mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-21 07:46:58 +02:00
Simplify
This commit is contained in:
@@ -1,17 +1,7 @@
|
||||
iD.ui.Inspector = function(context, entity) {
|
||||
var tagEditor,
|
||||
id = entity.id,
|
||||
newFeature = false;
|
||||
|
||||
function changeTags(tags) {
|
||||
var entity = context.hasEntity(id);
|
||||
if (entity && !_.isEqual(entity.tags, tags)) {
|
||||
context.perform(
|
||||
iD.actions.ChangeTags(entity.id, tags),
|
||||
t('operations.change_tags.annotation'));
|
||||
}
|
||||
}
|
||||
|
||||
function browse() {
|
||||
context.enter(iD.modes.Browse(context));
|
||||
}
|
||||
@@ -54,7 +44,6 @@ iD.ui.Inspector = function(context, entity) {
|
||||
});
|
||||
|
||||
tagEditor = iD.ui.TagEditor(context, entity)
|
||||
.on('changeTags', changeTags)
|
||||
.on('close', browse)
|
||||
.on('choose', function(preset) {
|
||||
var right = panewrap.style('right').indexOf('%') > 0 ?
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
iD.ui.TagEditor = function(context, entity) {
|
||||
var event = d3.dispatch('changeTags', 'choose', 'close'),
|
||||
var event = d3.dispatch('choose', 'close'),
|
||||
presets = context.presets(),
|
||||
id = entity.id,
|
||||
tags = _.clone(entity.tags),
|
||||
@@ -121,7 +121,12 @@ iD.ui.TagEditor = function(context, entity) {
|
||||
|
||||
function changeTags(changed) {
|
||||
tags = clean(_.extend(tags, changed));
|
||||
event.changeTags(_.clone(tags));
|
||||
var entity = context.hasEntity(id);
|
||||
if (entity && !_.isEqual(entity.tags, tags)) {
|
||||
context.perform(
|
||||
iD.actions.ChangeTags(entity.id, tags),
|
||||
t('operations.change_tags.annotation'));
|
||||
}
|
||||
}
|
||||
|
||||
tageditor.close = function() {
|
||||
|
||||
Reference in New Issue
Block a user