feat: measurement tools (distance, perimeter, area)#654
Open
MathiasWP wants to merge 2 commits into
Open
Conversation
Add calibrated measurement tools (distance, perimeter, polygon/rectangle/ ellipse area) with live, zoom-stable labels, scale calibration (incl. draw-to-calibrate), units (mm/cm/m/in/ft/yd/pt), decimal/fractional precision, and an optional secondary unit. Implementation: measurements are ordinary Line/Polyline/Polygon/Square/Circle annotations carrying typed `measurement` metadata; pure math lives in @embedpdf/models; persisted via the /EPDFCustom channel + spec /IT intent (native /Measure dictionary deferred — needs a pdfium WASM rebuild). Rendered across React/Preact/Vue/Svelte, with snippet-viewer UI (Measure mode, toolbar, calibrate dialog, property panel) and hold-Shift angle constraint.
|
@MathiasWP is attempting to deploy a commit to the OpenBook Team on Vercel. A member of the Team first needs to authorize it. |
Fill rectangle/ellipse/polygon area measurements with a subtle 45° diagonal hatch (mode === 'area' only) so the enclosed region reads as the measured area. Sized in px/scale so density stays constant across zoom; shared AreaHatch helper with Vue/Svelte mirrors.
Author
|
@bobsingor thoughts on adding this? This is the missing piece for us to start using EmbedPDF |
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.
Adds calibrated measurement tools — distance (line), perimeter (polyline), and area (polygon / rectangle / ellipse) — with live, zoom-stable labels, scale calibration (including draw-to-calibrate), units (mm/cm/m/in/ft/yd/pt), decimal/fractional precision, and an optional secondary unit.
Implementation: measurements are ordinary Line/Polyline/Polygon/Square/Circle annotations carrying typed
measurementmetadata; the unit/geometry math is a pure module in@embedpdf/models. Calibration is persisted via the/EPDFCustomdata channel plus the spec/ITintent (a fully spec-compliant native/Measuredictionary for cross-viewer interop is deferred — it needs a pdfium WASM rebuild). Labels render across React/Preact/Vue/Svelte, and the snippet viewer gets a Measure mode (toolbar, draw-to-calibrate dialog, property panel) plus hold-Shift angle constraint.Resolves #223