Module: nagvis
Branch: nagvis-1.4
Commit: 48f9e7e776bea9cd77044502315d075dffb66628
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis/nagvis;a=commit;h=48f9e7e776bea9cd77044502315d075dffb66628

Author: Lars Michelsen <[email protected]>
Date:   Fri Sep 25 23:33:18 2009 +0200

#62 Trying to place the context menu on all sides when it would be rendered out 
of the screen

---

 nagvis/nagvis/includes/js/frontendContext.js |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/nagvis/nagvis/includes/js/frontendContext.js 
b/nagvis/nagvis/includes/js/frontendContext.js
index 7cbed1a..fb930d8 100644
--- a/nagvis/nagvis/includes/js/frontendContext.js
+++ b/nagvis/nagvis/includes/js/frontendContext.js
@@ -147,6 +147,22 @@ 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', 
''));
+               if(contextLeft+contextMenu.clientWidth > pageWidth()) {
+                       // move the context menu to the left 
+                       contextMenu.style.left = contextLeft - 
contextMenu.clientWidth + 'px';
+               }
+               contextLeft = null;
+               
+               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';
+               }
+               contextTop = null;
                
                // Append to visible menus array
                _openContextMenus.push(contextMenu);


------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to