diff options
author | Artur Signell <artur@vaadin.com> | 2016-10-19 22:50:22 +0300 |
---|---|---|
committer | Pekka Hyvönen <pekka@vaadin.com> | 2016-12-09 09:39:00 +0200 |
commit | 97a75f1abcbd1c9001a7ff5b75713e3a913748cb (patch) | |
tree | 2b235993e96a42f63c2bfa989d8cc3a2d05776cc /client | |
parent | a30c614552d22f1b5817e0c2757fa05ab0df8736 (diff) | |
download | vaadin-framework-97a75f1abcbd1c9001a7ff5b75713e3a913748cb.tar.gz vaadin-framework-97a75f1abcbd1c9001a7ff5b75713e3a913748cb.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 c62c5f032f..2b615ebdb7 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 @@ -362,6 +362,7 @@ public abstract class ScrollbarBundle implements DeferredWorker { private HandlerRegistration scrollSizeTemporaryScrollHandler; private HandlerRegistration offsetSizeTemporaryScrollHandler; + private HandlerRegistration scrollInProgress; private ScrollbarBundle() { root.appendChild(scrollSizeElement); @@ -523,6 +524,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(); } @@ -911,6 +922,6 @@ public abstract class ScrollbarBundle implements DeferredWorker { // requestAnimationFrame - which is not automatically checked return scrollSizeTemporaryScrollHandler != null || offsetSizeTemporaryScrollHandler != null - || scrollEventFirer.isBeingFired; + || scrollInProgress != null || scrollEventFirer.isBeingFired; } } |