Topo2: Handle regions without a map/sprite
Change-Id: Ifa944499992843c1506462caae0e1646b204996b
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 af708fb..d41acfe 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2NodePosition.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2NodePosition.js
@@ -150,13 +150,11 @@
function coordFromXY(loc) {
- // Something this is wrong in the config
- if (!t2sls.getWidth() || !t2sls.getHeight()) {
- return [0, 0];
- }
+ var bgWidth = t2sls.getWidth() || 100,
+ bgHeight = t2sls.getHeight() || 100;
- var scale = 1000 / t2sls.getWidth(),
- yOffset = (1000 - (t2sls.getHeight() * scale)) / 2;
+ var scale = 1000 / bgWidth,
+ yOffset = (1000 - (bgHeight * scale)) / 2;
// 1000 is a hardcoded HTML value of the SVG element (topo2.html)
var x = scale * loc.gridX,