Explorar el Código

move filterEventRenderEl

Adam Shaw hace 8 años
padre
commit
c9ef347eb4

+ 0 - 25
src/common/ChronoComponent.js

@@ -359,31 +359,6 @@ var ChronoComponent = Model.extend({
 	},
 
 
-	// Foreground Segment Rendering
-	// ---------------------------------------------------------------------------------------------------------------
-
-
-	// Given an event and the default element used for rendering, returns the element that should actually be used.
-	// Basically runs events and elements through the eventRender hook.
-	filterEventRenderEl: function(eventFootprint, el) {
-		var legacy = eventFootprint.getEventLegacy();
-
-		var custom = this.publiclyTrigger('eventRender', {
-			context: legacy,
-			args: [ legacy, el, this._getView() ]
-		});
-
-		if (custom === false) { // means don't render at all
-			el = null;
-		}
-		else if (custom && custom !== true) {
-			el = $(custom);
-		}
-
-		return el;
-	},
-
-
 	// Navigation
 	// ----------------------------------------------------------------------------------------------------------------
 

+ 21 - 0
src/common/EventRenderUtils.js

@@ -60,6 +60,27 @@ var EventRenderUtils = Class.extend({
 	},
 
 
+	// Given an event and the default element used for rendering, returns the element that should actually be used.
+	// Basically runs events and elements through the eventRender hook.
+	filterEventRenderEl: function(eventFootprint, el) { // TODO: move this to EventRenderUtils!!!
+		var legacy = eventFootprint.getEventLegacy();
+
+		var custom = this.delegate.publiclyTrigger('eventRender', {
+			context: legacy,
+			args: [ legacy, el, this.delegate._getView() ]
+		});
+
+		if (custom === false) { // means don't render at all
+			el = null;
+		}
+		else if (custom && custom !== true) {
+			el = $(custom);
+		}
+
+		return el;
+	},
+
+
 	// Compute the text that should be displayed on an event's element.
 	// `range` can be the Event object itself, or something range-like, with at least a `start`.
 	// If event times are disabled, or the event has no time, will return a blank string.

+ 2 - 3
src/common/SegChronoComponentMixin.js

@@ -10,7 +10,6 @@ Caller must:
 This mixin can depend on ChronoComponent:
 - opt
 - _getView
-- filterEventRenderEl
 - eventRangesToEventFootprints
 - eventFootprintsToSegs
 */
@@ -124,7 +123,7 @@ var SegChronoComponentMixin = {
 				var el = $(node);
 
 				if (hasEventRenderHandlers) { // optimization
-					el = _this.filterEventRenderEl(seg.footprint, el);
+					el = _this.eventRenderUtils.filterEventRenderEl(seg.footprint, el);
 				}
 
 				if (el) {
@@ -165,7 +164,7 @@ var SegChronoComponentMixin = {
 	// Renders a background event element, given the default rendering. Called by the fill system.
 	// NEEDED BY FILL SYSTEM, FillSystem::buildSegEls :(
 	bgEventSegEl: function(seg, el) {
-		return this.filterEventRenderEl(seg.footprint, el);
+		return this.eventRenderUtils.filterEventRenderEl(seg.footprint, el);
 	},