From 0a238dbfcc0388de0d38eaab1e68b473e8cf05f5 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Wed, 17 Feb 2016 12:03:51 -0500 Subject: [PATCH] Load traffico stylesheet dynamically --- index.html | 1 - js/id/services/mapillary.js | 11 +++++++++++ test/spec/services/mapillary.js | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 798ce1acc..f45f10d6c 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,6 @@ - diff --git a/js/id/services/mapillary.js b/js/id/services/mapillary.js index 8a98e9dbb..c224540c1 100644 --- a/js/id/services/mapillary.js +++ b/js/id/services/mapillary.js @@ -9,6 +9,16 @@ iD.services.mapillary = function() { tileZoom = 14; + function loadSignStyles(context) { + d3.select('head').selectAll('#traffico') + .data([0]) + .enter() + .append('link') + .attr('id', 'traffico') + .attr('rel', 'stylesheet') + .attr('href', context.assetPath() + 'traffico/stylesheets/traffico.css'); + } + function loadSignDefs(context) { if (!iD.services.mapillary.sign_defs) { iD.services.mapillary.sign_defs = {}; @@ -121,6 +131,7 @@ iD.services.mapillary = function() { mapillary.loadSigns = function(context, projection, dimensions) { var url = apibase + 'search/im/geojson/or?'; + loadSignStyles(context); loadSignDefs(context); loadTiles('signs', url, projection, dimensions); }; diff --git a/test/spec/services/mapillary.js b/test/spec/services/mapillary.js index cea1274ed..787c54295 100644 --- a/test/spec/services/mapillary.js +++ b/test/spec/services/mapillary.js @@ -3,7 +3,7 @@ describe('iD.services.mapillary', function() { context, server, mapillary; beforeEach(function() { - context = iD(); + context = iD().assetPath('../dist/'); context.projection.scale(667544.214430109); // z14 server = sinon.fakeServer.create();