Skip to content

Commit d72ecde

Browse files
committed
auto-scroll doc fix
1 parent 3bcf007 commit d72ecde

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

doc/CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Change log
4949
- fix [1540](https://github.com/gridstack/gridstack.js/issues/1540) Safari H5 drag&drop fixed
5050
- fix [1545](https://github.com/gridstack/gridstack.js/issues/1545) `disableMove()` correctly prevents drag later (remove events and draggable attribute)
5151
- fix [1546](https://github.com/gridstack/gridstack.js/issues/1546) resize no longer delayed, which caused race conditions errors
52+
- fix [1001](https://github.com/gridstack/gridstack.js/issues/1001) resizing near bottom/top needs to auto-scroll/. thanks [@hbcarlos](https://github.com/hbcarlos)!
5253

5354
## 3.1.2 (2020-12-7)
5455

src/utils.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -328,14 +328,12 @@ export class Utils {
328328
}
329329
}
330330

331-
/**
332-
* @internal
333-
*
334-
* Function used to scroll the page.
335-
*
331+
/**
332+
* @internal Function used to scroll the page.
333+
*
336334
* @param event `MouseEvent` that triggers the resize
337335
* @param el `HTMLElement` that's being resized
338-
* @param distance Distance to scroll
336+
* @param distance Distance from the V edges to start scrolling
339337
*/
340338
static updateScrollResize(event: MouseEvent, el: HTMLElement, distance: number): void {
341339
const scrollEl = this.getScrollParent(el);
@@ -348,7 +346,6 @@ export class Utils {
348346
// This also can be done with a timeout to keep scrolling while the mouse is
349347
// in the scrolling zone. (will have smoother behavior)
350348
scrollEl.scrollBy({ behavior: 'smooth', top: event.clientY - distance});
351-
352349
} else if (bottom) {
353350
scrollEl.scrollBy({ behavior: 'smooth', top: distance - (height - event.clientY)});
354351
}

0 commit comments

Comments
 (0)