mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-20 15:34:49 +02:00
Focus search after going back to preset grid (fixes #1386)
This commit is contained in:
@@ -42,7 +42,7 @@ iD.ui.Inspector = function(context, entity) {
|
||||
.classed('pane tag-pane', true);
|
||||
|
||||
var presetGrid = iD.ui.PresetGrid(context, entity)
|
||||
.newFeature(newFeature)
|
||||
.autofocus(newFeature)
|
||||
.on('close', browse)
|
||||
.on('choose', function(preset) {
|
||||
var right = panewrap.style('right').indexOf('%') > 0 ? '0%' : '0px';
|
||||
@@ -64,6 +64,7 @@ iD.ui.Inspector = function(context, entity) {
|
||||
.transition()
|
||||
.style('right', right);
|
||||
|
||||
presetGrid.autofocus(true);
|
||||
presetLayer.call(presetGrid, preset);
|
||||
});
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ iD.ui.PresetGrid = function(context, entity) {
|
||||
defaultLimit = 9,
|
||||
currentlyDrawn = 9,
|
||||
presets,
|
||||
newFeature = false;
|
||||
autofocus = false;
|
||||
|
||||
function presetgrid(selection, preset) {
|
||||
|
||||
@@ -103,7 +103,7 @@ iD.ui.PresetGrid = function(context, entity) {
|
||||
searchwrap.append('span')
|
||||
.attr('class', 'icon search');
|
||||
|
||||
if (newFeature) {
|
||||
if (autofocus) {
|
||||
search.node().focus();
|
||||
}
|
||||
|
||||
@@ -246,9 +246,9 @@ iD.ui.PresetGrid = function(context, entity) {
|
||||
}
|
||||
}
|
||||
|
||||
presetgrid.newFeature = function(_) {
|
||||
if (!arguments.length) return newFeature;
|
||||
newFeature = _;
|
||||
presetgrid.autofocus = function(_) {
|
||||
if (!arguments.length) return autofocus;
|
||||
autofocus = _;
|
||||
return presetgrid;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user