feat(b07): 횡단 장 표 · 표 위 글 배율 칸(180-2)
- cross_layout.json table_scale(모든 장 한 값 · 0.5~2.0 · 기본 1) · 저장 검사 · 「모든 장」 저장이 배율 안 지움 - 표 폭 · 행 높이 · 글 · 글 줄 높이에 배율 · 174 쌓기 · 넘침 판정이 같은 값으로 다시 셈 - 확정 장 그대로 · 다른 배율로 확정된 장 = stale_scale 안내 - 배치 칸 줄에 「표 배율 [1] [배율 적용]」 - 새 시험 test_180_2_b07_cross_scale · test_140 기본값 · test_153_1 배율 칸 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TNMXVCZXMpHpVvqmFkeChL
This commit is contained in:
@@ -104,6 +104,8 @@ CROSS_SHEET_LAYOUT = 5
|
||||
CROSS_LAYOUT_FILE = "cross_layout.json"
|
||||
CROSS_GRID_DEFAULT = [4, 4]
|
||||
_CROSS_GRID_MAX = 10
|
||||
# 표 · 표 위 글 배율(180-2) — 모든 장 한 값 · 기본 1
|
||||
CROSS_SCALE_RANGE = (0.5, 2.0)
|
||||
|
||||
|
||||
def _cross_grid(value: Any) -> list[int]:
|
||||
@@ -116,13 +118,22 @@ def _cross_grid(value: Any) -> list[int]:
|
||||
return [int(value[0]), int(value[1])]
|
||||
|
||||
|
||||
def _cross_scale(value: Any) -> float:
|
||||
low, high = CROSS_SCALE_RANGE
|
||||
if value is None:
|
||||
return 1.0
|
||||
if isinstance(value, bool) or not isinstance(value, (int, float)) or not low <= value <= high:
|
||||
raise ValueError(f"표 배율은 {low}~{high} 사이로 적어 주세요.")
|
||||
return round(float(value), 2)
|
||||
|
||||
|
||||
def read_cross_layout(project_root: Path) -> dict[str, Any]:
|
||||
"""횡단 장 배치 — 파일이 없거나 깨졌으면 기본 4 × 4 만."""
|
||||
"""횡단 장 배치 — 파일이 없거나 깨졌으면 기본 4 × 4 · 배율 1 만."""
|
||||
path = _design_root(project_root) / CROSS_LAYOUT_FILE
|
||||
try:
|
||||
return checked_cross_layout(_read_json(path))
|
||||
except (OSError, ValueError, AttributeError):
|
||||
return {"default": list(CROSS_GRID_DEFAULT), "sheets": {}}
|
||||
return {"default": list(CROSS_GRID_DEFAULT), "sheets": {}, "table_scale": 1.0}
|
||||
|
||||
|
||||
def checked_cross_layout(layout: dict[str, Any]) -> dict[str, Any]:
|
||||
@@ -132,6 +143,7 @@ def checked_cross_layout(layout: dict[str, Any]) -> dict[str, Any]:
|
||||
return {
|
||||
"default": _cross_grid(layout.get("default") or CROSS_GRID_DEFAULT),
|
||||
"sheets": {str(int(key)): _cross_grid(grid) for key, grid in sheets.items()},
|
||||
"table_scale": _cross_scale(layout.get("table_scale")),
|
||||
}
|
||||
|
||||
|
||||
@@ -449,6 +461,10 @@ def _read_drawing(
|
||||
label = str(manifest_entry.get("label") or drawing_id)
|
||||
if kind == "cross" and manifest_entry.get("layout") != CROSS_SHEET_LAYOUT:
|
||||
saved["stale_layout"] = True # 화면이 [수정] → 새 배치로 다시 만들기를 안내
|
||||
elif kind == "cross" and drawing_id.startswith("cross_s"):
|
||||
scale = read_cross_layout(project_root)["table_scale"]
|
||||
if manifest_entry.get("table_scale", 1.0) != scale:
|
||||
saved["stale_scale"] = True # 옛 배율로 확정한 장 — 그대로 두고 안내(180-2)
|
||||
stored_table = manifest_entry.get("quantity_table")
|
||||
table = stored_table if kind == "cross" and isinstance(stored_table, dict) else None
|
||||
return kind, label, saved, True, table
|
||||
@@ -594,6 +610,7 @@ def _store_confirmed_drawing(
|
||||
}
|
||||
if item.kind == "cross":
|
||||
entry["layout"] = CROSS_SHEET_LAYOUT
|
||||
entry["table_scale"] = read_cross_layout(project_root)["table_scale"]
|
||||
if item.kind == "cross" and isinstance(quantity_table, dict):
|
||||
entry["quantity_table"] = quantity_table
|
||||
if isinstance(quantity_tables, dict) and quantity_tables:
|
||||
|
||||
Reference in New Issue
Block a user