nakarte

Source code of https://map.sikmir.ru (fork)
git clone git://git.sikmir.ru/nakarte
Log | Files | Refs | LICENSE

commit f656854a6b698f4b7fa975076132bfc9cd73f2c2
parent 44139f485e2dc4aa80394979c44cc9d2df04595a
Author: myadzel <myadzel@gmail.com>
Date:   Fri, 25 May 2018 10:01:20 +0300

resize altitude profile on window resize

Diffstat:
Msrc/lib/leaflet.control.elevation-profile/elevation-profile.css | 5-----
Msrc/lib/leaflet.control.elevation-profile/index.js | 14+++-----------
2 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/src/lib/leaflet.control.elevation-profile/elevation-profile.css b/src/lib/leaflet.control.elevation-profile/elevation-profile.css @@ -53,7 +53,6 @@ overflow-x: scroll; overflow-y: hidden; position: relative; - display: block; } .elevation-profile-grid-label { @@ -120,10 +119,6 @@ display: none; } -.elevation-profile-cursor-hidden-while-drag { - display: none; -} - .elevation-profile-selection { background-color: #0078A8; opacity: .3; diff --git a/src/lib/leaflet.control.elevation-profile/index.js b/src/lib/leaflet.control.elevation-profile/index.js @@ -246,17 +246,6 @@ const ElevationProfile = L.Class.extend({ self._addTo(map); }); this.values = null; - - this._setupWindowResize(); - }, - - _setupWindowResize: function() { - let onWindowResize = this._onWindowResize.bind(this); - L.DomEvent.off(window, 'resize', onWindowResize, this); - L.DomEvent.on(window, 'resize', onWindowResize, this); - L.DomEvent.on(this, 'remove', function() { - L.DomEvent.off(window, 'resize', onWindowResize, this); - }); }, _onWindowResize: function() { @@ -267,6 +256,7 @@ const ElevationProfile = L.Class.extend({ this.svgWidth = this.drawingContainer.clientWidth * this.horizZoom; this.svg.setAttribute('width', this.svgWidth + 'px'); this.updateGraph(); + this.updateGraphSelection(); }, _addTo: function(map) { @@ -321,6 +311,7 @@ const ElevationProfile = L.Class.extend({ this.svgDragEvents.on('drag', this.onSvgDrag, this); this.svgDragEvents.on('click', this.onSvgClick, this); L.DomEvent.on(svg, 'dblclick', this.onSvgDblClick, this); + L.DomEvent.on(window, 'resize', this._onWindowResize, this); }, removeFrom: function(map) { @@ -334,6 +325,7 @@ const ElevationProfile = L.Class.extend({ map.removeLayer(this.polyline); map.removeLayer(this.trackMarker); map.removeLayer(this.polyLineSelection); + L.DomEvent.off(window, 'resize', this._onWindowResize, this); this._map = null; this.fire('remove'); return this;