Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: serioustommy on May 23, 2012, 09:02:42 AM

Title: UIDraggablePanel.ResetPosition modifying clipping position
Post by: serioustommy on May 23, 2012, 09:02:42 AM
I don't really understand but there's probably a reason why by calling ResetPosition it attempts to move the clipping region of the UIPanel.

However I need to be able to reset the draggable content positions after adding them to the panel without modifying the panel's clipping region. Since the contents are buttons that scale up when moused over, the buttons then go out of the moved clipping region causing them to be clipped. They also get moved in the x axis even though the x scale is set to 0 just so they get moved back into the clipping region.

Is there anyway to add a boolean parameter to ResetPosition so it leaves the clipping region alone?
Title: Re: UIDraggablePanel.ResetPosition modifying clipping position
Post by: ArenMook on May 23, 2012, 09:47:54 AM
The way UIDraggablePanel works is it moves the clipping region instead of the widgets (the widgets stay in place). This way the buffers for the widgets don't need to be rebuilt. ResetPosition reverts the offset that resulted from dragging the panel.

Are you adding stuff to the panel dynamically? You need to reset the position before and after adding stuff.
Title: Re: UIDraggablePanel.ResetPosition modifying clipping position
Post by: serioustommy on May 23, 2012, 11:09:09 AM
Thanks for the reply.

What you said makes sense to me, but it seems like ResetPosition changes x even if scale x has been set to 0. Could that be a bug? I tried calling ResetPosition both before adding the dynamic widgets as well as after but it doesn't seem to make a difference.

Here's a few images which might help:

Before adding widgets to the panel:
(http://i.imgur.com/p267E.png)

after adding widgets to the panel, notice the pink rectangle moves to the right so it aligns with the left side of the widgets:
(http://i.imgur.com/tPUJp.png)

mouse over the second button causing the button to be clipped on the left (notice that the red rectangle is now outside of the pink):
(http://i.imgur.com/XCQYC.png)

Thanks again for any help you can provide!
Title: Re: UIDraggablePanel.ResetPosition modifying clipping position
Post by: ArenMook on May 23, 2012, 11:40:22 AM
You are using the latest version, right?
Title: Re: UIDraggablePanel.ResetPosition modifying clipping position
Post by: serioustommy on May 23, 2012, 11:48:48 AM
yeah just updated to 2.07 this morning in fact.

So if I don't call ResetPosition then the clipping rectangle stays the same. The only problem is just that the added widget won't be in the correct default position. So basically I'm just looking for a way to reset the position without the clipping region getting moved.
Title: Re: UIDraggablePanel.ResetPosition modifying clipping position
Post by: ArenMook on May 23, 2012, 12:04:16 PM
Just set the X value of "Relative Position On Reset" to 0.5.
Title: Re: UIDraggablePanel.ResetPosition modifying clipping position
Post by: serioustommy on May 23, 2012, 12:59:09 PM
Ah thanks that works.

However instinctively I thought the clipping region should only be moved when "Reposition Clipping" is clicked, and not when ResetPosition() is called which I thought should just reset the position of the contents. Maybe a ResetContentPosition() that does just that in the future? Just a suggestion :)

thanks again for the help.
Title: Re: UIDraggablePanel.ResetPosition modifying clipping position
Post by: Dauntless on September 21, 2013, 08:56:04 AM
I am having the same problem.  When I click my ScrollBar the clipping plane shifts to the right?.  Can you please tell me how did you fix this?
Title: Re: UIDraggablePanel.ResetPosition modifying clipping position
Post by: ArenMook on September 21, 2013, 07:25:31 PM
http://www.youtube.com/watch?v=OiA4o8KqBFI