mirror of
https://github.com/openstf/stf
synced 2025-10-04 10:19:30 +02:00
New multitouch-compatible touch system.
This commit is contained in:
parent
38d20eba9a
commit
6c09a53d55
15 changed files with 861 additions and 280 deletions
|
@ -82,19 +82,6 @@ module.exports = function(options) {
|
|||
sub.unsubscribe(channel)
|
||||
}
|
||||
|
||||
function createTouchHandler(Klass) {
|
||||
return function(channel, data) {
|
||||
push.send([
|
||||
channel
|
||||
, wireutil.envelope(new Klass(
|
||||
data.seq
|
||||
, data.x
|
||||
, data.y
|
||||
))
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
function createKeyHandler(Klass) {
|
||||
return function(channel, data) {
|
||||
push.send([
|
||||
|
@ -268,10 +255,71 @@ module.exports = function(options) {
|
|||
dbapi.resetUserSettings(user.email)
|
||||
})
|
||||
// Touch events
|
||||
.on('input.touchDown', createTouchHandler(wire.TouchDownMessage))
|
||||
.on('input.touchMove', createTouchHandler(wire.TouchMoveMessage))
|
||||
.on('input.touchUp', createTouchHandler(wire.TouchUpMessage))
|
||||
.on('input.tap', createTouchHandler(wire.TapMessage))
|
||||
.on('input.touchDown', function(channel, data) {
|
||||
push.send([
|
||||
channel
|
||||
, wireutil.envelope(new wire.TouchDownMessage(
|
||||
data.seq
|
||||
, data.contact
|
||||
, data.x
|
||||
, data.y
|
||||
, data.pressure
|
||||
))
|
||||
])
|
||||
})
|
||||
.on('input.touchMove', function(channel, data) {
|
||||
push.send([
|
||||
channel
|
||||
, wireutil.envelope(new wire.TouchMoveMessage(
|
||||
data.seq
|
||||
, data.contact
|
||||
, data.x
|
||||
, data.y
|
||||
, data.pressure
|
||||
))
|
||||
])
|
||||
})
|
||||
.on('input.touchUp', function(channel, data) {
|
||||
push.send([
|
||||
channel
|
||||
, wireutil.envelope(new wire.TouchUpMessage(
|
||||
data.seq
|
||||
, data.contact
|
||||
))
|
||||
])
|
||||
})
|
||||
.on('input.touchCommit', function(channel, data) {
|
||||
push.send([
|
||||
channel
|
||||
, wireutil.envelope(new wire.TouchCommitMessage(
|
||||
data.seq
|
||||
))
|
||||
])
|
||||
})
|
||||
.on('input.touchReset', function(channel, data) {
|
||||
push.send([
|
||||
channel
|
||||
, wireutil.envelope(new wire.TouchResetMessage(
|
||||
data.seq
|
||||
))
|
||||
])
|
||||
})
|
||||
.on('input.gestureStart', function(channel, data) {
|
||||
push.send([
|
||||
channel
|
||||
, wireutil.envelope(new wire.GestureStartMessage(
|
||||
data.seq
|
||||
))
|
||||
])
|
||||
})
|
||||
.on('input.gestureStop', function(channel, data) {
|
||||
push.send([
|
||||
channel
|
||||
, wireutil.envelope(new wire.GestureStopMessage(
|
||||
data.seq
|
||||
))
|
||||
])
|
||||
})
|
||||
// Key events
|
||||
.on('input.keyDown', createKeyHandler(wire.KeyDownMessage))
|
||||
.on('input.keyUp', createKeyHandler(wire.KeyUpMessage))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue