Skip to content

Commit

Permalink
Fix issue where tab-focusing off the preset list would unexpectedly n…
Browse files Browse the repository at this point in the history
…avigate to the entity editor (re: #7770)

Make offscreen inspector panes display:hidden
  • Loading branch information
quincylvania committed Sep 11, 2020
1 parent 5c18d46 commit c4fcb23
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions modules/ui/inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ export function uiInspector(context) {
.autofocus(_newFeature)
.on('choose', inspector.setPreset)
.on('cancel', function() {
wrap.transition()
.styleTween('right', function() { return d3_interpolate('-100%', '0%'); });
editorPane.call(entityEditor);
inspector.setPreset();
});

entityEditor
Expand Down Expand Up @@ -87,10 +85,14 @@ export function uiInspector(context) {

if (shouldDefaultToPresetList()) {
wrap.style('right', '-100%');
presetPane.call(presetList);
editorPane.classed('hide', true);
presetPane.classed('hide', false)
.call(presetList);
} else {
wrap.style('right', '0%');
editorPane.call(entityEditor);
presetPane.classed('hide', true);
editorPane.classed('hide', false)
.call(entityEditor);
}

var footer = selection.selectAll('.footer')
Expand All @@ -109,8 +111,15 @@ export function uiInspector(context) {

inspector.showList = function(presets) {

presetPane.classed('hide', false);

wrap.transition()
.styleTween('right', function() { return d3_interpolate('0%', '-100%'); });
.styleTween('right', function() {
return d3_interpolate('0%', '-100%');
})
.on('end', function () {
editorPane.classed('hide', true);
});

if (presets) {
presetList.presets(presets);
Expand All @@ -123,16 +132,25 @@ export function uiInspector(context) {
inspector.setPreset = function(preset) {

// upon setting multipolygon, go to the area preset list instead of the editor
if (preset.id === 'type/multipolygon') {
if (preset && preset.id === 'type/multipolygon') {
presetPane
.call(presetList.autofocus(true));

} else {
editorPane.classed('hide', false);
wrap.transition()
.styleTween('right', function() { return d3_interpolate('-100%', '0%'); });

.styleTween('right', function() {
return d3_interpolate('-100%', '0%');
})
.on('end', function () {
presetPane.classed('hide', true);
});

if (preset) {
entityEditor.presets([preset])
}
editorPane
.call(entityEditor.presets([preset]));
.call(entityEditor);
}

};
Expand Down

0 comments on commit c4fcb23

Please sign in to comment.