Add custom resize handle cursors#184
Merged
pascalpp merged 4 commits intoJun 11, 2026
Merged
Conversation
e401d37 to
bab8c66
Compare
bab8c66 to
0ea5667
Compare
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.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements custom AppKit resize cursors for the ruler resize handles by generating NSCursor images at runtime, aiming to approximate the private macOS window resize cursors while remaining App Store-safe.
Changes:
- Replaces use of
.resizeLeftRight/.resizeUpDownwith generated customNSCursorimages for horizontal/vertical resizing. - Adds cursor image generation logic (outline + shadow) and a DEBUG SwiftUI preview for tuning.
- Adds a unit test validating cursor image sizes, centered hotspot, and non-template rendering.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| FreeRulerTests/RulerCoreTests.swift | Adds a focused unit test validating the generated resize cursor image properties. |
| Free Ruler/ResizeHandleView.swift | Introduces generated custom cursor images (plus DEBUG preview tooling) and wires them into resize-handle cursor behavior. |
💡 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.
Refs #183
Summary
NSCursorimages for horizontal and vertical resizingTests
xcodebuild -project "Free Ruler.xcodeproj" -scheme "Free Ruler" test(RulerCoreTests passed; UI tests failed while another agent was also running tests, causing app/window interaction contention)