Bladeren bron

relocate disableCursor/enableCursor

Adam Shaw 11 jaren geleden
bovenliggende
commit
9241d7cf34
4 gewijzigde bestanden met toevoegingen van 21 en 25 verwijderingen
  1. 0 16
      src/EventManager.js
  2. 6 6
      src/common/Grid.events.js
  3. 3 3
      src/common/Grid.js
  4. 12 0
      src/util.js

+ 0 - 16
src/EventManager.js

@@ -882,8 +882,6 @@ function EventManager(options) { // assumed to be a calendar
 
 	t.isEventAllowedInRange = isEventAllowedInRange;
 	t.isSelectionAllowedInRange = isSelectionAllowedInRange;
-	t.enableCursor = enableCursor;
-	t.disableCursor = disableCursor;
 
 
 	function isEventAllowedInRange(event, start, end) {
@@ -1021,20 +1019,6 @@ function EventManager(options) { // assumed to be a calendar
 		return start < eventEnd && end > eventStart;
 	}
 
-
-	// Make the cursor express that an event is not allowed in the current area.
-	// Shouldn't really be here :(
-	function disableCursor() {
-		$('body').addClass('fc-not-allowed');
-	}
-
-
-	// Returns the cursor to its original look.
-	// Shouldn't really be here :(
-	function enableCursor() {
-		$('body').removeClass('fc-not-allowed');
-	}
-
 }
 
 

+ 6 - 6
src/common/Grid.events.js

@@ -299,14 +299,14 @@ $.extend(Grid.prototype, {
 					// have the helper follow the mouse (no snapping) with a warning-style cursor
 					newStart = null; // mark an invalid drop date
 					mouseFollower.show();
-					calendar.disableCursor();
+					disableCursor();
 				}
 			},
 			cellOut: function() { // called before mouse moves to a different cell OR moved out of all cells
 				newStart = null;
 				view.destroyDrag(); // unrender whatever was done in view.renderDrag
 				mouseFollower.show(); // show in case we are moving out of all cells
-				calendar.enableCursor();
+				enableCursor();
 			},
 			dragStop: function(ev) {
 				var hasChanged = newStart && !newStart.isSame(event.start);
@@ -323,7 +323,7 @@ $.extend(Grid.prototype, {
 					}
 				});
 
-				calendar.enableCursor();
+				enableCursor();
 			},
 			listenStop: function() {
 				mouseFollower.stop(); // put in listenStop in case there was a mousedown but the drag never started
@@ -423,18 +423,18 @@ $.extend(Grid.prototype, {
 				else {
 					newEnd = null; // mark an invalid resize
 					destroy();
-					calendar.disableCursor();
+					disableCursor();
 				}
 			},
 			cellOut: function() { // called before mouse moves to a different cell OR moved out of all cells
 				newEnd = null;
 				destroy();
-				calendar.enableCursor();
+				enableCursor();
 			},
 			dragStop: function(ev) {
 				_this.isResizingSeg = false;
 				destroy();
-				calendar.enableCursor();
+				enableCursor();
 				view.trigger('eventResizeStop', el[0], event, ev, {}); // last argument is jqui dummy
 
 				if (newEnd) {

+ 3 - 3
src/common/Grid.js

@@ -117,7 +117,7 @@ $.extend(Grid.prototype, {
 						}
 						else {
 							dates = null; // flag for an invalid selection
-							calendar.disableCursor();
+							disableCursor();
 						}
 					}
 				}
@@ -125,7 +125,7 @@ $.extend(Grid.prototype, {
 			cellOut: function(cell, date) {
 				dates = null;
 				_this.destroySelection();
-				calendar.enableCursor();
+				enableCursor();
 			},
 			listenStop: function(ev) {
 				if (dates) { // started and ended on a cell?
@@ -137,7 +137,7 @@ $.extend(Grid.prototype, {
 						view.reportSelection(start, end, ev);
 					}
 				}
-				calendar.enableCursor();
+				enableCursor();
 			}
 		});
 

+ 12 - 0
src/util.js

@@ -32,6 +32,18 @@ function uncompensateScroll(rowEls) {
 }
 
 
+// Make the mouse cursor express that an event is not allowed in the current area
+function disableCursor() {
+	$('body').addClass('fc-not-allowed');
+}
+
+
+// Returns the mouse cursor to its original look
+function enableCursor() {
+	$('body').removeClass('fc-not-allowed');
+}
+
+
 // Given a total available height to fill, have `els` (essentially child rows) expand to accomodate.
 // By default, all elements that are shorter than the recommended height are expanded uniformly, not considering
 // any other els that are already too tall. if `shouldRedistribute` is on, it considers these tall rows and