clamp method

Offset clamp(
  1. Offset min,
  2. Offset max
)

Implementation

Offset clamp(Offset min, Offset max) {
  return Offset(
    clampDouble(dx, min.dx, max.dx),
    clampDouble(dy, min.dy, max.dy),
  );
}