Target subtitle added

This commit is contained in:
barsdeveloper
2022-11-19 19:14:25 +01:00
parent b55779312b
commit 1353a4ff4f
10 changed files with 101 additions and 61 deletions

View File

@@ -157,15 +157,7 @@ export default class PinElement extends IElement {
}
getPinDisplayName() {
let matchResult = null
if (
this.entity.PinToolTip
// Match up until the first \n excluded or last character
&& (matchResult = this.entity.PinToolTip.match(/\s*(.+?(?=\n)|.+\S)\s*/))
) {
return Utility.formatStringName(matchResult[1])
}
return Utility.formatStringName(this.entity.PinName)
return this.entity.getDisplayName()
}
/** @return {CSSResult} */

View File

@@ -11,6 +11,7 @@ import SimpleSerializationRotatorEntity from "./SimpleSerializationRotatorEntity
import SimpleSerializationVectorEntity from "./SimpleSerializationVectorEntity"
import TypeInitialization from "./TypeInitialization"
import UnionType from "./UnionType"
import Utility from "../Utility"
import VectorEntity from "./VectorEntity"
/** @typedef {import("./TypeInitialization").AnyValue} AnyValue */
@@ -124,6 +125,18 @@ export default class PinEntity extends IEntity {
return this.PinType.PinCategory
}
getDisplayName() {
let matchResult = null
if (
this.PinToolTip
// Match up until the first \n excluded or last character
&& (matchResult = this.PinToolTip.match(/\s*(.+?(?=\n)|.+\S)\s*/))
) {
return Utility.formatStringName(matchResult[1])
}
return Utility.formatStringName(this.PinName)
}
/** @param {PinEntity} other */
copyTypeFrom(other) {
this.PinType.PinCategory = other.PinType.PinCategory

View File

@@ -3,6 +3,7 @@ import Configuration from "../Configuration"
import ElementFactory from "../element/ElementFactory"
import ISelectableDraggableTemplate from "./ISelectableDraggableTemplate"
import SVGIcon from "../SVGIcon"
import Utility from "../Utility"
/**
* @typedef {import("../element/NodeElement").default} NodeElement
@@ -27,6 +28,8 @@ export default class NodeTemplate extends ISelectableDraggableTemplate {
default: SVGIcon.functionSymbol
}
#hasTargetInputNode = false
toggleAdvancedDisplayHandler = () => {
this.element.toggleShowAdvancedPinDisplay()
this.element.addNextUpdatedCallbacks(() => this.element.dispatchReflowEvent(), true)
@@ -68,12 +71,17 @@ export default class NodeTemplate extends ISelectableDraggableTemplate {
<div class="ueb-node-top">
<div class="ueb-node-name">
${icon ? html`
<span class="ueb-node-name-symbol">${icon}</span>
<div class="ueb-node-name-symbol">${icon}</div>
` : nothing}
${name ? html`
<span class="ueb-node-name-text ueb-ellipsis-nowrap-text">
<div class="ueb-node-name-text ueb-ellipsis-nowrap-text">
${name}
</span>
${this.#hasTargetInputNode ? html`
<div class="ueb-node-subtitle-text ueb-ellipsis-nowrap-text">
Target is ${Utility.formatStringName(this.element.entity.FunctionReference.MemberParent.getName())}
</div>
`: nothing}
</div>
` : nothing}
</div>
</div>
@@ -134,6 +142,19 @@ export default class NodeTemplate extends ISelectableDraggableTemplate {
})
}
createPinElements() {
return this.element.getPinEntities()
.filter(v => !v.isHidden())
.map(v => {
if (!this.#hasTargetInputNode && v.getDisplayName() === "Target") {
this.#hasTargetInputNode = true
}
return/** @type {PinElement} */(
new (ElementFactory.getConstructor("ueb-pin"))(v, undefined, this.element)
)
})
}
/**
* @param {NodeElement} node
* @returns {NodeListOf<PinElement>}
@@ -142,13 +163,5 @@ export default class NodeTemplate extends ISelectableDraggableTemplate {
return node.querySelectorAll("ueb-pin")
}
createPinElements() {
return this.element.getPinEntities()
.filter(v => !v.isHidden())
.map(v => /** @type {PinElement} */(
new (ElementFactory.getConstructor("ueb-pin"))(v, undefined, this.element)
))
}
linksChanged() { }
}