mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-18 20:34:54 +08:00
Some minor fixes and refactoring
This commit is contained in:
@@ -13,7 +13,7 @@ export default class CommentNodeTemplate extends IResizeableTemplate {
|
||||
element.classList.add("ueb-node-style-comment", "ueb-node-resizeable")
|
||||
element.sizeX = 25 * Configuration.gridSize
|
||||
element.sizeY = 6 * Configuration.gridSize
|
||||
super.initialize(element) // Keep it at the end because it calls this.getColor() where this.#color must be initialized
|
||||
super.initialize(element) // Keep it at the end because it needs the color. this.#color must be initialized
|
||||
}
|
||||
|
||||
/** @returns {HTMLElement} */
|
||||
|
||||
@@ -35,6 +35,17 @@ export default class KnotNodeTemplate extends NodeTemplate {
|
||||
this.element.classList.add("ueb-node-style-minimal")
|
||||
}
|
||||
|
||||
/** @param {PropertyValues} changedProperties */
|
||||
update(changedProperties) {
|
||||
super.update(changedProperties)
|
||||
if (!this.#inputPin.isLinked && !this.#outputPin.isLinked) {
|
||||
this.#inputPin.entity.PinType.PinCategory.value = "wildcard"
|
||||
this.#inputPin.updateColor()
|
||||
this.#outputPin.entity.PinType.PinCategory.value = "wildcard"
|
||||
this.#inputPin.updateColor()
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return html`
|
||||
<div class="ueb-node-border"></div>
|
||||
|
||||
@@ -57,17 +57,13 @@ export default class NodeTemplate extends ISelectableDraggableTemplate {
|
||||
super.initialize(element)
|
||||
this.#subtitle = nodeSubtitle(element.entity)
|
||||
this.element.classList.add(.../** @type {typeof NodeTemplate} */(this.constructor).nodeStyleClasses)
|
||||
this.element.style.setProperty("--ueb-node-color", this.getColor().cssText)
|
||||
this.element.style.setProperty("--ueb-node-color", this.element.entity.nodeColor().cssText)
|
||||
this.pinInserter = this.element.entity.additionalPinInserter()
|
||||
if (this.pinInserter) {
|
||||
this.element.classList.add("ueb-node-is-variadic")
|
||||
}
|
||||
}
|
||||
|
||||
getColor() {
|
||||
return this.element.entity.nodeColor()
|
||||
}
|
||||
|
||||
render() {
|
||||
return html`
|
||||
<div class="ueb-node-border">
|
||||
|
||||
@@ -21,6 +21,6 @@ export default class VariableAccessNodeTemplate extends VariableManagementNodeTe
|
||||
setupPins() {
|
||||
super.setupPins()
|
||||
let outputPin = this.element.getPinElements().find(p => !p.entity.isHidden() && !p.entity.isExecution())
|
||||
this.element.style.setProperty("--ueb-node-color", outputPin.getColor().cssText)
|
||||
this.element.style.setProperty("--ueb-node-color", outputPin.entity.pinColor().cssText)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user