Skip to content

Commit

Permalink
Improve point.xRange and point.yRange performance (chartjs#5062)
Browse files Browse the repository at this point in the history
  • Loading branch information
fanthos authored and simonbrunel committed Dec 18, 2017
1 parent 512f633 commit 4dccc37
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/elements/element.point.js
Expand Up @@ -24,12 +24,12 @@ defaults._set('global', {

function xRange(mouseX) {
var vm = this._view;
return vm ? (Math.pow(mouseX - vm.x, 2) < Math.pow(vm.radius + vm.hitRadius, 2)) : false;
return vm ? (Math.abs(mouseX - vm.x) < vm.radius + vm.hitRadius) : false;
}

function yRange(mouseY) {
var vm = this._view;
return vm ? (Math.pow(mouseY - vm.y, 2) < Math.pow(vm.radius + vm.hitRadius, 2)) : false;
return vm ? (Math.abs(mouseY - vm.y) < vm.radius + vm.hitRadius) : false;
}

module.exports = Element.extend({
Expand Down

0 comments on commit 4dccc37

Please sign in to comment.