2017-10-31 17 views
-1

私はHammer.jsと正常道具で新しいですが、認識を回転させます。ハンマーjsの回転方向

私の質問どのように回転の方向を(左または右に)検出できますか?

答えて

1

rotationin the event objectをご覧ください。回転角度は度(回転方向に基づいて正または負)です。だからこのような何かがあなたのために働くはずです:

manager.on("rotate", function (event) { 
    console.log(event.type + " gesture detected."); 
    if(event.type === "rotate") { 
     console.log("Rotation by " + event.rotation + " degrees."); 
     if (event.rotation > 0) { 
      console.log("Clockwise"); 
     } else { 
      console.log("Counterclockwise"); 
     } 
    } 
}); 
+0

ええ、これは私が必要なものです。 ありがとう – Nordknight

関連する問題