Touch

Touch 介面表示了一個於觸控裝置上接觸的單一觸碰點。觸碰點通常是由手指或觸控筆所接觸,而裝置可能為觸控螢幕或觸控板。

Touch.radiusX (en-US)Touch.radiusY (en-US)Touch.rotationAngle (en-US) 描述了使用者與螢幕之間接觸的區域—觸碰區(touch area),這對處理不精確的指向設備(如手指)來說相當有幫助。這些數值被用來描述一個盡可能與整個接觸面積相匹配的橢圓(如使用者的指尖)。 實驗性質

備註: Many of the properties' values are hardware-dependent; for example, if the device doesn't have a way to detect the amount of pressure placed on the surface, the force value will always be 0. This may also be the case for radiusX and radiusY; if the hardware reports only a single point, these values will be 1.

建構式

Touch() (en-US) 實驗性質

Creates a Touch object.

屬性

This interface has no parent, and doesn't inherits or implements any other property.

基本屬性

Touch.identifier (en-US) Read only

Returns a unique identifier for this Touch object. A given touch point (say, by a finger) will have the same identifier for the duration of its movement around the surface. This lets you ensure that you're tracking the same touch all the time.

Touch.screenX (en-US) Read only

Returns the X coordinate of the touch point relative to the left edge of the screen.

Touch.screenY (en-US) Read only

Returns the Y coordinate of the touch point relative to the top edge of the screen.

Touch.clientX (en-US) Read only

Returns the X coordinate of the touch point relative to the left edge of the browser viewport, not including any scroll offset.

Touch.clientY (en-US) Read only

Returns the Y coordinate of the touch point relative to the top edge of the browser viewport, not including any scroll offset.

Touch.pageX (en-US) Read only

Returns the X coordinate of the touch point relative to the left edge of the document. Unlike clientX, this value includes the horizontal scroll offset, if any.

Touch.pageY (en-US) Read only

Returns the Y coordinate of the touch point relative to the top of the document. Unlike clientY, this value includes the vertical scroll offset, if any.

Touch.target (en-US) Read only

Returns the Element on which the touch point started when it was first placed on the surface, even if the touch point has since moved outside the interactive area of that element or even been removed from the document.

觸碰區(Touch area)

Experimental: 這是一個實驗中的功能
此功能在某些瀏覽器尚在開發中,請參考兼容表格以得到不同瀏覽器用的前輟。

Touch.radiusX (en-US) Read only 實驗性質

Returns the X radius of the ellipse that most closely circumscribes the area of contact with the screen. The value is in pixels of the same scale as screenX.

Touch.radiusY (en-US) Read only 實驗性質

Returns the Y radius of the ellipse that most closely circumscribes the area of contact with the screen. The value is in pixels of the same scale as screenY.

Touch.rotationAngle (en-US) Read only 實驗性質

Returns the angle (in degrees) that the ellipse described by radiusX and radiusY must be rotated, clockwise, to most accurately cover the area of contact between the user and the surface.

Touch.force (en-US)Read only 實驗性質

Returns the amount of pressure being applied to the surface by the user, as a float between 0.0 (no pressure) and 1.0 (maximum pressure).

方法

This interface has no method and no parent, and doesn't inherits or implements any method.

規範

Specification
Touch Events
# touch-interface

瀏覽器相容性

BCD tables only load in the browser

參見