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?
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);
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.