From c43a59d2d58a44c29b460741bd4ddff0114e36a5 Mon Sep 17 00:00:00 2001 From: Simon Hunt Date: Wed, 5 Apr 2017 13:56:13 -0700 Subject: [PATCH] Topo2: Added zoom callback to map service, to allow for adjusting map stroke-width on-the-fly. Change-Id: I08f7bdda0b34c8e64a95a05d3c5af28fc236fe7d --- web/gui/src/main/webapp/app/view/topo2/topo2.js | 3 +++ web/gui/src/main/webapp/app/view/topo2/topo2Map.js | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) 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 775228c0a9..06e0a8d20e 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 0c8f73e8fb..2c28ec0150 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();