This repository was archived by the owner on Aug 24, 2024. It is now read-only.
Commit 101deff 1 parent 0297449 commit 101deff Copy full SHA for 101deff
File tree 1 file changed +12
-12
lines changed
1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change 8
8
24 : ' Floats' ,
9
9
32 : ' Enable gravity' ,
10
10
};
11
-
12
- let propertyValues = $store .brushColour .split (' ' ).map ((v ) => v === ' 1' );
13
-
14
- store .subscribe ((value ) => {
15
- propertyValues = value .brushColour .split (' ' ).map ((v ) => v === ' 1' );
16
- });
17
-
18
- $ : {
19
- $store .brushColour = propertyValues .map ((v ) => (v ? ' 1' : ' 0' )).join (' ' );
20
- }
21
11
</script >
22
12
23
13
<div class =" col-span-2 flex flex-col items-center" >
26
16
{#each Array (4 ) as _ , groupIndex }
27
17
<div class =" flex flex-1 justify-between" >
28
18
{#each Array (8 ) as _ , i }
19
+ {@const index = 8 * groupIndex + i }
20
+ {@const checked = $store .brushColour [index ] === ' 1' }
29
21
<div class =" flex flex-col items-center gap-2" >
30
- <input type ="checkbox" bind:checked ={propertyValues [8 * groupIndex + i ]} />
22
+ <input
23
+ type =" checkbox"
24
+ {checked }
25
+ on:change ={() => {
26
+ const arr = $store .brushColour .split (' ' );
27
+ arr [index ] = checked ? ' 0' : ' 1' ;
28
+ $store .brushColour = arr .join (' ' );
29
+ }}
30
+ />
31
31
<div style:writing-mode =" vertical-lr" >
32
- {propertyDescriptions [8 * groupIndex + i + 1 ] || ' ' }
32
+ {propertyDescriptions [index ] || ' ' }
33
33
</div >
34
34
</div >
35
35
{/each }
You can’t perform that action at this time.
0 commit comments