From 87876f5200387ced65118bb44ef55b43fb5ad51d Mon Sep 17 00:00:00 2001 From: Jukka Kurkela Date: Tue, 30 Apr 2019 12:30:16 +0300 Subject: [PATCH] Utilize helpers.canvas._isPointInArea --- src/core/core.controller.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/core/core.controller.js b/src/core/core.controller.js index 50087d44227..8cf04b0f827 100644 --- a/src/core/core.controller.js +++ b/src/core/core.controller.js @@ -141,13 +141,6 @@ function positionIsHorizontal(position) { return position === 'top' || position === 'bottom'; } -function eventInArea(e, area) { - return e.x > area.left - && e.x < area.right - && e.y > area.top - && e.y < area.bottom; -} - var Chart = function(item, config) { this.construct(item, config); return this; @@ -1001,7 +994,7 @@ helpers.extend(Chart.prototype, /** @lends Chart */ { helpers.callback(options.onHover || options.hover.onHover, [e.native, me.active], me); if (e.type === 'mouseup' || e.type === 'click') { - if (options.onClick && eventInArea(e, me.chartArea)) { + if (options.onClick && helpers.canvas._isPointInArea(e, me.chartArea)) { // Use e.native here for backwards compatibility options.onClick.call(me, e.native, me.active); }