From 60a78afdab25af48d862dc639e2b093902d27ca1 Mon Sep 17 00:00:00 2001 From: cpsdqs Date: Mon, 9 Oct 2017 07:20:29 +0200 Subject: [PATCH] Fix soft keyboard not working --- js/term/screen.js | 4 ++-- js/term/soft_keyboard.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/js/term/screen.js b/js/term/screen.js index 49e76ec..e1aa454 100644 --- a/js/term/screen.js +++ b/js/term/screen.js @@ -137,7 +137,7 @@ module.exports = class TermScreen extends EventEmitter { let touchDidMove = false let getTouchPositionOffset = touch => { - let rect = this.canvas.getBoundingClientRect() + let rect = this.layout.canvas.getBoundingClientRect() return [touch.clientX - rect.left, touch.clientY - rect.top] } @@ -145,7 +145,7 @@ module.exports = class TermScreen extends EventEmitter { touchPosition = getTouchPositionOffset(e.touches[0]) touchDidMove = false touchDownTime = Date.now() - }, { passive: true }) + }) this.layout.on('touchmove', e => { touchPosition = getTouchPositionOffset(e.touches[0]) diff --git a/js/term/soft_keyboard.js b/js/term/soft_keyboard.js index 9d89960..f5d78a9 100644 --- a/js/term/soft_keyboard.js +++ b/js/term/soft_keyboard.js @@ -18,7 +18,7 @@ module.exports = function (screen, input) { let updateInputPosition = function () { 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)` }