1
NGUI 3 Support / UIPopupList popup isn't sizing and positioning correctly
« on: November 21, 2014, 04:44:04 AM »
I'm creating a dropdown menu following the example scene's popup list, using my own sprites and font
Problem 1: dropdown sizing
the width of the dropdown is smaller than the original button that spawned the dropdown. Digging through the code, I found this line:
The problem seems to stem from dynScale being indirectly calculated to be less than 1, from its activeFontScale assignment where it's stated to be fontSize / bitmapFont.defaultSize if a bitmap font is specified. The problem doesn't appear in the example scene because the dropdown font is native sized, but I have a big font that I've scaled down a bit. I hope I don't have to create another smaller font atlas to work around this
Problem 2: dropdown positioning
Seems like if the list is just a bit longer (say maybe 10 values or more), the dropdown will be positioned further down and no longer adjacent to its spawning button, even if it wouldn't go beyond the bottom of the window if positioned correctly. This happens in the example project if I add more options to either one of the example popup lists.
Am I missing something, or are these actual bugs?
Thanks for any help!
Problem 1: dropdown sizing
the width of the dropdown is smaller than the original button that spawned the dropdown. Digging through the code, I found this line:
- // The triggering widget's width should be the minimum allowed width
- x = Mathf.Max(x, bounds.size.x * dynScale - (bgPadding.x + padding.x) * 2f);
The problem seems to stem from dynScale being indirectly calculated to be less than 1, from its activeFontScale assignment where it's stated to be fontSize / bitmapFont.defaultSize if a bitmap font is specified. The problem doesn't appear in the example scene because the dropdown font is native sized, but I have a big font that I've scaled down a bit. I hope I don't have to create another smaller font atlas to work around this

Problem 2: dropdown positioning
Seems like if the list is just a bit longer (say maybe 10 values or more), the dropdown will be positioned further down and no longer adjacent to its spawning button, even if it wouldn't go beyond the bottom of the window if positioned correctly. This happens in the example project if I add more options to either one of the example popup lists.
Am I missing something, or are these actual bugs?
Thanks for any help!