clampScalar method

Vector2 clampScalar(
  1. double minVal,
  2. double maxVal
)

Implementation

Vector2 clampScalar(double minVal, double maxVal) {
  x = Math.max(minVal, Math.min(maxVal, x));
  y = Math.max(minVal, Math.min(maxVal, y));

  return this;
}