Topo2: Added zoom callback to map service, to allow for adjusting map stroke-width on-the-fly.
Change-Id: I08f7bdda0b34c8e64a95a05d3c5af28fc236fe7d
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2.js b/web/gui/src/main/webapp/app/view/topo2/topo2.js
index 775228c..06e0a8d 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2.js
@@ -73,6 +73,9 @@
offsetY: tr[1]
};
+ // Allow map service to react to change in zoom parameters
+ t2ms.zoomCallback(sc, tr);
+
// Note: Meta data stored in the context of the current layout,
// automatically, by the server
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2Map.js b/web/gui/src/main/webapp/app/view/topo2/topo2Map.js
index 0c8f73e..2c28ec0 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2Map.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2Map.js
@@ -97,6 +97,11 @@
zoomer.reset();
}
+ function zoomCallback(sc, tr) {
+ // keep the map lines constant width while zooming
+ this.node().style('stroke-width', (2.0 / sc) + 'px');
+ }
+
angular.module('ovTopo2')
.factory('Topo2MapService', [
'$log', '$location', 'Topo2ViewController', 'PrefsService',
@@ -126,7 +131,8 @@
setMap: setMap,
setUpMap: setUpMap,
openMapSelection: openMapSelection,
- resetZoom: resetZoom
+ resetZoom: resetZoom,
+ zoomCallback: zoomCallback
});
return instance || new MapLayer();