fix(playground): resize canvas when switching output modes in Design B (meml-2c3)

When switching from synth back to visual mode, the FlowFieldVisualizer
canvas had stale dimensions from being hidden. Add requestAnimationFrame
resize call after toggling canvas visibility so the visualizer picks up
correct dimensions and renders properly.
This commit is contained in:
w1n5t0n 2026-03-22 01:07:52 +02:00
parent a669a54543
commit b80a9e4e86
2 changed files with 10 additions and 0 deletions

View file

@ -906,6 +906,16 @@ function setOutputMode(mode) {
document.getElementById('toggle-visual').classList.toggle('active', mode === 'visual');
document.getElementById('toggle-synth').classList.toggle('active', mode === 'synth');
// Resize the now-visible canvas so it picks up correct dimensions
if (mode === 'visual') {
requestAnimationFrame(() => {
visualizer.resize();
visualizer.initParticles();
});
} else if (synthVisualizer) {
requestAnimationFrame(() => synthVisualizer._resize());
}
buildParamGroups();
const outputs = iml.getOutputs();
updateAllParamBars(outputs);