Refactoring

This commit is contained in:
barsdeveloper
2021-10-31 16:05:38 +01:00
parent 12e44c5482
commit 199005ec20
13 changed files with 1297 additions and 81 deletions

View File

@@ -1,4 +1,4 @@
import { PinEntity } from "../../dist/ueblueprint"
import PinEntity from "../entity/PinEntity"
import Template from "./Template"
export default class NodeTemplate extends Template {
@@ -42,7 +42,7 @@ export default class NodeTemplate extends Template {
${outputs.map((output, index) => `
<div class="ueb-node-output ueb-node-value-${output.type}">
${output.name}
<span class="ueb-node-value-icon ${entity.outputs[index].connected ? 'ueb-node-value-fill' : ''}"></span>
<span class="ueb-node-value-icon ${outputs[index].connected ? 'ueb-node-value-fill' : ''}"></span>
</div>
`).join("") ?? ''}
</div>

View File

@@ -1,5 +1,5 @@
/**
* @typedef {import("../graph/GraphNode").default} GraphNode
* @typedef {import(""../entity/Entity"").default} Entity
*/
export default class Template {
@@ -14,12 +14,12 @@ export default class Template {
/**
* Returns the html elements rendered by this template.
* @param {GraphNode} entity Entity representing the element
* @param {Entity} entity Entity representing the element
* @returns The rendered elements
*/
getElements(entity) {
let aDiv = document.createElement('div')
aDiv.innerHTML = this.render(element)
aDiv.innerHTML = this.render(entity)
return aDiv.childNodes
}
}