fix: allow dragging all gates + stop waveform recording on edits

- INPUT/CLOCK gates can now be dragged (click-without-move = toggle,
  click-and-drag = move). Uses 4px movement threshold.
- Waveform only records samples on intentional actions (INPUT toggle,
  manual step, simulation tick), not on gate placement/movement/connections.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jose Luis
2026-03-20 02:42:00 +01:00
parent 3f1daa77bd
commit 3bff1fd4b4
2 changed files with 33 additions and 14 deletions

View File

@@ -53,12 +53,12 @@ export function evaluate(gate, visited = new Set()) {
return result;
}
export function evaluateAll() {
export function evaluateAll(recordWave = false) {
state.gates.forEach(g => {
if (g.type !== 'INPUT' && g.type !== 'CLOCK') g.value = 0;
});
state.gates.forEach(g => evaluate(g));
if (state.recording && state.waveformVisible) recordSample();
if (recordWave && state.recording && state.waveformVisible) recordSample();
}
// Register evaluateAll in waveform to break circular dependency