mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-06-09 20:47:24 +00:00
add padding to normalize out of bounds context menu
This commit is contained in:
parent
57a72fd3b5
commit
9866f5fea9
@ -20,18 +20,17 @@ export default (mouseX, mouseY) => {
|
|||||||
let normalizedX = mouseX;
|
let normalizedX = mouseX;
|
||||||
let normalizedY = mouseY;
|
let normalizedY = mouseY;
|
||||||
|
|
||||||
// console.log(mouseX, mouseY);
|
|
||||||
// ? normalize on X
|
// ? normalize on X
|
||||||
if (outOfBoundsOnX) {
|
if (outOfBoundsOnX) {
|
||||||
normalizedX = scopeOffsetX + scope.clientWidth - contextMenu.clientWidth;
|
normalizedX = scopeOffsetX + scope.clientWidth - contextMenu.clientWidth;
|
||||||
|
normalizedX -= 10
|
||||||
}
|
}
|
||||||
|
|
||||||
// ? normalize on Y
|
// ? normalize on Y
|
||||||
if (outOfBoundsOnY) {
|
if (outOfBoundsOnY) {
|
||||||
normalizedY = scopeOffsetY + scope.clientHeight - contextMenu.clientHeight;
|
normalizedY = scopeOffsetY + scope.clientHeight - contextMenu.clientHeight;
|
||||||
|
normalizedY -= 10
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(normalizedX, normalizedY);
|
|
||||||
|
|
||||||
return { normalizedX, normalizedY };
|
return { normalizedX, normalizedY };
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user