New icons and types

This commit is contained in:
barsdeveloper
2022-11-16 23:01:57 +01:00
parent 704049c869
commit 8e2f44bd0d
22 changed files with 324 additions and 111 deletions

View File

@@ -1,4 +1,5 @@
import { html, nothing } from "lit"
import Configuration from "../Configuration"
import ElementFactory from "../element/ElementFactory"
import ISelectableDraggableTemplate from "./ISelectableDraggableTemplate"
import SVGIcon from "../SVGIcon"
@@ -11,6 +12,15 @@ import SVGIcon from "../SVGIcon"
/** @extends {ISelectableDraggableTemplate<NodeElement>} */
export default class NodeTemplate extends ISelectableDraggableTemplate {
static #nodeIcon = {
[Configuration.nodeType.callFunction]: SVGIcon.functionSymbol,
[Configuration.nodeType.forEachLoop]: SVGIcon.forEachLoop,
[Configuration.nodeType.forLoop]: SVGIcon.loopNode,
[Configuration.nodeType.ifThenElse]: SVGIcon.branchNode,
[Configuration.nodeType.whileLoop]: SVGIcon.loopNode,
default: SVGIcon.functionSymbol
}
toggleAdvancedDisplayHandler = () => {
this.element.toggleShowAdvancedPinDisplay()
this.element.addNextUpdatedCallbacks(() => this.element.dispatchReflowEvent(), true)
@@ -27,7 +37,7 @@ export default class NodeTemplate extends ISelectableDraggableTemplate {
<div class="ueb-node-wrapper">
<div class="ueb-node-top">
<div class="ueb-node-name">
<span class="ueb-node-name-symbol">${SVGIcon.functionSymbol}</span>
<span class="ueb-node-name-symbol">${this.renderNodeIcon()}</span>
<span class="ueb-node-name-text ueb-ellipsis-nowrap-text">
${this.renderNodeName()}
</span>
@@ -52,6 +62,17 @@ export default class NodeTemplate extends ISelectableDraggableTemplate {
`
}
renderNodeIcon() {
let icon = NodeTemplate.#nodeIcon[this.element.getType()]
if (icon) {
return icon
}
if (this.element.entity.getClass() === Configuration.nodeType.macro) {
return SVGIcon.macro
}
return NodeTemplate.#nodeIcon.default
}
renderNodeName() {
return this.element.getNodeDisplayName()
}