We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5f7365f commit 87327ebCopy full SHA for 87327eb
1 file changed
server/priv/static/hydra.html
@@ -129,6 +129,9 @@
129
canvas.width = width;
130
canvas.height = height;
131
132
+ // Save the current sketch if it exists
133
+ const currentSketch = window.currentSketch;
134
+
135
// Reinitialize Hydra with new dimensions
136
hydra = new Hydra({
137
canvas: canvas,
@@ -138,8 +141,19 @@
138
141
height: height
139
142
});
140
143
- // Rerun the current sketch
- runDefaultSketch();
144
+ // Immediately restore the sketch if it existed
145
+ if (currentSketch) {
146
+ try {
147
+ eval(currentSketch);
148
+ } catch (e) {
149
+ console.error('Error restoring sketch after resize:', e);
150
+ // Fall back to default sketch if restoration fails
151
+ runDefaultSketch();
152
+ }
153
+ } else {
154
+ // No custom sketch was running, use default
155
156
157
158
</script>
159
</body>
0 commit comments