Author Topic: Issues tweening the position, width or height of a scrollview  (Read 1875 times)

briangibson

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 26
    • View Profile
Potential bug: Today I noticed that if I have scrollbars attached to a UIScrollView, if i call TweenPosition, TweenWidth or TweenHeight on the master widget that the scrollview's panel is anchored to, on the first call to update during the tween, the grid items in the scrollview will jump. If i don't have the scrollbars attached to a scrollview, i don't have this problem.

Potential feature request: I also had to modify one of the tween scripts to add scrollView.RestrictWithinBounds(true); so that when I tween a scrollview, the contents stay within the view bounds. I wonder if it'd be useful to have an onUpdate callback delegate in these tweens so that the user doesn't need to modify the scripts to add additional functionality during the Tween OnUpdate calls.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Issues tweening the position, width or height of a scrollview
« Reply #1 on: April 26, 2014, 03:28:12 PM »
You need to ResetPosition() on your scroll view yourself at some point. Without it, it only happens when you resize it (such as by using your tweens). Also make sure you have the latest version of NGUI.

The resetting occurs because of anchors, not tweens.

briangibson

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 26
    • View Profile
Re: Issues tweening the position, width or height of a scrollview
« Reply #2 on: April 27, 2014, 12:06:32 PM »
the whole point is that i _dont_ want it to reset the position, but it was doing it without me asking it to, when I start a tween, if i have scrollbars attached.

Why would I want it to reset the scrollview contents when I start a tween? If I understand correctly, that'll just force it to cause an ugly glitch every time i tween. My solution of modifying the Tween script to call RestrictWithinBounds every frame during a tween allows me to not call ResetPosition but smoothly keep the scrollview contents within the rect.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Issues tweening the position, width or height of a scrollview
« Reply #3 on: April 27, 2014, 11:58:44 PM »
I don't see any jumping happening in the drag & drop example. So my question stands -- what version of NGUI are you using and if it's the latest, how can I reproduce it on my end?