From 16f8bfb4fcfdcde5080e04806f98cf6cdad896ab Mon Sep 17 00:00:00 2001 From: Qiming zhao Date: Fri, 16 Jun 2017 18:29:59 +0800 Subject: [PATCH] Fix scale not accessible on IOS On IOS 10.3.2, `e.scale = dist / this.distance * this.scale` would not work, the access to `scale` would cause an error, but `Object.defineProperty` would works. --- index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 9836bc6..9b9343e 100644 --- a/index.js +++ b/index.js @@ -86,7 +86,13 @@ Pinch.prototype.ontouchmove = function(e) { e = E(e); // iphone does scale natively, just use that - e.scale = dist / this.distance * this.scale; + var scale = dist / this.distance * this.scale + Object.defineProperty(e, 'scale', { + get: function () { + return scale + } + }) + e.x = mid.x; e.y = mid.y;