Skip to content

Commit 1b13617

Browse files
atesgoralvieron
authored andcommittedOct 26, 2013
fix(gridster): Orphan preview holder when dragging is interrupted
After beginning a drag, if the mouse button is released outside of the screen, and if a subsequent drag operation is begun on another widget (while the previous widget still follows the mouse around), Draggable will trigger a new drag start event, causing Gridster to leave the current widget + its preview holder aside and start dragging the new widget. This will lead to an orphan preview holder to be left on the screen. A quick solution is to ignore drag start without receiving a drag stop.
1 parent 5bfbc5c commit 1b13617

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
 

‎src/jquery.gridster.js

+8
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,13 @@
647647
offset_left: this.options.widget_margins[0],
648648
container_width: this.container_width,
649649
start: function(event, ui) {
650+
// Ignore drag start if mouse was released outside screen on a previous drag
651+
if (self.dragging) {
652+
return;
653+
}
654+
655+
self.dragging = true;
656+
650657
self.$widgets.filter('.player-revert')
651658
.removeClass('player-revert');
652659

@@ -659,6 +666,7 @@
659666
self.$el.trigger('gridster:dragstart');
660667
},
661668
stop: function(event, ui) {
669+
self.dragging = false;
662670
self.on_stop_drag.call(self, event, ui);
663671
self.$el.trigger('gridster:dragstop');
664672
},

0 commit comments

Comments
 (0)
Please sign in to comment.