From 20314d972544b41a826064aed3d97f9ac18876c1 Mon Sep 17 00:00:00 2001 From: Pavel Reznikov Date: Fri, 5 Dec 2014 19:18:08 -0800 Subject: [PATCH] update gridstack.js --- gridstack.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/gridstack.js b/gridstack.js index 7f04d20..38b94e6 100644 --- a/gridstack.js +++ b/gridstack.js @@ -64,15 +64,19 @@ if (n._updating || typeof n._orig_y == 'undefined' || n.y == n._orig_y) return; - var collision_node = _.chain(this.nodes) - .find(function (bn) { - return n != bn && Utils.is_intercepted({x: n.x, y: n._orig_y, width: n.width, height: n.height}, bn); - }) - .value(); + var new_y = n.y; + while (new_y >= n._orig_y) { + var collision_node = _.chain(this.nodes) + .find(function (bn) { + return n != bn && Utils.is_intercepted({x: n.x, y: new_y, width: n.width, height: n.height}, bn); + }) + .value(); - if (!collision_node) { - n._dirty = true; - n.y = n._orig_y; + if (!collision_node) { + n._dirty = true; + n.y = new_y; + } + --new_y; } }, this); }