Skip to content

Fix sprocket preview canvas switching#102

Merged
lexluthor0304 merged 1 commit into
mainfrom
fix/sprocket-preview-visibility
Jun 10, 2026
Merged

Fix sprocket preview canvas switching#102
lexluthor0304 merged 1 commit into
mainfrom
fix/sprocket-preview-visibility

Conversation

@lexluthor0304

Copy link
Copy Markdown
Owner

Summary

  • keep the 2D canvas visible when sprocket preview is toggled on in Step 3
  • restore the WebGL preview display size from the current image source when sprocket preview is toggled off
  • prevent the non-sprocket preview from inheriting the sprocket frame aspect ratio

Verification

  • node negative2positive/src/app/sprocketFrame.test.mjs
  • node negative2positive/src/app/imageDataOps.test.mjs
  • npm run build:web
  • Chrome DevTools: SAMPLE.jpg -> Positive Mode -> Step 3 -> Sprocket Preview on/off restores original preview aspect ratio

@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
negative-converter Ready Ready Preview, Comment Jun 10, 2026 12:02pm

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c17366b560

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

try {
const source = getWebglSourceImageData();
if (!source) return false;
adjustCanvasDisplay(source.width, source.height);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reset the backing canvas when returning to WebGL

When sprocket preview is turned off in Step 3, updatePreview() now takes the WebGL path, and this line only restores the CSS display size. The hidden 2D canvas dimensions remain set to the sprocket-framed size from renderFastSprocketPreview/setMainCanvasDimensions, so any later code that uses canvas.width/canvas.height still sees the framed aspect; for example the window resize handler calls adjustCanvasDisplay(canvas.width, canvas.height), which re-applies the sprocket aspect after a resize. Reset the backing canvas dimensions to the non-sprocket source size when switching back to WebGL.

Useful? React with 👍 / 👎.

@lexluthor0304 lexluthor0304 merged commit 8309856 into main Jun 10, 2026
10 checks passed
@lexluthor0304 lexluthor0304 deleted the fix/sprocket-preview-visibility branch June 10, 2026 12:06
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