Skip to content

Commit

Permalink
add two piano rows
Browse files Browse the repository at this point in the history
  • Loading branch information
TeemuKoivisto committed Apr 5, 2024
1 parent 653fbbc commit adadff0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
14 changes: 14 additions & 0 deletions packages/client/src/components/virtual-piano/VirtualPiano.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@
{#each keys as key, idx}
<VirtualKey
{key}
row={1}
keyCount={keys.length}
isFirst={idx === 0}
isLast={idx === keys.length - 1}
width={windowWidth}
on:pressed
/>
{/each}
</ul>
<ul class={`${$$props.class || ''} flex flex-row relative overflow-x-scroll`}>
{#each keys as key, idx}
<VirtualKey
{key}
row={0}
keyCount={keys.length}
isFirst={idx === 0}
isLast={idx === keys.length - 1}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { createEventDispatcher } from 'svelte'
export let key: { idx: number; isWhite: boolean; whiteKeyCount: number },
row: number,
keyCount: number,
isFirst: boolean,
isLast: boolean,
Expand Down Expand Up @@ -29,7 +30,7 @@
function handlePointerDown(e: any) {
if (!keyHeld && !timeout) {
dispatch('pressed', key.idx)
dispatch('pressed', key.idx + row * 12)
keyHeld = true
}
}
Expand Down Expand Up @@ -64,6 +65,11 @@
li {
button {
@apply relative shadow outline-none rounded-b top-0;
// -webkit-tap-highlight-color: rgba(0,0,0,0);
&::selection {
color: none;
background: none;
}
&.is-first {
@apply rounded-tl;
}
Expand Down

0 comments on commit adadff0

Please sign in to comment.