Makes shapes immutable, adds parenting methods to utils

This commit is contained in:
Steve Ruiz 2021-05-25 10:00:59 +01:00
parent f4e429af0e
commit a1cc578bb9
18 changed files with 245 additions and 163 deletions

View file

@ -39,10 +39,9 @@ export function generateFromCode(code: string) {
new Function(...Object.keys(scope), `${code}`)(...Object.values(scope))
const generatedShapes = Array.from(codeShapes.values()).map((instance) => {
instance.shape.isGenerated = true
return instance.shape
})
const generatedShapes = Array.from(codeShapes.values()).map(
(instance) => instance.shape
)
const generatedControls = Array.from(codeControls.values())
@ -73,10 +72,9 @@ export function updateFromCode(
new Function(...Object.keys(scope), `${code}`)(...Object.values(scope))
const generatedShapes = Array.from(codeShapes.values()).map((instance) => {
instance.shape.isGenerated = true
return instance.shape
})
const generatedShapes = Array.from(codeShapes.values()).map(
(instance) => instance.shape
)
return { shapes: generatedShapes }
}