Commit 2a39c23a authored by Andreas Heimann's avatar Andreas Heimann

fixed context menu offset on scroll

parent cc8795f6
let DOMContextMenu = document.querySelector(".contextmenu");
function ShowContextMenu(x, y) {
let DOMActiveSection = document.querySelector("section.active");
DOMContextMenu.classList.add("active");
if(x > window.innerWidth - DOMContextMenu.getBoundingClientRect().width) {
x = window.innerWidth - DOMContextMenu.getBoundingClientRect().width;
if(x > DOMActiveSection.clientWidth - DOMContextMenu.getBoundingClientRect().width) {
x = DOMActiveSection.clientWidth - DOMContextMenu.getBoundingClientRect().width;
}
if(y > window.innerHeight - DOMContextMenu.getBoundingClientRect().height) {
y = window.innerHeight - DOMContextMenu.getBoundingClientRect().height;
if(y > DOMActiveSection.clientHeight - DOMContextMenu.getBoundingClientRect().height) {
y = DOMActiveSection.clientHeight - DOMContextMenu.getBoundingClientRect().height;
}
DOMContextMenu.style.top = y + "px";
......
......@@ -129,7 +129,7 @@ function BuildLibrarySongDOM(songDetail, spinShareReference) {
e.preventDefault();
ClearContextMenu();
AddContextMenuItem("delete", locale.get('library.contextmenu.delete'), function() { ShowDeleteOverlay(songDetail); });
ShowContextMenu(e.clientX, e.clientY);
ShowContextMenu(e.pageX, e.pageY);
});
return songContainer;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment