Skip to content

Commit

Permalink
Smarter Icon Selection
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Sep 25, 2024
1 parent 3d2fe7d commit b9c33fd
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions api/web/src/components/util/IconSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,11 @@ export default {
},
},
modelValue: async function() {
if (this.modelValue && this.modelValue.includes(":")) {
await this.fetch();
}
await this.fetch();
}
},
mounted: async function() {
if (this.modelValue && this.modelValue.includes(":")) {
await this.fetch();
}
await this.fetch();
await this.Iconlistsets();
await this.Iconlists();
},
Expand All @@ -244,14 +240,24 @@ export default {
return String(url);
},
fetch: async function() {
let path = this.modelValue;
// This is unfortuantely but the CloudTAK Map uses the MapLibre Icon format
// While the backend uses the TAK Icon Format
if (
this.modelValue
&& (
this.modelValue.includes(":")
|| this.modelValue.split('/').length === 3
)
) {
let path = this.modelValue;
// MapLibre needs the palette name seperated by a ":" isntead of a "/"
if (path.includes(':')) path = path.split(':').join('/') + '.png';
// MapLibre needs the palette name seperated by a ":" isntead of a "/"
if (path.includes(':')) path = path.split(':').join('/') + '.png';
const iconset = path.split('/')[0];
const icon = path.split('/').splice(1).join('/');
this.selected = await std(`/api/iconset/${iconset}/icon/${encodeURIComponent(icon)}`);
const iconset = path.split('/')[0];
const icon = path.split('/').splice(1).join('/');
this.selected = await std(`/api/iconset/${iconset}/icon/${encodeURIComponent(icon)}`);
}
},
Iconlistsets: async function() {
this.loading.iconsets = true;
Expand Down

0 comments on commit b9c33fd

Please sign in to comment.