g6-editor icon indicating copy to clipboard operation
g6-editor copied to clipboard

请问如何获取所有支持的事件名?

Open lianchi opened this issue 5 years ago • 4 comments

import G6Editor from '@antv/g6-editor'

const editor = new G6Editor()
const flow = new G6Editor.Flow()

请问 editorflow 支持的所有事件都有哪些?

目前我的需求: 从左边 itempanel 面板拖拽某个元素至右侧编辑区时(该元素的 id 被固定),判断当前编辑区是否存在 id 一样的元素,若存在,则弹框告警,同时中止拖拽。

所以我想是否存在「以拖拽方式新增元素」的事件,可以被我捕获到。 另外,目前 g6-editor 源码里已有类似「防重复 id」的处理,它会浏览器控制台触发 error。换个角度说,我是否也可以用 try catch 捕获到 error 报错,然后插入我的弹框逻辑?

lianchi avatar Mar 19 '19 07:03 lianchi

我看它源码里添加item结束时有graph.emit('aftereadditem', { type, model }); 你可以试试在你的代码里graph.on('aftereadditem',xxx),在xxx里写判断和移除的代码

guozhaolong avatar Apr 19 '19 10:04 guozhaolong

在哪里看的源码啊

papibabi avatar May 13 '19 04:05 papibabi

在哪里看的源码啊

g6的源码,github上有

guozhaolong avatar May 14 '19 09:05 guozhaolong

楼主实现了吗,如何可以中止拖拽

junob avatar Aug 07 '19 01:08 junob