Przeglądaj źródła

lockdown on EventResizing/EventDragging dependency on EventPointing

Adam Shaw 8 lat temu
rodzic
commit
0187db2999

+ 4 - 4
src/component/InteractiveDateComponent.js

@@ -39,12 +39,12 @@ var InteractiveDateComponent = FC.InteractiveDateComponent = DateComponent.exten
 			this.eventPointing = new this.eventPointingClass(this);
 		}
 
-		if (this.eventDraggingClass) {
-			this.eventDragging = new this.eventDraggingClass(this);
+		if (this.eventDraggingClass && this.eventPointing) {
+			this.eventDragging = new this.eventDraggingClass(this, this.eventPointing);
 		}
 
-		if (this.eventResizingClass) {
-			this.eventResizing = new this.eventResizingClass(this);
+		if (this.eventResizingClass && this.eventPointing) {
+			this.eventResizing = new this.eventResizingClass(this, this.eventPointing);
 		}
 
 		if (this.externalDroppingClass) {

+ 9 - 3
src/component/interactions/EventDragging.js

@@ -1,6 +1,7 @@
 
 var EventDragging = FC.EventDragging = Interaction.extend({
 
+	eventPointing: null,
 	dragListener: null,
 	isDragging: false,
 
@@ -12,10 +13,16 @@ var EventDragging = FC.EventDragging = Interaction.extend({
 		- diffDates
 		- eventRangesToEventFootprints
 		- isEventInstanceGroupAllowed
-		- eventPointing (!)
 	*/
 
 
+	constructor: function(component, eventPointing) {
+		Interaction.call(this, component);
+
+		this.eventPointing = eventPointing;
+	},
+
+
 	end: function() {
 		if (this.dragListener) {
 			this.dragListener.endInteraction();
@@ -149,8 +156,7 @@ var EventDragging = FC.EventDragging = Interaction.extend({
 				isDragging = true;
 
 				// ensure a mouseout on the manipulated event has been reported
-				// TODO: okay to call this?
-				component.eventPointing.handleMouseout(seg, ev);
+				_this.eventPointing.handleMouseout(seg, ev);
 
 				_this.segDragStart(seg, ev);
 				view.hideEventsWithId(eventDef.id); // hide all event segments. our mouseFollower will take over

+ 9 - 3
src/component/interactions/EventResizing.js

@@ -1,6 +1,7 @@
 
 var EventResizing = FC.EventResizing = Interaction.extend({
 
+	eventPointing: null,
 	dragListener: null,
 	isResizing: false,
 
@@ -13,10 +14,16 @@ var EventResizing = FC.EventResizing = Interaction.extend({
 		- eventRangesToEventFootprints
 		- isEventInstanceGroupAllowed
 		- getSafeHitFootprint
-		- eventPointing (!)
 	*/
 
 
+	constructor: function(component, eventPointing) {
+		Interaction.call(this, component);
+
+		this.eventPointing = eventPointing;
+	},
+
+
 	end: function() {
 		if (this.dragListener) {
 			this.dragListener.endInteraction();
@@ -73,8 +80,7 @@ var EventResizing = FC.EventResizing = Interaction.extend({
 				isDragging = true;
 
 				// ensure a mouseout on the manipulated event has been reported
-				// TODO: okay to call this?
-				component.eventPointing.handleMouseout(seg, ev);
+				_this.eventPointing.handleMouseout(seg, ev);
 
 				_this.segResizeStart(seg, ev);
 			},