@orbat-mapper/tactical-map-sheet 0.6.6 → 0.6.7
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/dist/{create-tactical-map-sheet-DR2FqVrS.mjs → create-tactical-map-sheet-DLJy2TJk.mjs}
RENAMED
|
@@ -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
|
-
|
|
692
|
-
|
|
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
|
-
|
|
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-
|
|
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-
|
|
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,
|