forked from GEOLYTIX/xyz
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'GEOLYTIX:main' into main
- Loading branch information
Showing
13 changed files
with
97 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
export default function attribution(mapview) { | ||
|
||
if (typeof mapview.attribution !== 'object') return; | ||
|
||
if (!mapview.attribution.target) { | ||
|
||
mapview.attribution.node = mapview.target.appendChild( | ||
mapp.utils.html.node`<div class="map-attribution"> | ||
${mapview.attribution.logo}`) | ||
|
||
mapview.attribution.target = mapview.attribution.node | ||
.appendChild(mapp.utils.html.node`<div class="attribution-links">`) | ||
} | ||
|
||
mapview.attribution.links ??= {} | ||
|
||
mapview.attribution.check = () => { | ||
|
||
// Create clone of mapview.attribution.links which are always displayed. | ||
const links = structuredClone(mapview.attribution.links) | ||
|
||
// Assign layer.attribution for visible to layers to links. | ||
Object.values(mapview.layers) | ||
.filter(layer => !!layer.display) | ||
.filter(layer => !!layer.attribution) | ||
.forEach(layer => Object.assign(links, layer.attribution)) | ||
|
||
const elements = Object.entries(links) | ||
.map(entry => mapp.utils.html` | ||
<a target="_blank" href="${entry[1]}">${entry[0]}`) | ||
|
||
// Render all links into mapview.attribution.target. | ||
mapp.utils.render( | ||
mapview.attribution.target, | ||
mapp.utils.html.node`${elements}`) | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters