mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-28 00:13:40 +00:00
Merge branch 'master' of github.com:systemed/iD
This commit is contained in:
@@ -28,6 +28,12 @@ iD.BackgroundSource.template = function(template, subdomains, scaleExtent) {
|
||||
return generator;
|
||||
};
|
||||
|
||||
iD.BackgroundSource.Custom = function() {
|
||||
var template = window.prompt('Enter a tile template. Valid tokens are {z}, {x}, {y} for Z/X/Y scheme and {u} for quadtile scheme.');
|
||||
if (!template) return null;
|
||||
return iD.BackgroundSource.template(template, null, [0, 20]);
|
||||
};
|
||||
|
||||
iD.BackgroundSource.Bing = iD.BackgroundSource.template(
|
||||
'http://ecn.t{t}.tiles.virtualearth.net/tiles/a{u}.jpeg?g=587&mkt=en-gb&n=z',
|
||||
[0, 1, 2, 3], [0, 20]);
|
||||
|
||||
@@ -12,6 +12,10 @@ iD.layerswitcher = function(map) {
|
||||
name: 'OSM',
|
||||
source: iD.BackgroundSource.OSM,
|
||||
description: 'The default OpenStreetMap layer.'
|
||||
}, {
|
||||
name: 'Custom',
|
||||
source: iD.BackgroundSource.Custom,
|
||||
description: 'A custom layer (requires configuration)'
|
||||
}],
|
||||
opacities = [1, 0.5, 0];
|
||||
|
||||
@@ -101,6 +105,12 @@ iD.layerswitcher = function(map) {
|
||||
.call(bootstrap.tooltip().placement('right'))
|
||||
.on('click.set-source', function(d) {
|
||||
d3.event.preventDefault();
|
||||
if (d.name === 'Custom') {
|
||||
var configured = d.source();
|
||||
if (!configured) return;
|
||||
d.source = configured;
|
||||
d.name = 'Custom (configured)';
|
||||
}
|
||||
map.background.source(d.source);
|
||||
map.redraw();
|
||||
selectLayer(d);
|
||||
|
||||
Reference in New Issue
Block a user