From 463ee36fa69ea6aa6daeb5f54cab9c73287f351f Mon Sep 17 00:00:00 2001 From: Ilya Zverev Date: Mon, 7 Nov 2011 17:47:51 +0400 Subject: [PATCH 1/1] When changing feature, save tags that have editors in new feature --- net/systemeD/potlatch2/TagViewer.mxml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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); + } } } -- 2.31.1