kopia lustrzana https://github.com/OpenDroneMap/WebODM
Cleaner map controls, fix opacity label alignment
rodzic
59e104946c
commit
d73558256a
|
@ -4,8 +4,6 @@ import '../css/Map.scss';
|
||||||
import 'leaflet/dist/leaflet.css';
|
import 'leaflet/dist/leaflet.css';
|
||||||
import Leaflet from 'leaflet';
|
import Leaflet from 'leaflet';
|
||||||
import async from 'async';
|
import async from 'async';
|
||||||
import '../vendor/leaflet/L.Control.MousePosition.css';
|
|
||||||
import '../vendor/leaflet/L.Control.MousePosition';
|
|
||||||
import '../vendor/leaflet/Leaflet.Autolayers/css/leaflet.auto-layers.css';
|
import '../vendor/leaflet/Leaflet.Autolayers/css/leaflet.auto-layers.css';
|
||||||
import '../vendor/leaflet/Leaflet.Autolayers/leaflet-autolayers';
|
import '../vendor/leaflet/Leaflet.Autolayers/leaflet-autolayers';
|
||||||
// import '../vendor/leaflet/L.TileLayer.NoGap';
|
// import '../vendor/leaflet/L.TileLayer.NoGap';
|
||||||
|
@ -385,7 +383,7 @@ class Map extends React.Component {
|
||||||
|
|
||||||
this.map = Leaflet.map(this.container, {
|
this.map = Leaflet.map(this.container, {
|
||||||
scrollWheelZoom: true,
|
scrollWheelZoom: true,
|
||||||
positionControl: true,
|
positionControl: false,
|
||||||
zoomControl: false,
|
zoomControl: false,
|
||||||
minZoom: 0,
|
minZoom: 0,
|
||||||
maxZoom: 24
|
maxZoom: 24
|
||||||
|
@ -401,10 +399,6 @@ class Map extends React.Component {
|
||||||
mapView: this
|
mapView: this
|
||||||
});
|
});
|
||||||
|
|
||||||
let scaleControl = Leaflet.control.scale({
|
|
||||||
maxWidth: 250,
|
|
||||||
}).addTo(this.map);
|
|
||||||
|
|
||||||
//add zoom control with your options
|
//add zoom control with your options
|
||||||
let zoomControl = Leaflet.control.zoom({
|
let zoomControl = Leaflet.control.zoom({
|
||||||
position:'bottomleft'
|
position:'bottomleft'
|
||||||
|
@ -580,7 +574,6 @@ _('Example:'),
|
||||||
tiles: tiles,
|
tiles: tiles,
|
||||||
controls:{
|
controls:{
|
||||||
autolayers: this.autolayers,
|
autolayers: this.autolayers,
|
||||||
scale: scaleControl,
|
|
||||||
zoom: zoomControl
|
zoom: zoomControl
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -630,7 +623,7 @@ _('Example:'),
|
||||||
<div style={{height: "100%"}} className="map">
|
<div style={{height: "100%"}} className="map">
|
||||||
<ErrorMessage bind={[this, 'error']} />
|
<ErrorMessage bind={[this, 'error']} />
|
||||||
<div className="opacity-slider theme-secondary hidden-xs">
|
<div className="opacity-slider theme-secondary hidden-xs">
|
||||||
{_("Opacity:")} <input type="range" step="1" value={this.state.opacity} onChange={this.updateOpacity} />
|
<div className="opacity-slider-label">{_("Opacity:")}</div> <input type="range" step="1" value={this.state.opacity} onChange={this.updateOpacity} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Standby
|
<Standby
|
||||||
|
|
|
@ -11,6 +11,11 @@
|
||||||
margin-left: -100px;
|
margin-left: -100px;
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
padding-bottom: 6px;
|
padding-bottom: 6px;
|
||||||
|
.opacity-slider-label{
|
||||||
|
display: inline-block;
|
||||||
|
position: relative;
|
||||||
|
top: 2px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.leaflet-touch .leaflet-control-layers-toggle, .leaflet-control-layers-toggle{
|
.leaflet-touch .leaflet-control-layers-toggle, .leaflet-control-layers-toggle{
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
.leaflet-container .leaflet-control-mouseposition {
|
|
||||||
background-color: rgba(255, 255, 255, 0.7);
|
|
||||||
box-shadow: 0 0 5px #bbb;
|
|
||||||
padding: 0 5px;
|
|
||||||
margin:0;
|
|
||||||
color: #333;
|
|
||||||
font: 11px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
L.Control.MousePosition = L.Control.extend({
|
|
||||||
options: {
|
|
||||||
position: 'bottomleft',
|
|
||||||
separator: ' : ',
|
|
||||||
emptyString: 'Unavailable',
|
|
||||||
lngFirst: false,
|
|
||||||
numDigits: 5,
|
|
||||||
lngFormatter: undefined,
|
|
||||||
latFormatter: undefined,
|
|
||||||
prefix: ""
|
|
||||||
},
|
|
||||||
|
|
||||||
onAdd: function (map) {
|
|
||||||
this._container = L.DomUtil.create('div', 'leaflet-control-mouseposition');
|
|
||||||
L.DomEvent.disableClickPropagation(this._container);
|
|
||||||
map.on('mousemove', this._onMouseMove, this);
|
|
||||||
this._container.innerHTML=this.options.emptyString;
|
|
||||||
return this._container;
|
|
||||||
},
|
|
||||||
|
|
||||||
onRemove: function (map) {
|
|
||||||
map.off('mousemove', this._onMouseMove)
|
|
||||||
},
|
|
||||||
|
|
||||||
_onMouseMove: function (e) {
|
|
||||||
var lng = this.options.lngFormatter ? this.options.lngFormatter(e.latlng.lng) : L.Util.formatNum(e.latlng.lng, this.options.numDigits);
|
|
||||||
var lat = this.options.latFormatter ? this.options.latFormatter(e.latlng.lat) : L.Util.formatNum(e.latlng.lat, this.options.numDigits);
|
|
||||||
var value = this.options.lngFirst ? lng + this.options.separator + lat : lat + this.options.separator + lng;
|
|
||||||
var prefixAndValue = this.options.prefix + ' ' + value;
|
|
||||||
this._container.innerHTML = prefixAndValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
L.Map.mergeOptions({
|
|
||||||
positionControl: false
|
|
||||||
});
|
|
||||||
|
|
||||||
L.Map.addInitHook(function () {
|
|
||||||
if (this.options.positionControl) {
|
|
||||||
this.positionControl = new L.Control.MousePosition();
|
|
||||||
this.addControl(this.positionControl);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
L.control.mousePosition = function (options) {
|
|
||||||
return new L.Control.MousePosition(options);
|
|
||||||
};
|
|
Ładowanie…
Reference in New Issue