mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-19 15:08:23 +02:00
Add 1 as the hotkey for focusing the search bar
This commit is contained in:
@@ -15,8 +15,7 @@ export function modeAddArea(context, customMode) {
|
||||
id: 'add-area',
|
||||
button: 'area',
|
||||
title: t('modes.add_area.title'),
|
||||
description: t('modes.add_area.description'),
|
||||
key: '3'
|
||||
description: t('modes.add_area.description')
|
||||
};
|
||||
|
||||
var behavior = behaviorAddWay(context)
|
||||
|
||||
@@ -15,8 +15,7 @@ export function modeAddLine(context, customMode) {
|
||||
id: 'add-line',
|
||||
button: 'line',
|
||||
title: t('modes.add_line.title'),
|
||||
description: t('modes.add_line.description'),
|
||||
key: '2'
|
||||
description: t('modes.add_line.description')
|
||||
};
|
||||
|
||||
var behavior = behaviorAddWay(context)
|
||||
|
||||
@@ -11,7 +11,7 @@ export function modeAddNote(context) {
|
||||
button: 'note',
|
||||
title: t('modes.add_note.title'),
|
||||
description: t('modes.add_note.description'),
|
||||
key: '4'
|
||||
key: 'N'
|
||||
};
|
||||
|
||||
var behavior = behaviorDraw(context)
|
||||
|
||||
@@ -11,8 +11,7 @@ export function modeAddPoint(context, customMode) {
|
||||
id: 'add-point',
|
||||
button: 'point',
|
||||
title: t('modes.add_point.title'),
|
||||
description: t('modes.add_point.description'),
|
||||
key: '1'
|
||||
description: t('modes.add_point.description')
|
||||
};
|
||||
|
||||
var behavior = behaviorDraw(context)
|
||||
|
||||
@@ -44,6 +44,7 @@ export function uiSearchAdd(context) {
|
||||
.call(utilNoAuto)
|
||||
.on('focus', function() {
|
||||
search.attr('focusing', true);
|
||||
search.node().setSelectionRange(0, search.property('value').length);
|
||||
popover.classed('hide', false);
|
||||
})
|
||||
.on('blur', function() {
|
||||
@@ -86,6 +87,12 @@ export function uiSearchAdd(context) {
|
||||
//.call(drawList, context.presets().defaults(geometry, 36));
|
||||
|
||||
context.features().on('change.search-add', updateForFeatureHiddenState);
|
||||
|
||||
context.keybinding().on('1', function() {
|
||||
search.node().focus();
|
||||
d3_event.preventDefault();
|
||||
d3_event.stopPropagation();
|
||||
});
|
||||
}
|
||||
|
||||
function drawList(list, presets) {
|
||||
@@ -98,9 +105,9 @@ export function uiSearchAdd(context) {
|
||||
return ['point', 'line', 'area'].indexOf(geometry) !== -1;
|
||||
}).sort();
|
||||
if (supportedGeometry.length === 1) {
|
||||
return AddablePresetItem(preset, supportedGeom[0]);
|
||||
return AddablePresetItem(preset, supportedGeometry[0]);
|
||||
}
|
||||
return MultiGeometryPresetItem(preset, supportedGeom);
|
||||
return MultiGeometryPresetItem(preset, supportedGeometry);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user