mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 15:30:39 +00:00
23 lines
589 B
Swift
23 lines
589 B
Swift
import AppKit
|
|
|
|
enum TrackingAreaSupport {
|
|
@MainActor
|
|
static func resetMouseTracking(
|
|
on view: NSView,
|
|
tracking: inout NSTrackingArea?,
|
|
owner: AnyObject)
|
|
{
|
|
if let tracking {
|
|
view.removeTrackingArea(tracking)
|
|
}
|
|
let options: NSTrackingArea.Options = [
|
|
.mouseEnteredAndExited,
|
|
.activeAlways,
|
|
.inVisibleRect,
|
|
]
|
|
let area = NSTrackingArea(rect: view.bounds, options: options, owner: owner, userInfo: nil)
|
|
view.addTrackingArea(area)
|
|
tracking = area
|
|
}
|
|
}
|