tiled icon indicating copy to clipboard operation
tiled copied to clipboard

Scratch pad map panel

Open eishiya opened this issue 2 years ago • 2 comments

Sometimes it is useful to have a custom arrangement of tiles, possibly from multiple tilesets, somewhere quickly accessible. A dedicated "scratch pad" panel that displays a map but only lets you pick tiles from it like from a tileset would be very helpful for this.

The panel itself should work a lot like the Tilesets panel:

  • Display one map at a time, similar to how the Tilesets panel displays one tileset at a time
  • Allow multiple maps to be added to the panel, so users can switch between them with tabs
  • Allow zooming
  • Have buttons at the bottom to add a map to the panel, to remove a map from the panel, and to Edit a map, which would just open that map in the Map Editor.
  • Allow selecting a single or multiple tiles via click, shift+click, ctrl+click, and click+drag
  • If there are no maps, it should display some text like "Add maps to this panel to quickly access their tiles." and an "Add Map" button

Behaviour

Selecting a tile in the scratch pad should behave just like selecting a tile in the Map Editor, including bringing up the tileset of the selected tile(s) in the Tilesets panel, or selecting no tile if the cell is empty.

If a map has multiple layers, the top-most non-empty tile should be selected, if there is one. This would allow users to layer multiple tiles for clarity, but be unambiguous about which tile they'll pick.

  • Optional: if the user right-clicks on the panel with tile(s) selected, the context menu could include options for selecting tiles from any layer that has tiles in the selected cells, similar to how Alt + right click works for stacked objects.
  • Optional: There could also be an option to copy the entire stack of tiles. This is perhaps treading on Tile Stamp territory, but I think it would be useful.

The maps can inherit their tile grid display settings from the Map Editor. Using the same settings as the Tilesets Panel is also acceptable, if that's easier to implement.

The maps in the scratch pad should automatically update either immediately upon changes, or when the map file is saved, whichever is more convenient.

Optional: Let users drag a map document tab to the scratch pad panel to add that map to it.

Use scenarios

  • Quick-access palette for commonly used tiles from multiple tilesets
  • A quick way to select a particular tileset if you have a lot of tilesets, you can have a representative tile from each tileset in the scratch pad map and click it to go to that tileset, instead of scrolling through the tabs or a list. Tiles are often more compact that tileset titles, and can be zoomed.
  • A custom arrangement of a tileset that's more flexible than the Rearrange Tiles feature, since you can leave empty spaces to group together related tiles, without introducing empty space into the tileset itself.
  • As an always-visible reference for style/density from an earlier maps, or just a quick way to open a particular map in the editor.
  • A map with some text objects on it could be used to label groups of tiles, display a to-do list or reminders, etc. The text objects would not be selectable.
  • Isometric/hexagonal display of tilesets, instead of the orthogonal display in the Tilesets panel, which would solve #3228

Objects

The feature as described above would treat Objects as entirely cosmetic and ignore them when selecting tiles.

It could also be cool to have both the default Tile selection mode, and an Object selection mode, toggleable via buttons at the bottom of the panel. In Object mode, you'd be able to select objects and these objects would be automatically copied. However, this would probably encourage blind copypasting instead of using Templates, so it might not be a good addition. Perhaps a separate visual Template Browser panel would be better.

eishiya avatar Feb 27 '22 15:02 eishiya

Some more thoughts on interacting with this panel.


I fairly often right-click a tile to select it in its tileset, just as a way to quickly scroll to the relevant part of the tileset. For example, I'll right-click a chair to get to the other furniture tiles. I'd like to be able to do this with scratch pad maps as well. However, since a tile may be in multiple maps or even appear multiple times within a single map, and since users may scroll to a particular part of a scratch pad map on purpose, this behaviour isn't always desirable or even predictable.

So, I think that selecting and scrolling to the relevant tile(s) in a scratch pad panel should be done only within the already active scratch pad map (should never change scratch pad tabs). If there are multiple instance(s) of some of the selected tiles, any already-selected instances should be prioritised for scrolling. Other than that, the first found instance could be selected. Selecting all instances would also be fine, if it can be done efficiently. Ideally, if the user's multi-tile selection is an exact match for some region of the scratch pad map, that region should be selected to the exclusion of other regions using those tiles, but I imagine this gets rather heavy xP

It would also be fine if right-clicking tiles only selected tile(s) in the scratch pad panel if there's only a single selected tile and it's in the currently selected scratch pad map. This would still allow right-clicking as a shortcut, but without a lot of complicated logic.

It should also be possible to lock the current scroll position in the scratch pad map to prevent unwanted auto-scrolling (see #2860).


Switching tabs in this panel should never modify the user's current brush (see #3654). If a user wants to set their brush to the current tile selection in the scratch pad, they can do so by unselecting and reselecting any tile within the panel by ctrl+clicking it, same as they can within the Tilesets view.

eishiya avatar May 05 '23 18:05 eishiya

Another potential use for this came up on Discord: As a more compact, visual way to select Terrains. This would be a convenient work-around for the inability to reorder terrains, on top of letting users customise the overall presentation of their terrains.

But what would the UI for this be? Having to change a toggle between tile selection and terrain selection modes would be inconvenient, I think. Left-click is reserved for selecting tiles, Tileset-style. Right-click is needed for a menu. Perhaps right-click specifically while a Terrain tool is active could be it? This would be close in behaviour for picking terrains from a regular map.

eishiya avatar Dec 01 '23 15:12 eishiya