Просмотр исходного кода

centralize dragOpacity, fix IE8 bug while dragging in agenda view

Adam Shaw 11 лет назад
Родитель
Сommit
8c4e751df6
3 измененных файлов с 16 добавлено и 12 удалено
  1. 1 6
      src/common/DayGrid.js
  2. 14 0
      src/common/Grid.events.js
  3. 1 6
      src/common/TimeGrid.js

+ 1 - 6
src/common/DayGrid.js

@@ -318,7 +318,6 @@ var DayGrid = Grid.extend({
 	// Renders a visual indication of an event or external element being dragged.
 	// The dropLocation's end can be null. seg can be null. See Grid::renderDrag for more info.
 	renderDrag: function(dropLocation, seg) {
-		var opacity;
 
 		// always render a highlight underneath
 		this.renderHighlight(
@@ -329,11 +328,7 @@ var DayGrid = Grid.extend({
 		if (seg && !seg.el.closest(this.el).length) {
 
 			this.renderRangeHelper(dropLocation, seg);
-
-			opacity = this.view.opt('dragOpacity');
-			if (opacity !== undefined) {
-				this.helperEls.css('opacity', opacity);
-			}
+			this.applyDragOpacity(this.helperEls);
 
 			return true; // a helper has been rendered
 		}

+ 14 - 0
src/common/Grid.events.js

@@ -406,6 +406,20 @@ Grid.mixin({
 	},
 
 
+	// Utility for apply dragOpacity to a jQuery set
+	applyDragOpacity: function(els) {
+		var opacity = this.view.opt('dragOpacity');
+
+		if (opacity != null) {
+			els.each(function(i, node) {
+				// Don't use jQuery (will set an IE filter), do it the old fashioned way.
+				// In IE8, a helper element will disappears if there's a filter.
+				node.style.opacity = opacity;
+			});
+		}
+	},
+
+
 	/* External Element Dragging
 	------------------------------------------------------------------------------------------------------------------*/
 

+ 1 - 6
src/common/TimeGrid.js

@@ -335,15 +335,10 @@ var TimeGrid = Grid.extend({
 	// dropLocation's end might be null, as well as `seg`. See Grid::renderDrag for more info.
 	// A returned value of `true` signals that a mock "helper" event has been rendered.
 	renderDrag: function(dropLocation, seg) {
-		var opacity;
 
 		if (seg) { // if there is event information for this drag, render a helper event
 			this.renderRangeHelper(dropLocation, seg);
-
-			opacity = this.view.opt('dragOpacity');
-			if (opacity !== undefined) {
-				this.helperEl.css('opacity', opacity);
-			}
+			this.applyDragOpacity(this.helperEl);
 
 			return true; // signal that a helper has been rendered
 		}