clamp method

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

Implementation

Vector2D clamp(Vector2D min, Vector2D max) => .vec2(
  math.min(max.x, math.max(min.x, x)),
  math.min(max.y, math.max(min.y, y)),
);