Perspective Map - How to show View layer based on zoom?

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
image

2 Likes

what are you trying to do exactly?

me? helping you? xd

3 Likes

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

1 Like

oh persective MAP i see ups xD

2 Likes

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

2 Likes

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

1 Like

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.