Author Topic: [solved]Scoll View Panel click item = center item  (Read 4469 times)

laurentl

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 188
    • View Profile
    • McDROID
[solved]Scoll View Panel click item = center item
« 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.
« Last Edit: April 06, 2013, 06:32:00 PM by Nicki »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scoll View Panel click item = center item
« Reply #1 on: April 05, 2013, 11:11:12 PM »
The same way skyrim UI example works? SpringPanel.Begin to your destination.

laurentl

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 188
    • View Profile
    • McDROID
Re: [solved]Scoll View Panel click item = center item
« Reply #2 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.


Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: [solved]Scoll View Panel click item = center item
« Reply #3 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.

wana7262

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: [solved]Scoll View Panel click item = center item
« Reply #4 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

wana7262

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: [solved]Scoll View Panel click item = center item
« Reply #5 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.         }


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: [solved]Scoll View Panel click item = center item
« Reply #6 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);

wana7262

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: [solved]Scoll View Panel click item = center item
« Reply #7 on: June 07, 2013, 01:01:36 AM »
Thanks working Now :)