I volontari di MDN non hanno ancora tradotto questo articolo in Italiano. Unisciti a noi e traducilo tu stesso.
Puoi anche consultare l’articolo in English (US).

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().

Properties

DOMPointInit.x
An unrestricted floating-point value indicating the 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
An unrestricted floating-point number providing the point's 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
An unrestricted floating-point value which gives the point's 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
The point's w perspective value given as an unrestricted floating-point number. The default is 1.

Example

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);

Specifications

Specification Status Comment
Geometry Interfaces Module Level 1
The definition of 'DOMPointReadOnly.fromPoint()' in that specification.
Candidate Recommendation Initial definition

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic support
Experimental
Chrome ? Edge No support NoFirefox Full support 62IE No support NoOpera ? Safari No support NoWebView Android ? Chrome Android ? Edge Mobile No support NoFirefox Android Full support 62Opera Android ? Safari iOS No support NoSamsung Internet Android ?
x
Experimental
Chrome ? Edge No support NoFirefox Full support 62IE No support NoOpera ? Safari No support NoWebView Android ? Chrome Android ? Edge Mobile No support NoFirefox Android Full support 62Opera Android ? Safari iOS No support NoSamsung Internet Android ?
y
Experimental
Chrome ? Edge No support NoFirefox Full support 62IE No support NoOpera ? Safari No support NoWebView Android ? Chrome Android ? Edge Mobile No support NoFirefox Android Full support 62Opera Android ? Safari iOS No support NoSamsung Internet Android ?
z
Experimental
Chrome ? Edge No support NoFirefox Full support 62IE No support NoOpera ? Safari No support NoWebView Android ? Chrome Android ? Edge Mobile No support NoFirefox Android Full support 62Opera Android ? Safari iOS No support NoSamsung Internet Android ?
w
Experimental
Chrome ? Edge No support NoFirefox Full support 62IE No support NoOpera ? Safari No support NoWebView Android ? Chrome Android ? Edge Mobile No support NoFirefox Android Full support 62Opera Android ? Safari iOS No support NoSamsung Internet Android ?

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.

Tag del documento e collaboratori

Hanno collaborato alla realizzazione di questa pagina: Sheppy
Ultima modifica di: Sheppy,