Skip to content

EdgeInsets

An EdgeInset object represents screen space padding applied to the edges of the viewport. This shifts the apprent center or the vanishing point of the map. This is useful for adding floating UI elements on top of the map and having the vanishing point shift as UI elements resize.

Methods

getCenter()

getCenter(width: number, height: number): Point

Utility method that computes the new apprent center or vanishing point after applying insets. This is in pixels and with the top left being (0.0) and +y being downwards.

Parameters

Parameter Type Description
width number the width
height number the height

Returns

Point

the point

Defined in

src/geo/edge_insets.ts:70


interpolate()

interpolate(start: EdgeInsets | PaddingOptions, target: PaddingOptions, t: number): EdgeInsets

Interpolates the inset in-place. This maintains the current inset value for any inset not present in target.

Parameters

Parameter Type Description
start EdgeInsets | PaddingOptions interpolation start
target PaddingOptions interpolation target
t number interpolation step/weight

Returns

EdgeInsets

the insets

Defined in

src/geo/edge_insets.ts:53


toJSON()

toJSON(): PaddingOptions

Returns the current state as json, useful when you want to have a read-only representation of the inset.

Returns

PaddingOptions

state as json

Defined in

src/geo/edge_insets.ts:95

Properties

bottom

bottom: number

Default Value

0

Defined in

src/geo/edge_insets.ts:20


left

left: number

Default Value

0

Defined in

src/geo/edge_insets.ts:24


right: number

Default Value

0

Defined in

src/geo/edge_insets.ts:28


top

top: number

Default Value

0

Defined in

src/geo/edge_insets.ts:16