Skip to content

Attempt to animate the canonicalization process.#25

Open
huttarl wants to merge 2 commits intolevskaya:masterfrom
huttarl:master
Open

Attempt to animate the canonicalization process.#25
huttarl wants to merge 2 commits intolevskaya:masterfrom
huttarl:master

Conversation

@huttarl
Copy link
Contributor

@huttarl huttarl commented Oct 9, 2025

I wanted to see the canonicalization process in action. So I added a little bit of code into canonicalize(), to call

        // Update the polyhedron vertices to show progress
        poly.vertices = newVs;
        // update the display to show animated progress
        drawShape();
        // Yield to UI thread to allow display update
        await new Promise(resolve => setTimeout(resolve, 0));

at the end of each iteration. (The await meant that canonicalize() had to be made async.)

But I can't test it. When I rebuild (build.sh does a concatenate and minify) and reload the page, I get this error:
SyntaxError: '[test!='']:sizzle' is not a valid selector. I've read that this has something to do with either not waiting for the page to fully load, or minify working incorrectly. I have minify 2.24.3 installed by homebrew. No idea what sort of minify was used before. When I try to modify polyhedronisme.min.js by hand, I get baffling errors ... no idea what's going on.

So I offer this little change, hoping someone (e.g. @levskaya) can try it, rebuild the app, and deploy the change ... or else tell me how to fix my build process.

The await new Promise(resolve => setTimeout(resolve, 0)) is an attempt to not block the UI thread for too long and allow canvas writes to be displayed. But I don't know if it's actually helpful, or breaks things. Without it, canonicalize() doesn't need to be async, which may make the change simpler.

@huttarl huttarl closed this Oct 9, 2025
@huttarl huttarl reopened this Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant