Improve point.xRange and point.yRange performance (#5062)

This commit is contained in:
Boyi C 2017-12-19 03:24:02 +08:00 committed by Simon Brunel
parent b04ce949d1
commit ce1fc28b74

View File

@ -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({