Skip to content

Commit 77936c2

Browse files
committed
full grid maxRow fix
* fix #2449 * move, while still being under maxRow or at least not making it worse (case where widget was somehow added past our max)
1 parent bc2bc8a commit 77936c2

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

doc/CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Change log
55
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
66
**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*
77

8+
- [9.1.1-dev (TBD)](#911-dev-tbd)
89
- [9.1.1 (2023-09-06)](#911-2023-09-06)
910
- [9.1.0 (2023-09-04)](#910-2023-09-04)
1011
- [9.0.2 (2023-08-29)](#902-2023-08-29)
@@ -97,6 +98,9 @@ Change log
9798

9899
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
99100

101+
## 9.1.1-dev (TBD)
102+
* fix [#2449](https://github.com/gridstack/gridstack.js/issues/2449) full grid maxRow fix
103+
100104
## 9.1.1 (2023-09-06)
101105
* fix [#2435](https://github.com/gridstack/gridstack.js/issues/2435) directionCollideCoverage() tweaks
102106
* fix resizeToContent() to handle node.h (using when cellHeight changes or we resize) vs DOM sizing (rest of the time)

src/gridstack-engine.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,8 +591,9 @@ export class GridStackEngine {
591591
});
592592
if (!clonedNode) return false;
593593

594-
// check if we're covering 50% collision and could move
595-
let canMove = clone.moveNode(clonedNode, o) && clone.getRow() <= this.maxRow;
594+
// check if we're covering 50% collision and could move, while still being under maxRow or at least not making it worse
595+
// (case where widget was somehow added past our max #2449)
596+
let canMove = clone.moveNode(clonedNode, o) && clone.getRow() <= Math.max(this.getRow(), this.maxRow);
596597
// else check if we can force a swap (float=true, or different shapes) on non-resize
597598
if (!canMove && !o.resizing && o.collide) {
598599
let collide = o.collide.el.gridstackNode; // find the source node the clone collided with at 50%

0 commit comments

Comments
 (0)