ContextMenu should never leave the screen again

This commit is contained in:
Tobias Reich 2014-01-31 22:27:58 +01:00
parent 3ad59279b3
commit 6f09515c20

View File

@ -21,11 +21,21 @@ contextMenu = {
if ((mouse_x+$(".contextmenu").outerWidth(true))>$("html").width()) orientation = "left";
if ((mouse_y+$(".contextmenu").outerHeight(true))>$("html").height()) mouse_y -= (mouse_y+$(".contextmenu").outerHeight(true)-$("html").height())
if (mouse_x>$(document).width()) mouse_x = $(document).width();
if (mouse_x<0) mouse_x = 0;
if (mouse_y>$(document).height()) mouse_y = $(document).height();
if (mouse_y<0) mouse_y = 0;
if (orientation==="left") mouse_x -= $(".contextmenu").outerWidth(true);
if (!mouse_x||!mouse_y) {
mouse_x = "10px";
mouse_y = "10px";
if (mouse_x===null||
mouse_x===undefined||
mouse_x===NaN||
mouse_y===null||
mouse_y===undefined||
mouse_y===NaN) {
mouse_x = "10px";
mouse_y = "10px";
}
$(".contextmenu").css({
@ -95,7 +105,7 @@ contextMenu = {
mouse_y = e.pageY - $(document).scrollTop(),
items;
if (albumID==="0"||albumID==="f"||albumID==="s") return false;
if (albumID==="0"||albumID==="f"||albumID==="s") return false;
contextMenu.fns = [
function() { album.setTitle(albumID) },