Skip to content

Commit 4191f34

Browse files
author
Vincent Molinié
committed
feat(scroll): add possibility to disable auto scrolling
1 parent 6b3620d commit 4191f34

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/gridstack.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2181,7 +2181,9 @@ export class GridStack {
21812181
if (node._temporaryRemoved) return; // handled by dropover
21822182
let distance = ui.position.top - node._prevYPix;
21832183
node._prevYPix = ui.position.top;
2184-
Utils.updateScrollPosition(el, ui.position, distance);
2184+
if (!this.opts.disableAutoScroll) {
2185+
Utils.updateScrollPosition(el, ui.position, distance);
2186+
}
21852187

21862188
// get new position taking into account the margin in the direction we are moving! (need to pass mid point by margin)
21872189
let left = ui.position.left + (ui.position.left > node._lastUiPosition.left ? -mRight : mLeft);

src/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ export interface GridStackOptions {
140140
Note: only used by addGrid(), else your element should have the needed class */
141141
class?: string;
142142

143+
/** disallows the scroll when dragging or resizing a widget (default?: false) */
144+
disableAutoScroll?: boolean;
145+
143146
/** disallows dragging of widgets (default?: false) */
144147
disableDrag?: boolean;
145148

0 commit comments

Comments
 (0)