Namespace: limit

FlatView.limit

View limiting functions.

Methods

(static) letterbox() → {function}

Return a view limiter that constrains the zoom parameter such that zooming out is prevented beyond the point at which the image is fully visible. Unless the image and the viewport have the same aspect ratio, this will cause bands to appear around the image.

Returns:

view limiter

Type
function

(static) resolution(size) → {function}

Return a view limiter that prevents zooming in beyond the given resolution.

Parameters:
Name Type Description
size number

the image width in pixels

Returns:

view limiter

Type
function

(static) visibleX(min, max) → {function}

Return a view limiter that constrains the values of the x parameter that are inside the viewport.

Parameters:
Name Type Description
min number

the minimum x value

max number

the maximum x value

Returns:

view limiter

Type
function

(static) visibleY(min, max) → {function}

Return a view limiter that constrains the values of the y parameter that are inside the viewport.

Parameters:
Name Type Description
min number

the minimum y value

max number

the maximum y value

Returns:

view limiter

Type
function

(static) x(min, max) → {function}

Return a view limiter that constrains the x parameter.

Parameters:
Name Type Description
min number
max number
Returns:

view limiter

Type
function

(static) y(min, max) → {function}

Return a view limiter that constrains the y parameter.

Parameters:
Name Type Description
min number

the minimum y value.

max number

the maximum y value.

Returns:

view limiter

Type
function

(static) zoom(min, max) → {function}

Return a view limiter than constrains the zoom parameter.

Parameters:
Name Type Description
min number

the minimum zoom value

max number

the maximum zoom value

Returns:

view limiter

Type
function