New anums added, bug fix causing object loss

This commit is contained in:
barsdeveloper
2023-05-06 20:06:16 +02:00
parent f7abd7ff6e
commit e97ce5d562
7 changed files with 85 additions and 13 deletions

View File

@@ -39,7 +39,7 @@ export default class IInputPinTemplate extends PinTemplate {
#setInput = () => this.setInputs(this.getInputs(), true)
/** @param {Event} event */
#onInputCheckWrapHandler = event => this.#updateWrapClass(/** @type {HTMLElement} */(event.target))
#checkWrapHandler = event => this.#updateWrapClass(/** @type {HTMLElement} */(event.target))
/** @param {HTMLElement} inputElement*/
#updateWrapClass(inputElement) {
@@ -56,7 +56,7 @@ export default class IInputPinTemplate extends PinTemplate {
firstUpdated(changedProperties) {
super.firstUpdated(changedProperties)
if (/** @type {typeof IInputPinTemplate} */(this.constructor).canWrapInput) {
this.element.addEventListener("input", this.#onInputCheckWrapHandler)
this.element.addEventListener("input", this.#checkWrapHandler)
this.nameWidth = this.blueprint.scaleCorrect(
this.element.querySelector(".ueb-pin-name").getBoundingClientRect().width
)
@@ -74,13 +74,15 @@ export default class IInputPinTemplate extends PinTemplate {
this.element.addEventListener("focusout", this.#setInput)
}
if (/** @type {typeof IInputPinTemplate} */(this.constructor).canWrapInput) {
this.element.addEventListener("input", this.#onInputCheckWrapHandler)
this.element.addEventListener("input", this.#checkWrapHandler)
this.element.nodeElement.addEventListener(Configuration.nodeReflowEventName, this.#checkWrapHandler)
}
}
cleanup() {
super.cleanup()
this.element.removeEventListener("input", this.#onInputCheckWrapHandler)
this.element.nodeElement.removeEventListener(Configuration.nodeReflowEventName, this.#checkWrapHandler)
this.element.removeEventListener("input", this.#checkWrapHandler)
this.element.removeEventListener("input", this.#setInput)
this.element.removeEventListener("focusout", this.#setInput)