Adam Shaw 8 年 前
コミット
8b558d208a
2 ファイル変更25 行追加8 行削除
  1. 0 8
      demos/agenda-views.html
  2. 25 0
      src/common/View.js

+ 0 - 8
demos/agenda-views.html

@@ -25,20 +25,12 @@
 				{
 					title: 'All Day Event',
 					start: '2017-05-01',
-					yoman: 'hey',
-					whatsup: 'yo'
 				},
 				{
 					title: 'Long Event',
 					start: '2017-05-07',
 					end: '2017-05-10'
 				},
-				{
-					title: 'recurring event',
-					start: '09:00',
-					end: '11:00',
-					dow: [ 1, 2, 3, 4, 5 ]
-				},
 				{
 					id: 999,
 					title: 'Repeating Event',

+ 25 - 0
src/common/View.js

@@ -803,6 +803,18 @@ var View = FC.View = ChronoComponent.extend({
 	},
 
 
+	renderSelectionFootprint: function(footprint, ev) {
+		if (this.renderSelection) { // legacy method in custom view classes
+			this.renderSelection(
+				convertFootprintToLegacySelection(footprint, this.calendar)
+			);
+		}
+		else {
+			ChronoComponent.prototype.renderSelectionFootprint.apply(this, arguments);
+		}
+	},
+
+
 	// Called when a new selection is made. Updates internal state and triggers handlers.
 	reportSelection: function(footprint, ev) {
 		this.isSelected = true;
@@ -981,3 +993,16 @@ function convertEventsPayloadToLegacyArray(eventsPayload) {
 
 	return legacyEvents;
 }
+
+
+function convertFootprintToLegacySelection(footprint, calendar) {
+	var start = calendar.moment(footprint.dateRange.startMs);
+	var end = calendar.moment(footprint.dateRange.endMs);
+
+	if (footprint.isAllDay) {
+		start.stripTime();
+		end.stripTime();
+	}
+
+	return { start: start, end: end };
+}