Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: doppio on December 11, 2012, 07:05:09 PM

Title: UIDraggablePanel and Restrict Within Panel Issue
Post by: doppio on December 11, 2012, 07:05:09 PM
Hey,

I have a UIDraggablePanel which scrolls vertically. I have soft clipping at the edges of the screen, and I'm setting the clipping size to (0, 0) to fill the screen. Looks great when I manually move the contents of the draggable panel in the editor, but there's a problem when I use Restrict Within Panel which only occurs when my clipping size is (0, 0). Instead of entirely restricting the contents within the bounds, the bounds (indicated by the orange outline) cannot cross y=0. That is, the top of my content cannot go below the half-way mark on the screen. Likewise, the bottom of the content cannot go above y=0. If the contents of the panel are large enough, they can still extend beyond the edges of the panel.

Is this the expected behavior? Am I doing something wrong?

Thanks.
Title: Re: UIDraggablePanel and Restrict Within Panel Issue
Post by: ArenMook on December 12, 2012, 08:03:07 AM
Hum, I will look into this later. For now I suggest you create a script that will set the clipping size to that of the screen.width and screen.height -- I believe it should have the proper effect for what you are trying to achieve.
Title: Re: UIDraggablePanel and Restrict Within Panel Issue
Post by: doppio on December 12, 2012, 01:00:59 PM
No problem, thought that might be the case. Setting the clipping size to the screen size in Awake() does the job. Thanks. :)
Title: Re: UIDraggablePanel and Restrict Within Panel Issue
Post by: doppio on December 12, 2012, 02:17:37 PM
Possibly an unrelated issue, but it looks like this solution has a problem on an iPad 4. The screen height is being reported correctly by Screen.height, but the clipping area is far too large (by a factor of 2 or so?). Any thoughts on what might be causing this?
Title: Re: UIDraggablePanel and Restrict Within Panel Issue
Post by: ArenMook on December 12, 2012, 03:11:32 PM
UIRoot has a min and a max value on it by default. Be sure that the 'max' value reaches to iPad4's height: 1536 in landscape or 2048 in portrait mode.
Title: Re: UIDraggablePanel and Restrict Within Panel Issue
Post by: doppio on December 12, 2012, 03:33:02 PM
Ah-hah! That was it. Thanks!