CanvasViewportTransform class
Transform for drawing using a canvas context. Y-flip is permanently set to true.
- Inheritance
-
- Object
- ViewportTransform
- CanvasViewportTransform
Constructors
- CanvasViewportTransform(Vector2 extents, Vector2 center)
- Constructs a new viewport transform with the default scale.
Properties
- center → Vector2
-
center of the viewport.
finalinherited
- extents → Vector2
-
This is the half-width and half-height.
This should be the actual half-width and
half-height, not anything transformed or scaled.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scale ↔ double
-
Returns the scaling factor used in converting from world sizes to
rendering sizes.
getter/setter pairinherited
- translation ↔ Vector2
-
The current translation is the difference in canvas units between the
actual center of the canvas and the currently specified center. For
example, if the actual canvas center is (5, 5) but the current center is
(6, 6), the translation is (1, 1).
getter/setter pairinherited
- yFlip ↔ bool
-
if we flip the y axis when transforming.
getter/setter pairinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
screenToWorld(
Vector2 argScreen) → Vector2 -
Takes the screen coordinates and return the corresponding world
coordinates.
inherited
-
setCamera(
double x, double y, double s) → void -
Sets the transform's center to the given x and y coordinates,
and using the given scale.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
updateTransformation(
CanvasRenderingContext2D ctx) → void - Sets the rendering context such that all drawing commands given in terms of the world coordinate system will display correctly on the canvas screen.
-
worldToScreen(
Vector2 argWorld) → Vector2 -
Takes the world coordinates and return the corresponding screen
coordinates.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- defaultDrawingScale → const double