Hi Team,
I am using below code snippet to highlight complete Gantt row on hover but when I click on any task from grid and move mouse curser to any other task vertical scroll bar starts moving slowly.
Even on click also it moves a little.
My observations : gantt.refreshTask/click event is triggering scroll- bar event.
Is there any way to stop it ?
gantt.$highlight_id = null;
gantt.attachEvent("onMouseMove", function (id, e) {
if ((!id && gantt.$highlight_id) || (id && gantt.$highlight_id && (id != gantt.$highlight_id))) {
gantt.batchUpdate(function () {
gantt.eachTask(function (task) {
if (task.$highlighted) {
task.$highlighted = false;
}
})
})
gantt.$highlight_id = null;
}
if (id) {
var hover_task = gantt.getTask(id);
if (!hover_task.$highlighted) {
hover_task.$highlighted = true;
gantt.refreshTask(id)
}
gantt.$highlight_id = id;
}
else {
if (e.target.closest('[data-task-id]') && e.target.closest('.gantt_task_row')) {
const taskElement = e.target.closest('[data-task-id]');
const taskId = taskElement.getAttribute('data-task-id');
if (taskId) {
const hoverTask = gantt.getTask(taskId);
if (!hoverTask.$highlighted) {
hoverTask.$highlighted = true;
gantt.refreshTask(taskId);
}
gantt.$highlight_id = taskId;
}
}
}
});