Skip to content

Commit

Permalink
add attribution to map by default
Browse files Browse the repository at this point in the history
  • Loading branch information
kochis committed Jul 25, 2023
1 parent 5bbcca2 commit 935846c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 6 deletions.
13 changes: 11 additions & 2 deletions src/ui/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const RADAR_LOGO_URL = 'https://api.radar.io/maps/static/images/logo.svg';
const defaultMaplibreOptions: Partial<maplibregl.MapOptions> = {
minZoom: 1,
maxZoom: 20,
attributionControl: false,
attributionControl: true,
dragRotate: false,
touchPitch: false,
maplibreLogo: false,
Expand Down Expand Up @@ -53,7 +53,6 @@ class MapUI {
{ style },
mapOptions,
);
console.log('PASSED OPTIONS', mapOptions);
Logger.debug(`initialize map with options: ${JSON.stringify(maplibreOptions)}`);

// set container
Expand Down Expand Up @@ -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

Expand Down
30 changes: 26 additions & 4 deletions styles/radar.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
height: 38px;
}

.maplibregl-marker:hover {
cursor: pointer;
}

@font-face {
font-family: 'Graphik';
font-weight: 400;
Expand Down Expand Up @@ -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;
}

0 comments on commit 935846c

Please sign in to comment.