From 270676c548c097bf6b70d5c1bb00e883887ade7c Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Wed, 20 Feb 2013 16:45:58 -0500 Subject: [PATCH 1/3] Add backgrounds to area icons --- css/app.css | 35 +++++++++++++++++++++++++++++++++++ js/id/ui/presetgrid.js | 16 ++++++++++++---- presets/presets.json | 24 ++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 4 deletions(-) diff --git a/css/app.css b/css/app.css index 9e874aa55..225dfd6ee 100644 --- a/css/app.css +++ b/css/app.css @@ -687,6 +687,16 @@ a.selected:hover .toggle.icon { background-position: -40px -180px;} left: 10px; right: 10px; top: 10px; bottom: 10px; border-radius: 4px; } +.grid-entry .grid-inner .preset-icon-fill.area { + position: absolute; + opacity: 0.4; + left: 0; right: 0; top: 0; bottom: 0; + border-radius: 4px; + margin: auto; + width: 40px; + height: 40px; +} + .preset-grid .grid-entry .icon { left: 0; right: 0; top: 0; bottom: 0; position: absolute; @@ -715,6 +725,31 @@ a.selected:hover .toggle.icon { background-position: -40px -180px;} height: 20px; } +/* Preset icon colors */ + +.preset-icon-fill.tag-amenity, +.preset-icon-fill.tag-shop, +.preset-icon-fill.tag-building { + background-color: #e06e5f; +} + +.preset-icon-fill.tag-natural-water { + background-color: #77d3de; +} + +.preset-icon-fill.tag-landuse, +.preset-icon-fill.tag-natural-wood, +.preset-icon-fill.tag-natural-tree, +.preset-icon-fill.tag-natural-grassland, +.preset-icon-fill.tag-leisure-park { + background-color: #8cd05f; +} + +.preset-icon-fill.tag-amenity-parking { + background-color: #aaa; +} + + /* Map Controls */ .map-control { diff --git a/js/id/ui/presetgrid.js b/js/id/ui/presetgrid.js index d2ae7e39f..0dda0b348 100644 --- a/js/id/ui/presetgrid.js +++ b/js/id/ui/presetgrid.js @@ -53,10 +53,18 @@ iD.ui.PresetGrid = function() { event.choose(d); }); - entered.append('div') - .attr('class','grid-inner fillL') - .append('div') - .attr('class', function(d) { return 'maki-' + d.icon + '-24 icon'; }); + var inner = entered.append('div') + .attr('class','grid-inner fillL'); + inner.append('div') + .attr('class', function(d) { + var s = 'preset-icon-fill ' + d.match.type.join(' '); + for (var i in d.match.tags) { + s += ' tag-' + i + ' tag-' + i + '-' + d.match.tags[i]; + } + return s; + }); + inner.append('div') + .attr('class', function(d) { return 'maki-' + d.icon + '-24 icon'; }); entered.append('span').attr('class','label').text(name); entries.exit().remove(); diff --git a/presets/presets.json b/presets/presets.json index 04a046f50..0ca925de1 100644 --- a/presets/presets.json +++ b/presets/presets.json @@ -26,6 +26,30 @@ } ] }, + { + "title": "Park", + "name": "park", + "match": { + "type": ["node", "area"], + "tags": { + "leisure": "park" + } + }, + "icon": "park", + "form": [] + }, + { + "title": "Water", + "name": "water", + "match": { + "type": ["node", "area"], + "tags": { + "natural": "water" + } + }, + "icon": "", + "form": [] + }, { "title": "Supermarket", "name": "supermarket", From e17d7ecd63f1b0f4511c74c36939580b8e46b912 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Wed, 20 Feb 2013 16:49:55 -0500 Subject: [PATCH 2/3] Limit backgrounds to areas --- js/id/ui/presetgrid.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/id/ui/presetgrid.js b/js/id/ui/presetgrid.js index 0dda0b348..63c5c6e07 100644 --- a/js/id/ui/presetgrid.js +++ b/js/id/ui/presetgrid.js @@ -57,7 +57,7 @@ iD.ui.PresetGrid = function() { .attr('class','grid-inner fillL'); inner.append('div') .attr('class', function(d) { - var s = 'preset-icon-fill ' + d.match.type.join(' '); + var s = 'preset-icon-fill ' + entity.geometry(context.graph()); for (var i in d.match.tags) { s += ' tag-' + i + ' tag-' + i + '-' + d.match.tags[i]; } From 49e5eb8317610eb3be0bf0ed4976bdd4519af953 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Wed, 20 Feb 2013 17:35:50 -0500 Subject: [PATCH 3/3] Fix name input saving and updating --- js/id/modes/select.js | 1 + js/id/ui/tageditor.js | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/js/id/modes/select.js b/js/id/modes/select.js index 43b110e03..715c499e6 100644 --- a/js/id/modes/select.js +++ b/js/id/modes/select.js @@ -125,6 +125,7 @@ iD.modes.Select = function(context, selection, initial) { if (!_.isEqual(entity.tags, newEntity.tags)) { inspector.tags(newEntity.tags); } + entity = newEntity; } }); diff --git a/js/id/ui/tageditor.js b/js/id/ui/tageditor.js index 12a4bb203..885f44253 100644 --- a/js/id/ui/tageditor.js +++ b/js/id/ui/tageditor.js @@ -5,6 +5,7 @@ iD.ui.TagEditor = function() { inspectorbody, entity, tags, + name, presetMatch, presetUI, presetGrid, @@ -61,13 +62,13 @@ iD.ui.TagEditor = function() { namelabel = namewrap.append('h4') .text('Name'); - var name = namewrap.append('input') + name = namewrap.append('input') .attr('placeholder', 'name') .attr('type', 'text') .property('value', function() { return entity.tags.name || ''; }) - .on('keyup', function() { + .on('blur', function() { var tags = tageditor.tags(); tags.name = this.value; tageditor.tags(tags); @@ -132,6 +133,7 @@ iD.ui.TagEditor = function() { } else { tags = newtags; if (presetUI && tagList) { + name.property('value', tags.name || ''); presetUI.change(tags); tagList.tags(_.omit(tags, _.keys(presetUI.tags() || {}))); }