Add app info and instrument controls
This commit is contained in:
1 parent
e23825cdb1
commit
9d8f277971
38 files changed
+4001
-257
No files matched your search
@@ -16,20 +16,20 @@ import {
|
||||
getStackedPosition,
|
||||
wrapStepPosition,
|
||||
} from '../domain/timeline';
|
||||
import { SOUND_BY_ID } from '../domain/sounds';
|
||||
import type { SoundId } from '../domain/sounds';
|
||||
import { INSTRUMENT_BY_ID } from '../domain/instruments';
|
||||
import type { InstrumentId } from '../domain/instruments';
|
||||
|
||||
interface CircularTimelineProps {
|
||||
beats: BeatPoint[];
|
||||
soundIds: readonly SoundId[];
|
||||
colorBySoundId: Partial<Record<SoundId, string>>;
|
||||
soundIds: readonly InstrumentId[];
|
||||
colorBySoundId: Partial<Record<InstrumentId, string>>;
|
||||
currentStep: number;
|
||||
totalSteps: number;
|
||||
focusedSoundId: SoundId | null;
|
||||
focusedSoundId: InstrumentId | null;
|
||||
selectedBeatId: string | null;
|
||||
onMoveBeat: (beatId: string, step: number) => void;
|
||||
onSelectBeat: (beatId: string) => void;
|
||||
onSelectSound: (soundId: SoundId) => void;
|
||||
onSelectSound: (soundId: InstrumentId) => void;
|
||||
}
|
||||
|
||||
function getPointerCoordinates(event: ReactPointerEvent<SVGSVGElement>) {
|
||||
@@ -94,7 +94,10 @@ export function CircularTimeline({
|
||||
onMoveBeat(beat.id, nextStep);
|
||||
}
|
||||
|
||||
function handleOrbitKeyDown(event: ReactKeyboardEvent<SVGCircleElement>, soundId: SoundId): void {
|
||||
function handleOrbitKeyDown(
|
||||
event: ReactKeyboardEvent<SVGCircleElement>,
|
||||
soundId: InstrumentId,
|
||||
): void {
|
||||
if (event.key !== 'Enter' && event.key !== ' ') return;
|
||||
event.preventDefault();
|
||||
onSelectSound(soundId);
|
||||
@@ -165,7 +168,7 @@ export function CircularTimeline({
|
||||
pointerEvents="stroke"
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
aria-label={`Select ${SOUND_BY_ID[soundId].label} ring`}
|
||||
aria-label={`Select ${INSTRUMENT_BY_ID[soundId].label} ring`}
|
||||
aria-pressed={soundId === activeSoundId}
|
||||
onClick={() => onSelectSound(soundId)}
|
||||
onKeyDown={(event) => handleOrbitKeyDown(event, soundId)}
|
||||
@@ -184,7 +187,7 @@ export function CircularTimeline({
|
||||
})()}
|
||||
|
||||
{beats.map((beat) => {
|
||||
const sound = SOUND_BY_ID[beat.soundId];
|
||||
const sound = INSTRUMENT_BY_ID[beat.soundId];
|
||||
const soundIndex = orderedSoundIds.indexOf(beat.soundId);
|
||||
const point = getStackedPosition(
|
||||
beat,
|
||||
|
||||
Reference in new issue
Block a user