DOMPointInit
dictionary is used to provide the values of the coordinates and perspective when creating and JSONifying a
DOMPoint
or
DOMPointReadOnly
对象。
It's used as an input parameter to the
DOMPoint
/
DOMPointReadOnly
方法
fromPoint()
. It's used as the return value when calling
toJSON()
.
DOMPointInit.x
x
-coordinate of the point in space. This is generally the horizontal coordinate, with positive values being to the right and negative values to the left. The default value is
0
.
DOMPointInit.y
y
-coordinate. This is the vertical coordinate, and barring any transforms applied to the coordinate system, positive values are downward and negative values upward toward the top of the screen. The default is
0
.
DOMPointInit.z
z
-coordinate, which is (assuming no transformations that alter the situation) the depth coordinate; positive values are closer to the user and negative values retreat back into the screen. The default value is
0
.
DOMPointInit.w
w
perspective value, given as an unrestricted floating-point number. The default is
1
.
This example creates a new
DOMPoint
representing the top-left corner of the current window, with a
z
component added to move the point closer to the user. This same code will work to create a
DOMPointReadOnly
object; just change the interface name in the code.
const pointDesc = {
x: window.screenX,
y: window.screenY,
z: 5.0
};
const windTopLeft = DOMPoint.fromPoint(pointDesc)
| 规范 | 状态 | 注释 |
|---|---|---|
|
Geometry Interfaces Module Level 1
The definition of 'DOMPointReadOnly.fromPoint()' in that specification. |
候选推荐 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
DOMPointInit
|
Chrome ? | Edge ? | Firefox 62 | IE No | Opera ? | Safari No | WebView Android ? | Chrome Android ? | Firefox Android 62 | Opera Android ? | Safari iOS No | Samsung Internet Android ? |
w
|
Chrome ? | Edge ? | Firefox 62 | IE No | Opera ? | Safari No | WebView Android ? | Chrome Android ? | Firefox Android 62 | Opera Android ? | Safari iOS No | Samsung Internet Android ? |
x
|
Chrome ? | Edge ? | Firefox 62 | IE No | Opera ? | Safari No | WebView Android ? | Chrome Android ? | Firefox Android 62 | Opera Android ? | Safari iOS No | Samsung Internet Android ? |
y
|
Chrome ? | Edge ? | Firefox 62 | IE No | Opera ? | Safari No | WebView Android ? | Chrome Android ? | Firefox Android 62 | Opera Android ? | Safari iOS No | Samsung Internet Android ? |
z
|
Chrome ? | Edge ? | Firefox 62 | IE No | Opera ? | Safari No | WebView Android ? | Chrome Android ? | Firefox Android 62 | Opera Android ? | Safari iOS No | Samsung Internet Android ? |
完整支持
不支持
兼容性未知
实验。期望将来行为有所改变。
DOMPointInit
AbortController
AbortSignal
AbstractRange
Attr
ByteString
CDATASection
CSSPrimitiveValue
CSSValue
CSSValueList
CharacterData
ChildNode
注释
CustomEvent
DOMConfiguration
DOMError
DOMErrorHandler
DOMException
DOMImplementation
DOMImplementationList
DOMImplementationRegistry
DOMImplementationSource
DOMLocator
DOMObject
DOMParser
DOMPoint
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