www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@xregGui/@imagePlayer/doPosition.m
function doPosition( obj ) %DOPOSITION Redraw the object in the correct position % % DOPOSITION(OBJ) % % Copyright 2000-2010 The MathWorks, Inc. and Ford Global Technologies, Inc. if obj.ExpandToFit % Allow the image object to expand to the imagePlayer position. pos = obj.Position; else % Keep the image object no bigger than the source image and centered % in the current imagePlayer position. if ishandle(obj.imageSource) imsz = obj.imageSource.imageSize; pos = obj.Position; if imsz(1)<pos(3) pos(1) = pos(1) + (pos(3)-imsz(1))*0.5; pos(3) = imsz(1); end if imsz(2)<pos(4) pos(2) = pos(2) + (pos(4)-imsz(2))*0.5; pos(4) = imsz(2); end else pos = obj.Position; end end pos(3:4) = max(pos(3:4),[1 1]); set(obj.imageObject, 'Position',pos);