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

system of object creation by mouse ilmproved

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/mouse_motion.m

    r622 r625  
    3030FigData=get(hObject,'UserData');
    3131if ishandle(FigData)% case of a zoom plot, the handle of the parent rectangle is stored in UserData, its parent is the plotting axes of the rectangle
    32     CurrentFig=get(get(FigData,'parent'),'parent');
     32    hCurrentFig=get(get(FigData,'parent'),'parent');
    3333else
    34     CurrentFig=hObject;%usual plot
    35 end
    36 hhCurrentFig=guidata(CurrentFig);%handles of the elements in the GUI containing the current figure (uvmat or view_field)
     34    hCurrentFig=hObject;%usual plot
     35end
     36hhCurrentFig=guidata(hCurrentFig);%handles of the elements in the GUI containing the current figure (uvmat or view_field)
    3737CheckZoom=get(hhCurrentFig.CheckZoom,'Value');% check for zoom on mode
    3838CheckZoomFig=get(hhCurrentFig.CheckZoomFig,'Value');% check for zoom sub fig creation mode
     39hPlotAxes=hhCurrentFig.PlotAxes';% handles of the main plot axes
     40AxeData=get(hPlotAxes,'UserData');% data attached to the axis
     41test_draw=0;%test for mouse drawing of object, =0 by default
     42if isfield(AxeData,'Drawing')&& ~isempty(AxeData.Drawing)
     43    test_draw=~isequal(AxeData.Drawing,'off');%=1 if mouse drawing of object is active
     44end
    3945test_zoom_draw=0;
    40 test_draw=0;%test for mouse drawing of object, =0 by default
    4146test_object=0; %test for object editing or creation
    4247test_edit_object=0;% edit test for mouse shap: an arrow
     
    6469text_displ_4='';
    6570
    66 AxeData=[];%default
     71% AxeData=[];%default
    6772xy=[];%default
    6873xy_fig=get(hObject,'CurrentPoint');% current point of the current figure (gcbo)
     
    9297    CurrentAxes=hchild;
    9398    xy=get(CurrentAxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
    94     AxeData=get(CurrentAxes,'UserData');% data attached to the axis
    95     if isfield(AxeData,'Drawing')&& ~isempty(AxeData.Drawing)
    96         test_draw=~isequal(AxeData.Drawing,'off');%=1 if mouse drawing of object is active
    97     end
    9899    test_zoom_draw=test_draw && isequal(AxeData.Drawing,'zoom')&& isfield(AxeData,'CurrentOrigin') && isequal(get(gcf,'SelectionType'),'normal');
    99100    test_object=test_draw && isfield(AxeData,'CurrentObject') && ~isempty(AxeData.CurrentObject) && ishandle(AxeData.CurrentObject);
    100     %if ~test_edit_object && ~test_zoom_draw && ~test_ruler
    101101    if ~test_edit_object  && ~test_ruler && ~CheckZoom
    102102        pointershape='crosshair';%set pointer with cross shape (default when mouse is over an axis)
    103103    end
    104     FigData=get(CurrentFig,'UserData');
     104    FigData=get(hCurrentFig,'UserData');
    105105    tagaxes=get(CurrentAxes,'tag');
    106106    if isfield(FigData,tagaxes)
     
    130130                                pointershape='arrow'; %mouse indicates  the detection of a vector
    131131                                if isempty(hhh)
    132                                     set(0,'CurrentFigure',CurrentFig)
    133                                     set(CurrentFig,'CurrentAxes',CurrentAxes)
     132                                    set(0,'CurrentFigure',hCurrentFig)
     133                                    set(hCurrentFig,'CurrentAxes',CurrentAxes)
    134134                                    rectangle('Curvature',[1 1],...
    135135                                        'Position',[X(ivec)-Field.CoordMesh/2 Y(ivec)-Field.CoordMesh/2 Field.CoordMesh Field.CoordMesh],'EdgeColor','m',...
     
    232232                hhhh=findobj(CurrentAxes,'Tag','PIV_search_marker');
    233233                if isempty(hhh)
    234                     set(0,'CurrentFigure',CurrentFig)
    235                     set(CurrentFig,'CurrentAxes',CurrentAxes)
     234                    set(0,'CurrentFigure',hCurrentFig)
     235                    set(hCurrentFig,'CurrentAxes',CurrentAxes)
    236236                    rectangle('Curvature',[0 0],...
    237237                        'Position',[xround-ibx2 yround-iby2 2*ibx2 2*iby2],'EdgeColor','m',...
     
    420420
    421421%% update the mouse pointer
    422 set(CurrentFig,'Pointer',pointershape);
     422set(hCurrentFig,'Pointer',pointershape);
Note: See TracChangeset for help on using the changeset viewer.