Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fec86f2

Browse files
committed
check for fixed grid maxRow during resize
* fix for gridstack#2683 untested as I don't have my dev machine right now.
1 parent a471c47 commit fec86f2

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

doc/CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ Change log
109109
- [v0.1.0 (2014-11-18)](#v010-2014-11-18)
110110

111111
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
112+
113+
## 10.2.0-dev (TBD)
114+
* fix: [#2683](https://github.com/gridstack/gridstack.js/issues/2683) check for fixed grid maxRow during resize
115+
112116
## 10.2.0 (2024-06-02)
113117
* feat: [#2682](https://github.com/gridstack/gridstack.js/pull/2682) You can now press 'Esc' to cancel a move|resize, 'r' to rotate during a drag. added `GridStack.rotate()` as well - Thank you John B. for this feature sponsor.
114118
* fix: [#2672](https://github.com/gridstack/gridstack.js/pull/2672) dropping into full grid JS error

src/gridstack.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2503,10 +2503,12 @@ export class GridStack {
25032503
// set the min/max resize info taking into account the column count and position (so we don't resize outside the grid)
25042504
this.engine.cacheRects(cellWidth, cellHeight, this.opts.marginTop as number, this.opts.marginRight as number, this.opts.marginBottom as number, this.opts.marginLeft as number);
25052505
if (event.type === 'resizestart') {
2506-
dd.resizable(el, 'option', 'minWidth', cellWidth * Math.min(node.minW || 1, this.getColumn() - node.x))
2507-
.resizable(el, 'option', 'minHeight', cellHeight * Math.min(node.minH || 1, (this.opts.maxRow || Number.MAX_SAFE_INTEGER) - node.y));
2508-
if (node.maxW) { dd.resizable(el, 'option', 'maxWidth', cellWidth * node.maxW); }
2509-
if (node.maxH) { dd.resizable(el, 'option', 'maxHeight', cellHeight * node.maxH); }
2506+
const colLeft = this.getColumn() - node.x;
2507+
const rowLeft = (this.opts.maxRow || Number.MAX_SAFE_INTEGER) - node.y;
2508+
dd.resizable(el, 'option', 'minWidth', cellWidth * Math.min(node.minW || 1, colLeft))
2509+
.resizable(el, 'option', 'minHeight', cellHeight * Math.min(node.minH || 1, rowLeft))
2510+
.resizable(el, 'option', 'maxWidth', cellWidth * Math.min(node.maxW || Number.MAX_SAFE_INTEGER, colLeft))
2511+
.resizable(el, 'option', 'maxHeight', cellHeight * Math.min(node.maxH || Number.MAX_SAFE_INTEGER, rowLeft));
25102512
}
25112513
}
25122514

0 commit comments

Comments
 (0)