chore: 基线 — 已发布壁纸现状原样入库(未做任何改动)
dist/ 为 Wallpaper Engine 网页壁纸「【崩坏:星穹铁道】昔涟」(workshopid 3604974793, version 2), 含两套预设 xilian / kv37,总计 105.1MB。本次提交不做任何修改,仅作为后续优化的对拍基线。
This commit is contained in:
commit
d8c7e492f7
35 files changed
+193916
No files matched your search
Vendored
+60
@@ -0,0 +1,60 @@
|
||||
export default class SpineController {
|
||||
constructor(containerId, config = {}) {
|
||||
this.containerId = containerId;
|
||||
this.config = {
|
||||
alpha: true,
|
||||
premultipliedAlpha: false,
|
||||
showControls: false,
|
||||
showLoading: false,
|
||||
...config,
|
||||
};
|
||||
|
||||
this.previousConfig = {};
|
||||
|
||||
this.container = document.getElementById(containerId);
|
||||
this.player = undefined;
|
||||
}
|
||||
|
||||
create() {
|
||||
if (!this.player) {
|
||||
const containerId = this.containerId;
|
||||
const config = this.config;
|
||||
this.player = new spine.SpinePlayer(containerId, config);
|
||||
}
|
||||
}
|
||||
|
||||
dispose() {
|
||||
if (this.player) {
|
||||
const container = this.container;
|
||||
this.player.dispose();
|
||||
container.innerHTML = "";
|
||||
this.player = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
adjustCanvas() {
|
||||
if (this.player) {
|
||||
const container = this.container;
|
||||
const canvas = container.querySelector("canvas");
|
||||
if (canvas) {
|
||||
const rect = container.getBoundingClientRect();
|
||||
canvas.style.width = "100%";
|
||||
canvas.style.height = "100%";
|
||||
canvas.width = rect.width;
|
||||
canvas.height = rect.height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
changeConfig(newConfig = {}) {
|
||||
if (this.player) {
|
||||
this.previousConfig = this.config;
|
||||
this.config = {
|
||||
...this.config,
|
||||
...newConfig,
|
||||
};
|
||||
this.dispose();
|
||||
this.create();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user