71
就写编辑名称的功能吧。
先是监听单击事件
this.graph.on('cell:click', ({
cell, e }) => {
if (cell.isNode()) {
this.createDiv({
cell, e })
}
})
然后这个创建div的函数
createDiv ({
cell }) {
// const p = this.graph.clientToGraph(e.clientX, e.clientY)
const position = cell.position()
const pos = this.graph.localToGraph(position)
const size = cell.size()
const x = pos.x
const y = pos.y
const width = size.width
const height = size.height
this.editorParent = ToolsView.createElement(</