缩放时是否可以隐藏图层上的所有功能?我尝试将图层本身的可见性和不透明度属性设置为现在在缩放时显示。我还尝试将每个功能的样式设置为“无”,但它似乎不起作用。我试过这两种选择:
1.
function hideGraphicsFeatures(hide) {
if(hide) {
graphicsLayer.setVisible(false);
} else {
graphicsLayer.setVisible(true);
}
map.render();
}
2.
function hideGraphicsFeatures(hide) {
var features = graphicsLayer.getFeatures();
if(hide) {
for (var i = features.length - 1; i >= 0; i--) {
features[i].style.display = 'none';
};
} else {
for (var i = features.length - 1; i >= 0; i--) {
features[i].style.display = ''; // show. Set to anything but 'none'
};
}
map.render();
}