Skip to content

Commit 385ed90

Browse files
authored
fix(components): disable preserveDrawingBuffer by default for better performance (#3326)
preserveDrawingBuffer was hardcoded to true for the base map, causing a known WebGL performance penalty on every frame. This option is only needed for image export (canvas.toDataURL()), so we now only enable it when isExport is true. The plot-container already sets isExport: true when rendering for export, ensuring image export continues to work correctly. Users who need preserveDrawingBuffer for other purposes can still override it via bottomMapContainerProps. Addresses #3237 Signed-off-by: pierreeurope <pierre.europe@pm.me>
1 parent f182d6c commit 385ed90

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/components/src/map-container.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,7 @@ export default function MapContainerFactory(
11121112
const internalViewState = this.context?.getInternalViewState(index);
11131113
const mapProps = {
11141114
...internalViewState,
1115-
preserveDrawingBuffer: true,
1115+
preserveDrawingBuffer: this.props.isExport ?? false,
11161116
mapboxAccessToken: currentStyle?.accessToken || mapboxApiAccessToken,
11171117
// baseApiUrl: mapboxApiUrl,
11181118
mapLib: baseMapLibraryConfig.getMapLib(),

0 commit comments

Comments
 (0)