fixes cursor

This commit is contained in:
2026-10-05 10:32:09 +02:00
parent 336987d821
commit 201c59c659
12 changed files with 460 additions and 46 deletions
+10 -2
View File
@@ -54,7 +54,7 @@ private struct SplitterHandle: NSViewRepresentable {
}
}
final class SplitterHandleView: NSView {
final class SplitterHandleView: NSView, PointerOwner {
var axis: Axis = .vertical {
didSet { if axis != oldValue { window?.invalidateCursorRects(for: self) } }
}
@@ -86,6 +86,10 @@ final class SplitterHandleView: NSView {
cursor.set()
}
func updatePointer(atWindowPoint point: NSPoint) {
cursor.set()
}
override func mouseEntered(with event: NSEvent) {
onHover(true)
cursor.set()
@@ -117,8 +121,12 @@ final class SplitterHandleView: NSView {
override func mouseUp(with event: NSEvent) {
guard dragStart != nil else { return }
let inside = bounds.contains(convert(event.locationInWindow, from: nil))
(inside ? cursor : NSCursor.arrow).set()
endDrag()
if inside {
cursor.set()
} else if let window {
PointerPolicy.updateCursor(in: window)
}
onHover(inside)
onEnd()
}