Reputation: 4031
I am using hammer.js for handling my touch events. I am performing a zoom on a canvas element. With the touch event I can only get the offset of my touch event relative to the page and not to the canvas element. How can I solve this issue?
Upvotes: 1
Views: 1678
Reputation: 4031
Got it working this way:
hammertime_zoomer.on("transform", function(evt) {
var c = dojo.position(evt.target);
var c1 = c.x;
var c2 = c.y;
var p1 = evt.gesture.center.pageX;
var p2 = evt.gesture.center.pageY;
var x = p1 - c1;
var y = p2 - c2;
vp.zoomIt(x, y, evt.gesture.scale);
});
Upvotes: 1