Author Topic: Bugfix for wrong UIPopupList drop-down colliders  (Read 2623 times)

veblush

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Bugfix for wrong UIPopupList drop-down colliders
« on: June 26, 2014, 02:43:07 AM »
Hello, there.

With NGUI 3.6.5, UIPopupList may generate wrong sized colliders for drop-down list items.
Even though UIPopupList.OnClick() works well for calculating size of collider,
NGUITools.AddWidgetCollider set autoResizeBoxCollider true and makes size fit with contents of item. (padding size missed!)

I've just fixed this bug as following.
Please consider it for next release.

  1. --- UIPopupList.cs      (revision 4859)
  2. +++ UIPopupList.cs      (revision 4860)
  3. @@ -767,7 +767,9 @@
  4.                         for (int i = 0, imax = labels.Count; i < imax; ++i)
  5.                         {
  6.                                 UILabel lbl = labels[i];
  7. -                               NGUITools.AddWidgetCollider(lbl.gameObject);
  8. +                               NGUITools.AddWidgetCollider(lbl.gameObject);
  9. +                               lbl.autoResizeBoxCollider = false;
  10. +
  11.  

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Bugfix for wrong UIPopupList drop-down colliders
« Reply #1 on: June 26, 2014, 11:11:10 AM »
Thanks, I will add your change.

ludos1978

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Bugfix for wrong UIPopupList drop-down colliders
« Reply #2 on: October 09, 2014, 06:10:19 AM »
This fix messes UIPopupList up in other situations. I am using UIPopupList in conjunction with a uiInput as autocompletion suggestions.

For me it requires this additional fix, but im unsure wether it works for other situations as well:

change line 850 in UIPopupList.cs:
         Vector3 bcCenter = new Vector3(cx * 0.5f, -fontHeight * 0.5f, 0f);

to:
         Vector3 bcCenter = new Vector3(cx * 0.5f, -labelHeight * 0.5f, 0f);


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Bugfix for wrong UIPopupList drop-down colliders
« Reply #3 on: October 10, 2014, 02:25:09 AM »
I'll change it and see if it breaks anything on my end.