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:
parent
a669a54543
commit
b80a9e4e86
2 changed files with 10 additions and 0 deletions
|
|
@ -906,6 +906,16 @@ function setOutputMode(mode) {
|
||||||
document.getElementById('toggle-visual').classList.toggle('active', mode === 'visual');
|
document.getElementById('toggle-visual').classList.toggle('active', mode === 'visual');
|
||||||
document.getElementById('toggle-synth').classList.toggle('active', mode === 'synth');
|
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();
|
buildParamGroups();
|
||||||
const outputs = iml.getOutputs();
|
const outputs = iml.getOutputs();
|
||||||
updateAllParamBars(outputs);
|
updateAllParamBars(outputs);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue