Fix Export paths name adjustments

This commit is contained in:
barsdeveloper
2025-01-20 23:58:57 +02:00
parent e40e6ba52b
commit 6403fec906
16 changed files with 320 additions and 171 deletions

View File

@@ -122,22 +122,20 @@ export default class LinkTemplate extends IFromToPositionedTemplate {
if (changedProperties.has("fromX") || changedProperties.has("toX")) {
const from = this.element.fromX
const to = this.element.toX
const isSourceAKnot = sourcePin?.nodeElement.getType() == Configuration.paths.knot
const isDestinationAKnot = destinationPin?.nodeElement.getType() == Configuration.paths.knot
const isSourceAKnot = sourcePin?.isKnot()
const isDestinationAKnot = destinationPin?.isKnot()
if (isSourceAKnot && (!destinationPin || isDestinationAKnot)) {
if (sourcePin?.isInput() && to > from + Configuration.distanceThreshold) {
this.element.source = /** @type {KnotNodeTemplate} */(sourcePin.nodeElement.template).outputPin
} else if (sourcePin?.isOutput() && to < from - Configuration.distanceThreshold) {
this.element.source = /** @type {KnotNodeTemplate} */(sourcePin.nodeElement.template).inputPin
if (sourcePin?.isInputLoossly() && to > from + Configuration.distanceThreshold) {
this.element.source = /** @type {KnotPinTemplate} */(sourcePin.template).oppositePin()
} else if (sourcePin?.isOutputLoosely() && to < from - Configuration.distanceThreshold) {
this.element.source = /** @type {KnotPinTemplate} */(sourcePin.template).oppositePin()
}
}
if (isDestinationAKnot && (!sourcePin || isSourceAKnot)) {
if (destinationPin?.isInput() && to < from - Configuration.distanceThreshold) {
this.element.destination =
/** @type {KnotNodeTemplate} */(destinationPin.nodeElement.template).outputPin
} else if (destinationPin?.isOutput() && to > from + Configuration.distanceThreshold) {
this.element.destination =
/** @type {KnotNodeTemplate} */(destinationPin.nodeElement.template).inputPin
if (destinationPin?.isInputLoossly() && to < from - Configuration.distanceThreshold) {
this.element.destination = /** @type {KnotPinTemplate} */(destinationPin.template).oppositePin()
} else if (destinationPin?.isOutputLoosely() && to > from + Configuration.distanceThreshold) {
this.element.destination = /** @type {KnotPinTemplate} */(destinationPin.template).oppositePin()
}
}
}

View File

@@ -31,10 +31,7 @@ export default class KnotNodeTemplate extends NodeTemplate {
/** @param {PinElement} startingPin */
findDirectionaPin(startingPin) {
if (
startingPin.nodeElement.getType() !== Configuration.paths.knot
|| KnotNodeTemplate.#traversedPin.has(startingPin)
) {
if (startingPin.isKnot() || KnotNodeTemplate.#traversedPin.has(startingPin)) {
KnotNodeTemplate.#traversedPin.clear()
return true
}

View File

@@ -9,7 +9,7 @@ export default class KnotPinTemplate extends MinimalPinTemplate {
return this.element.isOutput() ? super.render() : html``
}
getOppositePin() {
oppositePin() {
const nodeTemplate = /** @type {KnotNodeTemplate} */(this.element.nodeElement.template)
return this.element.isOutput() ? nodeTemplate.inputPin : nodeTemplate.outputPin
}