Node links cleaned wen added to the graph

This commit is contained in:
barsdeveloper
2022-04-07 23:06:43 +02:00
parent 141784a3f3
commit be2db55dce
6 changed files with 93 additions and 51 deletions

View File

@@ -29,6 +29,11 @@ export default class NodeElement extends ISelectableDraggableElement {
return new NodeElement(entity)
}
connectedCallback() {
const type = this.getAttribute("type")?.trim()
super.connectedCallback()
}
disconnectedCallback() {
super.disconnectedCallback()
this.dispatchDeleteEvent()
@@ -38,6 +43,10 @@ export default class NodeElement extends ISelectableDraggableElement {
return this.entity.getFullName()
}
cleanLinks() {
this.getPinElements().forEach(pin => pin.cleanLinks())
}
/**
* @param {String} name
*/
@@ -45,13 +54,14 @@ export default class NodeElement extends ISelectableDraggableElement {
if (this.entity.Name == name) {
return false
}
this.getPinElements().forEach(sourcePinElement =>
sourcePinElement.getLinks().forEach(targetPinReference =>
for (let sourcePinElement of this.getPinElements()) {
for (let targetPinReference of sourcePinElement.getLinks()) {
this.blueprint.getPin(targetPinReference).redirectLink(sourcePinElement, new PinReferenceEntity({
objectName: name,
pinGuid: sourcePinElement.entity.PinId,
}))
))
}
}
this.entity.Name = name
}
@@ -66,11 +76,6 @@ export default class NodeElement extends ISelectableDraggableElement {
return this.entity.CustomProperties.filter(v => v instanceof PinEntity)
}
connectedCallback() {
const type = this.getAttribute("type")?.trim()
super.connectedCallback()
}
setLocation(value = [0, 0]) {
let nodeType = this.entity.NodePosX.constructor
// @ts-expect-error