@@ -579,35 +579,16 @@ struct NavHeader: View {
579579
580580// MARK: - Hover Modifiers
581581
582- /// NSViewRepresentable that uses addCursorRect to reliably set
583- /// the pointing hand cursor. This is the proper AppKit mechanism
584- /// and won't fight with SwiftUI's internal cursor management.
585- struct PointingHandCursor : NSViewRepresentable {
586- func makeNSView( context: Context ) -> NSView {
587- let view = CursorView ( )
588- view. wantsLayer = true
589- return view
590- }
591-
592- func updateNSView( _ nsView: NSView , context: Context ) {
593- nsView. window? . invalidateCursorRects ( for: nsView)
594- }
595-
596- private class CursorView : NSView {
597- override func hitTest( _ point: NSPoint ) -> NSView ? {
598- return nil // Let clicks pass through to the SwiftUI button underneath
599- }
600-
601- override func resetCursorRects( ) {
602- addCursorRect ( bounds, cursor: . pointingHand)
603- }
604- }
605- }
606-
607582extension View {
608- /// Shows pointing hand cursor via AppKit cursor rects (reliable) .
583+ /// Shows pointing hand cursor on hover .
609584 func pointerOnHover( ) -> some View {
610- self . overlay ( PointingHandCursor ( ) )
585+ self . onHover { inside in
586+ if inside {
587+ NSCursor . pointingHand. set ( )
588+ } else {
589+ NSCursor . arrow. set ( )
590+ }
591+ }
611592 }
612593
613594 /// Shows pointing hand cursor + subtle background highlight on hover.
@@ -626,9 +607,13 @@ private struct HoverHighlightModifier: ViewModifier {
626607 . fill ( isHovered ? Color . primary. opacity ( 0.06 ) : Color . clear)
627608 . padding ( . horizontal, 4 )
628609 )
629- . overlay ( PointingHandCursor ( ) )
630610 . onHover { hovering in
631611 isHovered = hovering
612+ if hovering {
613+ NSCursor . pointingHand. set ( )
614+ } else {
615+ NSCursor . arrow. set ( )
616+ }
632617 }
633618 }
634619}
0 commit comments