1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-06 03:50:04 +02:00

Use InputAgent for the keyboard.

This commit is contained in:
Simo Kinnunen 2014-02-17 19:27:45 +09:00
parent 30fdc62711
commit bc9d356d7f
12 changed files with 323 additions and 83 deletions

View file

@ -18,6 +18,7 @@ define(['./_module'], function(app) {
var loader = new Image()
, canvas = element.find('canvas')[0]
, finger = element.find('span')
, input = element.find('textarea')
, g = canvas.getContext('2d')
, displayWidth = 0
, displayHeight = 0
@ -96,6 +97,7 @@ define(['./_module'], function(app) {
function downListener(e) {
e.preventDefault()
input[0].focus()
element.addClass('fingering')
sendTouch('touchDown', e)
element.bind('mousemove', moveListener)
@ -124,6 +126,24 @@ define(['./_module'], function(app) {
stop()
})
input.bind('keydown', function(e) {
$scope.control.keyDown(e.keyCode)
})
input.bind('keyup', function(e) {
$scope.control.keyUp(e.keyCode)
})
input.bind('keypress', function(e) {
e.preventDefault() // no need to change value
$scope.control.type(String.fromCharCode(e.charCode))
})
input.bind('paste', function(e) {
e.preventDefault() // no need to change value
$scope.control.type(e.clipboardData.getData('text/plain'))
})
element.bind('mousedown', downListener)
updateDisplaySize()
loadScreen()