I don't think this works any longer, or at least, I couldnt get it to work.
pan in a single axes
6 views (last 30 days)
Show older comments
I have a figure with 21 axes.
I need to turn the horizontal pan on within a single axes with a dead-simple callback when pan is executed:
So I do this:
h = pan;
setAllowAxesPan(h,ax_target,true);
h.Motion = 'horizontal';
h.ActionPostCallback = {@post_pan_callback, h, ax_target};
h.enable = 'on';
This turns on the blue/grey pan thingy (axtoolbar) and the callback works when I drag the curve left and right.
BUT
(because I completely fail to understand the interaction between the pan object and the good-old pan)...
problem 1
Even if I disable the pan thingy, I can still pan and the callback doesn't execute. I want the ability for the pan to be under user control. When the thingy is off, pan should be off. What the heck is the point of it then? If the callback doesn't execute, wrong data are displayed.
problem 2
The pan thingy infects the other 20 axes because h is assigned to a figure, not an axes. WHY? Can I have mutlple pan objects, one per axes?
As it stands now, I need to turn off the pan thingy on the ax_target on in order to interact with the other axes. -- you know, the ones that should NOT pan under any circumstances because it tooks hours of work to align them.
problem 3
I want to turn off the panning behavior globally if I click outside of ax_target. IE when I click on one of the other axes, I want the pan on ax_target to turn the heck off. When I try to set
if ~(strcmp(eventdata.Axes.Tag,'the axes that I want the pan to work in')), h.enable='off';
inside the callback, I get the typical matlab goobledeegook below, when I try the good old "pan('off')" inside the callback and I get the same thing:
Warning: An error occurred during the mode callback.
In matlab.uitools.internal.uimode/fireActionPostCallback (line 16)
In pan>locWindowButtonUpFcn (line 375)
In pan>@(~,e)locWindowButtonUpFcn(fig,e,ax,hMode,buttonDownData) (line 541)
In hgfeval (line 62)
In matlab.uitools.internal.uimode/modeWindowButtonUpFcn (line 52)
In matlab.uitools.internal.uimode/setCallbackFcn>localModeWindowButtonUpFcn (line 56)
I think that figure's properties are blocked during the pan callback. So what should I do? Keep global variables?
Answers (0)
See Also
Categories
Find more on Graphics Object Properties in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!