www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtools/@exprview/zoomToFit.m
function zoomToFit(obj) %ZOOMTOFIT Set zoom factor so that the entire display is shown % % ZOOMTOFIT(OBJ) calculates and applies the zoom factor that will result % in the entire expression chain being viewed in the object. % Copyright 2000-2004 The MathWorks, Inc. and Ford Global Technologies, Inc. if isnull(obj.RootExpression) obj.ZoomFactor = 1; return end % Get the available viewing rectangle, allowing room for the scrollbars viewPort = obj.Position(3:4) - [17 17]; scales = viewPort./obj.CanvasSize; obj.ZoomFactor = min(scales);