Add resize handles#180
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a visual resize-handle (“grip”) affordance to the ruler UI by introducing a dedicated ResizeHandleView, installing it into both horizontal and vertical ruler views, and adding a DEBUG-only SwiftUI preview for quicker iteration.
Changes:
- Introduces
ResizeHandleViewthat draws a small grip background + lines for horizontal and vertical orientations. - Installs the resize-handle subview from
HorizontalRuleandVerticalRuleinitializers via newRuleView.installResizeHandle. - Adds DEBUG-only SwiftUI previews for
RuleViewto visualize both ruler orientations during development.
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 |
|---|---|
| Free Ruler/HorizontalRule.swift | Installs the resize handle for horizontal rulers during initialization. |
| Free Ruler/VerticalRule.swift | Installs the resize handle for vertical rulers during initialization. |
| Free Ruler/RuleView.swift | Adds resize-handle plumbing (subview install + frame updates) and a DEBUG-only SwiftUI preview. |
| Free Ruler/ResizeHandleView.swift | New NSView responsible for drawing the resize-handle/grip UI. |
| Free Ruler.xcodeproj/project.pbxproj | Adds ResizeHandleView.swift to the Xcode project build sources. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
867970e to
7f53bfd
Compare
Fix resize handle drag behavior
Refine the resize-handle cursor appearance and preview UI: reduce arrow/shaft sizes and stroke, add miterLimit and shadow parameters (alpha, blur, offset, padding) and draw the cursor with an NSShadow for depth. Adjust image/hotSpot APIs to account for orientation when computing size, and update cursor drawing to honor the new parameters and miter limit. Revise the debug preview defaults, layout, sliders (more granular steps and additional controls for shadow/miter), and preview sizing to better match the new visuals and allow interactive tuning.
Add custom resize handle cursors
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.
[codex] Clamp mouse tick labels before resize handles
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.
Closes #173
Summary
Tests