improve y calc when dragging

This commit is contained in:
Pavel Reznikov 2014-12-01 18:13:03 -08:00
parent 320c4e1380
commit 2ac2043576

View file

@ -395,7 +395,7 @@
});
el.data('_gridstack_node', node);
var cell_width, cell_height = this.opts.cell_height + this.opts.vertical_margin / 2;
var cell_width, cell_height = this.opts.cell_height + this.opts.vertical_margin;
var on_start_moving = function (event, ui) {
var o = $(this);
@ -442,7 +442,7 @@
stop: on_end_moving,
drag: function (event, ui) {
var x = Math.round(ui.position.left / cell_width),
y = Math.floor(ui.position.top / cell_height);
y = Math.floor((ui.position.top + cell_height/2) / cell_height);
if (self.opts.height && !self.grid.can_move_node(node, x, y, node.width, node.height)) {
return;
}