From d16c3f4356b665f99f75e8d6fe4294d482807d54 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Thu, 29 Dec 2016 17:30:01 +0100 Subject: [PATCH] Always show all features in inspect mode --- src/components/map/FeaturePropertyPopup.jsx | 5 +++-- src/components/map/InspectionMap.jsx | 6 ++---- src/libs/stylegen.js | 9 +++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/map/FeaturePropertyPopup.jsx b/src/components/map/FeaturePropertyPopup.jsx index b862b72..e6e41e0 100644 --- a/src/components/map/FeaturePropertyPopup.jsx +++ b/src/components/map/FeaturePropertyPopup.jsx @@ -24,13 +24,14 @@ const Panel = (props) => { } function renderFeature(feature) { + console.log(feature) return
{feature.layer['source-layer']} {renderProperties(feature)}
} -class FeatureLayerTable extends React.Component { +class FeaturePropertyPopup extends React.Component { render() { const features = this.props.features @@ -41,4 +42,4 @@ class FeatureLayerTable extends React.Component { } -export default FeatureLayerTable +export default FeaturePropertyPopup diff --git a/src/components/map/InspectionMap.jsx b/src/components/map/InspectionMap.jsx index 892a7ec..d672698 100644 --- a/src/components/map/InspectionMap.jsx +++ b/src/components/map/InspectionMap.jsx @@ -10,12 +10,10 @@ import 'mapbox-gl/dist/mapbox-gl.css' import '../../mapboxgl.css' function convertInspectStyle(mapStyle, sources, highlightedLayer) { - let coloredLayers = generateColoredLayers(sources) - const layer = colorHighlightedLayer(highlightedLayer) + const coloredLayers = generateColoredLayers(sources) + const layer = colorHighlightedLayer(highlightedLayer) if(layer) { - const idx = style.indexOfLayer(coloredLayers, layer.id) - coloredLayers.splice(idx, 1) coloredLayers.push(layer) } diff --git a/src/libs/stylegen.js b/src/libs/stylegen.js index 0d74b49..20c2080 100644 --- a/src/libs/stylegen.js +++ b/src/libs/stylegen.js @@ -75,12 +75,13 @@ function lineLayer(source, vectorLayer, color) { export function colorHighlightedLayer(layer) { if(!layer || layer.type === 'background' || layer.type === 'raster') return null - function changeFilter(l) { + function changeLayer(l) { if(layer.filter) { l.filter = layer.filter } else { delete l['filter'] } + l.id = l.id + '_highlight' return l } @@ -88,15 +89,15 @@ export function colorHighlightedLayer(layer) { const layers = [] if(layer.type === "fill" || layer.type === 'fill-extrusion') { - return changeFilter(polygonLayer(layer.source, layer['source-layer'], color, Color(color).alpha(0.2).string())) + return changeLayer(polygonLayer(layer.source, layer['source-layer'], color, Color(color).alpha(0.2).string())) } if(layer.type === "symbol" || layer.type === 'circle') { - return changeFilter(circleLayer(layer.source, layer['source-layer'], color)) + return changeLayer(circleLayer(layer.source, layer['source-layer'], color)) } if(layer.type === 'line') { - return changeFilter(lineLayer(layer.source, layer['source-layer'], color)) + return changeLayer(lineLayer(layer.source, layer['source-layer'], color)) } return null