From 6e88d4b47165173dea4a46b2d6283fbdfc962556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A2=E1=84=91=E1=85=B3=E1=86=AF=20=E1=84=82?= =?UTF-8?q?=E1=85=A9=E1=84=90=E1=85=B3=E1=84=87=E1=85=AE=E1=86=A8?= Date: Wed, 15 May 2019 20:37:48 +0900 Subject: [PATCH] Fix: position of keyboard and hand --- src/game/typing/lib/hand.js | 6 +++++- src/game/typing/lib/keyboard.js | 13 ++++++++----- src/game/typing/test/game.js | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/game/typing/lib/hand.js b/src/game/typing/lib/hand.js index 688b4d2..229f81b 100644 --- a/src/game/typing/lib/hand.js +++ b/src/game/typing/lib/hand.js @@ -27,9 +27,13 @@ function Hand(keyMapper) { this.little_finger.alpha = 0.5; this.hand.addChild(this.little_finger); + var maskOffsetY = 0; + if(isTypingTestApp()) + maskOffsetY = 40; + var mask = game.add.graphics(); mask.beginFill(0xffffff); - mask.drawRect(100, 300, 1028, 360); + mask.drawRect(100, 300 + maskOffsetY, 1028, 360); this.hand.mask = mask; } diff --git a/src/game/typing/lib/keyboard.js b/src/game/typing/lib/keyboard.js index 2720304..0eaea5d 100644 --- a/src/game/typing/lib/keyboard.js +++ b/src/game/typing/lib/keyboard.js @@ -279,6 +279,9 @@ Keyboard.prototype.getKeyPosY = function(text) { Keyboard.prototype.initKeyData = function(keyMapper) { + var row1offsetY = 0; + if(isTypingTestApp()) + row1offsetY = 80; // row 1 this.addFunctionKeyData( "Backquote", @@ -286,7 +289,7 @@ Keyboard.prototype.initKeyData = function(keyMapper) { Keyboard.ROW_1, KeyButton.LITTLE_FINGER, Keyboard.KEYBOARD_OFFSET_POS_X, - Keyboard.ROW_1_POS_Y, + Keyboard.ROW_1_POS_Y + row1offsetY, Keyboard.DEFAULT_KEY_SIZE_PX, Keyboard.DEFAULT_KEY_SIZE_PX, KeyButton.NORMAL_FUNCTION_KEY @@ -319,7 +322,7 @@ Keyboard.prototype.initKeyData = function(keyMapper) { Keyboard.ROW_2, KeyButton.NONE_FINGER, Keyboard.KEYBOARD_OFFSET_POS_X, - Keyboard.ROW_2_POS_Y, + Keyboard.ROW_2_POS_Y + row1offsetY, Keyboard.TAB_KEY_WIDTH_PX, Keyboard.DEFAULT_KEY_SIZE_PX, KeyButton.LEFT_FUNCTION_KEY @@ -345,7 +348,7 @@ Keyboard.prototype.initKeyData = function(keyMapper) { Keyboard.ROW_3, KeyButton.NONE_FINGER, Keyboard.KEYBOARD_OFFSET_POS_X, - Keyboard.ROW_3_POS_Y, + Keyboard.ROW_3_POS_Y + row1offsetY, Keyboard.CAPS_LOCK_KEY_WIDTH_PX, Keyboard.DEFAULT_KEY_SIZE_PX, KeyButton.LEFT_FUNCTION_KEY @@ -377,7 +380,7 @@ Keyboard.prototype.initKeyData = function(keyMapper) { Keyboard.ROW_4, KeyButton.LITTLE_FINGER, Keyboard.KEYBOARD_OFFSET_POS_X, - Keyboard.ROW_4_POS_Y, + Keyboard.ROW_4_POS_Y + row1offsetY, Keyboard.SHIFT_KEY_WIDTH_PX, Keyboard.DEFAULT_KEY_SIZE_PX, KeyButton.LEFT_FUNCTION_KEY @@ -408,7 +411,7 @@ Keyboard.prototype.initKeyData = function(keyMapper) { Keyboard.ROW_5, KeyButton.NONE_FINGER, Keyboard.KEYBOARD_OFFSET_POS_X, - Keyboard.ROW_5_POS_Y, + Keyboard.ROW_5_POS_Y + row1offsetY, Keyboard.CTRL_KEY_WIDTH_PX, Keyboard.DEFAULT_KEY_SIZE_PX, KeyButton.LEFT_FUNCTION_KEY diff --git a/src/game/typing/test/game.js b/src/game/typing/test/game.js index 31d2632..7479f64 100644 --- a/src/game/typing/test/game.js +++ b/src/game/typing/test/game.js @@ -101,7 +101,7 @@ var TypingTest = { // input text - this.inputTextContent = new InputTypeText(game.world.centerX, TYPING_CONTENT_Y + 100); + this.inputTextContent = new InputTypeText(game.world.centerX, TYPING_CONTENT_Y + 120); this.inputTextContent.anchor.set(0.5); this.inputTextContent.canvasInput.value(''); this.inputTextContent.canvasInput.focus();