* Border is counted as part of ArcElement
* improve calculation
'outerRadius',
'circumference'
], useFinalPosition);
- const rAdjust = this.options.spacing / 2;
+ const rAdjust = (this.options.spacing + this.options.borderWidth) / 2;
const _circumference = valueOrDefault(circumference, endAngle - startAngle);
const betweenAngles = _circumference >= TAU || _angleBetween(angle, startAngle, endAngle);
const withinRadius = _isBetween(distance, innerRadius + rAdjust, outerRadius + rAdjust);
options: {
spacing: 0,
offset: 0,
+ borderWidth: 0
}
});
options: {
spacing: 0,
offset: 0,
+ borderWidth: 0
}
});
options: {
spacing: 10,
offset: 0,
+ borderWidth: 0
+ }
+ });
+
+ expect(arc.inRange(7, 0)).toBe(false);
+ expect(arc.inRange(15, 0)).toBe(true);
+ });
+
+ it ('should include borderWidth for in range check', function() {
+ // Mock out the arc as if the controller put it there
+ var arc = new Chart.elements.ArcElement({
+ startAngle: 0,
+ endAngle: Math.PI / 2,
+ x: 0,
+ y: 0,
+ innerRadius: 5,
+ outerRadius: 10,
+ options: {
+ spacing: 0,
+ offset: 0,
+ borderWidth: 10
}
});
options: {
spacing: 0,
offset: 0,
+ borderWidth: 0
}
});
options: {
spacing: 0,
offset: 0,
+ borderWidth: 0
}
});
options: {
spacing: 0,
offset: 0,
+ borderWidth: 0
}
});
options: {
spacing: 10,
offset: 10,
+ borderWidth: 0
}
});
options: {
spacing: 0,
offset: 0,
+ borderWidth: 0
}
});
options: {
spacing: 0,
offset: 0,
+ borderWidth: 0
}
});
options: {
spacing: 0,
offset: 0,
+ borderWidth: 0
}
});
options: {
spacing: 0,
offset: 0,
+ borderWidth: 0,
scales: {
r: {
grid: {