Add setting to toggle scale grid visibility (#2838)
* Add a setting for showScaleGrid * Fix up setting persistence, move under modeling * Make the setting actually do something * the lamest fmt I've seen in a while * Fix clippy warnings * Add snapshot tests for grid (first time using Playwright masks) * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * Re-run CI after new screenshots added --------- Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@ -1158,6 +1158,7 @@ export class EngineCommandManager extends EventTarget {
|
||||
theme: Themes.Dark,
|
||||
highlightEdges: true,
|
||||
enableSSAO: true,
|
||||
showScaleGrid: false,
|
||||
},
|
||||
}: {
|
||||
setMediaStream: (stream: MediaStream) => void
|
||||
@ -1172,6 +1173,7 @@ export class EngineCommandManager extends EventTarget {
|
||||
theme: Themes
|
||||
highlightEdges: boolean
|
||||
enableSSAO: boolean
|
||||
showScaleGrid: boolean
|
||||
}
|
||||
}) {
|
||||
this.makeDefaultPlanes = makeDefaultPlanes
|
||||
@ -1254,7 +1256,7 @@ export class EngineCommandManager extends EventTarget {
|
||||
// We want modify the grid first because we don't want it to flash.
|
||||
// Ideally these would already be default hidden in engine (TODO do
|
||||
// that) https://github.com/KittyCAD/engine/issues/2282
|
||||
this.modifyGrid(true)?.then(async () => {
|
||||
this.modifyGrid(!settings.showScaleGrid)?.then(async () => {
|
||||
await this.initPlanes()
|
||||
this.resolveReady()
|
||||
setIsStreamReady(true)
|
||||
@ -2074,4 +2076,12 @@ export class EngineCommandManager extends EventTarget {
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the visibility of the scale grid in the engine scene.
|
||||
* @param visible - whether to show or hide the scale grid
|
||||
*/
|
||||
setScaleGridVisibility(visible: boolean) {
|
||||
this.modifyGrid(!visible)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user