Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

fix: remove ui buttons from map preview image (#3659)

Igor Dykhtadf9abf68f481
diff --git a/src/components/src/map/map-control.tsx b/src/components/src/map/map-control.tsx
index cc469d4fe..b2e1ad77a 100644
--- a/src/components/src/map/map-control.tsx
+++ b/src/components/src/map/map-control.tsx
@@ -160,7 +160,7 @@ function MapControlFactory(
{actionComponents.map((ActionComponent, index) => (
<ActionComponent key={index} className="map-control-action" {...actionComponentProps} />
))}
- {mapState && mapStateActions ? (
+ {mapState && mapStateActions && !restProps.isExport ? (
<MapNavigationControl
mapState={mapState}
mapIndex={mapIndex}
diff --git a/src/components/src/plot-container.tsx b/src/components/src/plot-container.tsx
index 8f07a68d9..1bb6095d3 100644
--- a/src/components/src/plot-container.tsx
+++ b/src/components/src/plot-container.tsx
@@ -33,9 +33,17 @@ const CLASS_FILTER = [
'mapboxgl-control-container',
'attrition-link',
'attrition-logo',
- 'map-control__panel-split-viewport-tools'
+ 'map-control__panel-split-viewport-tools',
+ 'map-navigation-control'
];
-const DOM_FILTER_FUNC = node => !CLASS_FILTER.includes(node.className);
+const DOM_FILTER_FUNC = node => {
+ const className = typeof node.className === 'string' ? node.className : '';
+ if (!className) {
+ return true;
+ }
+ const classes = className.split(/\s+/);
+ return !CLASS_FILTER.some(cls => classes.includes(cls));
+};
const OUT_OF_SCREEN_POSITION = -9999;
/**
@@ -75,7 +83,8 @@ const StyledPlotContainer = styled.div<StyledPlotContainerProps>`
.mapboxgl-ctrl-bottom-left,
.mapboxgl-ctrl-bottom-right,
.mapbox-attribution-container,
- .map-control__panel-split-viewport-tools {
+ .map-control__panel-split-viewport-tools,
+ .map-navigation-control {
display: none;
}