it works!
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
src/wasm-lib/*
|
||||
src/lib/engine-utils/engine.js
|
||||
*.typegen.ts
|
||||
packages/codemirror-lsp-client/dist/*
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import EngineUtils from './engine-utils/engine.js'
|
||||
import EngineUtils from '@engine-utils'
|
||||
|
||||
type KCEngineUtilsEvaluatePath = {
|
||||
(sketch: string, t: number): string
|
||||
@ -10,7 +10,7 @@ export async function init() {
|
||||
try {
|
||||
EngineUtils().then((module) => {
|
||||
kcEngineUtilsEvaluatePath = module.cwrap(
|
||||
'kcEngineCalcPathEndpoint',
|
||||
'kcEngineUtilsEvaluatePath',
|
||||
'string',
|
||||
['string', 'number']
|
||||
)
|
||||
@ -27,5 +27,31 @@ export async function getTruePathEndPos(sketch: string) {
|
||||
await init()
|
||||
}
|
||||
|
||||
//testing
|
||||
const obj = {
|
||||
path: [
|
||||
{
|
||||
command: 'moveTo',
|
||||
pos: { x: 0, y: 0, z: 0 },
|
||||
},
|
||||
{
|
||||
command: 'lineTo',
|
||||
pos: { x: 10, y: 10, z: 0 },
|
||||
},
|
||||
{
|
||||
command: 'bezCurveTo',
|
||||
controlPoint1: { x: 15, y: 5, z: 0 },
|
||||
controlPoint2: { x: 20, y: 15, z: 0 },
|
||||
pos: { x: 25, y: 12.5, z: 0 },
|
||||
},
|
||||
{
|
||||
command: 'tangentialArc',
|
||||
radius: 15,
|
||||
offset: -45,
|
||||
},
|
||||
],
|
||||
}
|
||||
sketch = JSON.stringify(obj)
|
||||
|
||||
return kcEngineUtilsEvaluatePath(sketch, 1.0)
|
||||
}
|
||||
|
||||
@ -58,6 +58,7 @@ const config = defineConfig({
|
||||
resolve: {
|
||||
alias: {
|
||||
'@kittycad/codemirror-lsp-client': '/packages/codemirror-lsp-client/src',
|
||||
'@engine-utils': '/src/lib/engine-utils/engine.js',
|
||||
},
|
||||
},
|
||||
plugins: [react(), viteTsconfigPaths(), eslint(), version(), lezer()],
|
||||
|
||||
Reference in New Issue
Block a user