From 2fff6aec9363c935c18e02679caf19207a61fe3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Mon, 21 Dec 2020 21:59:50 -0800 Subject: [PATCH] Added shortcut to select parent way --- data/core.yaml | 1 + data/shortcuts.json | 4 ++++ modules/modes/select.js | 10 ++++++++++ 3 files changed, 15 insertions(+) diff --git a/data/core.yaml b/data/core.yaml index cf60722c6..4f7e80dd5 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -2258,6 +2258,7 @@ en: next: "Jump to next node" first: "Jump to first node" last: "Jump to last node" + parent: "Select parent way" change_parent: "Switch parent way" editing: title: "Editing" diff --git a/data/shortcuts.json b/data/shortcuts.json index 2997ed427..dfad38e8c 100644 --- a/data/shortcuts.json +++ b/data/shortcuts.json @@ -158,6 +158,10 @@ "shortcuts": ["}", "⇟"], "text": "shortcuts.browsing.vertex_selected.last" }, + { + "shortcuts": [">"], + "text": "shortcuts.browsing.vertex_selected.parent" + }, { "shortcuts": ["\\", "shortcuts.key.pause"], "text": "shortcuts.browsing.vertex_selected.change_parent" diff --git a/modules/modes/select.js b/modules/modes/select.js index b0b98d183..01946f1c2 100644 --- a/modules/modes/select.js +++ b/modules/modes/select.js @@ -245,6 +245,7 @@ export function modeSelect(context, selectedIDs) { .on(utilKeybinding.minusKeys.map((key) => uiCmd('⇧' + key)), scaleSelection(1/1.05)) .on(utilKeybinding.minusKeys.map((key) => uiCmd('⇧⌥' + key)), scaleSelection(1/Math.pow(1.05, 5))) .on(['\\', 'pause'], nextParent) + .on('>', selectParent) .on('⎋', esc, true); d3_select(document) @@ -561,6 +562,15 @@ export function modeSelect(context, selectedIDs) { .classed('related', true); } } + + function selectParent(d3_event) { + d3_event.preventDefault(); + if (_relatedParent) { + context.enter( + modeSelect(context, [_relatedParent]) + ); + } + } };