ズームコントロール付きのGeoExtマップパネルがあります。setVisibility
マップ上のレイヤーが「範囲外」にある場合、つまりそれらがfalseに設定されている場合、ツリーパネルの一部のノードを無効にしたいのですが。ズームエンドイベントが機能していて、チェックチェンジイベントも機能していますが、ユーザーがズームバーを複数のレベルに押すと、チェックチェンジイベントが複数回評価されます。もう1つの問題は、ズームエンドイベントが終了した後もチェックチェンジが終了することです。ユーザーがノードのチェックボックスをオンまたはオフにするだけで起動します。このcheckchangeイベントを1回だけ実行し、ユーザーがズームバーを使用していない場合に発生しないように制御する方法が本当に必要です...
map.events.on({ "zoomend": function (e) {
layerTree.on("checkchange", function (node, checked) {
alert(node.text + "Inside event");
if(checked == false)
node.disable();
else if(checked == true)
node.enable();
});
if (this.getZoom() > 7) {
tib_villages.setVisibility(true);
tib_lakes.setVisibility(true);
tib_townships.setVisibility(true);
}
else {
tib_villages.setVisibility(false);
tib_lakes.setVisibility(false);
tib_townships.setVisibility(false);
if (this.getZoom() > 5) {
infrastructure.setVisibility(true);
geography.setVisibility(true);
geography2.setVisibility(true);
tib_countys.setVisibility(true);
}
else{
infrastructure.setVisibility(false);
geography.setVisibility(false);
geography2.setVisibility(false);
tib_countys.setVisibility(false);
}
}//end else
}//end function (e)
}); //end map.events.on
いつもありがとうございました:)
エルシェ