Various fixes to links

This commit is contained in:
barsdeveloper
2022-03-02 22:55:05 +01:00
parent 525b4188dc
commit 2d2af6f097
11 changed files with 115 additions and 35 deletions

View File

@@ -303,7 +303,16 @@ export default class Blueprint extends IElement {
* Returns the list of links in this blueprint.
* @returns {LinkElement[]} Nodes
*/
getLinks() {
getLinks([a, b] = []) {
if (a == null != b == null) {
const pin = a ?? b
return this.links.filter(link => link.getSourcePin() == pin || link.getDestinationPin() == pin)
}
if (a != null && b != null) {
return this.links.filter(link =>
link.getSourcePin() == a && link.getDestinationPin() == b
|| link.getSourcePin() == b && link.getDestinationPin() == a)
}
return this.links
}