2012-10-02 4 views

답변

4

새 줄을 만들어 mousedown의 레이어에 추가 할 수 있습니다.

 stage.on("mousedown", function(){ 
      if (moving){ 
       moving = false;layer.draw(); 
      } else { 
       var mousePos = stage.getMousePosition(); 
       //CHANGED - Create new line 
       line = new Kinetic.Line({ 
        points: [0, 0, 50, 50], 
        stroke: "red" 
       }); 
       //CHANGED - Add line to layer 
       layer.add(line); 
       //start point and end point are the same 
       line.getPoints()[0].x = mousePos.x; 
       line.getPoints()[0].y = mousePos.y; 
       line.getPoints()[1].x = mousePos.x; 
       line.getPoints()[1].y = mousePos.y; 

       moving = true;  
       layer.drawScene();    
      } 

     }); 

확인 데모 : 내가 필요 정확히 무엇 http://jsfiddle.net/QTsgn/

+0

, 나는 새로운 TIO kineticsjs을 유감스럽게 생각한다 :) – Mike

관련 문제