import { useCutsceneStore, useSelectedCutscene } from '../../store/cutsceneStore'; import { useShallow } from 'zustand/react/shallow'; import { AVAILABLE_IMAGES } from '../../constants/images'; import { EASING_OPTIONS } from '../../constants/easings'; import type { ImagePose } from '../../types/cutscene'; import styles from './RightPanel.module.css'; function NumField({ label, value, onChange, min, step }: { label: string; value: number; onChange: (v: number) => void; min?: number; step?: number; }) { return (
onChange(Number(e.target.value))} />
); } function PoseFields({ label, pose, onChange }: { label: string; pose: ImagePose; onChange: (patch: Partial) => void; }) { return (
{label}
onChange({ centerX: Number(e.target.value) })} />
onChange({ centerY: Number(e.target.value) })} />
onChange({ scale: Number(e.target.value) })} />
); } export default function LayerProperties() { const cutscene = useSelectedCutscene(); const { selectedLayerIndex, updateLayer, updateLayerFrom, updateLayerTo } = useCutsceneStore(useShallow(s => ({ selectedLayerIndex: s.selectedLayerIndex, updateLayer: s.updateLayer, updateLayerFrom: s.updateLayerFrom, updateLayerTo: s.updateLayerTo, }))); if (!cutscene || selectedLayerIndex === null) return null; const seg = cutscene.imageSegments[selectedLayerIndex]; if (!seg) return null; return (
Layer {selectedLayerIndex + 1}
updateLayer(selectedLayerIndex, { path: e.target.value })} placeholder="resources/..." />
updateLayer(selectedLayerIndex, { width: v })} min={1} /> updateLayer(selectedLayerIndex, { height: v })} min={1} />
updateLayer(selectedLayerIndex, { startMs: v })} min={0} /> updateLayer(selectedLayerIndex, { endMs: v })} min={0} />
updateLayer(selectedLayerIndex, { fadeInMs: v })} min={0} /> updateLayer(selectedLayerIndex, { fadeOutMs: v })} min={0} />
updateLayerFrom(selectedLayerIndex, patch)} /> updateLayerTo(selectedLayerIndex, patch)} />
); }