PDA

View Full Version : maximizing a window and zoom extents in LUA (unity)



reikster
April 28th, 2021, 17:34
Hi,

Feeling like this is the right forum for specific LUA script questions. Apologies if I'm wrong.

I have only been testing with unity, but I have noticed that the wsx extenstion (window saver xtension) will not save a maximized screen and also it does not restore map images zoomed to extents for me.

I looked through the LUA reference and could not find either a maximize window or zoom to extents type function. I was thinking about tweaking wsx for my specific needs.

I am trying to have two unattended local client sessions restore maps controlled by me at the host session. One is for the stream(mostly for a remote player tbh), and the other is for local players to see. The second use case may go away once I get everyone migrated to using FG, but logistics have me not at the streaming PC.

The only weird caveat I might add (I don't think it should matter..but I could be wrong) is that both client machines are logged in as the free version with of course a different login than my main one, but they both have been logged in with my main login and full product key in the past so they have "remnants" of the full version in their install.

regards,

Eric

Moon Wizard
April 28th, 2021, 18:03
Yes, it's the right forum. :)

You'll have to ask the Window Saver X extension developer to look at adding something specific for images in background vs. images in floating windows. The image background panel is a special kind of panel window with a swappable internal frame; so it doesn't have the same ease of tracking as a regular window.

There is a zoomToFit API for image controls, but again that would need to be added after the panel window "restored".

Regards,
JPG

reikster
April 28th, 2021, 18:23
Thank you!

I'm happy tweaking the code myself and sharing it if it's something the wsx dev wants to add.
I may even just make a very specific extension of my own. I just started with the share function of wsx and it almost worked...
I have a few decades of coding experience(including python recently), but every new language and API has its challenge especially as one ages...
Mostly I was having trouble finding anything in the LUA reference. I'll search for the zoomToFit and see if I can find maximize.

eric

Moon Wizard
April 28th, 2021, 21:20
The zoomToFit API function is only available on the imagecontrol object (because that's the "view" onto any image data values).

Regards,
JPG

reikster
April 28th, 2021, 22:27
thank you!
is there an Atlassian link to lua api/objects for unity?
I found the one for classic somewhere, but I wasn't sure what if anything is new in unity.

Moon Wizard
April 28th, 2021, 22:28
https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996644285/Developer+Guide

Cheers,
JPG