From 654bf456121a68d9cacf82a5578693e4ba73c015 Mon Sep 17 00:00:00 2001 From: Andrew Gundersen Date: Fri, 5 Mar 2021 09:39:54 -0600 Subject: [PATCH] inputItem movement --- src/components/helpers.ts | 6 +++--- src/components/inputItem.vue | 4 ++-- src/views/messenger.vue | 10 ++++------ 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/components/helpers.ts b/src/components/helpers.ts index 022acc5..ec57775 100644 --- a/src/components/helpers.ts +++ b/src/components/helpers.ts @@ -16,13 +16,13 @@ export function calcPosition (inputItemPosition: number, percent: number, short: number, win: number) { // Is it close to the right/left side? - if (percent > 0.85) { + if (percent > 0.75) { inputItemPosition = win - short } // Is it not close to a side? - if (percent < 0.85 && percent > 0.15) { - inputItemPosition = inputItemPosition / win + if (percent < 0.75 && percent > 0.25) { + inputItemPosition = win * percent } return inputItemPosition diff --git a/src/components/inputItem.vue b/src/components/inputItem.vue index 6f10ab2..99bc6e7 100644 --- a/src/components/inputItem.vue +++ b/src/components/inputItem.vue @@ -50,13 +50,13 @@ export default defineComponent({ // Update position references when user is done moving inputItem. const onMouseUp = (e: any) => { - window.removeEventListener('mousemove'); + window.removeEventListener('mousemove', onMouseMove, true); const winW = window.innerWidth const winH = window.innerHeight xShort = calcSideProximity(inputItemX.value, winW) - yShort = calcSideProximity(inputItemX.value, winW) + yShort = calcSideProximity(inputItemY.value, winH) percentX = inputItemX.value / winW percentY = inputItemY.value / winH diff --git a/src/views/messenger.vue b/src/views/messenger.vue index e9499b9..e765719 100644 --- a/src/views/messenger.vue +++ b/src/views/messenger.vue @@ -1,8 +1,8 @@