The DOMPointInit
dictionary is used to provide the values of the coordinates and perspective when creating and JSONifying a DOMPoint
or DOMPointReadOnly
object.
It's used as an input parameter to the DOMPoint
/DOMPointReadOnly
method fromPoint()
. It's used as the return value when calling toJSON()
.
DOMPointInit.x
DOMPointInit.y
DOMPointInit.z
DOMPointInit.w
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.
var pointDesc = { x: window.screenX, y: window.screenY, z: 5.0 }; var windTopLeft = DOMPoint.fromPoint(pointDesc);
Specification | Status | Comment |
---|---|---|
Geometry Interfaces Module Level 1 The definition of 'DOMPointReadOnly.fromPoint()' in that specification. | Candidate Recommendation | Initial definition |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | ? | No | 62 | No | ? | No |
x
|
? | No | 62 | No | ? | No |
y
|
? | No | 62 | No | ? | No |
z
|
? | No | 62 | No | ? | No |
w
|
? | No | 62 | No | ? | No |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | ? | ? | No | 62 | ? | No | ? |
x
|
? | ? | No | 62 | ? | No | ? |
y
|
? | ? | No | 62 | ? | No | ? |
z
|
? | ? | No | 62 | ? | No | ? |
w
|
? | ? | No | 62 | ? | No | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/DOMPointInit