Skip to content

Fix Alt-based quick measurement to show document space coordinates instead of viewport space #2995

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

vineetpuranik
Copy link

@vineetpuranik vineetpuranik commented Aug 5, 2025

Fixes #2941

This PR addresses the bug where the quick measurement feature (triggered by holding Alt while hovering over a shape) displayed distances in viewport coordinates instead of document coordinates. This caused the measured distance to vary incorrectly based on zoom level.

Changes made

  • Updated the logic to compute the bounding boxes (selected_bounds, hovered_bounds) in document space using bounding_box_document.
  • Applied the document_to_viewport transform only once during rendering, preserving measurement accuracy.
  • Refactored variable names and added clear inline comments for maintainability.

Before

  • Measured distances between shapes would change when zooming in/out.

After

  • Measured distances remain consistent regardless of zoom level.
  • Overlays are correctly drawn by transforming document-space bounding boxes at render time.

Visual verification

Screencast.from.08-04-2025.11.43.41.PM.webm

@vineetpuranik vineetpuranik marked this pull request as ready for review August 5, 2025 06:46
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.

Quick measurement with Alt is incorrectly showing viewport coordinates instead of document coordinates
1 participant