-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
selection bugs, rearranging things for maureen
- Loading branch information
1 parent
dfbad8a
commit 97b511f
Showing
11 changed files
with
225 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<script lang="ts"> | ||
import focusStore from "../stores/focus-store"; | ||
import colorStore from "../stores/color-store"; | ||
import { buttonStyle } from "../lib/styles"; | ||
$: colors = $colorStore.palettes[$colorStore.currentPal].colors; | ||
$: focused = $focusStore.focusedColors; | ||
$: buttonsActive = focused.length > 0; | ||
</script> | ||
|
||
<button | ||
class="{buttonStyle} mr-2" | ||
class:opacity-30={!buttonsActive} | ||
class:cursor-not-allowed={!buttonsActive} | ||
on:click|stopPropagation|preventDefault={() => { | ||
// move every element to the left | ||
const newColors = [...colors]; | ||
const newFocused = [...focused]; | ||
for (let i = 0; i < focused.length; i++) { | ||
const idx = focused[i]; | ||
if (idx === 0) { | ||
continue; | ||
} | ||
newColors[idx] = colors[idx - 1]; | ||
newColors[idx - 1] = colors[idx]; | ||
newFocused[i] = idx - 1; | ||
} | ||
colorStore.setSort(newColors); | ||
focusStore.setColors(newFocused); | ||
}} | ||
> | ||
Move left | ||
</button> | ||
<button | ||
class="{buttonStyle} mr-2" | ||
class:opacity-30={!buttonsActive} | ||
class:cursor-not-allowed={!buttonsActive} | ||
on:click|stopPropagation|preventDefault={() => { | ||
// move every element to the right | ||
const newColors = [...colors]; | ||
const newFocused = [...focused]; | ||
for (let i = focused.length - 1; i >= 0; i--) { | ||
const idx = focused[i]; | ||
if (idx === colors.length - 1) { | ||
continue; | ||
} | ||
newColors[idx] = colors[idx + 1]; | ||
newColors[idx + 1] = colors[idx]; | ||
newFocused[i] = idx + 1; | ||
} | ||
colorStore.setSort(newColors); | ||
focusStore.setColors(newFocused); | ||
}} | ||
> | ||
Move right | ||
</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.