Module: nagvis Branch: master Commit: 418f25cd41d54e558da2e59ad845a083b52774fe URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=418f25cd41d54e558da2e59ad845a083b52774fe
Author: LaMi <[email protected]> Date: Tue Jan 12 10:15:46 2010 +0100 Changed context menu reposition algorithm not to reposition to the top when context menu would be out of sight --- share/frontend/nagvis-js/js/frontendContext.js | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/share/frontend/nagvis-js/js/frontendContext.js b/share/frontend/nagvis-js/js/frontendContext.js index 133dc1d..18df30c 100644 --- a/share/frontend/nagvis-js/js/frontendContext.js +++ b/share/frontend/nagvis-js/js/frontendContext.js @@ -161,7 +161,7 @@ function contextShow(event) { // Need to corrent the position by 30px in IE & FF. Don't know why... contextMenu.style.top = event.clientY + scrollTop - 30 + 'px'; contextMenu.style.display = ''; - + // Check if the context menu is "in screen". // When not: reposition var contextLeft = parseInt(contextMenu.style.left.replace('px', '')); @@ -173,8 +173,11 @@ function contextShow(event) { var contextTop = parseInt(contextMenu.style.top.replace('px', '')); if(contextTop+contextMenu.clientHeight > pageHeight()) { - // move the context menu to the left - contextMenu.style.top = contextTop - contextMenu.clientHeight + 'px'; + // Only move the context menu to the top when the new top will not be + // out of sight + if(contextTop - contextMenu.clientHeight >= 0) { + contextMenu.style.top = contextTop - contextMenu.clientHeight + 'px'; + } } contextTop = null; ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
