DOMPoint()
constructor creates and returns a new
DOMPoint
object, given the values for some or all of its properties.
You can also create a
DOMPoint
通过调用
DOMPoint.fromPoint()
static function. That function accepts as input a
DOMPointInit
compatible object, including a
DOMPoint
or
DOMPointReadOnly
.
point = new DOMPoint(x, y, z, w);
x
可选
x
coordinate for the new
DOMPoint
.
y
可选
y
coordinate for the new
DOMPoint
.
z
可选
z
coordinate for the new
DOMPoint
.
w
可选
DOMPoint
.
此范例创建
DOMPoint
representing the top-left corner of the current window, then creates a second point based on the first, which is then offset by 100 pixels both vertically and horizontally.
var windTopLeft = new DOMPoint(window.screenX, window.screenY); var newTopLeft = DOMPoint.fromPoint(windTopLeft); newTopLeft.x += 100; newTopLeft.y += 100;
| 规范 | 状态 | 注释 |
|---|---|---|
|
Geometry Interfaces Module Level 1
The definition of 'DOMPoint()' in that specification. |
候选推荐 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
DOMPoint()
构造函数
|
Chrome 61 | Edge 79 | Firefox 31 | IE No | Opera 48 | Safari 10.1 | WebView Android 61 | Chrome Android 61 | Firefox Android 31 | Opera Android 45 | Safari iOS 10.3 | Samsung Internet Android 8.0 |
完整支持
不支持
实验。期望将来行为有所改变。
DOMPoint
DOMPoint()
AbortController
AbortSignal
AbstractRange
Attr
ByteString
CDATASection
CSSPrimitiveValue
CSSValue
CSSValueList
CharacterData
ChildNode
注释
CustomEvent
DOMConfiguration
DOMError
DOMErrorHandler
DOMException
DOMImplementation
DOMImplementationList
DOMImplementationRegistry
DOMImplementationSource
DOMLocator
DOMObject
DOMParser
DOMPointInit
DOMPointReadOnly
DOMRect
DOMString
DOMTimeStamp
DOMTokenList
DOMUserData
Document
DocumentFragment
DocumentType
元素
ElementTraversal
Entity
EntityReference
事件
EventTarget
HTMLCollection
MutationObserver
节点
NodeFilter
NodeIterator
NodeList
NonDocumentTypeChildNode
ProcessingInstruction
PromiseResolver
范围
StaticRange
文本
TextDecoder
TextEncoder
TimeRanges
TreeWalker
TypeInfo
USVString
UserDataHandler
XMLDocument