Rect SceneRect { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The SceneRect property of the Editor.GraphicsView class represents the rectangular area of the scene that is currently being viewed. This property is of type Sandbox.Rect, which defines the dimensions and position of the rectangle in the scene's coordinate space.

Usage

Use the SceneRect property to get or set the current viewable area of the scene within the GraphicsView. This can be useful for operations such as zooming, panning, or fitting specific items within the view.

To modify the viewable area, you can assign a new Sandbox.Rect to the SceneRect property. This will adjust the visible portion of the scene accordingly.

Example

// Example of setting the SceneRect property
GraphicsView graphicsView = new GraphicsView();
Sandbox.Rect newSceneRect = new Sandbox.Rect(0, 0, 100, 100);
graphicsView.SceneRect = newSceneRect;

// Example of getting the SceneRect property
Sandbox.Rect currentSceneRect = graphicsView.SceneRect;
Console.WriteLine($"Current Scene Rect: {currentSceneRect}");