Skip to content

Commit 8b1f180

Browse files
committed
Include resizable, draggable opts in all listeners for resizable, draggable, respectively. Fixes issue particularly when passing handle to draggable - was listening to everything on el rather than this.opts.draggable.handle.
1 parent 96b84ed commit 8b1f180

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

src/gridstack.js

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -702,15 +702,16 @@
702702

703703
el
704704
.draggable(_.extend(this.opts.draggable, {
705-
containment: this.opts.is_nested ? this.container.parent() : null
705+
containment: this.opts.is_nested ? this.container.parent() : null,
706+
start: on_start_moving,
707+
stop: on_end_moving,
708+
drag: drag_or_resize
706709
}))
707-
.on('dragstart', on_start_moving)
708-
.on('dragstop', on_end_moving)
709-
.on('drag', drag_or_resize)
710-
.resizable(_.extend(this.opts.resizable, {}))
711-
.on('resizestart', on_start_moving)
712-
.on('resizestop', on_end_moving)
713-
.on('resize', drag_or_resize);
710+
.resizable(_.extend(this.opts.resizable, {
711+
resizestart: on_start_moving,
712+
resizestop: on_end_moving,
713+
resize: drag_or_resize
714+
}));
714715

715716
if (node.no_move || this._is_one_column_mode()) {
716717
el.draggable('disable');
@@ -1003,22 +1004,12 @@
10031004

10041005
scope.GridStackUI.Utils = Utils;
10051006

1006-
function event_stop_propagate(event) {
1007-
event.stopPropagation();
1008-
}
10091007
$.fn.gridstack = function(opts) {
10101008
return this.each(function() {
10111009
var o = $(this);
10121010
if (!o.data('gridstack')) {
10131011
o
1014-
.data('gridstack', new GridStack(this, opts))
1015-
.on('dragstart', event_stop_propagate)
1016-
.on('dragstop', event_stop_propagate)
1017-
.on('drag', event_stop_propagate)
1018-
.on('resizestart', event_stop_propagate)
1019-
.on('resizestop', event_stop_propagate)
1020-
.on('resize', event_stop_propagate)
1021-
.on('change', event_stop_propagate);
1012+
.data('gridstack', new GridStack(this, opts));
10221013
}
10231014
});
10241015
};

0 commit comments

Comments
 (0)