From ec279e9c4048e55c7569d2cd1737a65c718e8313 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20Zag=C3=B3rski?= Date: Tue, 30 Apr 2024 13:02:59 +0200 Subject: [PATCH] add attribution in test --- test/apps/carto-map/app.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/test/apps/carto-map/app.ts b/test/apps/carto-map/app.ts index 576b53286ac..5dad609d1df 100644 --- a/test/apps/carto-map/app.ts +++ b/test/apps/carto-map/app.ts @@ -24,15 +24,20 @@ async function createMap(cartoMapId: string) { } // Get map info from CARTO and update deck - const {initialViewState, mapStyle, basemap, layers} = await fetchMap(options); + const {initialViewState, basemap, layers} = await fetchMap(options); deck.setProps({initialViewState, layers}); // Mapbox basemap (optional) - // const {label} = mapStyle.visibleLayerGroups; - // const MAP_STYLE = `https://basemaps.cartocdn.com/gl/${mapStyle.styleType}${ - // label ? '' : '-nolabels' - // }-gl-style/style.json`; - const map = new mapboxgl.Map({container: 'map', style: basemap?.styleUrl, interactive: false}); + const map = new mapboxgl.Map({ + container: 'map', + style: basemap?.styleUrl, + interactive: false, + attributionControl: false + }).addControl( + new mapboxgl.AttributionControl({ + customAttribution: basemap?.attribution + }) + ); deck.setProps({ controller: true, onViewStateChange: ({viewState}) => {