1
This commit is contained in:
parent
be40fc0ccf
commit
d70373c203
1 changed files with 2 additions and 37 deletions
|
|
@ -28,43 +28,8 @@ function calcPositionXDrag (elementId: string, short: number, mouse: number) {
|
||||||
|
|
||||||
const elementRect = element.getBoundingClientRect();
|
const elementRect = element.getBoundingClientRect();
|
||||||
|
|
||||||
// If we are close to a side...
|
|
||||||
if (short <= 15) {
|
|
||||||
|
|
||||||
elementPosition = elementRect.left // no change
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
elementPosition = elementRect.left + mouse;
|
elementPosition = elementRect.left + mouse;
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(`leftSide: ${elementRect.left}`)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return elementPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
function calcPositionYDrag (elementId: string, short: number, mouse: number) {
|
|
||||||
let elementPosition = 0;
|
|
||||||
const element = document.getElementById(elementId);
|
|
||||||
|
|
||||||
if (element) {
|
|
||||||
|
|
||||||
const elementRect = element.getBoundingClientRect();
|
|
||||||
|
|
||||||
if (short <= 15 && !xTouch) {
|
|
||||||
|
|
||||||
elementPosition = elementRect.top // no change
|
|
||||||
xTouch = true
|
|
||||||
|
|
||||||
} else {
|
|
||||||
elementPosition = elementRect.top + mouse;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return elementPosition;
|
return elementPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -95,8 +60,8 @@ export default function draggify(elementId: string, xStart: number,
|
||||||
const elementY = ref(0);
|
const elementY = ref(0);
|
||||||
|
|
||||||
// Is inputItem touching the side?
|
// Is inputItem touching the side?
|
||||||
let xTouch = true;
|
const xTouch = true;
|
||||||
let yTouch = false;
|
const yTouch = false;
|
||||||
|
|
||||||
// Position of inputItem on terms of percentage of window.
|
// Position of inputItem on terms of percentage of window.
|
||||||
let percentX: number;
|
let percentX: number;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue