Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 573ed66

Browse files
committed
fixes in drag/stop callbacks. Related to ducksboard#23.
- break ondrag callback execution if stop event already was fired. - unset this.$player after the execution of draggable.stop callback.
1 parent 81c96b9 commit 573ed66

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/jquery.gridster.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,11 @@
474474
* @param {Object} A prepared ui object.
475475
*/
476476
fn.on_drag = function(event, ui) {
477+
//break if dragstop has been fired
478+
if (this.$player === null) {
479+
return false;
480+
};
481+
477482
var abs_offset = {
478483
left: ui.position.left + this.baseX,
479484
top: ui.position.top + this.baseY
@@ -548,15 +553,14 @@
548553
this.$player.coords().grid.row = this.placeholder_grid_data.row;
549554
this.$player.coords().grid.col = this.placeholder_grid_data.col;
550555

551-
this.$player = null;
556+
if (this.options.draggable.stop) {
557+
this.options.draggable.stop.call(this, event, ui);
558+
}
552559

553560
this.$preview_holder.remove();
561+
this.$player = null;
554562

555563
this.set_dom_grid_height();
556-
557-
if (this.options.draggable.stop) {
558-
this.options.draggable.stop.call(this, event, ui);
559-
}
560564
};
561565

562566

0 commit comments

Comments
 (0)