-
Notifications
You must be signed in to change notification settings - Fork 26
Implement horizontal resizing for OnitPanel #184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement horizontal resizing for OnitPanel #184
Conversation
Co-Authored-By: Tim Lenardo <tim.lenardo@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
Implemented horizontal resizing functionality for the OnitPanel through a new ResizeHandle component and dynamic width management system, allowing users to adjust panel width while maintaining proper tethering behavior.
- Added new
ResizeHandle
component in/macos/Onit/UI/Components/ResizeHandle.swift
with drag gesture support - Changed
minOnitWidth
in TetherAppsManager from constant to computed property usingContentView.idealWidth
- Added width persistence by updating
panelWidth
Default when panel is resized inContentView
- Missing maximum width constraint in
OnitPanelState+Position.swift
could lead to oversized panels - Potential race condition in
ContentView
when modifying staticidealWidth
with multiple panels open
💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!
5 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile
@@ -16,7 +16,7 @@ struct ContentView: View { | |||
@ObservedObject private var accessibilityPermissionManager = AccessibilityPermissionManager.shared | |||
@Default(.showOnboarding) var showOnboarding | |||
|
|||
static let idealWidth: CGFloat = 400 | |||
static var idealWidth: CGFloat = 400 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Using a static mutable property for idealWidth could cause race conditions if multiple panels are resized simultaneously
DragGesture(minimumDistance: 1) | ||
.onChanged { value in | ||
onDrag(value.translation.width) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: DragGesture needs .onEnded to handle drag completion. Without it, rapid drag gestures could cause jittery behavior.
if let panel = state.panel { | ||
panelWidth = panel.frame.width | ||
ContentView.idealWidth = panel.frame.width | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: No width validation or bounds checking before updating panelWidth and idealWidth. Should enforce minimum/maximum constraints
Co-Authored-By: Tim Lenardo <tim.lenardo@gmail.com>
Co-Authored-By: Tim Lenardo <tim.lenardo@gmail.com>
Co-Authored-By: Tim Lenardo <tim.lenardo@gmail.com>
Co-Authored-By: Tim Lenardo <tim.lenardo@gmail.com>
Co-Authored-By: Tim Lenardo <tim.lenardo@gmail.com>
Co-Authored-By: Tim Lenardo <tim.lenardo@gmail.com>
Co-Authored-By: Tim Lenardo <tim.lenardo@gmail.com>
@Niduank - this one is ready to be reviewed now. Here's a demo: horizontal_resizing_trimmed.movBasically, we add a ResizeHandle element in the bottom left corner, and override the "mouseDownCanMoveWindow()' function in it, to prevent mouseDown events there from moving the window. I want to make sure this gets in before you implement Pinned mode! I think people will want to be able to resize when we're in Pinned mode. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@timlenardo Don't forget to check "Preserve vector data"
Now that the width can change, it should live inside OnitPanelState. |
…elWidth to prevent race conditions Co-Authored-By: Tim Lenardo <tim.lenardo@gmail.com>
@@ -34,7 +34,7 @@ class TetherAppsManager: ObservableObject { | |||
private var skipFirstRegularAppUpdate: Bool = true | |||
|
|||
static var minOnitWidth: CGFloat { | |||
return ContentView.idealWidth | |||
return shared.defaultState.panelWidth |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1/ We should remove the TetherAppsManager.minOnitWidth
2/ We should never use the TetherAppsManager.shared.defaultState
but TetherAppsManager.shared.state
@@ -27,7 +27,7 @@ class UntetheredScreenManager: ObservableObject { | |||
private let defaultState = OnitPanelState(trackedScreen: nil) | |||
|
|||
static var minOnitWidth: CGFloat { | |||
return ContentView.idealWidth | |||
return defaultState.panelWidth |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1/ We should remove the UntetheredScreenManager.minOnitWidth
2/ We should never use the UntetheredScreenManager.shared.defaultState
but
UntetheredScreenManager.shared.state
8533175
to
006c4b9
Compare
(aside) Devin didn't get this right, so I removed his (her?) last two commits and am adding my own. |
…horizontal-panel-resizing
Implement horizontal resizing for OnitPanel
Added horizontal resizing functionality for the OnitPanel with a resize handle on the bottom left corner. Panel width is dynamically updated and stored in Defaults. Tethered elements are properly repositioned during resize operations.
Link to Devin run: https://app.devin.ai/sessions/ed307234bdff483aba82dce222010597
User: Tim Lenardo (tim.lenardo@gmail.com)