add client lib @kittycad/lib (#214)

* add client lib

* tsc after build

* update after spec update

* remove uneeded check

* updates

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

* fixes

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

* fix camera drag

* fix throttle typing

* comment with link to issue

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Kurt Hutten
2023-08-02 15:41:59 +10:00
committed by GitHub
parent aabb88ee45
commit 5419039fae
12 changed files with 140 additions and 126 deletions

View File

@ -6,13 +6,17 @@ import { useState } from 'react'
import { ActionButton } from '../components/ActionButton'
import { faCheck } from '@fortawesome/free-solid-svg-icons'
type SketchModeCmd = EngineCommand['cmd']['DefaultCameraEnableSketchMode']
type SketchModeCmd = Extract<
EngineCommand['cmd'],
{ type: 'default_camera_enable_sketch_mode' }
>
export const DebugPanel = () => {
const { engineCommandManager } = useStore((s) => ({
engineCommandManager: s.engineCommandManager,
}))
const [sketchModeCmd, setSketchModeCmd] = useState<SketchModeCmd>({
type: 'default_camera_enable_sketch_mode',
origin: { x: 0, y: 0, z: 0 },
x_axis: { x: 1, y: 0, z: 0 },
y_axis: { x: 0, y: 1, z: 0 },
@ -56,10 +60,8 @@ export const DebugPanel = () => {
<ActionButton
onClick={() => {
engineCommandManager?.sendSceneCommand({
type: 'ModelingCmdReq',
cmd: {
DefaultCameraEnableSketchMode: sketchModeCmd,
},
type: 'modeling_cmd_req',
cmd: sketchModeCmd,
cmd_id: uuidv4(),
file_id: uuidv4(),
})