From: Ilya Zverev Date: Mon, 7 Nov 2011 13:47:51 +0000 (+0400) Subject: When changing feature, save tags that have editors in new feature X-Git-Url: https://git.openstreetmap.org/potlatch2.git/commitdiff_plain/463ee36fa69ea6aa6daeb5f54cab9c73287f351f?hp=c431f56a04313812886e9e605f87e50eb0c6da8c When changing feature, save tags that have editors in new feature --- diff --git a/net/systemeD/potlatch2/TagViewer.mxml b/net/systemeD/potlatch2/TagViewer.mxml index 1e1070de..57ec9b4c 100644 --- a/net/systemeD/potlatch2/TagViewer.mxml +++ b/net/systemeD/potlatch2/TagViewer.mxml @@ -867,11 +867,22 @@ var action:CompositeUndoableAction = new CompositeUndoableAction( "Set "+selectedEntity.getType()+" "+selectedEntity.id+" to "+newFeature.name); selectedEntity.suspend(); + + // build a list of tags that are editable in new feature + var editableTags:Array = new Array(); + for each( var editor:EditorFactory in newFeature.editors ) { + if ( editor is SingleTagEditorFactory ) { + var singleTagEditor:SingleTagEditorFactory = editor as SingleTagEditorFactory; + editableTags.push(singleTagEditor.key); + } + } // remove tags from the current feature if ( feature != null ) { for each( var oldtag:Object in feature.tags ) { - selectedEntity.setTag(oldtag["k"], null, action.push); + if ( editableTags.indexOf(oldtag["k"]) < 0 ) { + selectedEntity.setTag(oldtag["k"], null, action.push); + } } }