Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: yuriks on October 24, 2013, 10:56:53 AM

Title: [BUG] Incorrect minsize on sliced sprites with pixelSize != 1 (Has fix)
Post by: yuriks on October 24, 2013, 10:56:53 AM
When you have a sliced sprite that uses an atlas with Pixel Size set to something other than 1 the minimum allowed size of the sprite doesn't take that into account and is calculated incorrectly.

For example, if my atlas has a sliced sprite with 32px borders, and has pixel size set to 0.5. Instead of the minimum width/height being 32 (16+16 for each border), it will be 64 (32+32 for each border) even though the borders as rendered are only 16px wide. This means you can't make the sprites as small as you'd like, which is specially a problem for progress bars.

Fix is to edit lines 252 and 269 in UISprite.cs and change
  1. Vector4 b = border;
to
  1. Vector4 b = border * atlas.pixelSize;
Title: Re: [BUG] Incorrect minsize on sliced sprites with pixelSize != 1 (Has fix)
Post by: ArenMook on October 24, 2013, 11:51:40 PM
Seems reasonable, thanks.