The getCoords() method returns information about the current mouse cursor position relative to the Gantt Chart grid.
Available since 2023.3.5734.
Declaration
DayPilot.Gantt.getCoords();Return Value
Returns an object with the following properties:
x(number) - horizontal position in pixelsy(number) - vertical position in pixelstime(DayPilot.Date) - current position in the timelinecell- current grid celltask(DayPilot.Task) - current row tasktaskOffset(object withx,yproperties) - 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.
Example
const coords = gantt.getCoords();
if (coords) {
const task = coords.task;
}See Also
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot