enable keybindings for unavailable operations -> show info message

this should make it easier to discover what a given keypress was supposed to do (e.g. which operation it triggered)

closes #9896
This commit is contained in:
Martin Raifer
2025-05-15 17:01:30 +02:00
parent c11b661ef3
commit e25af7c05e
6 changed files with 50 additions and 26 deletions
+2 -5
View File
@@ -12,7 +12,6 @@ export function utilKeybinding(namespace) {
function testBindings(d3_event, isCapturing) {
var didMatch = false;
var bindings = Object.keys(_keybindings).map(function(id) { return _keybindings[id]; });
var i, binding;
// Most key shortcuts will accept either lower or uppercase ('h' or 'H'),
// so we don't strictly match on the shift key, but we prioritize
@@ -20,8 +19,7 @@ export function utilKeybinding(namespace) {
// (This lets us differentiate between '←'/'⇧←' or '⌘Z'/'⌘⇧Z')
// priority match shifted keybindings first
for (i = 0; i < bindings.length; i++) {
binding = bindings[i];
for (const binding of bindings) {
if (!binding.event.modifiers.shiftKey) continue; // no shift
if (!!binding.capture !== isCapturing) continue;
if (matches(d3_event, binding, true)) {
@@ -36,8 +34,7 @@ export function utilKeybinding(namespace) {
if (didMatch) return;
// then unshifted keybindings
for (i = 0; i < bindings.length; i++) {
binding = bindings[i];
for (const binding of bindings) {
if (binding.event.modifiers.shiftKey) continue; // shift
if (!!binding.capture !== isCapturing) continue;
if (matches(d3_event, binding, false)) {