mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
macos: use pointerStyle for SplitView Divider
This commit is contained in:
@ -33,9 +33,9 @@ extension Backport where Content: View {
|
||||
}
|
||||
}
|
||||
|
||||
func pointerStyle(_ style: BackportPointerStyle) -> some View {
|
||||
func pointerStyle(_ style: BackportPointerStyle?) -> some View {
|
||||
if #available(macOS 15, *) {
|
||||
return content.pointerStyle(style.official)
|
||||
return content.pointerStyle(style?.official)
|
||||
} else {
|
||||
return content
|
||||
}
|
||||
|
@ -44,15 +44,30 @@ extension SplitView {
|
||||
}
|
||||
}
|
||||
|
||||
private var pointerStyle: BackportPointerStyle {
|
||||
return switch (direction) {
|
||||
case .horizontal: .resizeLeftRight
|
||||
case .vertical: .resizeUpDown
|
||||
}
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
Color.clear
|
||||
.frame(width: invisibleWidth, height: invisibleHeight)
|
||||
.contentShape(Rectangle()) // Makes it hit testable for pointerStyle
|
||||
Rectangle()
|
||||
.fill(color)
|
||||
.frame(width: visibleWidth, height: visibleHeight)
|
||||
}
|
||||
.backport.pointerStyle(pointerStyle)
|
||||
.onHover { isHovered in
|
||||
// macOS 15+ we use the pointerStyle helper which is much less
|
||||
// error-prone versus manual NSCursor push/pop
|
||||
if #available(macOS 15, *) {
|
||||
return
|
||||
}
|
||||
|
||||
if (isHovered) {
|
||||
switch (direction) {
|
||||
case .horizontal:
|
||||
|
Reference in New Issue
Block a user