@@ -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
0 commit comments