doBoundaries method
Ensures that the width is within the specified boundaries.
Implementation
double doBoundaries(double width, (double, double) boundaries) {
if (width >= boundaries.$1 && width <= boundaries.$2) return width;
return max(min(boundaries.$2, width), boundaries.$1);
}