[core] add meta mobileWidth and mobileHeight params
This commit is contained in:
@@ -42,10 +42,13 @@ class Config {
|
||||
company: null,
|
||||
width: 800,
|
||||
height: 600,
|
||||
mobileWidth: null,
|
||||
mobileHeight: null,
|
||||
fps: 60,
|
||||
};
|
||||
if (params) {
|
||||
this.update(params);
|
||||
this.afterUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,12 +71,18 @@ class Config {
|
||||
if (this.meta.icon) this.icon = Config.absolutePath(this.meta.icon);
|
||||
}
|
||||
|
||||
afterUpdate() {
|
||||
if (this.meta.mobileWidth === null) this.meta.mobileWidth = this.meta.width;
|
||||
if (this.meta.mobileHeight === null) this.meta.mobileHeight = Math.round(this.meta.mobileWidth / 1.777777778);
|
||||
}
|
||||
|
||||
branch(params) {
|
||||
const result = new Config();
|
||||
for (const params of this._params) {
|
||||
result.update(params);
|
||||
}
|
||||
result.update(params);
|
||||
result.afterUpdate();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user