--- title: DOMRect slug: Web/API/DOMRect translation_of: Web/API/DOMRect ---
{{draft}}{{APIRef("Geometry Interfaces")}}
一个 DOMRect 代表一个矩形。
DOMRect 表示的盒子的类型由返回它的方法或属性指定。例如,WebVR API 的 {{domxref("VREyeParameters.renderRect")}} 指定了头戴式显示器的一只眼睛应该呈现的影像所在的 canvas 的视口。
它继承自它的父类,{{domxref("DOMRectReadOnly")}}。
{{InheritanceDiagram}}
DOMRect 对象。DOMRect 从其父类 {{domxref("DOMRectReadOnly")}} 继承属性。不同之处在于它们不再是只读的。
DOMRect 原点的 x 坐标。DOMRect 原点的 y 坐标。DOMRect 的宽度。DOMRect 的高度。DOMRect 的顶坐标值(与 y 具有相同的值,如果 height 为负值,则为 y + height 的值)。DOMRect 的右坐标值(与 x + width 具有相同的值,如果width 为负值,则为 x 的值)。DOMRect 的底坐标值(与 y + height 具有相同的值,如果 height 为负值,则为 y 的值)。DOMRect 的左坐标值(与 x 具有相同的值,如果 width 为负值,则为 x + width 的值)。DOMRect 从它的父类继承方法,{{domxref("DOMRectReadOnly")}}。
DOMRect 对象。| Specification | Status | Comment |
|---|---|---|
| {{SpecName('Geometry Interfaces', '#DOMRect', 'DOMRect')}} | {{Spec2('Geometry Interfaces')}} | Initial definition. |
{{Compat("api.DOMRect")}}