Repository navigation
Fix minimal tab drag edge hit testing #126
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
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 | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1264,6 +1264,28 @@ final class BonsplitTests: XCTestCase { | |||||||||||||||||||||||
| XCTAssertLessThan(hoverAlpha, 0.12) | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| func testSharedBackdropActiveTabBackgroundIsClear() { | ||||||||||||||||||||||||
| let appearance = BonsplitConfiguration.Appearance( | ||||||||||||||||||||||||
| chromeColors: .init( | ||||||||||||||||||||||||
| backgroundHex: "#272822", | ||||||||||||||||||||||||
| tabBarBackgroundHex: "#00000000", | ||||||||||||||||||||||||
| splitButtonBackdropHex: "#00000000", | ||||||||||||||||||||||||
| paneBackgroundHex: "#00000000" | ||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||
| usesSharedBackdrop: true | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
| let active = NSColor(TabBarColors.activeTabBackground(for: appearance)).usingColorSpace(.sRGB)! | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| var alpha: CGFloat = 1 | ||||||||||||||||||||||||
| active.getRed(nil, green: nil, blue: nil, alpha: &alpha) | ||||||||||||||||||||||||
|
Comment on lines
+1277
to
+1280
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.
Suggested change
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| XCTAssertLessThan( | ||||||||||||||||||||||||
| alpha, | ||||||||||||||||||||||||
| 0.01, | ||||||||||||||||||||||||
| "Shared-backdrop selected tabs should rely on the active indicator instead of a hover-like fill" | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| func testSplitActionPressedStateUsesHigherContrast() { | ||||||||||||||||||||||||
| let appearance = BonsplitConfiguration.Appearance( | ||||||||||||||||||||||||
| chromeColors: .init(backgroundHex: "#272822") | ||||||||||||||||||||||||
|
|
@@ -1714,6 +1736,15 @@ final class BonsplitTests: XCTestCase { | |||||||||||||||||||||||
| "A short-titled tab must own the full configured visible tab width so minimal-mode drags do not become window drags" | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| let topEdgeTabPoint = hostingView.convert( | ||||||||||||||||||||||||
| NSPoint(x: appearance.tabMinWidth - 20, y: appearance.tabBarHeight + 3), | ||||||||||||||||||||||||
| to: nil | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
| XCTAssertTrue( | ||||||||||||||||||||||||
| BonsplitTabItemHitRegionRegistry.containsWindowPoint(topEdgeTabPoint, in: window), | ||||||||||||||||||||||||
| "A tab's horizontal lane must own near-titlebar-edge drags so minimal-mode top-edge tab drags do not become window drags" | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| let emptyChromePoint = hostingView.convert( | ||||||||||||||||||||||||
| NSPoint(x: appearance.tabMinWidth + 30, y: verticalCenter), | ||||||||||||||||||||||||
| to: nil | ||||||||||||||||||||||||
|
|
@@ -1722,6 +1753,15 @@ final class BonsplitTests: XCTestCase { | |||||||||||||||||||||||
| BonsplitTabItemHitRegionRegistry.containsWindowPoint(emptyChromePoint, in: window), | ||||||||||||||||||||||||
| "Empty tab-strip chrome after the configured tab remains available for app-window dragging" | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| let topEdgeEmptyChromePoint = hostingView.convert( | ||||||||||||||||||||||||
| NSPoint(x: appearance.tabMinWidth + 30, y: appearance.tabBarHeight + 3), | ||||||||||||||||||||||||
| to: nil | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
| XCTAssertFalse( | ||||||||||||||||||||||||
| BonsplitTabItemHitRegionRegistry.containsWindowPoint(topEdgeEmptyChromePoint, in: window), | ||||||||||||||||||||||||
| "Near-titlebar-edge empty chrome after the tab should remain available for app-window dragging" | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| @MainActor | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
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.
bounds.insetBy(dx: 0, dy: -verticalSlop)expands the accepted y-range byverticalSlop(6 pt) on both the top edge (toward the titlebar — the intended fix) and the bottom edge (toward app content). Any point within a tab's x-lane that lies up to 6 pt below the tab bar's bottom edge will be claimed as a tab hit. The old per-tabinsetBy(dx: -2, dy: -2)also over-extended downward, but only by 2 pt. The new code triples that slop, andshouldCaptureHitonly guards this withbounds.contains(point)on the drag-zone view, so if that view's bounds extend past the tab bar's visual bottom (e.g. it fills the full content view), the downward expansion starts suppressing window-drag events for touches in the app content area. The test only verifies the upward direction.