DayPilot.Gantt.getCoords

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 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.

Example

const coords = gantt.getCoords();

if (coords) {
  const task = coords.task;
}

See Also

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript