Parcourir la source

external dragging, don't rely on jqui's dragstop event

Adam Shaw il y a 11 ans
Parent
commit
fb24adb2fa
2 fichiers modifiés avec 9 ajouts et 10 suppressions
  1. 2 1
      src/common/DragListener.js
  2. 7 9
      src/common/Grid.events.js

+ 2 - 1
src/common/DragListener.js

@@ -148,7 +148,6 @@ var DragListener = fc.DragListener = Class.extend({
 
 	// Called when the user does a mouseup
 	mouseup: function(ev) {
-		this.stopDrag(ev);
 		this.stopListening(ev);
 	},
 
@@ -172,6 +171,8 @@ var DragListener = fc.DragListener = Class.extend({
 
 	// Call this to stop listening to the user's mouse events
 	stopListening: function(ev) {
+		this.stopDrag(ev); // if there's a current drag, kill it
+
 		if (this.isListening) {
 
 			// remove the scroll handler if there is a scrollEl

+ 7 - 9
src/common/Grid.events.js

@@ -466,16 +466,14 @@ Grid.mixin({
 				dropLocation = null; // signal unsuccessful
 				_this.destroyDrag();
 				enableCursor();
-			}
-		});
-
-		// gets called, only once, when jqui drag is finished
-		$(document).one('dragstop', function(ev, ui) {
-			_this.destroyDrag();
-			enableCursor();
+			},
+			dragStop: function() {
+				_this.destroyDrag();
+				enableCursor();
 
-			if (dropLocation) { // element was dropped on a valid date/time cell
-				_this.view.reportExternalDrop(meta, dropLocation, el, ev, ui);
+				if (dropLocation) { // element was dropped on a valid date/time cell
+					_this.view.reportExternalDrop(meta, dropLocation, el, ev, ui);
+				}
 			}
 		});