Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: wizardsmoke on June 29, 2016, 07:49:55 AM

Title: Bug: UIPopupList position bug when the panel is offset from the panel's parent
Post by: wizardsmoke on June 29, 2016, 07:49:55 AM
I found a bug in UIPopupList that occurs when the hierarchy looks something like this:

UIRoot
  PanelParent (empty GameObject)
    UIPanel
      UIPopupList

There is a bit of code in UIPopupList.Show() that causes the position of the popup's generated "Drop-down" object to be based on the panel's parent even though the "Drop-down" object is still a child of the panel.  This causes a problem if the panel's local position is not (0,0,0).

This issue can be reproduced in Example 0 by rearranging your hierarchy as described.  I used a game window that was sized around 1920x1080, with the panel's parent anchored to the top-left corner of the screen.  The panel's clipping option was set to None.  With this setup, the popup works fine if the panel and popup are in the top-left quadrant of the screen.  If you move the panel (along with the popup) over to the bottom-right quadrant of the screen, you will see that the popup's "Drop-down" object will be constrained to the top-left quadrant of the screen.

Commenting out this code near the end of UIPopupList.Show() fixed this issue for me:

  1.                         Transform pt = mPanel.cachedTransform.parent;
  2.  
  3.                         if (pt != null)
  4.                         {
  5.                                 min = mPanel.cachedTransform.TransformPoint(min);
  6.                                 max = mPanel.cachedTransform.TransformPoint(max);
  7.                                 min = pt.InverseTransformPoint(min);
  8.                                 max = pt.InverseTransformPoint(max);
  9.                         }
  10.  
Title: Re: Bug: UIPopupList position bug when the panel is offset from the panel's parent
Post by: ArenMook on July 01, 2016, 10:16:46 PM
Hmm... Thanks, I'll make the modifications on my end and see if this will cause any adverse effects.