- You said "CurrentPoint is off by a significant amount" but your reproduction steps show off by ~1 pixel. Have you experienced errors that are larger than 1 pixel before?
- In the code you posted you have an axes directly in a uifigure. Are you using anything else in the figure, like tabs, panels, uigridlayout, etc.? Is the axes always directly in the uifigure, or is it in another container inside the uifigure?
- Any reproduction code you have, with as much detail as you can include, will be helpful.
- Are you using the "Scrollable" feature of the uifigures?
- What platform are you using? Windows? Mac? Linux?
- What is the output from rendererinfo run on your axes?
- What is your screen resolution and pixel density?
Issues with CurrentPoint in R2021b
14 views (last 30 days)
I am trying to track some user clicks within an axes that lives within a uifigure.
I was originally using CurrentPoint from the axes object, but I started to notice that in certain scenarios, the coordinates of CurrentPoint did not seem to be correct for where the mouse event happened. I did as much investigating as I could and found a possible solution in looking at the event IntersectionPoint property.
I can effectively use the IntersectionPoint property of the event for mouse down and up events and I get coordiantes that very closely match where I was trying to click.
I need something like IntersectionPoint that can be used withn mouse motion callbacks because CurrentPoint is off by a significant amount.
Here is what I have in all of my callbacks:
cp = get(obj.Axes,'CurrentPoint');
ip = evt.IntersectionPoint;
fprintf('Current Point: (%g,%g)\nIntersection Point: (%g,%g)\n\n',cp(1,1),cp(1,2),ip(1,1),ip(1,2));
Then when I execute clicks, attempting to click near (11,1200) on the axes, I get the follwing:
Current Point: (10.9365,1376.74)
Intersection Point: (10.9782,1196.9)
Benjamin Kraus on 16 Dec 2021
We've seen issues in the past with CurrentPoint being slightly off, and we are investigating them. Can you provide a little more information about your particular setup and I'll add it to our internal report about this issue? Specifically: