Collision/overlap threshold

It should be possible to set a collision/overlap threshold via a configuration setting.
This basically lets me set a threshold for when the scheduler should render the event next to an event instead of shadowing/overlapping it.

Currently I’ve coded this in manually quite easily with this code(in dhtmlxscheduler_debug):

var threshold = typeof this.config.overlap_threshold == 'number' ? this.config.overlap_threshold * 60 * 1000 : 0;
			while (stack.length && (stack[stack.length-1].end_date.valueOf()+threshold)<=ev.start_date.valueOf())



in the function named _pre_render_events_line.

I have no idea if this is safe or not in all kinds of views, but it seems to work ok in units and week, and lets me specify a threshold easily like this:

scheduler.config.overlap_threshold = 30; // minutes

A natural evolution of this would be to allow different thresholds in different views. 30 minutes works very good or us in units view, but is a bit spacious in weeks. In weeks cascade probably works better.

Of course this causes a diff between upstream(you) and local(me) implementations, and makes updates harder. It would be nice to see this in the next release as I think it’s a quite useful feature to have for many users.

What do you think?


Thank you for your feedback, it is always welcome.

Do you mean situations where, for example, there are 2 5 minute events next to each other? Right now indeed they would visually overlap and it would be clear.
If it is indeed the problem you are describing than I am more than happy to tell that in the upcoming version there would be scheduler.config.separate_short_events option (true/false) which would do exactly that. If there is enough space to display them as they are right now - good, display. If not - display them in separate columns.

Kind regards,

It’s not necessarily two short events, if only the first one is short, the latter will overlap most of the former event.

IMHO I think my solution is better, because instead of a true/false, the user can select exactly what threshold they prefer. The “optimal” threshold might change from project to project.
Maybe a “config.separate_events_shorter_than = 3 // minutes” type of config would be a sort of middle ground?

That was an example. It will check if events would visually overlap while their dates do not and place them in separate columns.

Kind regards,

Sounds great! However I don’t think the name of the setting I reflecting what it does. Either way I’m happy to see you bring this functionality.

Due April, correct?

Well one of the events have to be short for this to happen :slight_smile:

That’s the plan.

Best regards,