8000 Implement horizontal resizing for OnitPanel by devin-ai-integration[bot] · Pull Request #184 · synth-inc/onit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Conversation

devin-ai-integration[bot]
Copy link
Contributor

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)

Co-Authored-By: Tim Lenardo <tim.lenardo@gmail.com>
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Contributor
@greptile-apps greptile-apps bot left a 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 using ContentView.idealWidth
  • Added width persistence by updating panelWidth Default when panel is resized in ContentView
  • Missing maximum width constraint in OnitPanelState+Position.swift could lead to oversized panels
  • Potential race condition in ContentView when modifying static idealWidth 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
Copy link
Contributor

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

Comment on lines 21 to 24
DragGesture(minimumDistance: 1)
.onChanged { value in
onDrag(value.translation.width)
}
Copy link
Contributor

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.

Comment on lines 93 to 96
if let panel = state.panel {
panelWidth = panel.frame.width
ContentView.idealWidth = panel.frame.width
}
Copy link
Contributor

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

devin-ai-integration bot and others added 12 commits April 29, 2025 19:52
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>
< 8000 div class="commit-build-statuses">
@timlenardo
Copy link
Contributor

@Niduank - this one is ready to be reviewed now. Here's a demo:

horizontal_resizing_trimmed.mov

Basically, 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.

Copy link
Collaborator
@Niduank Niduank May 8, 2025

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"

@Niduank
Copy link
Collaborator
Niduank commented May 8, 2025

⚠️ ⚠️ ⚠️
Greptile is right — ContentView.idealWidth is static, which means that if we change the size of one panel, it will asynchronously affect the size of other panels (when some calculation relies on it).

Now that the width can change, it should live inside OnitPanelState.
Classes using it should observe changes to its value in order to trigger any necessary updates.

…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
Copy link
Collaborator

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
Copy link
Collaborator

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

@timlenardo timlenardo force-pushed the devin/1745956085-horizontal-panel-resizing branch from 8533175 to 006c4b9 Compare May 8, 2025 21:42
@timlenardo
Copy link
Contributor

(aside) Devin didn't get this right, so I removed his (her?) last two commits and am adding my own.

@timlenardo timlenardo merged commit 40b6316 into feature/no-accessibility-access May 8, 2025
@timlenardo timlenardo deleted the devin/1745956085-horizontal-panel-resizing branch May 9, 2025 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0