refactor: opt

This commit is contained in:
cha0s 2021-02-07 02:40:58 -06:00
parent 841c8c9c52
commit 9fafe9cda8

View File

@ -266,11 +266,12 @@ export default () => class Visible extends decorate(Trait) {
}
onZIndexChanged(zIndex) {
if (!this.#container) {
return;
}
this.#usingAutoZIndex = AUTO_ZINDEX === zIndex;
if (!this.#usingAutoZIndex) {
if (this.#container) {
this.#container.zIndex = zIndex;
}
this.#container.zIndex = zIndex;
}
}
@ -335,9 +336,7 @@ export default () => class Visible extends decorate(Trait) {
}
this.#container.position = this.entity.position;
if (this.#usingAutoZIndex) {
if (this.#container) {
this.#container.zIndex = this.entity.y;
}
this.#container.zIndex = this.entity.y;
}
}