beforeLineTitleMove
Description
Fires before a text element of a line is moved
Usage
beforeLineTitleMove: (
event: MouseEvent,
lineId: string | number,
titleId: string | number,
coord: object
) => boolean | void;
Parameters
The callback of the event takes the following parameters:
event
- (required) a native HTML event objectlineId
- (required) the id of a linetitleId
- (required) the id of a text element of a linecoord
- (required) an object with the x and y coordinates of the text element position before movement
Returns
Return false
to prevent the text element of a line from being moved; otherwise, true
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", (event, lineId, titleId, coordinates) => {
console.log(`
LineTitle ${id} is position:
x: ${coordinates.x}
y: ${coordinates.y}
`);
return true;
});
Change log: Added in v4.1