mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-05-19 20:37:36 +08:00
Fix node rename and link coherence
This commit is contained in:
@@ -100,7 +100,7 @@ export default class NodeElement extends ISelectableDraggableElement {
|
||||
}
|
||||
|
||||
/** @param {String} name */
|
||||
#redirectLinksAfterRename(name) {
|
||||
#redirectLinksBeforeRename(name) {
|
||||
for (let sourcePinElement of this.getPinElements()) {
|
||||
for (let targetPinReference of sourcePinElement.getLinks()) {
|
||||
this.blueprint.getPin(targetPinReference).redirectLink(
|
||||
@@ -135,9 +135,9 @@ export default class NodeElement extends ISelectableDraggableElement {
|
||||
"Name",
|
||||
/** @param {InstanceType<typeof ObjectEntity.attributes.Name>} newName */
|
||||
newName => {
|
||||
this.#redirectLinksBeforeRename(newName.value)
|
||||
this.nodeTitle = newName.value
|
||||
this.nodeDisplayName = nodeTitle(entity)
|
||||
this.#redirectLinksAfterRename(newName.value)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ export default class PinElement extends IElement {
|
||||
fromAttribute: (value, type) => value
|
||||
? GuidEntity.grammar.parse(value)
|
||||
: null,
|
||||
toAttribute: (value, type) => /** @type {String} */(value?.toString()),
|
||||
toAttribute: (value, type) => value?.toString(),
|
||||
},
|
||||
attribute: "data-id",
|
||||
reflect: true,
|
||||
@@ -95,6 +95,7 @@ export default class PinElement extends IElement {
|
||||
this.isLinked = false
|
||||
this.connectable = !entity.bNotConnectable?.valueOf()
|
||||
super.initialize(entity, template)
|
||||
this.pinId = this.entity.PinId
|
||||
this.pinType = this.entity.getType()
|
||||
this.defaultValue = this.entity.getDefaultValue()
|
||||
this.color = PinElement.properties.color.converter.fromAttribute(this.getColor().toString())
|
||||
@@ -233,7 +234,7 @@ export default class PinElement extends IElement {
|
||||
&& pinReference.pinGuid.toString() == originalPinElement.entity.PinId.toString()
|
||||
)
|
||||
if (index >= 0) {
|
||||
this.entity.LinkedTo[index] = newReference
|
||||
this.entity.LinkedTo.valueOf()[index] = newReference
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user