Skip to content

Commit e609fb4

Browse files
committed
smoother drag of uiscrollview
1 parent b7648c4 commit e609fb4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cmioslayer/src/main/java/crossmobile/ios/uikit/UIScrollView.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,10 @@ public void exec(UIGestureRecognizer arg) {
126126
double x = calculateNewPosition(-transl.getX(), contentSize.getWidth() + contentInset.getLeft() + contentInset.getRight() - getWidth(), shouldSpring);
127127
double y = calculateNewPosition(-transl.getY(), contentSize.getHeight() + contentInset.getTop() + contentInset.getBottom() - getHeight(), shouldSpring);
128128
if (pan.state() != UIGestureRecognizerState.Ended) { // UIGestureRecognizerState.Changed
129-
if (Math.sqrt(Math.pow(contentOffset.getX() - x, 2) + Math.pow(contentOffset.getY() - y, 2)) > SELECTION_THRESHOLD) {
130-
// Dragging
129+
if (dragging)
130+
setContentOffset(x, y); // no special animation
131+
else if (Math.sqrt(Math.pow(contentOffset.getX() - x, 2) + Math.pow(contentOffset.getY() - y, 2)) > SELECTION_THRESHOLD) {
132+
// Set dragging mode, disable component click mode
131133
invalidateTimers();
132134
touchesCancelled(arg.touchList, arg.touchEvent);
133135
dragging = true;

0 commit comments

Comments
 (0)