Module: nagvis
Branch: master
Commit: d5b03410db925edcc4527f0aa6dce1ea30013838
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=d5b03410db925edcc4527f0aa6dce1ea30013838

Author: Lars Michelsen <[email protected]>
Date:   Sun Jul 25 14:50:00 2010 +0200

#335 labels have the correct positions after moving now

---

 share/frontend/wui/js/wui.js |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/share/frontend/wui/js/wui.js b/share/frontend/wui/js/wui.js
index 3e08778..0708fb4 100644
--- a/share/frontend/wui/js/wui.js
+++ b/share/frontend/wui/js/wui.js
@@ -380,11 +380,16 @@ function coordsToGrid(x, y) {
 }
 
 function saveObjectAfterMoveAndDrop(oObj) {
-       var borderWidth = 3;
-       
        // Reset z-index to configured value
        oObj.setZ(oObj.defz);
        
+       // Split id to get object information
+       var arr = oObj.name.split('_');
+
+       var borderWidth = 3;
+       if(arr[1] == 'label')
+                       borderWidth = 0;
+       
        // When x or y are negative just return this and make no change
        if((oObj.y - getHeaderHeight() + borderWidth) < 0 || oObj.x < 0) {
                oObj.moveTo(oObj.oldX, oObj.oldY);
@@ -402,9 +407,6 @@ function saveObjectAfterMoveAndDrop(oObj) {
                oObj.moveTo(coords[0] - borderWidth, coords[1] + 
getHeaderHeight() - borderWidth);
        }
        
-       // Split id to get object information
-       var arr = oObj.name.split('_');
-       
        // Handle different ojects (Normal icons and labels)
        var type, id , url;
        if(arr[1] === 'label') {
@@ -423,8 +425,8 @@ function saveObjectAfterMoveAndDrop(oObj) {
                        objY += getHeaderHeight();
                        
                        // +3: Is the borderWidth of the object highlighting
-                       x = oObj.x - objX + 3;
-                       y = oObj.y - objY + 3;
+                       x = oObj.x - objX + borderWidth;
+                       y = oObj.y - objY + borderWidth;
                        
                        // Add + sign to mark relative positive coords (On 
negative relative coord
                        // the - sign is added automaticaly
@@ -448,8 +450,8 @@ function saveObjectAfterMoveAndDrop(oObj) {
                id = arr[2];
 
                // +3: Is the borderWidth of the object highlighting
-               x = oObj.x + 3;
-               y = oObj.y - getHeaderHeight() + 3;
+               x = oObj.x + borderWidth;
+               y = oObj.y - getHeaderHeight() + borderWidth;
 
                // Don't forget to substract height of header menu
                url = 
oGeneralProperties.path_server+'?mod=Map&act=modifyObject&map='+mapname+'&type='+type+'&id='+id+'&x='+x+'&y='+y;


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to