support
support copied to clipboard
`scrollEventIntoView` does not scroll to the center of the event
we have a long running task, e.g. the start date is 25th March, 2025 and end date is 9th April, 2025, then instead of scrolling to the event on current date it is highlighting the event on some middle date like 4th April, 2025.
Steps:
- Go to basic scheduler example
- Use this code:
const scheduler = new Scheduler({
appendTo : 'container',
resources : [
{ id : 'r1', name : 'Mike' }
],
events : [
{
id : 1,
resourceId : 'r1',
startDate : new Date(2025, 2, 25),
endDate : new Date(2025, 3, 9),
name : 'Click me',
iconCls : 'b-fa b-fa-mouse-pointer'
}
],
startDate : new Date(2025, 0, 1, 6),
viewPreset : 'hourAndDay',
rowHeight : 50,
barMargin : 5,
multiEventSelect : true,
columns : [{ text : 'Name', field : 'name', width : 130 }],
});
- RUn this in console:
scheduler.scrollEventIntoView(scheduler.eventStore.first,{ behavior: "smooth", animate: true, block: "start" })
- The scrolled position is not the center of the event.
This is my suggested fix:
eventRecord.durationMS > timeAxis.endMS - timeAxis.startMS tests whether the event really is larger than the time range, so that it is extended to accommodate the event.