MATLAB Answers

0

Get CurrentPoint gives me wrong values after deploying as web app

Asked by Guojin Feng on 14 May 2019
I am using appdesigner to develop an application. In the app, I have an axes that plots one image. Once the user clicks the image, it triggers a callback function, as shown below.
him = imagesc(wafermap, 'parent', app.Ax1);
him.ButtonDownFcn = @app.imClicked;
Inside, the callback function, I want to get the X and Y position of the click for some further processing. For convinience, I have output the value to a label.
The codes to get the click position is shown below.
cpt = get(app.Ax1, 'CurrentPointGet ');
pt = cpt(1, 1:2);
x = round(pt(1));
y = round(pt(2));
app.StatusOutput.Text = sprintf('Row: %d, Column: %d', y, x);
The app works very well on my desktop. The problem comes when being deployed as a web app. The returned x and y values can be 0 or minus sometimes. After palying with the web app for a while, I find that the returned x and y values can change when I change the size of the browser. When I use the maximize button on the bottom left corner, the x values are correct while the y value is always minus 1 from the expected value, that's showing 0 if it is actually 1.
By the way, I am using Matlab 2019a on Windows 10 64bit system.
Any thoughts on how to sort out the problem or any workaround?
Thanks a lot.

  0 Comments

Sign in to comment.

0 Answers