mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-19 09:33:32 +00:00
Only show tags not supported by preset; saving
This commit is contained in:
@@ -3,6 +3,7 @@ iD.ui.inspector = function() {
|
||||
taginfo = iD.taginfo(),
|
||||
presetData = iD.presetData(),
|
||||
initial = false,
|
||||
presetUI,
|
||||
graph,
|
||||
tagList;
|
||||
|
||||
@@ -41,7 +42,7 @@ iD.ui.inspector = function() {
|
||||
var inspectorwrap = inspectorbody.append('div')
|
||||
.attr('class', 'inspector-inner tag-wrap fillL2');
|
||||
|
||||
var presetUI = iD.ui.preset()
|
||||
presetUI = iD.ui.preset()
|
||||
.on('change', function(tags) {
|
||||
inspector.tags(_.extend(inspector.tags(), tags));
|
||||
event.change();
|
||||
@@ -130,6 +131,7 @@ iD.ui.inspector = function() {
|
||||
function drawTags(tags) {
|
||||
var entity = tagList.datum();
|
||||
|
||||
tags = _.omit(tags, _.keys(presetUI.tags() || {}));
|
||||
tags = d3.entries(tags);
|
||||
|
||||
if (!tags.length) {
|
||||
@@ -311,7 +313,7 @@ iD.ui.inspector = function() {
|
||||
|
||||
inspector.tags = function(tags) {
|
||||
if (!arguments.length) {
|
||||
tags = {};
|
||||
tags = presetUI.tags();
|
||||
tagList.selectAll('li').each(function() {
|
||||
var row = d3.select(this),
|
||||
key = row.selectAll('.key').property('value'),
|
||||
|
||||
@@ -5,7 +5,7 @@ iD.ui.preset = function() {
|
||||
preset;
|
||||
|
||||
function getTags() {
|
||||
var tags = {};
|
||||
var tags = _.clone(preset.tags);
|
||||
sections.selectAll('input,select')
|
||||
.each(function(d) {
|
||||
tags[d.key] = this.value;
|
||||
@@ -110,6 +110,7 @@ iD.ui.preset = function() {
|
||||
.attr('class', 'col8 preset-input'), d);
|
||||
});
|
||||
if (exttags) setTags(exttags);
|
||||
key();
|
||||
}
|
||||
|
||||
presets.preset = function(_) {
|
||||
@@ -124,5 +125,10 @@ iD.ui.preset = function() {
|
||||
return presets;
|
||||
};
|
||||
|
||||
presets.tags = function() {
|
||||
if (!preset || !sections) return {};
|
||||
return clean(getTags());
|
||||
};
|
||||
|
||||
return d3.rebind(presets, event, 'on');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user