support icon indicating copy to clipboard operation
support copied to clipboard

`scrollEventIntoView` does not scroll to the center of the event

Open ghulamghousdev opened this issue 9 months ago • 2 comments

Forum post

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:

  1. Go to basic scheduler example
  2. 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 }],
});

  1. RUn this in console:
scheduler.scrollEventIntoView(scheduler.eventStore.first,{ behavior: "smooth", animate: true, block: "start" })
  1. The scrolled position is not the center of the event.

ghulamghousdev avatar Apr 09 '25 06:04 ghulamghousdev

This is my suggested fix:

Image

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.

ExtAnimal avatar Apr 25 '25 04:04 ExtAnimal