Author:   Lars Michelsen <[email protected]>
Date:     Thu Mar 27 10:06:36 2014 +0100
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Thu Mar 27 10:06:36 2014 +0100

FIX: Not altering relative object coordinates when zoom_scale_objects is 
disabled

---

 ChangeLog                                   |    2 ++
 etc/nagvis.ini.php-sample                   |    5 +++++
 share/frontend/nagvis-js/js/NagVisObject.js |   19 ++++++++++++++++---
 3 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2d05a55..9dd325b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
 Frontend:
   * FIX: Custom context actions: Conditions, e.g. filtering by custom vars, 
did not work
   * FIX: Fixed zoom of text in textbox objects in chrome
+  * FIX: Not altering relative object coordinates when zoom_scale_objects is
+  disabled
 
 1.8b3
 Frontend:
diff --git a/etc/nagvis.ini.php-sample b/etc/nagvis.ini.php-sample
index b66e5a6..6dd280a 100644
--- a/etc/nagvis.ini.php-sample
+++ b/etc/nagvis.ini.php-sample
@@ -287,6 +287,11 @@
 ;label_show=0
 ; Configure the colors used by weathermap lines
 
;line_weather_colors="10:#8c00ff,25:#2020ff,40:#00c0ff,55:#00f000,70:#f0f000,85:#ffc000,100:#ff0000"
+; Show mouse controllable elements for zooming the maps at the upper left 
corner of the map
+;zoombar=0
+; Enables scaling of the objects (icons, texts, lines, ...) when zooming the 
map. This can be disabled
+; to have the objects remain at the same size during zooming
+;zoom_scale_objects=1
 
 ; Options to configure the Overview page of NagVis
 [index]
diff --git a/share/frontend/nagvis-js/js/NagVisObject.js 
b/share/frontend/nagvis-js/js/NagVisObject.js
index 393002c..2071f15 100644
--- a/share/frontend/nagvis-js/js/NagVisObject.js
+++ b/share/frontend/nagvis-js/js/NagVisObject.js
@@ -648,6 +648,9 @@ var NagVisObject = Base.extend({
      * @author  Lars Michelsen <[email protected]>
      */
     parseCoord: function(val, dir, addZoom) {
+        if (addZoom === undefined)
+            addZoom = true;
+
         var coord = 0;
         if(!isRelativeCoord(val)) {
             coord = parseInt(val);
@@ -658,8 +661,18 @@ var NagVisObject = Base.extend({
                 var objectId  = parts[0];
                 var offset    = parts[1];
                 var refObj    = getMapObjByDomObjId(objectId);
-                if(refObj)
-                    coord = parseFloat(refObj.parseCoord(refObj.conf[dir], 
dir, false)) + parseFloat(offset);
+                if (refObj) {
+                    coord = parseFloat(refObj.parseCoord(refObj.conf[dir], 
dir, false));
+                    if (addZoom)
+                        coord = addZoomFactor(coord, true);
+
+                    if (addZoom)
+                        coord += addZoomFactor(parseFloat(offset), false);
+                    else
+                        coord += parseFloat(offset);
+
+                    return coord;
+                }
             } else {
                 // Only an object id. Get the coordinate and return it
                 var refObj = getMapObjByDomObjId(val);
@@ -668,7 +681,7 @@ var NagVisObject = Base.extend({
             }
         }
 
-        if(addZoom === undefined || addZoom === true)
+        if (addZoom)
             return addZoomFactor(coord, true);
         else
             return coord;


------------------------------------------------------------------------------
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to