Make elements default constructible, testing wip

This commit is contained in:
barsdeveloper
2022-12-24 15:29:12 +01:00
parent 7ed36f21e5
commit c3ab6478b0
53 changed files with 992 additions and 712 deletions

View File

@@ -3,8 +3,9 @@ import ElementFactory from "../../element/ElementFactory"
import IMouseClickDrag from "./IMouseClickDrag"
/**
* @typedef {import("../../element/PinElement").default} PinElement
* @typedef {import("../../element/LinkElement").default} LinkElement
* @typedef {import("../../element/LinkElement").LinkElementConstructor} LinkElementConstructor
* @typedef {import("../../element/PinElement").default} PinElement
* @typedef {import("../../template/node/KnotNodeTemplate").default} KnotNodeTemplate
*/
@@ -71,8 +72,8 @@ export default class MouseCreateLink extends IMouseClickDrag {
this.#knotPin = this.target
}
/** @type {LinkElement} */
// @ts-expect-error
this.link = new (ElementFactory.getConstructor("ueb-link"))(this.target, null)
this.link = /** @type {LinkElementConstructor} */(ElementFactory.getConstructor("ueb-link"))
.newObject(this.target, null)
this.blueprint.linksContainerElement.prepend(this.link)
this.link.setMessagePlaceNode()
this.#listenedPins = this.blueprint.querySelectorAll("ueb-pin")