comparison toolboxes/MIRtoolbox1.3.2/somtoolbox/vis_footnoteButtonDownFcn.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function vis_footnoteButtonDownFcn
2
3 % VIS_FOOTNOTEBUTTONDOWNFCN Callback set by VIS_FOOTNOTE
4 %
5 % som_showtitleButtonDownFcn
6 %
7 % Moves the axis of current callback object using DRAGRECT
8 % command. This callback is set to all texts added to figures by
9 % VIS_FOOTNOTE function.
10 %
11 % See also DRAGRECT, SOM_SHOWTITLE.
12
13 % Copyright (c) 1997-2000 by the SOM toolbox programming team.
14 % http://www.cis.hut.fi/projects/somtoolbox/
15
16 % Version 2.0beta Johan 080698
17
18 % Action
19
20 [txt,fig]=gcbo; % Get text and figure handles
21 ax=get(txt,'parent'); % Get axis handle
22
23 memunits_fig=get(fig,'units'); % Get figure size in pixels
24 set(gcf,'units','pixels');
25 pos_fig=get(fig,'position');
26
27 memunits_txt=get(txt,'units'); % Get text field size in pixels
28 set(txt,'units','pixels');
29 text_size=get(txt,'extent');
30
31 memunits_ax=get(ax,'units'); % Get axis position in pixels
32 set(ax,'units','pixels');
33 pos_ax=get(ax,'position');
34
35 %%% Move text
36
37 pos_final=dragrect([pos_ax(1:2) text_size(3:4)]);
38
39 %%% Keep the text inside the figure!
40
41 pos_final(1)=max(pos_final(1),0);
42 pos_final(2)=max(pos_final(2),0);
43 pos_final(1)=min(pos_final(1),pos_fig(3)-text_size(3));
44 pos_final(2)=min(pos_final(2),pos_fig(4)-text_size(4));
45
46 %%% Set new position
47
48 new_pos=[pos_final(1:2) pos_ax(3:4)];
49 set(ax,'position', new_pos);
50
51 %%% Set the text on the top of the object stack
52
53 children=get(gcf,'children');
54 i=find(ismember(children,ax));
55 new_i=[i 1:i-1 i+1:length(children)];
56 set(gcf,'children',children(new_i));
57
58 set(txt,'position',[0 0 0]);
59 set(fig,'units',memunits_fig);
60 set(ax,'units',memunits_ax);
61 set(txt,'units',memunits_txt);
62
63
64