Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: cruncher3019 on December 22, 2014, 12:06:15 PM
-
Hey guys, I couldn't find an answer to my issue so I'm making a thread for it here.
I have certain functionality that's depending on whether or not the scroll view is in place, or currently scrolling, and I have two issues/questions regarding this:
One - I couldn't find an already implemented way of knowing when a scroll view is no longer moving/being collided with by a touch. is there an easy way to check this that is already accessible?
Two - The 'offset' of the scrollView is how I dictate other functions to run. However, I have noticed that offset becomes inaccurate if you scroll off the Device/Editor screen and then let it spring back. Doing this usually makes the offset a few decimals off, but I need it to be exact all the time. is there a reset function I can call to fix this when it happens?
Thank you for all the help,
cruncher3019
-
1. UIScrollView.onDragFinished / UIScrollView.onStoppedMoving
2. Not sure what you mean by offset of the scroll view.
-
1. UIScrollView.onDragFinished / UIScrollView.onStoppedMoving
2. Not sure what you mean by offset of the scroll view.
1. Thank you.
2. Sorry, the offset I'm referring to is the "clipping offset". I get the x value of that offset and divide it by the cellWidth to get -1, 0, or 1.
The issue is that the offset is incorrect after it springs back, but only if you drag off of the game screen first and then let go of the object you're scrolling.
Instead of being 0, for example, it could become 7, even though the position of the scrollview is the same.
-
Clipping offset is used by the scroll view to move the contents while scrolling. I don't understand why you need to adjust it yourself? When the clipping offset gets adjusted by some value, the transform position gets adjusted by the inverse of that value.
-
I don't need to adjust the offset position. I use the offset position for my own calculations. The issue is that the offset is inaccurate.
If I drag and then let it spring back: When it stops, the offset would not be accurate. It'd be off by 3 - 7 pixels.
-
The offset it springs to is determined by the content of your scroll view and the scroll view panel's bounds + clipping border. There is no guarantee that 0 means "origin".