Add 1 as the hotkey for focusing the search bar

This commit is contained in:
Quincy Morgan
2019-03-02 15:37:15 -05:00
parent b8a1a65316
commit 971b901b21
5 changed files with 13 additions and 9 deletions
+1 -2
View File
@@ -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)
+1 -2
View File
@@ -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)
+1 -1
View File
@@ -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)
+1 -2
View File
@@ -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)
+9 -2
View File
@@ -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);
}
});