From 3c447eb7e0935eedfa3ebcd7cd30661518270c30 Mon Sep 17 00:00:00 2001 From: Alain Dumesny Date: Sat, 8 Oct 2022 15:15:10 -0700 Subject: [PATCH] fix #2055 maxRow=1 resize outside * fix bug introduced when fixing #2043 (checking for 50% coverage before swap) --- doc/CHANGES.md | 4 ++++ src/gridstack-engine.ts | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/CHANGES.md b/doc/CHANGES.md index 04c2177fa..0fd523e86 100644 --- a/doc/CHANGES.md +++ b/doc/CHANGES.md @@ -5,6 +5,7 @@ Change log **Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)* +- [6.0.2-dev (TBD)](#602-dev-tbd) - [6.0.2 (2022-09-23)](#602-2022-09-23) - [6.0.1 (2022-08-27)](#601-2022-08-27) - [6.0.0 (2022-08-21)](#600-2022-08-21) @@ -71,6 +72,9 @@ Change log +## 6.0.2-dev (TBD) +* fixed [#2055](https://github.com/gridstack/gridstack.js/issues/2055) maxRow=1 resize outside + ## 6.0.2 (2022-09-23) * fixed [#2034](https://github.com/gridstack/gridstack.js/issues/2034) `removeWidget()` breaking resize handle feedback * fixed [#2043](https://github.com/gridstack/gridstack.js/issues/2043) when swapping shapes in maxRow grid, make sure we still check for 50% coverage diff --git a/src/gridstack-engine.ts b/src/gridstack-engine.ts index e14fe6dd5..6919de678 100644 --- a/src/gridstack-engine.ts +++ b/src/gridstack-engine.ts @@ -543,10 +543,10 @@ export class GridStackEngine { if (!clonedNode) return false; // check if we're covering 50% collision and could move - let canMove = clone.moveNode(clonedNode, o); - // make sure we are still valid grid max, else check if we can force a swap (float=true, or different shapes) on non-resize - if (!o.resizing && canMove && o.collide && this.float && clone.getRow() > this.maxRow) { - let collide = o.collide.el.gridstackNode; // find the source node the clone collided with + let canMove = clone.moveNode(clonedNode, o) && clone.getRow() <= this.maxRow; + // else check if we can force a swap (float=true, or different shapes) on non-resize + if (!canMove && !o.resizing && o.collide) { + let collide = o.collide.el.gridstackNode; // find the source node the clone collided with at 50% if (this.swap(node, collide)) { // swaps and mark dirty this._notify(); return true;