Constructors
Fields
Properties
ControlMidPoint
#public PointF ControlMidPoint { get; }
Gets the point in the exact center of the viewport in control coordinates.
Height
#Gets or sets the height of the viewport. Typically this is tied to the dimensions of the canvas. Height is not allowed to go below 5 pixels.
MidPoint
#public PointF MidPoint { get; set; }
Gets or sets the canvas coordinate that is directly underneath the center of the viewport.
ScreenPort
#public Rectangle ScreenPort { get; }
Gets the dimensions of the viewport in control coordinates.
Size
#public Size Size { get; set; }
Gets or sets the size of the viewport. The size is typically tied to the dimensions of the Canvas.
Target
#public Point Target { get; set; }
Gets or sets the location of the target pixel. The target represents where the canvas origin is drawn.
TargetRatio
#public SizeF TargetRatio { get; set; }
Gets or sets the target ratio with respect to the viewport dimensions. This is a useful tool to prevent weird view changes during a canvas resize.
Tx
#Gets or sets the x-component of the target pixel. The target represents where the canvas origin is drawn.
Ty
#Gets or sets the y-component of the target pixel. The target represents where the canvas origin is drawn.
Width
#Gets or sets the width of the viewport. Typically this is tied to the dimensions of the canvas. Width is not allowed to go below 5 pixels.
Methods
ApplyProjection
#Apply the current display transformation to a Graphics object.
Parameters:
| G (Graphics) |
DollyZoom
#Advanced interface function for mouse 'dolly' zooming.
Parameters:
| e (GH_CanvasMouseEvent) | Event arguments. |
Returns: True if a change to the viewport was made, otherwise false.
Duplicate
#Focus
#Look at a set of specific objects.
Parameters:
| attributes (List<IGH_Attributes>) | Object attributes to focus on. |
IsVisible
#Test visibility of a point.
IsVisible
#Test visibility of a rectangle.
Parameters:
| rec (ref RectangleF) | Rectangle in canvas coordinates. |
| margin (float = 0) | Fuzzy area around rectangle to test. |
Returns: True if the rectangle is visible in the control upon projection.
LimitUnit
#Utility function for calculating pixel dimensions in a zoom-aware environment. The desired value is put through the zoom projection and if the resulting size (as displayed on the screen) exceeds the visual limits it is clipped. This function can be used for example to make sure that a certain penwidth never exceeds visual limits (i.e. it doesn't get too thin or too thick on the screen).
Project
#public void Project(ref PointF pt)
Transform a point from canvas into control coordinate space.
Parameters:
| pt (ref PointF) | Point to transform. |
ProjectPoint
#public PointF ProjectPoint(PointF pt)
Project a point from canvas coordinates into control coordinates.
Parameters:
| pt (PointF) | The point in canvas coordinates. |
Returns: The associated point in control pixel coordinates.
ProjectRectangle
#Project a rectangle from canvas coordinates into control coordinates.
Parameters:
| rec (RectangleF) | The rectangle in canvas coordinates. |
Returns: The associated rectangle in control pixel coordinates.
ProjectX
#Project a value along constant X from canvas coordinates into control coordinates.
Parameters:
| x (float) | The constant X value in canvas coordinates. |
Returns: The associated X value in control pixel coordinates.
ProjectY
#Project a value along constant Y from canvas coordinates into control coordinates.
Parameters:
| y (float) | The constant Y value in canvas coordinates. |
Returns: The associated Y value in control pixel coordinates.
SolveUnit
#Utility function for calculating graphics dimensions in a zoom-aware environment. This function can be used for example to compute the linewidth of a pen which always needs to appear as 3 pixels thick on the screen regardless of zoom values.
Unproject
#public void Unproject(ref PointF pt)
Transform a point from control into canvas coordinate space.
Parameters:
| pt (ref PointF) | Point to transform. |
UnprojectPoint
#public PointF UnprojectPoint(PointF pt)
Project a point from control coordinates into canvas coordinates.
Parameters:
| pt (PointF) | The point in control coordinates. |
Returns: The associated point in canvas coordinates.
UnprojectRectangle
#Project a rectangle from control coordinates into canvas coordinates.
Parameters:
| rec (RectangleF) | The rectangle in control coordinates. |
Returns: The associated rectangle in canvas coordinates.
UnprojectX
#Project a value along constant X from control coordinates into canvas coordinates.
Parameters:
| x (float) | The constant X value in control coordinates. |
Returns: The associated X value in canvas coordinates.
UnprojectY
#Project a value along constant Y from control coordinates into canvas coordinates.
Parameters:
| y (float) | The constant Y value in control coordinates. |
Returns: The associated Y value in canvas coordinates.
XFormMatrix
#Gets the display transformation cached by this viewport.
Parameters:
| projection (GH_Viewport.GH_DisplayMatrix) |