DOMRect.fromRect()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.

DOMRect 객체의 fromRect() 정적 메서드는 주어진 좌표와 크기를 가진 새로운 DOMRect 객체를 반환합니다.

구문

js
DOMRect.fromRect(rectangle);

매개변수

rectangle Optional

직사각형의 위치와 크기를 지정하는 객체입니다. 모든 속성의 기본 값은 0입니다. 포함할 수 있는 속성은 다음과 같습니다.

  • x: 직사각형 왼쪽 모서리의 좌표입니다.
  • y: 직사각형 위쪽 모서리의 좌표입니다.
  • width: 직사각형의 너비입니다.
  • height: 직사각형의 높이입니다.

반환 값

DOMRect 인스턴스.

명세

Specification
Geometry Interfaces Module Level 1
# dom-domrect-fromrect

브라우저 호환성

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
fromRect() static method

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support