afterLineTitleMove
描述
当连线的文本元素按网格步长移动时触发
用法
"afterLineTitleMove": ({
event: PointerEvent,
lineId: string | number,
titleId: string | number,
coords: object
}) => void;
参数
该事件的回调函数使用一个包含以下参数的对象进行调用:
event- 事件对象lineId- 连线的 idtitleId- 连线的文本元素的 idcoords- 一个包含移动后文本元素位置的x和y坐标的对象,其中:x- 文本元素的水平位置,从左向右移动y- 文本元素的垂直位置,从上向下移动
信息
如需处理 Diagram Editor 的内部事件,可以使用 on() 方法。
示例
// 初始化 Diagram Editor
const editor = new dhx.DiagramEditor("editor_container");
// 加载数据
editor.parse(data);
// 为事件绑定处理程序
editor.events.on("afterLineTitleMove", ({ titleId, coords }) => {
console.log(`
LineTitle ${titleId} is at the position:
x: ${coords.x}
y: ${coords.y}
`);
});
更新日志:自 v6.0 起,回调函数将参数作为对象接收