royibernthal Posted September 11, 2017 Share Posted September 11, 2017 When using Adaptive scaling, GUI calculates the final positioning and dimensions of controls according to idealWidth / idealHeight. When the stage scale is adapted, the width and height of controls returns scaled values. Is there a way to retrieve the original values (before adaptive scaling is applied)? Lately I found the need for that when setting dimensions during play - to do that I need to set the ideal values which will later be scaled by GUI. For instance, at a certain event I need to change the children of a container and then change the width of the container to be the sum of all its children's widths. When the stage is rendered at its ideal size there's no problem, however when it is scaled, the widths returned by the controls are scaled as well, and after setting the container's width to the already scaled sum of the childrens' widths, it is then scaled again by the GUI (as expected). How can I access the original values before adaptive scaling is applied? I guess I can create some util function to take into consideration current scale vs ideal, but it can make things cumbersome (especially when dealing with many such cases). Is there by any chance a built-in solution? If not, it'd be great to have something like "original" object property in controls containing the original values like: { x, y, width, height } Or alternatively parameters like width and height in controls can return the original values, which seems to me more practical (unless there are use cases I'm missing). This way or another, it'd be great to be able to get and set both the original and adapted values of controls. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 12, 2017 Share Posted September 12, 2017 You can still reference the private property with control._width for instance and get the value with control._width.internalValue royibernthal 1 Quote Link to comment Share on other sites More sharing options...
royibernthal Posted September 12, 2017 Author Share Posted September 12, 2017 Got it, thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.