Support Pl3xmap custom world icons

This commit is contained in:
James Lyne 2021-09-30 15:04:01 +01:00
parent ca1d90a739
commit 8f794d044f
4 changed files with 13 additions and 4 deletions

View File

@ -23,7 +23,8 @@
v-bind:value="[world.name,map.name]" v-model="currentMap" v-bind:value="[world.name,map.name]" v-model="currentMap"
:aria-labelledby="`${name}-${world.name}-${key}-label`"> :aria-labelledby="`${name}-${world.name}-${key}-label`">
<label :id="`${name}-${world.name}-${key}-label`" class="map" :for="`${name}-${world.name}-${key}`" :title="`${world.displayName} - ${map.displayName}`"> <label :id="`${name}-${world.name}-${key}-label`" class="map" :for="`${name}-${world.name}-${key}`" :title="`${world.displayName} - ${map.displayName}`">
<SvgIcon :name="map.getIcon()"></SvgIcon> <img v-if="map.hasCustomIcon()" :src="map.getIcon()" alt="" />
<SvgIcon v-else :name="map.getIcon()"></SvgIcon>
</label> </label>
</template> </template>
</div> </div>
@ -110,7 +111,7 @@ export default defineComponent({
height: 3.2rem; height: 3.2rem;
margin-right: 0.5rem; margin-right: 0.5rem;
.svg-icon { .svg-icon, img {
top: 0.2rem !important; top: 0.2rem !important;
right: 0.2rem !important; right: 0.2rem !important;
bottom: 0.2rem !important; bottom: 0.2rem !important;

View File

@ -91,10 +91,18 @@ export default class LiveAtlasMapDefinition {
: {x: latLng.lng / this.scale, y: y, z: -latLng.lat / this.scale}; : {x: latLng.lng / this.scale, y: y, z: -latLng.lat / this.scale};
} }
hasCustomIcon(): boolean {
return !!this.icon;
}
getIcon(): string { getIcon(): string {
let worldType: string, let worldType: string,
mapType: string; mapType: string;
if(this.icon) {
return this.icon;
}
switch(this.world.dimension) { switch(this.world.dimension) {
case 'nether': case 'nether':
worldType = 'nether'; worldType = 'nether';

View File

@ -142,7 +142,7 @@ export default class Pl3xmapMapProvider extends MapProvider {
background: 'transparent', background: 'transparent',
backgroundDay: 'transparent', backgroundDay: 'transparent',
backgroundNight: 'transparent', backgroundNight: 'transparent',
icon: undefined, icon: world.icon ? `${this.config.pl3xmap}images/icon/${world.icon}.png` : undefined,
imageFormat: 'png', imageFormat: 'png',
name: 'flat', name: 'flat',
displayName: 'Flat', displayName: 'Flat',

View File

@ -42,7 +42,7 @@
line-height: 2rem; line-height: 2rem;
-webkit-tap-highlight-color: transparent; -webkit-tap-highlight-color: transparent;
.svg-icon { .svg-icon, img {
display: inline-block; display: inline-block;
max-width: 3rem; max-width: 3rem;
max-height: 3rem; max-height: 3rem;