how to use linkprop with custom interactions in appdesigner?
2 ビュー (過去 30 日間)
古いコメントを表示
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
0 件のコメント
回答 (1 件)
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'})
参考
カテゴリ
Help Center および File Exchange で Interactive Control and Callbacks についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!