Fix box empty rows: add x_min_px/x_max_px to flowing/header columns
Some checks failed
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-school (push) Successful in 55s
CI / test-go-edu-search (push) Successful in 51s
CI / test-python-klausur (push) Failing after 2m7s
CI / test-python-agent-core (push) Successful in 26s
CI / test-nodejs-website (push) Successful in 31s
Some checks failed
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-school (push) Successful in 55s
CI / test-go-edu-search (push) Successful in 51s
CI / test-python-klausur (push) Failing after 2m7s
CI / test-python-agent-core (push) Successful in 26s
CI / test-nodejs-website (push) Successful in 31s
GridTable calculates column widths from col.x_max_px - col.x_min_px. Flowing and header_only layouts were missing these fields, producing NaN widths which collapsed the CSS grid layout and showed empty rows with only row numbers visible. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -176,7 +176,11 @@ def build_box_zone_grid(
|
|||||||
w.get("text", "") for w in sorted(zone_words, key=lambda ww: (ww["top"], ww["left"]))
|
w.get("text", "") for w in sorted(zone_words, key=lambda ww: (ww["top"], ww["left"]))
|
||||||
).strip()
|
).strip()
|
||||||
return {
|
return {
|
||||||
"columns": [{"col_index": 0, "index": 0, "label": "column_text", "col_type": "column_1"}],
|
"columns": [{"col_index": 0, "index": 0, "label": "column_text", "col_type": "column_1",
|
||||||
|
"x_min_px": box_x, "x_max_px": box_x + box_w,
|
||||||
|
"x_min_pct": round(box_x / img_w * 100, 2) if img_w else 0,
|
||||||
|
"x_max_pct": round((box_x + box_w) / img_w * 100, 2) if img_w else 0,
|
||||||
|
"bold": False}],
|
||||||
"rows": [{"index": 0, "row_index": 0,
|
"rows": [{"index": 0, "row_index": 0,
|
||||||
"y_min": box_y, "y_max": box_y + box_h, "y_center": box_y + box_h / 2,
|
"y_min": box_y, "y_max": box_y + box_h, "y_center": box_y + box_h / 2,
|
||||||
"y_min_px": box_y, "y_max_px": box_y + box_h,
|
"y_min_px": box_y, "y_max_px": box_y + box_h,
|
||||||
@@ -199,7 +203,14 @@ def build_box_zone_grid(
|
|||||||
if layout_type in ("flowing", "bullet_list"):
|
if layout_type in ("flowing", "bullet_list"):
|
||||||
# Force single column — each line becomes one row with one cell
|
# Force single column — each line becomes one row with one cell
|
||||||
lines = _group_into_lines(zone_words)
|
lines = _group_into_lines(zone_words)
|
||||||
column = {"col_index": 0, "index": 0, "label": "column_text", "col_type": "column_1"}
|
# Column needs x_min_px/x_max_px for GridTable width calculation
|
||||||
|
column = {
|
||||||
|
"col_index": 0, "index": 0, "label": "column_text", "col_type": "column_1",
|
||||||
|
"x_min_px": box_x, "x_max_px": box_x + box_w,
|
||||||
|
"x_min_pct": round(box_x / img_w * 100, 2) if img_w else 0,
|
||||||
|
"x_max_pct": round((box_x + box_w) / img_w * 100, 2) if img_w else 0,
|
||||||
|
"bold": False,
|
||||||
|
}
|
||||||
rows = []
|
rows = []
|
||||||
cells = []
|
cells = []
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user