Skip to content

Commit 9442e3c

Browse files
author
Derek Moore
committed
stop event propagation at the grid instead of at grid items
1 parent 69d2df1 commit 9442e3c

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/gridstack.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,6 @@
641641
}
642642
self.grid.move_node(node, x, y, width, height);
643643
self._update_container_height();
644-
event.stopPropagation();
645644
};
646645

647646
var on_start_moving = function(event, ui) {
@@ -661,7 +660,6 @@
661660

662661
el.resizable('option', 'minWidth', cell_width * (node.min_width || 1));
663662
el.resizable('option', 'minHeight', self.opts.cell_height * (node.min_height || 1));
664-
event.stopPropagation();
665663
};
666664

667665
var on_end_moving = function(event, ui) {
@@ -679,7 +677,6 @@
679677
self._trigger_change_event();
680678

681679
self.grid.end_update();
682-
event.stopPropagation();
683680
};
684681

685682
el
@@ -970,10 +967,21 @@
970967

971968
scope.GridStackUI.Utils = Utils;
972969

970+
function event_stop_propagate(event) {
971+
event.stopPropagation();
972+
}
973973
$.fn.gridstack = function(opts) {
974974
return this.each(function() {
975-
if (!$(this).data('gridstack')) {
976-
$(this).data('gridstack', new GridStack(this, opts));
975+
var o = $(this);
976+
if (!o.data('gridstack')) {
977+
o
978+
.data('gridstack', new GridStack(this, opts))
979+
.on('dragstart', event_stop_propagate)
980+
.on('dragstop', event_stop_propagate)
981+
.on('drag', event_stop_propagate)
982+
.on('resizestart', event_stop_propagate)
983+
.on('resizestop', event_stop_propagate)
984+
.on('resize', event_stop_propagate);
977985
}
978986
});
979987
};

0 commit comments

Comments
 (0)