gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: -draggedImageLocation giving incorrect results?


From: Fred Kiefer
Subject: Re: -draggedImageLocation giving incorrect results?
Date: Thu, 26 Apr 2007 15:26:06 +0200
User-agent: Thunderbird 1.5.0.10 (X11/20060911)

Michael Gardner wrote:
> I've got some code in an NSImageView subclass that looks like this:
> 
> -(void) mouseDown: (NSEvent*)event
> {
>        ...
>        [self dragImage: [self image] at: NSZeroPoint offset:
> NSZeroSize event: event pasteboard: pboard source: self slideBack:
> YES];
>        ...
> }
> 
> and in the dragging destination, I position the dropped object at
> [sender draggedImageLocation]. This worked in the latest release
> version of GNUstep, but in trunk the value that I get from
> -draggedImageLocation is offset by 1 pixel horizontally and 9 pixels
> vertically from where it should be. I believe those dimensions are
> exactly the width and height of the decorations on the left and bottom
> edges of the enclosing window, respectively.
> 

I am not sure here, but to me it looks like the problem stems from the
fact that your code relies on NSZeroPoint being the origin of the
window. But when calling this method on the view the handed in point
will first be translated to window coordinates which may take the window
border into account, depending on whether GNUstep is handling it or not.
You could easily work around this by calling the same method on _window
instead of self.

Cheers,
Fred




reply via email to

[Prev in Thread] Current Thread [Next in Thread]