Author:   Lars Michelsen <[email protected]>
Date:     Sun Nov 27 21:35:45 2011 +0100
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Sun Nov 27 21:35:45 2011 +0100

Ignoring right clicks and clicks on the header menu when currently
adding an object to the map

---

 ChangeLog                             |    2 ++
 share/frontend/nagvis-js/js/edit.js   |   17 +++++++++++++++--
 share/frontend/nagvis-js/js/nagvis.js |    1 -
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 78743a9..69606cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,8 @@ Frontend
   * Reimplemented the "clone object" functionality in edit mode
   * Only show the edit links in context menu when permitted to edit the map
   * long text values with no spaces do not stretch the add/modify dialog 
anymore
+  * Ignoring right clicks and clicks on the header menu when currently adding
+    an object to the map
   * Bugfix: Not adding default_params parameter to all maps after editing the
     global map configuration using the web frontend
   * Bugfix: Don't enable map_image when not set when editing the global
diff --git a/share/frontend/nagvis-js/js/edit.js 
b/share/frontend/nagvis-js/js/edit.js
index ac6ae4b..9a0b92c 100644
--- a/share/frontend/nagvis-js/js/edit.js
+++ b/share/frontend/nagvis-js/js/edit.js
@@ -401,6 +401,21 @@ function addObject(e, objType, viewType, numLeft, action) {
 function getEventMousePos(e) {
     var event = !e ? window.event : e;
 
+    // Only accept "left" mouse clicks
+    if(getButton(event) != 'LEFT')
+        return;
+
+    // Ignore clicks on the header menu
+    if(event.target) {
+        var target = event.target;
+        while(target) {
+            if(target.id && target.id == 'header') {
+                return;
+            }
+            target = target.parentNode;
+        }
+    }
+
     if (event.pageX || event.pageY) {
         posx = event.pageX;
         posy = event.pageY;
@@ -409,8 +424,6 @@ function getEventMousePos(e) {
         posy = event.clientY;
     }
 
-    // FIXME: Check the clicked area. Only handle clicks on the map!
-
     // Substract height of header menu here
     posy -= getHeaderHeight();
 
diff --git a/share/frontend/nagvis-js/js/nagvis.js 
b/share/frontend/nagvis-js/js/nagvis.js
index b485806..2baeae2 100644
--- a/share/frontend/nagvis-js/js/nagvis.js
+++ b/share/frontend/nagvis-js/js/nagvis.js
@@ -685,7 +685,6 @@ function oDump(object, depth, max){
 
 /**
  * This counts the elements in an object
- * FIXME: There must be a better way!
  */
 function oLength(object) {
     var c = 0;


------------------------------------------------------------------------------
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. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to