diff options
author | Artur Signell <artur@vaadin.com> | 2016-10-19 22:50:22 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2016-10-20 05:11:35 +0000 |
commit | 82a001d2dc4e9e207e26107b6a31d6619ba6e7a4 (patch) | |
tree | 86d1737483fe05137df4b1c2f250463ae8adc095 /client | |
parent | fd8130ed6e6f93ced6ee1c7576efde31b9f768c0 (diff) | |
download | vaadin-framework-82a001d2dc4e9e207e26107b6a31d6619ba6e7a4.tar.gz vaadin-framework-82a001d2dc4e9e207e26107b6a31d6619ba6e7a4.zip |
Make Grid isWorkPending wait for scroll events to complete (#20417)
Change-Id: I3cfdac539111ff2e88c7ff81e6d6b9a579160423
Diffstat (limited to 'client')
-rw-r--r-- | client/src/main/java/com/vaadin/client/widget/escalator/ScrollbarBundle.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/client/src/main/java/com/vaadin/client/widget/escalator/ScrollbarBundle.java b/client/src/main/java/com/vaadin/client/widget/escalator/ScrollbarBundle.java index c8bc8462e9..6e2fb14f8f 100644 --- a/client/src/main/java/com/vaadin/client/widget/escalator/ScrollbarBundle.java +++ b/client/src/main/java/com/vaadin/client/widget/escalator/ScrollbarBundle.java @@ -368,6 +368,7 @@ public abstract class ScrollbarBundle implements DeferredWorker { private HandlerRegistration scrollSizeTemporaryScrollHandler; private HandlerRegistration offsetSizeTemporaryScrollHandler; + private HandlerRegistration scrollInProgress; private ScrollbarBundle() { root.appendChild(scrollSizeElement); @@ -530,6 +531,16 @@ public abstract class ScrollbarBundle implements DeferredWorker { scrollPos = Math.max(0, Math.min(maxScrollPos, truncate(px))); if (!WidgetUtil.pixelValuesEqual(oldScrollPos, scrollPos)) { + if (scrollInProgress == null) { + // Only used for tracking that there is "workPending" + scrollInProgress = addScrollHandler(new ScrollHandler() { + @Override + public void onScroll(ScrollEvent event) { + scrollInProgress.removeHandler(); + scrollInProgress = null; + } + }); + } if (isInvisibleScrollbar) { invisibleScrollbarTemporaryResizer.show(); } @@ -919,6 +930,6 @@ public abstract class ScrollbarBundle implements DeferredWorker { // requestAnimationFrame - which is not automatically checked return scrollSizeTemporaryScrollHandler != null || offsetSizeTemporaryScrollHandler != null - || scrollEventFirer.isBeingFired; + || scrollInProgress != null || scrollEventFirer.isBeingFired; } } |