Can I show/hide a View layer (props.layers.ui.view
) based on zoom? (Other that passing the zoom as a param to the view and hiding it in the view itself)
hell @nminchin I am trying to do something similar. Could you do it?
not sure what he ment with zoom but you can create styleclass mediaquery. when the view exceeds a certain width (so zoom?) it will activate
ive used something like this before for a label. Unfortunalty there is no display
style in the designer , so i just turned it invisible.
if thats not enough you will have to use theme.css in addition to this to also do display:none
what are you trying to do exactly?
me? helping you? xd
Zoom as in the mapâs zoom level. This isnât exposed as a property as such, but you can expose it as a property by using an on change script to write the current zoom level into a custom prop (a bit vague, but I donât have it in front of me). Media queries wonât help you/me here
oh persective MAP i see ups xD
I think from memory I just ended up passing in the mapâs zoom level into the template and I handled it in the template View⌠itâs not ideal but it works
I have this solution:
1-I have created a custom property âcuurentZoomâ on the map.
2-in the âonZoomâ event of the map put:
self.custom.currentZoom = event.zoom
self.refreshBinding (âprops.layers.ui.viewâ)
3-finally in UI view put a view based on currentZoom
if zoom<13:
view 1
else:
view 2
thanks you
Another solution is to use a binding on the path that would refer to an empty view (coordinate container with height and width set at 0) when the view is supposed to be hidden. I guess that's not ideal either since it would mean the view gets re-rendered everytime the zoom changes.