Add area tag by default, remove when applying preset

This commit is contained in:
Ansis Brammanis
2013-03-18 14:25:32 -04:00
parent 63edc30922
commit f295c217e8
2 changed files with 10 additions and 9 deletions

View File

@@ -5,9 +5,13 @@ iD.presets = function(context) {
var other = iD.presets.Preset('other', {
tags: {},
geometry: ['point', 'vertex', 'line', 'area']
geometry: ['point', 'vertex', 'line']
}),
all = iD.presets.Collection([other]),
otherarea = iD.presets.Preset('other/area', {
tags: { area: 'yes' },
geometry: ['area']
}),
all = iD.presets.Collection([other, otherarea]),
defaults = { area: all, line: all, point: all, vertex: all },
fields = {},
universal = [],

View File

@@ -13,18 +13,15 @@ iD.ui.TagEditor = function(context, entity) {
selection_ = selection;
var geometry = entity.geometry(context.graph());
if (!preset) preset = presets.match(entity, context.graph());
// preset was explicitly chosen
if (newpreset) {
if (preset) {
tags = preset.removeTags(tags, geometry);
}
tags = preset.removeTags(tags, geometry);
newpreset.applyTags(tags, geometry);
preset = newpreset;
// find a preset that best fits
} else if (!preset) {
preset = presets.match(entity, context.graph());
}
selection.html('');