Fix #48
This commit is contained in:
parent
26c3f3d382
commit
ed22ce6953
|
|
@ -34,6 +34,8 @@ export class SkinViewer {
|
||||||
|
|
||||||
private _disposed: boolean = false;
|
private _disposed: boolean = false;
|
||||||
private _renderPaused: boolean = false;
|
private _renderPaused: boolean = false;
|
||||||
|
private _skinSet: boolean = false;
|
||||||
|
private _capeSet: boolean = false;
|
||||||
|
|
||||||
constructor(options: SkinViewerOptions) {
|
constructor(options: SkinViewerOptions) {
|
||||||
this.domElement = options.domElement;
|
this.domElement = options.domElement;
|
||||||
|
|
@ -149,21 +151,33 @@ export class SkinViewer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get skinUrl(): string {
|
get skinUrl(): string | null {
|
||||||
return this.skinImg.src;
|
return this._skinSet ? this.skinImg.src : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
set skinUrl(url: string) {
|
set skinUrl(url: string | null) {
|
||||||
|
if (url === null) {
|
||||||
|
this._skinSet = false;
|
||||||
|
this.playerObject.skin.visible = false;
|
||||||
|
} else {
|
||||||
|
this._skinSet = true;
|
||||||
this.skinImg.src = url;
|
this.skinImg.src = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
get capeUrl(): string {
|
|
||||||
return this.capeImg.src;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set capeUrl(url: string) {
|
get capeUrl(): string | null {
|
||||||
|
return this._capeSet ? this.capeImg.src : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
set capeUrl(url: string | null) {
|
||||||
|
if (url === null) {
|
||||||
|
this._capeSet = false;
|
||||||
|
this.playerObject.cape.visible = false;
|
||||||
|
} else {
|
||||||
|
this._capeSet = true;
|
||||||
this.capeImg.src = url;
|
this.capeImg.src = url;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
get width(): number {
|
get width(): number {
|
||||||
return this.renderer.getSize(new Vector2()).width;
|
return this.renderer.getSize(new Vector2()).width;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue