Layer: visible property cannot be used dynamically #9876
-
Linkhttps://deck.gl/docs/api-reference/core/layer#visible DescriptionMy requirement is to display the GeoJson polygon layer within the specified zoom range. After setting the variable property for visible and modifying the variable, the layer will not switch between display and hide in real time |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
use the layerFilter={(ctx) => {
const { layer } = ctx;
if (layer.id === 'HexagonLayer' && ctx.viewport.zoom >= 8) {
return false;
}
return true;
}} |
Beta Was this translation helpful? Give feedback.
-
Modifying a variable after it is used does not change the previous result. This is not how JavaScript works. See https://deck.gl/docs/developer-guide/using-layers#updating-layers if you want to change a layer's prop. |
Beta Was this translation helpful? Give feedback.
Modifying a variable after it is used does not change the previous result. This is not how JavaScript works.
See https://deck.gl/docs/developer-guide/using-layers#updating-layers if you want to change a layer's prop.