refac: tools behaviour

This commit is contained in:
Timothy Jaeryang Baek
2024-11-16 18:10:01 -08:00
parent c35f8c9673
commit 393ab5d457
2 changed files with 7 additions and 6 deletions

View File

@@ -89,9 +89,10 @@
<div class=" flex-shrink-0">
<Switch
state={tools[toolId].enabled}
on:change={async () => {
on:change={async (e) => {
const state = e.detail;
await tick();
if (tools[toolId].enabled) {
if (state) {
selectedToolIds = [...selectedToolIds, toolId];
} else {
selectedToolIds = selectedToolIds.filter((id) => id !== toolId);