필터 지우기
필터 지우기

What causes UIAxes gesture interactions to become disabled?

조회 수: 6 (최근 30일)
Thomas Watson
Thomas Watson 2023년 6월 9일
답변: Rohit Kulkarni 2023년 8월 14일
(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.

답변 (1개)

Rohit Kulkarni
Rohit Kulkarni 2023년 8월 14일
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

카테고리

Help CenterFile Exchange에서 Visual Exploration에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by