Changeset 252 for trunk/src/mouse_up.m


Ignore:
Timestamp:
May 15, 2011, 11:17:08 PM (13 years ago)
Author:
sommeria
Message:

various bugs corrected.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/mouse_up.m

    r221 r252  
    250250    if  isequal(get(currentfig,'SelectionType'),'normal');%if left button has been pressed, zoom in by a factor of 2
    251251        xlim(1)=0.5*xy(1,1)+0.5*xlim(1);
    252         xlim(2)=0.5*xy(1,1)+0.5*xlim(2);
     252        xlim(2)=0.5*xy(1,1)+0.5*xlim(2);%double the field whith the middle at the selected points
    253253        set(currentaxes,'XLim',xlim)
    254254        ylim(2)=0.5*xy(1,2)+0.5*ylim(2);
     
    257257 % if right mouse button has been pressed, zoom out by a factor of 2
    258258    else
    259         xlim(1)=2*xlim(1)-xy(1,1);
     259        xlim(1)=2*xlim(1)-xy(1,1);% reverse of the zoom on action
    260260        xlim(2)=2*xlim(2)-xy(1,1);
    261261        ylim(1)=2*ylim(1)-xy(1,2);
    262262        ylim(2)=2*ylim(2)-xy(1,2);
    263263        if isfield(AxeData,'RangeX')&& isfield(AxeData,'RangeY')
    264             'TESTup'
    265             AxeData
    266264            xlim(1)=max(AxeData.RangeX(1),xlim(1));
    267265            xlim(2)=min(AxeData.RangeX(2),xlim(2));
    268266            ylim(1)=max(AxeData.RangeY(1),ylim(1));
    269267            ylim(2)=min(AxeData.RangeY(2),ylim(2));
     268            if ylim(1)>=ylim(2)|| xlim(1)>=xlim(2)
     269                xlim=AxeData.RangeX;
     270                ylim=AxeData.RangeY;
     271            end
    270272         % desactivate the zoom if the full field is visible within the axes
    271273            if isequal(xlim,AxeData.RangeX) && isequal(ylim,AxeData.RangeY)
     
    276278            end
    277279        end
    278         xlim
    279         ylim
    280280        set(currentaxes,'XLim',xlim)
    281281        set(currentaxes,'YLim',ylim)
Note: See TracChangeset for help on using the changeset viewer.