Skip to main content

afterItemMove

Description

Fires when an item is moved one grid step

note

The event doesn't work with the line object

Usage

afterItemMove: (
event: MouseEvent,
id: string | number,
coord: object
) => void;

Parameters

The callback of the event takes the following parameters:

  • event - (required) a native HTML event object
  • id - (required) the id of an item
  • coord - (required) an object with the x and y coordinates of the item position after movement

Example

// initializing Diagram Editor
const editor = new dhx.DiagramEditor("editor_container");
// loading data
editor.parse(data);

// attaching a handler to the event
editor.events.on("afterItemMove", (event, id, coordinates) => {
console.log(`
Item ${id} is position:
x: ${coordinates.x}
y: ${coordinates.y}
`);
});

Change log: Added in v4.0