@kerkhoff-ict/solora 2.1.4 → 2.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +10 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2068,8 +2068,16 @@ function initContextMenu() {
|
|
|
2068
2068
|
let posY = e.clientY;
|
|
2069
2069
|
const menuWidth = menu.offsetWidth;
|
|
2070
2070
|
const menuHeight = menu.offsetHeight;
|
|
2071
|
-
|
|
2072
|
-
|
|
2071
|
+
const windowWidth = window.innerWidth;
|
|
2072
|
+
const windowHeight = window.innerHeight;
|
|
2073
|
+
if (posX + menuWidth > windowWidth) {
|
|
2074
|
+
posX = posX - menuWidth;
|
|
2075
|
+
}
|
|
2076
|
+
if (posY + menuHeight > windowHeight) {
|
|
2077
|
+
posY = posY - menuHeight;
|
|
2078
|
+
}
|
|
2079
|
+
posX = Math.max(5, posX);
|
|
2080
|
+
posY = Math.max(5, posY);
|
|
2073
2081
|
menu.style.left = `${posX}px`;
|
|
2074
2082
|
menu.style.top = `${posY}px`;
|
|
2075
2083
|
requestAnimationFrame(() => menu.classList.add("visible"));
|