From 97201587c05f490107b24c4695dc7e8977f7d7a7 Mon Sep 17 00:00:00 2001 From: Wouter R Date: Wed, 15 Jan 2014 17:30:11 +0100 Subject: [PATCH] Fix move/zoom/rotate buttons on android (both chrome and native browser). Remove reference to undefined variable; remove unneeded log message. --- js/Button.js | 8 +++++++- js/canvasDrawing.js | 2 +- js/sketches.js | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/js/Button.js b/js/Button.js index 16b9b4c..e88842d 100644 --- a/js/Button.js +++ b/js/Button.js @@ -28,7 +28,13 @@ var offset = $(element).offset(); _x = e.originalEvent.pageX - offset.left; _y = e.originalEvent.pageY - offset.top; - } + } + + //android+chrome-specific hack + if (e.originalEvent.changedTouches != undefined) { + _x = e.originalEvent.changedTouches[0].pageX - offset.left; + _y = e.originalEvent.changedTouches[0].pageY - offset.top; + } } var startDownTimer = function() { diff --git a/js/canvasDrawing.js b/js/canvasDrawing.js index 582eee2..9f42d4b 100644 --- a/js/canvasDrawing.js +++ b/js/canvasDrawing.js @@ -408,7 +408,7 @@ function onCanvasTouchMove(e) { // var x = e.touches[0].layerX; // var y = e.touches[0].layerY; - console.log("f:onCanvasTouchMove >> x,y = "+x+","+y+" , e: " , e); + //console.log("f:onCanvasTouchMove >> x,y = "+x+","+y+" , e: " , e); if (prevPoint.x != -1 || prevPoint.y != -1) { var dist = Math.sqrt(Math.pow((prevPoint.x - x), 2) + Math.pow((prevPoint.y - y), 2)); diff --git a/js/sketches.js b/js/sketches.js index a376ff3..602f70d 100644 --- a/js/sketches.js +++ b/js/sketches.js @@ -17,7 +17,7 @@ function getSavedSketchStatus() { } } }).fail(function() { - console.log("getSavedSketchStatus failed: ", response); + console.log("getSavedSketchStatus failed"); }); }