Ver código fonte

fixup some things related to agendaEventMinHeight

Adam Shaw 8 anos atrás
pai
commit
c4772fb9b5

+ 0 - 2
src/View.js

@@ -31,8 +31,6 @@ var View = FC.View = InteractiveDateComponent.extend({
 	nowIndicatorTimeoutID: null, // for refresh timing of now indicator
 	nowIndicatorTimeoutID: null, // for refresh timing of now indicator
 	nowIndicatorIntervalID: null, // "
 	nowIndicatorIntervalID: null, // "
 
 
-	agendaEventMinHeight: 0, // allows setting a min-height to the event segment to prevent short events overlapping each other
-
 	constructor: function(calendar, viewSpec) {
 	constructor: function(calendar, viewSpec) {
 		this.calendar = calendar;
 		this.calendar = calendar;
 		this.viewSpec = viewSpec;
 		this.viewSpec = viewSpec;

+ 5 - 2
src/agenda/TimeGrid.js

@@ -472,16 +472,19 @@ var TimeGrid = FC.TimeGrid = InteractiveDateComponent.extend(StandardInteraction
 
 
 	// For each segment in an array, computes and assigns its top and bottom properties
 	// For each segment in an array, computes and assigns its top and bottom properties
 	computeSegVerticals: function(segs) {
 	computeSegVerticals: function(segs) {
+		var eventMinHeight = this.opt('agendaEventMinHeight');
 		var i, seg;
 		var i, seg;
 		var dayDate;
 		var dayDate;
-		var agendaEventMinHeight = this.view.opt('agendaEventMinHeight');
 
 
 		for (i = 0; i < segs.length; i++) {
 		for (i = 0; i < segs.length; i++) {
 			seg = segs[i];
 			seg = segs[i];
 			dayDate = this.dayDates[seg.dayIndex];
 			dayDate = this.dayDates[seg.dayIndex];
 
 
 			seg.top = this.computeDateTop(seg.startMs, dayDate);
 			seg.top = this.computeDateTop(seg.startMs, dayDate);
-			seg.bottom = Math.max(seg.top + agendaEventMinHeight, this.computeDateTop(seg.endMs, dayDate));
+			seg.bottom = Math.max(
+				seg.top + eventMinHeight,
+				this.computeDateTop(seg.endMs, dayDate)
+			);
 		}
 		}
 	},
 	},
 
 

+ 3 - 0
src/defaults.js

@@ -58,6 +58,9 @@ Calendar.defaults = {
 	//buttonIcons: null,
 	//buttonIcons: null,
 
 
 	allDayText: 'all-day',
 	allDayText: 'all-day',
+
+	// allows setting a min-height to the event segment to prevent short events overlapping each other
+	agendaEventMinHeight: 0,
 	
 	
 	// jquery-ui theming
 	// jquery-ui theming
 	theme: false,
 	theme: false,

+ 1 - 1
tests/event-render/minSegmentHeight.js

@@ -35,7 +35,7 @@ describe('short event rendering with agendaEventMinHeight', function() {
 			expect(el2.css('left')).not.toEqual('0px');
 			expect(el2.css('left')).not.toEqual('0px');
 		});
 		});
 
 
-		fit('prevents the events to overlap when we pass the slotEventOverlap: false option', function() {
+		it('prevents the events to overlap when we pass the slotEventOverlap: false option', function() {
 			initCalendar({
 			initCalendar({
 				slotEventOverlap: false
 				slotEventOverlap: false
 			});
 			});