Restore standard interactive axes behavior (callback) when using custom ButtonDownFcn

1 ビュー (過去 30 日間)
Luca Amerio
Luca Amerio 2019 年 10 月 17 日
In the latest MATLAB versions, by default, axes got a very neet degree of interactivity.
For example, just doing
[X,Y,Z] = peaks(25);
h = surf(X,Y,Z,Z);
clicking on the axes allows to 3d orbit, zoom with the mouse wheel and show a data-tit when hovering over a point. Everything without using the "orbit", "zoom" or "data tips" buttons.
However, if we add an interactive callback to the figure, for example doing
h.ButtonDownFcn = @my_hit_fun;
function my_hit_fun(~,~)
disp('hit')
the interactive behavior is completely gone.
NOTE: we added a button down function to the surface, but the interactive behaviour is not triggered not even when clicking on the background.
Is there a way to restore this behavior , at least when 'my_hit_fun' is not triggered? Something like:
if I_hit_something_with_a_callback
execute_my_callback
else
normal_behavior
end

回答 (0 件)

カテゴリ

Find more on Interactive Control and Callbacks in Help Center and File Exchange

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by