Gojs-选中项移动

Posted on 2020-08-13 18:58  !sylar  阅读(513)  评论(0编辑  收藏  举报
 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为选中项,但是此时必须使用迭代才能拿到节点数据。核心代码