fix(canvas): compensate print border in tool coordinate mapping#614
Merged
Conversation
Heal spots, dodge/burn lassos, mask edits and WB picks landed offset by the border size when the finish border/paper layout padded the preview: the overlay normalized clicks over the full padded frame and ignored content_rect (only the densitometer compensated). - overlay: _content_view_rect(); all coords crossing the overlay boundary are now content-normalized (forward map, _raw_to_screen, brush radius, drag clamps, IR/wash raster targets); mat clicks drop - widget: get_pixel_rgb samples content-relative - controller: densitometer no longer double-compensates - main_window: CPU path no longer pads the border-less crop/analysis preview (parity with GPU skipping the layout pass there)
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
With
finish.border_size > 0(or paper aspect ≠ ORIGINAL) the preview canvas is padded with the print/mat border. The overlay stored the deliveredcontent_rectbut nothing used it: every tool click was normalized over the full padded frame while the pipeline expects content coords. Manual heal spots, dodge&burn lassos, mask-vertex edits and WB picks all landed offset by the border size (asymmetric withborder_bottom_weight > 1). The reverse map had the same omission, so markers drew at the click point while the healed pixel landed elsewhere.Cleared suspects: filed carrier and vignette are value-only (no geometry); rotation/fine-rot/flip/distortion/crop are already handled by
uv_grid; stored config coords are raw-source-normalized, so no existing edits are affected.Bonus bug found along the way: CPU mode padded the border-less crop/analysis preview too (
main_window), misaligning the crop rect. GPU skips the layout pass there.Fix
Single contract change in
CanvasOverlay: every normalized coordinate crossing the overlay boundary is content-normalized, via one helper_content_view_rect()(short-circuits to_view_rectwhen there is no border)._raw_to_screen, brush radius, drag clamps, mat-click gating, IR/wash raster draw targetsget_pixel_rgbsamples content-relativecontent_rect=None(was the only compensated path — would double-compensate)Verification
tests/test_canvas_border_mapping.py; 7 failed pre-fix for the predicted reasonsmake allgreen: 2437 passed, lint + type clean