Topo2: Added zoom callback to map service, to allow for adjusting map stroke-width on-the-fly.

Change-Id: I08f7bdda0b34c8e64a95a05d3c5af28fc236fe7d
This commit is contained in:
Simon Hunt 2017-04-05 13:56:13 -07:00
parent ffaeac375e
commit c43a59d2d5
2 changed files with 10 additions and 1 deletions

View File

@ -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

View File

@ -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();