Skip to content

EdgeInsets

Defined in: src/geo/edge_insets.ts:12

An EdgeInset object represents screen space padding applied to the edges of the viewport. This shifts the apparent 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

Defined in: src/geo/edge_insets.ts:70

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

ParameterTypeDescription
widthnumberthe width
heightnumberthe height

Returns

Point

the point


interpolate()

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

Defined in: src/geo/edge_insets.ts:53

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

Parameters

ParameterTypeDescription
startEdgeInsets | PaddingOptionsinterpolation start
targetPaddingOptionsinterpolation target
tnumberinterpolation step/weight

Returns

EdgeInsets

the insets


toJSON()

toJSON(): Complete<PaddingOptions>

Defined in: src/geo/edge_insets.ts:95

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

Returns

Complete<PaddingOptions>

state as json

Properties

bottom

bottom: number

Defined in: src/geo/edge_insets.ts:20

Default Value

ts
0

left

left: number

Defined in: src/geo/edge_insets.ts:24

Default Value

ts
0

right: number

Defined in: src/geo/edge_insets.ts:28

Default Value

ts
0

top

top: number

Defined in: src/geo/edge_insets.ts:16

Default Value

ts
0