Now use top and bottom of widget instead of just center height when calculating remove. Fixes the removal of widgets when top leaves grid

This commit is contained in:
Sebastiaan la Fleur 2016-08-17 11:59:17 +02:00
commit d57dff7db3

View file

@ -986,6 +986,8 @@
var dragOrResize = function(event, ui) {
var x = Math.round(ui.position.left / cellWidth);
var y = Math.floor((ui.position.top + cellHeight / 2) / cellHeight);
var yTop = Math.floor(ui.position.top / cellHeight);
var yBottom = Math.floor((ui.position.top + cellHeight) / cellHeight);
var width;
var height;
@ -995,7 +997,7 @@
}
if (event.type == 'drag') {
if (x < 0 || x >= self.grid.width || y < 0) {
if (x < 0 || x >= self.grid.width || yTop < 0 || yBottom > self.grid.height) {
if (self.opts.removable === true) {
self._setupRemovingTimeout(el);
}