add padding to normalize out of bounds context menu

This commit is contained in:
geoffrey45 2022-03-14 08:45:03 +03:00
parent 57a72fd3b5
commit 9866f5fea9

View File

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