summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/main/java/com/vaadin/client/widgets/Escalator.java24
1 files changed, 19 insertions, 5 deletions
diff --git a/client/src/main/java/com/vaadin/client/widgets/Escalator.java b/client/src/main/java/com/vaadin/client/widgets/Escalator.java
index da488e1153..f2b553007b 100644
--- a/client/src/main/java/com/vaadin/client/widgets/Escalator.java
+++ b/client/src/main/java/com/vaadin/client/widgets/Escalator.java
@@ -568,7 +568,6 @@ public class Escalator extends Widget
yMov.moveTouch(event);
xMov.validate(yMov);
yMov.validate(xMov);
- event.getNativeEvent().preventDefault();
moveScrollFromEvent(escalator, xMov.delta, yMov.delta,
event.getNativeEvent());
}
@@ -620,21 +619,36 @@ public class Escalator extends Widget
final double deltaX, final double deltaY,
final NativeEvent event) {
+ boolean scrollPosXChanged = false;
+ boolean scrollPosYChanged = false;
+
if (!Double.isNaN(deltaX)) {
+ double oldScrollPosX = escalator.horizontalScrollbar
+ .getScrollPos();
escalator.horizontalScrollbar.setScrollPosByDelta(deltaX);
+ if (oldScrollPosX != escalator.horizontalScrollbar
+ .getScrollPos()) {
+ scrollPosXChanged = true;
+ }
}
if (!Double.isNaN(deltaY)) {
+ double oldScrollPosY = escalator.verticalScrollbar
+ .getScrollPos();
escalator.verticalScrollbar.setScrollPosByDelta(deltaY);
+ if (oldScrollPosY != escalator.verticalScrollbar
+ .getScrollPos()) {
+ scrollPosYChanged = true;
+ }
}
/*
- * TODO: only prevent if not scrolled to end/bottom. Or no? UX team
- * needs to decide.
+ * Only prevent if internal scrolling happened. If there's no more
+ * room to scroll internally, allow the event to pass further.
*/
- final boolean warrantedYScroll = deltaY != 0
+ final boolean warrantedYScroll = deltaY != 0 && scrollPosYChanged
&& escalator.verticalScrollbar.showsScrollHandle();
- final boolean warrantedXScroll = deltaX != 0
+ final boolean warrantedXScroll = deltaX != 0 && scrollPosXChanged
&& escalator.horizontalScrollbar.showsScrollHandle();
if (warrantedYScroll || warrantedXScroll) {
event.preventDefault();