From bbe11094c0bfcfc162022711f848905e57479152 Mon Sep 17 00:00:00 2001 From: Steve 'Cutter' Blades Date: Thu, 7 Jul 2022 15:05:13 -0500 Subject: [PATCH] fix: zero duration no-overlap events (#2213) Corrects issue with the no-overlap algorithm with events that have no duration --- src/utils/layout-algorithms/no-overlap.js | 2 +- stories/Layout.stories.js | 27 ++++++++++++++++++++++- stories/helpers/index.js | 4 +++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/utils/layout-algorithms/no-overlap.js b/src/utils/layout-algorithms/no-overlap.js index e4b5c12ea..8738f26bf 100644 --- a/src/utils/layout-algorithms/no-overlap.js +++ b/src/utils/layout-algorithms/no-overlap.js @@ -51,7 +51,7 @@ export default function ({ const y4 = se2.style.top + se2.style.height // be friends when overlapped - if ((y3 <= y1 && y1 < y4) || (y1 <= y3 && y3 < y2)) { + if ((y3 <= y1 && y1 <= y4) || (y1 <= y3 && y3 <= y2)) { // TODO : hashmap would be effective for performance se1.friends.push(se2) se2.friends.push(se1) diff --git a/stories/Layout.stories.js b/stories/Layout.stories.js index 2a4060f81..ccf31d9fa 100644 --- a/stories/Layout.stories.js +++ b/stories/Layout.stories.js @@ -13,10 +13,12 @@ export default { const Template = (args) => +const defaultDate = new Date() + export const EventLayout = Template.bind({}) EventLayout.args = { defaultView: Views.DAY, - defaultDate: new Date(), + defaultDate, timeslots: 4, events: createEvents(1), } @@ -174,3 +176,26 @@ export const ZeroDurationOddities = () => { /> ) } + +export const ZeroDurationOverlap = () => { + return ( + + ) +} diff --git a/stories/helpers/index.js b/stories/helpers/index.js index 30c02b82b..46d131398 100644 --- a/stories/helpers/index.js +++ b/stories/helpers/index.js @@ -22,7 +22,9 @@ const localizer = momentLocalizer(moment) export const date = (...args) => moment(...args).toDate() export const Calendar = (props) => ( - +
+ +
) export const DragAndDropCalendar = withDragAndDrop(Calendar)