DOMQuad

interface · experimental

interface DOMQuad

A DOMQuad is a collection of four DOMPoints defining the corners of an arbitrary quadrilateral. Returning DOMQuads lets getBoxQuads() return accurate information even when arbitrary 2D or 3D transforms are present. It has a handy bounds attribute returning a DOMRectReadOnly for those cases where you just want an axis-aligned bounding rectangle.

MDN

variable · experimental

var DOMQuad: { … }

A DOMQuad is a collection of four DOMPoints defining the corners of an arbitrary quadrilateral. Returning DOMQuads lets getBoxQuads() return accurate information even when arbitrary 2D or 3D transforms are present. It has a handy bounds attribute returning a DOMRectReadOnly for those cases where you just want an axis-aligned bounding rectangle.

MDN

Constructors

constructor

new DOMQuad(p1?: DOMPointInit, p2?: DOMPointInit, p3?: DOMPointInit, p4?: DOMPointInit): DOMQuad

Properties

p1

readonly p1: DOMPoint

The DOMQuad interface's p1 property holds the DOMPoint object that represents one of the four corners of the DOMQuad. When created from DOMQuad.fromRect(), it is the point (x, y).

MDN Reference

p2

readonly p2: DOMPoint

The DOMQuad interface's p2 property holds the DOMPoint object that represents one of the four corners of the DOMQuad. When created from DOMQuad.fromRect(), it is the point (x + width, y).

MDN Reference

p3

readonly p3: DOMPoint

The DOMQuad interface's p3 property holds the DOMPoint object that represents one of the four corners of the DOMQuad. When created from DOMQuad.fromRect(), it is the point (x + width, y + height).

MDN Reference

p4

readonly p4: DOMPoint

The DOMQuad interface's p4 property holds the DOMPoint object that represents one of the four corners of the DOMQuad. When created from DOMQuad.fromRect(), it is the point (x, y + height).

MDN Reference

prototype

prototype: DOMQuad

Methods

getBounds

getBounds(): DOMRect

The DOMQuad method getBounds() returns a DOMRect object representing the smallest rectangle that fully contains the DOMQuad object.

MDN Reference

toJSON

toJSON(): any

The DOMQuad method toJSON() returns a JSON representation of the DOMQuad object.

MDN Reference

fromQuad

fromQuad(other?: DOMQuadInit): DOMQuad

The fromQuad() static method of the DOMQuad interface returns a new DOMQuad object based on the provided set of coordinates in the shape of another DOMQuad object.

MDN Reference

fromRect

fromRect(other?: DOMRectInit): DOMQuad

The fromRect() static method of the DOMQuad interface returns a new DOMQuad object based on the provided set of coordinates in the shape of a DOMRect object.

MDN Reference