Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8ab3715

Browse files
committed
fix widgets packing in float mode
1 parent ab02fbb commit 8ab3715

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/gridstack.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,19 @@
6464
if (n._updating || typeof n._orig_y == 'undefined' || n.y == n._orig_y)
6565
return;
6666

67-
var collision_node = _.chain(this.nodes)
68-
.find(function (bn) {
69-
return n != bn && Utils.is_intercepted({x: n.x, y: n._orig_y, width: n.width, height: n.height}, bn);
70-
})
71-
.value();
72-
73-
if (!collision_node) {
74-
n._dirty = true;
75-
n.y = n._orig_y;
67+
var new_y = n.y;
68+
while (new_y >= n._orig_y) {
69+
var collision_node = _.chain(this.nodes)
70+
.find(function (bn) {
71+
return n != bn && Utils.is_intercepted({x: n.x, y: new_y, width: n.width, height: n.height}, bn);
72+
})
73+
.value();
74+
75+
if (!collision_node) {
76+
n._dirty = true;
77+
n.y = new_y;
78+
}
79+
--new_y;
7680
}
7781
}, this);
7882
}

0 commit comments

Comments
 (0)