From: Jukka Kurkela Date: Sun, 27 Oct 2019 20:29:07 +0000 (+0200) Subject: Limit onClick to chartArea (#6227) X-Git-Tag: v3.0.0-alpha~301 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db4a0d45699dedff00c875087d9d07135a7d2e80;p=thirdparty%2FChart.js.git Limit onClick to chartArea (#6227) * Limit onClick to chartArea * Utilize helpers.canvas._isPointInArea --- diff --git a/src/core/core.controller.js b/src/core/core.controller.js index 98cffef26..f56b04901 100644 --- a/src/core/core.controller.js +++ b/src/core/core.controller.js @@ -1080,7 +1080,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) { + if (options.onClick && helpers.canvas._isPointInArea(e, me.chartArea)) { // Use e.native here for backwards compatibility options.onClick.call(me, e.native, me.active); }