actually connecting wires to junctions

This commit is contained in:
Patrick Haßel 2025-01-30 15:20:41 +01:00
parent faccb3bbbe
commit aaccd69535
2 changed files with 14 additions and 1 deletions

View File

@ -120,8 +120,17 @@ export class BreadboardComponent {
return;
}
const wire = new Wire(start, end);
console.log("Wire created: ", wire);
wire.start.wires.push(wire);
wire.end.wires.push(wire);
this.wires.push(wire);
console.log("Wire connected: ", wire);
}
private wireDisconnect(wire: Wire) {
this.wires.splice(this.wires.indexOf(wire), 1);
wire.start.wires.splice(wire.start.wires.indexOf(wire), 1);
wire.end.wires.splice(wire.end.wires.indexOf(wire), 1);
console.log("Wire disconnected: ", wire);
}
private wireReset() {

View File

@ -1,3 +1,5 @@
import {Wire} from "../wire/Wire";
export const JUNCTION_RADIUS_PERCENT = 15;
export class Junction {
@ -8,6 +10,8 @@ export class Junction {
readonly percentY: number;
readonly wires: Wire[] = [];
constructor(
percentX: number,
percentY: number,