Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mod fill visualizer on resize throws error #279

Closed
katestange opened this issue Apr 21, 2024 · 3 comments
Closed

Mod fill visualizer on resize throws error #279

katestange opened this issue Apr 21, 2024 · 3 comments
Labels
visualizer Has to do with a visualizer or the visualizer subsystem.

Comments

@katestange
Copy link
Member

I tried the ModFill visualizer with default options on A006769, and when resizing the window produced this console error:

P5Visualizer.ts:112 Uncaught RangeError: Cached: Index 301 not in 0..300.
    at Proxy.getElement (Cached.ts:112:19)
    at Proxy.drawNew (ModFill.ts:55:27)
    at Proxy.draw (ModFill.ts:76:14)
    at sketch.draw (P5Visualizer.ts:106:26)
    at o.default.redraw (p5.js?v=1eaac891:11599:22)
    at l.default.resizeCanvas (p5.js?v=1eaac891:11226:24)
    at Proxy.windowResized (P5Visualizer.ts:177:22)
    at o.default._onresize (p5.js?v=1eaac891:9912:73)
@gwhitney
Copy link
Collaborator

This is occurring because draw is called again automatically by p5 when the canvas resizes, and the ModFill code just goes ahead and increments the index again even though it already got to the limit. (To be fair, the original author of ModFill did not realize it was possible for draw() to be called again after it had called noLoop().) Anyhow, we need to make visualizers in general resilient to draw being called again after the visualizer thinks it is "done".

@gwhitney gwhitney added visualizer Has to do with a visualizer or the visualizer subsystem. bug labels Apr 23, 2024
@gwhitney
Copy link
Collaborator

gwhitney commented Jul 11, 2024

[Should be resolved by ui2; I guess we should comb through the whole issue list thereafter.]

@gwhitney
Copy link
Collaborator

Indeed, this is working fine in ui2, so closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
visualizer Has to do with a visualizer or the visualizer subsystem.
Projects
None yet
Development

No branches or pull requests

2 participants