Perspective screen dynamic resize issue

Hi forum!

I have a Perspective view (default size 1920x1080, but doesn't really matter) where I use a *.png image as background and some led displays on top of it at specific locations; I have the root coordinate container configured in "percent" mode, and the picture itself as "fill". This works fine and, as I intend, the picture and leds are resized as required and shown fully on the user monitor.

Then, if I just change the container mode to "fixed" in the Designer and save the project, displayed size changes for the users, they now have a larger picture and scroll bars to move through it, but everything remains in place (i.e. the led displays remain on the required specific locations).

Now, if I try to perform the same change dynamically (include a button in the view, and script the same change with self.parent.props.mode = "fixed"), I don't get the same result: the picture resizes as before, but the led displays do not move, so they now fall in the wrong locations.

I've tried several modes for the root container and fit modes for the picture itself, but I'm kind of guessing...don't really know what I'm supposed to be doing, as the change I'm scripting -and doesn't work- is the same that works in the Designer. Any ideas?

Thanks and regards.

good notgood

For the coordinate container there is an aspectRatio prop. If you set this to 1920:1080 for exampe that should keep everything in place when resizing in percent mode. You may need to play around with the value to get what you want.

https://docs.inductiveautomation.com/display/DOC81/Perspective+-+Coordinate+Container

Thanks craigb! The "aspect ratio" parameter applies only when in "percent" mode, but that is the starting configuration of my view and works fine...it is when I switch to "fixed" mode when everything falls apart. Regards.

I see now, its as if switching between percent and fixed in the browser sets the default size and you cant go back until you save the designer again.

2 Likes

My suggestion is to not use a PNG or raster image at all. Use vector. You will get a far superior product

1 Like

Thanks nminchin! I understand and agree, but the png is not the problem in this case; the picture scales/resizes just fine...it is the native Perspective components (led displays) that don't!