new xrx.viewbox.Viewbox(drawing)
A class representing the view-box of a drawing canvas.
Parameters:
Name | Type | Description |
---|---|---|
drawing |
xrx.drawing.Drawing | The parent drawing object. |
Extends
Members
-
(private) xrx.viewbox.Viewbox#ctm_ :xrx.viewbox.FastAffineTransform
-
The current transformation matrix of this viewbox.
Type:
- Inherited From:
- Source:
-
(private) xrx.viewbox.Viewbox#drawing_ :xrx.drawing.Drawing
-
The parent drawing object.
Type:
-
(private) xrx.viewbox.Viewbox#FixPoints_
-
- Inherited From:
- Source:
-
(private) xrx.viewbox.Viewbox#group_
-
The group where matrix transformations are applied to. {xrx.shape.Group}
-
(private) xrx.viewbox.Viewbox#origin_ :Array.<number>
-
The last mouse point. This member is used when dragging or panning the view-box.
Type:
- Array.<number>
-
(private) xrx.viewbox.Viewbox#state_ :number
-
The state of the drawing canvas, either DRAG or NONE.
Type:
- number
-
(private) xrx.viewbox.Viewbox#zoomFactor_ :number
-
The current zoom factor, defaults to .1.
Type:
- number
- Inherited From:
- Source:
-
(private) xrx.viewbox.Viewbox#zoomMax_ :number
-
The maximum zoom value, defaults to 2.
Type:
- number
- Inherited From:
- Source:
-
(private) xrx.viewbox.Viewbox#zoomMin_ :number
-
The minimum zoom value, defaults to 0.1.
Type:
- number
- Inherited From:
- Source:
Methods
-
(private) xrx.viewbox.Viewbox#center()
-
Translates the view-box to the center of the drawing canvas.
- Inherited From:
- Source:
-
(private) xrx.viewbox.Viewbox#centerHorizontally()
-
Translates the view-box to the horizontal center of the drawing canvas.
- Inherited From:
- Source:
-
(private) xrx.viewbox.Viewbox#centerVertically()
-
Translates the view-box to the vertical center of the drawing canvas.
- Inherited From:
- Source:
-
(private) xrx.viewbox.Viewbox#containsPoint(point)
-
Whether a point is contained in this view-box.
Parameters:
Name Type Description point
Array.<number> The native point, without translation. - Inherited From:
- Source:
-
xrx.viewbox.Viewbox#ctmDump() → {Array.<number>}
-
Returns a dump of the current transformation matrix as an array.
- Inherited From:
- Source:
Returns:
The number array.- Type
- Array.<number>
-
xrx.viewbox.Viewbox#ctmRestore(dump)
-
Restores the current transformation matrix from an array.
Parameters:
Name Type Description dump
Array.<number> The number array. - Inherited From:
- Source:
-
(private) xrx.viewbox.Viewbox#direction_() → {number}
-
Returns a positional utility number representing the current orientation of the view-box.
- Inherited From:
- Source:
Returns:
The orientation.- Type
- number
-
xrx.viewbox.Viewbox#disposeInternal()
-
Disposes this view-box.
-
xrx.viewbox.Viewbox#fit(opt_center)
-
Makes the whole view-box visible and optionally centers it.
Parameters:
Name Type Description opt_center
boolean Whether to also center the canvas, defaults to true. - Inherited From:
- Source:
-
xrx.viewbox.Viewbox#fitToHeight(opt_center)
-
Makes the whole height of the view-box visible and optionally centers it.
Parameters:
Name Type Description opt_center
boolean Whether to also center the canvas, defaults to true. - Inherited From:
- Source:
-
xrx.viewbox.Viewbox#fitToWidth(opt_center)
-
Makes the whole width of the view-box visible and optionally centers it.
Parameters:
Name Type Description opt_center
boolean Whether to also center the canvas, defaults to true. - Inherited From:
- Source:
-
(private) xrx.viewbox.Viewbox#getBox() → {goog.math.Box}
-
Returns the bounding-box for this view-box, respecting transformation.
- Inherited From:
- Source:
Returns:
The bounding box, coordinates are the visibles and are transformed.- Type
- goog.math.Box
-
(private) xrx.viewbox.Viewbox#getCenterPoint_()
-
- Inherited From:
- Source:
-
xrx.viewbox.Viewbox#getCTM() → {xrx.viewbox.FastAffineTransform}
-
Returns the current transformation matrix of this view-box.
- Inherited From:
- Source:
Returns:
The transformation matrix. -
(private) xrx.viewbox.Viewbox#getDrawing() → {xrx.drawing.Drawing}
-
Returns the parent drawing object of the view-box.
Returns:
The drawing object.- Type
- xrx.drawing.Drawing
-
(private) xrx.viewbox.Viewbox#getFixPoint_()
-
- Inherited From:
- Source:
-
(private) xrx.viewbox.Viewbox#getFixPoints_()
-
- Inherited From:
- Source:
-
(private) xrx.viewbox.Viewbox#getGroup() → {xrx.shape.Group}
-
Returns the group of the view-box.
Returns:
The group.- Type
- xrx.shape.Group
-
(private) xrx.viewbox.Viewbox#getHeight(opt_transformed, opt_visible) → {number}
-
Returns the height of this view-box, optionally the transformed height (respecting the current scale) and / or the visible height (respecting the current rotation).
Parameters:
Name Type Description opt_transformed
boolean Whether to return the transformed height respecting the current scale. opt_visible
boolean Whether to return the visible height respecting the current rotation. - Inherited From:
- Source:
Returns:
The height.- Type
- number
-
(private) xrx.viewbox.Viewbox#getPivotPoint_()
-
- Inherited From:
- Source:
-
(private) xrx.viewbox.Viewbox#getPivotPoints_(reverse) → {Array.<number>}
-
Returns the four pivot points of this view-box.
Parameters:
Name Type Description reverse
boolean If we rotate in right or left direction. If reverse is true we assume left direction otherwise right direction. - Inherited From:
- Source:
Returns:
- Type
- Array.<number>
-
xrx.viewbox.Viewbox#getRotation() → {number}
-
Returns the current rotation in degrees.
- Inherited From:
- Source:
Returns:
The current rotation in degrees.- Type
- number
-
(private) xrx.viewbox.Viewbox#getVisibleOrientation_()
-
- Inherited From:
- Source:
-
(private) xrx.viewbox.Viewbox#getWidth(opt_transformed, opt_visible) → {number}
-
Returns the width of this view-box, optionally the transformed width (respecting the current scale) and / or the visible width (respecting the current rotation).
Parameters:
Name Type Description opt_transformed
boolean Whether to return the transformed width respecting the current scale. opt_visible
boolean Whether to return the visible width respecting the current rotation. - Inherited From:
- Source:
Returns:
The width.- Type
- number
-
xrx.viewbox.Viewbox#getZoomFactor() → {number}
-
Returns the current zoom factor, defaults to .1.
- Inherited From:
- Source:
Returns:
The zoom factor.- Type
- number
-
xrx.viewbox.Viewbox#getZoomMax() → {number}
-
Returns the current maximum zoom value.
- Inherited From:
- Source:
Returns:
The maximum zoom value.- Type
- number
-
xrx.viewbox.Viewbox#getZoomMin() → {number}
-
Returns the current minimum zoom value.
- Inherited From:
- Source:
Returns:
The minimum zoom value.- Type
- number
-
xrx.viewbox.Viewbox#getZoomStep(opt_zoomValuenullable) → {number}
-
Returns the current zoom step or the zoom step of a zoom value if opt_zoomValue is defined.
Parameters:
Name Type Attributes Description opt_zoomValue
number <nullable>
A zoom value. - Inherited From:
- Source:
Returns:
The zoom step.- Type
- number
-
xrx.viewbox.Viewbox#getZoomValue() → {number}
-
Returns the current zoom value.
- Inherited From:
- Source:
Returns:
- Type
- number
-
(private) xrx.viewbox.Viewbox#handleDblClick(offsetPoint)
-
Handles double-click events for the view-box.
Parameters:
Name Type Description offsetPoint
Array.<number> The offset point. -
(private) xrx.viewbox.Viewbox#handleDown(e, offsetPoint)
-
Handles mouse-down events for the view-box.
Parameters:
Name Type Description e
goog.events.BrowserEvent The browser event. offsetPoint
Array.<number> The offset point. -
(private) xrx.viewbox.Viewbox#handleMove(e, offsetPoint)
-
Handles mouse-move events for the view-box.
Parameters:
Name Type Description e
goog.events.BrowserEvent The browser event. offsetPoint
Array.<number> The offset point. -
(private) xrx.viewbox.Viewbox#handleOut(e)
-
Handles mouse-out events for the view-box.
Parameters:
Name Type Description e
goog.events.BrowserEvent The browser event. -
(private) xrx.viewbox.Viewbox#handleUp(e)
-
Handles mouse-up events for the view-box.
Parameters:
Name Type Description e
goog.events.BrowserEvent The browser event. -
(private) xrx.viewbox.Viewbox#handleWheel(offsetPoint)
-
Handles mouse-wheel events for the view-box.
Parameters:
Name Type Description offsetPoint
Array.<number> The offset point. -
(private) xrx.viewbox.Viewbox#isFixPoint_(fixPoint)
-
Whether the fix-point is a point, that is an Array of length 2.
Parameters:
Name Type Description fixPoint
? The fix-point. - Inherited From:
- Source:
-
(private) xrx.viewbox.Viewbox#isHorizontal() → {boolean}
-
Whether the view-box currently is in horizontal orientation.
- Inherited From:
- Source:
Returns:
Whether the view-box is oriented horizontally.- Type
- boolean
-
(private) xrx.viewbox.Viewbox#isOrientation_(fixPoint)
-
Whether the fix-point is an orientation, that is one of xrx.drawing.Orientation.*.
Parameters:
Name Type Description fixPoint
? The fix-point. - Inherited From:
- Source:
-
(private) xrx.viewbox.Viewbox#isValidRotation(rotation) → {boolean}
-
Checks whether the rotation value is valid.
Parameters:
Name Type Description rotation
number The rotation in degrees. - Inherited From:
- Source:
Returns:
Whether the rotation is valid.- Type
- boolean
-
(private) xrx.viewbox.Viewbox#isVertical() → {boolean}
-
Whether the view-box currently is in vertical orientation.
- Inherited From:
- Source:
Returns:
Whether the view-box is oriented vertically.- Type
- boolean
-
(private) xrx.viewbox.Viewbox#resetState_()
-
(private) xrx.viewbox.Viewbox#rotateBy(anglenullable, opt_fixPointnullable)
-
Rotates the view-box by an angle, respecting a fix-point or an orientation.
Parameters:
Name Type Attributes Description angle
number <nullable>
The angle of rotation in degrees, e.g. 90 or 180. opt_fixPoint
Array.<number> | string <nullable>
A fix-point or an orientation. Defaults to the center of the view-box. - Inherited From:
- Source:
-
(private) xrx.viewbox.Viewbox#rotateBy_(anglenullable, opt_orientationnullable, opt_fixPointnullable)
-
Rotates the view-box by an angle, respecting a fix-point or an orientation.
Parameters:
Name Type Attributes Description angle
number <nullable>
The angle of rotation in degrees, e.g. 90 or 180. opt_orientation
string <nullable>
An orientation, defaults to xrx.drawing.Orientation.C. opt_fixPoint
Array.<number> <nullable>
A fix-point, defaults to the center of the view-box. - Inherited From:
- Source:
-
xrx.viewbox.Viewbox#rotateLeft(opt_fixPointnullable)
-
Rotates the view-box by 90° in left direction, optionally respecting a fix-point or an orientation.
Parameters:
Name Type Attributes Description opt_fixPoint
Array.<number> | string <nullable>
The fix-point. - Inherited From:
- Source:
-
xrx.viewbox.Viewbox#rotateRight(opt_fixPointnullable)
-
Rotates the view-box by 90° in right direction, optionally respecting a fix-point or an orientation.
Parameters:
Name Type Attributes Description opt_fixPoint
Array.<number> | string <nullable>
The fix-point. - Inherited From:
- Source:
-
xrx.viewbox.Viewbox#setCTM(ctm)
-
Sets the current transformation matrix of the view-box.
Parameters:
Name Type Description ctm
xrx.viewbox.FastAffineTransform The matrix object. - Inherited From:
- Source:
-
xrx.viewbox.Viewbox#setPosition(position)
-
Translates the view-box to a certain position of the drawing canvas.
Parameters:
Name Type Description position
string A position as declared in {xrx.drawing.Position}. - Inherited From:
- Source:
-
xrx.viewbox.Viewbox#setZoomFactor(factor)
-
Sets a new zoom factor, e.g. 0.1.
Parameters:
Name Type Description factor
number The new zoom factor. - Inherited From:
- Source:
-
xrx.viewbox.Viewbox#setZoomFactorMax(value)
-
Sets the maximum zoom value.
Parameters:
Name Type Description value
number The maximum zoom value. - Inherited From:
- Source:
-
xrx.viewbox.Viewbox#setZoomFactorMin(value)
-
Sets the minimum zoom value.
Parameters:
Name Type Description value
number The minimum zoom value. - Inherited From:
- Source:
-
xrx.viewbox.Viewbox#translate(x, y)
-
Translates the view-box.
Parameters:
Name Type Description x
number The distance to translate in the x direction. y
number The distance to translate in the y direction. - Inherited From:
- Source:
-
xrx.viewbox.Viewbox#zoomIn(opt_fixPoint)
-
Zoom in on the view-box, optionally respecting a fix-point.
Parameters:
Name Type Description opt_fixPoint
Array.<number> A fix-point. - Inherited From:
- Source:
-
(private) xrx.viewbox.Viewbox#zoomOffset_()
-
- Inherited From:
- Source:
-
xrx.viewbox.Viewbox#zoomOut(opt_fixPoint)
-
Zoom out the view-box, optionally respecting a fix-point.
Parameters:
Name Type Description opt_fixPoint
Array.<number> A fix-point. - Inherited From:
- Source:
-
xrx.viewbox.Viewbox#zoomTo(zoomValue, opt_fixPointnullable)
-
Zooms the view-box to a value, optionally respecting a fix-point.
Parameters:
Name Type Attributes Description zoomValue
number The zoom value. opt_fixPoint
number <nullable>
A fix-point. - Inherited From:
- Source: