nakarte

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

index.js (749B)


      1 import L from 'leaflet';
      2 import './style.css';
      3 
      4 const ZoomWithDisplay = L.Control.Zoom.extend({
      5     onAdd: function(map) {
      6         const container = L.Control.Zoom.prototype.onAdd.call(this, map);
      7         this._display = L.DomUtil.create('div', 'leaflet-control-zoom-display');
      8         container.insertBefore(this._display, this._zoomOutButton);
      9         map.on('zoomend', this._updateDisplay, this);
     10         this._updateDisplay();
     11         return container;
     12     },
     13 
     14     onRemove: function(map) {
     15         L.Control.Zoom.prototype.onRemove.call(this, map);
     16         map.off('zoomend', this._updateDisplay, this);
     17     },
     18 
     19     _updateDisplay: function() {
     20         this._display.innerHTML = this._map.getZoom();
     21     }
     22 
     23 });
     24 
     25 export default ZoomWithDisplay;