Table of Contents

Class DOMRect

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

A DOMRect describes the size and position of a rectangle.

[Value("DOMRect")]
public class DOMRect : DOMRectReadOnly
Inheritance
DOMRect
Inherited Members

Remarks

The type of box represented by the DOMRect is specified by the method or property that returned it. For example, GetBoundingClientRect() specifies the rectangle that bounds the content of the range using such objects.

It inherits from its parent, DOMRectReadOnly.

-DOMPoint

See also on MDN

Constructors

DOMRect()

public DOMRect()

DOMRect(double, double, double, double)

The DOMRect() constructor creates a new DOMRect object.

public DOMRect(double x = 0, double y = 0, double width = 0, double height = 0)

Parameters

x double
y double
width double
height double

Remarks

Properties

Height

The height property of the DOMRect interface represents the height of the rectangle. The value can be negative.

[Value("height")]
public double Height { get; set; }

Property Value

double

A double.

Remarks

Width

The width property of the DOMRect interface represents the width of the rectangle. The value can be negative.

[Value("width")]
public double Width { get; set; }

Property Value

double

A double.

Remarks

X

The x property of the DOMRect interface represents the x-coordinate of the rectangle, which is the horizontal distance between the viewport's left edge and the rectangle's origin.

[Value("x")]
public double X { get; set; }

Property Value

double

A double.

Remarks

When the rectangle's width is non-negative, the rectangle's horizontal origin is the viewport's left edge. If the width is negative, the rectangle's horizontal origin is the viewport's right edge.

-DOMRectReadOnly

See also on MDN

Y

The y property of the DOMRect interface represents the y-coordinate of the rectangle, which is the vertical distance between the viewport's top edge and the rectangle's origin.

[Value("y")]
public double Y { get; set; }

Property Value

double

A double.

Remarks

When the rectangle's height is non-negative, the rectangle's vertical origin is the viewport's top edge. If the height has a negative height, the rectangle's vertical origin is the viewport's bottom edge.

-DOMRectReadOnly

See also on MDN

Methods

FromRect(DOMRectInit)

The fromRect() static method of the
DOMRect object creates a new DOMRect
object with a given location and dimensions.

[Value("fromRect")]
public static DOMRect FromRect(DOMRectInit other = null)

Parameters

other DOMRectInit

Returns

DOMRect

An instance of DOMRect.

Remarks