Fix layout-save crash; add screen-alignment buttons and drag-snap UX (auto-snap, zone spanning, sticky right-click cancel) - #86
Open
haylax wants to merge 3 commits into
Conversation
UserLayout.reArrange() force-unwrapped both the section number (`$0.number!`) and the matching section window (`.first(where:)!`). When the section configs and live section windows fell out of sync (e.g. after adding/removing a section), the unwrap hit nil and the app crashed with SIGTRAP on Save. Make it tolerant, matching the existing guard-let pattern already used in LayoutWindow.onSave(): sort with `?? Int.max` and skip configs that have no matching window instead of force-unwrapping. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds an AlignmentPreset enum + AlignmentButton (SF Symbols align.horizontal.* / align.vertical.*) and a new row of buttons in the per-section editor (EditorSectionView). Unlike the existing PositioningPreset buttons, which also resize the section, these keep the section's current size and only reposition it relative to the screen: align left / center / right and top / middle / bottom. This lets you size a zone freely, then align it without changing its dimensions. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Three related window-drag snapping improvements, all toggleable in Preferences: - Auto-snap while dragging (snapWhileDragging, default on): the layout activates automatically when a window drag starts, no key required. Holding the snap key (default Shift) temporarily suppresses snapping instead of activating it (inverted logic in monitorShortcuts). - Zone spanning (enableZoneSpanning, default on; spanKey, default Command): hold the span key while dragging over multiple zones to accumulate them, and drop to snap the window to their bounding-box union. Implemented in Macsy.swift via spannedSectionWindows plus isSpanKeyPressed/spannedAXRect/applyZoneSpanHighlight, accumulation in onWindowMoved and union snapping in handleZoneMouseUp. (Grid layouts already span natively.) - Sticky right-click cancel: snapWithRightClick already toggled snapping mid-drag, but auto-snap re-activated it on the next mouse move. A snapSuppressedForDrag flag now keeps snapping off for the rest of the drag once cancelled, reset at drag start/end. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Owner
|
Thanks. I'll merge with next update. |
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.
This branch bundles one bug fix and three opt-in UX features. Each is in its own commit.
1. Fix crash when saving a zone layout
UserLayout.reArrange()force-unwrapped both the section number ($0.number!) and the matching section window (.first(where:)!). When section configs and live section windows fell out of sync (e.g. after adding/removing a section), the unwrap hit nil and the app crashed with SIGTRAP on Save. Made it tolerant using the same guard-let pattern already used inLayoutWindow.onSave().2. Screen-alignment buttons in the zone editor
Adds an
AlignmentPresetenum +AlignmentButton(SF Symbols) and a new row in the per-section editor. Unlike the existingPositioningPresetbuttons (which also resize), these keep the section's current size and only reposition it relative to the screen: left / center / right and top / middle / bottom. Lets you size a zone freely, then align it without changing its dimensions.3. Drag-snap UX (all toggleable in Preferences)
snapWhileDragging, default on): the layout activates automatically when a drag starts, no key required. Holding the snap key (default Shift) temporarily suppresses snapping instead of activating it.enableZoneSpanning+spanKey, default Command): hold the span key while dragging over multiple zones to accumulate them, then drop to snap the window to their bounding-box union. (Grid layouts already span natively.)snapWithRightClickalready toggled snapping mid-drag, but auto-snap re-activated it on the next mouse move. AsnapSuppressedForDragflag now keeps snapping off for the rest of the drag once cancelled.All new behavior is gated behind settings and defaults preserve a familiar experience for existing users where reasonable.
🤖 Generated with Claude Code