AGK for Pascal
TAgkScene.ViewZoomCentered Property

Sets the zoom mode from top left corner (False) or centered (True).

class property ViewZoomCentered: Boolean;

By default the view zooms from its top left corner, maintaining the views offset in world coodinates. For example a view with an offset of 20,20 will maintain its top left corner at 20,20 in world coordinates no matter what zoom value is given. However, centered zoom keeps the center of the view stationary whilst scaling everything else around it, making the offset value more difficult to judge. In this mode the top left corner will only be at 20,20 when the zoom value is 1.0, for other zoom values the top left corner will be scaled away from the offset point. For example, assume a world size of 100,100 units, a zoom level of 1.0, and a view offset of 0,0. The view will be displaying world coordinates 0,0 (its top left corner) to 100,100 (at its bottom right corner), with a zoom value of 2.0 and top left zooming the view will now show world coordinates 0,0 to 50,50 in the same space making everything look bigger. In centered zooming the view would instead show 25,25 to 75,75 maintaining the center of the view over the point 50,50 in world coordinates.

Copyright (c) 2012. All rights reserved.