Class DOMPointReadOnly
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
The DOMPointReadOnly interface specifies the coordinate and perspective fields used by DOMPoint to define a 2D or 3D point in a coordinate system.
[Value("DOMPointReadOnly")]
public class DOMPointReadOnly
- Inheritance
-
DOMPointReadOnly
- Derived
- Inherited Members
Remarks
There are two ways to create a new DOMPointReadOnly instance. First, you can use its constructor, passing in the values of the parameters for each dimension and, optionally, the perspective:
The other option is to use the static FromPoint(DOMPointInit) method:
Constructors
DOMPointReadOnly()
public DOMPointReadOnly()
DOMPointReadOnly(double, double, double, double)
The DOMPointReadOnly()
constructor returns a new DOMPointReadOnly object representing a point
in 2D or 3D space, optionally with perspective, whose values cannot be altered by
script code.
public DOMPointReadOnly(double x = 0, double y = 0, double z = 0, double w = 0)
Parameters
Remarks
Properties
W
The DOMPointReadOnly interface'sw property holds the point's perspective value,w, for a read-only point in space.
[Value("w")]
public double W { get; }
Property Value
- double
A double-precision floating-point value indicating the
wperspective value
for the point. This value is unrestricted, meaning that it is allowed
to be infinite or invalid (that is, its value may be GlobalObject.NaN or
GlobalObject.Infinity). The default is1.0.
Remarks
If your script needs to be able
to change the value of this property, you should instead use the DOMPoint
object.
X
The DOMPointReadOnly interface'sx property holds the horizontal coordinate, x, for a
read-only point in space. This property cannot be changed by JavaScript code in this
read-only version of the DOMPoint object.
[Value("x")]
public double X { get; }
Property Value
- double
A double-precision floating-point value indicating the x coordinate's value for the
point. This value is unrestricted, meaning that it is allowed to be
infinite or invalid (that is, its value may be GlobalObject.NaN or GlobalObject.Infinity).
Remarks
In general, positive values x mean to the right, and negative values ofx means to the left, assuming no transforms have resulted in a reversal.
-The other coordinate properties: Y,
Z, and the perspective value,
W.
Y
The DOMPointReadOnly interface'sy property holds the vertical coordinate, y, for a
read-only point in space.
[Value("y")]
public double Y { get; }
Property Value
- double
A double-precision floating-point value indicating the y coordinate's value for the
point. This value is unrestricted, meaning that it is allowed to be
infinite or invalid (that is, its value may be GlobalObject.NaN or GlobalObject.Infinity).
Remarks
If your script needs to be able to change the value
of this property, you should instead use the DOMPoint object.
In general, positive values of y mean downward, and negative values ofy mean upward, assuming no transforms have resulted in a reversal.
-The other coordinate properties: X,
Z, and the perspective value,
W.
Z
The DOMPointReadOnly interface'sz property holds the depth coordinate, z, for a
read-only point in space.
[Value("z")]
public double Z { get; }
Property Value
- double
A double-precision floating-point value indicating the z coordinate's value for the
point. This value is unrestricted, meaning that it is allowed to be
infinite or invalid (that is, its value may be GlobalObject.NaN or GlobalObject.Infinity).
Remarks
If your script needs to be able to change the value
of this property, you should instead use the DOMPoint object.
In general, positive values of z mean toward the user (out from the
screen), and negative values of z mean away from the user (into the
screen), assuming no transforms have resulted in a reversal.
-The other coordinate properties: X,
Y, and the perspective value,
W.
Methods
FromPoint(DOMPointInit)
The static DOMPointReadOnly
method fromPoint() creates and returns a newDOMPointReadOnly object given a source point.
[Value("fromPoint")]
public static DOMPointReadOnly FromPoint(DOMPointInit other = null)
Parameters
otherDOMPointInit
Returns
- DOMPointReadOnly
A new DOMPointReadOnly object (which is identical to the source point).
Remarks
You can also create a new DOMPointReadOnly object using the
DOMPointReadOnly(double, double, double, double) constructor.
MatrixTransform(DOMMatrixInit)
The matrixTransform() method of the DOMPointReadOnly interface applies a matrix transform specified as an object to the DOMPointReadOnly object, creating and returning a new DOMPointReadOnly object. Neither the matrix nor the point are altered.
[Value("matrixTransform")]
public DOMPoint MatrixTransform(DOMMatrixInit matrix = null)
Parameters
matrixDOMMatrixInit
Returns
Remarks
If the matrix passed as a parameter is 2D (the DOMMatrixReadonly.Is2D is true) then this is a 2D transformation and the point's z coordinate will be 0 and point's w perspective will be 1. Otherwise this is a 3D transformation.
You can also create a new DOMPoint with a point and matrix with the TransformPoint(DOMPointInit) method.
-DOMPoint
-DOMMatrix
-TransformPoint(DOMPointInit)
-CSS transform-function/matrix and transform-function/matrix3d functions
ToJSON()
The DOMPointReadOnly methodtoJSON() returns an object giving the
JSON form of the point object.
[Value("toJSON")]
public Object ToJSON()
Returns
- Object
A new object whose properties are set to the values in the
DOMPointorDOMPointReadOnlyon which the method was called.