From 1899eb361c741f6d42199bb5dcdfdf3de7279e02 Mon Sep 17 00:00:00 2001 From: Aaron Lidman Date: Mon, 14 Oct 2013 12:08:36 -0400 Subject: [PATCH] Add None tile layer Fixes #1472 --- data/core.yaml | 1 + dist/locales/en.json | 1 + js/id/renderer/background.js | 2 ++ js/id/renderer/background_source.js | 4 ++++ js/id/renderer/tile_layer.js | 1 + 5 files changed, 9 insertions(+) diff --git a/data/core.yaml b/data/core.yaml index eedf3580c..30230df50 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -211,6 +211,7 @@ en: title: Background description: Background settings percent_brightness: "{opacity}% brightness" + none: None custom: Custom custom_prompt: "Enter a tile template. Valid tokens are {z}, {x}, {y} for Z/X/Y scheme and {u} for quadtile scheme." fix_misalignment: Fix misalignment diff --git a/dist/locales/en.json b/dist/locales/en.json index bd7244694..ca93964f8 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -260,6 +260,7 @@ "title": "Background", "description": "Background settings", "percent_brightness": "{opacity}% brightness", + "none": "None", "custom": "Custom", "custom_prompt": "Enter a tile template. Valid tokens are {z}, {x}, {y} for Z/X/Y scheme and {u} for quadtile scheme.", "fix_misalignment": "Fix misalignment", diff --git a/js/id/renderer/background.js b/js/id/renderer/background.js index f88175433..53e2d0b0a 100644 --- a/js/id/renderer/background.js +++ b/js/id/renderer/background.js @@ -14,6 +14,8 @@ iD.Background = function(context) { } }); + backgroundSources.unshift(iD.BackgroundSource.None()); + function findSource(id) { return _.find(backgroundSources, function(d) { return d.id && d.id === id; diff --git a/js/id/renderer/background_source.js b/js/id/renderer/background_source.js index b8041a2d3..74d1f46d8 100644 --- a/js/id/renderer/background_source.js +++ b/js/id/renderer/background_source.js @@ -112,3 +112,7 @@ iD.BackgroundSource.Bing = function(data, dispatch) { return bing; }; + +iD.BackgroundSource.None = function() { + return iD.BackgroundSource({ name: t('background.none'), id: 'None', template: '' }); +}; diff --git a/js/id/renderer/tile_layer.js b/js/id/renderer/tile_layer.js index 9acb2cc0d..a40572c06 100644 --- a/js/id/renderer/tile_layer.js +++ b/js/id/renderer/tile_layer.js @@ -68,6 +68,7 @@ iD.TileLayer = function() { if (source.validZoom(z)) { tile().forEach(function(d) { addSource(d); + if (d[3] === '') return; requests.push(d); if (cache[d[3]] === false && lookUp(d)) { requests.push(addSource(lookUp(d)));