What causes UIAxes gesture interactions to become disabled?

2 Ansichten (letzte 30 Tage)
Thomas Watson
Thomas Watson am 9 Jun. 2023
Beantwortet: Rohit Kulkarni am 14 Aug. 2023
(1) https://www.mathworks.com/help/matlab/creating_plots/control-axes-interactions.html
When creating a uifigure-based uiaxes object, you automatically get to use the built-in interaction "gestures" such as panning/zooming without needing to enable any of the interactive modes from the toolbar.
You can toggle this behavior with enableDefaultInteractivity / disableDefaultInteractivity, which under the hood modify UIAxes.InteractionContainer.Enabled (a dependent property).
I am refactoring an existing application to try to use these gesture interactions.
The problem is that something is causing the gestures to become irreversibly disabled for all of the UIAxes on my uifigure, as in enableDefaultInteractivity() does not restore the gestures and the UIAxes.InteractionContainer.Enabled property remains off due to circumstances/code that I cannot see since Mathworks has chosen to P-code everything.
The only clue we're given is that "Sometimes MATLAB® automatically disables the built-in interactions. For example, they might be disabled for charts that have special features, or when you implement certain callbacks such as a WindowScrollWheelFcn callback." (1)
I have made sure nothing in my code sets WindowButtonDownFcn / WindowButtonMotionFcn / WindowButtonUpFcn / WindowKeyPressFcn / WindowKeyReleaseFcn / WindowScrollWheelFcn to eliminate that as a potential cause, but the gestures are still disiabled.
Without actual elaboration from Mathworks or other users' findings, I am unable to determine what else might be causing the gestures to become irreversably disabled.
Any help would be greatly appreciated.

Antworten (1)

Rohit Kulkarni
Rohit Kulkarni am 14 Aug. 2023
Hi,
In my understanding from the information that was provided by you, here are two possible workarounds:
1) Enable the interactions via the axes toolbar ("axtoolbar"), which is available in R2018b and later. The interactions can be enabled by clicking the desired control in the toolbar.
2) Alternatively, enable the specific interaction programmatically, as exemplified below:
%enable pan
pan(ax2, 'on');
%enable rotate
rotate3d(ax2, 'on');
% enable zoom
zoom(ax2, 'on');
Note: This method only allows one interaction (pan, zoom, rotate, etc.) to be enabled at a time.
Thanks

Kategorien

Mehr zu Visual Exploration finden Sie in Help Center und File Exchange

Produkte


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by