Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

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

Open
lianchi opened this issue Mar 19, 2019 · 4 comments
Open

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

lianchi opened this issue Mar 19, 2019 · 4 comments

Comments

@lianchi
Copy link

lianchi commented Mar 19, 2019

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 报错,然后插入我的弹框逻辑?

@guozhaolong
Copy link

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

@papibabi
Copy link

在哪里看的源码啊

@guozhaolong
Copy link

在哪里看的源码啊

g6的源码,github上有

@junob
Copy link

junob commented Aug 7, 2019

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants