Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: laurentl on April 05, 2013, 06:35:38 PM

Title: [solved]Scoll View Panel click item = center item
Post by: laurentl on April 05, 2013, 06:35:38 PM
How would I change the scroll view (panel) example so when I click on an item it centers it ?
Thanks.
Title: Re: Scoll View Panel click item = center item
Post by: ArenMook on April 05, 2013, 11:11:12 PM
The same way skyrim UI example works? SpringPanel.Begin to your destination.
Title: Re: [solved]Scoll View Panel click item = center item
Post by: laurentl on April 06, 2013, 06:58:32 PM
I placed  SpringPanel.Begin in my event handler, when the item is clicked,  SpringPanel.Begin(gameObject) is called. Where gameObject is the item I clicked (the topmost one that contains UIDragPanelContent).
What happens then is item disappears, it seems to be moved to some place in the drag list, which is not what I want so let me clarify what I want:

I have a scroll list.
When I click on an item I want the list to scroll until this item is at the center of the drag zone.

Title: Re: [solved]Scoll View Panel click item = center item
Post by: Nicki on April 07, 2013, 09:29:17 AM
You have to put the springpanel.begin on your clipping panel's gameobject and I think you also have to offset the cliprange opposite so the clipping area stays in the same place on the screen.
Title: Re: [solved]Scoll View Panel click item = center item
Post by: wana7262 on June 06, 2013, 12:06:15 AM
how can i do it?
any noob help? i am using the sample scroll panel...i want to center the panel content on click..help plz
Title: Re: [solved]Scoll View Panel click item = center item
Post by: wana7262 on June 06, 2013, 12:55:46 AM
i used this method but when i click on any item it move upwards
  1. void OnClick()
  2.         {
  3.                
  4.                 SpringPanel.Begin(dragPanel.gameObject, -transform.localPosition, 8f);
  5.         }

Title: Re: [solved]Scoll View Panel click item = center item
Post by: ArenMook on June 06, 2013, 07:37:34 AM
So eliminate the Y from your target?

  1. SpringPanel.Begin(dragPanel.gameObject new Vector3(transform.localPosition.x, 0f, 0f), 8f);
Title: Re: [solved]Scoll View Panel click item = center item
Post by: wana7262 on June 07, 2013, 01:01:36 AM
Thanks working Now :)