Changeset 221 for trunk/src/mouse_up.m
- Timestamp:
- Mar 12, 2011, 11:11:01 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/mouse_up.m
r210 r221 201 201 map=colormap(currentaxes); 202 202 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]); 204 204 set(hfig2,'Unit','normalized') 205 205 set(hfig2,'KeyPressFcn',{@keyboard_callback,handles})%set keyboard action function … … 229 229 set(hcol_new,'Yticklabel',YTicklabel); 230 230 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)]) 245 239 set(AxeData.ZoomAxes,'UserData',ChildAxeData);%update the AxeData of the new axes 246 240 end … … 253 247 xlim=get(currentaxes,'XLim'); 254 248 ylim=get(currentaxes,'YLim'); 249 % if left mouse button has been pressed, zoom in by a factor of 2 255 250 if isequal(get(currentfig,'SelectionType'),'normal');%if left button has been pressed, zoom in by a factor of 2 256 251 xlim(1)=0.5*xy(1,1)+0.5*xlim(1); … … 260 255 ylim(1)=0.5*xy(1,2)+0.5*ylim(1); 261 256 set(currentaxes,'YLim',ylim) 262 %zoom out by a factor of 2 out when the right mouse button has been used263 else %if isequal(get(currentfig,'SelectionType'),'alt'); %if right button has been pressed257 % if right mouse button has been pressed, zoom out by a factor of 2 258 else 264 259 xlim(1)=2*xlim(1)-xy(1,1); 265 260 xlim(2)=2*xlim(2)-xy(1,1); 266 261 ylim(1)=2*ylim(1)-xy(1,2); 267 262 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;270 263 if isfield(AxeData,'RangeX')&& isfield(AxeData,'RangeY') 264 'TESTup' 265 AxeData 271 266 xlim(1)=max(AxeData.RangeX(1),xlim(1)); 272 267 xlim(2)=min(AxeData.RangeX(2),xlim(2)); 273 268 ylim(1)=max(AxeData.RangeY(1),ylim(1)); 274 269 ylim(2)=min(AxeData.RangeY(2),ylim(2)); 270 % desactivate the zoom if the full field is visible within the axes 275 271 if isequal(xlim,AxeData.RangeX) && isequal(ylim,AxeData.RangeY) 276 272 set(hhuvmat.zoom,'Value',0) … … 280 276 end 281 277 end 278 xlim 279 ylim 282 280 set(currentaxes,'XLim',xlim) 283 281 set(currentaxes,'YLim',ylim) … … 287 285 end 288 286 end 289 % if isfield(AxeData,'ParentRect')% update the position of the parent rectangle represneting the field290 % 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)296 287 if isfield(AxeData,'LimEditBox')&& AxeData.LimEditBox% update display of the GUI containing the axis (uvmat or view_field) 297 288 set(hhcurrentfig.MinX,'String',num2str(xlim(1))) … … 327 318 Tabchar=[Tabchar ;{'......'}]; 328 319 set(h_ListCoord,'String',Tabchar) 329 % coord_str=Coord{index_point}; %current line (string)330 % k=findstr('|',coord_str);%find separator indices on the string331 % blanks=blank332 % xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates333 % if numel(k)>=3334 % 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 coord335 % else336 % coord_str=[ ' | ' ' | ' ' | ' num2str(xy(1,1),4) ' | ' num2str(xy(1,2),4)];337 % end338 % Coord{index_point}=coord_str;339 % set(h_ListCoord,'String',Coord)340 % data=read_geometry_calib(Coord);%transform char cell to numbers341 320 set(hh,'XData',data.Coord(:,4)) 342 321 set(hh,'YData',data.Coord(:,5)) … … 344 323 end 345 324 end 346 347 325 348 326 %% finalising ruler … … 383 361 currentobj=gco;%default 384 362 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 workspace391 objtype=get(currentobj,'Type');392 display(['UserData of ' objtype ':'])393 evalin('base',['Data_' figname]) %display CurData in the workspace394 commandwindow %brings the Matlab command window to the front395 end363 % 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 396 374 end 397 375
Note: See TracChangeset
for help on using the changeset viewer.