Skip to content

Commit

Permalink
remove debounce on horizonal scroll, fixes #789
Browse files Browse the repository at this point in the history
  • Loading branch information
6pac committed Jun 30, 2023
1 parent b458c23 commit c7a7aeb
Showing 1 changed file with 22 additions and 26 deletions.
48 changes: 22 additions & 26 deletions slick.grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ if (typeof Slick === "undefined") {
viewportMinWidthPx: undefined,
viewportMaxWidthPx: undefined,
suppressCssChangesOnHiddenInit: false,
scrollDebounceDelay: -1, // add a scroll delay to avoid screen flickering, -1 to disable delay
ffMaxSupportedCssHeight: 6000000,
maxSupportedCssHeight: 1000000000,
sanitizer: undefined, // sanitize function, built in basic sanitizer is: Slick.RegexSanitizer(dirtyHtml)
Expand Down Expand Up @@ -4350,34 +4349,31 @@ if (typeof Slick === "undefined") {
prevScrollLeft = scrollLeft;

// adjust scroll position of all div containers when scrolling the grid
// user can optionally provide "scrollDebounceDelay" grid option if flickering are a problem
utils.debounce(() => {
_viewportScrollContainerX.scrollLeft = scrollLeft;
_headerScrollContainer.scrollLeft = scrollLeft;
_topPanelScrollers[0].scrollLeft = scrollLeft;
if (options.createFooterRow) {
_footerRowScrollContainer.scrollLeft = scrollLeft;
}
if (options.createPreHeaderPanel) {
if (hasFrozenColumns()) {
_preHeaderPanelScrollerR.scrollLeft = scrollLeft;
} else {
_preHeaderPanelScroller.scrollLeft = scrollLeft;
}
}

_viewportScrollContainerX.scrollLeft = scrollLeft;
_headerScrollContainer.scrollLeft = scrollLeft;
_topPanelScrollers[0].scrollLeft = scrollLeft;
if (options.createFooterRow) {
_footerRowScrollContainer.scrollLeft = scrollLeft;
}
if (options.createPreHeaderPanel) {
if (hasFrozenColumns()) {
if (hasFrozenRows) {
_viewportTopR.scrollLeft = scrollLeft;
}
_headerRowScrollerR.scrollLeft = scrollLeft; // right header row scrolling with frozen grid
_preHeaderPanelScrollerR.scrollLeft = scrollLeft;
} else {
if (hasFrozenRows) {
_viewportTopL.scrollLeft = scrollLeft;
}
_headerRowScrollerL.scrollLeft = scrollLeft; // left header row scrolling with regular grid
_preHeaderPanelScroller.scrollLeft = scrollLeft;
}
}, options.scrollDebounceDelay)();
}

if (hasFrozenColumns()) {
if (hasFrozenRows) {
_viewportTopR.scrollLeft = scrollLeft;
}
_headerRowScrollerR.scrollLeft = scrollLeft; // right header row scrolling with frozen grid
} else {
if (hasFrozenRows) {
_viewportTopL.scrollLeft = scrollLeft;
}
_headerRowScrollerL.scrollLeft = scrollLeft; // left header row scrolling with regular grid
}
}

// autoheight suppresses vertical scrolling, but editors can create a div larger than
Expand Down

0 comments on commit c7a7aeb

Please sign in to comment.