NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/gliderproc/trunk/MATLAB/opnml/FCAST_1.2/movescaleaxes.m

Revision 495 (checked in by cbc, 12 years ago)

Initial import of Stark code.

Line 
1 function movescaleaxes(arg)
2 %MOVEAXIS Used to grab and move vecplot sclae axes.
3 %   To use, click and hold down a mouse button while
4 %   the cursor is near the lower left corner of the
5 %   axis you want to move. Wait for the cursor to change
6 %   to a fleur (4 way arrows), then drag the legend or axis
7 %   to the desired location and release the mouse button.
8 %
9 %            set(gca,'ButtonDownFcn','movescaleaxes(1)')
10
11
12
13 global OLDCA DELTA HL FIGUTS;
14 if arg==1,
15
16     OLDCA=gca; 
17
18     cur_obj_tag=get(gco,'Tag');
19     if ~strcmp(cur_obj_tag,'vecscaleaxes')
20        disp('axes not a scale axes')
21        break;
22     end
23     ax=axis;
24     DELTA=sqrt((ax(2)-ax(1)).^2+(ax(4)-ax(3)).^2)/10;
25     OLDCA=gca; 
26     FIGUTS = get(gcf,'units');
27     set(gcf,'pointer','fleur');
28     if strcmp(FIGUTS,'normalized'),
29         pnt = get(gcf,'currentpoint');
30         set(gcf,'units','normalized'); 
31         pos = get(gcf,'position');
32         pnt = [pnt(1) * pos(3) pnt(2) * pos(4)];
33     else,
34         set(gcf,'units','normalized');
35         pnt=get(gcf,'currentpoint');
36     end
37     set(gcf,'windowbuttonmotionfcn','movescaleaxes(2)')
38     set(gcf,'windowbuttonupfcn','movescaleaxes(3)');
39 elseif arg==2,
40     pos=get(get(gcf,'currentobject'),'position');
41     cp=get(gcf,'CurrentPoint');
42     dirx=cp(1)-pos(1);diry=cp(2)-pos(2);
43     newpos= [pos(1)+dirx pos(2)+diry pos(3) pos(4)];
44     set(get(gcf,'currentobject'),'units','normalized','drawmode','fast',...
45     'position',newpos);
46 elseif arg==3,
47     set(gcf,'WindowButtonMotionfcn','', ...
48         'pointer','arrow','currentaxes',OLDCA, ...
49         'windowbuttonupfcn','');
50     set(gcf,'units',FIGUTS);
51 end
52
53
54
Note: See TracBrowser for help on using the browser.