mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-23 15:24:45 +08:00
Fix switched link position
This commit is contained in:
26
dist/ueblueprint.js
vendored
26
dist/ueblueprint.js
vendored
@@ -9040,8 +9040,6 @@ class NodeTemplate extends ISelectableDraggableTemplate {
|
||||
.map(pinEntity => this.createPinElement(pinEntity))
|
||||
}
|
||||
|
||||
linksChanged() { }
|
||||
|
||||
/** All the link connected to this node */
|
||||
getAllConnectedLinks() {
|
||||
const nodeTitle = this.element.nodeTitle;
|
||||
@@ -9672,11 +9670,11 @@ class PinTemplate extends ITemplate {
|
||||
this.#wrapperElement = this.element.querySelector(".ueb-pin-wrapper");
|
||||
}
|
||||
|
||||
getLinkLocation() {
|
||||
getLinkLocation(oppositeDirection = false) {
|
||||
const rect = (this.#iconElement ?? this.element).getBoundingClientRect();
|
||||
/** @type {[Number, Number]} */
|
||||
const boundingLocation = [
|
||||
this.element.isInputVisually() ? rect.left : rect.right + 1,
|
||||
this.element.isInputVisually() && !oppositeDirection ? rect.left : rect.right + 1,
|
||||
(rect.top + rect.bottom) / 2
|
||||
];
|
||||
const location = Utility.convertLocation(boundingLocation, this.blueprint.template.gridElement);
|
||||
@@ -9792,11 +9790,11 @@ class KnotPinTemplate extends MinimalPinTemplate {
|
||||
}
|
||||
|
||||
/** Location on the grid of a link connecting to this pin */
|
||||
getLinkLocation() {
|
||||
getLinkLocation(oppositeDirection = false) {
|
||||
if (this.element.isInput()) {
|
||||
return this.getoppositePin().getLinkLocation()
|
||||
return this.getoppositePin().getLinkLocation(!oppositeDirection)
|
||||
}
|
||||
return super.getLinkLocation()
|
||||
return super.getLinkLocation(oppositeDirection)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9856,9 +9854,6 @@ class KnotNodeTemplate extends NodeTemplate {
|
||||
return result
|
||||
}
|
||||
|
||||
linksChanged() {
|
||||
}
|
||||
|
||||
checkSwtichDirectionsVisually() {
|
||||
let leftPinsLocation = 0;
|
||||
let leftPinsCount = 0;
|
||||
@@ -13431,8 +13426,8 @@ class PinElement extends IElement {
|
||||
return this.nodeElement?.getType() == Configuration.paths.knot
|
||||
}
|
||||
|
||||
getLinkLocation() {
|
||||
return this.template.getLinkLocation()
|
||||
getLinkLocation(oppositeDirection = false) {
|
||||
return this.template.getLinkLocation(oppositeDirection)
|
||||
}
|
||||
|
||||
getNodeElement() {
|
||||
@@ -13493,7 +13488,6 @@ class PinElement extends IElement {
|
||||
}
|
||||
if (this.entity.linkTo(targetPinElement.getNodeElement().getNodeName(), targetPinElement.entity)) {
|
||||
this.isLinked = this.entity.isLinked();
|
||||
this.nodeElement?.template.linksChanged();
|
||||
if (this.entity.recomputesNodeTitleOnChange) {
|
||||
this.nodeElement?.computeNodeDisplayName();
|
||||
}
|
||||
@@ -13504,7 +13498,6 @@ class PinElement extends IElement {
|
||||
unlinkFrom(targetPinElement, removeLink = true) {
|
||||
if (this.entity.unlinkFrom(targetPinElement.getNodeElement().getNodeName(), targetPinElement.entity)) {
|
||||
this.isLinked = this.entity.isLinked();
|
||||
this.nodeElement?.template.linksChanged();
|
||||
if (removeLink) {
|
||||
this.blueprint.getLink(this, targetPinElement)?.remove(); // Might be called after the link is removed
|
||||
}
|
||||
@@ -13515,11 +13508,8 @@ class PinElement extends IElement {
|
||||
}
|
||||
|
||||
unlinkFromAll() {
|
||||
const isLinked = this.getLinks().length;
|
||||
this.getLinks().length;
|
||||
this.getLinks().map(ref => this.blueprint.getPin(ref)).forEach(pin => this.unlinkFrom(pin));
|
||||
if (isLinked) {
|
||||
this.nodeElement?.template.linksChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
4
dist/ueblueprint.min.js
vendored
4
dist/ueblueprint.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -190,8 +190,8 @@ export default class PinElement extends IElement {
|
||||
return this.nodeElement?.getType() == Configuration.paths.knot
|
||||
}
|
||||
|
||||
getLinkLocation() {
|
||||
return this.template.getLinkLocation()
|
||||
getLinkLocation(oppositeDirection = false) {
|
||||
return this.template.getLinkLocation(oppositeDirection)
|
||||
}
|
||||
|
||||
getNodeElement() {
|
||||
@@ -252,7 +252,6 @@ export default class PinElement extends IElement {
|
||||
}
|
||||
if (this.entity.linkTo(targetPinElement.getNodeElement().getNodeName(), targetPinElement.entity)) {
|
||||
this.isLinked = this.entity.isLinked()
|
||||
this.nodeElement?.template.linksChanged()
|
||||
if (this.entity.recomputesNodeTitleOnChange) {
|
||||
this.nodeElement?.computeNodeDisplayName()
|
||||
}
|
||||
@@ -263,7 +262,6 @@ export default class PinElement extends IElement {
|
||||
unlinkFrom(targetPinElement, removeLink = true) {
|
||||
if (this.entity.unlinkFrom(targetPinElement.getNodeElement().getNodeName(), targetPinElement.entity)) {
|
||||
this.isLinked = this.entity.isLinked()
|
||||
this.nodeElement?.template.linksChanged()
|
||||
if (removeLink) {
|
||||
this.blueprint.getLink(this, targetPinElement)?.remove() // Might be called after the link is removed
|
||||
}
|
||||
@@ -276,9 +274,6 @@ export default class PinElement extends IElement {
|
||||
unlinkFromAll() {
|
||||
const isLinked = this.getLinks().length
|
||||
this.getLinks().map(ref => this.blueprint.getPin(ref)).forEach(pin => this.unlinkFrom(pin))
|
||||
if (isLinked) {
|
||||
this.nodeElement?.template.linksChanged()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -59,9 +59,6 @@ export default class KnotNodeTemplate extends NodeTemplate {
|
||||
return result
|
||||
}
|
||||
|
||||
linksChanged() {
|
||||
}
|
||||
|
||||
checkSwtichDirectionsVisually() {
|
||||
let leftPinsLocation = 0
|
||||
let leftPinsCount = 0
|
||||
|
||||
@@ -169,8 +169,6 @@ export default class NodeTemplate extends ISelectableDraggableTemplate {
|
||||
.map(pinEntity => this.createPinElement(pinEntity))
|
||||
}
|
||||
|
||||
linksChanged() { }
|
||||
|
||||
/** All the link connected to this node */
|
||||
getAllConnectedLinks() {
|
||||
const nodeTitle = this.element.nodeTitle
|
||||
|
||||
@@ -14,10 +14,10 @@ export default class KnotPinTemplate extends MinimalPinTemplate {
|
||||
}
|
||||
|
||||
/** Location on the grid of a link connecting to this pin */
|
||||
getLinkLocation() {
|
||||
getLinkLocation(oppositeDirection = false) {
|
||||
if (this.element.isInput()) {
|
||||
return this.getoppositePin().getLinkLocation()
|
||||
return this.getoppositePin().getLinkLocation(!oppositeDirection)
|
||||
}
|
||||
return super.getLinkLocation()
|
||||
return super.getLinkLocation(oppositeDirection)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,11 +171,11 @@ export default class PinTemplate extends ITemplate {
|
||||
this.#wrapperElement = this.element.querySelector(".ueb-pin-wrapper")
|
||||
}
|
||||
|
||||
getLinkLocation() {
|
||||
getLinkLocation(oppositeDirection = false) {
|
||||
const rect = (this.#iconElement ?? this.element).getBoundingClientRect()
|
||||
/** @type {[Number, Number]} */
|
||||
const boundingLocation = [
|
||||
this.element.isInputVisually() ? rect.left : rect.right + 1,
|
||||
this.element.isInputVisually() && !oppositeDirection ? rect.left : rect.right + 1,
|
||||
(rect.top + rect.bottom) / 2
|
||||
]
|
||||
const location = Utility.convertLocation(boundingLocation, this.blueprint.template.gridElement)
|
||||
|
||||
Reference in New Issue
Block a user