Class: MapSyncedCanvasLayer<P>
Defined in: src/sdk/components/map/layers/MapSyncedCanvasLayer.ts:8
A canvas map layer whose size and position is synced with the map projection window.
Extends
Extended by
Type Parameters
Type Parameter | Default type |
---|---|
P extends MapCanvasLayerProps <any > | MapCanvasLayerProps <any > |
Constructors
Constructor
new MapSyncedCanvasLayer<
P
>(props
):MapSyncedCanvasLayer
<P
>
Defined in: src/sdk/components/FSComponent.ts:73
Creates an instance of a DisplayComponent.
Parameters
Parameter | Type | Description |
---|---|---|
props | P | The propertis of the component. |
Returns
MapSyncedCanvasLayer
<P
>
Inherited from
Properties
context?
optional
context: [] =undefined
Defined in: src/sdk/components/FSComponent.ts:64
The context on this component, if any.
Inherited from
contextType?
readonly
optional
contextType: readonly [] =undefined
Defined in: src/sdk/components/FSComponent.ts:67
The type of context for this component, if any.
Inherited from
isInit
protected
isInit:boolean
=false
Defined in: src/sdk/components/map/layers/MapCanvasLayer.tsx:78
Inherited from
props
props:
P
&ComponentProps
Defined in: src/sdk/components/FSComponent.ts:61
The properties of the component.
Inherited from
Accessors
buffer
Get Signature
get buffer():
C
Defined in: src/sdk/components/map/layers/MapCanvasLayer.tsx:98
Gets this layer's buffer canvas instance.
Throws
Error if this layer's buffer canvas instance has not been initialized.
Returns
C
This layer's buffer canvas instance.
Inherited from
display
Get Signature
get display():
C
Defined in: src/sdk/components/map/layers/MapCanvasLayer.tsx:85
Gets this layer's display canvas instance.
Throws
Error if this layer's display canvas instance has not been initialized.
Returns
C
This layer's display canvas instance.
Inherited from
Methods
copyBufferToDisplay()
copyBufferToDisplay():
void
Defined in: src/sdk/components/map/layers/MapCanvasLayer.tsx:171
Copies the contents of the buffer to the display. Has no effect if this layer does not have a buffer.
Returns
void
Inherited from
MapCanvasLayer
.copyBufferToDisplay
createCanvasInstance()
protected
createCanvasInstance(canvas
,context
,isDisplayed
):MapCanvasLayerCanvasInstance
Defined in: src/sdk/components/map/layers/MapCanvasLayer.tsx:227
Creates a canvas instance.
Parameters
Parameter | Type | Description |
---|---|---|
canvas | HTMLCanvasElement | The canvas element. |
context | CanvasRenderingContext2D | The canvas 2D rendering context. |
isDisplayed | boolean | Whether the canvas is displayed. |
Returns
a canvas instance.
Inherited from
MapCanvasLayer
.createCanvasInstance
destroy()
destroy():
void
Defined in: src/sdk/components/FSComponent.ts:98
Destroys this component.
Returns
void
Inherited from
getContext()
protected
getContext(context
):never
Defined in: src/sdk/components/FSComponent.ts:106
Gets a context data subscription from the context collection.
Parameters
Parameter | Type | Description |
---|---|---|
context | never | The context to get the subscription for. |
Returns
never
The requested context.
Throws
An error if no data for the specified context type could be found.
Inherited from
getHeight()
getHeight():
number
Defined in: src/sdk/components/map/layers/MapCanvasLayer.tsx:134
Gets the height of the canvas element, in pixels.
Returns
number
the height of the canvas element.
Inherited from
getWidth()
getWidth():
number
Defined in: src/sdk/components/map/layers/MapCanvasLayer.tsx:126
Gets the width of the canvas element, in pixels.
Returns
number
the width of the canvas element.
Inherited from
isVisible()
isVisible():
boolean
Defined in: src/sdk/components/map/MapLayer.ts:38
Checks whether this layer is visible.
Returns
boolean
whether this layer is visible.
Inherited from
onAfterRender()
onAfterRender():
void
Defined in: src/sdk/components/map/layers/MapCanvasLayer.tsx:182
A callback called after the component renders.
Returns
void
Inherited from
onAttached()
onAttached():
void
Defined in: src/sdk/components/map/layers/MapSyncedCanvasLayer.ts:10
This method is called when this layer is attached to its parent map component.
Returns
void
Overrides
onBeforeRender()
onBeforeRender():
void
Defined in: src/sdk/components/FSComponent.ts:80
A callback that is called before the component is rendered.
Returns
void
Inherited from
onDetached()
onDetached():
void
Defined in: src/sdk/components/map/MapLayer.ts:108
This method is called when this layer is detached from its parent map component.
Returns
void
Inherited from
onMapProjectionChanged()
onMapProjectionChanged(
mapProjection
,changeFlags
):void
Defined in: src/sdk/components/map/layers/MapSyncedCanvasLayer.ts:30
This method is called when the map projection changes.
Parameters
Parameter | Type | Description |
---|---|---|
mapProjection | MapProjection | this layer's map projection. |
changeFlags | number | The types of changes made to the projection. |
Returns
void
Overrides
MapCanvasLayer
.onMapProjectionChanged
onSleep()
onSleep():
void
Defined in: src/sdk/components/map/MapLayer.ts:81
This method is called when this layer's parent map is put to sleep.
Returns
void
Inherited from
onUpdated()
onUpdated(
time
,elapsed
):void
Defined in: src/sdk/components/map/MapLayer.ts:101
This method is called once every map update cycle.
Parameters
Parameter | Type | Description |
---|---|---|
time | number | The current time as a UNIX timestamp. |
elapsed | number | The elapsed time, in milliseconds, since the last update. |
Returns
void
Inherited from
onVisibilityChanged()
onVisibilityChanged(
isVisible
):void
Defined in: src/sdk/components/map/layers/MapCanvasLayer.tsx:187
This method is called when this layer's visibility changes.
Parameters
Parameter | Type | Description |
---|---|---|
isVisible | boolean | Whether the layer is now visible. |
Returns
void
Inherited from
MapCanvasLayer
.onVisibilityChanged
onWake()
onWake():
void
Defined in: src/sdk/components/map/MapLayer.ts:74
This method is called when this layer's parent map is woken.
Returns
void
Inherited from
render()
render():
null
|VNode
Defined in: src/sdk/components/map/layers/MapCanvasLayer.tsx:256
Renders the component.
Returns
null
| VNode
A JSX element to be rendered.
Inherited from
setHeight()
setHeight(
height
):void
Defined in: src/sdk/components/map/layers/MapCanvasLayer.tsx:157
Sets the height of the canvas element, in pixels.
Parameters
Parameter | Type | Description |
---|---|---|
height | number | The new height. |
Returns
void
Inherited from
setVisible()
setVisible(
val
):void
Defined in: src/sdk/components/map/MapLayer.ts:46
Sets this layer's visibility.
Parameters
Parameter | Type | Description |
---|---|---|
val | boolean | Whether this layer should be visible. |
Returns
void
Inherited from
setWidth()
setWidth(
width
):void
Defined in: src/sdk/components/map/layers/MapCanvasLayer.tsx:142
Sets the width of the canvas element, in pixels.
Parameters
Parameter | Type | Description |
---|---|---|
width | number | The new width. |
Returns
void
Inherited from
tryGetBuffer()
tryGetBuffer():
undefined
|MapCanvasLayerCanvasInstance
Defined in: src/sdk/components/map/layers/MapCanvasLayer.tsx:118
Attempts to get this layer's buffer canvas instance.
Returns
undefined
| MapCanvasLayerCanvasInstance
This layer's buffer canvas instance, or undefined if it has not been initialized.
Inherited from
tryGetDisplay()
tryGetDisplay():
undefined
|MapCanvasLayerCanvasInstance
Defined in: src/sdk/components/map/layers/MapCanvasLayer.tsx:110
Attempts to get this layer's display canvas instance.
Returns
undefined
| MapCanvasLayerCanvasInstance
This layer's display canvas instance, or undefined if it has not been initialized.
Inherited from
updateCanvasSize()
protected
updateCanvasSize():void
Defined in: src/sdk/components/map/layers/MapCanvasLayer.tsx:234
Updates the canvas element's size.
Returns
void
Inherited from
MapCanvasLayer
.updateCanvasSize
updateFromProjectedSize()
protected
updateFromProjectedSize(projectedSize
):void
Defined in: src/sdk/components/map/layers/MapSyncedCanvasLayer.ts:20
Updates this layer according to the current size of the projected map window.
Parameters
Parameter | Type | Description |
---|---|---|
projectedSize | ReadonlyFloat64Array | The size of the projected map window. |
Returns
void
updateFromVisibility()
protected
updateFromVisibility():void
Defined in: src/sdk/components/map/layers/MapCanvasLayer.tsx:196
Updates this layer according to its current visibility.
Returns
void