Update cursor after disabling rotate3d

6 ビュー (過去 30 日間)
Matthias Fath
Matthias Fath 2024 年 10 月 8 日
回答済み: Matthias Fath 2024 年 10 月 14 日
Im am facing a small, but annoying issue using App Designer. I have an UIaxes with some plotted data. Since i was not happy with the default toolbar, i reengineered the functionalities i needed (datatips, rotate3d and home view) and assigned them to buttons respectively state buttons. When i click the button to enable rotation (using rotate3d(ax,'on') in the buttons callback function) the functionality is correctly enabled. When i wait some seconnds an then move the mouse cursor onto the plot area, it switches to the rotate symbol as it should. But when i move the mouse cursor quickly onto the plot area after activating the button and let it sit there, it stays an arrow and just changes to the rotate symbol when moved again. Same happens when disabling. When disabling by button, waiting and then hovering to the plot area it works fine and the cursor is displayed as arrow. When moved quickly, it stays the rotatesymbol.
Is there any way to programmatically force the cursor to update after usingrotate3d(ax,'on' / 'off')? I tried many combinations of drawnow, figure(), axes(), ().Pointer = 'arrow' and so on but everything gets ignored when entering or leaving the rotate3d modus.
Regards,
Matthias
  3 件のコメント
Matthias Fath
Matthias Fath 2024 年 10 月 10 日
Hi Adam,
i tried that but it does not affect the behaviour.
thanks & regards,
Matthias
Adam Danz
Adam Danz 2024 年 10 月 10 日
It's difficult to troubleshoot without seeing the behavior and seeing any customizations done to interactions. I recommend contacting tech support and include instructions how to reproduce the problem

サインインしてコメントする。

回答 (2 件)

Rahul
Rahul 2024 年 10 月 14 日
I understand that while trying to build an App Designer app you require to plot something on an axis and then enable rotation of the axis using 'rotate3d' function as well as disable it when rotation is not required. As per my understanding from your description, when you are trying to set the rotation, then there is some discrepancy about when the rotation symbol is displayed and when the cursor is displayed symbolizing 'rotation' property being 'on' or 'off'.
I have tried to create a simple App Designer app where using an axis I am plotting a 3d parabolic using the 'surf' function which is added to the callback function of a Push Button called 'PlotButton' like this:
function PlotButtonPushed(app, event)
[X, Y] = meshgrid(-5:0.5:5, -5:0.5:5);
Z = X.^2 + Y.^2;
surf(app.UIAxes, X, Y, Z);
disableDefaultInteractivity(app.UIAxes);
% Here the 'disableDefaultInteractivity' function disables any default interactivity set to the axis.
app.RotateButton.Enable = "on";
% This is to enable another State Button 'RotateButton' to enable and disable rotation of the axis.
% The 'Enable' property of the 'RotateButton' is initially set to 'off'
end
Now, when I click the 'RotateButton', I have linked it with a callback function 'RotateButtonValueChanged'. This callback function looks like:
function RotateButtonValueChanged(app, event)
value = app.RotateButton.Value;
if(value == 1)
rotate3d(app.UIAxes, 'on');
else
rotate3d(app.UIAxes, 'off');
end
end
  • When the 'RotateButton' is in the pressed state, the rotation of the axis gets enabled properly with only the 'rotate' cursor symbol being shown while hovering the plot/axis.
  • When the 'RotateButton' is NOT in the pressed state, the rotation of the axis gets disabled properly with only the normal cursor symbol being shown while hovering the plot/axis.
  • An interesting observation is that, the axis also offers a UI feature to set the rotation directly like this:
  • Whenever this icon is in pressed state, the 'rotation' property of the axis is enabled and when it is not in pressed state, it is disabled. So this is another way of adjusting rotation of the axis. It works in a similar fashion as the 'rotate3d' function linked to the callback of 'RotateButton'.
I am attaching a video GIF as well as the '.mlapp' file for your reference.
You can refer to the following MathWorks documentations to know more:
Hope this helps! Thanks.

Matthias Fath
Matthias Fath 2024 年 10 月 14 日
Hi Rahul,
thank you so much for your detailed answer. I can replicate what you described in a small standalone app and it works perfectly, just the way it should. However, within my bigger, actual app project, it somehow does not work that fast and the reaction of the mouse cursor is not so responsive. When i enable the rotation mode and hover rather quickly onto the plot area, the cursor does not change untill i move it again. It happens regardless of how much data i plot. Hope you can see what i mean in the attached .gif.
I have no additional functions connected with the state button, only:
function ButtonValueChanged(app, event)
value = app.Button.Value;
if(value == 1)
rotate3d(app.myUIAxes,'on');
else
rotate3d(app.myUIAxes,'off');
end
end

カテゴリ

Help Center および File ExchangePlot Customization についてさらに検索

製品


リリース

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by