Description
The FitInView
method is a member of the Editor.GraphicsView
class. It adjusts the view to ensure that the specified rectangle, defined by the Sandbox.Rect
parameter, is fully visible within the current view. This method is useful for automatically zooming and panning the view to focus on a particular area of interest within the scene.
Usage
To use the FitInView
method, you need to have an instance of the Editor.GraphicsView
class. You can then call this method with a Sandbox.Rect
object that defines the area you want to fit within the view.
Ensure that the rect
parameter accurately represents the area you wish to focus on. The method will adjust the view's zoom and position to make the entire rectangle visible.
Example
// Assuming 'graphicsView' is an instance of Editor.GraphicsView
Sandbox.Rect targetRect = new Sandbox.Rect(0, 0, 100, 100);
graphicsView.FitInView(targetRect);