how to use linkprop with custom interactions in appdesigner?

2 ビュー (過去 30 日間)
sigguy90
sigguy90 2022 年 4 月 20 日
編集済み: sigguy90 2022 年 5 月 9 日
I followed the steps here to enable linkprop between two axes in an app, which worked. However, when I try to set the Interactions, the behavior is not what I expect. If I set the Interactions to be rotateInteraction for both axes, I can click+drag to rotate axis 1 (which rotates axis 2) but I can't click+drag to rotate axis 2. If I click axis 2 first, then I can't interact with axis 1. Is this a bug or am I not doing something correctly? Thanks.
properties (Access = private)
ax1 matlab.graphics.axis.Axes
ax2 matlab.graphics.axis.Axes
hlink
end
% Callbacks that handle component events
methods (Access = private)
% Code that executes after component creation
function startupFcn(app)
app.ax1 = axes(app.Panel);
app.ax2 = axes(app.Panel2);
scatter3(app.ax1,1,1,1)
scatter3(app.ax2,1,1,1)
app.ax1.Toolbar = [];
app.ax2.Toolbar = [];
app.ax1.Interactions = [];
app.ax2.Interactions = [];
end
% Button pushed function: RotateButton
function RotateButtonPushed(app, event)
app.ax1.Interactions = [rotateInteraction];
% app.ax2.Interactions = [rotateInteraction];
app.hlink = linkprop([app.ax1,app.ax2],{'CameraUpVector', 'CameraPosition', 'CameraTarget', 'XLim', 'YLim', 'ZLim','Interactions'});
end
% Button pushed function: ZoomButton
function ZoomButtonPushed(app, event)
app.ax1.Interactions = [zoomInteraction];
% app.ax2.Interactions = [zoomInteraction];
% app.hlink = linkprop([app.ax1,app.ax2],{'CameraUpVector', 'CameraPosition', 'CameraTarget', 'XLim', 'YLim', 'ZLim','Interactions'});
end
end

回答 (1 件)

Kevin Holly
Kevin Holly 2022 年 5 月 2 日
I was able to replicate the same issue with your code.
Is there a reason that you aren't using UIAxes? I was able to get the following to work smoothly using uiaxes in R2021b and R2022a.
linkprop([app.UIAxes,app.UIAxes2],{'CameraUpVector', 'CameraPosition', 'CameraTarget', 'XLim', 'YLim', 'ZLim','Interactions'})
  1 件のコメント
sigguy90
sigguy90 2022 年 5 月 9 日
編集済み: sigguy90 2022 年 5 月 9 日
The thread I linked in the original post suggested using axes instead of UIAxes. With UIAxes, the interactions still don't work right. I tried changing the property definition for ax1 and ax2 but that didn't help. This is in R2021b.
properties (Access = private)
ax1
ax2
hlink
end

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

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by