From 935846c1d5f4784e5b6607d16466800073955366 Mon Sep 17 00:00:00 2001 From: Craig Kochis Date: Tue, 25 Jul 2023 12:51:23 -0400 Subject: [PATCH] add attribution to map by default --- src/ui/map.ts | 13 +++++++++++-- styles/radar.css | 30 ++++++++++++++++++++++++++---- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/src/ui/map.ts b/src/ui/map.ts index ce27e759..46bdd61b 100644 --- a/src/ui/map.ts +++ b/src/ui/map.ts @@ -12,7 +12,7 @@ const RADAR_LOGO_URL = 'https://api.radar.io/maps/static/images/logo.svg'; const defaultMaplibreOptions: Partial = { minZoom: 1, maxZoom: 20, - attributionControl: false, + attributionControl: true, dragRotate: false, touchPitch: false, maplibreLogo: false, @@ -53,7 +53,6 @@ class MapUI { { style }, mapOptions, ); - console.log('PASSED OPTIONS', mapOptions); Logger.debug(`initialize map with options: ${JSON.stringify(maplibreOptions)}`); // set container @@ -87,6 +86,16 @@ class MapUI { Logger.warn('map container does not have a set "width" or "height"'); } + // dont expand on mobile view by default + map.on('load', () => { + const attrib = document.querySelector('.maplibregl-ctrl-attrib') + if (attrib) { + attrib.classList.remove('maplibregl-compact-show'); + attrib.classList.remove('mapboxgl-compact-show'); + attrib.classList.add('loaded'); + } + }); + // TODO // add location button diff --git a/styles/radar.css b/styles/radar.css index 390a1e7c..b9853358 100644 --- a/styles/radar.css +++ b/styles/radar.css @@ -22,10 +22,6 @@ height: 38px; } -.maplibregl-marker:hover { - cursor: pointer; -} - @font-face { font-family: 'Graphik'; font-weight: 400; @@ -210,3 +206,29 @@ .radar-no-results { padding: 8px 16px; } + +.maplibregl-marker:hover { + cursor: pointer; +} + +.maplibregl-ctrl-attrib.maplibregl-compact { + padding: 2px 24px 2px 0 !important; +} +.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button { + background-color: #FFFFFF !important; +} +.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner { + display: none !important; +} + + +.maplibregl-ctrl-attrib.maplibregl-compact.maplibregl-compact-show.loaded { + padding: 2px 28px 2px 8px !important; +} +.maplibregl-ctrl-attrib.maplibregl-compact.maplibregl-compact-show.loaded .maplibregl-ctrl-attrib-inner { + display: block !important; +} +.maplibregl-ctrl-attrib.maplibregl-compact.maplibregl-compact-show.loaded .maplibregl-ctrl-attrib-button { + display: block !important; + background-color: rgb(0, 0, 0/5%) !important; +}