#9349 - Stereo group labels are overlapped by CIP labels in Macromole…#10089
Conversation
46a3d43 to
d4ea70b
Compare
| this.appendBadValenceWarning(); | ||
| this.appendCIPLabel(); | ||
| this.appendStereoLabel(); |
There was a problem hiding this comment.
This ordering is now load-bearing — positionCIPLabel reads this.stereoTextElementBBox (set during appendStereoLabel) to push the CIP label past the stereo label. A future refactor that re-orders or splits these calls would silently regress #9349. Worth a one-line comment, e.g. // must come before appendCIPLabel — CIP positioning depends on the stereo bbox, or a comment on appendCIPLabel/positionCIPLabel documenting the dependency.
| projectedDistance = Math.max( | ||
| projectedDistance, | ||
| stereoProjectedDistance + | ||
| stereoProjectionRadius + | ||
| cipProjectionRadius + | ||
| 2, | ||
| ); |
There was a problem hiding this comment.
The trailing + 2 is a magic literal — it's the gap between the stereo and CIP labels but reads as noise next to the named LABEL_CLEARANCE_OFFSET. Suggest pulling it into a named constant (e.g. STEREO_CIP_GAP = 2) alongside LABEL_CLEARANCE_OFFSET so the spacing model is discoverable and tunable in one place.
| SELECTION_HOVERED_COLOR, | ||
| } from 'application/render/renderers/constants'; | ||
|
|
||
| const LABEL_CLEARANCE_OFFSET = 5; |
There was a problem hiding this comment.
Consider a brief comment explaining what LABEL_CLEARANCE_OFFSET = 5 represents (extra px past the bbox? why 5?). The whole point of this PR is to tune that spacing, so the next person changing it will want to know the rationale rather than tweaking blind.
|
Code review summary — nothing blocking, but a few things worth addressing. PR description vs. diff mismatch
The checklist also has Code No performance or security concerns. |
svvald
left a comment
There was a problem hiding this comment.
Approved in advance, but please check and address Claude's comments, they're pretty reasonable for future code maintenance
…cules mode - snapshots update + claude suggestions
…cules mode - snapshots update
What changed
Improved stereo-label and CIP label spacing in Macromolecules mode so labels sit farther from bonds and no longer overlap each other.
Refactored AtomRenderer to center labels using the actual SVG bounding box instead of relying on height-based offsets.
Made the stereo/CIP spacing logic easier to read and tune by naming the gap constant and documenting the load-bearing render order.
Added updated visual regression snapshot baselines for the affected Chromium cases.
Why
Stereo labels in Macromolecules mode were too close to bond lines.
The previous text positioning logic introduced a vertical bias because it did not use the real SVG text box origin.
The stereo label must be rendered before the CIP label because CIP positioning depends on the stereo label bounding box.
The spacing change needed snapshot coverage to prevent regressions.
Results:


Check list
#1234 – issue name