Author: Lars Michelsen <[email protected]>
Date: Fri Mar 30 09:09:51 2012 +0200
Committer: Lars Michelsen <[email protected]>
Commit-Date: Fri Mar 30 09:09:51 2012 +0200
Fixed repositioning of objects when using the grid with zoomed coords
---
share/frontend/nagvis-js/js/NagVisObject.js | 20 ++++++++++----------
share/frontend/nagvis-js/js/edit.js | 20 +++++++++++---------
share/server/core/classes/CoreModMap.php | 1 -
3 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/share/frontend/nagvis-js/js/NagVisObject.js
b/share/frontend/nagvis-js/js/NagVisObject.js
index 6654e0c..8e47486 100644
--- a/share/frontend/nagvis-js/js/NagVisObject.js
+++ b/share/frontend/nagvis-js/js/NagVisObject.js
@@ -1227,17 +1227,17 @@ var NagVisObject = Base.extend({
// Honor the enabled grid and reposition the object after dropping
if(oViewProperties.grid_show === 1) {
if(viewType === 'line') {
- var pos = coordsToGrid(jsObj.parseCoords(jsObj.conf.x,
'x')[anchorId],
- jsObj.parseCoords(jsObj.conf.y,
'y')[anchorId]);
- jsObj.conf.x = jsObj.calcNewCoord(pos[0], 'x', anchorId);
- jsObj.conf.y = jsObj.calcNewCoord(pos[1], 'y', anchorId);
- pos = null;
+ var pos = coordsToGrid(jsObj.parseCoords(jsObj.conf.x, 'x',
false)[anchorId],
+ jsObj.parseCoords(jsObj.conf.y, 'y',
false)[anchorId]);
+ jsObj.conf.x = jsObj.calcNewCoord(pos[0], 'x', anchorId);
+ jsObj.conf.y = jsObj.calcNewCoord(pos[1], 'y', anchorId);
+ pos = null;
} else {
- var pos = coordsToGrid(jsObj.parseCoord(jsObj.conf.x, 'x'),
- jsObj.parseCoord(jsObj.conf.y, 'y'));
- jsObj.conf.x = jsObj.calcNewCoord(pos[0], 'x');
- jsObj.conf.y = jsObj.calcNewCoord(pos[1], 'y');
- pos = null;
+ var pos = coordsToGrid(jsObj.parseCoord(jsObj.conf.x, 'x',
false),
+ jsObj.parseCoord(jsObj.conf.y, 'y',
false));
+ jsObj.conf.x = jsObj.calcNewCoord(pos[0], 'x');
+ jsObj.conf.y = jsObj.calcNewCoord(pos[1], 'y');
+ pos = null;
}
jsObj.reposition();
}
diff --git a/share/frontend/nagvis-js/js/edit.js
b/share/frontend/nagvis-js/js/edit.js
index 4566eee..ccf544a 100644
--- a/share/frontend/nagvis-js/js/edit.js
+++ b/share/frontend/nagvis-js/js/edit.js
@@ -474,13 +474,15 @@ function getEventMousePos(e) {
// When a grid is enabled align the dragged object in the nearest grid
if(oViewProperties.grid_show === 1) {
- var a = coordsToGrid(posx, posy);
- posx = a[0];
- posy = a[1];
- a = null;
+ //var a = coordsToGrid(posx, posy);
+ //posx = a[0];
+ //posy = a[1];
+ //a = null;
}
- // Take the zoom into account
+ // Take the zoom into account. If the map is zoomed this function gathers
+ // coordinates where the zoom factor is included. It has to be removed for
+ // further processing.
posx = rmZoomFactor(posx);
posy = rmZoomFactor(posy);
@@ -897,15 +899,15 @@ function coordsToGrid(x, y) {
x = x.split(',');
y = y.split(',');
for(var i = 0; i < x.length; i++) {
- x[i] = x[i] - (x[i] % oViewProperties.grid_steps);
- y[i] = y[i] - (y[i] % oViewProperties.grid_steps);
+ x[i] = x[i] - (x[i] % addZoomFactor(oViewProperties.grid_steps));
+ y[i] = y[i] - (y[i] % addZoomFactor(ooViewProperties.grid_steps));
}
return [ x.join(','), y.join(',') ];
} else {
x = +x;
y = +y;
- var gridMoveX = x - (x % oViewProperties.grid_steps);
- var gridMoveY = y - (y % oViewProperties.grid_steps);
+ var gridMoveX = x - (x % addZoomFactor(oViewProperties.grid_steps));
+ var gridMoveY = y - (y % addZoomFactor(oViewProperties.grid_steps));
return [ gridMoveX, gridMoveY ];
}
}
diff --git a/share/server/core/classes/CoreModMap.php
b/share/server/core/classes/CoreModMap.php
index e7a0e08..8244fa4 100644
--- a/share/server/core/classes/CoreModMap.php
+++ b/share/server/core/classes/CoreModMap.php
@@ -365,7 +365,6 @@ class CoreModMap extends CoreModule {
// 2. Save the changes for himselfs
// 3. Save the changes to the map config (-> Use default code
below)
if($mode == 'view_params' && $perm != 1 && $perm != 2) {
- echo 1;
// This is the 1. case -> redirect the user to a well formated
url
$params = $attrs;
unset($params['object_id']);
------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins