How to maintain the scroll position in NSScrollView when changing scale?
问题 I've got an NSView (myView) wrapped in an NSScrollView (myScrollView). Using zoom-in/out buttons, the user can alter the scale of myView. If the user is currently scrolled to a particular spot in myView, I'd like to keep that part of the view on-screen after the zooming has taken place. I've got code that looks like this: // preserve current position in scrollview NSRect oldVisibleRect = [[myScrollView contentView] documentVisibleRect]; NSPoint oldCenter = NSPointFromCGPoint(CGPointMake