doBoundaries method

double doBoundaries(
  1. double width,
  2. (double, double) boundaries
)

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);
}