fix(showcase): fixed an issue where the position wouldn't load in wallpaper engine
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -37,3 +37,4 @@ dist-ssr
|
|||||||
*.njsproj
|
*.njsproj
|
||||||
*.sln
|
*.sln
|
||||||
*.sw?
|
*.sw?
|
||||||
|
temp
|
||||||
|
|||||||
@@ -24,15 +24,7 @@ export default class Matcher {
|
|||||||
'assets',
|
'assets',
|
||||||
`return new Evalable(config, assets).${name}`)
|
`return new Evalable(config, assets).${name}`)
|
||||||
)(Evalable, this.#config, this.#assets)
|
)(Evalable, this.#config, this.#assets)
|
||||||
if (matches.length > 1) {
|
this.content = matches.length > 1 ? this.content.replace(match, result) : result
|
||||||
try {
|
|
||||||
this.content = this.content.replace(match, result)
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error(e)
|
|
||||||
}
|
|
||||||
} else if (matches.length === 1) {
|
|
||||||
this.content = result
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return this.content
|
return this.content
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ export default function spinePlayer(el) {
|
|||||||
entry.mixDuration = 0.3;
|
entry.mixDuration = 0.3;
|
||||||
widget.animationState.addAnimation(0, "Idle", true, 0);
|
widget.animationState.addAnimation(0, "Idle", true, 0);
|
||||||
}
|
}
|
||||||
|
window.settings.loadViewport()
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -150,45 +150,37 @@ export default class Settings {
|
|||||||
document.getElementById("custom_background_clear").disabled = true
|
document.getElementById("custom_background_clear").disabled = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadViewport() {
|
||||||
|
this.spinePlayer.updateViewport({
|
||||||
|
padLeft: `${this.#padLeft}%`,
|
||||||
|
padRight: `${this.#padRight}%`,
|
||||||
|
padTop: `${this.#padTop}%`,
|
||||||
|
padBottom: `${this.#padBottom}%`,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
positionPadding(key, value) {
|
positionPadding(key, value) {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case "left":
|
case "left":
|
||||||
this.#padLeft = value
|
this.#padLeft = value
|
||||||
this.spinePlayer.updateViewport({
|
|
||||||
padLeft: `${value}%`,
|
|
||||||
padRight: `${this.#padRight}%`,
|
|
||||||
padTop: `${this.#padTop}%`,
|
|
||||||
padBottom: `${this.#padBottom}%`,
|
|
||||||
})
|
|
||||||
break;
|
break;
|
||||||
case "right":
|
case "right":
|
||||||
this.#padRight = value
|
this.#padRight = value
|
||||||
this.spinePlayer.updateViewport({
|
|
||||||
padLeft: `${this.#padLeft}%`,
|
|
||||||
padRight: `${value}%`,
|
|
||||||
padTop: `${this.#padTop}%`,
|
|
||||||
padBottom: `${this.#padBottom}%`,
|
|
||||||
})
|
|
||||||
break;
|
break;
|
||||||
case "top":
|
case "top":
|
||||||
this.#padTop = value
|
this.#padTop = value
|
||||||
this.spinePlayer.updateViewport({
|
|
||||||
padLeft: `${this.#padLeft}%`,
|
|
||||||
padRight: `${this.#padRight}%`,
|
|
||||||
padTop: `${value}%`,
|
|
||||||
padBottom: `${this.#padBottom}%`,
|
|
||||||
})
|
|
||||||
break;
|
break;
|
||||||
case "bottom":
|
case "bottom":
|
||||||
this.#padBottom = value
|
this.#padBottom = value
|
||||||
this.spinePlayer.updateViewport({
|
break;
|
||||||
padLeft: `${this.#padLeft}%`,
|
default:
|
||||||
padRight: `${this.#padRight}%`,
|
this.#padLeft = value.left
|
||||||
padTop: `${this.#padTop}%`,
|
this.#padRight = value.right
|
||||||
padBottom: `${value}%`,
|
this.#padTop = value.top
|
||||||
})
|
this.#padBottom = value.bottom
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
this.loadViewport()
|
||||||
}
|
}
|
||||||
|
|
||||||
positionReset() {
|
positionReset() {
|
||||||
|
|||||||
@@ -40,6 +40,13 @@ window.wallpaperPropertyListener = {
|
|||||||
if (properties.position) {
|
if (properties.position) {
|
||||||
if (!properties.position.value) {
|
if (!properties.position.value) {
|
||||||
window.settings.positionReset()
|
window.settings.positionReset()
|
||||||
|
} else {
|
||||||
|
window.settings.positionPadding(null, {
|
||||||
|
left: properties.paddingleft.value,
|
||||||
|
right: properties.paddingright.value,
|
||||||
|
top: properties.paddingtop.value,
|
||||||
|
bottom: properties.paddingbottom.value,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (properties.paddingleft) {
|
if (properties.paddingleft) {
|
||||||
|
|||||||
Reference in New Issue
Block a user