Editor singleton to prevent re-renders (#2163)

* move editor data into a singleton

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* debounce on update

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* make select on extrude work

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* highlight range

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* highlight range

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix errors

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* almost forgot the error pane

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* loint

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* call out to codemirror

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix tauri;

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* more efficient

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* create the modals in the hook

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* Revert "create the modals in the hook"

This reverts commit bbeba85030763cf7235a09fa24247dbf120f2a64.

* change todo

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2024-04-19 14:24:40 -07:00
committed by GitHub
parent f08d955d40
commit 537d86c8ff
44 changed files with 584 additions and 415 deletions

View File

@ -7,6 +7,7 @@ import {
sceneInfra,
sceneEntitiesManager,
engineCommandManager,
editorManager,
} from 'lib/singletons'
import {
horzVertInfo,
@ -800,7 +801,7 @@ export const modelingMachine = createMachine(
sketchDetails.origin
)
},
'AST extrude': (_, event) => {
'AST extrude': async (_, event) => {
if (!event.data) return
const { selection, distance } = event.data
let ast = kclManager.ast
@ -829,10 +830,12 @@ export const modelingMachine = createMachine(
? distance.variableIdentifierAst
: distance.valueAst
)
// TODO not handling focusPath correctly I think
kclManager.updateAst(modifiedAst, true, {
const selections = await kclManager.updateAst(modifiedAst, true, {
focusPath: pathToExtrudeArg,
})
if (selections) {
editorManager.selectRange(selections)
}
},
'conditionally equip line tool': (_, { type }) => {
if (type === 'done.invoke.animate-to-face') {