Перейти к основному содержимому

onMouseMove

Description

Функция вызывается при перемещении мыши над контейнером gantt

onMouseMove: (id: string | number, e: Event) => void;

Parameters

  • id - (required) string | number - id задачи, над которой перемещается указатель мыши
  • e - (required) Event - объект нативного события

Example

gantt.attachEvent("onMouseMove", function (id, e){
// любая ваша логика здесь
});

Details

Это событие является псевдонимом нативного обработчика события mousemove прикрепленного к элементу gantt.$root.

Если целевой элемент является узлом элемента задачи, в первый аргумент будет передано соответствующее id задачи. В противном случае первый аргумент будет равен null.

gantt.message({
expire: -1,
text: ""
});

const formatDate = gantt.date.date_to_str("%Y-%m-%d %H:%i");
gantt.attachEvent("onMouseMove", function (id, e){
const helper = gantt.utils.dom;
if(helper.isChildOf(e.target, gantt.$task_data)){
const textContainer = document.querySelector("#pointer-date");
const pos = helper.getRelativeEventPosition(e, gantt.$task_data);
const pointerDate = gantt.dateFromPos(pos.x);
textContainer.innerText = formatDate(pointerDate);
}
});
Need help?
Got a question about the documentation? Reach out to our technical support team for help and guidance. For custom component solutions, visit the Services page.