Skip to content

Commit c5ff172

Browse files
committed
collision: more 2 grids with maxRow
* partial fix for #1687 last change to willItFit() broke this case. Working but still some issues...
1 parent 98041da commit c5ff172

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/gridstack-dd.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ GridStack.prototype._setupAcceptWidget = function(): GridStack {
130130
}
131131
// finally check to make sure we actually have space left #1571
132132
if (canAccept && node && this.opts.maxRow) {
133-
let n = {w: node.w, h: node.h, minW: node.minW, minH: node.minH}; // only width/height matters
133+
let n = {w: node.w, h: node.h, minW: node.minW, minH: node.minH}; // only width/height matters and autoPosition
134134
canAccept = this.engine.willItFit(n);
135135
}
136136
return canAccept;

src/gridstack-engine.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,9 @@ export class GridStackEngine {
560560
float: this.float,
561561
nodes: this.nodes.map(n => {return {...n}})
562562
});
563-
let n = Utils.copyPos({}, node, true); // clone node so we don't mod any settings on it! #1687
563+
let n = {...node}; // clone node so we don't mod any settings on it but have full autoPosition and min/max as well! #1687
564+
this.cleanupNode(n);
565+
delete n.el; delete n._id; delete n.content; delete n.grid;
564566
clone.addNode(n);
565567
return clone.getRow() <= this.maxRow;
566568
}

0 commit comments

Comments
 (0)