remove outdated files
This commit is contained in:
parent
a4ff3a36b9
commit
0f31b569bc
2 changed files with 0 additions and 95 deletions
|
|
@ -1,29 +0,0 @@
|
|||
|
||||
// Update xShort or yShort value.
|
||||
export function calcSideProximity (inputItemX: number, winW: number) {
|
||||
let short = winW - inputItemX
|
||||
|
||||
if (short > winW / 2) {
|
||||
short = inputItemX
|
||||
}
|
||||
|
||||
return short
|
||||
}
|
||||
|
||||
|
||||
// Update inputItemX or inputItemY value.
|
||||
export function calcPosition (inputItemPosition: number, percent: number,
|
||||
short: number, win: number) {
|
||||
|
||||
// Is it close to the right/left side?
|
||||
if (percent > 0.75) {
|
||||
inputItemPosition = win - short
|
||||
}
|
||||
|
||||
// Is it not close to a side?
|
||||
if (percent < 0.75 && percent > 0.25) {
|
||||
inputItemPosition = win * percent
|
||||
}
|
||||
|
||||
return inputItemPosition
|
||||
}
|
||||
66
src/test.vue
66
src/test.vue
|
|
@ -1,66 +0,0 @@
|
|||
// Snap to the nearest window border and update percentages. Called when
|
||||
// user stops dragging the inputItem.
|
||||
const mouseUp = (e: any) => {
|
||||
window.removeEventListener('mousemove', divMove, true);
|
||||
|
||||
const winW = window.innerWidth
|
||||
const winH = window.innerHeight
|
||||
console.log(`Window dimensions: W${winW} H${winH}`)
|
||||
|
||||
// First, are we changing inputItemX or inputItemY?
|
||||
|
||||
let xShort = winW - inputItemX.value
|
||||
if (xShort > winW / 2) {
|
||||
xShort = inputItemX.value
|
||||
}
|
||||
|
||||
let yShort = winH - inputItemY.value
|
||||
if (yShort > winH / 2) {
|
||||
yShort = inputItemY.value
|
||||
}
|
||||
|
||||
const shortest = (xShort < yShort) ? "inputItemX" : "inputItemY"
|
||||
|
||||
// Then, are we tranlating it positive or negative?
|
||||
// To answer this, we see which side is it closer to.
|
||||
// We also update percentages to aid in window resizing (handleResize).
|
||||
|
||||
if (shortest == "inputItemX") {
|
||||
if (inputItemX.value < winW / 2) {
|
||||
inputItemX.value = 0
|
||||
percentX = 0.0
|
||||
} else {
|
||||
inputItemX.value = winW - 38
|
||||
percentX = 1.0
|
||||
}
|
||||
percentY = inputItemY.value / winH
|
||||
} else {
|
||||
if (inputItemY.value < winH / 2) {
|
||||
inputItemY.value = 0
|
||||
percentY = 0.0
|
||||
} else {
|
||||
inputItemY.value = winH - 38
|
||||
percentY = 1.0
|
||||
}
|
||||
percentX = inputItemX.value / winW
|
||||
|
||||
}
|
||||
console.log(`Percents updated: iX: ${percentX} iY: ${percentY}`)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (percentX == 1.0) {
|
||||
inputItemX.value = window.innerWidth * percentX - 38
|
||||
} else {
|
||||
inputItemX.value = window.innerWidth * percentX
|
||||
}
|
||||
|
||||
if (percentY == 1.0) {
|
||||
inputItemY.value = window.innerHeight * percentY - 38
|
||||
} else {
|
||||
inputItemY.value = window.innerHeight * percentY
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue