scrolling and drawing porblems
scrolling and drawing porblems
- Subject: scrolling and drawing porblems
- From: Ivan Kourtev <email@hidden>
- Date: Mon, 6 Nov 2006 18:10:51 -0500
I posted a related question some time ago but haven't been able to
find a satisfactory solution ever since. here is the problem.
I have a custom NSView within an NSScrollView and I want an object to
draw always at the same position relative to the visible rectangle
(not to the bounds). Telling where to draw this object is not a
problem (I can get the visible rectangle and so on). The problem is
that after scrolling, the argument to drawRect can be just a small
rectangle of whatever area was exposed after scrolling. I guess the
graphics buffer is reused to paint the rest of the visible rectangle
so I end up with "ghost" objects."
To make this clearer here is an example: if my special object should
always draw right above the bottom end of the visible rectangle and I
scroll down (the visible rectangle moves down), then the argument to
drawRect is just a horizontal strip along the bottom edge of the
visible rectangle. So my special object is still drawn correctly but
there is also a "ghost" of it higher up in the view (what was drawn
above the bottom edge simply got moved up before drawRect was called
as a result of scrolling).
I tried ignoring the rect argument in drawRect and working with the
visible rectangle instead but that didn't help -- I think drawing is
clipped with the argument do drawRect no matter where you draw.
If only I can somehow find out that scrolling has just occurred I
could (I think) solve this by pre-erasing the special object before
the drawRect due to scrolling is sent. Any ideas?
Thanks,
--
ivan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden