Changeset 625 for trunk/src/mouse_up.m


Ignore:
Timestamp:
May 2, 2013, 7:51:42 PM (11 years ago)
Author:
sommeria
Message:

system of object creation by mouse ilmproved

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/mouse_up.m

    r623 r625  
    2525
    2626test_ruler=0;%default
    27 hcurrentfig=hObject;
    28 fig_tag=get(hcurrentfig,'tag');
    29 currentaxes=gca; %store the current axes handle
    30 AxeData=get(currentaxes,'UserData');
     27AxeData=get(gca,'UserData');
     28if isfield(AxeData,'ParentAxes')% case of a zoom plot as current axis
     29    hcurrentaxes=AxeData.ParentAxes;
     30    AxeData=get(hcurrentaxes,'UserData');
     31    hcurrentfig=get(hcurrentaxes,'parent');%handles of the GUI parent of the zoom plot
     32    testsubplot=1;% mouse selection is on a zoom subplot
     33else
     34    hcurrentfig=hObject;
     35    hcurrentaxes=gca; %store the current axes handle
     36    testsubplot=0;
     37end
    3138CurrentOrigin=[];
    3239if isfield(AxeData,'CurrentOrigin')
    3340    CurrentOrigin=AxeData.CurrentOrigin;
    3441end
    35 if isfield(AxeData,'ParentRect')% case of a zoom plot as current axis
    36     parentaxes=get(AxeData.ParentRect,'parent');
    37     AxeData=get(parentaxes,'UserData');
    38     controlGUI=get(parentaxes,'parent');%handles of the GUI parent of the zoom plot
    39     hhcurrentfig=guidata(controlGUI);
    40     testsubplot=1;
    41 else
    42     hhcurrentfig=guidata(hcurrentfig);%the current figure is a GUI (uvmat or view_field)
    43     testsubplot=0;
    44 end
    45 test_zoom=get(hhcurrentfig.CheckZoom,'Value');
    46 
     42FigTag=get(hcurrentfig,'tag');
     43hhcurrentfig=guidata(hcurrentfig);%the current figure is a GUI (uvmat or view_field)
     44CheckZoom=get(hhcurrentfig.CheckZoom,'Value');
     45CheckZoomFig=get(hhcurrentfig.CheckZoomFig,'Value');%exclusive to CheckZoom
    4746huvmat=findobj(allchild(0),'tag','uvmat');%find the uvmat interface handle
    4847if ~isempty(huvmat)
    4948    hhuvmat=guidata(huvmat);
    5049    UvData=get(huvmat,'UserData');
    51    test_ruler=~test_zoom && isequal(get(hhuvmat.MenuRuler,'checked'),'on');%test for ruler  action, second priority
    52 end
    53 test_drawing=0;%default
    54 
    55 %% finalize the fabrication or the translation/deformation of an object and plot the corresponding projected field
     50   test_ruler=~CheckZoom && isequal(get(hhuvmat.MenuRuler,'checked'),'on');%test for ruler  action, second priority
     51end
     52test_drawing=0;%default, =1 to allow drawing by further mouse action
     53xy=get(gca,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
     54
     55
     56%% proceed with the creation or editing (translation/deformation) of an object
    5657if ~isempty(huvmat) && isfield(AxeData,'Drawing') && ~isequal(AxeData.Drawing,'off') && isfield(AxeData,'CurrentObject')...
    5758        && ~isempty(AxeData.CurrentObject) && ishandle(AxeData.CurrentObject)
    58     xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
     59    %     xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
    5960    PlotData=get(AxeData.CurrentObject,'UserData');%get data attached to the current projection object
    6061    IndexObj=PlotData.IndexObj;
    6162    ObjectData=UvData.ProjObject{IndexObj};
    6263    check_multiple=0;
     64   
     65    h_set_object=findobj(allchild(0),'Tag','set_object');
     66    hh_set_object=guidata(h_set_object);
     67    ObjectData.Coord=get(hh_set_object.Coord,'Data');
     68   
    6369    % ending translation
    6470    if isequal(AxeData.Drawing,'translate')
     
    6975        ObjectData.Coord(:,2)=ObjectData.Coord(:,2)+DY;
    7076       
    71     %ending object deformation
     77        %ending object deformation
    7278    elseif isequal(AxeData.Drawing,'deform')
    7379        ind_move=AxeData.CurrentIndex;
     
    7581        ObjectData.Coord(ind_move,2)=xy(1,2);
    7682       
    77     %creating object
     83        %creating object
    7884    else
    7985        switch ObjectData.Type
     
    8591                end
    8692            case {'rectangle','ellipse','volume'}
    87 %                  if size(ObjectData.Coord,1)==1 % this is the mouse up for the first point, continue until next click
    88 %                     check_multiple=1;
    89 %                  else
    90                 ObjectData.Coord=(CurrentOrigin+xy(1,1:2))/2;% keep only the first point coordinate     
     93                %                  if size(ObjectData.Coord,1)==1 % this is the mouse up for the first point, continue until next click
     94                %                     check_multiple=1;
     95                %                  else
     96                ObjectData.Coord=(CurrentOrigin+xy(1,1:2))/2;% keep only the first point coordinate
    9197                ObjectData.RangeX=abs(ObjectData.Coord(1,1)-xy(1,1));%rectangle width
    92                 ObjectData.RangeY=abs(ObjectData.Coord(1,2)-xy(1,2));%rectangle height   
     98                ObjectData.RangeY=abs(ObjectData.Coord(1,2)-xy(1,2));%rectangle height
    9399                if isequal(ObjectData.RangeX,0)||isequal(ObjectData.RangeY,0)
    94100                    check_multiple=1;% pass to next mous up if width of height=0
    95101                end
    96 %                 ObjectData.Coord(1,1)=(xy(1,1)+XYData(1))/2;%origin rectangle, x coordinate
    97 %                 ObjectData.Coord(1,2)=(xy(1,2)+XYData(2))/2;
    98 %                 ObjectData.RangeX=abs(xy(1,1)-XYData(1))/2;%rectangle width
    99 %                 ObjectData.RangeY=abs(xy(1,2)-XYData(2))/2;%rectangle height
    100 %                  end
     102                %                 ObjectData.Coord(1,1)=(xy(1,1)+XYData(1))/2;%origin rectangle, x coordinate
     103                %                 ObjectData.Coord(1,2)=(xy(1,2)+XYData(2))/2;
     104                %                 ObjectData.RangeX=abs(xy(1,1)-XYData(1))/2;%rectangle width
     105                %                 ObjectData.RangeY=abs(xy(1,2)-XYData(2))/2;%rectangle height
     106                %                  end
    101107            case 'plane' %case of 'plane'
    102108                DX=(xy(1,1)-ObjectData.Coord(1,1));
     
    110116                end
    111117            otherwise
    112                 check_multiple=1; 
     118                check_multiple=1;
    113119        end
    114120    end
    115121   
    116122    %show object coordinates in the GUI set_object
    117     h_set_object=findobj(allchild(0),'Tag','set_object');
    118     hh_set_object=guidata(h_set_object);
    119     set(hh_set_object.Coord,'Data',ObjectData.Coord);
     123    %     h_set_object=findobj(allchild(0),'Tag','set_object');
     124    %     hh_set_object=guidata(h_set_object);
     125    %     set(hh_set_object.Coord,'Data',ObjectData.Coord);
    120126    if strcmp(ObjectData.Type,'rectangle')||strcmp(ObjectData.Type,'ellipse')
    121127        set(hh_set_object.num_RangeX_2,'String',num2str(ObjectData.RangeX,4));
    122128        set(hh_set_object.num_RangeY_2,'String',num2str(ObjectData.RangeY,4));
    123129    end
    124 
    125     %stop drawing and plot projected field if the object manipulation is finished
     130   
     131    %% stop drawing and plot the projected field if the object manipulation is finished
    126132    if check_multiple==0  || isequal(get(hcurrentfig,'SelectionType'),'alt')
    127133        AxeData.CurrentOrigin=[]; %suppress the current origin
    128         hobject=UvData.ProjObject{IndexObj}.DisplayHandle.(fig_tag);
     134        hobject=UvData.ProjObject{IndexObj}.DisplayHandle.(FigTag);
    129135        if ~isempty(hObject)
    130          ProjObject=UvData.ProjObject{get(hhuvmat.ListObject_1,'Value')};
    131         AxeData.CurrentObject=plot_object(ObjectData,ProjObject,hobject,'m');%draw the object and its handle becomes AxeData.CurrentObject
     136            ProjObject=UvData.ProjObject{get(hhuvmat.ListObject_1,'Value')};
     137            AxeData.CurrentObject=plot_object(ObjectData,ProjObject,hobject,'m');%draw the object and its handle becomes AxeData.CurrentObject
    132138        end
    133139        %%
     
    136142            ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData
    137143            if ~isempty(ProjData)
    138                 if strcmp(fig_tag,'uvmat')% uvmat plot selected, projection plot seen in view_field
     144                if strcmp(FigTag,'uvmat')% uvmat plot selected, projection plot seen in view_field
    139145                    hview_field=findobj(allchild(0),'tag','view_field');
    140146                    if isempty(hview_field)
     
    159165                else
    160166                    UvData.PlotAxes=ProjData;
    161                     [PlotType,PlotParam]=plot_field(ProjData,hhuvmat.PlotAxes,read_GUI(hhuvmat));%update an existing field plot
     167                    [PlotType,PlotParam]=plot_field(ProjData,hhuvmat.PlotAxes,read_GUI(huvmat));%update an existing field plot
    162168                    errormsg=fill_GUI(PlotParam,huvmat);
    163169                end
    164170            end
    165171            set(hhuvmat.ViewField,'Value',1);%
    166             set(hhuvmat.edit_object,'BackgroundColor',[1 1 0]);% paint the edit text in yellow
    167             set(hhuvmat.edit_object,'Value',1);%
     172            set(hhuvmat.edit_object,'Value',1);%           
    168173            set(hhuvmat.edit_object,'Enable','on');%
    169174            set(hhuvmat.MenuEditObject,'Enable','on');%
    170175            set(hhuvmat.MenuEdit,'Enable','on');%
     176            set(get(h_set_object,'children'),'Enable','on')
     177        end
     178        UvData.ProjObject{IndexObj}=ObjectData;
     179        if isfield(UvData.ProjObject{IndexObj},'CreateMode')
     180            UvData.ProjObject{IndexObj}=rmfield(UvData.ProjObject{IndexObj},'CreateMode');%remove createMode to mark the object as finished
    171181        end
    172182    else
    173 %         test_drawing=1;%allow continuation of drawing object
    174         AxeData.CurrentOrigin=[xy(1,1) xy(1,2)]; %the current point becomes the next current origin
    175     end
    176     UvData.ProjObject{IndexObj}=ObjectData;
     183        test_drawing=1;%allow continuation of drawing object
     184        AxeData.CurrentOrigin=[xy(1,1) xy(1,2)]; %the current point becomes the next current origin
     185    end
     186    %     UvData.ProjObject{IndexObj}=ObjectData;
    177187    hother=findobj('Tag','deformpoint');%find all the deformpoints
    178188    set(hother,'Color','b');%reset all the deformpoints in 'blue'
    179189end
    180190
    181 %% creation of a new zoom plot
    182 if isequal(get(hcurrentfig,'SelectionType'),'normal');%if left button has been pressed
     191%% creation or update of a  zoom sub-plot
     192if CheckZoomFig && isequal(get(hcurrentfig,'SelectionType'),'normal')&&...%if left button has been pressed
     193     ~isempty(CurrentOrigin) && ~isequal(CurrentOrigin(1),xy(1,1)) && ~isequal(CurrentOrigin(2),xy(1,2))%if mouse moved in x and y since presed down
    183194    hparentfig=hcurrentfig;
    184195    %open or update a new zoom figure if a rectangle has been drawn
    185     if ishandle(currentaxes);
     196    if ishandle(hcurrentaxes);
    186197        if isfield(AxeData,'CurrentRectZoom') && ~isempty(AxeData.CurrentRectZoom) && ishandle(AxeData.CurrentRectZoom)
    187             PosRect=get(AxeData.CurrentRectZoom,'Position');
     198            %PosRect=get(AxeData.CurrentRectZoom,'Position');
    188199            if isfield(AxeData,'CurrentVec') && ~isempty(AxeData.CurrentVec) && ishandle(AxeData.CurrentVec)
    189200                delete(AxeData.CurrentVec)
    190201            end
    191             if ~testsubplot
    192                 hfig2=figure;%create new figure
    193                 set(hfig2,'name','zoom')
    194                 set(0,'Unit','pixels')
    195                 set(hfig2,'Unit','pixels')
    196                 FigPos=get(hfig2,'Position');
    197                 ScreenSize=get(0,'ScreenSize');% get the size of the screen, to put the fig on the upper right
    198                 Left=ScreenSize(3)- FigPos(3)-40; %right edge close to the right, with margin=40
    199                 Bottom=ScreenSize(4)-FigPos(4)-40; %put fig at top right
    200                 FigPos(1:2)=[Left Bottom];
    201                 set(hfig2,'Position',FigPos);
    202                 map=colormap(currentaxes);
    203                 colormap(map);%transmit the current colormap to the zoom fig
    204                 set(hfig2,'KeyPressFcn',{@keyboard_callback,handles})%set keyboard action function
    205                 set(hfig2,'WindowButtonMotionFcn',{@mouse_motion,handles})%set mouse action function
    206                 set(hfig2,'WindowButtonDownFcn',{@mouse_down})%set mouse click action function
    207                 set(hfig2,'WindowButtonUpFcn',{@mouse_up,handles})
    208                 set(hfig2,'DeleteFcn',{@close_fig,AxeData.CurrentRectZoom,'zoom'})
    209                 set(hfig2,'UserData',AxeData.CurrentRectZoom)% record the parent object (zoom rectangle) in the new fig
    210                 AxeData.ZoomAxes=copyobj(currentaxes,hfig2); %copy the current graph axes to the zoom figure
     202            if ~testsubplot% if we are not already on a zoom plot
     203                hfig2=findobj(allchild(0),'Tag','zoom_fig');
     204                if isempty(hfig2)% create zoom sub plot if absent
     205                    hfig2=figure('name',['zoom_' FigTag],'tag','zoom_fig');%create new figure (unit='pixels' by default)
     206                    set(0,'Unit','pixels')
     207                    FigPos=get(hfig2,'Position');%get the standard width and height of the fig
     208                    ScreenSize=get(0,'ScreenSize');% get the size of the screen, to put the fig on the upper right
     209                    Left=ScreenSize(3)- FigPos(3)-40; %right edge close to the right, with margin=40
     210                    Bottom=ScreenSize(4)-FigPos(4)-40; %put fig at top right
     211                    FigPos(1:2)=[Left Bottom];
     212                    set(hfig2,'Position',FigPos);% put the zoom fig close to the upper right of the screen
     213                    map=colormap(hcurrentaxes);
     214                    colormap(map);%transmit the current colormap to the zoom fig
     215                    set(hfig2,'KeyPressFcn',{@keyboard_callback,handles})%set keyboard action function
     216                    set(hfig2,'WindowButtonMotionFcn',{@mouse_motion,handles})%set mouse action function
     217                    set(hfig2,'WindowButtonDownFcn',{@mouse_down})%set mouse click action function
     218                    set(hfig2,'WindowButtonUpFcn',{@mouse_up,handles})
     219                else
     220                    zoom_axes=findobj(hfig2,'Type','axes');%delete existing axes
     221                    axes(zoom_axes);%make the zoom axes apparent
     222                    delete(zoom_axes)
     223                end
     224                set(hfig2,'DeleteFcn',{@close_fig,AxeData.CurrentRectZoom})
     225                set(hfig2,'UserData',AxeData.CurrentRectZoom)% record the parent object (zoom rectangle) in the new fig   
     226                AxeData.ZoomAxes=copyobj(hcurrentaxes,hfig2); %copy the current graph axes to the zoom figure
    211227                hrect_zoom=findobj(AxeData.ZoomAxes,'Tag','rect_zoom');%find and delete the copy of the rect_zoom rectangle
    212228                delete(hrect_zoom)
    213                 ChildAxeData=get(AxeData.ZoomAxes,'UserData');
    214                 if isfield(ChildAxeData,'ParentGUI')
    215                     ChildAxeData=rmfield(ChildAxeData,'ParentGUI');%no parent GUI, e.g. uvmat,  for the new plot
    216                 end
    217                 set(AxeData.ZoomAxes,'Position',[0.1300    0.1100    0.7750    0.8150])% standard axes position on a figure
    218229                hcol=findobj(hparentfig,'Tag','Colorbar'); %look for colorbar axes
    219230                if ~isempty(hcol)
     
    228239                    set(hcol_new,'Yticklabel',YTicklabel);
    229240                end
    230             end         
     241                ChildAxeData=get(AxeData.ZoomAxes,'UserData');
     242            end 
     243            ChildAxeData.CurrentOrigin=[];% forget the current origin
    231244            ChildAxeData.CurrentRectZoom=[]; % no rect zoom in the new window
    232245            ChildAxeData.Drawing='off';
    233             ChildAxeData.ParentRect=AxeData.CurrentRectZoom;%set the rectangle as a 'parent' associated to the new axe
    234             PosRect=CurrentOrigin;
    235             xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
    236             set(AxeData.ZoomAxes,'Xlim',[PosRect(1) xy(1,1)])
    237             set(AxeData.ZoomAxes,'Ylim',[PosRect(2) xy(1,2)])
     246            ChildAxeData.ParentAxes=hcurrentaxes;
     247            ChildAxeData.ParentRect=AxeData.CurrentRectZoom;%set the rectangle drawing as a 'parent' associated to the new axe
     248            %PosRect=CurrentOrigin;
     249           % xy=get(hcurrentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
     250            if xy(1,1)>CurrentOrigin(1)
     251            set(AxeData.ZoomAxes,'Xlim',[CurrentOrigin(1) xy(1,1)])
     252            else
     253                set(AxeData.ZoomAxes,'Xlim',[xy(1,1) CurrentOrigin(1)])
     254            end
     255            if xy(1,2)>CurrentOrigin(2)
     256            set(AxeData.ZoomAxes,'Ylim',[CurrentOrigin(2) xy(1,2)])
     257            else
     258                set(AxeData.ZoomAxes,'Ylim',[xy(1,2) CurrentOrigin(2)])
     259            end
    238260            set(AxeData.ZoomAxes,'UserData',ChildAxeData);%update the AxeData of the new axes
    239261        end
     
    242264
    243265%% zoom in or out by a factor 2 if no new figure is created
    244 if test_zoom
    245     xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
    246     xlim=get(currentaxes,'XLim');
    247     ylim=get(currentaxes,'YLim');
     266if CheckZoom
     267    if testsubplot
     268        haxes=gca;% zoom on a zoom sub-plot
     269    else
     270        haxes=hcurrentaxes;% zoom on the main plot
     271    end
     272   % xy=get(haxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
     273    xlim=get(haxes,'XLim');
     274    ylim=get(haxes,'YLim');
    248275    % if left mouse button has been pressed, zoom in by a factor of 2
    249     if  isequal(get(hcurrentfig,'SelectionType'),'normal');%if left button has been pressed, zoom in by a factor of 2
    250         PlotBoxAspectRatio=get(currentaxes,'PlotBoxAspectRatio');
     276    if  isequal(get(gcf,'SelectionType'),'normal');%if left button has been pressed, zoom in by a factor of 2
     277        PlotBoxAspectRatio=get(haxes,'PlotBoxAspectRatio');
    251278        yoverx=PlotBoxAspectRatio(2)/PlotBoxAspectRatio(1);
    252279        if yoverx <2
    253280            xlim(1)=0.5*xy(1,1)+0.5*xlim(1);
    254281            xlim(2)=0.5*xy(1,1)+0.5*xlim(2);%double the field whith the middle at the selected points
    255             set(currentaxes,'XLim',xlim)
     282            set(haxes,'XLim',xlim)
    256283        end
    257284        if yoverx >0.5
    258285            ylim(2)=0.5*xy(1,2)+0.5*ylim(2);
    259286            ylim(1)=0.5*xy(1,2)+0.5*ylim(1);
    260             set(currentaxes,'YLim',ylim)
     287            set(haxes,'YLim',ylim)
    261288        end
    262289       
     
    267294        ylim(1)=2*ylim(1)-xy(1,2);
    268295        ylim(2)=2*ylim(2)-xy(1,2);
    269         if isfield(AxeData,'RangeX')&& isfield(AxeData,'RangeY')
     296        % adjust the zoom out to the available field
     297        if ~testsubplot && isfield(AxeData,'RangeX')&& isfield(AxeData,'RangeY')
    270298            xlim(1)=max(AxeData.RangeX(1),xlim(1));
    271299            xlim(2)=min(AxeData.RangeX(2),xlim(2));
     
    279307            if isequal(xlim,AxeData.RangeX) && isequal(ylim,AxeData.RangeY)
    280308                set(hhuvmat.CheckZoom,'Value',0)
    281                 set(hhuvmat.CheckZoom,'BackgroundColor',[0.7 0.7 0.7])
     309               % set(hhuvmat.CheckZoom,'BackgroundColor',[0.7 0.7 0.7])
    282310                set(hhuvmat.CheckFixLimits,'Value',0)
    283                 set(hhuvmat.CheckFixLimits,'BackgroundColor',[0.7 0.7 0.7])
    284             end
    285         end
    286         set(currentaxes,'XLim',xlim)
    287         set(currentaxes,'YLim',ylim)
     311              %  set(hhuvmat.CheckFixLimits,'BackgroundColor',[0.7 0.7 0.7])
     312            end
     313        end
     314        set(haxes,'XLim',xlim)
     315        set(haxes,'YLim',ylim)
    288316        %test whther zoom out is operating (to inactivate AxedAta
    289317        if ~isfield(AxeData,'CurrentXLim')|| ~isequal(xlim,AxeData.CurrentXLim)
     
    291319        end
    292320    end
    293     if isfield(AxeData,'LimEditBox')&& AxeData.LimEditBox% update display of the GUI containing the axis (uvmat or view_field)
     321    %if isfield(AxeData,'LimEditBox')&& AxeData.LimEditBox% update display of the GUI containing the axis (uvmat or view_field)
     322    if testsubplot
     323        set(AxeData.CurrentRectZoom,'Position',[xlim(1) ylim(1) xlim(2)-xlim(1) ylim(2)-ylim(1)])
     324    else
    294325        set(hhcurrentfig.num_MinX,'String',num2str(xlim(1)))
    295326        set(hhcurrentfig.num_MaxX,'String',num2str(xlim(2)))
     
    300331
    301332%% editing calibration point
    302 if ~test_zoom && isfield(AxeData,'Drawing') && isequal(AxeData.Drawing,'calibration')
     333if ~CheckZoom && isfield(AxeData,'Drawing') && isequal(AxeData.Drawing,'calibration')
    303334    h_geometry_calib=findobj(allchild(0),'tag','geometry_calib'); %find the geomterty_calib GUI
    304335    if ~isempty(h_geometry_calib)
    305336        hh_geometry_calib=guidata(h_geometry_calib);
    306337        edit_test=get(hh_geometry_calib.edit_append,'Value');
    307         hh=findobj(currentaxes,'tag','calib_points');%look for handle of calibration points
     338        hh=findobj(hcurrentaxes,'tag','calib_points');%look for handle of calibration points
    308339        if ~isempty(hh) && edit_test
    309340            index_point=get(hh,'UserData');
     
    313344            data=read_geometry_calib(Coord);
    314345            %         val=get(h_ListCoord,'Value');
    315             xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
     346          %  xy=get(hcurrentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
    316347            data.Coord(index_point,4)=xy(1,1);
    317348            data.Coord(index_point,5)=xy(1,2);
     
    331362
    332363%% finalising ruler
    333 if test_ruler
     364if test_ruler && ~isempty(xy)
    334365    set(hhuvmat.MenuRuler,'checked','off')%desable the ruler option in uvmat
    335     xy=get(currentaxes,'CurrentPoint');% get the current mouse coordinates
     366    xy=get(hcurrentaxes,'CurrentPoint');% get the current mouse coordinates
    336367    RulerCoord=[AxeData.RulerCoord ;xy(1,1:2)];% append the recorded ruler origin to the current mouse coordinates
    337368    RulerCoord=diff(RulerCoord,1);% coordiante difference between segment end and beginning
     
    346377
    347378%% display the data of the current object selected with the mouse right click
    348 if isequal(get(hcurrentfig,'SelectionType'),'alt') && ~test_zoom && (~isfield(AxeData,'Drawing')||~isequal(AxeData.Drawing,'create'))
     379if isequal(get(hcurrentfig,'SelectionType'),'alt') && ~CheckZoom && (~isfield(AxeData,'Drawing')||~isequal(AxeData.Drawing,'create'))
    349380    hother=findobj('Tag','proj_object');%find all the proj objects
    350381    nbselect=0;
     
    384415        AxeData.Drawing='off';%stop current drawing action
    385416end
    386 set(currentaxes,'UserData',AxeData);
     417set(hcurrentaxes,'UserData',AxeData);
    387418if ~isempty(huvmat)
    388419    set(huvmat,'UserData',UvData);
    389420end
    390421
    391    
    392 
     422%------------------------------------------------------------------------   
     423% --- 'close_fig': function  activated when a zoom figure is closed
     424%------------------------------------------------------------------------
     425function close_fig(ggg,eventdata,hparent)
     426
     427hfig=get(get(hparent,'parent'),'parent');
     428hbutton=findobj(hfig,'Tag','CheckZoomFig');
     429if ~isempty(hbutton)
     430    set(hbutton,'Value',0)% desactivate the zoom fig option
     431end
     432delete(hparent)  % delete the rectangle showing the zoom graph in the parent fig
     433
Note: See TracChangeset for help on using the changeset viewer.