]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Bug in handler event.type='touchend' 1703/head
authorwuchangming <wuchangmingnice@163.com>
Fri, 27 Nov 2015 03:16:54 +0000 (11:16 +0800)
committerwuchangming <wuchangmingnice@163.com>
Fri, 27 Nov 2015 03:16:54 +0000 (11:16 +0800)
In Chorme.
while event.type = "touchend” ,  event.touches is a empty TouchList,
event.touches.length === 0

src/core/core.helpers.js

index d8c8ac4df0d2fe02f59b0de062a33ede4780de39..08fc3a419053b4bb1e6c29cad1a1da72c2e87849 100644 (file)
 
                        var d01 = Math.sqrt(Math.pow(current.x - previous.x, 2) + Math.pow(current.y - previous.y, 2));
                        var d12 = Math.sqrt(Math.pow(next.x - current.x, 2) + Math.pow(next.y - current.y, 2));
-                       
+
                        var s01 = d01 / (d01 + d12);
                        var s12 = d12 / (d01 + d12);
 
                                canvas = evt.currentTarget || evt.srcElement,
                                boundingRect = canvas.getBoundingClientRect();
 
-                       if (e.touches) {
+                       if (e.touches && e.touches.length > 0) {
                                mouseX = e.touches[0].clientX;
                                mouseY = e.touches[0].clientY;
 
                        }
 
                        // Scale mouse coordinates into canvas coordinates
-                       // by following the pattern laid out by 'jerryj' in the comments of 
+                       // by following the pattern laid out by 'jerryj' in the comments of
                        // http://www.html5canvastutorials.com/advanced/html5-canvas-mouse-coordinates/
 
                        // We divide by the current device pixel ratio, because the canvas is scaled up by that amount in each direction. However