2013-04-02 41 views

回答

0

簡單的解決方案是,您根本不旋轉圖像,您正在旋轉圖層,並且圖層的中心位置爲0,0,所以圖像圍繞此旋轉。如果您最初將圖像設置爲0,0,則會看到它旋轉得更好。

試試這些簡單的測試變化:

// reposition the layer 
    dlayerA1 = new Kinetic.Layer({x: 50,y: 50}); 

    //move the image 
    dImage1 = new Kinetic.Image({ 
       x: 0, 
       y: 0, 
       image: dicom1, 
       width: 150, 
       height: 150 
    }); 

    //inside handleMouseMove(), switch it to dImage1 being rotated <---- this is the fix that answers your original question 
    dImage1.rotate(degree); 
+0

太感謝你了,它的偉大工程。 – hncl