in SAM2-Demo/Views/ZoomableScrollView.swift [59:70]
func listen() {
NotificationCenter.default.addObserver(forName: NSScrollView.didEndLiveMagnifyNotification, object: nil, queue: nil) { notification in
let scrollView = notification.object as! NSScrollView
print("did magnify: \(scrollView.magnification), \(scrollView.documentVisibleRect)")
self.parent.visibleRect = scrollView.documentVisibleRect
}
NotificationCenter.default.addObserver(forName: NSScrollView.didEndLiveScrollNotification, object: nil, queue: nil) { notification in
let scrollView = notification.object as! NSScrollView
print("did scroll: \(scrollView.magnification), \(scrollView.documentVisibleRect)")
self.parent.visibleRect = scrollView.documentVisibleRect
}
}