Fix soft keyboard not working

pull/1/head
cpsdqs 7 years ago
parent 4547ea668a
commit 60a78afdab
Signed by untrusted user: cpsdqs
GPG Key ID: 3F59586BB7448DD1
  1. 4
      js/term/screen.js
  2. 2
      js/term/soft_keyboard.js

@ -137,7 +137,7 @@ module.exports = class TermScreen extends EventEmitter {
let touchDidMove = false let touchDidMove = false
let getTouchPositionOffset = touch => { let getTouchPositionOffset = touch => {
let rect = this.canvas.getBoundingClientRect() let rect = this.layout.canvas.getBoundingClientRect()
return [touch.clientX - rect.left, touch.clientY - rect.top] return [touch.clientX - rect.left, touch.clientY - rect.top]
} }
@ -145,7 +145,7 @@ module.exports = class TermScreen extends EventEmitter {
touchPosition = getTouchPositionOffset(e.touches[0]) touchPosition = getTouchPositionOffset(e.touches[0])
touchDidMove = false touchDidMove = false
touchDownTime = Date.now() touchDownTime = Date.now()
}, { passive: true }) })
this.layout.on('touchmove', e => { this.layout.on('touchmove', e => {
touchPosition = getTouchPositionOffset(e.touches[0]) touchPosition = getTouchPositionOffset(e.touches[0])

@ -18,7 +18,7 @@ module.exports = function (screen, input) {
let updateInputPosition = function () { let updateInputPosition = function () {
if (!keyboardOpen) return if (!keyboardOpen) return
let [x, y] = screen.gridToScreen(screen.cursor.x, screen.cursor.y, true) let [x, y] = screen.layout.gridToScreen(screen.cursor.x, screen.cursor.y, true)
keyInput.style.transform = `translate(${x}px, ${y}px)` keyInput.style.transform = `translate(${x}px, ${y}px)`
} }

Loading…
Cancel
Save