From 20140b16b40de96cad795202479cbb19c7cb8d14 Mon Sep 17 00:00:00 2001 From: Andrew Gundersen Date: Tue, 9 Mar 2021 21:26:29 -0600 Subject: [PATCH] styling for input item --- crash.log | 2 + src/components/inputItem/inputController.ts | 11 ++ src/components/inputItem/inputItem.vue | 107 ++++++++++++-------- 3 files changed, 80 insertions(+), 40 deletions(-) diff --git a/crash.log b/crash.log index 14b4301..83885fe 100644 --- a/crash.log +++ b/crash.log @@ -45,3 +45,5 @@ PID 65740 received SIGSEGV for address: 0x7fbddef00000 0 segfault-handler.node 0x0000000116e6ae60 _ZL16segfault_handleriP9__siginfoPv + 304 PID 65817 received SIGSEGV for address: 0x7fe23f39d000 0 segfault-handler.node 0x0000000110840e60 _ZL16segfault_handleriP9__siginfoPv + 304 +PID 93442 received SIGSEGV for address: 0x7f91092e1000 +0 segfault-handler.node 0x0000000111beae60 _ZL16segfault_handleriP9__siginfoPv + 304 diff --git a/src/components/inputItem/inputController.ts b/src/components/inputItem/inputController.ts index 6c9570d..860c345 100644 --- a/src/components/inputItem/inputController.ts +++ b/src/components/inputItem/inputController.ts @@ -28,6 +28,7 @@ export default function useInputController() { // send message on ENTER. const onEnter = () => { + if (input.value) { // remove first character of input. const text = input.value.substring(1); @@ -48,10 +49,12 @@ export default function useInputController() { if (textInput) textInput.value = ''; input.value = " "; } + } // update input on keydown event & listen for special commands. const onKeyDown = (e: KeyboardEvent) => { + if (textInput) textInput.focus(); // keyboardCharMap is an array of arrays, with each inner @@ -64,6 +67,7 @@ export default function useInputController() { if (e.shiftKey) { iCol = 1; } + const ch = keyboardCharMap[e.keyCode][iCol]; // Optionally do things with non-printables, @@ -84,6 +88,7 @@ export default function useInputController() { default: input.value += ch; } + } // stop stream recording and render audio message on space key up event. @@ -122,12 +127,16 @@ export default function useInputController() { // watch keyboard input & update current state. watch(input, (input, prevInput) => { + + // if (prevInput !== "" || prevInput.length > 0) { if (!isRecording.value) { isTyping.value = true; } return; } + + // if (input === " " && isRecording.value === false) { isTyping.value = false; isRecording.value = true; @@ -137,7 +146,9 @@ export default function useInputController() { }); return; } + isTyping.value = true; + }); return { diff --git a/src/components/inputItem/inputItem.vue b/src/components/inputItem/inputItem.vue index 32019ac..452bc24 100644 --- a/src/components/inputItem/inputItem.vue +++ b/src/components/inputItem/inputItem.vue @@ -5,16 +5,21 @@ :class="{ playing: isRecording }" :style="{ top: `${elementY}px`, left: `${elementX}px` }" > + + - -
-
A
- -
+ +
+
+ + + + -- 2.43.0