Click or drag to resize

GH_Viewport Class

Provides functionality for panning and zooming in a GH_Canvas environment.
Inheritance Hierarchy
SystemObject
  Grasshopper.GUI.CanvasGH_Viewport

Namespace:  Grasshopper.GUI.Canvas
Assembly:  Grasshopper (in Grasshopper.dll)
Syntax
public sealed class GH_Viewport

The GH_Viewport type exposes the following members.

Constructors
  NameDescription
Public methodGH_Viewport
Initializes a new instance of the GH_Viewport class
Public methodGH_Viewport(GH_Viewport)
Initializes a new instance of the GH_Viewport class
Public methodGH_Viewport(Point)
Initializes a new instance of the GH_Viewport class
Public methodGH_Viewport(Point, Single)
Initializes a new instance of the GH_Viewport class
Top
Properties
  NameDescription
Public propertyControlMidPoint
Gets the point in the exact center of the viewport in control coordinates.
Public propertyDiagonal
Gets the length of the diagonal of the viewport in canvas coordinates.
Public propertyHeight
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.
Public propertyMidPoint
Gets or sets the canvas coordinate that is directly underneath the center of the viewport.
Public propertyScreenPort
Gets the dimensions of the viewport in control coordinates.
Public propertySize
Gets or sets the size of the viewport. The size is typically tied to the dimensions of the Canvas.
Public propertyTarget
Gets or sets the location of the target pixel. The target represents where the canvas origin is drawn.
Public propertyTargetRatio
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.
Public propertyTx
Gets or sets the x-component of the target pixel. The target represents where the canvas origin is drawn.
Public propertyTy
Gets or sets the y-component of the target pixel. The target represents where the canvas origin is drawn.
Public propertyVisibleRegion
Gets the rectangle in canvas coordinates that is visible in the control.
Public propertyWidth
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.
Public propertyZoom
Gets or sets the Zoom factor of the viewport. Please assign only sensible values.
Public propertyZoomBoolean
Sets the zoom of the viewport with a view anchor.
Public propertyZoomInverse
Gets the inverse of the zoom.
Top
Methods
  NameDescription
Public methodApplyProjection
Apply the current display transformation to a Graphics object.
Public methodComputeProjection
Forces a recomputation of all cached data.
Public methodDollyZoom
Advanced interface function for mouse 'dolly' zooming.
Public methodDuplicate
Public methodFocus(IGH_Attributes)
Look at a specific object.
Public methodFocus(ListIGH_Attributes)
Look at a set of specific objects.
Public methodFocus(Point)
Look at a specific point.
Public methodFocus(PointF)
Look at a specific point.
Public methodIsVisible(PointF, Single)
Test visibility of a point.
Public methodIsVisible(RectangleF, Single)
Test visibility of a rectangle.
Public methodLimitUnit
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).
Public methodProject
Transform a point from canvas into control coordinate space.
Public methodProjectPoint
Project a point from canvas coordinates into control coordinates.
Public methodProjectRectangle
Project a rectangle from canvas coordinates into control coordinates.
Public methodProjectX
Project a value along constant X from canvas coordinates into control coordinates.
Public methodProjectY
Project a value along constant Y from canvas coordinates into control coordinates.
Public methodSet
Public methodSolveUnit
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.
Public methodUnproject
Transform a point from control into canvas coordinate space.
Public methodUnprojectPoint
Project a point from control coordinates into canvas coordinates.
Public methodUnprojectRectangle
Project a rectangle from control coordinates into canvas coordinates.
Public methodUnprojectX
Project a value along constant X from control coordinates into canvas coordinates.
Public methodUnprojectY
Project a value along constant Y from control coordinates into canvas coordinates.
Public methodXFormMatrix
Gets the display transformation cached by this viewport.
Top
Fields
See Also