Re: scroll bars and visible rect
Re: scroll bars and visible rect
- Subject: Re: scroll bars and visible rect
- From: Andy Lee <email@hidden>
- Date: Fri, 04 Jan 2013 18:08:34 -0800
On Jan 4, 2013, at 4:04 PM, Graham Cox <email@hidden> wrote:
>
> On 05/01/2013, at 12:28 AM, koko <email@hidden> wrote:
>
>> Thanks, Graham.
>>
>> I have no control over "Basing the size of some content on the visible rect sounds like a bad idea" as that is what the boss wants.
>>
>> FYI, our model defines a bitmap of content and we use the visible rect to clip this content.
>
>
> Well, that's what NSScrollView does, without any intervention on your part. It really sounds as if you are either misunderstanding how the view works and doing unnecessary work, or deliberately abusing it. I'm not sure which.
I'm still confused whether the question has anything to do with layers. As others have pointed out, koko quotes documentation for CAScrollLayer's visibleRect method rather than NSView's. But from the initial wording I *thought* it was about the visibleRect of the documentView of an NSScrollView, i.e., [[myScrollView documentView] visibleRect]. If this is correct (and it should be trivial to clarify), then...
The Scroll View Programming Guide explains the view hierarchy under a scroll view:
<https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/NSScrollViewGuide/Articles/Introduction.html>
Basically it's:
* scroll view
* vertical scroll bar (possibly hidden)
* horizontal scroll bar (possibly hidden)
* content view (an NSClipView, given by [myScrollView contentView])
* document view (your view, given by [myScrollView documentView])
None of the scroll view's subviews overlap.
At the same time, the documentation for NSView's visibleRect says:
> Returns the portion of the receiver not clipped by its superviews.
>
> - (NSRect)visibleRect
> Return Value
>
> A rectangle defining the unclipped portion of the receiver.
>
> Discussion
>
> Visibility for this method is defined quite simply and doesn’t account for whether other NSView objects (or windows) overlap the receiver or whether the receiver has a window at all. This method returns NSZeroRectif the receiver is effectively hidden.
>
> During a printing operation the visible rectangle is further clipped to the page being imaged.
Put this all together and clearly the document view's visibleRect does not include any of the area occupied by the scroll bars.
But maybe I am answering the wrong question, in which case... never mind.
--Andy
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden