电子为触摸屏启用触摸事件 [英] Electron enable touch events for a touch screen

查看:104
本文介绍了电子为触摸屏启用触摸事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Raspberry Pi连接到触摸屏,并通过startx命令在其上运行电子应用程序,

I have a Raspberry Pi connected to touchscreen and running an electron app on it through the startx command,

# startx ./electron-app -- --nocursor

我无法处理类似触摸事件的问题(touchstart,touchend),显然是因为Electron(或铬)没有将屏幕视为触摸屏。

the problem that I can't handle the touch events like (touchstart, touchend) and apparently that is because Electron (or chromium) not seeing the screen as a touch screen.

推荐答案

问题不在于Electron / Blink没有看到触摸屏/本机触摸事件。据我了解,问题有两个部分:

The problem is not that Electron/Blink isn't seeing the touchscreen / native touch events. There are two parts to the problem, as I understand it:


  1. 您需要确保从操作系统接收到触摸事件。触摸屏。我尚未在Pi / Linux上进行过测试,所以不确定是否可以原生处理触摸事件。我知道OSX需要一个第三方驱动程序,例如[UDP-Touch-Base UDPP。

  2. 一旦OS处理触摸事件,这些驱动程序就是通过电子包装器通过管道传递到Blink 。但是,您需要设置 touch-events 命令行开关将其启用。我的理解是,该开关作为 Chromium命令行开关

  1. You need to ensure you're receiving touch events in the OS from the touchscreen. I haven't tested with Pi/Linux, so I'm not sure if those handle touch events natively. I know that OSX, for one, requires a third-party driver like [UDPP by Touch-Base.
  2. Once the OS is handling touch events, those are piped through to Blink via the Electron wrapper. However, you need to set the touch-events command-line switch to enable it. My understanding is that that switch is passed through as a Chromium commandline switch.

我在此线程,虽然不是很多,但仍然无法在OSX上正常工作建立。 Electron的文档非常稀疏... touch-events 开关甚至未在其 CLI文档。希望这会有所帮助。

I found more info on this thread, though not very much, and still haven't gotten things working on my OSX setup. Electron's documentation is very sparse...the touch-events switch isn't even listed in their CLI docs. Hope this helps.

这篇关于电子为触摸屏启用触摸事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆