Skip to content

Commit

Permalink
Shift click can now remove units from selection; closes #13
Browse files Browse the repository at this point in the history
  • Loading branch information
bananu7 committed Oct 8, 2022
1 parent 4a7e2ee commit 4c1ee40
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,18 @@ function App() {
case 0:
if (!selectedAction) {
if (shift) {
console.log("shift")
setSelectedUnits(units => units.add(targetId));
// shift-click means add if not there, but remove if there
setSelectedUnits(prev => {
const units = new Set(prev);
if (units.has(targetId)) {
units.delete(targetId);
}
else {
units.add(targetId);
}
return units;
});
} else {
console.log("no shift")
setSelectedUnits(new Set([targetId]));
}
break;
Expand Down

0 comments on commit 4c1ee40

Please sign in to comment.