Add prettier and reformat code
This commit is contained in:
parent
68eb00bae9
commit
970a34981f
37 changed files with 3459 additions and 1969 deletions
|
|
@ -1,33 +1,47 @@
|
|||
BR.Elevation = L.Control.Elevation.extend({
|
||||
options: {
|
||||
width:$('#map').outerWidth(),
|
||||
width: $('#map').outerWidth(),
|
||||
margins: {
|
||||
top: 20,
|
||||
right: 30,
|
||||
bottom: 30,
|
||||
left: 60
|
||||
},
|
||||
theme: "steelblue-theme"
|
||||
theme: 'steelblue-theme'
|
||||
},
|
||||
|
||||
onAdd: function (map) {
|
||||
|
||||
onAdd: function(map) {
|
||||
var container = L.Control.Elevation.prototype.onAdd.call(this, map);
|
||||
|
||||
// revert registering touch events when touch screen detection is available and negative
|
||||
// see https://github.com/MrMufflon/Leaflet.Elevation/issues/67
|
||||
if (L.Browser.touch && BR.Browser.touchScreenDetectable && !BR.Browser.touchScreen) {
|
||||
|
||||
this._background.on("touchmove.drag", null).
|
||||
on("touchstart.drag", null).
|
||||
on("touchstart.focus", null);
|
||||
L.DomEvent.off(this._container, 'touchend', this._dragEndHandler, this);
|
||||
|
||||
this._background.on("mousemove.focus", this._mousemoveHandler.bind(this)).
|
||||
on("mouseout.focus", this._mouseoutHandler.bind(this)).
|
||||
on("mousedown.drag", this._dragStartHandler.bind(this)).
|
||||
on("mousemove.drag", this._dragHandler.bind(this));
|
||||
L.DomEvent.on(this._container, 'mouseup', this._dragEndHandler, this);
|
||||
if (
|
||||
L.Browser.touch &&
|
||||
BR.Browser.touchScreenDetectable &&
|
||||
!BR.Browser.touchScreen
|
||||
) {
|
||||
this._background
|
||||
.on('touchmove.drag', null)
|
||||
.on('touchstart.drag', null)
|
||||
.on('touchstart.focus', null);
|
||||
L.DomEvent.off(
|
||||
this._container,
|
||||
'touchend',
|
||||
this._dragEndHandler,
|
||||
this
|
||||
);
|
||||
|
||||
this._background
|
||||
.on('mousemove.focus', this._mousemoveHandler.bind(this))
|
||||
.on('mouseout.focus', this._mouseoutHandler.bind(this))
|
||||
.on('mousedown.drag', this._dragStartHandler.bind(this))
|
||||
.on('mousemove.drag', this._dragHandler.bind(this));
|
||||
L.DomEvent.on(
|
||||
this._container,
|
||||
'mouseup',
|
||||
this._dragEndHandler,
|
||||
this
|
||||
);
|
||||
}
|
||||
|
||||
return container;
|
||||
|
|
@ -44,10 +58,13 @@ BR.Elevation = L.Control.Elevation.extend({
|
|||
|
||||
function setParent(el, newParent) {
|
||||
newParent.appendChild(el);
|
||||
}
|
||||
this.addTo(map);
|
||||
}
|
||||
this.addTo(map);
|
||||
// move elevation graph outside of the map
|
||||
setParent(this.getContainer(), document.getElementById('elevation-chart'));
|
||||
setParent(
|
||||
this.getContainer(),
|
||||
document.getElementById('elevation-chart')
|
||||
);
|
||||
},
|
||||
|
||||
update: function(track, layer) {
|
||||
|
|
@ -62,7 +79,7 @@ BR.Elevation = L.Control.Elevation.extend({
|
|||
if (track && track.getLatLngs().length > 0) {
|
||||
this.addData(track.toGeoJSON(), layer);
|
||||
|
||||
layer.on("mouseout", this._hidePositionMarker.bind(this));
|
||||
layer.on('mouseout', this._hidePositionMarker.bind(this));
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue