diff --git a/js/id/ui/entity_editor.js b/js/id/ui/entity_editor.js index de981b16e..1e044b609 100644 --- a/js/id/ui/entity_editor.js +++ b/js/id/ui/entity_editor.js @@ -1,5 +1,6 @@ iD.ui.EntityEditor = function(context) { var event = d3.dispatch('choose'), + state = 'select', id, preset; @@ -31,7 +32,9 @@ iD.ui.EntityEditor = function(context) { // Update $header.select('h3') - .text(t('inspector.editing_feature', {feature: preset.name()})); + .text(state === 'select' ? + t('inspector.editing_feature', {feature: preset.name()}) : + preset.name()); $header.select('.preset-reset') .on('click', function() { @@ -142,6 +145,12 @@ iD.ui.EntityEditor = function(context) { } } + entityEditor.state = function(_) { + if (!arguments.length) return state; + state = _; + return entityEditor; + }; + entityEditor.entityID = function(_) { if (!arguments.length) return id; id = _; diff --git a/js/id/ui/inspector.js b/js/id/ui/inspector.js index f1b949f99..5bf8a6b74 100644 --- a/js/id/ui/inspector.js +++ b/js/id/ui/inspector.js @@ -1,6 +1,7 @@ iD.ui.Inspector = function(context) { var presetList = iD.ui.PresetList(context), entityEditor = iD.ui.EntityEditor(context), + state = 'select', entityID, newFeature = false; @@ -27,6 +28,7 @@ iD.ui.Inspector = function(context) { var $editorPane = $wrap.select('.entity-editor-pane') .call(entityEditor + .state(state) .entityID(entityID) .on('choose', showList)); @@ -56,6 +58,12 @@ iD.ui.Inspector = function(context) { selection.style('display', 'none'); }; + inspector.state = function(_) { + if (!arguments.length) return state; + state = _; + return inspector; + }; + inspector.entityID = function(_) { if (!arguments.length) return entityID; entityID = _; diff --git a/js/id/ui/sidebar.js b/js/id/ui/sidebar.js index 7002e4308..da5adebb8 100644 --- a/js/id/ui/sidebar.js +++ b/js/id/ui/sidebar.js @@ -10,6 +10,7 @@ iD.ui.Sidebar = function(context) { wrap.classed('inspector-hidden', false) .classed('inspector-hover', true) .call(iD.ui.Inspector(context) + .state('hover') .entityID(entity.id)); } else { wrap.classed('inspector-hidden', true); @@ -21,6 +22,7 @@ iD.ui.Sidebar = function(context) { wrap.classed('inspector-hidden', false) .classed('inspector-hover', false) .call(iD.ui.Inspector(context) + .state('select') .entityID(selection[0])); } else { wrap.classed('inspector-hidden', true);