Skip to content

Reframe screenshot views to fit model after edits#36

Merged
kmatzen merged 1 commit intomainfrom
fix-screenshot-framing
Apr 17, 2026
Merged

Reframe screenshot views to fit model after edits#36
kmatzen merged 1 commit intomainfrom
fix-screenshot-framing

Conversation

@kmatzen
Copy link
Copy Markdown
Owner

@kmatzen kmatzen commented Apr 17, 2026

Summary

  • The "current" viewport capture now computes a zoom-to-fit position from the model bounding box instead of using the raw camera position, so the model is always fully visible after parameter edits
  • Saves and restores camera quaternion and orbit controls target to prevent the viewport from jumping after screenshots are captured

Test plan

  • Edit a model's parameters (e.g. make a box much larger) then send a chat message — verify the captured screenshots show the full model, not a zoomed-in partial view
  • After sending a message with screenshots, verify the viewport doesn't jump or change orientation
  • Verify the front/right/top orthographic views still show correct framing with rulers

🤖 Generated with Claude Code

The multi-view capture had several issues:

- On HiDPI/Retina displays, drawImage(canvas, 0, 0) used the DPR-
  scaled backing store dimensions, capturing only the top-left corner.
  Fix: pass explicit width/height to scale the full render down.
- The "current" view used the raw camera position which could be too
  close or far after edits. Now computes a zoom-to-fit position.
- Camera quaternion and orbit controls target weren't saved/restored,
  causing the viewport to jump after capture.
- OutlinePass render targets weren't resized to match the 256x256
  capture size, causing depth/outline mismatches.
- OutlinePass render targets could be created at zero size if the
  container hadn't been laid out yet.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kmatzen kmatzen force-pushed the fix-screenshot-framing branch from d08a4b2 to 9f4a6e7 Compare April 17, 2026 16:32
@kmatzen kmatzen merged commit 3a55efc into main Apr 17, 2026
5 checks passed
@kmatzen kmatzen deleted the fix-screenshot-framing branch April 17, 2026 16:41
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