Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: fredxxx123 on November 21, 2012, 01:25:55 AM

Title: UIAnchor's PanelContainer question.
Post by: fredxxx123 on November 21, 2012, 01:25:55 AM
The code at UIAnchor.cs line 109...

  1. ...
  2. if (panelContainer.clipping == UIDrawCall.Clipping.None)
  3. {
  4.     // Panel has no clipping -- just use the screen's dimensions
  5.     float ratio = (mRoot != null) ? (float)mRoot.manualHeight / Screen.height * 0.5f : 0.5f;
  6.     rect.xMin = -Screen.width * ratio;
  7.     rect.yMin = -Screen.height * ratio;
  8.     rect.xMax = -rect.xMin;
  9.     rect.yMax = -rect.yMin;
  10. }...
  11.  

When calculate the 'ratio', it's need to check 'UIRoot.Automatic'? or not?
I try to check automatic, then the UIAnchor positioned right like i want.

  1. //float ratio = (mRoot != null) ? (float)mRoot.manualHeight / Screen.height * 0.5f : 0.5f;
  2. float ratio = (mRoot != null && !mRoot.automatic) ? (float)mRoot.manualHeight / Screen.height * 0.5f : 0.5f;
  3.  

and...sorry for my English.  :P
Title: Re: UIAnchor's PanelContainer question.
Post by: ArenMook on November 21, 2012, 01:50:57 AM
If it's set to 'automatic', the maunalHeight will always equal Screen.height, so the equation will result in 0.5 anyway. Your change doesn't do anything.
Title: Re: UIAnchor's PanelContainer question.
Post by: fredxxx123 on November 21, 2012, 03:28:57 AM
If it's set to 'automatic', the maunalHeight will always equal Screen.height, so the equation will result in 0.5 anyway. Your change doesn't do anything.

Hi!
It's might equal to Screen.height in old version.. not sure.
But i just update my NGUI to 2.2.6c today, and i trace the 'maunalHeight', either PlayMode or EditorMode, no one change the 'maunalHeight' if Automatic checked.

thanks :)