From 85f39134b502c60169ab501bfadc2840769df8e8 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Tue, 19 Feb 2013 19:25:35 -0500 Subject: [PATCH] Add address ui element with street suggestions --- css/app.css | 17 ++++++++++++++++- index.html | 1 + js/id/geo.js | 4 ++++ js/id/ui/preset.js | 5 +++++ presets/presets.json | 4 ++++ 5 files changed, 30 insertions(+), 1 deletion(-) diff --git a/css/app.css b/css/app.css index ec71f7ac5..9e874aa55 100644 --- a/css/app.css +++ b/css/app.css @@ -1586,4 +1586,19 @@ div.combobox { } @media only screen and (max-height: 840px) { -} \ No newline at end of file +} + +/* Address input */ + +.preset-input .addr-housename { + width: 300px; + display: block; +} + +.preset-input .addr-number { + width: 50px; +} + +.preset-input .addr-streetname { + width: 250px; +} diff --git a/index.html b/index.html index bb49d19ef..cdebb64ad 100644 --- a/index.html +++ b/index.html @@ -93,6 +93,7 @@ + diff --git a/js/id/geo.js b/js/id/geo.js index 682980758..f0c30d4a3 100644 --- a/js/id/geo.js +++ b/js/id/geo.js @@ -85,3 +85,7 @@ iD.geo.pathLength = function(path) { } return length; }; + +iD.geo.metresToCoordinates = function(loc, vector) { + return [vector[1] / 111200, vector[0] / 111200 / Math.cos(loc[1])]; +}; diff --git a/js/id/ui/preset.js b/js/id/ui/preset.js index 9c8e94f2c..9f61c0134 100644 --- a/js/id/ui/preset.js +++ b/js/id/ui/preset.js @@ -134,6 +134,11 @@ iD.ui.preset = function() { // Multiple elements, eg, address } else { if (d.type === 'address') { + wrap.append('div') + .attr('class', 'col8 preset-input', d) + .call(iD.ui.preset.address() + .context(context) + .entity(entity)); } } }); diff --git a/presets/presets.json b/presets/presets.json index af5c4828e..04a046f50 100644 --- a/presets/presets.json +++ b/presets/presets.json @@ -19,6 +19,10 @@ { "key": "cuisine", "type": "combo" + }, + { + "type": "address", + "title": "Address" } ] },