Reputation: 45
I try to move a circle to mouseposition on an ipad with this code:
function CircleMovetoMouse(){
var mousePos = stage.getMousePosition();
var xpos = mousePos.x;
var ypos = mousePos.y ;
var circle1 = stage.get('#Circle1')[0];
new Kinetic.Tween({
node: circle1,
duration: 1,
x: xpos ,
y: ypos,
easing: Kinetic.Easings.EaseInOut
}).play();
$('#container').bind('click touchstart', function() {
CircleMovetoMouse()
});
works perfect on desktop but not on smartphone and ipad. I need it really badly so it would be really great if someone can help. thanks in advance.
Upvotes: 0
Views: 1027
Reputation: 3160
I think you need to use getTouchPosition() to get the touch coordinates. See the tutorial.
var touchPos = stage.getTouchPosition();
Also just FYI, the "click" equivalent for mobile events is "tap", not "touchstart".
$('#container').bind('click tap', function() {
CircleMovetoMouse()
});
Touchstart <=> mousedown.
Upvotes: 1