Eliminate iD.layers

This commit is contained in:
John Firebaugh
2013-03-06 15:20:27 -08:00
parent 7cdfa8daf3
commit 84a4f9e5d2
5 changed files with 11 additions and 11 deletions

View File

@@ -48,7 +48,6 @@
<script src='js/id/renderer/background.js'></script>
<script src='js/id/renderer/background_source.js'></script>
<script src='js/id/renderer/map.js'></script>
<script src='js/id/renderer/layers.js'></script>
<script src="js/id/svg.js"></script>
<script src="js/id/svg/areas.js"></script>

View File

@@ -95,6 +95,14 @@ window.iD = function () {
context.zoomIn = map.zoomIn;
context.zoomOut = map.zoomOut;
/* Background */
var backgroundSources = iD.data.imagery.map(iD.BackgroundSource.template);
backgroundSources.push(iD.BackgroundSource.Custom);
context.backgroundSources = function() {
return backgroundSources;
};
/* Presets */
var presets = iD.presets(context);
@@ -111,7 +119,7 @@ window.iD = function () {
var q = iD.util.stringQs(location.hash.substring(1)), detected = false;
if (q.layer) {
context.background()
.source(_.find(iD.layers, function(l) {
.source(_.find(backgroundSources, function(l) {
if (l.data.sourcetag === q.layer) {
detected = true;
return true;
@@ -121,7 +129,7 @@ window.iD = function () {
if (!detected) {
context.background()
.source(_.find(iD.layers, function(l) {
.source(_.find(backgroundSources, function(l) {
return l.data.name === 'Bing aerial imagery';
}));
}

View File

@@ -1,2 +0,0 @@
iD.layers = iD.data.imagery.map(iD.BackgroundSource.template);
iD.layers.push(iD.BackgroundSource.Custom);

View File

@@ -2,7 +2,7 @@ iD.ui.Background = function(context) {
var event = d3.dispatch('cancel', 'save'),
opacities = [1, 0.5, 0];
var layers = iD.layers;
var layers = context.backgroundSources();
function getSources() {
var ext = context.map().extent();

View File

@@ -20,11 +20,6 @@ describe('iD.Background', function() {
expect(c.size([100, 100])).to.equal(c);
expect(c.size()).to.eql([100,100]);
});
it('#source', function() {
expect(c.source(iD.layers[0])).to.equal(c);
expect(c.source()).to.equal(iD.layers[0]);
});
});
describe('iD.BackgroundSource.Template', function() {