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:
parent
30fdc62711
commit
bc9d356d7f
12 changed files with 323 additions and 83 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue