MATLAB Answers

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

8 views (last 30 days)
Luca Amerio
Luca Amerio on 17 Oct 2019
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 Comments

Sign in to comment.

Answers (0)

Sign in to answer this question.

Products


Release

R2018b

Translated by