Skip to content

fix(annotations): dimension lines from other editors keep their look - #528

Merged
DutchSailor merged 1 commit into
mainfrom
fix/foreign-dimension-lines
Oct 6, 2026
Merged

DutchSailor merged 1 commit into
mainfrom
fix/foreign-dimension-lines

Conversation

@DutchSailor

Copy link
Copy Markdown
Collaborator

What happened

A structural overview drawing whose annotations were made in another editor looked different in Open PDF Studio. Its dimension lines (/Line /IT /LineDimension with /LL, /LLE, /Cap, /CP /Inline, /LE [/ClosedArrow /ClosedArrow], no /IC, no /BS) were read into the app's own measure style, which:

  • drew them 0.5 pt thin (pdf.js reports width 0 when /BS and /Border are missing; the PDF default is 1);
  • filled the closed arrowheads (without /IC they are hollow) and made them 12 pt instead of the file's size;
  • added the app's own 10.8 pt overshoot and ignored /LLE and /LLO;
  • put the caption above the line instead of inside it, ignoring the font size and colour in /RC;
  • turned short dimensions into a blob of overlapping heads and flipped near-vertical captions.

Saving then wrote that style back, so after one save other viewers showed the changed version as well.

What this changes

  • New pure helper js/pdf/loader/maatlijn-uit-bestand.js maps a foreign dimension line to the model per key, only from what the dict contains: width 1 without /BS//Border, hollow closed heads without /IC, head size from the file, /LL//LLE//LLO, inline caption for /CP /Inline (and for /Cap without /CP, the PDF default), caption font size and colour from /RC.
  • Renderer: hollow closed heads (decorations.js), inline caption with a gap in the line (maatlijn-inline.js, maat-inline-tekenen.js), arrowheads outside the leader lines when the caption does not fit, a 1° tolerance before a near-vertical caption flips.
  • Saver (js/pdf/saver/maatlijn-opslaan.js): writes the appearance accordingly and keeps every taken-over property through OPS_HeadFill, OPS_DimTextPos, OPS_FontSize and OPS_LabelColor, so it survives load, save and load again.
  • The same width default applies to plain lines and arrows without /BS, and to the perimeter measure branch.

Unchanged

Files saved by Open PDF Studio itself and floor-plan measures: their saved dictionaries and appearances are compared with fixed output of the previous code (maatlijn-eigen-opslag.json) and are identical. Older own measures (from before OPS_Subtype existed) now draw at the PDF default width of 1 pt instead of 0.5 pt; a test records this.

Verification

  • 40+ new tests, each seen failing first; npm run test:unit 2633 passed, 0 failed; npx vite build and npm run typecheck green.
  • Live check in a local build with the drawing: the dimension lines now match the file's own appearance (hollow heads, leader ticks, caption in the line, short dimensions with the heads outside).
  • Save round trip with the full verification set: identical to release 2026.39.2. Text rotation, placement under the cursor, save duplicates and rotation sweep (46/46) good; comparison sweep without new flags.
  • An adversarial review found three defects (font size lost after one save in two cases, /Cap without /CP not inline); all fixed test-first.

🤖 Generated with Claude Code

Dimension lines (/Line /IT /LineDimension) from other programs were
read into the app's own measure style and lost most of their
properties; saving then wrote that style back, so other viewers showed
the changed version too. Now taken over, and kept over load and save
through OPS keys:
- line width 1 when neither /BS nor /Border is given (also plain lines
  and arrows);
- hollow closed arrowheads when there is no /IC, at the size the file
  uses;
- leader lines from /LL, /LLE and /LLO, without the app's own overshoot;
- the caption inside the line (/CP /Inline, also the default for /Cap
  without /CP), with font size and colour from /RC;
- short dimensions with the arrowheads outside the leader lines;
- near-vertical dimensions read from bottom to top.
Files saved by Open PDF Studio itself and floor-plan measures load and
save as before.
@DutchSailor
DutchSailor merged commit 71fae91 into main Oct 6, 2026
4 checks passed
DutchSailor added a commit that referenced this pull request Oct 6, 2026
@DutchSailor
DutchSailor deleted the fix/foreign-dimension-lines branch October 6, 2026 06:38
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