Skip to content

Commit 13b82d5

Browse files
authored
Merge pull request #2062 from adumesny/v6
fix #2055 maxRow=1 resize outside
2 parents a1b1bf7 + 3c447eb commit 13b82d5

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
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+
- [6.0.2-dev (TBD)](#602-dev-tbd)
89
- [6.0.2 (2022-09-23)](#602-2022-09-23)
910
- [6.0.1 (2022-08-27)](#601-2022-08-27)
1011
- [6.0.0 (2022-08-21)](#600-2022-08-21)
@@ -71,6 +72,9 @@ Change log
7172

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

75+
## 6.0.2-dev (TBD)
76+
* fixed [#2055](https://github.com/gridstack/gridstack.js/issues/2055) maxRow=1 resize outside
77+
7478
## 6.0.2 (2022-09-23)
7579
* fixed [#2034](https://github.com/gridstack/gridstack.js/issues/2034) `removeWidget()` breaking resize handle feedback
7680
* fixed [#2043](https://github.com/gridstack/gridstack.js/issues/2043) when swapping shapes in maxRow grid, make sure we still check for 50% coverage

src/gridstack-engine.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -543,10 +543,10 @@ export class GridStackEngine {
543543
if (!clonedNode) return false;
544544

545545
// check if we're covering 50% collision and could move
546-
let canMove = clone.moveNode(clonedNode, o);
547-
// make sure we are still valid grid max, else check if we can force a swap (float=true, or different shapes) on non-resize
548-
if (!o.resizing && canMove && o.collide && this.float && clone.getRow() > this.maxRow) {
549-
let collide = o.collide.el.gridstackNode; // find the source node the clone collided with
546+
let canMove = clone.moveNode(clonedNode, o) && clone.getRow() <= this.maxRow;
547+
// else check if we can force a swap (float=true, or different shapes) on non-resize
548+
if (!canMove && !o.resizing && o.collide) {
549+
let collide = o.collide.el.gridstackNode; // find the source node the clone collided with at 50%
550550
if (this.swap(node, collide)) { // swaps and mark dirty
551551
this._notify();
552552
return true;

0 commit comments

Comments
 (0)