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