Skip to content

Commit 14590e7

Browse files
committed
Bump version to v0.4.4
1 parent 28232ef commit 14590e7

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

chartjs-plugin-zoom.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
22
* chartjs-plugin-zoom
33
* http://chartjs.org/
4-
* Version: 0.4.3
4+
* Version: 0.4.4
55
*
66
* Copyright 2016 Evert Timberg
77
* Released under the MIT license
@@ -398,9 +398,10 @@ var zoomPlugin = {
398398
zoomNS.zoomCumulativeDelta = 0;
399399
});
400400

401-
var currentDeltaX = null, currentDeltaY = null;
401+
var currentDeltaX = null, currentDeltaY = null, panning = false;
402402
var handlePan = function handlePan(e) {
403403
if (currentDeltaX !== null && currentDeltaY !== null) {
404+
panning = true;
404405
var deltaX = e.deltaX - currentDeltaX;
405406
var deltaY = e.deltaY - currentDeltaY;
406407
currentDeltaX = e.deltaX;
@@ -419,7 +420,17 @@ var zoomPlugin = {
419420
currentDeltaX = null;
420421
currentDeltaY = null;
421422
zoomNS.panCumulativeDelta = 0;
423+
setTimeout(function() { panning = false; }, 500);
422424
});
425+
426+
chartInstance.zoom._ghostClickHandler = function(e) {
427+
if (panning) {
428+
e.stopImmediatePropagation();
429+
e.preventDefault();
430+
}
431+
};
432+
node.addEventListener('click', chartInstance.zoom._ghostClickHandler);
433+
423434
chartInstance._mc = mc;
424435
}
425436
},
@@ -466,6 +477,10 @@ var zoomPlugin = {
466477
node.removeEventListener('wheel', chartInstance.zoom._wheelHandler);
467478
}
468479

480+
if (Hammer) {
481+
node.removeEventListener('click', chartInstance.zoom._ghostClickHandler);
482+
}
483+
469484
delete chartInstance.zoom;
470485

471486
var mc = chartInstance._mc;

chartjs-plugin-zoom.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "chartjs-plugin-zoom",
33
"description": "Simple HTML5 charts using the canvas element.",
4-
"version": "0.4.3",
4+
"version": "0.4.4",
55
"license": "MIT",
66
"main": "src/chart.zoom.js",
77
"repository": {

0 commit comments

Comments
 (0)