[mac] fix: allow scratchpad window to be resized#372
Merged
Conversation
The scratchpad panel had `.resizable` in its styleMask but two later additions blocked actual resize: - `NSHostingController` defaults its `sizingOptions` to `[.minSize, .intrinsicContentSize, .maxSize]` on macOS 13+, so the hosting view pinned the window to SwiftUI's intrinsic size with a `.maxSize` Auto Layout constraint. - `preferredContentSize` plus `translatesAutoresizingMaskIntoConstraints = false` were band-aids for the same machinery — they prevented the panel from collapsing on first show, but kept the window locked there. Switching `sizingOptions` to `.minSize` (and dropping the band-aids) keeps the SwiftUI-driven minimum but lets the user grow the window freely. The min bumped to 420×320 so a centered "New Scratchpad" title can't overlap the traffic lights or the new-note button, and `contentMinSize` is set redundantly so the constraint applies to the content rect under `.fullSizeContentView`. Autosave key bumped to `ClearlyScratchpadWindow_v2` so any stale sub-minimum frame written by earlier builds is ignored.
Deploying clearly with
|
| Latest commit: |
d462c4e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://e81124e4.clearly-cjz.pages.dev |
| Branch Preview URL: | https://claude-wonderful-archimedes.clearly-cjz.pages.dev |
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
.resizablein its styleMask but couldn't actually be resized.NSHostingControllerdefaults itssizingOptionsto[.minSize, .intrinsicContentSize, .maxSize]on macOS 13+, so the hosting view pinned the window to SwiftUI's intrinsic size via a.maxSizeAuto Layout constraint.preferredContentSizeandtranslatesAutoresizingMaskIntoConstraints = falsewere earlier workarounds for the same machinery — they kept the panel from collapsing on first show, but locked it at its initial size.sizingOptions = .minSizeand drop the workarounds. The SwiftUI minimum still propagates as a constraint, but.intrinsicContentSize/.maxSizeno longer fight user resize.win.minSize,win.contentMinSize, and the SwiftUI shell's.frame(minWidth:minHeight:).ClearlyScratchpadWindow_v2so any stale sub-minimum frame saved by earlier builds is discarded — first launch picks up the default 480×560.Test plan