clampPos method

int clampPos(
  1. int pos, [
  2. int min = 0
])

Make sure pos is between min (default: 0) and the length of this document.

Implementation

int clampPos(int pos, [int min = 0]) {
    return pos.clamp(min, length);
}