diff --git a/doc/CHANGES.md b/doc/CHANGES.md index 370f1546..f6d49365 100644 --- a/doc/CHANGES.md +++ b/doc/CHANGES.md @@ -126,6 +126,7 @@ Change log * fix: [#2939](https://github.com/gridstack/gridstack.js/issues/2939) custom drag handle not working with LazyLoad * fix: [#2955](https://github.com/gridstack/gridstack.js/issues/2955) angular circular dependency * fix: [#2951](https://github.com/gridstack/gridstack.js/issues/2951) shadow DOM dragging re-appending fix +* fix: [#2964](https://github.com/gridstack/gridstack.js/pull/2964) minW larger than column fix ## 11.3.0 (2025-01-26) * feat: added `isIgnoreChangeCB()` if changeCB should be ignored due to column change, sizeToContent, loading, etc... diff --git a/src/gridstack-engine.ts b/src/gridstack-engine.ts index fd3fd93b..bc48e2dd 100644 --- a/src/gridstack-engine.ts +++ b/src/gridstack-engine.ts @@ -408,10 +408,10 @@ export class GridStackEngine { const before = node._orig || Utils.copyPos({}, node); - if (node.maxW && node.w) { node.w = Math.min(node.w, node.maxW); } - if (node.maxH && node.h) { node.h = Math.min(node.h, node.maxH); } - if (node.minW && node.w && node.minW <= this.column) { node.w = Math.max(node.w, node.minW); } - if (node.minH && node.h) { node.h = Math.max(node.h, node.minH); } + if (node.maxW) { node.w = Math.min(node.w || 1, node.maxW); } + if (node.maxH) { node.h = Math.min(node.h || 1, node.maxH); } + if (node.minW) { node.w = Math.max(node.w || 1, node.minW); } + if (node.minH) { node.h = Math.max(node.h || 1, node.minH); } // if user loaded a larger than allowed widget for current # of columns, // remember it's position & width so we can restore back (1 -> 12 column) #1655 #1985