mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-06 19:31:41 +00:00
Eliminate iD.layers
This commit is contained in:
@@ -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>
|
||||
|
||||
12
js/id/id.js
12
js/id/id.js
@@ -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';
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
iD.layers = iD.data.imagery.map(iD.BackgroundSource.template);
|
||||
iD.layers.push(iD.BackgroundSource.Custom);
|
||||
@@ -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();
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user