From 4028a4fb50d3cbb8a1642971655b2b26678547e6 Mon Sep 17 00:00:00 2001 From: dleadbetter Date: Mon, 22 Jul 2024 21:08:13 -0400 Subject: [PATCH] CDC #248 - Adding "preserveDrawingBuffer" prop to MapDraw component --- packages/geospatial/src/components/MapDraw.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/geospatial/src/components/MapDraw.js b/packages/geospatial/src/components/MapDraw.js index be693a29..3e395879 100644 --- a/packages/geospatial/src/components/MapDraw.js +++ b/packages/geospatial/src/components/MapDraw.js @@ -82,6 +82,11 @@ type Props = { */ onGeocodingSelection?: (data: any) => void, + /** + * If `true`, the map's canvas can be exported to a PNG using `map.getCanvas().toDataURL()`. + */ + preserveDrawingBuffer?: boolean, + /** * Map style object. */ @@ -197,8 +202,9 @@ const MapDraw = (props: Props) => { setLoaded(true)} mapLib={maplibregl} + onLoad={() => setLoaded(true)} + preserveDrawingBuffer={props.preserveDrawingBuffer} ref={mapRef} style={style} mapStyle={mapStyleUrl} @@ -241,6 +247,7 @@ const MapDraw = (props: Props) => { MapDraw.defaultProps = { buffer: DEFAULT_BUFFER, cooperativeGestures: true, + preserveDrawingBuffer: false, zoomDuration: DEFAULT_ZOOM_DELAY };