mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-22 14:54:43 +08:00
source / destionation => origin / target
This commit is contained in:
@@ -22,7 +22,7 @@ export default class MouseCreateLink extends IMouseClickDrag {
|
||||
if (!this.enteredPin) {
|
||||
this.linkValid = false
|
||||
this.enteredPin = /** @type {PinElement} */(e.target)
|
||||
const a = this.link.source ?? this.target // Remember target might have change
|
||||
const a = this.link.origin ?? this.target // Remember target might have change
|
||||
const b = this.enteredPin
|
||||
const outputPin = a.isOutput() ? a : b
|
||||
if (a.isKnot() || b.isKnot()) {
|
||||
@@ -96,11 +96,11 @@ export default class MouseCreateLink extends IMouseClickDrag {
|
||||
}
|
||||
})
|
||||
this.link.startDragging()
|
||||
this.link.setDestinationLocation(location)
|
||||
this.link.setTargetLocation(location)
|
||||
}
|
||||
|
||||
dragTo(location, movement) {
|
||||
this.link.setDestinationLocation(location)
|
||||
this.link.setTargetLocation(location)
|
||||
}
|
||||
|
||||
endDrag() {
|
||||
@@ -112,26 +112,26 @@ export default class MouseCreateLink extends IMouseClickDrag {
|
||||
if (this.enteredPin && this.linkValid) {
|
||||
// Knot can use wither the input or output (by default) part indifferently, check if a switch is needed
|
||||
if (this.#knotPin) {
|
||||
const otherPin = this.#knotPin !== this.link.source ? this.link.source : this.enteredPin
|
||||
const otherPin = this.#knotPin !== this.link.origin ? this.link.origin : this.enteredPin
|
||||
// Knot pin direction correction
|
||||
if (this.#knotPin.isInput() && otherPin.isInput() || this.#knotPin.isOutput() && otherPin.isOutput()) {
|
||||
const oppositePin = /** @type {KnotPinTemplate} */(this.#knotPin.template).oppositePin()
|
||||
if (this.#knotPin === this.link.source) {
|
||||
this.link.source = oppositePin
|
||||
if (this.#knotPin === this.link.origin) {
|
||||
this.link.origin = oppositePin
|
||||
} else {
|
||||
this.enteredPin = oppositePin
|
||||
}
|
||||
}
|
||||
} else if (this.enteredPin.isKnot()) {
|
||||
this.#knotPin = this.enteredPin
|
||||
if (this.link.source.isOutput()) {
|
||||
// Knot uses by default the output pin, let's switch to keep it coherent with the source node we have
|
||||
if (this.link.origin.isOutput()) {
|
||||
// Knot uses by default the output pin, let's switch to keep it coherent with the origin node we have
|
||||
this.enteredPin = /** @type {KnotPinTemplate} */(this.enteredPin.template).oppositePin()
|
||||
}
|
||||
}
|
||||
if (!this.link.source.getLinks().find(ref => ref.equals(this.enteredPin.createPinReference()))) {
|
||||
if (!this.link.origin.getLinks().find(ref => ref.equals(this.enteredPin.createPinReference()))) {
|
||||
this.blueprint.addGraphElement(this.link)
|
||||
this.link.destination = this.enteredPin
|
||||
this.link.target = this.enteredPin
|
||||
} else {
|
||||
this.link.remove()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user