coordinate system mismatch? [message #197303] |
Sat, 01 October 2005 16:57 |
Eclipse User |
|
|
|
Originally posted by: alnospammajor.noboxspamspoon.com
there appears to be some difference between the coordinate system used
by the Location/Selection request and that used to draw/find figures.
i'm using these requests to highlight mouse rollover. it's working
correctly until the first scroll. after a scroll, the feedback is being
drawn at an offset to the actual mouse location.
my guess is that the request location is relative to the control,
whereas the figure coordinates are relative to the figure canvas.
am i correct in the diagnosis of the coordinate system mismatch here?
what transformation do i apply to get them in sync? code snippet or
pointer to existing code would be most useful.
regards,
al
|
|
|
Re: coordinate system mismatch? [message #197334 is a reply to message #197303] |
Mon, 03 October 2005 08:42 |
Eclipse User |
|
|
|
Originally posted by: alnospammajor.noboxspamspoon.com
working on the assumption that the control coordinate system is the same
as the coordinate system of the root figure, i tried using
fig.translateToRelative on the Location coordinate (where fig is the
target figure). this appears to be working, and the reasoning seems correct.
if someone knows a reason why this is not the answer for the general
case, please let me know.
regards,
al
|
|
|
Re: coordinate system mismatch? [message #197388 is a reply to message #197334] |
Mon, 03 October 2005 15:29 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
"Al Major" <alnospammajor@noboxspamspoon.com> wrote in message
news:dhqqs6$o99$1@news.eclipse.org...
> working on the assumption that the control coordinate system is the same
> as the coordinate system of the root figure, i tried using
> fig.translateToRelative on the Location coordinate (where fig is the
> target figure). this appears to be working, and the reasoning seems
> correct.
>
> if someone knows a reason why this is not the answer for the general case,
> please let me know.
To find out where a canvas-relative point is relative to a figure's bounds,
do what you did.
To find out where a figure is on the canvas, do the opposite. Take a *COPY*
of its bounds, and call translateToAbsolute on the same figure.
|
|
|
Re: coordinate system mismatch? [message #197481 is a reply to message #197388] |
Mon, 03 October 2005 17:39 |
Eclipse User |
|
|
|
Originally posted by: alnospammajor.noboxspamspoon.com
>
> To find out where a canvas-relative point is relative to a figure's bounds,
> do what you did.
> To find out where a figure is on the canvas, do the opposite. Take a *COPY*
> of its bounds, and call translateToAbsolute on the same figure.
>
so "relative" means WRT the coordinate system (bounds) of the figure on
which the call is made. and "absolute" refers to the coordinate system
of the FigureCanvas (implicitly the root figure?).
that was my interpretation as well. thanks for confirming.
regards,
al
|
|
|
Powered by
FUDForum. Page generated in 0.07230 seconds