diff options
author | Anna Koskinen <Ansku@users.noreply.github.com> | 2020-07-09 13:54:46 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-09 13:54:46 +0300 |
commit | a17348081abf87cb0d42bef4ae4faac3c8fd6c72 (patch) | |
tree | 9e8197ccb448cf7ae97137cdf94bb936ac173f91 /client/src | |
parent | d1e6c704fd25a426d5956e521b0903910d7cb4cb (diff) | |
download | vaadin-framework-a17348081abf87cb0d42bef4ae4faac3c8fd6c72.tar.gz vaadin-framework-a17348081abf87cb0d42bef4ae4faac3c8fd6c72.zip |
Revert 'Rewrote debouncing of onResize (#11899)' (#12051)
Fixes #12049
Diffstat (limited to 'client/src')
-rwxr-xr-x | client/src/main/java/com/vaadin/client/widgets/Grid.java | 48 |
1 files changed, 15 insertions, 33 deletions
diff --git a/client/src/main/java/com/vaadin/client/widgets/Grid.java b/client/src/main/java/com/vaadin/client/widgets/Grid.java index 9f36864bc8..1226920bd1 100755 --- a/client/src/main/java/com/vaadin/client/widgets/Grid.java +++ b/client/src/main/java/com/vaadin/client/widgets/Grid.java @@ -4387,9 +4387,6 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, private boolean refreshBodyRequested = false; - private boolean resizeRequested = false; - private boolean resizeRefreshScheduled = false; - private DragAndDropHandler.DragAndDropCallback headerCellDndCallback = new DragAndDropCallback() { private final AutoScrollerCallback autoScrollerCallback = new AutoScrollerCallback() { @@ -9325,38 +9322,23 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, /* * Delay calculation to be deferred so Escalator can do it's magic. */ - resizeRequested = true; - if (!resizeRefreshScheduled) { - resizeRefreshScheduled = true; - Scheduler.get().scheduleFixedDelay(() -> { - if (!resizeRequested) { - doRefreshOnResize(); - resizeRefreshScheduled = false; - return false; - } else { - resizeRequested = false; - return true; - } - }, 50); - } - } - - private void doRefreshOnResize() { - if (escalator - .getInnerWidth() != autoColumnWidthsRecalculator.lastCalculatedInnerWidth) { - recalculateColumnWidths(); - } + Scheduler.get().scheduleFinally(() -> { + if (escalator + .getInnerWidth() != autoColumnWidthsRecalculator.lastCalculatedInnerWidth) { + recalculateColumnWidths(); + } - // Vertical resizing could make editor positioning invalid so it - // needs to be recalculated on resize - if (isEditorActive()) { - editor.updateVerticalScrollPosition(); - } + // Vertical resizing could make editor positioning invalid so it + // needs to be recalculated on resize + if (isEditorActive()) { + editor.updateVerticalScrollPosition(); + } - // if there is a resize, we need to refresh the body to avoid an - // off-by-one error which occurs when the user scrolls all the - // way to the bottom. - refreshBody(); + // if there is a resize, we need to refresh the body to avoid an + // off-by-one error which occurs when the user scrolls all the + // way to the bottom. + refreshBody(); + }); } private double getEscalatorInnerHeight() { |