diff --git a/packages/plugin-r3f/src/store.ts b/packages/plugin-r3f/src/store.ts index 8c1ef87..18f3cd1 100644 --- a/packages/plugin-r3f/src/store.ts +++ b/packages/plugin-r3f/src/store.ts @@ -293,20 +293,21 @@ const editorSheetObjectConfig = types.compound({ showAxes: types.boolean(true), showGrid: types.boolean(true), showOverlayIcons: types.boolean(false), - transformControlsMode: types.stringLiteral( - 'translate', - ['translate', 'rotate', 'scale'], - ), - transformControlsSpace: types.stringLiteral('world', [ - 'local', - 'world', - ]), - viewportShading: types.stringLiteral('rendered', [ - 'flat', - 'rendered', - 'solid', - 'wireframe', - ]), + transformControlsMode: types.stringLiteral('translate', { + translate: 'Translate', + rotate: 'Rotate', + scale: 'Scale', + }), + transformControlsSpace: types.stringLiteral('world', { + local: 'Local', + world: 'World', + }), + viewportShading: types.stringLiteral('rendered', { + flat: 'Flat', + rendered: 'Rendered', + solid: 'Solid', + wireframe: 'Wireframe', + }), }) export const bindToCanvas: BindFunction = ({ diff --git a/theatre/core/src/propTypes/index.ts b/theatre/core/src/propTypes/index.ts index d6a78c1..97c3217 100644 --- a/theatre/core/src/propTypes/index.ts +++ b/theatre/core/src/propTypes/index.ts @@ -61,17 +61,17 @@ export interface PropTypeConfig_StringLiteral extends IBasePropType { type: 'stringLiteral' default: T - options: ReadonlyArray + options: Record } -export function stringLiteral( - defaultValue: T, - options: ReadonlyArray, -): PropTypeConfig_StringLiteral { +export function stringLiteral( + defaultValue: Extract, + options: Opts, +): PropTypeConfig_StringLiteral> { return { type: 'stringLiteral', default: defaultValue, - options: [...options], + options: {...options}, [s]: 'TheatrePropType', valueType: null as $IntentionalAny, } diff --git a/theatre/studio/src/panels/ObjectEditorPanel/propEditors/StringLiteralPropEditor.tsx b/theatre/studio/src/panels/ObjectEditorPanel/propEditors/StringLiteralPropEditor.tsx index 3b36fc7..3b6985f 100644 --- a/theatre/studio/src/panels/ObjectEditorPanel/propEditors/StringLiteralPropEditor.tsx +++ b/theatre/studio/src/panels/ObjectEditorPanel/propEditors/StringLiteralPropEditor.tsx @@ -77,9 +77,9 @@ const StringLiteralPropEditor: React.FC<{ {stuff.controlIndicators}