beforeLineTitleMove
Description
Fires before a text element of a line is moved
Usage
"beforeLineTitleMove": ({
event: PointerEvent,
lineId: string | number,
titleId: string | number,
coords: obj
}) => boolean | void;
Parameters
The callback of the event is called with an object with the following parameters:
event
- an event objectlineId
- the id of a linetitleId
- the id of a text element of a linecoords
- an object with thex
andy
coordinates of the text element position before movement, where:x
- the horizontal position of the text element, moving from left to righty
- the vertical position of the text element, moving from top to bottom
Returns
The callback returns false
to prevent the text element of a line from being moved; otherwise, true
info
For handling the inner Diagram Editor events you can use the on() method.
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("beforeLineTitleMove", ({ titleId, coords }) => {
console.log(`
LineTitle ${titleId} is at the position:
x: ${coords.x}
y: ${coords.y}
`);
return true;
});
Change log:
- The callback function takes an object as a parameter since v6.0