inputItem movement

This commit is contained in:
Andrew Gundersen 2021-03-05 09:39:54 -06:00
commit 654bf45612
3 changed files with 9 additions and 11 deletions

View file

@ -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

View file

@ -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