Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: greyhoundgames on January 29, 2015, 01:38:38 PM

Title: Can you have sprites that respect the minimum area while maintaining aspect rati
Post by: greyhoundgames on January 29, 2015, 01:38:38 PM
Consider a common case of a box with a stat icon in it. If you set the stat icon to be anchored to the box, and give it a basedOnWidth\height aspect ratio, as the box grows in a single dimension, the icon will either ignore it(ok, or grow with it spilling over the side in the other dimension). Is there a way to have something like size based on minimum of both width and height. Or an ability to put a sprite on free aspect ratio but then making the actual render be aspect ratio dependant still?

See the example for boxes with icons in them. The icons are set to based on width aspect ratio. As the box gets wider, the icons spill over the top.
Desired would be for them to respect both the width and height without getting distorted.

Title: Re: Can you have sprites that respect the minimum area while maintaining aspect rati
Post by: ArenMook on January 30, 2015, 02:47:36 PM
Nothing built-in, no. You'd need a script that picks the lowest of the two and resizes the sprite accordingly (or changes the anchors / aspect ratio source).
Title: Re: Can you have sprites that respect the minimum area while maintaining aspect rati
Post by: greyhoundgames on January 30, 2015, 03:20:13 PM
Ok thanks. I just wanted to say I appreciate how you are on here every day answering questions.
Title: Re: Can you have sprites that respect the minimum area while maintaining aspect rati
Post by: r.pedra on February 02, 2015, 05:27:14 AM
I know that UIStretch is deprecated but it's possible with it no? With FillKeepingRatio or FillInternalKeepingRatio it should work no?
Title: Re: Can you have sprites that respect the minimum area while maintaining aspect rati
Post by: ArenMook on February 03, 2015, 10:09:14 AM
Hmm... maybe. I haven't thought of that deprecated script in a while...