I’m using the map component in Ignition 8.1 and I’m trying to overlay a view, and change it’s size with the zoomlevel, so I can zoom ‘into’ and ‘out’ of the UI view layer. I have an XY coordinate view set to percent, with height/width bound to input parameters height/width. I have the tiles turned off (maybe that’s my problem…)
I have params under my ui > view > for height and width.
**Initial issue: ** When running a session, before clicking in the map area, it renders the view in some sort of square - if I set my background image to ‘fill’, it’s square in its aspect ratio. As soon as I click (even on a separate component) or drag in the map, it refreshes and renders properly. Any idea how to force this? I looked into simulating mouse click… I tried grabbing focus on startup, no dice.
In trying to zoom the embedded view UI layer - When I change the height/widths params, they seem to either lag behind one update of the zoom:
ie: I change height from 1200 to 1100. The view shrinks. I change from 1100 to 1000, it shrinks. I change from 1000 back to 1100, it shrinks again. I change from 1100 to 1200, it grows back to ‘1100’
I figured out a workaround for this but it’s pretty gross. I added a custom parameter, bound to toMilli(now(10)) …why:
The embedded view display - size seemed to only evaluate correctly when a parameter was changed AFTER zoom resolved completely. not when a zoom event fired. I tried updating a parameter on the onZoomEnd and it didn’t work. It would work if I update a parameter on MouseMove … so the zoom would happen, view doesn’t change - as soon as I moved my mouse the parameter updates and the embedded view renders with it’s ‘new’ width/height.
So okay, I have it rendering properly when a custom parameter changes, but there was no event I could find that would tigger properly after zooming. Hence the timer. Zoom occurs, 10ms later, my custom param has changed and the view size resolves.
Doesn’t seem to cause to much performance decrease so I think it’s just resolving the new view size once. Would love a better solution but for now this gets the job done.
I am trying to do something similar.
How to change the size of the view depending on the zoom?
a solution for this is to put bounds on the view, but I still can’t find how to do it.