Move inputs to templates

This commit is contained in:
barsdeveloper
2022-04-14 23:28:23 +02:00
parent 796deac851
commit 8bd9ab24bb
9 changed files with 1364 additions and 1314 deletions

View File

@@ -1,5 +1,6 @@
// @ts-check
import MouseMoveNodes from "../input/mouse/MouseMoveNodes"
import ITemplate from "./ITemplate"
import sanitizeText from "./sanitizeText"
@@ -7,11 +8,27 @@ import sanitizeText from "./sanitizeText"
* @typedef {import("../element/ISelectableDraggableElement").default} ISelectableDraggableElement
*/
/**
* @extends {ITemplate<ISelectableDraggableElement>}
*/
export default class SelectableDraggableTemplate extends ITemplate {
/**
* Returns the html elements rendered from this template.
* @param {ISelectableDraggableElement} element Element of the graph
* @param {ISelectableDraggableElement} element
*/
createInputObjects(element) {
return [
...super.createInputObjects(element),
...[
new MouseMoveNodes(this, element.blueprint, {
looseTarget: true
}),
]
]
}
/**
* @param {ISelectableDraggableElement} element
*/
applyLocation(element) {
element.style.setProperty("--ueb-position-x", sanitizeText(element.location[0]))
@@ -19,8 +36,7 @@ export default class SelectableDraggableTemplate extends ITemplate {
}
/**
* Returns the html elements rendered from this template.
* @param {ISelectableDraggableElement} element Element of the graph
* @param {ISelectableDraggableElement} element
*/
applySelected(element) {
if (element.selected) {