Changeset 483 for trunk/src/mouse_up.m


Ignore:
Timestamp:
Jun 26, 2012, 11:50:19 PM (12 years ago)
Author:
sommeria
Message:

civ set to accept automatic input in the absence of PARAM.xml. Still problem with run time address
zoom improved to deal with elongated plots
better link between PIV and images in uvmat.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/mouse_up.m

    r444 r483  
    244244    xlim=get(currentaxes,'XLim');
    245245    ylim=get(currentaxes,'YLim');
    246  % if left mouse button has been pressed, zoom in by a factor of 2
     246    % if left mouse button has been pressed, zoom in by a factor of 2
    247247    if  isequal(get(currentfig,'SelectionType'),'normal');%if left button has been pressed, zoom in by a factor of 2
    248         xlim(1)=0.5*xy(1,1)+0.5*xlim(1);
    249         xlim(2)=0.5*xy(1,1)+0.5*xlim(2);%double the field whith the middle at the selected points
    250         set(currentaxes,'XLim',xlim)
    251         ylim(2)=0.5*xy(1,2)+0.5*ylim(2);
    252         ylim(1)=0.5*xy(1,2)+0.5*ylim(1);
    253         set(currentaxes,'YLim',ylim)
    254  % if right mouse button has been pressed, zoom out by a factor of 2
     248        PlotBoxAspectRatio=get(currentaxes,'PlotBoxAspectRatio');
     249        yoverx=PlotBoxAspectRatio(2)/PlotBoxAspectRatio(1);
     250        if yoverx <2
     251            xlim(1)=0.5*xy(1,1)+0.5*xlim(1);
     252            xlim(2)=0.5*xy(1,1)+0.5*xlim(2);%double the field whith the middle at the selected points
     253            set(currentaxes,'XLim',xlim)
     254        end
     255        if yoverx >0.5
     256            ylim(2)=0.5*xy(1,2)+0.5*ylim(2);
     257            ylim(1)=0.5*xy(1,2)+0.5*ylim(1);
     258            set(currentaxes,'YLim',ylim)
     259        end
     260       
     261        % if right mouse button has been pressed, zoom out by a factor of 2
    255262    else
    256263        xlim(1)=2*xlim(1)-xy(1,1);% reverse of the zoom on action
     
    267274                ylim=AxeData.RangeY;
    268275            end
    269          % desactivate the zoom if the full field is visible within the axes
     276            % desactivate the zoom if the full field is visible within the axes
    270277            if isequal(xlim,AxeData.RangeX) && isequal(ylim,AxeData.RangeY)
    271278                set(hhuvmat.CheckZoom,'Value',0)
     
    323330%% finalising ruler
    324331if test_ruler
    325     set(hhuvmat.MenuRuler,'checked','off')%desable the ruler option in uvmat 
    326     xy=get(currentaxes,'CurrentPoint');% get the current mouse coordinates 
    327     RulerCoord=[AxeData.RulerCoord ;xy(1,1:2)];% append the recorded ruler origin to the current mouse coordinates 
     332    set(hhuvmat.MenuRuler,'checked','off')%desable the ruler option in uvmat
     333    xy=get(currentaxes,'CurrentPoint');% get the current mouse coordinates
     334    RulerCoord=[AxeData.RulerCoord ;xy(1,1:2)];% append the recorded ruler origin to the current mouse coordinates
    328335    RulerCoord=diff(RulerCoord,1);% coordiante difference between segment end and beginning
    329336    RulerCoord=RulerCoord(1)+i*RulerCoord(2);
Note: See TracChangeset for help on using the changeset viewer.