sharmaeklavya2 / packing-game

2D geometric bin-packing game in the browser
https://sharmaeklavya2.github.io/packing-game/
8 stars 4 forks source link

Allow selecting and moving multiple items at once #11

Open sharmaeklavya2 opened 4 years ago

sharmaeklavya2 commented 4 years ago

Currently we can only move one item at a time. Moving multiple items at once can be really useful, like if we want to move a large group of items from one bin to another.

There are 2 things to be done here:

  1. Make a function that takes multiple items are arguments and the target position and moves those items to that position. This can be exposed in the developer console.
  2. Implement a UI for the above function. If the user clicks outside an item and drags the pointer, we should show a selection rectangle, and the items lying inside it should get selected. Later when these items are moved, they should move together. If some other item is moved, the selection should deactivate.

I think this will require major changes to the code, i.e. instead of having one active item, we'll now have multiple active items, and we'll have to handle more states.