Open Hugofv opened 1 year ago
Any workaround?, I have the same issue
Here's a workaround based on the internal calculations:
onTimeChange={(visibleTimeStart, visibleTimeEnd, updateScrollCanvas) => {
let zoom = visibleTimeEnd - visibleTimeStart; // buffer - 1 (1 is visible area) divided by 2 (2 is the buffer split on the right and left of the timeline)
const minTimeAdjusted = minTime + zoom * (buffer - 1) / 2; // Hack to prevent scroll past the minTime
const maxTimeAdjusted = maxTime - zoom * (buffer - 1) / 2; // Hack to prevent scroll past the maxTime
if (visibleTimeStart < minTimeAdjusted && visibleTimeEnd > maxTimeAdjusted) {
updateScrollCanvas(minTimeAdjusted, maxTimeAdjusted, true)
} else if (visibleTimeStart < minTimeAdjusted) {
updateScrollCanvas(minTimeAdjusted, minTimeAdjusted + zoom, true)
} else if (visibleTimeEnd > maxTimeAdjusted) {
updateScrollCanvas(maxTimeAdjusted - zoom, maxTimeAdjusted, true)
} else {
updateScrollCanvas(visibleTimeStart, visibleTimeEnd)
}
}}
Hey, @rezgar, what is the buffer
in your workaround?
Well, how about fixed header then? @rezgar answer resolves the body issue but header is still not moving at all.
I have a problem that I want to limite visible range view using the follow code:
` const onTimeChange = ( visibleTimeStart, visibleTimeEnd, updateScrollCanvas ) => { const minDate = filter.startDate.clone().startOf("day").valueOf(); const maxDate = filter.endDate.clone().endOf("day").valueOf();
}; `
The results is bellow:
Left side - The Header keep fixed when the body is scrolling![Screen Recording 2022-09-10 at 20 23 25](https://user-images.githubusercontent.com/19415984/189505255-135e0fa1-cb43-4a3b-b02e-5341fd03aa77.gif)
Right side - The body finish before the header![Screen Recording 2022-09-10 at 20 24 41](https://user-images.githubusercontent.com/19415984/189505267-d299beda-e387-4b91-8479-06feb03cd13b.gif)
Anyone to help in this bug. I suggest pass the start and end datetime to limite the range view.