Skip to content

Add marks_layout: non-overlapping Set-of-Marks labels with readable colour#443

Merged
JE-Chen merged 1 commit into
devfrom
feat/marks-layout-batch
Jun 26, 2026
Merged

Add marks_layout: non-overlapping Set-of-Marks labels with readable colour#443
JE-Chen merged 1 commit into
devfrom
feat/marks-layout-batch

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jun 25, 2026

Copy link
Copy Markdown
Member

Summary

Second feature of the ROUND-15 perception lane. set_of_marks draws each numbered label at a fixed offset, so on dense UIs the numbers pile on top of each other (unreadable) and a dark label on a dark element vanishes.

  • Headless core utils/marks_layout/: place_labels (greedy non-overlap placement — for each mark, try a ring of candidate positions around its box and take the first that stays in bounds and clears every already-placed label), label_color (black or white by whichever has the better WCAG contrast against the element background). Pure standard library; reuses a11y_audit.contrast_ratio. Deterministic, fully testable without rendering.
  • 5 layers wired: facade __all__; AC_place_labels / AC_label_color executor commands (marks/bounds accept JSON); matching read-only ac_* MCP tools; Script Builder under Image.
  • Docs: EN + Zh v215_features_doc.rst + WHATS_NEW.md.

Test

test/unit_test/headless/test_marks_layout_batch.py — one label per mark, no-overlap on stacked marks, stays-in-bounds at the corner, default-above placement, empty input, label_color white-on-dark / black-on-light, plus JSON executor coercion and facade + executor/MCP/builder wiring. All 10 green; ruff + bandit + radon clean; no float ==; package stays Qt-free.

…olour

set_of_marks draws each numbered label at a fixed offset, so on dense UIs
the numbers pile up and a dark label on a dark element vanishes.
place_labels does greedy non-overlap placement over a candidate ring,
staying in bounds; label_color picks black/white by better WCAG contrast
(reusing a11y_audit.contrast_ratio). Pure geometry, fully testable.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 52 complexity · 0 duplication

Metric Results
Complexity 52
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@JE-Chen JE-Chen merged commit 1e4a2db into dev Jun 26, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/marks-layout-batch branch June 26, 2026 00:55
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant