|
|
|
|
|
by tomosterlund
902 days ago
|
|
Ah, never even thought of having a kind of overlap tolerance. I might look into if this would make sense for Schedule-X too. Solving overlapping events was definitely one of the things were a couple of days went into finding a nice and performant solution. My solution is here: https://github.com/schedule-x/schedule-x/blob/main/packages/... Basically what I do is iterate over a list of events, sorted by start time, and for each:
1) figure out if it has an overlap with its next
2) if no, all good -> do nothing. If yes:
3) recursively check upcoming events until none is found with an overlap.
4) for each event in the recursion, set an integer property for how many previous overlapping events there were
5) Use this integer property for adjusting the position of the event with CSS |
|