Files
ueblueprint/js/template/pin/KnotPinTemplate.js
2025-01-25 14:52:54 +02:00

24 lines
803 B
JavaScript
Executable File

import { html } from "lit"
import MinimalPinTemplate from "./MinimalPinTemplate.js"
/** @extends MinimalPinTemplate<KnotEntity> */
export default class KnotPinTemplate extends MinimalPinTemplate {
render() {
return this.element.isOutput() ? super.render() : html``
}
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(oppositeDirection = false) {
if (this.element.isInput()) {
return this.getoppositePin().getLinkLocation(!oppositeDirection)
}
return super.getLinkLocation(oppositeDirection)
}
}