Mouse Events and Zoomed Images
Posted by nellypledge on
URL: http://imagej.273.s1.nabble.com/Mouse-Events-and-Zoomed-Images-tp5015681.html
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