Skip to content

Commit c00bd07

Browse files
committed
atribution support
1 parent 192c71b commit c00bd07

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

web/src/components/map/ToggleCompareMap.vue

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ function setAttributionControlStyle() {
5757
});
5858
}
5959
60-
const handleMapReady = (newMap: Map) => {
61-
console.log("Compare maps ready");
60+
const handleMapAReady = (newMap: Map) => {
6261
newMap.addControl(attributionControl);
6362
newMap.on('error', (response) => {
6463
// AbortErrors are raised when updating style of raster layers; ignore these
@@ -77,9 +76,29 @@ const handleMapReady = (newMap: Map) => {
7776
mapStore.setMapCenter(undefined, true);
7877
createMapControls();
7978
newMap.once('idle', () => {
80-
//layerStore.updateLayersShown();
81-
});
79+
layerStore.updateLayersShown();
80+
});
81+
}
82+
83+
const handleMapBReady = (newMap: Map) => {
84+
newMap.addControl(attributionControl);
85+
newMap.on('error', (response) => {
86+
// AbortErrors are raised when updating style of raster layers; ignore these
87+
if (response.error.message !== 'AbortError') console.error(response.error)
88+
});
8289
90+
/**
91+
* This is called on every click, and technically hides the tooltip on every click.
92+
* However, if a feature layer is clicked, that event is fired after this one, and the
93+
* tooltip is re-enabled and rendered with the desired contents. The net result is that
94+
* this only has a real effect when the base map is clicked, as that means that no other
95+
* feature layer can "catch" the event, and the tooltip stays hidden.
96+
*/
97+
newMap.on("click", () => {mapStore.clickedFeature = undefined});
98+
createMapControls();
99+
newMap.once('idle', () => {
100+
layerStore.updateLayersShown();
101+
});
83102
}
84103
85104
@@ -182,11 +201,13 @@ const swiperColor = computed(() => {
182201
handleColor: swiperColor
183202
}"
184203
layer-order="bottommost"
204+
:attribution-control="false"
185205
@panend="compareStore.updateMapStats($event)"
186206
@zoomend="compareStore.updateMapStats($event)"
187207
@pitchend="compareStore.updateMapStats($event)"
188208
@rotateend="compareStore.updateMapStats($event)"
189-
@map-ready="handleMapReady"
209+
@map-ready-a="handleMapAReady"
210+
@map-ready-b="handleMapBReady"
190211
class="map"
191212
/>
192213

web/src/components/sidebars/FloatingPanel.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function panelUpdated() {
110110
v-tooltip="'Compare Layers'"
111111
icon="mdi-compare"
112112
:color="compareStore.isComparing ? 'primary' : ''"
113-
@mousedown="compareStore.isComparing = !compareStore.isComparing"
113+
@click="compareStore.isComparing = !compareStore.isComparing"
114114
/>
115115

116116
<v-icon

web/src/store/compare.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ export const useMapCompareStore = defineStore('mapCompare', () => {
152152
return flatList;
153153
}
154154
const baseLayerSourceIds = getBaseLayerSourceIds();
155+
155156
layerStore.selectedLayers.forEach((layer) => {
156157
if (displayLayers.value.mapLayerA.find((l) => l.displayName === layer.name)?.state === false) {
157158
return;

0 commit comments

Comments
 (0)