Node replace bug fix, names simplify

This commit is contained in:
barsdeveloper
2023-04-23 10:26:48 +02:00
parent 8a96af670e
commit 3ccd3ce9f3
15 changed files with 172 additions and 192 deletions

View File

@@ -166,7 +166,7 @@ export default class Blueprint extends IElement {
}
}
scrollCenter() {
scrollCenter(smooth = false) {
const scroll = this.getScroll()
const offset = [
this.translateX - scroll[0],
@@ -177,7 +177,7 @@ export default class Blueprint extends IElement {
offset[0] - targetOffset[0],
offset[1] - targetOffset[1]
]
this.scrollDelta(deltaOffset[0], deltaOffset[1], true)
this.scrollDelta(deltaOffset[0], deltaOffset[1], smooth)
}
getViewportSize() {
@@ -339,12 +339,12 @@ export default class Blueprint extends IElement {
getLinks(a = null, b = null) {
if ((a == null) != (b == null)) {
const pin = a ?? b
return this.links.filter(link => link.sourcePin == pin || link.destinationPin == pin)
return this.links.filter(link => link.source == pin || link.destination == pin)
}
if (a != null && b != null) {
return this.links.filter(link =>
link.sourcePin == a && link.destinationPin == b
|| link.sourcePin == b && link.destinationPin == a
link.source == a && link.destination == b
|| link.source == b && link.destination == a
)
}
return this.links
@@ -356,8 +356,8 @@ export default class Blueprint extends IElement {
*/
getLink(sourcePin, destinationPin, strictDirection = false) {
return this.links.find(link =>
link.sourcePin == sourcePin && link.destinationPin == destinationPin
|| !strictDirection && link.sourcePin == destinationPin && link.destinationPin == sourcePin
link.source == sourcePin && link.destination == destinationPin
|| !strictDirection && link.source == destinationPin && link.destination == sourcePin
)
}