简体   繁体   English

Windows phone 8触控支持

[英]Windows phone 8 touch support

Does windows phone 8 fully support touch events within the default browser? Windows Phone 8是否完全支持默认浏览器中的触摸事件?

Does it work out of the box so that arbitrary touchmove events can be detected by a web-page? 它是否可以开箱即用,以便网页可以检测到任意触摸移动事件?

I have had issues with some browsers which hijack the touchmove events to use for their interface as a swipe gesture. 我遇到了一些浏览器的问题,这些浏览器劫持了touchmove事件以用作他们的界面作为滑动手势。 Does windows phone 8 browser do anything like that? Windows Phone 8浏览器是否做了类似的事情?

Can anyone point to any documentation about windows phone 8 touch events? 任何人都可以指向任何有关Windows Phone 8触摸事件的文档吗?

EDIT: 编辑:

There is a page here that would allow someone with a wondows phone 8 to test the touch capabilities: http://blogs.msdn.com/b/ie/archive/2011/10/19/handling-multi-touch-and-mouse-input-in-all-browsers.aspx 这里有一个页面允许有wondows手机8的人测试触摸功能: http//blogs.msdn.com/b/ie/archive/2011/10/19/handling-multi-touch-and-鼠标输入功能于全browsers.aspx

I would greatly appreciate if someone could try it out and let me know if it works or not. 如果有人可以尝试一下,让我知道它是否有效,我将不胜感激。

However, there are a couple of comments... 但是,有几条评论......

SnarkMaiden 20 Oct 2011 11:17 AM # Just for curiosity; SnarkMaiden 2011年10月20日上午11:17#只是为了好奇; I have a tablet PC with both pen and touch - in IE9, with the pen I can draw in the field but with my finger I can only scroll the page. 我有一台带笔和触摸的平板电脑 - 在IE9中,我可以在现场绘制笔,但用手指我只能滚动页面。 Is that expected behaviour? 这是预期的行为吗? Ted Johnson [MSFT] 20 Oct 2011 11:28 AM # 泰德约翰逊[MSFT] 2011年10月20日上午11:28#

@SnarkMaiden: Unfortunately, yes, that's the expected behavior in IE9 and document mode 9 in IE10. @SnarkMaiden:不幸的是,是的,这是IE9中的预期行为和IE10中的文档模式9。 IE9 has no way to override the default panning gesture. IE9无法覆盖默认的平移手势。 IE10's 10 mode has a new CSS property, "-ms-content-zooming: none" that disables panning and zooming on the target element. IE10的10模式有一个新的CSS属性,“-ms-content-zoom:none”禁用平移和缩放目标元素。 BTW, this blog runs in document mode 9 in IE10. 顺便说一下,这个博客在IE10的文档模式9中运行。 So even IE10 users with touch are also seeing this behavior. 因此,即使是触控的IE10用户也会看到这种行为。

So still might not work form that page, even if it is possible on the device. 所以仍然可能无法在该页面上工作,即使它可能在设备上。

You should take a look at here: Updating touch and pointer events (official Windows Phone developer blog post). 你应该看看这里: 更新触摸和指针事件 (官方Windows Phone开发人员博客文章)。


EDIT: quote relevant parts of linked document 编辑:引用链接文档的相关部分

WebKit and Internet Explorer 10 handle touch event handling differently. WebKit和Internet Explorer 10以不同方式处理触摸事件处理。 WebKit supports a touch interface that is separate from mouse handling; WebKit支持与鼠标处理分开的触摸界面; IE10 groups touch, mouse, and stylus into a single interface (pointer). IE10将触摸,鼠标和手写笔分组到一个界面(指针)。 The pointer event model also has been submitted to the W3C for standardization under the Pointer Events Working Group. 指针事件模型也已提交给W3C,以便在指针事件工作组下进行标准化。 Although they are different, the models are generally similar, so support for pointer events can generally be added with minimal code changes. 尽管它们不同,但模型通常是相似的,因此通常可以在最少的代码更改的情况下添加对指针事件的支持。

Adding pointer event listeners 添加指针事件侦听器

The pointer API uses a standard “down, move, up” event model. 指针API使用标准的“向下,移动,向上”事件模型。 Therefore, it's simple to hook up listeners for existing event handlers to pointer events. 因此,将现有事件处理程序的侦听器连接到指针事件很简单。

Before 之前

this.element.addEventListener("touchstart", eventHandlerName, false); 
this.element.addEventListener("touchmove", eventHandlerName, false);
this.element.addEventListener("touchend", eventHandlerName, false);

After

if (window.navigator.msPointerEnabled) {
  this.element.addEventListener("MSPointerDown", eventHandlerName, false);
  this.element.addEventListener("MSPointerMove", eventHandlerName, false);
  this.element.addEventListener("MSPointerUp", eventHandlerName, false);
}
this.element.addEventListener("touchstart", eventHandlerName, false);
this.element.addEventListener("touchmove", eventHandlerName, false);
this.element.addEventListener("touchend", eventHandlerName, false);

Turning off default touch behavior 关闭默认触摸行为

The pointer event model in Internet Explorer 10 requires you to explicitly indicate which areas of the page will have custom gesture handling (using the code you just added), and which will use default gesture handling (pan the page). Internet Explorer 10中的指针事件模型要求您明确指示页面的哪些区域将具有自定义手势处理(使用您刚添加的代码),以及哪些区域将使用默认手势处理(平移页面)。 You can do this by adding markup on elements that should opt out of default gesture handling using the -ms-touch-action property. 您可以通过使用-ms-touch-action属性在应该退出默认手势处理的元素上添加标记来实现此目的。 For example: 例如:

Before 之前

<div id="slider" style="overflow: hidden;">

After

<div id="slider" style="overflow: hidden; -ms-touch-action: none;">

In addition to none, IE10 on Windows Phone 8 also supports the pan-x and pan-y properties, which specify that the browser should handle horizontal or vertical gestures, and custom JavaScript handlers should handle everything else. 除此之外,Windows Phone 8上的IE10还支持pan-x和pan-y属性,这些属性指定浏览器应处理水平或垂直手势,自定义JavaScript处理程序应处理其他所有内容。

It looks like this will be similar to IE 10 for Windows, with some exceptions... 看起来这将类似于IE 10 for Windows,但有一些例外......

From MSDN, "Web development for Windows Phone" : 来自MSDN,“Windows Phone的Web开发”

Unsupported features in Internet Explorer for Windows Phone OS 8.0 : The following features are supported in the desktop version of Internet Explorer 10, but are not supported in Internet Explorer for Windows Phone OS 8.0. Internet Explorer for Windows Phone OS 8.0中不支持的功能 :Internet Explorer 10的桌面版本支持以下功能,但Internet Explorer for Windows Phone OS 8.0不支持这些功能。

... ...

CSS Touch views – specifically overview, scroll, and accelerated scrolling. CSS Touch视图 - 特别是概述,滚动和加速滚动。

Rotation and angular events as related to gesture events. 与手势事件相关的旋转和角度事件。

UPDATE: The link in your update works in the IE 10 for the phone. 更新: 您的更新中链接适用于手机的IE 10。 Touch in the SVG canvas draws with multi-touch. 触摸SVG画布绘制多点触控。 (It doesn't scroll the page in this area but does on the rest of the page). (它不会在此区域中滚动页面,而是在页面的其余部分滚动)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM