// event.stopPropagation();
}
} else {
- // TODO cancel, user expects a gesture ?
+ /*
+ * Touch scroll is currenly on (possibly bouncing). Ignore.
+ */
}
}
}-*/;
private void onTransitionEnd() {
- if (handlerRegistration == null) {
- if (finalScrollTop < 0) {
- animateToScrollPosition(0, finalScrollTop);
- finalScrollTop = 0;
- } else if (finalScrollTop > getMaxFinalY()) {
- animateToScrollPosition(getMaxFinalY(), finalScrollTop);
- finalScrollTop = getMaxFinalY();
- } else {
- moveTransformationToScrolloffset();
- }
+ if (finalScrollTop < 0) {
+ animateToScrollPosition(0, finalScrollTop);
+ finalScrollTop = 0;
+ } else if (finalScrollTop > getMaxFinalY()) {
+ animateToScrollPosition(getMaxFinalY(), finalScrollTop);
+ finalScrollTop = getMaxFinalY();
+ } else {
+ moveTransformationToScrolloffset();
}
+ transitionOn = false;
}
private void animateToScrollPosition(int to, int from) {
}
private int getAnimationTimeForDistance(int dist) {
- if (dist < 0) {
- dist = -dist;
- }
- return MAX_DURATION * dist / (scrolledElement.getClientHeight() * 3);
+ return 350; // 350ms seems to work quite fine for all distances
+// if (dist < 0) {
+// dist = -dist;
+// }
+// return MAX_DURATION * dist / (scrolledElement.getClientHeight() * 3);
}
/**
}
scrolledElement.setScrollTop(finalScrollTop);
activeScrollDelegate = null;
+ handlerRegistration.removeHandler();
+ handlerRegistration = null;
+
}
/**
}
private void onTouchEnd(NativeEvent event) {
- // event.preventDefault();
- // event.stopPropagation();
- handlerRegistration.removeHandler();
- handlerRegistration = null;
if (!moved) {
activeScrollDelegate = null;
+ handlerRegistration.removeHandler();
+ handlerRegistration = null;
return;
}
moveTransformationToScrolloffset();
return;
}
+
int translateY = -finalY + origScrollTop;
translateTo(duration, translateY);
}
}
public void onPreviewNativeEvent(NativePreviewEvent event) {
+ if(transitionOn) {
+ /*
+ * TODO allow starting new events. See issue in onTouchStart
+ */
+ event.cancel();
+ return;
+ }
int typeInt = event.getTypeInt();
switch (typeInt) {
case Event.ONTOUCHMOVE: