feat: CLK toggles on Step, add pan/zoom (arrows, +/-, wheel, 0=reset)

This commit is contained in:
Jose Luis Montañes
2026-03-19 22:06:03 +01:00
parent 7409a96cf1
commit d5de328898
5 changed files with 141 additions and 27 deletions

View File

@@ -1,7 +1,7 @@
// Gate evaluation and port geometry
import { GATE_W, GATE_H, PORT_R, gateInputCount, gateOutputCount } from './constants.js';
import { state } from './state.js';
import { recordSample } from './waveform.js';
import { recordSample, setEvaluateAll } from './waveform.js';
export function getInputPorts(gate) {
const count = gateInputCount(gate.type);
@@ -61,6 +61,9 @@ export function evaluateAll() {
if (state.recording && state.waveformVisible) recordSample();
}
// Register evaluateAll in waveform to break circular dependency
setEvaluateAll(evaluateAll);
export function findGateAt(x, y) {
return state.gates.find(g => x >= g.x && x <= g.x + GATE_W && y >= g.y && y <= g.y + GATE_H);
}