[codex] Clamp mouse tick labels before resize handles#185
Merged
Conversation
Pin mouse label X to a max right bound and choose left/right placement to avoid overflowing the resize handle. HorizontalRule now computes a pinnedRightPosition and clamps left/right label Xs, then selects the final labelX based on the label number to ensure it flips correctly before colliding with the resize handle. Tests in RulerCoreTests were adjusted to use numbers that exercise the flip behavior, to assert against the resizeHandleExclusionFrame (with a guard that fails the test if the frame is missing), and to validate the label no longer overlaps the resize handle instead of relying on a hardcoded X value.
04449b8 to
2bc45d9
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts mouse tick label positioning so it doesn’t slide under the resize handle, while keeping the mouse tick line itself anchored to the live mouse position (addressing #178).
Changes:
- Clamp horizontal mouse tick labels so their right edge stays
8ptleft of the resize handle. - Clamp vertical mouse tick labels so their bottom edge stays
8ptabove the resize handle. - Add unit tests to validate the new clamping behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| FreeRulerTests/RulerCoreTests.swift | Adds tests asserting horizontal/vertical mouse tick label clamping near the resize handle. |
| Free Ruler/HorizontalRule.swift | Refactors mouse label positioning into a helper and clamps the label before the resize handle. |
| Free Ruler/VerticalRule.swift | Refactors mouse label positioning into a helper and clamps the label above the resize handle. |
| Free Ruler/RuleView.swift | Exposes resize handle frame for layout exclusion and centralizes the 8pt spacing constant. |
| Free Ruler/Localizable.xcstrings | Adds a new Unavailable string catalog entry and bumps catalog version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Fixes #178.
Validation
xcodebuild -project "Free Ruler.xcodeproj" -scheme "Free Ruler" -only-testing:FreeRulerTests/RulerCoreTests testxcodebuild -project "Free Ruler.xcodeproj" -scheme "Free Ruler" test, but the UI suite failed in unrelated interaction/visibility tests while another agent was also running tests on this machine.