Hide line numbers by default

This commit is contained in:
ochafik 2023-03-27 01:27:09 +01:00
commit 3c5aec27c3
4 changed files with 10 additions and 0 deletions

View file

@ -193,6 +193,8 @@ export default function EditorPanel({className, style}: {className?: string, sty
onMount={onMount} // TODO: This looks a bit silly, does it trigger a re-render??
options={{
...openscadEditorOptions,
lineNumbers: state.view.lineNumbers ? 'on' : 'off',
// readOnly: !isFileWritable(state.params.sourcePath)
}}
/>

View file

@ -38,6 +38,12 @@ export default function SettingsMenu({className, style}: {className?: string, st
// disabled: true,
command: () => model.mutate(s => s.view.showShadows = !s.view.showShadows)
},
{
label: state.view.lineNumbers ? 'Hide line numbers' : 'Show line numbers',
icon: 'pi pi-list',
// disabled: true,
command: () => model.mutate(s => s.view.lineNumbers = !s.view.lineNumbers)
},
] as MenuItem[]} popup ref={settingsMenu} />
<Button title="Settings menu"
style={style}

View file

@ -24,6 +24,7 @@ export interface State {
color: string,
showAxes?: boolean,
showShadows?: boolean,
lineNumbers?: boolean,
}
lastCheckerRun?: {

View file

@ -37,6 +37,7 @@ export function readStateFromFragment(): State | null {
color: validateString(view?.color, () => defaultModelColor),
showAxes: validateBoolean(view?.layout?.showAxis),
showShadows: validateBoolean(view?.layout?.showShadow),
lineNumbers: validateBoolean(view?.layout?.lineNumbers, () => false)
}
};
} catch (e) {