* Revert "sketch dies on exit XY sketch (#2397)"

This reverts commit 75c6ae6e66.

* cam fix

* fmt
This commit is contained in:
Kurt Hutten
2024-05-22 11:19:13 +10:00
committed by GitHub
parent ec7b733a0d
commit 344e72d7ec
4 changed files with 39 additions and 7 deletions

View File

@ -1220,7 +1220,6 @@ test('Selections work on fresh and edited sketch', async ({ page }) => {
// wait for execution done
await u.expectCmdLog('[data-message-type="execution-done"]')
await u.updateCamPosition([0, -1378.01, 0.06])
await u.closeDebugPanel()
// select a line
@ -1497,7 +1496,6 @@ test('Can add multiple sketches', async ({ page }) => {
await u.clearCommandLogs()
await page.getByRole('button', { name: 'Start Sketch' }).click()
await page.waitForTimeout(400)
await u.updateCamPosition([583, 2000, 370])
await page.mouse.click(650, 450)
await page.waitForTimeout(500) // TODO detect animation ending, or disable animation
@ -1511,7 +1509,8 @@ test('Can add multiple sketches', async ({ page }) => {
await page.waitForTimeout(100)
await page.mouse.click(startXPx + PUR * 10, 500 - PUR * 10)
const startAt2 = '[22.65, -30.57]'
const startAt2 =
process.platform === 'darwin' ? '[9.75, -13.16]' : '[0.93, -1.25]'
await expect(
(await page.locator('.cm-content').innerText()).replace(/\s/g, '')
).toBe(
@ -1525,7 +1524,7 @@ const part002 = startSketchOn('${plane}')
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 10)
await page.waitForTimeout(100)
const num2 = 22.87
const num2 = process.platform === 'darwin' ? 9.84 : 0.94
await expect(
(await page.locator('.cm-content').innerText()).replace(/\s/g, '')
).toBe(
@ -1543,7 +1542,9 @@ const part002 = startSketchOn('${plane}')
const part002 = startSketchOn('${plane}')
|> startProfileAt(${startAt2}, %)
|> line([${num2}, 0], %)
|> line([0, ${roundOff(num2)}], %)`.replace(/\s/g, '')
|> line([0, ${roundOff(
num2 + (process.platform === 'darwin' ? 0.01 : -0.01)
)}], %)`.replace(/\s/g, '')
)
await page.waitForTimeout(100)
await page.mouse.click(startXPx, 500 - PUR * 20)
@ -1554,8 +1555,13 @@ const part002 = startSketchOn('${plane}')
const part002 = startSketchOn('${plane}')
|> startProfileAt(${startAt2}, %)
|> line([${num2}, 0], %)
|> line([0, ${roundOff(num2)}], %)
|> line([-45.52, 0], %)`.replace(/\s/g, '')
|> line([0, ${roundOff(
num2 + (process.platform === 'darwin' ? 0.01 : -0.01)
)}], %)
|> line([-${process.platform === 'darwin' ? 19.59 : 1.87}, 0], %)`.replace(
/\s/g,
''
)
)
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 45 KiB

View File

@ -890,6 +890,7 @@ export const modelingMachine = createMachine(
})
.then(async () => {
// there doesn't appear to be an animation, but if there was one we could add a wait here
await engineCommandManager.sendSceneCommand({
type: 'modeling_cmd_req',
cmd_id: uuidv4(),
@ -898,6 +899,31 @@ export const modelingMachine = createMachine(
},
})
sceneInfra.camControls.syncDirection = 'engineToClient'
await engineCommandManager.sendSceneCommand({
type: 'modeling_cmd_req',
cmd_id: uuidv4(),
cmd: {
type: 'default_camera_set_perspective',
},
})
const center = { x: 0, y: 0, z: 0 }
const camPos = sceneInfra.camControls.camera.position
if (camPos.x === 0 && camPos.y === 0) {
// looking straight up or down is going to cause issues with the engine
// tweaking the center to be a little off center
// TODO come up with a proper fix
center.y = 0.05
}
await engineCommandManager.sendSceneCommand({
type: 'modeling_cmd_req',
cmd_id: uuidv4(),
cmd: {
type: 'default_camera_look_at',
center,
vantage: sceneInfra.camControls.camera.position,
up: { x: 0, y: 0, z: 1 },
},
})
await engineCommandManager.sendSceneCommand({
// CameraControls subscribes to default_camera_get_settings response events
// firing this at connection ensure the camera's are synced initially