Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: aammfe on October 26, 2016, 08:31:30 AM

Title: Scroll View List-View effect
Post by: aammfe on October 26, 2016, 08:31:30 AM
Hi!
Scroll view have one child size(100,100) .
when scroll this child to bottom it remain in bottom and do not go to top again.
 
i have attach an animation , it have two examples first , NGUI , and second is UGUI , and UGUI is working as it is , as supposed to , (changed pivot.y = 1).
how to do it in NGUI.

https://we.tl/fV0LBUQlHa (https://we.tl/fV0LBUQlHa)


 
Title: Re: Scroll View List-View effect
Post by: artfabrique on October 28, 2016, 06:00:53 AM
There is an option called "cancel drag if it fits"
I think that is what you need.
Title: Re: Scroll View List-View effect
Post by: aammfe on October 28, 2016, 06:53:38 AM
i have attached other script , for scrolling events , link pull up , and pull down , etc ,
if
 "Cancel Drag if Fits = true"
it stop scrolling means , use could not pull down , etc
Title: Re: Scroll View List-View effect
Post by: ArenMook on October 30, 2016, 12:25:07 PM
Cancel drag if fits will prevent dragging of the scroll view if the contents don't get clipped by its dimensions. Are you trying to make it spring back to top when you release the drag? If so, check the UICenterOnClick script. It shows the short amount of code you need to move the scroll view to a position of your choice. So if you wanted it to move back up to top when you release the touch, subscribe to UIScrollView.onDragFinished, and inside call SpringPanel.Begin with where you want it to move to.
Title: Re: Scroll View List-View effect
Post by: aammfe on October 30, 2016, 03:50:56 PM
UICenterOnClick

UIScrollView sv = panel.GetComponent<UIScrollView>();
         Vector3 offset = -panel.cachedTransform.InverseTransformPoint(transform.position);
         if (!sv.canMoveHorizontally) offset.x = panel.cachedTransform.localPosition.x;
         if (!sv.canMoveVertically) offset.y = panel.cachedTransform.localPosition.y;
         SpringPanel.Begin(panel.cachedGameObject, offset, 6f);


i could not figure out how i will use it in my case , ..?
Title: Re: Scroll View List-View effect
Post by: ArenMook on November 03, 2016, 08:03:37 AM
SpringPanel.Begin lets you spring the panel to the target position. Calculate the position you want, then SpringPanel.Begin to navigate there. As I said, you will want to subscribe to the onDragFinished, and do it there.