The getCoords() method returns information about the current mouse cursor position relative to the Gantt Chart grid.
Available since 2023.3.5734.
DayPilot.Gantt.getCoords();Returns an object with the following properties:
x (number) - horizontal position in pixels
y (number) - vertical position in pixels
time (DayPilot.Date) - current position in the timeline
cell - current grid cell
task (DayPilot.Task) - current row task
taskOffset (object with x, y properties) - relative coordinates in pixels when the mouse cursor is on a task box
Returns null if the current position cannot be read, for example when the mouse cursor is outside of the grid.
const coords = gantt.getCoords();
if (coords) {
const task = coords.task;
}