Make template stateful

This commit is contained in:
barsdeveloper
2022-09-27 20:40:23 +02:00
parent 8361ba61a6
commit 4f0c7f9190
23 changed files with 491 additions and 680 deletions

View File

@@ -8,23 +8,20 @@ import ITemplate from "./ITemplate"
*/
export default class IFromToPositionedTemplate extends ITemplate {
/**
* @param {T} selector
* @param {Map} changedProperties
*/
update(selector, changedProperties) {
super.update(selector, changedProperties)
/** @param {Map} changedProperties */
update(changedProperties) {
super.update(changedProperties)
if (changedProperties.has("initialPositionX")) {
selector.style.setProperty("--ueb-from-x", `${selector.initialPositionX}`)
this.element.style.setProperty("--ueb-from-x", `${this.element.initialPositionX}`)
}
if (changedProperties.has("initialPositionY")) {
selector.style.setProperty("--ueb-from-y", `${selector.initialPositionY}`)
this.element.style.setProperty("--ueb-from-y", `${this.element.initialPositionY}`)
}
if (changedProperties.has("finaPositionX")) {
selector.style.setProperty("--ueb-to-x", `${selector.finaPositionX}`)
this.element.style.setProperty("--ueb-to-x", `${this.element.finaPositionX}`)
}
if (changedProperties.has("finaPositionY")) {
selector.style.setProperty("--ueb-to-y", `${selector.finaPositionY}`)
this.element.style.setProperty("--ueb-to-y", `${this.element.finaPositionY}`)
}
}