title: KonvaJS : How to draw a line to connect two shape based on mouse move?
body: <p>I'am trying to draw a line to connect two shape based on mouse move. And I konw how to relize it by using native canvas. But have no idea how to realize it by using KonvaJS.
  Please help me on this.</p>
  <p>This image shows what result i what : <a href="https://i.stack.imgur.com/YoQrD.gif" rel="nofollow noreferrer">enter image description here</a></p>
  <p>And this is the code that i try to realize what I want. But it doesn't work.</p>
  <pre><code>            stage.on('mousedown', function(e) {
                  const a = e.target instanceof Konva.Rect;
                  if (!a) {
                      return;
                  } else {
                      
                      group.draggable(false);
                      group2.draggable(false);
                      
                      clickdot1 = e.target;
                      drawingLine = true;
                      }
              });
  
              stage.on('mousemove', function(e) {
                  if (!drawingLine) {
                      return;
                  }else{
                      if(clickdot1!=null&amp;&amp;drawingLine){
                          let lastLine = new Konva.Line({
                              stroke: '#df4b26',
                              strokeWidth: 5,
                              lineCap: 'round',
                              lineJoin: 'round',
                              points: [e.target.x(), e.target.y()],
                          });
                          connections.push(lastLine);
                          drawthings();
                      }
                  }   
              });
              
              function drawthings(){
                  for(let i = 0;i&lt;connections.length;i++){
                      animLayer.add(connections[i]);
                      animLayer.batchDraw();
                  }
              }
  </code></pre>