fix: defaults
This commit is contained in:
parent
3db9eefcc5
commit
7f4a80a767
|
@ -156,10 +156,16 @@ export default (latus) => class Pictured extends decorate(Trait) {
|
|||
|
||||
async load(json = {}) {
|
||||
await super.load(json);
|
||||
const {images} = this.params;
|
||||
const images = {
|
||||
...this.params.images,
|
||||
default: {
|
||||
...(this.params.images.default || {}),
|
||||
uri: this.entity.uri && !this.params.images.default.uri
|
||||
? this.entity.uri.replace('.entity.json', '.png')
|
||||
: this.params.images.default.uri,
|
||||
},
|
||||
};
|
||||
this.#currentImage = this.state.currentImage;
|
||||
images.default = images.default || {};
|
||||
images.default.uri = images.default.uri || this.entity.uri.replace('.entity.json', '.png');
|
||||
const {Image} = latus.get('%resources');
|
||||
this.#images = await mapValuesAsync(images, ({uri}) => Image.load(uri));
|
||||
this.#sprites = await mapValuesAsync(this.#images, async (image) => new Sprite(image));
|
||||
|
|
Loading…
Reference in New Issue
Block a user