@ryan_nookpi/pi-skill-excalidraw 0.1.0 → 0.1.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/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
- 일반 노드 `200×72`, 긴 라벨 노드 `240×80`, 판단 다이아몬드 `220×120`, 시작/끝 타원 `160×64`.
|
|
22
22
|
- 라벨 폰트 20, 제목 28–36, 보조 설명 16.
|
|
23
|
-
- 라벨 폭 추정: 한글 한 글자 ≈ fontSize, 영문 ≈ 0.55×fontSize. 좌우 여백
|
|
23
|
+
- 라벨 폭 추정: 한글 한 글자 ≈ fontSize, 영문 ≈ 0.55×fontSize. 좌우 여백 48px를 더한 값이 `width`보다 크면 너비를 늘리거나 `\n`으로 줄을 나눈다. 높이는 줄 수 × fontSize × 1.25 + 32px 이상, 다이아몬드는 모서리가 좁으니 1.5배로 잡는다. 실제 폰트는 추정보다 넓게 그려지므로 빠듯하게 맞추지 않는다.
|
|
24
24
|
- 노드 사이 간격: 라벨 없는 화살표 60px 이상, 라벨 있는 화살표 120px 이상(라벨이 화살표 위에 올라간다).
|
|
25
25
|
- 좌표는 20의 배수로 맞춘다. 같은 열의 노드는 `x`를, 같은 행은 `y`를 똑같이 둔다.
|
|
26
26
|
|
|
@@ -263,10 +263,14 @@ function lint(file) {
|
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
265
|
if (isSkel(e) && SHAPES.has(e.type) && e.label?.text && typeof e.width === "number") {
|
|
266
|
-
|
|
267
|
-
|
|
266
|
+
// Fonts render wider than the estimate; diamonds need extra room around their text.
|
|
267
|
+
const fontSize = e.label.fontSize ?? 20;
|
|
268
|
+
const scale = e.type === "diamond" ? 1.5 : 1;
|
|
269
|
+
const needW = (textWidthEstimate(e.label.text, fontSize) + 48) * scale;
|
|
270
|
+
const needH = (fontSize * 1.25 * e.label.text.split("\n").length + 32) * scale;
|
|
271
|
+
if (needW > e.width || (typeof e.height === "number" && needH > e.height))
|
|
268
272
|
warns.push(
|
|
269
|
-
`${e.id}: 라벨 "${e.label.text.split("\n")[0]}"이
|
|
273
|
+
`${e.id}: 라벨 "${e.label.text.split("\n")[0]}"이 ${e.width}×${e.height}에 빠듯해 보임 (약 ${Math.round(needW)}×${Math.round(needH)}px 필요)`,
|
|
270
274
|
);
|
|
271
275
|
}
|
|
272
276
|
}
|