fix(editor): clamp viewport/area snapshot captures to 2048px long edge - #639
Merged
Conversation
Viewport and area crop modes captured at the raw canvas backing-store resolution, so retina/5K displays produced multi-MB WebP snapshots that blow past upload transport limits. Clamp the output long edge to 2048 (matching the 1920-class standard presets) in the snapshot pipeline, the non-pipeline fallback, and the capture HUD resolution chip. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Viewport and area snapshot crop modes capture at the raw canvas backing-store resolution. On retina/5K Macs that is easily 3500–5000px wide, producing multi-MB WebP files that blow past upload transport limits (and silently fail to save in production).
Fix
SNAPSHOT_MAX_EDGE = 2048exported from the viewer snapshot pipeline; viewport and area captures scale down proportionally (high-quality smoothing) when the source exceeds it. Standard presets (≤1920 long edge) are untouched.ThumbnailGenerator.Verification
packages/viewerbun run buildandpackages/editorcheck-typespass.🤖 Generated with Claude Code
Note
Low Risk
Bounded output-size clamp on snapshot encoding only; standard presets are untouched and behavior is otherwise unchanged.
Overview
Caps viewport and area snapshot outputs at a 2048px long edge so retina/high-DPR captures no longer produce multi-MB WebPs that fail upload limits.
Adds
SNAPSHOT_MAX_EDGEin the viewer snapshot pipeline and proportionally downscales oversized captures (with high-quality smoothing) in both the pipeline and theThumbnailGeneratorfallback. Standard presets stay unchanged. The capture HUD now shows the clamped resolution.Reviewed by Cursor Bugbot for commit b9a4642. Bugbot is set up for automated code reviews on this repo. Configure here.