color icon cursor

This commit is contained in:
Ian Gulliver
2026-10-18 21:28:07 -07:00
parent 57788cc711
commit 2b7b940b6d
+19
View File
@@ -476,6 +476,25 @@ private final class FlowTextView: NSTextView {
return super.resignFirstResponder() return super.resignFirstResponder()
} }
override func cursorUpdate(with event: NSEvent) {
guard frontmost(event) else {
NSCursor.arrow.set()
return
}
super.cursorUpdate(with: event)
}
override func mouseMoved(with event: NSEvent) {
guard frontmost(event) else {
return
}
super.mouseMoved(with: event)
}
private func frontmost(_ event: NSEvent) -> Bool {
unsafe window?.contentView?.hitTest(event.locationInWindow)?.isDescendant(of: self) == true
}
override func mouseDown(with event: NSEvent) { override func mouseDown(with event: NSEvent) {
let onLink = link(at: convert(event.locationInWindow, from: nil)) let onLink = link(at: convert(event.locationInWindow, from: nil))
super.mouseDown(with: event) super.mouseDown(with: event)