getFractionX method
Returns the fractional X position of a given X coordinate within the bounds of this BoundingBox. Throws UnboundedError if X bounds are not set.
Implementation
double getFractionX(double x) {
if (this case BoundingBox(:final minX?, :final maxX?)) {
if (minX == maxX) {
return 0;
}
return (x - minX) / (maxX - minX);
}
throw UnboundedError(
message:
'Getting X-axis fraction is not possible without specific X-axis bounds. Please ensure minX and maxX are set. Current bounds: minX=$minX, maxX=$maxX',
);
}