mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-05-12 22:47:30 +08:00
Minor refactoring
This commit is contained in:
@@ -8,14 +8,15 @@ export default class KnotPinTemplate extends MinimalPinTemplate {
|
||||
return this.element.isOutput() ? super.render() : html``
|
||||
}
|
||||
|
||||
oppositePin() {
|
||||
getoppositePin() {
|
||||
const nodeTemplate = /** @type {KnotNodeTemplate} */(this.element.nodeElement.template)
|
||||
return this.element.isOutput() ? nodeTemplate.inputPin : nodeTemplate.outputPin
|
||||
}
|
||||
|
||||
/** Location on the grid of a link connecting to this pin */
|
||||
getLinkLocation() {
|
||||
if (this.element.isInput()) {
|
||||
return this.oppositePin().getLinkLocation()
|
||||
return this.getoppositePin().getLinkLocation()
|
||||
}
|
||||
return super.getLinkLocation()
|
||||
}
|
||||
|
||||
@@ -172,9 +172,12 @@ export default class PinTemplate extends ITemplate {
|
||||
}
|
||||
|
||||
getLinkLocation() {
|
||||
const rect = this.iconElement.getBoundingClientRect()
|
||||
const rect = (this.#iconElement ?? this.element).getBoundingClientRect()
|
||||
/** @type {[Number, Number]} */
|
||||
const boundingLocation = [this.element.isInputVisually() ? rect.left : rect.right + 1, (rect.top + rect.bottom) / 2]
|
||||
const boundingLocation = [
|
||||
this.element.isInputVisually() ? rect.left : rect.right + 1,
|
||||
(rect.top + rect.bottom) / 2
|
||||
]
|
||||
const location = Utility.convertLocation(boundingLocation, this.blueprint.template.gridElement)
|
||||
return this.blueprint.compensateTranslation(location[0], location[1])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user