Remove added checkbox

pull/690/head
nchamo 2019-07-01 23:50:10 -03:00
rodzic e6bf5b9f77
commit ab094318c3
3 zmienionych plików z 3 dodań i 32 usunięć

Wyświetl plik

@ -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} />
<div className="opacity-slider theme-secondary hidden-xs">
Opacity: <input type="range" step="1" value={opacity} onChange={this.updateOpacity} />
<input type="checkbox" checked={opacityOnMap ? "checked" : ""} title="When checked, the underlying map will be affected by the opacity slider." onChange={this.updateOpacityOnMap} />
</div>
</div>);
}

Wyświetl plik

@ -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);
});

Wyświetl plik

@ -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%;