weasel API - v0.8.0
    Preparing search index...

    Function clampView

    • Clamp a View so the visible world rect stays within bounds.

      Visible world rect = [view.x, view.x + canvas.width / view.scale.x] × [view.y, view.y + canvas.height / view.scale.y].

      If the visible rect is larger than bounds along an axis (zoomed out past the bounds extent), the view is centered on that axis so bounds sits in the middle of the canvas.

      Parameters

      Returns View