Re: Mouse Events and Zoomed Images

Posted by John Hayes on
URL: http://imagej.273.s1.nabble.com/Mouse-Events-and-Zoomed-Images-tp5015681p5015684.html

Hi Neil,

If you just want coordinates of the mouse wrt the window, I believe you
would need to add your listeners to the ImageWindow. That class should also
contain the ImageCanvas offset, but I don't have the source code or API in
front of me right now.

HTH,

John
On Feb 20, 2016 3:36 PM, "nellypledge" <[hidden email]> wrote:

> Hi all, I hope the data treats you well.
>
> I'm looking to use a mouse wheel event on an image even if it's been
> zoomed.
> I have everything in place for the image at the default zoom, but if I zoom
> the getX and getY locations from my mouse event are offset from the point
> on
> the image I need.  I can get the scale difference from the Dimensions of
> the
> ImagePlus and the Canvas respectively to get the ratio.  The trouble comes
> when the image is zoomed to the point where only a section shows in the
> frame and if I pan around I still get the same X and Y.  This is expected
> as
> I've added the added the mouseWheelListener to the Canvas, and I'm
> wondering
> if there's a way to get the info of the offset so I can adjust, or if
> there's a way to get the physical units location from the mouse wheel event
> location.
>
> Or, in retrospect, should I add the mouseWheelListener to a different
> object?
>
> My class implements MouseListener and MouseWheelListener.  In my
> mouseWheelMoved method I use the MouseWheelEvent getX() and getY().
>
> Thanks in advance for your time thinking on this question.
>
> Neil
>
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/Mouse-Events-and-Zoomed-Images-tp5015681.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html