Improve loads of fancy things in relation to the mouse pointer

This commit is contained in:
2026-10-07 13:02:52 +02:00
parent ed5a227c9d
commit a0b3ef9975
25 changed files with 334 additions and 89 deletions
@@ -93,10 +93,13 @@ extension NSView {
hitView(atWindowPoint: point)?.isDescendant(of: self) ?? false
}
/// The visible rect minus the enclosing scroll view's scrollers, which keep the arrow.
/// The visible rect minus the enclosing scroll view's scrollers and line-number ruler, which keep the arrow.
/// The clip view runs under a visible ruler, so the visible rect alone would give the gutter the I-beam.
var visibleRectWithoutScrollers: NSRect {
let scrollers = [enclosingScrollView?.verticalScroller, enclosingScrollView?.horizontalScroller]
return scrollers.compactMap { $0 }.filter { !$0.isHidden && $0.superview != nil }
let scroll = enclosingScrollView
let ruler: NSView? = scroll?.rulersVisible == true ? scroll?.verticalRulerView : nil
let strips: [NSView?] = [scroll?.verticalScroller, scroll?.horizontalScroller, ruler]
return strips.compactMap { $0 }.filter { !$0.isHidden && $0.superview != nil }
.reduce(visibleRect) { $0.removing(convert($1.bounds, from: $1)) }
}
}