diff --git a/app/static/app/js/MapView.jsx b/app/static/app/js/MapView.jsx index a62bfa8f..91aeaa95 100644 --- a/app/static/app/js/MapView.jsx +++ b/app/static/app/js/MapView.jsx @@ -24,13 +24,11 @@ class MapView extends React.Component { this.state = { opacity: 100, - opacityOnMap: true, selectedMapType: props.selectedMapType, tiles: this.getTilesByMapType(props.selectedMapType) }; this.updateOpacity = this.updateOpacity.bind(this); - this.updateOpacityOnMap = this.updateOpacityOnMap.bind(this); this.getTilesByMapType = this.getTilesByMapType.bind(this); this.handleMapTypeButton = this.handleMapTypeButton.bind(this); } @@ -66,15 +64,9 @@ class MapView extends React.Component { opacity: parseFloat(evt.target.value), }); } - - updateOpacityOnMap(evt) { - this.setState({ - opacityOnMap: evt.target.checked, - }); - } render(){ - const { opacity, opacityOnMap } = this.state; + const { opacity } = this.state; let mapTypeButtons = [ { label: "Orthophoto", @@ -111,12 +103,10 @@ class MapView extends React.Component { tiles={this.state.tiles} showBackground={true} opacity={opacity} - opacityOnMap={opacityOnMap} mapType={this.state.selectedMapType} public={this.props.public} />
Opacity: -
); } diff --git a/app/static/app/js/components/Map.jsx b/app/static/app/js/components/Map.jsx index 886fb199..ae9abad4 100644 --- a/app/static/app/js/components/Map.jsx +++ b/app/static/app/js/components/Map.jsx @@ -26,7 +26,6 @@ class Map extends React.Component { minzoom: 0, showBackground: false, opacity: 100, - opacityOnMap: true, mapType: "orthophoto", public: false }; @@ -37,7 +36,6 @@ class Map extends React.Component { showBackground: PropTypes.bool, tiles: PropTypes.array.isRequired, opacity: PropTypes.number, - opacityOnMap: PropTypes.bool, mapType: PropTypes.oneOf(['orthophoto', 'dsm', 'dtm']), public: PropTypes.bool }; @@ -333,21 +331,8 @@ https://a.tile.openstreetmap.org/{z}/{x}/{y}.png } componentDidUpdate(prevProps) { - let opacity = this.props.opacity / 100; - - Object.values(this.autolayers._layers) - .filter(layerContainer => layerContainer.overlay) - .map(layerContainer => layerContainer.layer) - .filter(layer => !this.imageryLayers.includes(layer)) - .filter(layer => layer.setOpacity) - .forEach(layer => layer.setOpacity(opacity)); - - - if (!this.props.opacityOnMap) { - opacity = 1; - } this.imageryLayers.forEach(imageryLayer => { - imageryLayer.setOpacity(opacity); + imageryLayer.setOpacity(this.props.opacity / 100); this.updatePopupFor(imageryLayer); }); diff --git a/app/static/app/js/css/MapView.scss b/app/static/app/js/css/MapView.scss index e51cdb14..5a886e7f 100644 --- a/app/static/app/js/css/MapView.scss +++ b/app/static/app/js/css/MapView.scss @@ -13,14 +13,10 @@ position: relative; top: 6px; } - - input[type="checkbox"]{ - margin-left: 6px - } .opacity-slider{ text-align: center; - width: 225px; + width: 220px; position: absolute; bottom: -32px; left: 50%;