Changeset 221 for trunk/src/mouse_up.m


Ignore:
Timestamp:
Mar 12, 2011, 11:11:01 PM (13 years ago)
Author:
sommeria
Message:

various bug corrections.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/mouse_up.m

    r210 r221  
    201201                map=colormap(currentaxes);
    202202                colormap(map);%transmit the current colormap to the zoom fig
    203                 set(hfig2,'Position',[0.2 0.33 0.6 0.6]);         
     203                set(hfig2,'Position',[0.2 0.33 0.6 0.6]);
    204204                set(hfig2,'Unit','normalized')
    205205                set(hfig2,'KeyPressFcn',{@keyboard_callback,handles})%set keyboard action function
     
    229229                    set(hcol_new,'Yticklabel',YTicklabel);
    230230                end
    231             end
    232     %             if ishandle(AxeData.ZoomAxes)
    233 %             hnew_rect=findobj(AxeData.ZoomAxes,'Tag','rect_zoom');
    234 %             if ~isempty(hnew_rect)
    235 %                 delete(hnew_rect);
    236 
    237                 ChildAxeData.CurrentRectZoom=[]; % no rect zoom in the new window
    238                 ChildAxeData.Drawing='off';
    239                 ChildAxeData.ParentRect=AxeData.CurrentRectZoom;%set the rectangle as a 'parent' associated to the new axe
    240                 PosRect=CurrentOrigin;
    241                 xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
    242                 set(AxeData.ZoomAxes,'Xlim',[PosRect(1) xy(1,1)])
    243                 set(AxeData.ZoomAxes,'Ylim',[PosRect(2) xy(1,2)])
    244 %             end
     231            end         
     232            ChildAxeData.CurrentRectZoom=[]; % no rect zoom in the new window
     233            ChildAxeData.Drawing='off';
     234            ChildAxeData.ParentRect=AxeData.CurrentRectZoom;%set the rectangle as a 'parent' associated to the new axe
     235            PosRect=CurrentOrigin;
     236            xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
     237            set(AxeData.ZoomAxes,'Xlim',[PosRect(1) xy(1,1)])
     238            set(AxeData.ZoomAxes,'Ylim',[PosRect(2) xy(1,2)])
    245239            set(AxeData.ZoomAxes,'UserData',ChildAxeData);%update the AxeData of the new axes
    246240        end
     
    253247    xlim=get(currentaxes,'XLim');
    254248    ylim=get(currentaxes,'YLim');
     249 % if left mouse button has been pressed, zoom in by a factor of 2
    255250    if  isequal(get(currentfig,'SelectionType'),'normal');%if left button has been pressed, zoom in by a factor of 2
    256251        xlim(1)=0.5*xy(1,1)+0.5*xlim(1);
     
    260255        ylim(1)=0.5*xy(1,2)+0.5*ylim(1);
    261256        set(currentaxes,'YLim',ylim)
    262         %zoom out by a factor of 2 out when the right mouse button has been used
    263     else%if isequal(get(currentfig,'SelectionType'),'alt'); %if right button has been pressed
     257 % if right mouse button has been pressed, zoom out by a factor of 2
     258    else
    264259        xlim(1)=2*xlim(1)-xy(1,1);
    265260        xlim(2)=2*xlim(2)-xy(1,1);
    266261        ylim(1)=2*ylim(1)-xy(1,2);
    267262        ylim(2)=2*ylim(2)-xy(1,2);
    268         %             ylim_new(1)=(1+alpha)*ylim(1)/2+(1-alpha)*ylim(2)/2;
    269         %             ylim_new(2)=(1-alpha)*ylim(1)/2+(1+alpha)*ylim(2)/2;
    270263        if isfield(AxeData,'RangeX')&& isfield(AxeData,'RangeY')
     264            'TESTup'
     265            AxeData
    271266            xlim(1)=max(AxeData.RangeX(1),xlim(1));
    272267            xlim(2)=min(AxeData.RangeX(2),xlim(2));
    273268            ylim(1)=max(AxeData.RangeY(1),ylim(1));
    274269            ylim(2)=min(AxeData.RangeY(2),ylim(2));
     270         % desactivate the zoom if the full field is visible within the axes
    275271            if isequal(xlim,AxeData.RangeX) && isequal(ylim,AxeData.RangeY)
    276272                set(hhuvmat.zoom,'Value',0)
     
    280276            end
    281277        end
     278        xlim
     279        ylim
    282280        set(currentaxes,'XLim',xlim)
    283281        set(currentaxes,'YLim',ylim)
     
    287285        end
    288286    end
    289 %     if isfield(AxeData,'ParentRect')% update the position of the parent rectangle represneting the field
    290 %         hparentrect=AxeData.ParentRect;
    291 %         xlim=get(currentaxes,'XLim');
    292 %         ylim=get(currentaxes,'YLim');
    293 %         rect([1 2])=[xlim(1) ylim(1)];
    294 %         rect([3 4])=[xlim(2)-xlim(1) ylim(2)-ylim(1)];
    295 %         set(hparentrect,'Position',rect)
    296287    if isfield(AxeData,'LimEditBox')&& AxeData.LimEditBox% update display of the GUI containing the axis (uvmat or view_field)
    297288        set(hhcurrentfig.MinX,'String',num2str(xlim(1)))
     
    327318            Tabchar=[Tabchar ;{'......'}];
    328319            set(h_ListCoord,'String',Tabchar)
    329             %         coord_str=Coord{index_point}; %current line (string)
    330             %         k=findstr('|',coord_str);%find separator indices on the string
    331             %         blanks=blank
    332             %         xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
    333             %         if numel(k)>=3
    334             %             coord_str=[coord_str(1:k(3)-1) ' | ' num2str(xy(1,1),4) ' | ' num2str(xy(1,2),4)]; %update the pixel information while preserving phys coord
    335             %         else
    336             %             coord_str=[ '    |    '  '    |    '  '    |    ' num2str(xy(1,1),4) '    |    ' num2str(xy(1,2),4)];
    337             %         end
    338             %         Coord{index_point}=coord_str;
    339             %         set(h_ListCoord,'String',Coord)
    340             %         data=read_geometry_calib(Coord);%transform char cell to numbers
    341320            set(hh,'XData',data.Coord(:,4))
    342321            set(hh,'YData',data.Coord(:,5))
     
    344323    end
    345324end
    346 
    347325
    348326%% finalising ruler
     
    383361        currentobj=gco;%default
    384362    end
    385     if ((nbselect==0) && isequal(get(currentobj,'Type'),'axes')) || isequal(currentobj,huvmat)
    386         currentfig=get(currentobj,'parent');
    387         figname=get(currentfig,'name');
    388         eval(['global Data_' figname])
    389         eval(['Data_' figname '=get(currentobj,''UserData'')']);
    390         evalin('base',['global Data_' figname])%make CurData global in the workspace
    391         objtype=get(currentobj,'Type');
    392         display(['UserData of ' objtype ':'])
    393         evalin('base',['Data_' figname]) %display CurData in the workspace
    394         commandwindow %brings the Matlab command window to the front
    395     end
     363%     if ((nbselect==0) && isequal(get(currentobj,'Type'),'axes')) || isequal(currentobj,huvmat)
     364%         currentfig=get(currentobj,'parent');
     365%         figname=get(currentfig,'name');
     366%         eval(['global Data_' figname])
     367%         eval(['Data_' figname '=get(currentobj,''UserData'')']);
     368%         evalin('base',['global Data_' figname])%make CurData global in the workspace
     369%         objtype=get(currentobj,'Type');
     370%         display(['UserData of ' objtype ':'])
     371%         evalin('base',['Data_' figname]) %display CurData in the workspace
     372%         commandwindow %brings the Matlab command window to the front
     373%     end
    396374end
    397375
Note: See TracChangeset for help on using the changeset viewer.