Limit onClick to chartArea (#6227)

* Limit onClick to chartArea
* Utilize helpers.canvas._isPointInArea
This commit is contained in:
Jukka Kurkela 2019-10-27 22:29:07 +02:00 committed by Evert Timberg
parent 1ac3a697f7
commit db4a0d4569

View File

@ -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);
}