getMarkerPosition method
Pixel position of the marker for high: on the bisector of its slice, halfway between the hole edge and the
rim (with the hole) or 3.6 tenths of the radius in from the rim (without). [NaN, NaN] when high is not a
slice.
Implementation
@protected
@override
Float32List getMarkerPosition(Highlight high) {
final center = centerCircleBox;
var r = radius;
var off = r / 10 * 3.6;
if (isDrawHoleEnabled) {
off = (r - (r / 100 * holeRadius)) / 2;
}
r -= off;
final rotationAngle = this.rotationAngle;
final entryIndex = kotlinFloatToInt(high.x);
if (entryIndex < 0 ||
entryIndex >= _drawAngles.length ||
entryIndex >= _absoluteAngles.length) {
MPPointF.recycleInstance(center);
return Float32List.fromList([double.nan, double.nan]);
}
final offset = _drawAngles[entryIndex] / 2;
final angle =
(rotationAngle + _absoluteAngles[entryIndex] - offset) *
animator.phaseY *
Utils.DEG2RAD;
final x = r * math.cos(angle) + center.x;
final y = r * math.sin(angle) + center.y;
MPPointF.recycleInstance(center);
return Float32List.fromList([x, y]);
}