📋 Summary
Currently, clicking on a tile selects all tile indexes under the mouse at that position (x, y). A single mouse_down is recorded, and tiles are transformed via ImGuizmo by tracking the difference between mouse_down and mouse_pos.
We want to extend this to support multi-selection using Ctrl + Mouse Click, allowing users to select and manipulate multiple tiles at once.
Related to: #113
Current Behavior
- Mouse click at (x, y) loads all tile indexes at that location into a selection vector.
- A single
mouse_down is stored.
ImGuizmo is anchored at mouse_down.
- Moving the mouse updates
mouse_pos, which is used to compute the delta transform for selected tiles.
- The tiles are live-updated by the delta between
mouse_down and mouse_pos.
- After each move,
mouse_down is updated to the current mouse_pos.
Proposed Behavior
- Ctrl + Mouse Click:
- Appends the tile indexes at the clicked position to the selection vector.
- Deduplicates and sorts the list to avoid overlapping transformations.
- Tracks a list of
mouse_down points corresponding to each Ctrl-clicked tile cluster.
- Computes the centroid of all
mouse_down points.
- On Transform (via ImGuizmo):
- Anchor the gizmo at the centroid.
- On drag, compute delta between
mouse_pos and the previous centroid.
- Move all selected tiles by this delta.
- Update
centroid.
- Shift all stored
mouse_down points by the same delta.
- This keeps them aligned with the tiles in case of additional Ctrl + clicks (i.e. adding to selection after moving).
🔧 Implementation Notes
- Add a
multi_selection mode enabled by checking Ctrl key state during mouse click.
- Use a
std::vector<glm::uvec2> (or equivalent) to store multiple mouse_down points.
- Selection vector stores tile indexes, sorted and deduplicated.
- Add helper functions to:
- Compute centroid of a list of points.
- Apply transformation delta to all selected tiles.
- Shift stored
mouse_down points by delta after each move.
- UI feedback: ImGuizmo appears at the centroid of selected tiles when multiple are selected.
Testing Considerations
- Select multiple tiles by Ctrl + clicking at various positions.
- Ensure ImGuizmo appears at the centroid and moves all selected tiles consistently.
- Check that dragging continues to update the centroid and tile positions correctly.
- Verify that stored
mouse_down points are updated so that adding to the selection still works as expected after moving tiles.
Future Improvements
📋 Summary
Currently, clicking on a tile selects all tile indexes under the mouse at that position (x, y). A single
mouse_downis recorded, and tiles are transformed via ImGuizmo by tracking the difference betweenmouse_downandmouse_pos.We want to extend this to support multi-selection using Ctrl + Mouse Click, allowing users to select and manipulate multiple tiles at once.
Related to: #113
Current Behavior
mouse_downis stored.ImGuizmois anchored atmouse_down.mouse_pos, which is used to compute the delta transform for selected tiles.mouse_downandmouse_pos.mouse_downis updated to the currentmouse_pos.Proposed Behavior
mouse_downpoints corresponding to each Ctrl-clicked tile cluster.mouse_downpoints.mouse_posand the previous centroid.centroid.mouse_downpoints by the same delta.🔧 Implementation Notes
multi_selectionmode enabled by checkingCtrlkey state during mouse click.std::vector<glm::uvec2>(or equivalent) to store multiplemouse_downpoints.mouse_downpoints by delta after each move.Testing Considerations
mouse_downpoints are updated so that adding to the selection still works as expected after moving tiles.Future Improvements