From 4f48a7a07c78ebf76f571150f0f1a80359fe4a16 Mon Sep 17 00:00:00 2001 From: Xaver Maierhofer Date: Sun, 26 Feb 2017 16:09:23 +0100 Subject: [PATCH] [TASK] Add zoom-control & adjust style --- lib/map.js | 4 ++- scss/modules/_leaflet.scss | 59 ++++++++++++++++++++++++++++++++------ scss/night.scss | 14 +++++++-- 3 files changed, 66 insertions(+), 11 deletions(-) diff --git a/lib/map.js b/lib/map.js index 13e4e5c..5690703 100644 --- a/lib/map.js +++ b/lib/map.js @@ -6,7 +6,7 @@ define(['map/clientlayer', 'map/labelslayer', var options = { worldCopyJump: true, - zoomControl: false + zoomControl: true }; var ButtonBase = L.Control.extend({ @@ -296,6 +296,8 @@ define(['map/clientlayer', 'map/labelslayer', layerControl = L.control.layers(baseLayers, [], { position: 'bottomright' }); layerControl.addTo(map); + map.zoomControl.setPosition('topright'); + var clientLayer = new ClientLayer({ minZoom: config.clientZoom }); clientLayer.addTo(map); clientLayer.setZIndex(5); diff --git a/scss/modules/_leaflet.scss b/scss/modules/_leaflet.scss index f1e778a..fea076e 100644 --- a/scss/modules/_leaflet.scss +++ b/scss/modules/_leaflet.scss @@ -36,17 +36,27 @@ } .leaflet-control-layers-toggle { - background: none; - height: auto; - width: auto; + background: $color-white; + border-radius: 50%; + color: $color-black; + display: block; + font-size: 1.6rem; + height: 1.8em; + line-height: 1.95; + margin-right: 16px; + opacity: .7; + text-align: center; + transition: background-color .5s, color .5s; + width: 1.8em; + + @media screen and (max-width: map-get($grid-breakpoints, lg) - 1) { + margin-right: -2px; + transform: scale(.8); + } &::before { - color: $color-primary; content: '\f229'; - display: inline-block; - font-family: $font-family-icons; - font-size: 2.3rem; - line-height: 1; + font-family: ionicons; speak: none; text-rendering: auto; } @@ -309,3 +319,36 @@ } } } + +.leaflet-control-zoom { + opacity: .7; + right: 16px; + top: 65px; + + @media screen and (max-width: map-get($grid-breakpoints, lg) - 1) { + right: calc(100vw - 50px); + top: -10px; + transform: scale(.8); + } + + a { + background: $color-white; + border-radius: 5px 5px 0 0; + color: $color-black; + display: block; + font-size: 40px; + height: 46px; + text-align: center; + transition: background-color .5s, color .5s; + width: 46px; + + &:hover { + color: $color-primary; + } + + + a { + border-radius: 0 0 5px 5px; + border-top: 1px solid $color-gray-light; + } + } +} diff --git a/scss/night.scss b/scss/night.scss index b70f738..11a2d27 100644 --- a/scss/night.scss +++ b/scss/night.scss @@ -17,18 +17,28 @@ html { background: transparentize($color-black, .98); } - //@import 'leaflet'; + //@import 'modules/leaflet'; .leaflet-container { background: $color-map-background; } - //@import 'modules/leaflet'; .leaflet-label { &.leaflet-label-right { background-color: $color-white; } } + .leaflet-control-zoom { + a { + background: lighten($color-white, 10); + color: $color-black; + + &:hover { + background: $color-white; + } + } + } + .leaflet-control-layers { &.leaflet-control { opacity: .9;