commit 64115824a6e7a6ef0dea304fddefee001c46c346
parent 5c7f7918fc716477783afcb21f0ba9415713f15d
Author: Sergej Orlov <wladimirych@gmail.com>
Date: Tue, 6 Nov 2018 22:43:02 +0100
Merge branch '158-controls-horizontal' into release-5
Diffstat:
3 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/src/App.js b/src/App.js
@@ -57,10 +57,15 @@ function setUp() {
}
).addTo(map);
- new L.Control.Scale({imperial: false, position: 'topleft'}).addTo(map);
L.control.zoom().addTo(map);
+ new L.Control.Scale({
+ imperial: false,
+ position: 'topleft',
+ stackHorizontally: true
+ }).addTo(map);
+
new L.Control.TrackList.Ruler(tracklist).addTo(map);
const panoramas = new L.Control.Panoramas(document.getElementById('street-view'))
diff --git a/src/lib/leaflet.fixes/index.js b/src/lib/leaflet.fixes/index.js
@@ -8,6 +8,7 @@ function fixAll() {
fixMapKeypressEvent();
fixVectorDrawWhileAnimation();
fixVectorMarkerWorldJump()
+ allowControlHorizontalStacking();
}
// https://github.com/Leaflet/Leaflet/issues/3575
@@ -80,5 +81,16 @@ function fixVectorDrawWhileAnimation() {
L.Renderer.__animationFixed = true;
}
+function allowControlHorizontalStacking() {
+ const original_addTo = L.Control.prototype.addTo;
+ L.Control.prototype.addTo = function(map) {
+ console.log('!!!!!!!!!!');
+ const result = original_addTo.call(this, map);
+ if (this.options.stackHorizontally) {
+ L.DomUtil.addClass(this._container, 'leaflet-control-horizontal-stack');
+ }
+ return result;
+ }
+}
export {fixAll}
diff --git a/src/lib/leaflet.fixes/style.css b/src/lib/leaflet.fixes/style.css
@@ -1,3 +1,15 @@
.leaflet-popup-pane, .leaflet-control {
cursor: default;
+}
+
+.leaflet-control-horizontal-stack {
+ clear: none;
+}
+
+.leaflet-left .leaflet-control-horizontal-stack {
+ margin-left: 8px;
+}
+
+.leaflet-right .leaflet-control-horizontal-stack {
+ margin-right: 8px;
}
\ No newline at end of file