fix(mac): use pointing hand cursor on tool links
parent
ceb0a8b3e3
commit
990fafa988
|
|
@ -0,0 +1,31 @@
|
||||||
|
import AppKit
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
private struct PointingHandCursorModifier: ViewModifier {
|
||||||
|
@State private var isHovering = false
|
||||||
|
|
||||||
|
func body(content: Content) -> some View {
|
||||||
|
content
|
||||||
|
.onHover { hovering in
|
||||||
|
guard hovering != self.isHovering else { return }
|
||||||
|
self.isHovering = hovering
|
||||||
|
if hovering {
|
||||||
|
NSCursor.pointingHand.push()
|
||||||
|
} else {
|
||||||
|
NSCursor.pop()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.onDisappear {
|
||||||
|
guard self.isHovering else { return }
|
||||||
|
self.isHovering = false
|
||||||
|
NSCursor.pop()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension View {
|
||||||
|
func pointingHandCursor() -> some View {
|
||||||
|
self.modifier(PointingHandCursorModifier())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -295,6 +295,7 @@ private struct ToolRow: View {
|
||||||
}
|
}
|
||||||
.foregroundColor(.accentColor)
|
.foregroundColor(.accentColor)
|
||||||
.onHover { self.linkHovering = $0 }
|
.onHover { self.linkHovering = $0 }
|
||||||
|
.pointingHandCursor()
|
||||||
Text(self.tool.description)
|
Text(self.tool.description)
|
||||||
.font(.subheadline)
|
.font(.subheadline)
|
||||||
.foregroundStyle(.secondary)
|
.foregroundStyle(.secondary)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue