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, *) {
|
if #available(macOS 15, *) {
|
||||||
return content.pointerStyle(style.official)
|
return content.pointerStyle(style?.official)
|
||||||
} else {
|
} else {
|
||||||
return content
|
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 {
|
var body: some View {
|
||||||
ZStack {
|
ZStack {
|
||||||
Color.clear
|
Color.clear
|
||||||
.frame(width: invisibleWidth, height: invisibleHeight)
|
.frame(width: invisibleWidth, height: invisibleHeight)
|
||||||
|
.contentShape(Rectangle()) // Makes it hit testable for pointerStyle
|
||||||
Rectangle()
|
Rectangle()
|
||||||
.fill(color)
|
.fill(color)
|
||||||
.frame(width: visibleWidth, height: visibleHeight)
|
.frame(width: visibleWidth, height: visibleHeight)
|
||||||
}
|
}
|
||||||
|
.backport.pointerStyle(pointerStyle)
|
||||||
.onHover { isHovered in
|
.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) {
|
if (isHovered) {
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case .horizontal:
|
case .horizontal:
|
||||||
|
Reference in New Issue
Block a user