Author Topic: UIPanel/UIScrollview Position Reset  (Read 4742 times)

nguiman

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
UIPanel/UIScrollview Position Reset
« on: April 29, 2014, 12:26:36 AM »
I have a UIPanel/UIScrollview (w/Alpha Clipping), and a UIGrid under that with a number of UIDragScrollViews as children. The children are instantiated once, the details and active state are enabled/disabled in place at runtime (meaning they are not destroyed just disabled).

I've noticed when going from a long list to a short list, the overall size of the grid doesn't change resulting in the shorter list potentially being shown offscreen. For example...

I instantiate a list of 15 items. All 15 are active, the containing UIPanel is using 'Alpha Clipping' to show 5 items at a time. I scroll to the bottom. I then load up a list of 3 items by replacing the values of the first 3 items and making the remaining 12 inactive. The 3 items and collider are now inaccessible outside the clipping region.

translating the UIPanel/Scrollview Transform relocates the Grid, but breaks the clipping region as that moves as well.

How can I reset the position of the panel/scrollview for the shorter list?

also I'm using NGUI v3.0.7f2, but can't upgrade due to other dependencies.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIPanel/UIScrollview Position Reset
« Reply #1 on: April 29, 2014, 01:20:51 PM »
You need to ResetPosition() on the UIScrollView. However this advice is for the current version of NGUI. 3.0.7 is very old.

nguiman

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: UIPanel/UIScrollview Position Reset
« Reply #2 on: April 30, 2014, 03:13:08 PM »
Thanks!