Hide cape if cape is empty

This commit is contained in:
Pig Fang 2019-03-31 16:31:42 +08:00
parent 4897656425
commit 6d5ab8ed2e
2 changed files with 13 additions and 0 deletions

View File

@ -100,6 +100,10 @@ export default {
this.viewer.skinUrl = url || SkinSteve
},
cape(url) {
if (!url) {
this.viewer.playerObject.cape.visible = false
return
}
this.viewer.capeUrl = url
},
},

View File

@ -1,5 +1,8 @@
/* eslint-disable max-params */
/* eslint-disable max-classes-per-file */
import {
PlayerObject, SkinObject, CapeObject,
} from 'skinview3d'
export class SkinViewer {
disposed: boolean
@ -12,6 +15,8 @@ export class SkinViewer {
camera: { position: { z: number } }
playerObject: PlayerObject
constructor() {
this.skinUrl = ''
this.capeUrl = ''
@ -22,6 +27,10 @@ export class SkinViewer {
z: 0,
},
}
this.playerObject = {
skin: {} as SkinObject,
cape: {} as CapeObject,
}
}
dispose() {