Search code examples
javascripthtmlkineticjspuzzle

Multi-touch for my rotation KineticJs


i am currenly using kineticJs v4.5.3 , i am doing jig-saw puzzle and my puzzle can be rotate with "click" event , but now i want to change to multi-touch which allows me to use 2 finger or hands to rotate the jig-saw pieces, anyone have any idea of that? Thanks :)

piecesArray[i][j].shape.on("mousedown", function () {
    this.moveToTop();
    this.rotateDeg(90)
    layer.draw();
});

My JsFiddle : http://jsfiddle.net/e70n2693/7/


Solution

  • You may use HammerJS with KineticJS v5.1.0:

    Hammer(rect).on('rotate', callback);
    

    https://github.com/lavrton/KineticJS-HammerJS-test

    http://jsfiddle.net/lavrton/w4HgN/