I want to display the mouse position when it moves over an Axes; however, I do not want it to display while I hover over the Figure.
Currently, I use 'WindowButtonMotionFcn' to define a callback, '@MouseDisplay', that is triggered when the mouse moves over the Figure window. This callback gets the current mouse position within the Axes, and displays it. I partially solved this issue on my own by finding the pixel coordinate of the axis and using that to selectively display when inside the bounds of the Axes only, as defined by 'Position' or 'OuterPosition'. The problem is that when I zoom in to the image, the display then shows the mouse position when hovering over the Figure outside of the Axes again.
How can I make this robust to zooming?
Best Answer