@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.
Files changed (2) hide show
  1. package/dist/index.js +10 -2
  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
- posX = Math.max(0, posX);
2072
- posY = Math.max(0, posY);
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"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kerkhoff-ict/solora",
3
- "version": "2.1.4",
3
+ "version": "2.1.5",
4
4
  "description": "Simple CSS component library",
5
5
  "main": "dist/index.js",
6
6
  "style": "dist/index.css",