Skip to content

Map editor: keyboard shortcuts for tools, zoom, scrolling and panning - #106

Open
Xehanort88 wants to merge 1 commit into
Psychronic-Games:mainfrom
Xehanort88:pr/map-shortcuts
Open

Xehanort88 wants to merge 1 commit into
Psychronic-Games:mainfrom
Xehanort88:pr/map-shortcuts

Conversation

@Xehanort88

Copy link
Copy Markdown
Contributor

First of four pull requests for the map editor. The other three build on this one: turned tiles, then Tiled exchange, then a few editor extras. Each later pull request contains this commit, so this one is best reviewed and merged first.

The problem

The map editor had almost no keyboard shortcuts. Choosing a tool, zooming, or moving around a large map meant going to the toolbar or the scrollbars every time. Tiled, RPG Maker and most tile editors let you do these from the keyboard.

What changed

On the flat map, when no dialog is open and no text field has focus:

Key Does
B / R / C / F Pencil / rectangle / circle / fill
E / S Turn the eraser / shadow pen on or off
Ctrl with + / − / 0 Zoom in / out / to 100 % (centred on the panel, using the mouse wheel's own steps and limits)
Ctrl+/ Fit the whole map in the panel
Arrow keys Scroll one tile (Event mode keeps them for its cursor)
Hold Space and drag Pan, alongside the middle button and Shift+drag; painting pauses for that drag

Each toolbar button's tooltip now ends with its key, so the keys can be found without documentation.

  • The key table lives in one place, editor/src/utils/MapShortcuts.js. UIManager.handleMapShortcut acts on it.
  • The 3D view keeps its own fly keys. The sidebar lists and open dropdowns keep their letters.

Verification

  • editor/tests/map-shortcuts.test.cjs loads the real MapShortcuts, UIManager and TilemapManager code and drives them. It covers every key, the cases where a key must be ignored (a text field, a dialog, Event mode, the 3D view), zoom limits, and Space-panning.
  • On this branch, all map, tile, i18n and dialog test files pass: 205 tests, none failing.
  • Checked in the running editor (SDK NW.js, driven over CDP): each key changes the tool, zoom or scroll position as listed above.

Limits

  • Flat view only.
  • The keys can't be reassigned.
  • Every user-visible string goes through the existing catalog; the tooltip suffix is the only addition.

🤖 Generated with Claude Code

On the flat map, with no dialog up and no text field in use:

- B, R, C, F pick the pencil, rectangle, circle and fill; E and S toggle
  the eraser and the shadow pen. Each button's tooltip ends with its key.
- Ctrl with +, - and 0 zooms in, out and to 100%; Ctrl+/ fits the map in
  the panel. Zoom is about the middle of the panel and uses the wheel's
  own steps and limits.
- The arrow keys scroll by one tile (Event mode keeps them for its cursor).
- Space held over the map turns a left drag into a pan, beside the middle
  button and Shift+drag. The painter stands down for that drag.

The key table is utils/MapShortcuts.js. The 3D view keeps its fly keys,
and the sidebar lists and open dropdowns keep their letters.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@Xehanort88

Copy link
Copy Markdown
Contributor Author

A note on CI for this pull request and the three stacked on it (#107, #108, #109): node-suite (4/8) fails on all four, and in each run the only failing test is

a dressed character's outfit and shoe pictures painted on helpers are the ones painted on one thread

(editor/tests/character-helper-threads.test.cjs, which reports "painted on helpers: 0 runs").

The same test fails in the same shard on main itself: the CI run for c22a4c4 (Release 0.99.8), https://github.com/Psychronic-Games/RPGReactor/actions/runs/46366052103. None of these four pull requests touches character pictures or helper threads, so this failure comes from main rather than from these changes. Every other check that has finished has passed.

🤖 Generated with Claude Code

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant