Daniel@0: function vis_footnoteButtonDownFcn Daniel@0: Daniel@0: % VIS_FOOTNOTEBUTTONDOWNFCN Callback set by VIS_FOOTNOTE Daniel@0: % Daniel@0: % som_showtitleButtonDownFcn Daniel@0: % Daniel@0: % Moves the axis of current callback object using DRAGRECT Daniel@0: % command. This callback is set to all texts added to figures by Daniel@0: % VIS_FOOTNOTE function. Daniel@0: % Daniel@0: % See also DRAGRECT, SOM_SHOWTITLE. Daniel@0: Daniel@0: % Copyright (c) 1997-2000 by the SOM toolbox programming team. Daniel@0: % http://www.cis.hut.fi/projects/somtoolbox/ Daniel@0: Daniel@0: % Version 2.0beta Johan 080698 Daniel@0: Daniel@0: % Action Daniel@0: Daniel@0: [txt,fig]=gcbo; % Get text and figure handles Daniel@0: ax=get(txt,'parent'); % Get axis handle Daniel@0: Daniel@0: memunits_fig=get(fig,'units'); % Get figure size in pixels Daniel@0: set(gcf,'units','pixels'); Daniel@0: pos_fig=get(fig,'position'); Daniel@0: Daniel@0: memunits_txt=get(txt,'units'); % Get text field size in pixels Daniel@0: set(txt,'units','pixels'); Daniel@0: text_size=get(txt,'extent'); Daniel@0: Daniel@0: memunits_ax=get(ax,'units'); % Get axis position in pixels Daniel@0: set(ax,'units','pixels'); Daniel@0: pos_ax=get(ax,'position'); Daniel@0: Daniel@0: %%% Move text Daniel@0: Daniel@0: pos_final=dragrect([pos_ax(1:2) text_size(3:4)]); Daniel@0: Daniel@0: %%% Keep the text inside the figure! Daniel@0: Daniel@0: pos_final(1)=max(pos_final(1),0); Daniel@0: pos_final(2)=max(pos_final(2),0); Daniel@0: pos_final(1)=min(pos_final(1),pos_fig(3)-text_size(3)); Daniel@0: pos_final(2)=min(pos_final(2),pos_fig(4)-text_size(4)); Daniel@0: Daniel@0: %%% Set new position Daniel@0: Daniel@0: new_pos=[pos_final(1:2) pos_ax(3:4)]; Daniel@0: set(ax,'position', new_pos); Daniel@0: Daniel@0: %%% Set the text on the top of the object stack Daniel@0: Daniel@0: children=get(gcf,'children'); Daniel@0: i=find(ismember(children,ax)); Daniel@0: new_i=[i 1:i-1 i+1:length(children)]; Daniel@0: set(gcf,'children',children(new_i)); Daniel@0: Daniel@0: set(txt,'position',[0 0 0]); Daniel@0: set(fig,'units',memunits_fig); Daniel@0: set(ax,'units',memunits_ax); Daniel@0: set(txt,'units',memunits_txt); Daniel@0: Daniel@0: Daniel@0: