Introduce zero corner geometry helpers#201
Conversation
a55a133 to
d176e65
Compare
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Pull request overview
This PR introduces a centralized ZeroCornerGeometry helper to consistently derive zero-corner-dependent behavior (frame placement, growth direction, tick side, and resize-handle side) across ruler operations, and adds targeted unit tests to validate all four zero-corner states.
Changes:
- Add
ZeroCornerGeometry(plus supportingRulerGrowthDirection/RulerSide) to model zero-corner traits and compute zero-point/frame placement. - Route ruler alignment/reset positioning through
ZeroCornerGeometry-backed frame placement. - Update resize-handle placement and resize-frame math to respect the selected zero corner, with new unit tests covering additional resize directions.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| FreeRulerTests/RulerCoreTests.swift | Adds focused tests covering all four zero-corner states and new resize directions. |
| Free Ruler/RulerController.swift | Uses ZeroCornerGeometry for alignment and zero-corner-aware default positioning on reset. |
| Free Ruler/Ruler.swift | Introduces ZeroCornerGeometry and refactors default frame computation to use the helper. |
| Free Ruler/ResizeHandleView.swift | Makes resize-handle placement and resizing math depend on the zero-corner-derived resize side. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Summary
ZeroCornerGeometryas the shared helper layer for zero-corner traits and frame placement.Validation
xcodebuild -project "Free Ruler.xcodeproj" -scheme "Free Ruler" test -only-testing:FreeRulerTestsCloses #193.