1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-05 10:39:25 +02:00

Translate pointer events into touch events.

This commit is contained in:
Simo Kinnunen 2015-09-14 20:33:59 +09:00
parent 2ee767ffed
commit a98cc67e2c
3 changed files with 98 additions and 6 deletions

View file

@ -11,10 +11,12 @@ var lifecycle = require('../../../../util/lifecycle')
var VncServer = require('./util/server')
var VncConnection = require('./util/connection')
var PointerTranslator = require('./util/pointertranslator')
module.exports = syrup.serial()
.dependency(require('../screen/stream'))
.define(function(options, screenStream) {
.dependency(require('../touch'))
.define(function(options, screenStream, touch) {
var log = logger.createLogger('device:plugins:vnc')
function createServer() {
@ -63,6 +65,24 @@ module.exports = syrup.serial()
, updateRequests: 0
}
var pointerTranslator = new PointerTranslator()
pointerTranslator.on('touchdown', function(event) {
touch.touchDown(event)
})
pointerTranslator.on('touchmove', function(event) {
touch.touchMove(event)
})
pointerTranslator.on('touchup', function(event) {
touch.touchUp(event)
})
pointerTranslator.on('touchcommit', function() {
touch.touchCommit()
})
function vncStartListener(frameProducer) {
return new Promise(function(resolve/*, reject*/) {
connState.frameWidth = frameProducer.banner.virtualWidth
@ -126,6 +146,10 @@ module.exports = syrup.serial()
maybeSendFrame()
})
conn.on('pointer', function(event) {
pointerTranslator.push(event)
})
conn.on('close', function() {
screenStream.broadcastSet.remove(id)
})