asyncronise executor (#115)

* Intital async of executor

The execture now sends websocket message instead of calling functions
directly from the engine, When it does so it holds onto the id.
The engine is still returning geo/polys directly but I'm working make it
so that the UI doesn't need to know about that, so that we can switch
over the streaming ui.

Things left to do:
- it is still making both direct function calls and websockets, and the former should be removed.
- It does highlighting of segments and sourceRanges not through websockets and that needs to be fixed.
- Tests have not been adjusted for these changes.
- Selecting the head of a segment is not working correctly again yet.

* Rough engine prep changes (#135)

* rough changes for engine prep

* mouse movements working again

* connect to engine for startsketch, line, close and extrude
This commit is contained in:
Kurt Hutten
2023-06-22 16:43:33 +10:00
committed by GitHub
parent dd3117cf03
commit 2d3c73d46a
39 changed files with 1798 additions and 2443 deletions

View File

@ -1,12 +1,12 @@
import { abstractSyntaxTree } from '../abstractSyntaxTree'
import { executor } from '../executor'
import { executor } from '../../lib/testHelpers'
import { lexer } from '../tokeniser'
import { initPromise } from '../rust'
beforeAll(() => initPromise)
describe('testing angledLineThatIntersects', () => {
it('angledLineThatIntersects should intersect with another line', () => {
it('angledLineThatIntersects should intersect with another line', async () => {
const code = (offset: string) => `const part001 = startSketchAt([0, 0])
|> lineTo({to:[2, 2], tag: "yo"}, %)
|> lineTo([3, 1], %)
@ -18,9 +18,11 @@ describe('testing angledLineThatIntersects', () => {
}, %)
const intersect = segEndX('yo2', part001)
show(part001)`
const { root } = executor(abstractSyntaxTree(lexer(code('-1'))))
const { root } = await executor(abstractSyntaxTree(lexer(code('-1'))))
expect(root.intersect.value).toBe(1 + Math.sqrt(2))
const { root: noOffset } = executor(abstractSyntaxTree(lexer(code('0'))))
const { root: noOffset } = await executor(
abstractSyntaxTree(lexer(code('0')))
)
expect(noOffset.intersect.value).toBeCloseTo(1)
})
})