Skip to content

Commit

Permalink
documentation and MapboxOverlay.getCanvas
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisgervang committed Sep 15, 2023
1 parent 21cae68 commit 4affbea
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/api-reference/core/deck.md
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,19 @@ Frees all resources associated with this `Deck` instance.
`deck.finalize()`
##### `getCanvas` {#getcanvas}
Get the canvas element attached to this `Deck` instance.
`deck.getCanvas()`
Returns:
* Either an `HTMLCanvasElement` or `null` if one isn't assigned.
Notes:
* See the [canvas](#canvas) prop for more information.
##### `setProps` {#setprops}
Expand Down
3 changes: 3 additions & 0 deletions docs/api-reference/mapbox/mapbox-overlay.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ See [Deck.pickMultipleObjects](../core/deck.md#pickmultipleobjects).

Removes the control and deletes all resources.

##### getCanvas

See [Deck.getCanvas](../core/deck.md#getcanvas). When using `interleaved: true`, returns the base map's `canvas`.

## Remarks

Expand Down
5 changes: 5 additions & 0 deletions modules/mapbox/src/mapbox-overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ export default class MapboxOverlay implements IControl {
}
}

/** If interleaved: true, returns base map's canvas, otherwise forwards the Deck.getCanvas method. */
getCanvas(): HTMLCanvasElement | null {
return this._interleaved ? this._map.getCanvas() : this._deck.getCanvas();
}

private _handleStyleChange = () => {
resolveLayers(this._map, this._deck, this._props.layers, this._props.layers);
};
Expand Down

0 comments on commit 4affbea

Please sign in to comment.