Skip to content

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

[bug] fix map legned render error when layer type is not assigned (#220)

Shan He89919b14b462
diff --git a/src/components/map/map-legend.js b/src/components/map/map-legend.js
index 8f502a7b5..4d3491238 100644
--- a/src/components/map/map-legend.js
+++ b/src/components/map/map-legend.js
@@ -45,11 +45,11 @@ const StyledMapControlLegend = styled.div`
font-size: 11px;
padding-right: ${props => props.theme.mapControl.padding}px;
}
-
- .legend--layer__title {
+
+ .legend--layer__title {
padding-right: ${props => props.theme.mapControl.padding}px;
}
-
+
.legend--layer_by {
color: ${props => props.theme.subtextColor};
}
@@ -113,13 +113,14 @@ const MultiColorLegend = ({layer, width}) => {
const MapLegend = ({layers}) => (
<div>
{layers.map((layer, index) => {
+ if (!layer.isValidToSave()) {
+ return null;
+ }
+
const colorChannelConfig = layer.getVisualChannelDescription('color');
const enableColorBy = colorChannelConfig.measure;
const width = DIMENSIONS.mapControl.width - 2 * DIMENSIONS.mapControl.padding;
- if (!layer.isValidToSave()) {
- return null;
- }
return (
<StyledMapControlLegend