From 079cfc43a6c7ffff75c6372de207b519205bcd6b Mon Sep 17 00:00:00 2001 From: zhipenglin Date: Mon, 26 Aug 2019 20:46:34 +0800 Subject: [PATCH] bug: PinchEvent angle NaN --- src/PinchableMixin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PinchableMixin.js b/src/PinchableMixin.js index 64984e1..e4b962c 100644 --- a/src/PinchableMixin.js +++ b/src/PinchableMixin.js @@ -7,7 +7,7 @@ function getPinchProps (touches) { return { identifier: touch.identifier, pageX: touch.pageX, pageY: touch.pageY }; }), center: {x: (touches[0].pageX + touches[1].pageX) / 2, y: (touches[0].pageY + touches[1].pageY) / 2 }, - angle: Math.atan() * (touches[1].pageY - touches[0].pageY) / (touches[1].pageX - touches[0].pageX) * 180 / Math.PI, + angle: Math.atan((touches[1].pageY - touches[0].pageY) / (touches[1].pageX - touches[0].pageX)) * 180 / Math.PI, distance: Math.sqrt(Math.pow(Math.abs(touches[1].pageX - touches[0].pageX), 2) + Math.pow(Math.abs(touches[1].pageY - touches[0].pageY), 2)) }; }