Author Topic: UIAnchor's PanelContainer question.  (Read 3326 times)

fredxxx123

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
UIAnchor's PanelContainer question.
« 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

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIAnchor's PanelContainer question.
« Reply #1 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.

fredxxx123

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: UIAnchor's PanelContainer question.
« Reply #2 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 :)