From 552ebf109baaf501577c4896a2e12926a583b3be Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Fri, 11 Jun 2010 00:57:31 +0200 Subject: [PATCH] Don't overlap events that don't overlap physically, but only visually because the event DIVs have a minimum height. --- kronolith/js/kronolith.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/kronolith/js/kronolith.js b/kronolith/js/kronolith.js index 03be2393b..c48bb10b1 100644 --- a/kronolith/js/kronolith.js +++ b/kronolith/js/kronolith.js @@ -1811,7 +1811,13 @@ KronolithCore = { // The conflict group where this event should go. pos = this.dayGroups.length, // The event below the current event fits. - placeFound = false; + placeFound = false, + // The minimum (virtual) duration of each event, defined by the + // minimum height of an event DIV. + minMinutes = (minHeight + this[storage].spacing) * 60 / this[storage].height, + // The minimum (virtual) end of an event, defined by its start + // time an minMinutes. + minEnd; // this.dayEvents contains all events of the current day. // this.dayGroups contains conflict groups, i.e. all events that @@ -1819,10 +1825,14 @@ KronolithCore = { // // Go through all events that have been added to this day already. this.dayEvents.each(function(ev) { + // Due to the minimum height of an event DIV, events might + // visually overlap, even if they physically don't. + minEnd = ev.start.clone().add(minMinutes).minutes(); + end = ev.end.isAfter(minEnd) ? ev.end : minEnd; // If it doesn't conflict with the current event, rember it // as a possible event below that we can put the current event // and go ahead. - if (!ev.end.isAfter(event.value.start)) { + if (!end.isAfter(event.value.start)) { placeFound = ev; return; } -- 2.11.0