commit a949f298440e3414e418f27d470081d9905ce147
parent 0caf9140f91d99e43db93284a7807938751edd05
Author: Sergej Orlov <wladimirych@gmail.com>
Date: Wed, 9 May 2018 15:11:24 +0300
geolocation control: use button factory #64
Diffstat:
2 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/src/lib/leaflet.control.locate/index.js b/src/lib/leaflet.control.locate/index.js
@@ -1,5 +1,5 @@
import L from 'leaflet';
-import 'lib/leaflet.control.commons'
+import {makeButton} from 'lib/leaflet.control.commons';
import './style.css';
import localStorage from 'lib/safe-localstorage';
@@ -122,14 +122,9 @@ const LocateControl = L.Control.extend({
onAdd: function(map) {
this._map = map;
- const container = this._container = L.DomUtil.create(
- 'div', 'leaflet-bar leaflet-control leaflet-control-locate'
- );
- this._stopContainerEvents();
- const link = L.DomUtil.create('a', '', container);
- link.title = 'Where am I?';
- L.DomUtil.create('div', 'icon-position', link);
- L.DomEvent.on(container, 'click', () => this._handleEvent(EVENT_BUTTON_CLICK));
+ const {container, link} = makeButton('leaflet-control-locate', 'Where am I?', 'icon-position');
+ this._container = container;
+ L.DomEvent.on(link, 'click', () => this._handleEvent(EVENT_BUTTON_CLICK));
this._marker = new PositionMarker();
this._handleEvent(EVENT_INIT);
return container;
diff --git a/src/lib/leaflet.control.locate/style.css b/src/lib/leaflet.control.locate/style.css
@@ -1,10 +1,5 @@
.icon-position {
background-image: url("location-arrow.svg");
- background-size: 61%;
- background-repeat: no-repeat;
- background-position: 50% 50%;
- width: 100%;
- height: 100%;
}
.following .icon-position {