@orbat-mapper/tactical-map-sheet 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -112,9 +112,8 @@ normalized and resolves to its southwest grid intersection, then optionally snap
112
112
  Its complete fixed 8 mm black crosshair and labels must fit inside the printable frame. A non-empty
113
113
  authored label is placed inward from the crosshair. Otherwise, the MGRS easting is placed to its left
114
114
  and the northing below it in the conventional abbreviated arrangement. At 100 km precision, the
115
- grid-square column and row letters take those positions. At least one pair must span 50% of the frame
116
- diagonal and 25% of both frame axes. Any invalid mark rejects the complete request; marks are never
117
- omitted or moved.
115
+ grid-square column and row letters take those positions. At least two marks must resolve to distinct
116
+ positions. Any invalid mark rejects the complete request; marks are never omitted or moved.
118
117
 
119
118
  Registered overlays are transparent. An explicit non-transparent `page.background` is rejected.
120
119
  SVG and PDF results expose the same ordered `registrationMarks`, each containing the authored ID,
@@ -1814,16 +1814,11 @@ function assertMarkFits(point, labels, frame, id) {
1814
1814
  const strokeEdge = 4.1;
1815
1815
  if (!(point.xMm - strokeEdge >= frame.xMm && point.xMm + strokeEdge <= frame.xMm + frame.widthMm && point.yMm - strokeEdge >= frame.yMm && point.yMm + strokeEdge <= frame.yMm + frame.heightMm) || labels.some((label) => !contains(frame, textBounds(label)))) throw new RangeError(`Registration mark ${JSON.stringify(id)} and its label must fit within the printable map frame`);
1816
1816
  }
1817
- function hasUsablePair(marks, frame) {
1818
- const minimumX = frame.widthMm * .25;
1819
- const minimumY = frame.heightMm * .25;
1820
- const minimumDiagonal = Math.hypot(frame.widthMm, frame.heightMm) * .5;
1817
+ function hasDistinctPair(marks) {
1821
1818
  for (let left = 0; left < marks.length; left += 1) for (let right = left + 1; right < marks.length; right += 1) {
1822
1819
  const first = marks[left].sheetPositionMm;
1823
1820
  const second = marks[right].sheetPositionMm;
1824
- const x = Math.abs(first.xMm - second.xMm);
1825
- const y = Math.abs(first.yMm - second.yMm);
1826
- if (x >= minimumX && y >= minimumY && Math.hypot(x, y) >= minimumDiagonal) return true;
1821
+ if (first.xMm !== second.xMm || first.yMm !== second.yMm) return true;
1827
1822
  }
1828
1823
  return false;
1829
1824
  }
@@ -1871,7 +1866,7 @@ function renderRegistration(request, context) {
1871
1866
  elements
1872
1867
  });
1873
1868
  }
1874
- if (!hasUsablePair(marks, context.frame)) throw new RangeError("Registration requires a pair spanning 50% of the printable diagonal and 25% of both frame axes");
1869
+ if (!hasDistinctPair(marks)) throw new RangeError("Registration requires marks at two distinct positions");
1875
1870
  return {
1876
1871
  layer: {
1877
1872
  id: "registration-marks-0",
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as mgrsToProjected, c as projectedToMgrs, i as mgrsToGeographic, l as snapGeographicToMgrs, o as normalizeMgrsReference, r as geographicToMgrs, s as parseMgrsReference, t as createTacticalMapSheet, u as snapProjectedToMgrs } from "./create-tactical-map-sheet-DSmO71Oa.mjs";
1
+ import { a as mgrsToProjected, c as projectedToMgrs, i as mgrsToGeographic, l as snapGeographicToMgrs, o as normalizeMgrsReference, r as geographicToMgrs, s as parseMgrsReference, t as createTacticalMapSheet, u as snapProjectedToMgrs } from "./create-tactical-map-sheet-Ch8io55k.mjs";
2
2
  //#region src/paper.ts
3
3
  const A0 = Object.freeze({
4
4
  widthMm: 841,
package/dist/pdf.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { d as formatDecimal, f as MILLIMETRES_PER_CSS_PIXEL, m as openSansCentralBaselineOffset, n as createTacticalMapSheetDocument, p as POINTS_PER_MILLIMETRE } from "./create-tactical-map-sheet-DSmO71Oa.mjs";
1
+ import { d as formatDecimal, f as MILLIMETRES_PER_CSS_PIXEL, m as openSansCentralBaselineOffset, n as createTacticalMapSheetDocument, p as POINTS_PER_MILLIMETRE } from "./create-tactical-map-sheet-Ch8io55k.mjs";
2
2
  import { jsPDF } from "jspdf";
3
3
  //#region src/pdf-transparency.ts
4
4
  const FORM_DICTIONARY_MARKER = new TextEncoder().encode("/Subtype /Form\n/BBox");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbat-mapper/tactical-map-sheet",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Scale-accurate projected vector tactical map-sheet renderer.",
5
5
  "license": "MIT",
6
6
  "author": "Orbat Mapper",