mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Simplify the map legend
This commit is contained in:
parent
6c32eb918d
commit
11afa1f6d5
@ -5,33 +5,15 @@
|
|||||||
<ds-heading tag="h1">{{ $t('map.pageTitle') }}</ds-heading>
|
<ds-heading tag="h1">{{ $t('map.pageTitle') }}</ds-heading>
|
||||||
<small>
|
<small>
|
||||||
<div>
|
<div>
|
||||||
|
<span v-for="type in markers.types" :key="type.id">
|
||||||
<img
|
<img
|
||||||
:alt="$t('map.legend.theUser')"
|
:alt="$t('map.legend.' + type.id)"
|
||||||
src="/img/mapbox/marker-icons/mapbox-marker-icon-orange.svg"
|
:src="'/img/mapbox/marker-icons/' + type.icon.legendName"
|
||||||
width="15"
|
width="15"
|
||||||
/>
|
/>
|
||||||
{{ $t('map.legend.theUser') }}
|
{{ $t('map.legend.' + type.id) }}
|
||||||
|
|
||||||
<img
|
</span>
|
||||||
:alt="$t('map.legend.user')"
|
|
||||||
src="/img/mapbox/marker-icons/mapbox-marker-icon-green.svg"
|
|
||||||
width="15"
|
|
||||||
/>
|
|
||||||
{{ $t('map.legend.user') }}
|
|
||||||
|
|
||||||
<img
|
|
||||||
:alt="$t('map.legend.group')"
|
|
||||||
src="/img/mapbox/marker-icons/mapbox-marker-icon-blue.svg"
|
|
||||||
width="15"
|
|
||||||
/>
|
|
||||||
{{ $t('map.legend.group') }}
|
|
||||||
|
|
||||||
<img
|
|
||||||
:alt="$t('map.legend.event')"
|
|
||||||
src="/img/mapbox/marker-icons/mapbox-marker-icon-purple.svg"
|
|
||||||
width="15"
|
|
||||||
/>
|
|
||||||
{{ $t('map.legend.event') }}
|
|
||||||
</div>
|
</div>
|
||||||
</small>
|
</small>
|
||||||
</ds-space>
|
</ds-space>
|
||||||
@ -115,22 +97,38 @@ export default {
|
|||||||
groups: null,
|
groups: null,
|
||||||
posts: null,
|
posts: null,
|
||||||
markers: {
|
markers: {
|
||||||
icons: [
|
types: [
|
||||||
{
|
|
||||||
id: 'marker-blue',
|
|
||||||
name: 'mapbox-marker-icon-20px-blue.png',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'marker-green',
|
|
||||||
name: 'mapbox-marker-icon-20px-green.png',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
|
id: 'theUser',
|
||||||
|
icon: {
|
||||||
id: 'marker-orange',
|
id: 'marker-orange',
|
||||||
name: 'mapbox-marker-icon-20px-orange.png',
|
legendName: 'mapbox-marker-icon-orange.svg',
|
||||||
|
mapName: 'mapbox-marker-icon-20px-orange.png',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id: 'user',
|
||||||
|
icon: {
|
||||||
|
id: 'marker-green',
|
||||||
|
legendName: 'mapbox-marker-icon-green.svg',
|
||||||
|
mapName: 'mapbox-marker-icon-20px-green.png',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'group',
|
||||||
|
icon: {
|
||||||
|
id: 'marker-blue',
|
||||||
|
legendName: 'mapbox-marker-icon-blue.svg',
|
||||||
|
mapName: 'mapbox-marker-icon-20px-blue.png',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'event',
|
||||||
|
icon: {
|
||||||
id: 'marker-purple',
|
id: 'marker-purple',
|
||||||
name: 'mapbox-marker-icon-20px-purple.png',
|
legendName: 'mapbox-marker-icon-purple.svg',
|
||||||
|
mapName: 'mapbox-marker-icon-20px-purple.png',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
isImagesLoaded: false,
|
isImagesLoaded: false,
|
||||||
@ -339,15 +337,18 @@ export default {
|
|||||||
},
|
},
|
||||||
loadMarkersIconsAndAddMarkers() {
|
loadMarkersIconsAndAddMarkers() {
|
||||||
Promise.all(
|
Promise.all(
|
||||||
this.markers.icons.map(
|
this.markers.types.map(
|
||||||
(marker) =>
|
(marker) =>
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
// our images have to be in the 'static/img/*' folder otherwise they are not reachable via URL
|
// our images have to be in the 'static/img/*' folder otherwise they are not reachable via URL
|
||||||
this.map.loadImage('img/mapbox/marker-icons/' + marker.name, (error, image) => {
|
this.map.loadImage(
|
||||||
|
'img/mapbox/marker-icons/' + marker.icon.mapName,
|
||||||
|
(error, image) => {
|
||||||
if (error) throw error
|
if (error) throw error
|
||||||
this.map.addImage(marker.id, image)
|
this.map.addImage(marker.icon.id, image)
|
||||||
resolve()
|
resolve()
|
||||||
})
|
},
|
||||||
|
)
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
).then(() => {
|
).then(() => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user