refactor main and rendered ipc
This commit is contained in:
parent
17e4b06948
commit
ddb2f4df0f
28 changed files with 758 additions and 211 deletions
|
|
@ -4,6 +4,8 @@ import { useIpc } from '@/modules/ipc';
|
|||
import { Ref, ref, watch, onMounted, onUnmounted } from "vue";
|
||||
import keyboardNameMap from "../keyBoardMaps/keyboardNameMap";
|
||||
import { clientMessage, renderMessage } from '@/modules/message';
|
||||
import { postMessage } from "@/ipcRend/session";
|
||||
|
||||
|
||||
//---Animations-----------------------------------------------
|
||||
|
||||
|
|
@ -19,7 +21,7 @@ function showTextInput () {
|
|||
translateX: [t1, t2],
|
||||
scale: [0.3, 1],
|
||||
duration: 500,
|
||||
easing: 'easeOutExpo',
|
||||
easing: 'easeOutExpo',
|
||||
})
|
||||
|
||||
}
|
||||
|
|
@ -33,7 +35,7 @@ function hideTextInput() {
|
|||
translateX: t,
|
||||
scale: 0.3,
|
||||
duration: 500,
|
||||
easing: 'easeOutExpo',
|
||||
easing: 'easeOutExpo',
|
||||
})
|
||||
|
||||
}
|
||||
|
|
@ -45,7 +47,7 @@ function switchSide(currentSide: string) {
|
|||
targets: '#textInput',
|
||||
translateX: t,
|
||||
duration: 500,
|
||||
easing: 'easeOutExpo',
|
||||
easing: 'easeOutExpo',
|
||||
})
|
||||
|
||||
}
|
||||
|
|
@ -75,7 +77,7 @@ export default function useTextInputController(elementX: Ref) {
|
|||
textInput.value = "";
|
||||
textInput.blur();
|
||||
}
|
||||
|
||||
|
||||
hideTextInput()
|
||||
firstKey = true;
|
||||
typing.value = false;
|
||||
|
|
@ -87,9 +89,9 @@ export default function useTextInputController(elementX: Ref) {
|
|||
|
||||
// Create the message.
|
||||
const message = renderMessage(
|
||||
textInput.value,
|
||||
false,
|
||||
"",
|
||||
textInput.value,
|
||||
false,
|
||||
"",
|
||||
"sf"
|
||||
)
|
||||
|
||||
|
|
@ -97,7 +99,7 @@ export default function useTextInputController(elementX: Ref) {
|
|||
|
||||
// Send it to the backend for processing.
|
||||
const clientM = clientMessage(textInput.value, false, message.uid);
|
||||
post('client-message', clientM);
|
||||
postMessage(clientM);
|
||||
|
||||
clearInput()
|
||||
}
|
||||
|
|
@ -115,9 +117,9 @@ export default function useTextInputController(elementX: Ref) {
|
|||
|
||||
const onKeyDown = (e: KeyboardEvent) => {
|
||||
const key = keyboardNameMap[e.keyCode]
|
||||
|
||||
|
||||
if (textInput) {
|
||||
|
||||
|
||||
// Only runs on firstKey.
|
||||
if (firstKey) {
|
||||
|
||||
|
|
@ -165,7 +167,7 @@ export default function useTextInputController(elementX: Ref) {
|
|||
switchSide(side)
|
||||
side = "left"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
if (winW - elementX > 230) {
|
||||
|
|
@ -173,7 +175,7 @@ export default function useTextInputController(elementX: Ref) {
|
|||
side = "right"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue