@@ -4,8 +4,6 @@ const defaults = require('../core/core.defaults');
44const Element = require ( '../core/core.element' ) ;
55const helpers = require ( '../helpers/index' ) ;
66
7- const valueOrDefault = helpers . valueOrDefault ;
8-
97const defaultColor = defaults . global . defaultColor ;
108
119defaults . _set ( 'global' , {
@@ -31,37 +29,37 @@ class Point extends Element {
3129 }
3230
3331 inRange ( mouseX , mouseY ) {
34- var vm = this . _view ;
32+ const vm = this . _view ;
3533 return vm ? ( ( Math . pow ( mouseX - vm . x , 2 ) + Math . pow ( mouseY - vm . y , 2 ) ) < Math . pow ( vm . hitRadius + vm . radius , 2 ) ) : false ;
3634 }
3735
3836 inXRange ( mouseX ) {
39- var vm = this . _view ;
37+ const vm = this . _view ;
4038 return vm ? ( Math . abs ( mouseX - vm . x ) < vm . radius + vm . hitRadius ) : false ;
4139 }
4240
4341 inYRange ( mouseY ) {
44- var vm = this . _view ;
42+ const vm = this . _view ;
4543 return vm ? ( Math . abs ( mouseY - vm . y ) < vm . radius + vm . hitRadius ) : false ;
4644 }
4745
4846 getCenterPoint ( ) {
49- var vm = this . _view ;
47+ const vm = this . _view ;
5048 return {
5149 x : vm . x ,
5250 y : vm . y
5351 } ;
5452 }
5553
5654 size ( ) {
57- var vm = this . _view ;
58- var radius = vm . radius || 0 ;
59- var borderWidth = vm . borderWidth || 0 ;
55+ const vm = this . _view ;
56+ const radius = vm . radius || 0 ;
57+ const borderWidth = vm . borderWidth || 0 ;
6058 return ( radius + borderWidth ) * 2 ;
6159 }
6260
6361 tooltipPosition ( ) {
64- var vm = this . _view ;
62+ const vm = this . _view ;
6563 return {
6664 x : vm . x ,
6765 y : vm . y ,
@@ -70,25 +68,23 @@ class Point extends Element {
7068 }
7169
7270 draw ( chartArea ) {
73- var vm = this . _view ;
74- var ctx = this . _ctx ;
75- var pointStyle = vm . pointStyle ;
76- var rotation = vm . rotation ;
77- var radius = vm . radius ;
78- var x = vm . x ;
79- var y = vm . y ;
80- var globalDefaults = defaults . global ;
81- var defaultColor = globalDefaults . defaultColor ; // eslint-disable-line no-shadow
82-
83- if ( vm . skip ) {
71+ const vm = this . _view ;
72+ const ctx = this . _ctx ;
73+ const pointStyle = vm . pointStyle ;
74+ const rotation = vm . rotation ;
75+ const radius = vm . radius ;
76+ const x = vm . x ;
77+ const y = vm . y ;
78+
79+ if ( vm . skip || radius <= 0 ) {
8480 return ;
8581 }
8682
8783 // Clipping for Points.
8884 if ( chartArea === undefined || helpers . canvas . _isPointInArea ( vm , chartArea ) ) {
89- ctx . strokeStyle = vm . borderColor || defaultColor ;
90- ctx . lineWidth = valueOrDefault ( vm . borderWidth , globalDefaults . elements . point . borderWidth ) ;
91- ctx . fillStyle = vm . backgroundColor || defaultColor ;
85+ ctx . strokeStyle = vm . borderColor ;
86+ ctx . lineWidth = vm . borderWidth ;
87+ ctx . fillStyle = vm . backgroundColor ;
9288 helpers . canvas . drawPoint ( ctx , pointStyle , radius , x , y , rotation ) ;
9389 }
9490 }
0 commit comments