Commit 152cbd9f authored by radiolips's avatar radiolips Committed by GitHub
Browse files

Merge pull request #434 from aletorrado/master

Some fixes when dropping external items.
parents 961eafeb 5e71f4bd
......@@ -798,13 +798,14 @@
var onDrag = function(event, ui) {
var el = draggingElement;
var node = el.data('_gridstack_node');
var pos = self.getCellFromPixel(ui.offset, true);
var pos = self.getCellFromPixel({left: event.pageX, top: event.pageY}, true);
var x = Math.max(0, pos.x);
var y = Math.max(0, pos.y);
if (!node._added) {
node._added = true;
node.el = el;
node.autoPosition = true;
node.x = x;
node.y = y;
self.grid.cleanNodes();
......@@ -823,13 +824,12 @@
node._beforeDragY = node.y;
self._updateContainerHeight();
} else {
if (!self.grid.canMoveNode(node, x, y)) {
return;
}
self.grid.moveNode(node, x, y);
self._updateContainerHeight();
}
if (!self.grid.canMoveNode(node, x, y)) {
return;
}
self.grid.moveNode(node, x, y);
self._updateContainerHeight();
};
this.dd
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment