Merge remote-tracking branch 'origin/sub_laptop_1' into main_laptop_1

This commit is contained in:
2026-10-08 13:27:54 +09:00
@@ -325,6 +325,8 @@ export interface PatternTile {
rings: Array<{ cx: number; cy: number; rx: number; ry: number }>;
}
/** 무늬 칸은 화면 px 로 그린 것 — 도면(종이 mm)에선 같은 촘촘함이 되게 px → mm. */
const PATTERN_MM_PER_PX = 25.4 / 96;
/** 무늬 칸 수 상한 — 넘으면 무늬를 버리고 외곽선만(ponytail: 큰 다각형이면 칸 크기를 키울 것). */
const PATTERN_TILE_LIMIT = 20000;
@@ -386,9 +388,10 @@ function patternTileOf(element: SVGElement, root: SVGElement): PatternTile | nul
(node) => node.getAttribute("id") === id,
);
if (!pattern) return null;
const k = PATTERN_MM_PER_PX;
const tile: PatternTile = {
width: attr(pattern, "width"),
height: attr(pattern, "height"),
width: attr(pattern, "width") * k,
height: attr(pattern, "height") * k,
paths: [],
rings: [],
};
@@ -400,19 +403,19 @@ function patternTileOf(element: SVGElement, root: SVGElement): PatternTile | nul
const numbers = run.match(/-?[\d.]+/g)?.map(Number) ?? [];
const points: XY[] = [];
for (let index = 0; index + 1 < numbers.length; index += 2) {
points.push([numbers[index], numbers[index + 1]]);
points.push([numbers[index] * k, numbers[index + 1] * k]);
}
if (points.length > 1) tile.paths.push(points);
}
} else if (tag === "circle") {
const r = attr(child, "r");
tile.rings.push({ cx: attr(child, "cx"), cy: attr(child, "cy"), rx: r, ry: r });
const r = attr(child, "r") * k;
tile.rings.push({ cx: attr(child, "cx") * k, cy: attr(child, "cy") * k, rx: r, ry: r });
} else if (tag === "ellipse") {
tile.rings.push({
cx: attr(child, "cx"),
cy: attr(child, "cy"),
rx: attr(child, "rx"),
ry: attr(child, "ry"),
cx: attr(child, "cx") * k,
cy: attr(child, "cy") * k,
rx: attr(child, "rx") * k,
ry: attr(child, "ry") * k,
});
}
}