import { For } from 'solid-js'; import type { DeckStore } from '../hooks/deckStore'; export interface LayerEditorPanelProps { store: DeckStore; } const ORIENTATION_OPTIONS = [ { value: 'n', label: '↑ 北' }, { value: 'e', label: '→ 东' }, { value: 's', label: '↓ 南' }, { value: 'w', label: '← 西' } ] as const; const ALIGN_OPTIONS = [ { value: '', label: '对齐' }, { value: 'l', label: '← 左' }, { value: 'c', label: '≡ 中' }, { value: 'r', label: '→ 右' } ] as const; /** * 图层编辑面板:图层可见性切换、位置编辑、复制代码 */ export function LayerEditorPanel(props: LayerEditorPanelProps) { const { store } = props; // 根据当前激活的面获取图层配置 const currentLayerConfigs = () => store.state.activeSide === 'front' ? store.state.frontLayerConfigs : store.state.backLayerConfigs; const updateLayerOrientation = (layerProp: string, orientation: 'n' | 's' | 'e' | 'w') => { const updateFn = store.state.activeSide === 'front' ? store.actions.updateFrontLayerConfig : store.actions.updateBackLayerConfig; updateFn(layerProp, { orientation }); }; const updateLayerFontSize = (layerProp: string, fontSize?: number) => { const updateFn = store.state.activeSide === 'front' ? store.actions.updateFrontLayerConfig : store.actions.updateBackLayerConfig; updateFn(layerProp, { fontSize }); }; const updateLayerAlign = (layerProp: string, align?: 'l' | 'c' | 'r') => { const updateFn = store.state.activeSide === 'front' ? store.actions.updateFrontLayerConfig : store.actions.updateBackLayerConfig; updateFn(layerProp, { align }); }; const toggleLayerVisible = (layerProp: string) => { const toggleFn = store.state.activeSide === 'front' ? store.actions.toggleFrontLayerVisible : store.actions.toggleBackLayerVisible; toggleFn(layerProp); }; const setEditingLayer = (layerProp: string) => { store.actions.setEditingLayer( store.state.editingLayer === layerProp ? null : layerProp ); }; return (