Topo2: Added debug grid and amended node positioning
Change-Id: Ibd2ab1f0793b3943c471ae7c7bb3708a7a46897f
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2NodePosition.js b/web/gui/src/main/webapp/app/view/topo2/topo2NodePosition.js
index f384619..aeac6d4 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2NodePosition.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2NodePosition.js
@@ -128,10 +128,12 @@
}
function coordFromXY(loc) {
- // 1000 is a hardcoded HTML value of the SVG element (topo2.html)
- var x = (1000 / t2sls.getWidth()) * loc.gridX,
- y = (1000 / t2sls.getHeight()) * loc.gridY;
+ var scale = 1000 / t2sls.getWidth(),
+ yOffset = (1000 - (t2sls.getHeight() * scale)) / 2;
+ // 1000 is a hardcoded HTML value of the SVG element (topo2.html)
+ var x = scale * loc.gridX,
+ y = (scale * loc.gridY) + yOffset;
return [x, y];
}