feat: move context menu to the left of the cursor if any part of it is beyond the right side of the viewport
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful

This commit is contained in:
SauceyRed 2025-08-07 09:01:18 +02:00
parent 51f8c28c54
commit 0540f22f5d
Signed by: sauceyred
GPG key ID: 2BF92EB6D8A5CCA7

View file

@ -18,6 +18,10 @@ onMounted(() => {
if (contextMenu) {
contextMenu.style.left = props.pointerX.toString() + "px";
contextMenu.style.top = props.pointerY.toString() + "px";
const rect = contextMenu.getBoundingClientRect();
if (rect.right > (window.innerWidth || document.documentElement.clientWidth)) {
contextMenu.style.left = (props.pointerX - contextMenu.clientWidth).toString() + "px";
}
}
});