@orbat-mapper/tactical-map-sheet 0.6.6 → 0.6.8

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.
@@ -676,20 +676,24 @@ function serializeElement(element) {
676
676
  if (element.kind === "text") return serializeText(element);
677
677
  const [first, ...rest] = element.points;
678
678
  if (!first) throw new Error("Cannot serialize an empty path");
679
+ const commands = [
680
+ `M ${formatDecimal(first.xMm)} ${formatDecimal(first.yMm)}`,
681
+ ...rest.map((point) => `L ${formatDecimal(point.xMm)} ${formatDecimal(point.yMm)}`),
682
+ ...element.closed ? ["Z"] : []
683
+ ];
684
+ const fillAttribute = ` fill="${element.fillPatternId ? `url(#${escapeXml(element.fillPatternId)})` : escapeXml(element.fillColor ?? "none")}"`;
685
+ const attributes = serializeAttributes(element.attributes);
686
+ if (element.strokeWidthMm === 0) return `<path d="${commands.join(" ")}" stroke="none"${fillAttribute}${attributes}/>`;
679
687
  return [
680
- `<path d="${[
681
- `M ${formatDecimal(first.xMm)} ${formatDecimal(first.yMm)}`,
682
- ...rest.map((point) => `L ${formatDecimal(point.xMm)} ${formatDecimal(point.yMm)}`),
683
- ...element.closed ? ["Z"] : []
684
- ].join(" ")}"`,
688
+ `<path d="${commands.join(" ")}"`,
685
689
  ` stroke="${escapeXml(element.strokeColor)}"`,
686
690
  ` stroke-width="${formatDecimal(element.strokeWidthMm)}"`,
687
691
  element.strokeOpacity !== void 0 ? ` stroke-opacity="${formatDecimal(element.strokeOpacity)}"` : "",
688
692
  ` stroke-linecap="${element.lineCap}" stroke-linejoin="${element.lineJoin}"`,
689
693
  element.strokeDashMm.length > 0 ? ` stroke-dasharray="${element.strokeDashMm.map(formatDecimal).join(" ")}"` : "",
690
694
  element.fillColor || element.fillPatternId ? ` paint-order="fill stroke"` : "",
691
- ` fill="${element.fillPatternId ? `url(#${escapeXml(element.fillPatternId)})` : escapeXml(element.fillColor ?? "none")}"`,
692
- serializeAttributes(element.attributes),
695
+ fillAttribute,
696
+ attributes,
693
697
  "/>"
694
698
  ].join("");
695
699
  }
@@ -1443,7 +1447,7 @@ function pathFromPositions(positions, closed, properties, portrayal, context) {
1443
1447
  if (positions.length < 2) throw new Error("A document path requires at least two positions");
1444
1448
  const style = properties.style;
1445
1449
  const strokeWidthCssPixels = style?.strokeWidth ?? portrayal.strokeWidthCssPixels;
1446
- requirePositiveFinite(strokeWidthCssPixels, "Stroke width");
1450
+ requireFiniteNonNegative(strokeWidthCssPixels, "Stroke width");
1447
1451
  const strokeDashCssPixels = style?.strokeDash ?? portrayal.strokeDashCssPixels;
1448
1452
  strokeDashCssPixels.forEach((value) => requireFiniteNonNegative(value, "Stroke dash"));
1449
1453
  const fillPattern = style?.fillPattern;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as geographicToMgrs, c as normalizeMgrsReference, d as snapGeographicToMgrs, f as snapProjectedToMgrs, i as resolveMapSheetRasterPlan, l as parseMgrsReference, o as mgrsToGeographic, r as mapSheetRasterPointToGeographic, s as mgrsToProjected, t as createTacticalMapSheet, u as projectedToMgrs } from "./create-tactical-map-sheet-DR2FqVrS.mjs";
1
+ import { a as geographicToMgrs, c as normalizeMgrsReference, d as snapGeographicToMgrs, f as snapProjectedToMgrs, i as resolveMapSheetRasterPlan, l as parseMgrsReference, o as mgrsToGeographic, r as mapSheetRasterPointToGeographic, s as mgrsToProjected, t as createTacticalMapSheet, u as projectedToMgrs } from "./create-tactical-map-sheet-DLJy2TJk.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 { _ as openSansMiddleBaselineOffset, g as openSansCentralBaselineOffset, h as POINTS_PER_MILLIMETRE, m as MILLIMETRES_PER_CSS_PIXEL, n as createTacticalMapSheetDocument, p as formatDecimal } from "./create-tactical-map-sheet-DR2FqVrS.mjs";
1
+ import { _ as openSansMiddleBaselineOffset, g as openSansCentralBaselineOffset, h as POINTS_PER_MILLIMETRE, m as MILLIMETRES_PER_CSS_PIXEL, n as createTacticalMapSheetDocument, p as formatDecimal } from "./create-tactical-map-sheet-DLJy2TJk.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");
@@ -569,7 +569,7 @@ function renderElement(pdf, element, formIds) {
569
569
  paintPath(pdf, {
570
570
  ...DEFAULT_VECTOR_PAINT,
571
571
  fill: element.fillColor,
572
- stroke: element.strokeColor,
572
+ stroke: element.strokeWidthMm > 0 ? element.strokeColor : void 0,
573
573
  strokeWidth: element.strokeWidthMm,
574
574
  strokeOpacity: element.strokeOpacity ?? DEFAULT_VECTOR_PAINT.strokeOpacity,
575
575
  lineCap: element.lineCap,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbat-mapper/tactical-map-sheet",
3
- "version": "0.6.6",
3
+ "version": "0.6.8",
4
4
  "description": "Scale-accurate projected vector tactical map-sheet renderer.",
5
5
  "license": "MIT",
6
6
  "author": "Orbat Mapper",
@@ -30,8 +30,8 @@
30
30
  "jspdf": "4.2.1",
31
31
  "opentype.js": "2.0.0",
32
32
  "saxes": "6.0.0",
33
- "@orbat-mapper/tactical-draw": "^0.27.0",
34
- "@orbat-mapper/control-measures": "^0.42.0"
33
+ "@orbat-mapper/control-measures": "^0.43.0",
34
+ "@orbat-mapper/tactical-draw": "^0.28.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@napi-rs/canvas": "1.0.7",
@@ -45,7 +45,7 @@
45
45
  "typescript": "~5.9.3",
46
46
  "vite": "^8.0.16",
47
47
  "vitest": "^4.1.8",
48
- "@orbat-mapper/point-symbols": "0.2.25"
48
+ "@orbat-mapper/point-symbols": "0.2.26"
49
49
  },
50
50
  "inlinedDependencies": {
51
51
  "@types/geojson": "7946.0.16"