1
NGUI 3 Support / Little polish on UIScrollView
« on: June 05, 2014, 10:26:41 AM »
Hi,
Just to submit a little polish proposition on UIScrollView, that I've just done myself for my needs; in case Momentum is chosen (with unrestricted movements), I think the scroll view should not stop immediately if the bound is met in one of the direction ; it should continue in the direction which still has space to move.
I did it very simply in RestrictWithinBounds with:
Instead of
I guess it's not totally clean, but it seems to work.
Another suggestion for MomentumAndSpring would be to allow the user to select the strenght of the force that prevent the user to drag the view too far from the bound (which is currently determined by a hard coded 0.5f).
Just to submit a little polish proposition on UIScrollView, that I've just done myself for my needs; in case Momentum is chosen (with unrestricted movements), I think the scroll view should not stop immediately if the bound is met in one of the direction ; it should continue in the direction which still has space to move.
I did it very simply in RestrictWithinBounds with:
- if(Mathf.Abs(constraint.x) > 1f)
- mMomentum.x = 0;
- if(Mathf.Abs(constraint.y) > 1f)
- mMomentum.y = 0;
- if(Mathf.Abs(constraint.z) > 1f)
- mMomentum.z = 0;
Instead of
- mMomentum = Vector3.zero;
I guess it's not totally clean, but it seems to work.
Another suggestion for MomentumAndSpring would be to allow the user to select the strenght of the force that prevent the user to drag the view too far from the bound (which is currently determined by a hard coded 0.5f).