fix ctx pos when window is scrollable

toast
Kit Kasune 3 years ago
parent 82189f702c
commit b54dd68214
  1. 2
      scripts/contextmenu/createcontext.js

@ -3,5 +3,5 @@ module.exports = (e, target, window) => {
let ctx = document.getElementById('ctx');
ctx.style.display = 'block';
ctx.style.left = `${Math.min(e.pageX, (window.innerWidth - (ctx.clientWidth + 2)))}px`;
ctx.style.top = `${Math.min(e.pageY, (window.innerHeight - (ctx.clientHeight + 2)))}px`;
ctx.style.top = `${Math.min(e.pageY, ((window.innerHeight + window.scrollY) - (ctx.clientHeight + 2)))}px`;
};
Loading…
Cancel
Save