fen input and index label
This commit is contained in:
parent
ccd82c306e
commit
d1b8b777ac
1 changed files with 6 additions and 3 deletions
|
|
@ -14,11 +14,11 @@
|
|||
|
||||
<div class="grid grid-cols-8 gap-0 border-2">
|
||||
{#each boardView as square, index}
|
||||
<div class="h-20 aspect-square flex justify-center items-center
|
||||
<div class="h-20 aspect-square relative flex justify-center items-center
|
||||
{index % 2 === Math.floor(index / 8) % 2 ? 'bg-orange-200 text-stone-800' : 'bg-amber-800 text-stone-200'}
|
||||
">
|
||||
<span class="absolute top-0 left-0">{showIndex ? index : ''}</span>
|
||||
{#if square}<img src="assets/{square}.svg" alt="p{square}" class="h-18 aspect-square"/>{/if}
|
||||
{showIndex ? index : ''}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
|
@ -29,7 +29,10 @@
|
|||
</label>
|
||||
<label class="block">
|
||||
fen (enter to set):
|
||||
<input type="text" onkeypress={(e) => e.key === 'Enter' && board.loadFEN(fen)} bind:value={fen} />
|
||||
<input type="text" onkeypress={(e) => e.key === 'Enter' && (() => {
|
||||
board.loadFEN(fen)
|
||||
updateView()
|
||||
})()} bind:value={fen} />
|
||||
</label>
|
||||
<button onclick={updateView}>update view</button>
|
||||
<button onclick={() => console.log(board)}>dump game to console</button>
|
||||
|
|
|
|||
Loading…
Reference in a new issue