Author:   Lars Michelsen <[email protected]>
Date:     Mon Oct 10 22:04:55 2011 +0200
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Mon Oct 10 22:04:55 2011 +0200

Changed hiding code of hover menu

---

 share/frontend/nagvis-js/js/NagVisObject.js        |   14 +++++++-------
 .../frontend/nagvis-js/js/NagVisStatefulObject.js  |    7 +------
 share/frontend/nagvis-js/js/frontendHover.js       |   12 ++++++++++--
 3 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/share/frontend/nagvis-js/js/NagVisObject.js 
b/share/frontend/nagvis-js/js/NagVisObject.js
index 5b6651f..2233590 100644
--- a/share/frontend/nagvis-js/js/NagVisObject.js
+++ b/share/frontend/nagvis-js/js/NagVisObject.js
@@ -282,15 +282,15 @@ var NagVisObject = Base.extend({
     },
 
     /**
-     * Returns true when the hover menu is displayed at the moment
+     * Returns true when the given menu is displayed at the moment
      */
-    hoverMenuOpened: function() {
-        var hoverMenu = document.getElementById(this.conf.object_id + 
'-hover');
-        if(hoverMenu) {
-            if(hoverMenu.style.display !== 'none') {
+    menuOpened: function(ty) {
+        var menu = document.getElementById(this.conf.object_id + '-' + ty);
+        if(menu) {
+            if(menu.style.display !== 'none') {
                 return true;
             }
-            hoverMenu = null;
+            menu = null;
         }
         return false;
     },
@@ -369,7 +369,7 @@ var NagVisObject = Base.extend({
             // Add eventhandlers for hover menu
             if(oObj) {
                 oObj.onmousemove = function(e) { var id = objId; var iH = 
iHoverDelay; displayHoverMenu(e, id, iH); id = null; iH = null; };
-                oObj.onmouseout = function() { hoverHide(); };
+                oObj.onmouseout = function(e) { var id = objId; hoverHide(id); 
id = null; };
             }
 
             // Is already done during map rendering before. But the hover menu
diff --git a/share/frontend/nagvis-js/js/NagVisStatefulObject.js 
b/share/frontend/nagvis-js/js/NagVisStatefulObject.js
index 4d3ec8a..a284773 100644
--- a/share/frontend/nagvis-js/js/NagVisStatefulObject.js
+++ b/share/frontend/nagvis-js/js/NagVisStatefulObject.js
@@ -319,11 +319,6 @@ var NagVisStatefulObject = NagVisObject.extend({
         var oHover = doc.getElementById(this.conf.object_id+'-hover');
         if(oHover) {
             try {
-                // Preserve the hover coords when the hover menu is open at 
the moment
-                if(!this.hoverMenuOpened()) {
-                    this.hoverX = null;
-                    this.hoverY = null;
-                }
                 this.parsedObject.removeChild(oHover);
             } catch(e) {}
             oHover = null;
@@ -373,7 +368,7 @@ var NagVisStatefulObject = NagVisObject.extend({
         this.getHoverMenu(this.getJsObjId());
 
         // Display the hover menu when it was open before re-rendering
-        if(this.hoverMenuOpened() && this.hoverX !== null) {
+        if(this.hoverX !== null) {
             hoverShow(this.hoverX, this.hoverY, this.conf.object_id);
         }
     },
diff --git a/share/frontend/nagvis-js/js/frontendHover.js 
b/share/frontend/nagvis-js/js/frontendHover.js
index 6cc35bf..2715369 100644
--- a/share/frontend/nagvis-js/js/frontendHover.js
+++ b/share/frontend/nagvis-js/js/frontendHover.js
@@ -42,7 +42,7 @@ function hoverOpen() {
  *
  * @author     Lars Michelsen <[email protected]>
  */
-function hoverHide() {
+function hoverHide(id) {
     // Loop all open hover menus
     while(_openHoverMenus.length > 0) {
         _openHoverMenus[0].style.display = 'none';
@@ -58,11 +58,18 @@ function hoverHide() {
 
     // Change cursor to auto when hiding hover menu
     document.body.style.cursor = 'auto';
+
+    var obj = getMapObjByDomObjId(id);
+    if(obj) {
+        obj.hoverX = null;
+        obj.hoverY = null;
+        obj = null;
+    }
 }
 
 function hoverShow(x, y, id) {
     // Hide all other hover menus
-    hoverHide();
+    hoverHide(id);
 
     var hoverSpacer = 5;
     var minWidth = 400;
@@ -70,6 +77,7 @@ function hoverShow(x, y, id) {
     var obj = getMapObjByDomObjId(id);
     obj.hoverX = x;
     obj.hoverY = y;
+    obj = null;
 
     // document.body.scrollTop does not work in IE
     var scrollTop = document.body.scrollTop ? document.body.scrollTop :


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to