inputItem movement
This commit is contained in:
parent
98dc03a77a
commit
654bf45612
3 changed files with 9 additions and 11 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue