Add new setting modeling.highlightEdges (#2166)

* Add doc comment to getThemeColorForEngine

* Add a user-level setting for highlightEdges

* Add a custom settings action to update the edge line visibility

* Make the settings pane always open to user settings first

* Refactor engineConnectionMananer.start() to take a settings object

* Revert alway open user settings

* Set highlight edges on engine start up

* fmt fml

* Fix tsc error
This commit is contained in:
Frank Noirot
2024-04-19 00:58:32 -04:00
committed by GitHub
parent 21756fe513
commit ba33b0da19
8 changed files with 70 additions and 11 deletions

View File

@ -926,7 +926,10 @@ export class EngineCommandManager {
executeCode,
token,
makeDefaultPlanes,
theme = Themes.Dark,
settings = {
theme: Themes.Dark,
highlightEdges: true,
},
}: {
setMediaStream: (stream: MediaStream) => void
setIsStreamReady: (isStreamReady: boolean) => void
@ -935,7 +938,10 @@ export class EngineCommandManager {
executeCode: () => void
token?: string
makeDefaultPlanes: () => Promise<DefaultPlanes>
theme?: Themes
settings?: {
theme: Themes
highlightEdges: boolean
}
}) {
this.makeDefaultPlanes = makeDefaultPlanes
if (width === 0 || height === 0) {
@ -963,15 +969,21 @@ export class EngineCommandManager {
},
onEngineConnectionOpen: () => {
// Set the stream background color
// This takes RGBA values from 0-1
// So we convert from the conventional 0-255 found in Figma
this.sendSceneCommand({
type: 'modeling_cmd_req',
cmd_id: uuidv4(),
cmd: {
type: 'set_background_color',
color: getThemeColorForEngine(theme),
color: getThemeColorForEngine(settings.theme),
},
})
// Set the edge lines visibility
this.sendSceneCommand({
type: 'modeling_cmd_req',
cmd_id: uuidv4(),
cmd: {
type: 'edge_lines_visible' as any, // TODO: update kittycad.ts to use the correct type
hidden: !settings.highlightEdges,
},
})