Konvajs:如何单击一个节点,开始移动鼠标,但拖动另一个节点?

Konvajs: How can I click one node, start moving mouse, but drag another node?

我有两个节点。是否可以单击一个节点,开始拖动,但改为拖动另一个节点?

我认为这会起作用:

node1.on('dragstart', () => {
  node1.stopDrag();
  // reset position
  node1.position({
    x: 100,
    y: 100
  })

  // start dragging another shape
  node2.startDrag();
});

此外,您可以尝试使用 clickmousedown 事件而不是 dragstart(选择更适合您的用例)。

演示:http://jsbin.com/quqekabeci/1/edit?js,output