diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/widgets/Escalator.java | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/client/src/com/vaadin/client/widgets/Escalator.java b/client/src/com/vaadin/client/widgets/Escalator.java index 3e08cc1f1f..1bb3fe3747 100644 --- a/client/src/com/vaadin/client/widgets/Escalator.java +++ b/client/src/com/vaadin/client/widgets/Escalator.java @@ -803,7 +803,24 @@ public class Escalator extends Widget implements RequiresResize, return $entry(function(e) { var deltaX = e.deltaX ? e.deltaX : -0.5*e.wheelDeltaX; var deltaY = e.deltaY ? e.deltaY : -0.5*e.wheelDeltaY; - + + // Delta mode 0 is in pixels; we don't need to do anything... + + // A delta mode of 1 means we're scrolling by lines instead of pixels + // We need to scale the number of lines by the default line height + if(e.deltaMode === 1) { + var brc = esc.@com.vaadin.client.widgets.Escalator::body; + deltaY *= brc.@com.vaadin.client.widgets.Escalator.AbstractRowContainer::getDefaultRowHeight()(); + } + + // Other delta modes aren't supported + if((e.deltaMode !== undefined) && (e.deltaMode >= 2 || e.deltaMode < 0)) { + var msg = "Unsupported wheel delta mode \"" + e.deltaMode + "\""; + + // Print warning message + esc.@com.vaadin.client.widgets.Escalator::logWarning(*)(msg); + } + // IE8 has only delta y if (isNaN(deltaY)) { deltaY = -0.5*e.wheelDelta; @@ -6700,4 +6717,8 @@ public class Escalator extends Widget implements RequiresResize, private String getSubPartNameSpacer(Element subElement) { return body.spacerContainer.getSubPartName(subElement); } + + private void logWarning(String message) { + getLogger().warning(message); + } } |