Load traffico stylesheet dynamically

This commit is contained in:
Bryan Housel
2016-02-17 12:03:51 -05:00
parent 2eca4da18c
commit 0a238dbfcc
3 changed files with 12 additions and 2 deletions

View File

@@ -6,7 +6,6 @@
<link rel='stylesheet' href='css/reset.css'>
<link rel='stylesheet' href='css/map.css'>
<link rel='stylesheet' href='css/app.css'>
<link rel='stylesheet' href='dist/traffico/stylesheets/traffico.css'>
<!-- mobile devices -->
<meta name='viewport' content='initial-scale=1.0 maximum-scale=1.0'>

View File

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

View File

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