How can I get the visible frame of the NSScrollView's document view that is clipped?

StackOverflow https://stackoverflow.com/questions/20762413

  •  21-09-2022
  •  | 
  •  

سؤال

Let's say we have an image set to an NSScrollView's document view. When the image is smaller than the NSScrollView then there is no clipping (the diagram on the left).

Now say we zoom the image and it clips the scroll view (the diagram on the right). How can I get the region of the document view that is visible in the document view's coordinates?

Diagram showing the a zoomed scroll view and coordinate frame.

هل كانت مفيدة؟

المحلول

You probably want [NSScrollView documentVisibleRect]

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top