도움이 되었습니까?

해결책

그것을 알아 냈습니다! onBeforeComputer ();메소드는 모든 것을 계산하기 전에 선택한 노드의 작업을 수행합니다.아래 코드 참조 :

//sets the selected node depth as the .currentParentDepth
onBeforeCompute : function(node){
    if (typeof this.currentParentDepth === "undefined") {
        this.currentParentDepth = 0;
    }
    else {
        this.currentParentDepth = node._depth; 
    }
},

onPlaceLabel: function(domElement, node){
    if (this.currentParentDepth == 0) {
        if (node._depth > 1) {
            domElement.style.display = 'none';
        } else {
            domElement.style.display = '';          
        }
    } else if (this.currentParentDepth == 1) {
        if (node._depth > 2) {
            domElement.style.display = 'none';
        } else {
            domElement.style.display = '';          
        }           
    }
}
.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top