Changeset 681 for trunk/src/mouse_down.m


Ignore:
Timestamp:
Sep 2, 2013, 2:42:52 PM (10 years ago)
Author:
sommeria
Message:

mouse action improved for translations, use of magenta color to indicate that REFRESH is needed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/mouse_down.m

    r680 r681  
    5959    UvData=get(huvmat,'UserData');
    6060    test_ruler=isequal(get(hhuvmat.MenuRuler,'checked'),'on');%test for ruler  action, second priority;
    61     test_edit=get(hhuvmat.CheckEditObject,'Value')&& (isequal(obj_tag,'proj_object')||isequal(obj_tag,'DeformPoint'));%test for object editing, third priority
     61    test_edit=get(hhuvmat.CheckEditObject,'Value');%&& (isequal(obj_tag,'proj_object')||isequal(obj_tag,'DeformPoint'));%test for object editing, third priority
    6262    hset_object=findobj(allchild(0),'Name','set_object');
    6363    if ~isempty(hset_object)
     
    9797ind_object=find(check_pos(:,1) & check_pos(:,2),1);% select the index of the (first) object under the mouse
    9898hchild=hchildren(ind_object);% corresponding object handle
     99htype='';
    99100if ~isempty(hchild)
    100101    htype=get(hchild,'Type');%type of object child of the current figure
     
    105106            xy=get(hchild,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
    106107            AxeData=get(hchild,'UserData');% data attached to the axis
    107 %             if isfield(AxeData,'ObjectCoord') && size(AxeData.ProjObjectCoord,2)==3
    108 %                 xy(1,3)=AxeData.ProjObjectCoord(1,3); % z coordinate of the mouse: to generalise ...
    109 %             else
    110 %                 xy(1,3)=0; % z coordinate set to 0 by default
    111 %             end
     108            AxeData.Enable='on';% unable current axes for mouse up action
    112109            AxeData.CurrentOrigin=xy(1,1:2);% The current point set by the mouse becomes the current origin
    113110           
     
    135132                end
    136133            end
    137             %break% leave the loop once an axes has been selected
    138            
     134            set(hchild,'UserData',AxeData)
    139135            %if the mouse is over a uicontrol, with right mouse button activated, duplicate the display in an editable  zoom window
    140136        case 'uicontrol'
     
    153149                hhchildren=get(hchild,'Children');%handles of all objects in the selected panel
    154150                check_visible=strcmp(get(hhchildren,'Visible'),'on');%=1 if visible='on', =0 otherwise
    155                 hhchildren=hhchildren(check_visible); %keep only the visible children
    156                
     151                hhchildren=hhchildren(check_visible); %keep only the visible children               
    157152                PosChildren=get(hhchildren,'Position');
    158153                PosLength=cellfun('length',PosChildren);
     
    171166                    end
    172167                end
    173             end
    174             %   return %leave the function once a uicontrol has been selected
    175     end
    176 end
    177 
     168            end           
     169    end
     170end
     171    if ~strcmp(htype,'axes')
     172        currentaxes=get(hObject,'CurrentAxes');
     173        if ~isempty(currentaxes)
     174        AxeData=get(currentaxes,'UserData');% data attached to the axis
     175        AxeData.Enable='off';% desactivate current axes for mouse up action
     176        set(currentaxes,'UserData',AxeData);
     177        end
     178    end
     179   
    178180%% zoom has first priority, stop here
    179181if CheckZoom
     
    236238%% selection of an existing projection object (third priority)
    237239if  test_edit
     240    testdeform=0;
    238241    if ~(isfield(AxeData,'Drawing') && isequal(AxeData.Drawing,'create'))
    239242        userdata=get(hcurrentobject,'UserData');
     
    293296            set_object(UvData.ProjObject{IndexObj})
    294297            axes(hchild);%set back the current axes haxes
    295             testdeform=0;
    296298            set(gcbo,'Pointer','circle');
    297299            AxeData.Drawing='deform';
     
    307309               end
    308310            end
    309             if testdeform==0
     311%             if testdeform==0
     312%                 AxeData.Drawing='translate';
     313%                 set(AxeData.CurrentObject,'Selected','on')
     314%                 set(gcbo,'Pointer','fleur');
     315%             end
     316        else
     317            if strcmp(get(hCurrentGUI,'tag'),'uvmat') %if the uvmat graph has been selected, object projection is on the other frame view_field
     318               IndexObj=get(hhuvmat.ListObject,'Value');
     319               AxeData.CurrentObject=UvData.ProjObject{IndexObj}.DisplayHandle.uvmat;
     320            else
     321                IndexObj=get(hhuvmat.ListObject_1,'Value');
     322                AxeData.CurrentObject=UvData.ProjObject{IndexObj}.DisplayHandle.view_field;
     323            end   
     324            ObjectData=get(AxeData.CurrentObject,'UserData');
     325            ObjectData.IndexObj=IndexObj;
     326            set(AxeData.CurrentObject,'UserData',ObjectData)
     327        end
     328        if testdeform==0
    310329                AxeData.Drawing='translate';
    311330                set(AxeData.CurrentObject,'Selected','on')
    312331                set(gcbo,'Pointer','fleur');
    313             end
    314332        end
    315333    end
Note: See TracChangeset for help on using the changeset viewer.