Add marks_layout: non-overlapping Set-of-Marks labels with readable colour#443
Merged
Conversation
…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.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 52 |
| Duplication | 0 |
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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Second feature of the ROUND-15 perception lane.
set_of_marksdraws 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.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 inboundsand clears every already-placed label),label_color(black or white by whichever has the better WCAG contrast against the element background). Pure standard library; reusesa11y_audit.contrast_ratio. Deterministic, fully testable without rendering.__all__;AC_place_labels/AC_label_colorexecutor commands (marks/bounds accept JSON); matching read-onlyac_*MCP tools; Script Builder under Image.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_colorwhite-on-dark / black-on-light, plus JSON executor coercion and facade + executor/MCP/builder wiring. All 10 green;ruff+bandit+radonclean; no float==; package stays Qt-free.