diagram.addDiagramListener('SelectionMoved',e=>{
for (let it = e.diagram.selection.iterator; it.next(); ) {
// it.value可以拿到选中节点的Node数据
if (it.value instanceof go.Node) {
let nodeEdit = {
id: it.value.data.nodeId,
x: it.value.location.x,
y: it.value.location.y
}
}
}
})
Gojs 事件,e为选中项,但是此时必须使用迭代才能拿到节点数据。核心代码