App Developer - Mouse Hovering Over Surf Plot in UIAxes Causes Extreme Lag

I have constructed a sub-app which is called from within a main app. Within this sub-app I have 3 UIAxes, each of which may be toggled between showing an image, with imagesc(), and showing the surface plot of that image, with surf().
This set-up works well, until I switch any of the axes to the surface plot and hover the mouse over the axis, at which point a significant lag (10-15 seconds?) occurs. This lag does not occur when I hover the mouse over the imagesc plot.
I have tried disabling interactivity with these axes, changing the way in which the surface plots are shaded, and changing the UIAxes to regular axes - none of these attempts worked.
Any advice would be hugely appreciated!

7 commentaires

Could you describe this lag? The lag is between what?--moving the mouse and the cursor moving?
Scott Young
Scott Young le 23 Sep 2022
Modifié(e) : Scott Young le 23 Sep 2022
I have a pair of sliders which control the contrast levels (CLim) of the imagesc and the z-limit of the surface plots. When only imagesc are selected, hovering over the axes and then immediately changing these sliders can be done with next to no lag, but when any of the axes display surface plots and the mouse of hovered over these, there is a 10ish second delay before the sliders can be moved again.
If you load the surface plots and do not hover your mouse of the surface axes, is there a lag?
No - the lag only occurs after I move the mouse over a surface plot
After hovering the mouse over the surface plot, are there other lags within the app or within matlab othe than the slider? For example, can you execute something quickly in matlab's command window after hovering? Or can you do other things within your app after hovering? Or is the problem only with the slider that controls clim?
Have tested your questions, and can report the following:
After hovering over the surface plot, while it is still lagging I am able to go to the matlab console and quickly perform a calculation: the lag does not ffect the Command Window within MATLAB.
However, after hovering over the surface plot and attempting to push one of the buttons within the same sub-app, the button does not become pressed until after the lag has finished.
It would seem that the lag caused by hovering the mouse over the surface plot affects the entire sub-app, but only the sub-app, as even within the main app I am still able to push buttons while the lag is occuring.
It sounds like a callback or listener is responding to the mouse event. I can't dig deeper without looking at the app and I don't have much time now to do so.

Connectez-vous pour commenter.

 Réponse acceptée

Mouse over the plot will not affect the performance of the plot if you disable interactions.
Try this at the startup of your sub-app...
disableDefaultInteractivity(app.UIAxes1)
disableDefaultInteractivity(app.UIAxes2)
disableDefaultInteractivity(app.UIAxes3)
hold(app.UIAxes1, 'on')
hold(app.UIAxes2, 'on')
hold(app.UIAxes3, 'on')

2 commentaires

Thanks for the suggestion: I already has disableDefaultInteractivity engaged on all the axes, but I didn't "hold" them on - doing so maybe cut a second or two off the lag, but it is still very significant (at least 5 seconds).
I'd be happy to share screen shots or videos of the issue if it werent' for the fact it's propriety work for my compnay. I'm starting to think this is an unavoidable issue around using surface plots with large (2048x2048) images, but it still confuses me why the contrast sliders work perfectly with no lag so long as I don't hover the mouse over the plots...
CORRECTION! I'm happy and relived to say this solution is now working - it turns out I had a few helper funtions that reset the axes each time they were called, and as such disabled the disableDefaultInteractivity property - this has now been resolved, and it is working lag-free!
Thank you all for your help! :)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Centre d'aide et File Exchange

Produits

Version

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by