Repository navigation
Fix browser webview divider resizing #7038
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
Changes from all commits
5f0eb00
474e7ad
2429ba8
807e40c
55c78ab
1d001a3
f87f8e6
c3ea0b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6486,6 +6486,12 @@ struct WebViewRepresentable: NSViewRepresentable { | |
| if passThrough { | ||
| #if DEBUG | ||
| debugLogHitTest(stage: "hitTest.pass", point: point, passThrough: true, hitView: nil) | ||
| #endif | ||
| return nil | ||
| } | ||
| if shouldPassThroughToExternalSplitDivider(at: point, hostedInspectorHit: hostedInspectorHit) { | ||
| #if DEBUG | ||
| debugLogHitTest(stage: "hitTest.splitPass", point: point, passThrough: true, hitView: nil) | ||
| #endif | ||
| return nil | ||
| } | ||
|
|
@@ -6646,6 +6652,60 @@ struct WebViewRepresentable: NSViewRepresentable { | |
| return contentView.bounds.maxX - hostRectInContent.maxX > 24 | ||
| } | ||
|
|
||
| private func shouldPassThroughToExternalSplitDivider( | ||
| at point: NSPoint, | ||
| hostedInspectorHit: HostedInspectorDividerHit? = nil | ||
| ) -> Bool { | ||
| guard hostedInspectorHit == nil else { return false } | ||
| guard isNearPaneEdge(point) else { return false } | ||
| guard window != nil else { return false } | ||
|
|
||
| let windowPoint = convert(point, to: nil) | ||
| var ancestor = superview | ||
| while let currentAncestor = ancestor { | ||
| if let splitView = currentAncestor as? NSSplitView, | ||
| let arrangedIndex = splitView.arrangedSubviews.firstIndex(where: { arrangedSubview in | ||
| self === arrangedSubview || self.isDescendant(of: arrangedSubview) | ||
| }) { | ||
| if externalSplitDividerHit(at: windowPoint, in: splitView, dividerIndex: arrangedIndex - 1) { | ||
| return true | ||
| } | ||
| if externalSplitDividerHit(at: windowPoint, in: splitView, dividerIndex: arrangedIndex) { | ||
| return true | ||
| } | ||
| } | ||
| ancestor = currentAncestor.superview | ||
| } | ||
| return false | ||
| } | ||
|
|
||
| private func externalSplitDividerHit( | ||
| at windowPoint: NSPoint, | ||
| in splitView: NSSplitView, | ||
| dividerIndex: Int | ||
| ) -> Bool { | ||
| guard let window, | ||
| splitView.window === window, | ||
| let hitRect = PortalSplitDividerRegion.dividerHitRectInWindow( | ||
| in: splitView, | ||
| dividerIndex: dividerIndex | ||
| ) else { | ||
| return false | ||
| } | ||
| return hitRect.contains(windowPoint) | ||
| } | ||
|
|
||
| private func isNearPaneEdge(_ point: NSPoint) -> Bool { | ||
| // hitTest and cursor tracking call this with points in this view's bounds coordinates. | ||
| guard bounds.contains(point) else { return false } | ||
| let expansion = PortalSplitDividerRegion.dividerHitExpansion | ||
| let nearVerticalEdge = point.x <= bounds.minX + expansion || | ||
| point.x >= bounds.maxX - expansion | ||
| let nearHorizontalEdge = point.y <= bounds.minY + expansion || | ||
| point.y >= bounds.maxY - expansion | ||
| return nearVerticalEdge || nearHorizontalEdge | ||
| } | ||
|
Comment on lines
+6698
to
+6707
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Consider converting the point to local coordinates first (
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in f87f8e6: now documents and guards the local-bounds coordinate invariant, and mirrors the external split-divider pass-through path with so the underlying split cursor can take over. — Claude Code
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correction to the previous reply: addressed in f87f8e6. isNearPaneEdge now documents and guards the local-bounds coordinate invariant, and updateDividerCursor mirrors the external split-divider pass-through path with restoreArrow false so the underlying split cursor can take over. — Claude Code |
||
|
|
||
| private func updateDividerCursor( | ||
| at point: NSPoint, | ||
| hostedInspectorHit: HostedInspectorDividerHit? = nil | ||
|
|
@@ -6655,6 +6715,10 @@ struct WebViewRepresentable: NSViewRepresentable { | |
| clearActiveDividerCursor(restoreArrow: false) | ||
| return | ||
| } | ||
| if shouldPassThroughToExternalSplitDivider(at: point, hostedInspectorHit: resolvedHostedInspectorHit) { | ||
| clearActiveDividerCursor(restoreArrow: false) | ||
| return | ||
| } | ||
| guard resolvedHostedInspectorHit != nil else { | ||
| clearActiveDividerCursor(restoreArrow: true) | ||
| return | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.