Skip to content

Commit

Permalink
Utilize helpers.canvas._isPointInArea
Browse files Browse the repository at this point in the history
  • Loading branch information
kurkle committed Apr 30, 2019
1 parent d94e539 commit 87876f5
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/core/core.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 87876f5

Please sign in to comment.