Skip to content

Keyboard shortcut conflict between R (Rotate) and Shift+R (Toggle Rapid) #3

Description

@nyampire

Summary

The R key (Rotate selected features) and Shift+R (Toggle Rapid data layer) may conflict in certain editing contexts.

Current Bindings

Key Action Registered In
R Rotate selected features modules/operations/rotate.js (line 79)
Shift+R Toggle Rapid dataset layer modules/ui/sections/data_layers.js (line 480)

How the Keybinding System Works

The keybinding system (modules/util/keybinding.js) uses a two-pass matching approach:

  1. First pass (lines 19-31): Checks shifted keybindings (Shift+R) - these have priority
  2. Second pass (lines 35-44): Falls back to unshifted keybindings (R)

The code comment (lines 14-17) states:

"Most key shortcuts will accept either lower or uppercase, so we don't strictly match on the shift key, but we prioritize shifted keybindings first, and fallback to unshifted only if no match."

Potential Issue

Due to the fallback behavior, pressing Shift+R could potentially trigger the Rotate operation as a fallback if the Toggle Rapid binding is not matched in the current context/mode. This needs testing to confirm the exact scenarios where the conflict manifests.

Steps to Reproduce

  1. Open Rapid editor
  2. Select a building feature
  3. Press Shift+R
  4. Observe whether the feature rotates or the Rapid layer toggles (or both)

Key Files

  • modules/util/keybinding.js - Keybinding matching logic (two-pass system)
  • modules/operations/rotate.js - Rotate operation (R key, line 79)
  • modules/ui/sections/data_layers.js - Toggle Rapid data (Shift+R, line 480)
  • data/shortcuts.json - Shortcut definitions

Activity

  1. nyampire commented on Feb 25, 2026

    @nyampire
    OwnerAuthor

    調査結果 (Investigation Results)

    キーバインディングシステムの動作

    modules/util/keybinding.js のキーバインディングシステムは 2パス方式 で動作しており、Shift+R と R の衝突を正しく処理する設計になっています。

    2パス方式の詳細:

    1. 第1パス (L20-31): Shift付きバインディングを優先チェック

      • ⇧R (Toggle Rapid) が shiftKey: true として登録されている
      • Shift+R 押下時: event.shiftKey=true が binding.shiftKey=true と一致 → マッチ
      • マッチした場合、第2パスはスキップ (didMatch=true → return)
    2. 第2パス (L36-44): Shift無しバインディングをチェック

      • R (Rotate) が shiftKey: false として登録されている
      • R 押下時 (Shift無し): testShift=false のためShiftチェック自体がスキップ → マッチ

    キー登録箇所:

    • R (Rotate): modules/operations/rotate.js L90 - KeyOperationBehavior 経由で登録
    • ⇧R (Toggle Rapid): modules/ui/sections/data_layers.js L466 - utilCmd('⇧' + 'R') として登録

    結論

    コードバグではなく、UXの問題です。 2パス方式により技術的には正しく動作しますが、同一キーをベースにした2つの機能が近接しているため、ユーザーが混乱する可能性があります。

    これはupstream Rapidの既存設計パターン(全レイヤートグルが Shift+キー)に従っているため、変更する場合はfork固有の対応が必要です。

    対応オプション:

    1. 現状維持: 2パスシステムが正しく動作するため、ドキュメントで説明
    2. Toggle Rapidのキー変更: Shift+R を別のキーに変更(例: Shift+T など)
    3. Rotateのキー変更: fork固有でRotateキーを変更(upstream互換性が低下)

    推奨: 実際にブラウザで動作確認を行い、衝突が発生する具体的なシナリオを特定してから対応を決定

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions