Author:   Lars Michelsen <[email protected]>
Date:     Mon Jul  1 13:36:25 2013 +0200
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Mon Jul  1 13:36:25 2013 +0200

FIX: Fixed positions of labels on zoomed automaps

---

 ChangeLog                                          |    1 +
 share/frontend/nagvis-js/js/NagVisObject.js        |    2 +-
 .../frontend/nagvis-js/js/NagVisStatefulObject.js  |    6 +++---
 share/frontend/nagvis-js/js/nagvis.js              |   11 ++++++++++-
 4 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 71c27e1..0d696c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@ Automap:
   * Labels have now a white background to improve the text readability
   * Labels should not overlap on automaps with many hosts anymore
   * FIX: Rendering lines on zoomed automaps correctly
+  * FIX: Fixed positions of labels on zoomed automaps
 
 1.7.9
 Core:
diff --git a/share/frontend/nagvis-js/js/NagVisObject.js 
b/share/frontend/nagvis-js/js/NagVisObject.js
index cf2e6da..6e4186e 100644
--- a/share/frontend/nagvis-js/js/NagVisObject.js
+++ b/share/frontend/nagvis-js/js/NagVisObject.js
@@ -955,7 +955,7 @@ var NagVisObject = Base.extend({
 
         // Move the objects label when enabled
         if(this.conf.label_show && this.conf.label_show == '1')
-            this.moveLabel();
+            this.updateLabel();
 
         // Move child objects
         for(var i = 0, l = this.childs.length; i < l; i++)
diff --git a/share/frontend/nagvis-js/js/NagVisStatefulObject.js 
b/share/frontend/nagvis-js/js/NagVisStatefulObject.js
index 0618582..b4c9aa3 100644
--- a/share/frontend/nagvis-js/js/NagVisStatefulObject.js
+++ b/share/frontend/nagvis-js/js/NagVisStatefulObject.js
@@ -820,7 +820,7 @@ var NagVisStatefulObject = NagVisObject.extend({
      *
      * @author Lars Michelsen <[email protected]>
      */
-    moveLabel: function () {
+    updateLabel: function () {
         var label  = document.getElementById(this.conf.object_id + '-label');
         this.updateLabelPos(label);
         label  = null;
@@ -891,12 +891,12 @@ var NagVisStatefulObject = NagVisObject.extend({
             y = this.conf.label_y;
 
         if(this.conf.label_x && this.conf.label_x.toString() == 'center') {
-            var diff_x = parseInt(parseInt(oLabel.clientWidth) - 
this.getObjWidth()) / 2;
+            var diff_x = parseInt(parseInt(oLabel.clientWidth) - 
rmZoomFactor(this.getObjWidth())) / 2;
             x = this.parseCoord(this.parseLabelCoord(this.conf.x), 'x', false) 
- diff_x;
         }
 
         if(this.conf.label_y && this.conf.label_y.toString() == 'bottom') {
-            y = this.parseCoord(this.conf.y, 'y', false) + this.getObjHeight();
+            y = this.parseCoord(this.conf.y, 'y', false) + 
rmZoomFactor(this.getObjHeight());
         }
 
         // If there is a presign it should be relative to the objects x/y
diff --git a/share/frontend/nagvis-js/js/nagvis.js 
b/share/frontend/nagvis-js/js/nagvis.js
index caf9961..2bdcdf5 100644
--- a/share/frontend/nagvis-js/js/nagvis.js
+++ b/share/frontend/nagvis-js/js/nagvis.js
@@ -1320,14 +1320,23 @@ function zoomHandler(event) {
     obj.style.display = 'block';
     var width  = addZoomFactor(obj.width);
     var height = addZoomFactor(obj.height);
+
     obj.style.display = 'none';
 
     obj.width  = width;
     obj.height = height;
     // Now really show the image
     obj.style.display = 'block';
-    obj = null;
 
+    // Fix also the label position on e.g. automap nodes
+    var arr     = obj.id.split('-');
+    var map_obj = getMapObjByDomObjId(arr[0]);
+    if(map_obj && typeof(map_obj.updateLabel) == 'function') {
+        map_obj.updateLabel();
+    }
+
+    map_obj = null;
+    obj = null;
 }
 
 /**


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to