mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-16 02:10:38 +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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,9 @@ export default class InputTemplate extends ITemplate {
|
||||
super.initialize(element)
|
||||
this.element.classList.add("ueb-pin-input-content")
|
||||
this.element.setAttribute("role", "textbox")
|
||||
this.element.contentEditable = "true"
|
||||
if (this.element.contentEditable !== "false") {
|
||||
this.element.contentEditable = "true"
|
||||
}
|
||||
}
|
||||
|
||||
/** @param {PropertyValues} changedProperties */
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
import MinimalPinTemplate from "./MinimalPinTemplate.js"
|
||||
|
||||
export default class InternalPinTemplate extends MinimalPinTemplate {
|
||||
|
||||
}
|
||||
19
js/template/pin/ReadonlyInputPinTemplate.js
Executable file
19
js/template/pin/ReadonlyInputPinTemplate.js
Executable file
@@ -0,0 +1,19 @@
|
||||
import { html } from "lit"
|
||||
import PinTemplate from "./PinTemplate.js"
|
||||
|
||||
/** @extends PinTemplate<StringEntity> */
|
||||
export default class ReadonlyNamePinTemplate extends PinTemplate {
|
||||
|
||||
setDefaultValue(values = [], rawValues = values) {
|
||||
}
|
||||
|
||||
renderInput() {
|
||||
return html`
|
||||
<div class="ueb-pin-input-wrapper ueb-pin-input">
|
||||
<ueb-input contenteditable="false" .singleLine="${true}" .selectOnFocus="${false}"
|
||||
.innerText="${this.element.entity.PinName.toString()}">
|
||||
</ueb-input>
|
||||
</div>
|
||||
`
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user