diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/touch | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/touch')
-rw-r--r-- | files/zh-cn/web/api/touch/clientx/index.html | 28 | ||||
-rw-r--r-- | files/zh-cn/web/api/touch/clienty/index.html | 26 | ||||
-rw-r--r-- | files/zh-cn/web/api/touch/force/index.html | 28 | ||||
-rw-r--r-- | files/zh-cn/web/api/touch/identifier/index.html | 22 | ||||
-rw-r--r-- | files/zh-cn/web/api/touch/index.html | 117 | ||||
-rw-r--r-- | files/zh-cn/web/api/touch/pagex/index.html | 28 | ||||
-rw-r--r-- | files/zh-cn/web/api/touch/pagey/index.html | 28 | ||||
-rw-r--r-- | files/zh-cn/web/api/touch/radiusx/index.html | 27 | ||||
-rw-r--r-- | files/zh-cn/web/api/touch/radiusy/index.html | 27 | ||||
-rw-r--r-- | files/zh-cn/web/api/touch/rotationangle/index.html | 28 | ||||
-rw-r--r-- | files/zh-cn/web/api/touch/screenx/index.html | 28 | ||||
-rw-r--r-- | files/zh-cn/web/api/touch/screeny/index.html | 36 | ||||
-rw-r--r-- | files/zh-cn/web/api/touch/target/index.html | 77 | ||||
-rw-r--r-- | files/zh-cn/web/api/touch/touch/index.html | 121 |
14 files changed, 621 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/touch/clientx/index.html b/files/zh-cn/web/api/touch/clientx/index.html new file mode 100644 index 0000000000..1af2a13895 --- /dev/null +++ b/files/zh-cn/web/api/touch/clientx/index.html @@ -0,0 +1,28 @@ +--- +title: Touch.clientX +slug: Web/API/Touch/clientX +tags: + - touch +translation_of: Web/API/Touch/clientX +--- +<p>{{ ApiRef() }}</p> +<h3 id="Summary" name="Summary">概述</h3> +<p>返回触点相对于可见视区(<a class="external" href="http://www.quirksmode.org/mobile/viewports2.html" title="http://www.quirksmode.org/mobile/viewports2.html">visual viewport</a>)左边沿的的X坐标. 不包括任何滚动偏移.这个值会根据用户对可见视区的缩放行为而发生变化.</p> +<h3 id="Syntax" name="Syntax">语法</h3> +<pre class="eval">var <em>x</em> = <em>touchItem</em>.clientX; +</pre> +<h3 id="Return_Value" name="Return_Value">返回值</h3> +<dl> + <dt> + <code>x</code></dt> + <dd> + 触点相对于可见视区(<a class="external" href="http://www.quirksmode.org/mobile/viewports2.html" title="http://www.quirksmode.org/mobile/viewports2.html">visual viewport</a>)左边沿的的X坐标. 不包括任何滚动偏移.</dd> +</dl> +<h3 id="Specification" name="Specification">标准定义</h3> +<p><a class="external" href="http://www.w3.org/TR/touch-events/" title="http://www.w3.org/TR/touch-events/">Touch Events Specification</a></p> +<h3 id="相关链接">相关链接</h3> +<ul> + <li>{{ domxref("Touch.clientY") }}</li> + <li>{{ domxref("Touch.screenX") }}</li> + <li>{{ domxref("Touch.pageX") }}</li> +</ul> diff --git a/files/zh-cn/web/api/touch/clienty/index.html b/files/zh-cn/web/api/touch/clienty/index.html new file mode 100644 index 0000000000..d905fd66b9 --- /dev/null +++ b/files/zh-cn/web/api/touch/clienty/index.html @@ -0,0 +1,26 @@ +--- +title: Touch.clientY +slug: Web/API/Touch/clientY +translation_of: Web/API/Touch/clientY +--- +<p>{{ ApiRef() }}</p> +<h3 id="Summary" name="Summary">概述</h3> +<p>返回触点相对于可见视区(<a class="external" href="http://www.quirksmode.org/mobile/viewports2.html" title="http://www.quirksmode.org/mobile/viewports2.html">visual viewport</a>)上边沿的的Y坐标. 不包括任何滚动偏移.这个值会根据用户对可见视区的缩放行为而发生变化.</p> +<h3 id="Syntax" name="Syntax">语法</h3> +<pre class="eval">var <span style="font-style: italic;">y</span> = <em>touchItem</em>.clientY; +</pre> +<h3 id="Return_Value" name="Return_Value">返回值</h3> +<dl> + <dt> + <code>y</code></dt> + <dd> + 返回触点相对于可见视区(<a class="external" href="http://www.quirksmode.org/mobile/viewports2.html" title="http://www.quirksmode.org/mobile/viewports2.html">visual viewport</a>)上边沿的的Y坐标. 不包括任何滚动偏移.</dd> +</dl> +<h3 id="Specification" name="Specification">标准定义</h3> +<p><a class="external" href="http://www.w3.org/TR/touch-events/" title="http://www.w3.org/TR/touch-events/">Touch Events Specification</a></p> +<h3 id="相关链接">相关链接</h3> +<ul> + <li>{{ domxref("Touch.clientX") }}</li> + <li>{{ domxref("Touch.screenY") }}</li> + <li>{{ domxref("Touch.pageY") }}</li> +</ul> diff --git a/files/zh-cn/web/api/touch/force/index.html b/files/zh-cn/web/api/touch/force/index.html new file mode 100644 index 0000000000..b902045bcf --- /dev/null +++ b/files/zh-cn/web/api/touch/force/index.html @@ -0,0 +1,28 @@ +--- +title: Touch.force +slug: Web/API/Touch/force +tags: + - touch +translation_of: Web/API/Touch/force +--- +<p>{{ ApiRef() }}</p> +<h3 id="Summary" name="Summary">概述</h3> +<p>返回这个 {{ domxref("Touch") }} 对象对应的手指挤压触摸平面的压力大小, 从0.0(没有压力)到1.0(最大压力)的浮点数.</p> +<h3 id="Syntax" name="Syntax">语法</h3> +<pre class="eval">var <em>force</em> = <em>touchItem</em>.force; +</pre> +<h3 id="Return_Value" name="Return_Value">返回值</h3> +<dl> + <dt> + <code>force</code></dt> + <dd> + 手指挤压触摸平面的压力大小. 从0.0(没有压力)到1.0(设备可识别的最大压力)的浮点数.</dd> +</dl> +<h3 id="Specification" name="Specification">标准定义</h3> +<p><a class="external" href="http://www.w3.org/TR/touch-events/" title="http://www.w3.org/TR/touch-events/">Touch Events Specification</a></p> +<h3 id="相关链接">相关链接</h3> +<ul> + <li>{{ domxref("Touch.radiusX") }}</li> + <li>{{ domxref("Touch.radiusY") }}</li> + <li>{{ domxref("Touch.rotationAngle") }}</li> +</ul> diff --git a/files/zh-cn/web/api/touch/identifier/index.html b/files/zh-cn/web/api/touch/identifier/index.html new file mode 100644 index 0000000000..bf42f62668 --- /dev/null +++ b/files/zh-cn/web/api/touch/identifier/index.html @@ -0,0 +1,22 @@ +--- +title: Touch.identifier +slug: Web/API/Touch/identifier +tags: + - touch +translation_of: Web/API/Touch/identifier +--- +<p>{{ ApiRef() }}</p> +<h3 id="Summary" name="Summary">概述</h3> +<p>返回一个可以唯一地识别和触摸平面接触的点的值. 这个值在这根手指(或触摸笔等)所引发的所有事件中保持一致, 直到它离开触摸平面.</p> +<h3 id="Syntax" name="Syntax">语法</h3> +<pre class="eval">var <em>id</em> = <em>touchItem</em>.identifier; +</pre> +<h3 id="Return_Value" name="Return_Value">返回值</h3> +<dl> + <dt> + <code>id</code></dt> + <dd> + {{ domxref("Touch") }} 对象的唯一标识符.</dd> +</dl> +<h3 id="Specification" name="Specification">标准定义</h3> +<p><a class="external" href="http://www.w3.org/TR/touch-events/" title="http://www.w3.org/TR/touch-events/">Touch Events Specification</a></p> diff --git a/files/zh-cn/web/api/touch/index.html b/files/zh-cn/web/api/touch/index.html new file mode 100644 index 0000000000..79f3092cdf --- /dev/null +++ b/files/zh-cn/web/api/touch/index.html @@ -0,0 +1,117 @@ +--- +title: Touch +slug: Web/API/Touch +tags: + - API + - TouchEvent + - touch + - 参考 + - 接口 +translation_of: Web/API/Touch +--- +<p>{{ ApiRef("Touch Events") }}</p> + +<p><strong><code>Touch</code> </strong>对象表示在触控设备上的触摸点。通常是指手指或者触控笔在触屏设备或者触摸板上的操作。</p> + +<p>对象属性 {{ domxref("Touch.radiusX") }}, {{ domxref("Touch.radiusY") }}, 和 {{ domxref("Touch.rotationAngle") }} 表示用户触摸操作所作用的区域,即<em>触摸区域</em>。这些属性对于处理类似于手指触摸之类的不精确操作很有帮助。这些属性可以表示出一个尽可能匹配触控区域的椭圆形(例如用户的指尖触控)。 {{experimental_inline}}</p> + +<div class="note"><strong>注意:</strong> 以下很多属性的值需要依赖硬件设备去获取,例如,如果设备本身不支持侦测压感,那么 <code>force</code> 属性的值将始终是0,对于 <code>radiusX</code> 和 <code>radiusY</code> 来说同样可能有这种情况,如果设备认为触点只是一个点而不是一个面, 它们始终为1。 </div> + +<h2 id="构造函数">构造函数</h2> + +<dl> + <dt>{{domxref("Touch.Touch", "Touch()")}} {{experimental_inline}}</dt> + <dd>创建一个Touch对象。</dd> + <dt></dt> +</dl> + +<h2 id="属性">属性</h2> + +<p><em>这个接口没有父类,不继承任何属性。</em></p> + +<h3 id="基本属性">基本属性</h3> + +<dl> + <dt>{{ domxref("Touch.identifier") }}{{readonlyInline}}</dt> + <dd>此 <code>Touch</code> 对象的唯一标识符。 一次触摸动作(例如手指触摸)在平面上移动的整个过程中, 该标识符不变。可以根据它来判断跟踪的是否是同一次触摸过程。</dd> + <dt><strong>{{ domxref("Touch.screenX") }}</strong>{{readonlyInline}}</dt> + <dd>触点相对于屏幕左边缘的X坐标。</dd> + <dt><strong>{{ domxref("Touch.screenY") }}</strong>{{readonlyInline}}</dt> + <dd>触点相对于屏幕上边缘的Y坐标。</dd> + <dt><strong>{{ domxref("Touch.clientX") }}</strong>{{readonlyInline}}</dt> + <dd>触点相对于可见视区(<a href="http://www.quirksmode.org/mobile/viewports2.html" title="http://www.quirksmode.org/mobile/viewports2.html">visual viewport</a>)左边缘的X坐标。不包括任何滚动偏移。</dd> + <dt><strong>{{ domxref("Touch.clientY") }}</strong>{{readonlyInline}}</dt> + <dd>触点相对于可见视区(<a href="http://www.quirksmode.org/mobile/viewports2.html" title="http://www.quirksmode.org/mobile/viewports2.html">visual viewport</a>)上边缘的Y坐标。不包括任何滚动偏移。</dd> + <dt>{{ domxref("Touch.pageX") }}{{readonlyInline}}</dt> + <dd>触点相对于HTML文档左边缘的X坐标。当存在水平滚动的偏移时, 这个值包含了水平滚动的偏移。</dd> + <dt>{{ domxref("Touch.pageY") }}{{readonlyInline}}</dt> + <dd>触点相对于HTML文档上边缘的Y坐标。当存在垂直滚动的偏移时, 这个值包含了垂直滚动的偏移。</dd> + <dt>{{ domxref("Touch.target") }}{{readonlyInline}}</dt> + <dd>返回触摸点最初接触的 {{ domxref("Element")}},即使这个触摸点已经移出那个元素的交互区域。需要注意的是, 如果这个元素在触摸过程中被移除, 这个事件仍然会指向它, 因此这个事件也不会冒泡到 <code>window</code> 或 <code>document</code> 对象。因此, 如果有元素在触摸过程中可能被移除, 最佳实践是将触摸事件的监听器绑定到这个元素本身, 防止元素被移除后, 无法再从它的上一级元素上侦测到从该元素冒泡的事件。</dd> +</dl> + +<h3 id="触摸区域">触摸区域</h3> + +<p>{{SeeCompatTable}}</p> + +<dl> + <dt>{{ domxref("Touch.radiusX") }}{{readonlyInline}}{{experimental_inline}}</dt> + <dd>返回能够包围接触区域的最小椭圆的水平轴(X轴)半径。这个值的单位和 <code>screenX</code> 相同<strong>。</strong></dd> + <dt>{{ domxref("Touch.radiusY") }}{{readonlyInline}}{{experimental_inline}}</dt> + <dd>返回能够包围接触区域的最小椭圆的垂直轴(Y轴)半径。这个值的单位和 <code>screenY</code> 相同。</dd> + <dt>{{ domxref("Touch.rotationAngle") }}{{readonlyInline}}{{experimental_inline}}</dt> + <dd>返回一个角度值,表示上述由<code>radiusX</code> 和 <code>radiusY</code> 描述的椭圆为了尽可能精确地覆盖用户与平面之间的接触区域而需要顺时针旋转的角度。</dd> + <dt>{{ domxref("Touch.force") }}{{readonlyInline}}{{experimental_inline}}</dt> + <dd>返回用户对触摸平面的压力大小,是一个从0.0(没有压力)到1.0(最大压力)的浮点数。</dd> +</dl> + +<dl> +</dl> + +<h2 id="Methods">Methods</h2> + +<p><em>这个接口没有方法,也没有父类,不继承任何方法。</em></p> + +<h2 id="示例">示例</h2> + +<p>请看 <a href="/en/DOM/Touch_events#Example" title="en/DOM/Touch events#Example">example on the main Touch events article</a>。</p> + +<dl> +</dl> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">规范</th> + <th scope="col">状态</th> + <th scope="col">注释</th> + </tr> + <tr> + <td>{{SpecName('Touch Events 2', '#touch-interface', 'Touch')}}</td> + <td>{{Spec2('Touch Events 2')}}</td> + <td>加入 <code>radiusX</code>, <code>radiusY</code>, <code>rotationAngle</code>, <code>force</code> 属性,和 <code>Touch()</code> 构造函数。</td> + </tr> + <tr> + <td>{{SpecName('Touch Events', '#touch-interface', 'Touch')}}</td> + <td>{{Spec2('Touch Events')}}</td> + <td>初始定义。</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<p>{{Compat("api.Touch")}}</p> + +<h2 id="相关链接">相关链接</h2> + +<ul> + <li><a href="/en/DOM/Touch_events" title="en/DOM/Touch events">Touch events</a></li> + <li>{{domxref("Touch_events","Touch Events Overview")}}</li> + <li>{{ domxref("Document.createTouch()") }}</li> + <li>{{ domxref("Touch") }}</li> + <li>{{ domxref("TouchList") }}</li> + <li>{{ domxref("TouchEvent") }}</li> +</ul> diff --git a/files/zh-cn/web/api/touch/pagex/index.html b/files/zh-cn/web/api/touch/pagex/index.html new file mode 100644 index 0000000000..ff6743a478 --- /dev/null +++ b/files/zh-cn/web/api/touch/pagex/index.html @@ -0,0 +1,28 @@ +--- +title: Touch.pageX +slug: Web/API/Touch/pageX +tags: + - touch +translation_of: Web/API/Touch/pageX +--- +<p>{{ ApiRef() }}</p> +<h3 id="Summary" name="Summary">概述</h3> +<p>触点相对于HTML文档左边沿的的X坐标. 和 <code>clientX 属性不同, 这个值是相对于整个html文档的坐标, 和用户滚动位置无关. 因此当存在水平滚动的偏移时, 这个值包含了水平滚动的偏移</code>.</p> +<h3 id="Syntax" name="Syntax">语法</h3> +<pre class="eval">var <em>x</em> = <em>touchItem</em>.pageX; +</pre> +<h3 id="Return_Value" name="Return_Value">返回值</h3> +<dl> + <dt> + <code>x</code></dt> + <dd> + 触点相对于HTML文档左边沿的的X坐标. <code>当存在水平滚动的偏移时, 这个值包含了水平滚动的偏移</code>.</dd> +</dl> +<h3 id="Specification" name="Specification">标准定义</h3> +<p><a class="external" href="http://www.w3.org/TR/touch-events/" title="http://www.w3.org/TR/touch-events/">Touch Events Specification</a></p> +<h3 id="相关链接">相关链接</h3> +<ul> + <li>{{ domxref("Touch.pageY") }}</li> + <li>{{ domxref("Touch.screenX") }}</li> + <li>{{ domxref("Touch.clientX") }}</li> +</ul> diff --git a/files/zh-cn/web/api/touch/pagey/index.html b/files/zh-cn/web/api/touch/pagey/index.html new file mode 100644 index 0000000000..4987c2eb3d --- /dev/null +++ b/files/zh-cn/web/api/touch/pagey/index.html @@ -0,0 +1,28 @@ +--- +title: Touch.pageY +slug: Web/API/Touch/pageY +tags: + - touch +translation_of: Web/API/Touch/pageY +--- +<p>{{ ApiRef() }}</p> +<h3 id="Summary" name="Summary">概述</h3> +<p>触点相对于HTML文档上边沿的的Y坐标. 和 <code>clientY 属性不同, 这个值是相对于整个html文档的坐标, 和用户滚动位置无关. 因此当存在垂直滚动的偏移时, 这个值包含了垂直滚动的偏移</code>.</p> +<h3 id="Syntax" name="Syntax">语法</h3> +<pre class="eval">var <em>y</em> = <em>touchItem</em>.pageY; +</pre> +<h3 id="Return_Value" name="Return_Value">返回值</h3> +<dl> + <dt> + <code>y</code></dt> + <dd> + 触点相对于HTML文档上边沿的的Y坐标. <code>当存在垂直滚动的偏移时, 这个值包含了垂直滚动的偏移</code>.</dd> +</dl> +<h3 id="Specification" name="Specification">标准定义</h3> +<p><a class="external" href="http://www.w3.org/TR/touch-events/" title="http://www.w3.org/TR/touch-events/">Touch Events Specification</a></p> +<h3 id="相关链接">相关链接</h3> +<ul> + <li>{{ domxref("Touch.pageX") }}</li> + <li>{{ domxref("Touch.screenY") }}</li> + <li>{{ domxref("Touch.clientY") }}</li> +</ul> diff --git a/files/zh-cn/web/api/touch/radiusx/index.html b/files/zh-cn/web/api/touch/radiusx/index.html new file mode 100644 index 0000000000..e1609b4d19 --- /dev/null +++ b/files/zh-cn/web/api/touch/radiusx/index.html @@ -0,0 +1,27 @@ +--- +title: Touch.radiusX +slug: Web/API/Touch/radiusX +translation_of: Web/API/Touch/radiusX +--- +<p>{{ ApiRef() }}</p> +<h3 id="Summary" name="Summary">概述</h3> +<p>能够包围用户和触摸平面的接触面的最小椭圆的水平轴(X轴)半径. 这个值的单位和<code> screenX 相同.</code></p> +<p><code>这个属性和 </code>{{ domxref("Touch.radiusY") }} , {{ domxref("Touch.rotationAngle") }} 一起, 描述了用户和触摸平面的接触面. 这在面向非精确触摸设备(由手指直接操作的触摸屏)开发时非常有用. 这些值描述了一个尽可能接近实际接触面(例如用户的指尖)的椭圆.</p> +<h3 id="Syntax" name="Syntax">语法</h3> +<pre class="eval">var <em>xRadius</em> = <em>touchItem</em>.radiusX; +</pre> +<h3 id="Return_Value" name="Return_Value">返回值</h3> +<dl> + <dt> + <code>xRadius</code></dt> + <dd> + 能够包围用户和触摸平面的接触面的最小椭圆的水平轴(X轴)半径.</dd> +</dl> +<h3 id="Specification" name="Specification">标准定义</h3> +<p><a class="external" href="http://www.w3.org/TR/touch-events/" title="http://www.w3.org/TR/touch-events/">Touch Events Specification</a></p> +<h3 id="相关链接">相关链接</h3> +<ul> + <li>{{ domxref("Touch.radiusY") }}</li> + <li>{{ domxref("Touch.rotationAngle") }}</li> + <li>{{ domxref("Touch.force") }}</li> +</ul> diff --git a/files/zh-cn/web/api/touch/radiusy/index.html b/files/zh-cn/web/api/touch/radiusy/index.html new file mode 100644 index 0000000000..2243af5c73 --- /dev/null +++ b/files/zh-cn/web/api/touch/radiusy/index.html @@ -0,0 +1,27 @@ +--- +title: Touch.radiusY +slug: Web/API/Touch/radiusY +translation_of: Web/API/Touch/radiusY +--- +<p>{{ ApiRef() }}</p> +<h3 id="Summary" name="Summary">概述</h3> +<p>能够包围用户和触摸平面的接触面的最小椭圆的垂直轴(Y轴)半径. 这个值的单位和<code> screenY 相同.</code></p> +<p><code>这个属性和 </code>{{ domxref("Touch.radiusX") }} , {{ domxref("Touch.rotationAngle") }} 一起, 描述了用户和触摸平面的接触面. 这在面向非精确触摸设备(由手指直接操作的触摸屏)开发时非常有用. 这些值描述了一个尽可能接近实际接触面(例如用户的指尖)的椭圆.</p> +<h3 id="Syntax" name="Syntax">语法</h3> +<pre class="eval">var <em>yRadius</em> = <em>touchItem</em>.radiusY; +</pre> +<h3 id="Return_Value" name="Return_Value">返回值</h3> +<dl> + <dt> + <code>yRadius</code></dt> + <dd> + 能够包围用户和触摸平面的接触面的最小椭圆的垂直轴(Y轴)半径.</dd> +</dl> +<h3 id="Specification" name="Specification">标准定义</h3> +<p><a class="external" href="http://www.w3.org/TR/touch-events/" title="http://www.w3.org/TR/touch-events/">Touch Events Specification</a></p> +<h3 id="相关链接">相关链接</h3> +<ul> + <li>{{ domxref("Touch.radiusX") }}</li> + <li>{{ domxref("Touch.rotationAngle") }}</li> + <li>{{ domxref("Touch.force") }}</li> +</ul> diff --git a/files/zh-cn/web/api/touch/rotationangle/index.html b/files/zh-cn/web/api/touch/rotationangle/index.html new file mode 100644 index 0000000000..dcad758fa7 --- /dev/null +++ b/files/zh-cn/web/api/touch/rotationangle/index.html @@ -0,0 +1,28 @@ +--- +title: Touch.rotationAngle +slug: Web/API/Touch/rotationAngle +tags: + - touch +translation_of: Web/API/Touch/rotationAngle +--- +<p>{{ ApiRef() }}</p> +<h3 id="Summary" name="Summary">概述</h3> +<p>返回以度为单位的旋转角. <code>由radiusX</code> 和 <code>radiusY</code> 描述的正方向的椭圆,通过顺时针旋转这个角度后,能最精确地覆盖住用户和触摸平面的接触面的角度. 这个值可能从0到90. 这三个值一起描述了用户和触摸平面的接触面的形状的大小. 例如, 当用户使用手指和平面接触时, 它可能是一个较大的椭圆, 而当用户使用触摸笔时, 它可能是很小的椭圆.</p> +<h3 id="Syntax" name="Syntax">语法</h3> +<pre class="eval">var <em>angle</em> = <em>touchItem</em>.rotationAngle; +</pre> +<h3 id="Return_Value" name="Return_Value">返回值</h3> +<dl> + <dt> + <code>angle</code></dt> + <dd> + 以度为单位的旋转角. <code>由radiusX</code> 和 <code>radiusY</code> 描述的正方向的椭圆,通过顺时针旋转这个角度后,能最精确地覆盖住用户和触摸平面的接触面的角度.</dd> +</dl> +<h3 id="Specification" name="Specification">标准定义</h3> +<p><a class="external" href="http://www.w3.org/TR/touch-events/" title="http://www.w3.org/TR/touch-events/">Touch Events Specification</a></p> +<h3 id="相关链接">相关链接</h3> +<ul> + <li>{{ domxref("Touch.radiusX") }}</li> + <li>{{ domxref("Touch.radiusY") }}</li> + <li>{{ domxref("Touch.force") }}</li> +</ul> diff --git a/files/zh-cn/web/api/touch/screenx/index.html b/files/zh-cn/web/api/touch/screenx/index.html new file mode 100644 index 0000000000..ef9ac6d9e0 --- /dev/null +++ b/files/zh-cn/web/api/touch/screenx/index.html @@ -0,0 +1,28 @@ +--- +title: Touch.screenX +slug: Web/API/Touch/screenX +tags: + - touch +translation_of: Web/API/Touch/screenX +--- +<p>{{ ApiRef() }}</p> +<h3 id="Summary" name="Summary">概述</h3> +<p>返回触点相对于屏幕左边沿的的X坐标. 不包含页面滚动的偏移量.</p> +<h3 id="Syntax" name="Syntax">语法</h3> +<pre class="eval">var <em>x</em> = <em>touchItem</em>.screenX; +</pre> +<h3 id="Return_Value" name="Return_Value">返回值</h3> +<dl> + <dt> + <code>x</code></dt> + <dd> + 触点相对于屏幕左边沿的的X坐标. 不包含页面滚动的偏移量.</dd> +</dl> +<h3 id="Specification" name="Specification">标准定义</h3> +<p><a class="external" href="http://www.w3.org/TR/touch-events/" title="http://www.w3.org/TR/touch-events/">Touch Events Specification</a></p> +<h3 id="相关链接">相关链接</h3> +<ul> + <li>{{ domxref("Touch.screenY") }}</li> + <li>{{ domxref("Touch.clientX") }}</li> + <li>{{ domxref("Touch.pageX") }}</li> +</ul> diff --git a/files/zh-cn/web/api/touch/screeny/index.html b/files/zh-cn/web/api/touch/screeny/index.html new file mode 100644 index 0000000000..e3c583c101 --- /dev/null +++ b/files/zh-cn/web/api/touch/screeny/index.html @@ -0,0 +1,36 @@ +--- +title: Touch.screenY +slug: Web/API/Touch/screenY +tags: + - touch +translation_of: Web/API/Touch/screenY +--- +<p>{{ ApiRef() }}</p> + +<h3 id="Summary" name="Summary">概述</h3> + +<p>返回触点相对于屏幕上边沿的Y坐标. 不包含页面滚动的偏移量.</p> + +<h3 id="Syntax" name="Syntax">语法</h3> + +<pre class="eval">var <em>y</em> = <em>touchItem</em>.screenY; +</pre> + +<h3 id="Return_Value" name="Return_Value">返回值</h3> + +<dl> + <dt><code>y</code></dt> + <dd>触点相对于屏幕上边沿的Y坐标. 不包含页面滚动的偏移量.</dd> +</dl> + +<h3 id="Specification" name="Specification">标准定义</h3> + +<p><a class="external" href="http://www.w3.org/TR/touch-events/" title="http://www.w3.org/TR/touch-events/">Touch Events Specification</a></p> + +<h3 id="相关链接">相关链接</h3> + +<ul> + <li>{{ domxref("Touch.screenX") }}</li> + <li>{{ domxref("Touch.clientY") }}</li> + <li>{{ domxref("Touch.pageY") }}</li> +</ul> diff --git a/files/zh-cn/web/api/touch/target/index.html b/files/zh-cn/web/api/touch/target/index.html new file mode 100644 index 0000000000..be815271e8 --- /dev/null +++ b/files/zh-cn/web/api/touch/target/index.html @@ -0,0 +1,77 @@ +--- +title: Touch.target +slug: Web/API/Touch/target +tags: + - API + - DOM + - EventTarget + - TouchEvent + - touch + - 属性 + - 移动设备 + - 触摸 +translation_of: Web/API/Touch/target +--- +<p>{{ APIRef("Touch Events") }}</p> + +<h2 id="Summary" name="Summary">概述</h2> + +<p>这个属性返回触摸点最初接触的 <a href="https://wiki.developer.mozilla.org/zh-CN/docs/Web/API/Element"><code>Element</code></a>,即使这个触摸点已经移出那个元素的交互区域,甚至移出文档。需要注意的是,如果这个元素在触摸过程中被移除,这个事件仍然会指向它,因此这个事件也不会冒泡到 <code>window</code> 或 <code>document</code> 对象。因此,如果有元素在触摸过程中可能被移除,最佳实践是将触摸事件的监听器绑定到这个元素本身,防止元素被移除后,无法再从它的上一级元素上侦测到从该元素冒泡的事件。</p> + +<h2 id="Syntax" name="Syntax">语法</h2> + +<pre class="eval">var <em>el</em> = <em>touchPoint</em>.target; +</pre> + +<h3 id="Return_Value" name="Return_Value">返回值</h3> + +<dl> + <dt><code>el</code></dt> + <dd>{{domxref("Touch")}} 对象的目标元素。</dd> +</dl> + +<h2 id="示例">示例</h2> + +<p>这个例子展示了如何访问 {{domxref("Touch")}} 对象的 {{domxref("Touch.target")}} 属性。{{domxref("Touch.target")}} 属性是最初接触平面的触摸点下的 {{domxref("Element")}} ({{domxref("EventTarget")}}) 。</p> + +<p>在下面的代码片段中,我们假设用户在 <code>source</code> 元素上开始接触,因此初始化了一个或多个触摸点。当这个元素上的 {{event("touchstart")}} 事件处理程序被调用时,每个触摸点的 {{domxref("Touch.target")}} 属性可经事件的 {{domxref("TouchEvent.targetTouches")}} 列表访问。</p> + +<pre class="brush: js">// 为'source'元素注册一个触摸监听器 +var src = document.getElementById("source"); + +src.addEventListener('touchstart', function(e) { + // 在这个元素上激活的触点间循环 + for (var i=0; i < e.targetTouches.length; i++) { + console.log("touchpoint[" + i + "].target = " + e.targetTouches[i].target); + } +}, false); + +</pre> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">规范</th> + <th scope="col">状态</th> + <th scope="col">注释</th> + </tr> + <tr> + <td>{{SpecName('Touch Events 2','#dom-touch-target')}}</td> + <td>{{Spec2('Touch Events 2')}}</td> + <td>Non-stable version.</td> + </tr> + <tr> + <td>{{SpecName('Touch Events', '#widl-Touch-target')}}</td> + <td>{{Spec2('Touch Events')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + + + +<p>{{Compat("api.Touch.target")}}</p> diff --git a/files/zh-cn/web/api/touch/touch/index.html b/files/zh-cn/web/api/touch/touch/index.html new file mode 100644 index 0000000000..768a18ce57 --- /dev/null +++ b/files/zh-cn/web/api/touch/touch/index.html @@ -0,0 +1,121 @@ +--- +title: Touch() +slug: Web/API/Touch/Touch +translation_of: Web/API/Touch/Touch +--- +<p>{{APIRef("Touch Events")}}{{SeeCompatTable}}</p> + +<p><strong><code>Touch()</code></strong> 构造器创建一个新的 {{domxref("Touch")}} 对象.</p> + +<h2 id="Syntax">Syntax</h2> + +<pre> <em>touch</em> = new Touch(<em>touchInit</em>);</pre> + +<h3 id="Arguments">Arguments</h3> + +<dl> + <dt><em>touchInit</em></dt> +</dl> + +<dl> + <dd>是一个<code>TouchInit</code> 字典,它拥有以下属性:</dd> + <dd> + <ul> + <li><code>"identifier"</code>, 必须,是一个长整型,表示一个触摸点的数字标记。</li> + <li><code>"target"</code>, 必须, 是 {{domxref("EventTarget")}}类型,表示在触摸点开始接触接触面时的节点。</li> + <li><code>"clientX"</code>, 可选,默认为0,为双精度浮点数类型,表示触摸在浏览器视口的横轴坐标,不包括滚动条的偏移距离。 </li> + <li><code>"clientY"</code>, 可选,默认为0,为双精度浮点数类型,表示触摸在浏览器视口的横轴坐标,不包括滚动条的偏移距离。 </li> + <li><code>"screenX"</code>, 可选,默认为0,为双精度浮点数类型,表示以用户屏幕为基准的,触摸点横坐标。</li> + <li><code>"screenY"</code>, 可选,默认为0,为双精度浮点数类型,表示以用户屏幕为基准的,触摸点纵坐标。</li> + <li><code>"pageX"</code>,可选,默认为0,为双精度浮点数类型,表示触摸在用户屏幕的横轴坐标,包括滚动条的偏移距离。 </li> + <li><code>"pageY"</code>, 可选,默认为0,为双精度浮点数类型,表示触摸在用户屏幕的纵轴坐标,包括滚动条的偏移距离。 </li> + <li><code>"radiusX"</code>, 可选,默认为0,为浮点数类型。表示接触面(比如手指,触控笔)接触形成的椭圆,在rotationAngle角度下横轴上形成的椭圆半径。和screenX使用的CSS像素保持同一个缩放大小。这个值不能为负。</li> + <li><code>"radiusY"</code>, 可选,默认为0,为浮点数类型。表示接触面(比如手指,触控笔)接触形成的椭圆,在rotationAngle角度下纵轴上形成的椭圆半径。和screenY使用的CSS像素保持同一个缩放大小。这个值不能为负。</li> + <li><code>"rotationAngle"</code>, 可选,默认为0,为浮点数类型。表示由 radiusX 和 radiusY决定的椭圆在顺时针方向相对其中心偏转的角度。这个值介于0到90度之间。如果由 radiusX 和 radiusY决定的椭圆是一个标准圆形,则rotationAngle没有任何效用。用户设备可能用0表示这种标准圆形的情况,或者用其他符合要求范围的值来表示(比如,用户设备可能用上一次的触摸事件rotationAngle值,来避免突然变动)。</li> + <li><code>"force"</code>,可选,默认为0,为浮点数类型。表示触摸体对触摸面的压力值。范围为从0到1:0表示压力为零,1表示设备能承受的最大压力敏感值。对压力的敏感值变动范围根据不同环境变动比较大。</li> + </ul> + </dd> +</dl> + +<h2 id="Specifications" name="Specifications">Specifications</h2> + +<table> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('Touch Events 2','#touchevent-interface', 'TouchEvent')}}</td> + <td>{{Spec2('Touch Events 2')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<p>{{ CompatibilityTable() }}</p> + +<div id="compat-desktop"> +<table class=" compat-table"> + <tbody> + <tr> + <th>特性</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari (WebKit)</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatChrome("48.0")}}</td> + <td>{{ CompatUnknown() }}</td> + <td>{{ CompatUnknown() }}</td> + <td>{{CompatOpera("35")}}</td> + <td>{{ CompatUnknown() }}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class=" compat-table"> + <tbody> + <tr> + <th>特性</th> + <th>Android</th> + <th>Android Webview</th> + <th>Chrome for Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>Firefox OS</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{ CompatUnknown() }}</td> + <td>{{CompatChrome("48.0")}}</td> + <td>{{CompatChrome("48.0")}}</td> + <td>{{ CompatUnknown() }}</td> + <td>{{ CompatUnknown() }}</td> + <td>{{ CompatUnknown() }}</td> + <td>{{CompatOpera("35")}}</td> + <td>{{ CompatUnknown() }}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="See_also"><br> + See also</h2> + +<ul> + <li>{{domxref("TouchEvent")}}, the interface of the objects it constructs<br> + .</li> +</ul> |