Re: setting the bounds
Re: setting the bounds
- Subject: Re: setting the bounds
- From: email@hidden
- Date: Sun, 8 Jun 2003 23:25:45 -0400
Each time drawRect: is called, the coordinate system needs to be
translated by a certain amount. Using affine transforms is not an
option, so I have been moving the bounds rect to achieve this:
[self translateOriginToPoint: NSMakePoint(-changeX,
-changeY)];
This, unfortunately, sometimes causes a flickering effect when in
drawRect:, which I believe is due to calculations already made with the
old bounds. This code works when outside of the drawing mechanism, but
it is difficult to place the code so that it will take effect before
drawing each time (the best I have done is to place it after drawing in
which case there is noticeable inaccuracy):
- (void)unlockFocus
{
[super unlockFocus];
[self translateOriginToPoint: NSMakePoint(-changeX,
-changeY)];
}
It would be nice if there were a "willDisplay" notification. Thanks for
the help.
On Sunday, Jun 8, 2003, at 23:08 America/New_York, John C. Randolph
wrote:
>
>
On Sunday, June 8, 2003, at 07:17 PM, email@hidden wrote:
>
>
> I overrode lockFocus: but the problem still occurred.
>
>
>
> It was only after I overrode unlockFocus: that the problem was fixed.
>
>
>
> This is still not good, because the change needs to be current.
>
>
>
> On Sunday, Jun 8, 2003, at 20:21 America/New_York,
>
> email@hidden wrote:
>
>
>
>> It appears that setting the bounds in NSView's drawRect: can cause
>
>> problems. How can I set the bounds each time before that method is
>
>> called? I have tried overriding methods, but there seems to be
>
>> private API in the works. Thanks.
>
>
Ling,
>
>
You're really not giving us enough information to be able to help you.
>
>
What are you trying to do, and why do you want to change the bounds
>
every time you draw the view?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.