2023-10-11 13:36:54 +11:00
|
|
|
import { useMachine } from '@xstate/react'
|
|
|
|
import React, { createContext, useEffect, useRef } from 'react'
|
|
|
|
import {
|
|
|
|
AnyStateMachine,
|
|
|
|
ContextFrom,
|
|
|
|
InterpreterFrom,
|
|
|
|
Prop,
|
|
|
|
StateFrom,
|
|
|
|
assign,
|
|
|
|
} from 'xstate'
|
|
|
|
import { SetSelections, modelingMachine } from 'machines/modelingMachine'
|
|
|
|
import { useSetupEngineManager } from 'hooks/useSetupEngineManager'
|
2024-03-11 20:26:13 -04:00
|
|
|
import { useSettingsAuthContext } from 'hooks/useSettingsAuthContext'
|
2024-05-31 11:36:08 +10:00
|
|
|
import {
|
|
|
|
isCursorInSketchCommandRange,
|
|
|
|
updatePathToNodeFromMap,
|
|
|
|
} from 'lang/util'
|
2024-04-17 20:18:07 -07:00
|
|
|
import {
|
|
|
|
kclManager,
|
|
|
|
sceneInfra,
|
|
|
|
engineCommandManager,
|
|
|
|
codeManager,
|
2024-04-19 14:24:40 -07:00
|
|
|
editorManager,
|
2024-05-24 20:54:42 +10:00
|
|
|
sceneEntitiesManager,
|
2024-04-17 20:18:07 -07:00
|
|
|
} from 'lib/singletons'
|
2023-10-11 13:36:54 +11:00
|
|
|
import { applyConstraintHorzVertDistance } from './Toolbar/SetHorzVertDistance'
|
2023-12-01 20:18:51 +11:00
|
|
|
import {
|
|
|
|
angleBetweenInfo,
|
|
|
|
applyConstraintAngleBetween,
|
|
|
|
} from './Toolbar/SetAngleBetween'
|
2023-10-11 13:36:54 +11:00
|
|
|
import { applyConstraintAngleLength } from './Toolbar/setAngleLength'
|
2023-10-16 21:20:05 +11:00
|
|
|
import { useStore } from 'useStore'
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
import {
|
2024-03-22 10:23:04 +11:00
|
|
|
Selections,
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
canExtrudeSelection,
|
|
|
|
handleSelectionBatch,
|
|
|
|
isSelectionLastLine,
|
|
|
|
isSketchPipe,
|
2024-06-24 11:45:40 -04:00
|
|
|
updateSelections,
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
} from 'lib/selections'
|
2023-10-16 08:54:38 +11:00
|
|
|
import { applyConstraintIntersect } from './Toolbar/Intersect'
|
2023-12-01 20:18:51 +11:00
|
|
|
import { applyConstraintAbsDistance } from './Toolbar/SetAbsDistance'
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
import useStateMachineCommands from 'hooks/useStateMachineCommands'
|
|
|
|
import { modelingMachineConfig } from 'lib/commandBarConfigs/modelingCommandConfig'
|
2024-03-22 10:23:04 +11:00
|
|
|
import {
|
2024-05-24 20:54:42 +10:00
|
|
|
STRAIGHT_SEGMENT,
|
|
|
|
TANGENTIAL_ARC_TO_SEGMENT,
|
|
|
|
getParentGroup,
|
2024-03-22 10:23:04 +11:00
|
|
|
getSketchOrientationDetails,
|
|
|
|
} from 'clientSideScene/sceneEntities'
|
2024-05-24 20:54:42 +10:00
|
|
|
import {
|
|
|
|
moveValueIntoNewVariablePath,
|
|
|
|
sketchOnExtrudedFace,
|
|
|
|
startSketchOnDefault,
|
|
|
|
} from 'lang/modifyAst'
|
|
|
|
import {
|
|
|
|
Program,
|
|
|
|
VariableDeclaration,
|
|
|
|
coreDump,
|
|
|
|
parse,
|
|
|
|
recast,
|
|
|
|
} from 'lang/wasm'
|
2024-04-19 11:56:21 -04:00
|
|
|
import {
|
|
|
|
getNodeFromPath,
|
|
|
|
getNodePathFromSourceRange,
|
2024-06-21 13:20:42 +10:00
|
|
|
hasExtrudableGeometry,
|
2024-04-19 11:56:21 -04:00
|
|
|
isSingleCursorInPipe,
|
|
|
|
} from 'lang/queryAst'
|
2024-03-04 16:06:43 -05:00
|
|
|
import { TEST } from 'env'
|
|
|
|
import { exportFromEngine } from 'lib/exportFromEngine'
|
|
|
|
import { Models } from '@kittycad/lib/dist/types/src'
|
|
|
|
import toast from 'react-hot-toast'
|
2024-03-22 10:23:04 +11:00
|
|
|
import { EditorSelection } from '@uiw/react-codemirror'
|
2024-04-09 18:05:36 -07:00
|
|
|
import { CoreDumpManager } from 'lib/coredump'
|
2024-04-25 15:51:33 -04:00
|
|
|
import { useSearchParams } from 'react-router-dom'
|
2024-04-22 20:14:06 +10:00
|
|
|
import { letEngineAnimateAndSyncCamAfter } from 'clientSideScene/CameraControls'
|
2024-05-24 20:54:42 +10:00
|
|
|
import { getVarNameModal } from 'hooks/useToolbarGuards'
|
2024-05-20 20:52:33 -07:00
|
|
|
import useHotkeyWrapper from 'lib/hotkeyWrapper'
|
2024-06-18 16:08:41 +10:00
|
|
|
import { uuidv4 } from 'lib/utils'
|
2024-06-24 11:45:40 -04:00
|
|
|
import { err, trap } from 'lib/trap'
|
2023-10-11 13:36:54 +11:00
|
|
|
|
|
|
|
type MachineContext<T extends AnyStateMachine> = {
|
|
|
|
state: StateFrom<T>
|
|
|
|
context: ContextFrom<T>
|
|
|
|
send: Prop<InterpreterFrom<T>, 'send'>
|
|
|
|
}
|
|
|
|
|
|
|
|
export const ModelingMachineContext = createContext(
|
|
|
|
{} as MachineContext<typeof modelingMachine>
|
|
|
|
)
|
|
|
|
|
|
|
|
export const ModelingMachineProvider = ({
|
|
|
|
children,
|
|
|
|
}: {
|
|
|
|
children: React.ReactNode
|
|
|
|
}) => {
|
2024-03-04 16:06:43 -05:00
|
|
|
const {
|
|
|
|
auth,
|
|
|
|
settings: {
|
2024-04-02 10:29:34 -04:00
|
|
|
context: {
|
2024-04-24 13:59:25 -07:00
|
|
|
app: { theme, enableSSAO },
|
2024-04-19 00:58:32 -04:00
|
|
|
modeling: { defaultUnit, highlightEdges },
|
2024-04-02 10:29:34 -04:00
|
|
|
},
|
2024-03-04 16:06:43 -05:00
|
|
|
},
|
2024-03-11 20:26:13 -04:00
|
|
|
} = useSettingsAuthContext()
|
2023-10-11 13:36:54 +11:00
|
|
|
const token = auth?.context?.token
|
|
|
|
const streamRef = useRef<HTMLDivElement>(null)
|
2024-04-25 15:51:33 -04:00
|
|
|
|
|
|
|
let [searchParams] = useSearchParams()
|
|
|
|
const pool = searchParams.get('pool')
|
|
|
|
|
2024-04-19 00:58:32 -04:00
|
|
|
useSetupEngineManager(streamRef, token, {
|
2024-04-25 15:51:33 -04:00
|
|
|
pool: pool,
|
2024-04-19 00:58:32 -04:00
|
|
|
theme: theme.current,
|
|
|
|
highlightEdges: highlightEdges.current,
|
2024-04-24 13:59:25 -07:00
|
|
|
enableSSAO: enableSSAO.current,
|
2024-04-19 00:58:32 -04:00
|
|
|
})
|
2024-04-11 13:15:49 -07:00
|
|
|
const { htmlRef } = useStore((s) => ({
|
|
|
|
htmlRef: s.htmlRef,
|
|
|
|
}))
|
|
|
|
const coreDumpManager = new CoreDumpManager(
|
|
|
|
engineCommandManager,
|
|
|
|
htmlRef,
|
|
|
|
token
|
|
|
|
)
|
2024-06-20 16:36:28 -07:00
|
|
|
useHotkeyWrapper(['meta + shift + .'], () => {
|
|
|
|
toast.promise(
|
|
|
|
coreDump(coreDumpManager, true),
|
|
|
|
{
|
|
|
|
loading: 'Starting core dump...',
|
|
|
|
success: 'Core dump completed successfully',
|
|
|
|
error: 'Error while exporting core dump',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
success: {
|
|
|
|
// Note: this extended duration is especially important for Playwright e2e testing
|
|
|
|
// default duration is 2000 - https://react-hot-toast.com/docs/toast#default-durations
|
|
|
|
duration: 6000,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
)
|
|
|
|
})
|
2023-10-11 13:36:54 +11:00
|
|
|
|
|
|
|
// Settings machine setup
|
|
|
|
// const retrievedSettings = useRef(
|
|
|
|
// localStorage?.getItem(MODELING_PERSIST_KEY) || '{}'
|
|
|
|
// )
|
|
|
|
|
|
|
|
// What should we persist from modeling state? Nothing?
|
|
|
|
// const persistedSettings = Object.assign(
|
|
|
|
// settingsMachine.initialState.context,
|
|
|
|
// JSON.parse(retrievedSettings.current) as Partial<
|
|
|
|
// (typeof settingsMachine)['context']
|
|
|
|
// >
|
|
|
|
// )
|
|
|
|
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
const [modelingState, modelingSend, modelingActor] = useMachine(
|
|
|
|
modelingMachine,
|
|
|
|
{
|
|
|
|
actions: {
|
|
|
|
'sketch exit execute': () => {
|
2024-06-18 16:08:41 +10:00
|
|
|
;(async () => {
|
|
|
|
await sceneInfra.camControls.snapToPerspectiveBeforeHandingBackControlToEngine()
|
|
|
|
|
|
|
|
sceneInfra.camControls.syncDirection = 'engineToClient'
|
|
|
|
|
|
|
|
const settings: Models['CameraSettings_type'] = (
|
|
|
|
await engineCommandManager.sendSceneCommand({
|
|
|
|
type: 'modeling_cmd_req',
|
|
|
|
cmd_id: uuidv4(),
|
|
|
|
cmd: {
|
|
|
|
type: 'default_camera_get_settings',
|
|
|
|
},
|
|
|
|
})
|
|
|
|
)?.data?.data?.settings
|
|
|
|
if (settings.up.z !== 1) {
|
|
|
|
// workaround for gimbal lock situation
|
|
|
|
await engineCommandManager.sendSceneCommand({
|
|
|
|
type: 'modeling_cmd_req',
|
|
|
|
cmd_id: uuidv4(),
|
|
|
|
cmd: {
|
|
|
|
type: 'default_camera_look_at',
|
|
|
|
center: settings.center,
|
|
|
|
vantage: {
|
|
|
|
...settings.pos,
|
|
|
|
y:
|
|
|
|
settings.pos.y +
|
|
|
|
(settings.center.z - settings.pos.z > 0 ? 2 : -2),
|
|
|
|
},
|
|
|
|
up: { x: 0, y: 0, z: 1 },
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
kclManager.executeCode(true)
|
|
|
|
})()
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
},
|
2024-04-04 11:07:51 +11:00
|
|
|
'Set mouse state': assign({
|
|
|
|
mouseState: (_, event) => event.data,
|
2024-05-24 20:54:42 +10:00
|
|
|
segmentHoverMap: ({ mouseState, segmentHoverMap }, event) => {
|
|
|
|
if (event.data.type === 'isHovering') {
|
|
|
|
const parent = getParentGroup(event.data.on, [
|
|
|
|
STRAIGHT_SEGMENT,
|
|
|
|
TANGENTIAL_ARC_TO_SEGMENT,
|
|
|
|
])
|
|
|
|
const pathToNode = parent?.userData?.pathToNode
|
|
|
|
const pathToNodeString = JSON.stringify(pathToNode)
|
2024-05-30 21:25:20 +10:00
|
|
|
if (!parent || !pathToNode) return segmentHoverMap
|
2024-05-24 20:54:42 +10:00
|
|
|
if (segmentHoverMap[pathToNodeString] !== undefined)
|
|
|
|
clearTimeout(segmentHoverMap[JSON.stringify(pathToNode)])
|
|
|
|
return {
|
|
|
|
...segmentHoverMap,
|
|
|
|
[pathToNodeString]: 0,
|
|
|
|
}
|
|
|
|
} else if (
|
|
|
|
event.data.type === 'idle' &&
|
|
|
|
mouseState.type === 'isHovering'
|
|
|
|
) {
|
|
|
|
const mouseOnParent = getParentGroup(mouseState.on, [
|
|
|
|
STRAIGHT_SEGMENT,
|
|
|
|
TANGENTIAL_ARC_TO_SEGMENT,
|
|
|
|
])
|
|
|
|
if (!mouseOnParent || !mouseOnParent?.userData?.pathToNode)
|
|
|
|
return segmentHoverMap
|
|
|
|
const pathToNodeString = JSON.stringify(
|
|
|
|
mouseOnParent?.userData?.pathToNode
|
|
|
|
)
|
|
|
|
const timeoutId = setTimeout(() => {
|
|
|
|
sceneInfra.modelingSend({
|
|
|
|
type: 'Set mouse state',
|
|
|
|
data: {
|
|
|
|
type: 'timeoutEnd',
|
|
|
|
pathToNodeString,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}, 800) as unknown as number
|
|
|
|
return {
|
|
|
|
...segmentHoverMap,
|
|
|
|
[pathToNodeString]: timeoutId,
|
|
|
|
}
|
|
|
|
} else if (event.data.type === 'timeoutEnd') {
|
|
|
|
const copy = { ...segmentHoverMap }
|
|
|
|
delete copy[event.data.pathToNodeString]
|
|
|
|
return copy
|
|
|
|
}
|
|
|
|
return {}
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
'Set Segment Overlays': assign({
|
|
|
|
segmentOverlays: ({ segmentOverlays }, { data }) => {
|
|
|
|
if (data.type === 'set-many') return data.overlays
|
|
|
|
if (data.type === 'set-one')
|
|
|
|
return {
|
|
|
|
...segmentOverlays,
|
|
|
|
[data.pathToNodeString]: data.seg,
|
|
|
|
}
|
|
|
|
if (data.type === 'delete-one') {
|
|
|
|
const copy = { ...segmentOverlays }
|
|
|
|
delete copy[data.pathToNodeString]
|
|
|
|
return copy
|
|
|
|
}
|
|
|
|
// data.type === 'clear'
|
|
|
|
return {}
|
|
|
|
},
|
2024-04-04 11:07:51 +11:00
|
|
|
}),
|
2024-05-24 20:54:42 +10:00
|
|
|
'Set sketchDetails': assign(({ sketchDetails }, event) =>
|
|
|
|
sketchDetails
|
|
|
|
? {
|
|
|
|
sketchDetails: {
|
|
|
|
...sketchDetails,
|
|
|
|
sketchPathToNode: event.data,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
: {}
|
|
|
|
),
|
2024-05-31 11:36:08 +10:00
|
|
|
'Set selection': assign(({ selectionRanges, sketchDetails }, event) => {
|
2024-05-30 13:28:29 +10:00
|
|
|
const setSelections = event.data as SetSelections // this was needed for ts after adding 'Set selection' action to on done modal events
|
2024-03-22 10:23:04 +11:00
|
|
|
const dispatchSelection = (selection?: EditorSelection) => {
|
|
|
|
if (!selection) return // TODO less of hack for the below please
|
2024-06-22 02:21:13 -07:00
|
|
|
if (!editorManager.editorView) return
|
2024-04-19 14:24:40 -07:00
|
|
|
editorManager.lastSelectionEvent = Date.now()
|
|
|
|
setTimeout(() => {
|
|
|
|
if (editorManager.editorView) {
|
|
|
|
editorManager.editorView.dispatch({ selection })
|
|
|
|
}
|
|
|
|
})
|
2024-03-22 10:23:04 +11:00
|
|
|
}
|
|
|
|
let selections: Selections = {
|
|
|
|
codeBasedSelections: [],
|
|
|
|
otherSelections: [],
|
|
|
|
}
|
|
|
|
if (setSelections.selectionType === 'singleCodeCursor') {
|
2024-04-19 14:24:40 -07:00
|
|
|
if (!setSelections.selection && editorManager.isShiftDown) {
|
|
|
|
} else if (!setSelections.selection && !editorManager.isShiftDown) {
|
2024-03-22 10:23:04 +11:00
|
|
|
selections = {
|
|
|
|
codeBasedSelections: [],
|
|
|
|
otherSelections: [],
|
|
|
|
}
|
2024-04-19 14:24:40 -07:00
|
|
|
} else if (setSelections.selection && !editorManager.isShiftDown) {
|
2024-03-22 10:23:04 +11:00
|
|
|
selections = {
|
|
|
|
codeBasedSelections: [setSelections.selection],
|
|
|
|
otherSelections: [],
|
|
|
|
}
|
2024-04-19 14:24:40 -07:00
|
|
|
} else if (setSelections.selection && editorManager.isShiftDown) {
|
2024-03-22 10:23:04 +11:00
|
|
|
selections = {
|
|
|
|
codeBasedSelections: [
|
|
|
|
...selectionRanges.codeBasedSelections,
|
|
|
|
setSelections.selection,
|
|
|
|
],
|
|
|
|
otherSelections: selectionRanges.otherSelections,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
const {
|
2024-03-22 10:23:04 +11:00
|
|
|
engineEvents,
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
codeMirrorSelection,
|
2024-03-22 10:23:04 +11:00
|
|
|
updateSceneObjectColors,
|
|
|
|
} = handleSelectionBatch({
|
|
|
|
selections,
|
2023-10-16 21:20:05 +11:00
|
|
|
})
|
2024-03-22 10:23:04 +11:00
|
|
|
codeMirrorSelection && dispatchSelection(codeMirrorSelection)
|
|
|
|
engineEvents &&
|
|
|
|
engineEvents.forEach((event) =>
|
|
|
|
engineCommandManager.sendSceneCommand(event)
|
|
|
|
)
|
|
|
|
updateSceneObjectColors()
|
2024-04-19 14:24:40 -07:00
|
|
|
|
2024-06-28 14:40:59 +10:00
|
|
|
// side effect to stop code mirror from updating the same selections again
|
|
|
|
editorManager.lastSelection = selections.codeBasedSelections
|
|
|
|
.map(({ range }) => `${range[1]}->${range[1]}`)
|
|
|
|
.join('&')
|
|
|
|
|
2023-12-01 20:18:51 +11:00
|
|
|
return {
|
2024-03-22 10:23:04 +11:00
|
|
|
selectionRanges: selections,
|
2023-12-01 20:18:51 +11:00
|
|
|
}
|
2024-03-22 10:23:04 +11:00
|
|
|
}
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
|
2024-03-22 10:23:04 +11:00
|
|
|
if (setSelections.selectionType === 'mirrorCodeMirrorSelections') {
|
|
|
|
return {
|
|
|
|
selectionRanges: setSelections.selection,
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
}
|
2024-03-22 10:23:04 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
if (setSelections.selectionType === 'otherSelection') {
|
2024-04-19 14:24:40 -07:00
|
|
|
if (editorManager.isShiftDown) {
|
2024-03-22 10:23:04 +11:00
|
|
|
selections = {
|
|
|
|
codeBasedSelections: selectionRanges.codeBasedSelections,
|
|
|
|
otherSelections: [setSelections.selection],
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
selections = {
|
|
|
|
codeBasedSelections: [],
|
|
|
|
otherSelections: [setSelections.selection],
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
}
|
|
|
|
}
|
2024-03-22 10:23:04 +11:00
|
|
|
const { engineEvents, updateSceneObjectColors } =
|
|
|
|
handleSelectionBatch({
|
|
|
|
selections,
|
|
|
|
})
|
|
|
|
engineEvents &&
|
|
|
|
engineEvents.forEach((event) =>
|
|
|
|
engineCommandManager.sendSceneCommand(event)
|
|
|
|
)
|
|
|
|
updateSceneObjectColors()
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
return {
|
2024-03-22 10:23:04 +11:00
|
|
|
selectionRanges: selections,
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
}
|
2023-12-01 20:18:51 +11:00
|
|
|
}
|
2024-05-30 13:28:29 +10:00
|
|
|
if (setSelections.selectionType === 'completeSelection') {
|
|
|
|
editorManager.selectRange(setSelections.selection)
|
2024-05-31 11:36:08 +10:00
|
|
|
if (!sketchDetails)
|
|
|
|
return {
|
|
|
|
selectionRanges: setSelections.selection,
|
|
|
|
}
|
2024-05-30 13:28:29 +10:00
|
|
|
return {
|
|
|
|
selectionRanges: setSelections.selection,
|
2024-05-31 11:36:08 +10:00
|
|
|
sketchDetails: {
|
|
|
|
...sketchDetails,
|
|
|
|
sketchPathToNode:
|
|
|
|
setSelections.updatedPathToNode ||
|
|
|
|
sketchDetails?.sketchPathToNode ||
|
|
|
|
[],
|
|
|
|
},
|
2024-05-30 13:28:29 +10:00
|
|
|
}
|
|
|
|
}
|
2024-03-22 10:23:04 +11:00
|
|
|
|
|
|
|
return {}
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
}),
|
2024-05-29 18:04:27 -04:00
|
|
|
'Engine export': async (_, event) => {
|
2024-03-04 16:06:43 -05:00
|
|
|
if (event.type !== 'Export' || TEST) return
|
2024-05-29 18:04:27 -04:00
|
|
|
console.log('exporting', event.data)
|
2024-03-04 16:06:43 -05:00
|
|
|
const format = {
|
|
|
|
...event.data,
|
|
|
|
} as Partial<Models['OutputFormat_type']>
|
|
|
|
|
|
|
|
// Set all the un-configurable defaults here.
|
|
|
|
if (format.type === 'gltf') {
|
|
|
|
format.presentation = 'pretty'
|
|
|
|
}
|
|
|
|
|
|
|
|
if (
|
|
|
|
format.type === 'obj' ||
|
|
|
|
format.type === 'ply' ||
|
|
|
|
format.type === 'step' ||
|
|
|
|
format.type === 'stl'
|
|
|
|
) {
|
|
|
|
// Set the default coords.
|
|
|
|
// In the future we can make this configurable.
|
|
|
|
// But for now, its probably best to keep it consistent with the
|
|
|
|
// UI.
|
|
|
|
format.coords = {
|
|
|
|
forward: {
|
|
|
|
axis: 'y',
|
|
|
|
direction: 'negative',
|
|
|
|
},
|
|
|
|
up: {
|
|
|
|
axis: 'z',
|
|
|
|
direction: 'positive',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (
|
|
|
|
format.type === 'obj' ||
|
|
|
|
format.type === 'stl' ||
|
|
|
|
format.type === 'ply'
|
|
|
|
) {
|
2024-04-02 10:29:34 -04:00
|
|
|
format.units = defaultUnit.current
|
2024-03-04 16:06:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (format.type === 'ply' || format.type === 'stl') {
|
|
|
|
format.selection = { type: 'default_scene' }
|
|
|
|
}
|
|
|
|
|
2024-05-29 18:04:27 -04:00
|
|
|
toast.promise(
|
|
|
|
exportFromEngine({
|
|
|
|
format: format as Models['OutputFormat_type'],
|
|
|
|
}),
|
|
|
|
{
|
|
|
|
loading: 'Exporting...',
|
|
|
|
success: 'Exported successfully',
|
|
|
|
error: 'Error while exporting',
|
|
|
|
}
|
|
|
|
)
|
2024-03-04 16:06:43 -05:00
|
|
|
},
|
2023-10-11 13:36:54 +11:00
|
|
|
},
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
guards: {
|
|
|
|
'has valid extrude selection': ({ selectionRanges }) => {
|
|
|
|
// A user can begin extruding if they either have 1+ faces selected or nothing selected
|
|
|
|
// TODO: I believe this guard only allows for extruding a single face at a time
|
|
|
|
const isPipe = isSketchPipe(selectionRanges)
|
|
|
|
|
2024-04-24 16:34:56 -04:00
|
|
|
if (
|
|
|
|
selectionRanges.codeBasedSelections.length === 0 ||
|
|
|
|
isSelectionLastLine(selectionRanges, codeManager.code)
|
2024-06-21 13:20:42 +10:00
|
|
|
) {
|
|
|
|
// they have no selection, we should enable the button
|
|
|
|
// so they can select the face through the cmdbar
|
|
|
|
// BUT only if there's extrudable geometry
|
|
|
|
if (hasExtrudableGeometry(kclManager.ast)) return true
|
|
|
|
return false
|
|
|
|
}
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
if (!isPipe) return false
|
|
|
|
|
|
|
|
return canExtrudeSelection(selectionRanges)
|
|
|
|
},
|
2024-06-24 11:45:40 -04:00
|
|
|
'Sketch is empty': ({ sketchDetails }) => {
|
|
|
|
const node = getNodeFromPath<VariableDeclaration>(
|
2024-04-19 11:56:21 -04:00
|
|
|
kclManager.ast,
|
|
|
|
sketchDetails?.sketchPathToNode || [],
|
|
|
|
'VariableDeclaration'
|
2024-06-24 11:45:40 -04:00
|
|
|
)
|
|
|
|
// This should not be returning false, and it should be caught
|
|
|
|
// but we need to simulate old behavior to move on.
|
|
|
|
if (err(node)) return false
|
|
|
|
return node.node?.declarations?.[0]?.init.type !== 'PipeExpression'
|
|
|
|
},
|
2024-02-19 17:23:03 +11:00
|
|
|
'Selection is on face': ({ selectionRanges }, { data }) => {
|
|
|
|
if (data?.forceNewSketch) return false
|
|
|
|
if (!isSingleCursorInPipe(selectionRanges, kclManager.ast))
|
|
|
|
return false
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
return !!isCursorInSketchCommandRange(
|
|
|
|
engineCommandManager.artifactMap,
|
|
|
|
selectionRanges
|
|
|
|
)
|
|
|
|
},
|
2024-05-23 16:03:34 -07:00
|
|
|
'Has exportable geometry': () => {
|
|
|
|
if (
|
|
|
|
kclManager.kclErrors.length === 0 &&
|
|
|
|
kclManager.ast.body.length > 0
|
|
|
|
)
|
|
|
|
return true
|
|
|
|
else {
|
|
|
|
let errorMessage = 'Unable to Export '
|
|
|
|
if (kclManager.kclErrors.length > 0)
|
|
|
|
errorMessage += 'due to KCL Errors'
|
|
|
|
else if (kclManager.ast.body.length === 0)
|
|
|
|
errorMessage += 'due to Empty Scene'
|
|
|
|
console.error(errorMessage)
|
|
|
|
toast.error(errorMessage)
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
},
|
2023-10-11 13:36:54 +11:00
|
|
|
},
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
services: {
|
2024-03-22 10:23:04 +11:00
|
|
|
'AST-undo-startSketchOn': async ({ sketchDetails }) => {
|
|
|
|
if (!sketchDetails) return
|
2024-02-14 05:35:05 +11:00
|
|
|
const newAst: Program = JSON.parse(JSON.stringify(kclManager.ast))
|
2024-03-22 10:23:04 +11:00
|
|
|
const varDecIndex = sketchDetails.sketchPathToNode[1][0]
|
2024-02-14 05:35:05 +11:00
|
|
|
// remove body item at varDecIndex
|
|
|
|
newAst.body = newAst.body.filter((_, i) => i !== varDecIndex)
|
2024-04-17 20:18:07 -07:00
|
|
|
await kclManager.executeAstMock(newAst)
|
2024-02-14 08:03:20 +11:00
|
|
|
sceneInfra.setCallbacks({
|
2024-02-14 05:35:05 +11:00
|
|
|
onClick: () => {},
|
2024-02-19 12:41:36 +11:00
|
|
|
onDrag: () => {},
|
2024-02-14 05:35:05 +11:00
|
|
|
})
|
|
|
|
},
|
2024-03-22 10:23:04 +11:00
|
|
|
'animate-to-face': async (_, { data }) => {
|
|
|
|
if (data.type === 'extrudeFace') {
|
2024-06-24 11:45:40 -04:00
|
|
|
const sketched = sketchOnExtrudedFace(
|
|
|
|
kclManager.ast,
|
|
|
|
data.sketchPathToNode,
|
|
|
|
data.extrudePathToNode,
|
|
|
|
kclManager.programMemory,
|
|
|
|
data.cap
|
|
|
|
)
|
|
|
|
if (trap(sketched)) return Promise.reject(sketched)
|
|
|
|
const { modifiedAst, pathToNode: pathToNewSketchNode } = sketched
|
|
|
|
|
2024-04-17 20:18:07 -07:00
|
|
|
await kclManager.executeAstMock(modifiedAst)
|
2024-03-22 10:23:04 +11:00
|
|
|
|
2024-04-22 20:14:06 +10:00
|
|
|
await letEngineAnimateAndSyncCamAfter(
|
|
|
|
engineCommandManager,
|
|
|
|
data.faceId
|
2024-03-22 10:23:04 +11:00
|
|
|
)
|
2024-06-18 16:08:41 +10:00
|
|
|
sceneInfra.camControls.syncDirection = 'clientToEngine'
|
2024-03-22 10:23:04 +11:00
|
|
|
return {
|
|
|
|
sketchPathToNode: pathToNewSketchNode,
|
|
|
|
zAxis: data.zAxis,
|
|
|
|
yAxis: data.yAxis,
|
|
|
|
origin: data.position,
|
|
|
|
}
|
|
|
|
}
|
2024-02-11 12:59:00 +11:00
|
|
|
const { modifiedAst, pathToNode } = startSketchOnDefault(
|
|
|
|
kclManager.ast,
|
2024-03-22 10:23:04 +11:00
|
|
|
data.plane
|
2024-02-11 12:59:00 +11:00
|
|
|
)
|
|
|
|
await kclManager.updateAst(modifiedAst, false)
|
2024-04-22 20:14:06 +10:00
|
|
|
sceneInfra.camControls.syncDirection = 'clientToEngine'
|
2024-06-24 11:45:40 -04:00
|
|
|
|
2024-06-18 16:08:41 +10:00
|
|
|
await letEngineAnimateAndSyncCamAfter(
|
|
|
|
engineCommandManager,
|
|
|
|
data.planeId
|
|
|
|
)
|
2024-06-24 11:45:40 -04:00
|
|
|
|
2024-02-11 12:59:00 +11:00
|
|
|
return {
|
|
|
|
sketchPathToNode: pathToNode,
|
2024-03-22 10:23:04 +11:00
|
|
|
zAxis: data.zAxis,
|
|
|
|
yAxis: data.yAxis,
|
|
|
|
origin: [0, 0, 0],
|
2024-02-11 12:59:00 +11:00
|
|
|
}
|
|
|
|
},
|
2024-03-22 10:23:04 +11:00
|
|
|
'animate-to-sketch': async ({ selectionRanges }) => {
|
|
|
|
const sourceRange = selectionRanges.codeBasedSelections[0].range
|
|
|
|
const sketchPathToNode = getNodePathFromSourceRange(
|
|
|
|
kclManager.ast,
|
|
|
|
sourceRange
|
|
|
|
)
|
|
|
|
const info = await getSketchOrientationDetails(sketchPathToNode || [])
|
2024-04-22 20:14:06 +10:00
|
|
|
await letEngineAnimateAndSyncCamAfter(
|
|
|
|
engineCommandManager,
|
|
|
|
info?.sketchDetails?.faceId || ''
|
2024-02-11 12:59:00 +11:00
|
|
|
)
|
2024-03-22 10:23:04 +11:00
|
|
|
return {
|
|
|
|
sketchPathToNode: sketchPathToNode || [],
|
|
|
|
zAxis: info.sketchDetails.zAxis || null,
|
|
|
|
yAxis: info.sketchDetails.yAxis || null,
|
|
|
|
origin: info.sketchDetails.origin.map(
|
|
|
|
(a) => a / sceneInfra._baseUnitMultiplier
|
|
|
|
) as [number, number, number],
|
|
|
|
}
|
2024-02-11 12:59:00 +11:00
|
|
|
},
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
'Get horizontal info': async ({
|
2023-12-01 20:18:51 +11:00
|
|
|
selectionRanges,
|
2024-06-03 15:37:23 +10:00
|
|
|
sketchDetails,
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
}): Promise<SetSelections> => {
|
|
|
|
const { modifiedAst, pathToNodeMap } =
|
|
|
|
await applyConstraintHorzVertDistance({
|
|
|
|
constraint: 'setHorzDistance',
|
2023-12-01 20:18:51 +11:00
|
|
|
selectionRanges,
|
|
|
|
})
|
2024-06-03 15:37:23 +10:00
|
|
|
const _modifiedAst = parse(recast(modifiedAst))
|
2024-06-24 11:45:40 -04:00
|
|
|
if (!sketchDetails)
|
|
|
|
return Promise.reject(new Error('No sketch details'))
|
2024-06-03 15:37:23 +10:00
|
|
|
const updatedPathToNode = updatePathToNodeFromMap(
|
|
|
|
sketchDetails.sketchPathToNode,
|
|
|
|
pathToNodeMap
|
|
|
|
)
|
2024-06-24 11:45:40 -04:00
|
|
|
const updatedAst = await sceneEntitiesManager.updateAstAndRejigSketch(
|
2024-06-03 15:37:23 +10:00
|
|
|
updatedPathToNode,
|
|
|
|
_modifiedAst,
|
|
|
|
sketchDetails.zAxis,
|
|
|
|
sketchDetails.yAxis,
|
|
|
|
sketchDetails.origin
|
|
|
|
)
|
2024-06-24 11:45:40 -04:00
|
|
|
if (err(updatedAst)) return Promise.reject(updatedAst)
|
|
|
|
const selection = updateSelections(
|
|
|
|
pathToNodeMap,
|
|
|
|
selectionRanges,
|
|
|
|
updatedAst.newAst
|
|
|
|
)
|
|
|
|
if (err(selection)) return Promise.reject(selection)
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
return {
|
|
|
|
selectionType: 'completeSelection',
|
2024-06-24 11:45:40 -04:00
|
|
|
selection,
|
2024-06-03 15:37:23 +10:00
|
|
|
updatedPathToNode,
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
'Get vertical info': async ({
|
2023-10-16 08:54:38 +11:00
|
|
|
selectionRanges,
|
2024-06-03 15:37:23 +10:00
|
|
|
sketchDetails,
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
}): Promise<SetSelections> => {
|
|
|
|
const { modifiedAst, pathToNodeMap } =
|
|
|
|
await applyConstraintHorzVertDistance({
|
|
|
|
constraint: 'setVertDistance',
|
|
|
|
selectionRanges,
|
|
|
|
})
|
2024-06-03 15:37:23 +10:00
|
|
|
const _modifiedAst = parse(recast(modifiedAst))
|
2024-06-24 11:45:40 -04:00
|
|
|
if (!sketchDetails)
|
|
|
|
return Promise.reject(new Error('No sketch details'))
|
2024-06-03 15:37:23 +10:00
|
|
|
const updatedPathToNode = updatePathToNodeFromMap(
|
|
|
|
sketchDetails.sketchPathToNode,
|
|
|
|
pathToNodeMap
|
|
|
|
)
|
2024-06-24 11:45:40 -04:00
|
|
|
const updatedAst = await sceneEntitiesManager.updateAstAndRejigSketch(
|
2024-06-03 15:37:23 +10:00
|
|
|
updatedPathToNode,
|
|
|
|
_modifiedAst,
|
|
|
|
sketchDetails.zAxis,
|
|
|
|
sketchDetails.yAxis,
|
|
|
|
sketchDetails.origin
|
|
|
|
)
|
2024-06-24 11:45:40 -04:00
|
|
|
if (err(updatedAst)) return Promise.reject(updatedAst)
|
|
|
|
const selection = updateSelections(
|
|
|
|
pathToNodeMap,
|
|
|
|
selectionRanges,
|
|
|
|
updatedAst.newAst
|
|
|
|
)
|
|
|
|
if (err(selection)) return Promise.reject(selection)
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
return {
|
|
|
|
selectionType: 'completeSelection',
|
2024-06-24 11:45:40 -04:00
|
|
|
selection,
|
2024-06-03 15:37:23 +10:00
|
|
|
updatedPathToNode,
|
2023-12-01 20:18:51 +11:00
|
|
|
}
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
},
|
|
|
|
'Get angle info': async ({
|
|
|
|
selectionRanges,
|
2024-05-31 11:36:08 +10:00
|
|
|
sketchDetails,
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
}): Promise<SetSelections> => {
|
2024-06-24 11:45:40 -04:00
|
|
|
const info = angleBetweenInfo({
|
2023-12-01 20:18:51 +11:00
|
|
|
selectionRanges,
|
2024-06-24 11:45:40 -04:00
|
|
|
})
|
|
|
|
if (err(info)) return Promise.reject(info)
|
|
|
|
const { modifiedAst, pathToNodeMap } = await (info.enabled
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
? applyConstraintAngleBetween({
|
|
|
|
selectionRanges,
|
|
|
|
})
|
|
|
|
: applyConstraintAngleLength({
|
|
|
|
selectionRanges,
|
|
|
|
angleOrLength: 'setAngle',
|
|
|
|
}))
|
2024-05-31 11:36:08 +10:00
|
|
|
const _modifiedAst = parse(recast(modifiedAst))
|
2024-06-24 11:45:40 -04:00
|
|
|
if (err(_modifiedAst)) return Promise.reject(_modifiedAst)
|
|
|
|
|
|
|
|
if (!sketchDetails)
|
|
|
|
return Promise.reject(new Error('No sketch details'))
|
2024-05-31 11:36:08 +10:00
|
|
|
const updatedPathToNode = updatePathToNodeFromMap(
|
|
|
|
sketchDetails.sketchPathToNode,
|
|
|
|
pathToNodeMap
|
|
|
|
)
|
2024-06-24 11:45:40 -04:00
|
|
|
const updatedAst = await sceneEntitiesManager.updateAstAndRejigSketch(
|
2024-05-31 11:36:08 +10:00
|
|
|
updatedPathToNode,
|
|
|
|
_modifiedAst,
|
|
|
|
sketchDetails.zAxis,
|
|
|
|
sketchDetails.yAxis,
|
|
|
|
sketchDetails.origin
|
|
|
|
)
|
2024-06-24 11:45:40 -04:00
|
|
|
if (err(updatedAst)) return Promise.reject(updatedAst)
|
|
|
|
const selection = updateSelections(
|
|
|
|
pathToNodeMap,
|
|
|
|
selectionRanges,
|
|
|
|
updatedAst.newAst
|
|
|
|
)
|
|
|
|
if (err(selection)) return Promise.reject(selection)
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
return {
|
|
|
|
selectionType: 'completeSelection',
|
2024-06-24 11:45:40 -04:00
|
|
|
selection,
|
2024-05-31 11:36:08 +10:00
|
|
|
updatedPathToNode,
|
2023-12-01 20:18:51 +11:00
|
|
|
}
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
},
|
|
|
|
'Get length info': async ({
|
|
|
|
selectionRanges,
|
2024-06-03 18:30:30 +10:00
|
|
|
sketchDetails,
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
}): Promise<SetSelections> => {
|
|
|
|
const { modifiedAst, pathToNodeMap } =
|
|
|
|
await applyConstraintAngleLength({ selectionRanges })
|
2024-06-03 18:30:30 +10:00
|
|
|
const _modifiedAst = parse(recast(modifiedAst))
|
2024-06-24 11:45:40 -04:00
|
|
|
if (!sketchDetails)
|
|
|
|
return Promise.reject(new Error('No sketch details'))
|
2024-06-03 18:30:30 +10:00
|
|
|
const updatedPathToNode = updatePathToNodeFromMap(
|
|
|
|
sketchDetails.sketchPathToNode,
|
|
|
|
pathToNodeMap
|
|
|
|
)
|
2024-06-24 11:45:40 -04:00
|
|
|
const updatedAst = await sceneEntitiesManager.updateAstAndRejigSketch(
|
2024-06-03 18:30:30 +10:00
|
|
|
updatedPathToNode,
|
|
|
|
_modifiedAst,
|
|
|
|
sketchDetails.zAxis,
|
|
|
|
sketchDetails.yAxis,
|
|
|
|
sketchDetails.origin
|
|
|
|
)
|
2024-06-24 11:45:40 -04:00
|
|
|
if (err(updatedAst)) return Promise.reject(updatedAst)
|
|
|
|
const selection = updateSelections(
|
|
|
|
pathToNodeMap,
|
|
|
|
selectionRanges,
|
|
|
|
updatedAst.newAst
|
|
|
|
)
|
|
|
|
if (err(selection)) return Promise.reject(selection)
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
return {
|
|
|
|
selectionType: 'completeSelection',
|
2024-06-24 11:45:40 -04:00
|
|
|
selection,
|
2024-06-03 18:30:30 +10:00
|
|
|
updatedPathToNode,
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
'Get perpendicular distance info': async ({
|
|
|
|
selectionRanges,
|
2024-06-03 22:40:59 +10:00
|
|
|
sketchDetails,
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
}): Promise<SetSelections> => {
|
|
|
|
const { modifiedAst, pathToNodeMap } = await applyConstraintIntersect(
|
|
|
|
{
|
|
|
|
selectionRanges,
|
|
|
|
}
|
|
|
|
)
|
2024-06-03 22:40:59 +10:00
|
|
|
const _modifiedAst = parse(recast(modifiedAst))
|
2024-06-24 11:45:40 -04:00
|
|
|
if (!sketchDetails)
|
|
|
|
return Promise.reject(new Error('No sketch details'))
|
2024-06-03 22:40:59 +10:00
|
|
|
const updatedPathToNode = updatePathToNodeFromMap(
|
|
|
|
sketchDetails.sketchPathToNode,
|
|
|
|
pathToNodeMap
|
|
|
|
)
|
2024-06-24 11:45:40 -04:00
|
|
|
const updatedAst = await sceneEntitiesManager.updateAstAndRejigSketch(
|
2024-06-03 22:40:59 +10:00
|
|
|
updatedPathToNode,
|
|
|
|
_modifiedAst,
|
|
|
|
sketchDetails.zAxis,
|
|
|
|
sketchDetails.yAxis,
|
|
|
|
sketchDetails.origin
|
|
|
|
)
|
2024-06-24 11:45:40 -04:00
|
|
|
if (err(updatedAst)) return Promise.reject(updatedAst)
|
|
|
|
const selection = updateSelections(
|
|
|
|
pathToNodeMap,
|
|
|
|
selectionRanges,
|
|
|
|
updatedAst.newAst
|
|
|
|
)
|
|
|
|
if (err(selection)) return Promise.reject(selection)
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
return {
|
|
|
|
selectionType: 'completeSelection',
|
2024-06-24 11:45:40 -04:00
|
|
|
selection,
|
2024-06-03 22:40:59 +10:00
|
|
|
updatedPathToNode,
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
'Get ABS X info': async ({
|
|
|
|
selectionRanges,
|
2024-05-31 14:00:32 +10:00
|
|
|
sketchDetails,
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
}): Promise<SetSelections> => {
|
|
|
|
const { modifiedAst, pathToNodeMap } =
|
|
|
|
await applyConstraintAbsDistance({
|
|
|
|
constraint: 'xAbs',
|
|
|
|
selectionRanges,
|
|
|
|
})
|
2024-05-31 14:00:32 +10:00
|
|
|
const _modifiedAst = parse(recast(modifiedAst))
|
2024-06-24 11:45:40 -04:00
|
|
|
if (!sketchDetails)
|
|
|
|
return Promise.reject(new Error('No sketch details'))
|
2024-05-31 14:00:32 +10:00
|
|
|
const updatedPathToNode = updatePathToNodeFromMap(
|
|
|
|
sketchDetails.sketchPathToNode,
|
|
|
|
pathToNodeMap
|
|
|
|
)
|
2024-06-24 11:45:40 -04:00
|
|
|
const updatedAst = await sceneEntitiesManager.updateAstAndRejigSketch(
|
2024-05-31 14:00:32 +10:00
|
|
|
updatedPathToNode,
|
|
|
|
_modifiedAst,
|
|
|
|
sketchDetails.zAxis,
|
|
|
|
sketchDetails.yAxis,
|
|
|
|
sketchDetails.origin
|
|
|
|
)
|
2024-06-24 11:45:40 -04:00
|
|
|
if (err(updatedAst)) return Promise.reject(updatedAst)
|
|
|
|
const selection = updateSelections(
|
|
|
|
pathToNodeMap,
|
|
|
|
selectionRanges,
|
|
|
|
updatedAst.newAst
|
|
|
|
)
|
|
|
|
if (err(selection)) return Promise.reject(selection)
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
return {
|
|
|
|
selectionType: 'completeSelection',
|
2024-06-24 11:45:40 -04:00
|
|
|
selection,
|
2024-05-31 14:00:32 +10:00
|
|
|
updatedPathToNode,
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
'Get ABS Y info': async ({
|
|
|
|
selectionRanges,
|
2024-05-31 14:00:32 +10:00
|
|
|
sketchDetails,
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
}): Promise<SetSelections> => {
|
|
|
|
const { modifiedAst, pathToNodeMap } =
|
|
|
|
await applyConstraintAbsDistance({
|
|
|
|
constraint: 'yAbs',
|
|
|
|
selectionRanges,
|
|
|
|
})
|
2024-05-31 14:00:32 +10:00
|
|
|
const _modifiedAst = parse(recast(modifiedAst))
|
2024-06-24 11:45:40 -04:00
|
|
|
if (!sketchDetails)
|
|
|
|
return Promise.reject(new Error('No sketch details'))
|
2024-05-31 14:00:32 +10:00
|
|
|
const updatedPathToNode = updatePathToNodeFromMap(
|
|
|
|
sketchDetails.sketchPathToNode,
|
|
|
|
pathToNodeMap
|
|
|
|
)
|
2024-06-24 11:45:40 -04:00
|
|
|
const updatedAst = await sceneEntitiesManager.updateAstAndRejigSketch(
|
2024-05-31 14:00:32 +10:00
|
|
|
updatedPathToNode,
|
|
|
|
_modifiedAst,
|
|
|
|
sketchDetails.zAxis,
|
|
|
|
sketchDetails.yAxis,
|
|
|
|
sketchDetails.origin
|
|
|
|
)
|
2024-06-24 11:45:40 -04:00
|
|
|
if (err(updatedAst)) return Promise.reject(updatedAst)
|
|
|
|
const selection = updateSelections(
|
|
|
|
pathToNodeMap,
|
|
|
|
selectionRanges,
|
|
|
|
updatedAst.newAst
|
|
|
|
)
|
|
|
|
if (err(selection)) return Promise.reject(selection)
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
return {
|
|
|
|
selectionType: 'completeSelection',
|
2024-06-24 11:45:40 -04:00
|
|
|
selection,
|
2024-05-31 14:00:32 +10:00
|
|
|
updatedPathToNode,
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
}
|
|
|
|
},
|
2024-06-24 11:45:40 -04:00
|
|
|
'Get convert to variable info': async (
|
|
|
|
{ sketchDetails, selectionRanges },
|
|
|
|
{ data }
|
|
|
|
): Promise<SetSelections> => {
|
|
|
|
if (!sketchDetails)
|
|
|
|
return Promise.reject(new Error('No sketch details'))
|
2024-05-24 20:54:42 +10:00
|
|
|
const { variableName } = await getVarNameModal({
|
|
|
|
valueName: data.variableName || 'var',
|
|
|
|
})
|
2024-06-24 11:45:40 -04:00
|
|
|
let parsed = parse(recast(kclManager.ast))
|
|
|
|
if (trap(parsed)) return Promise.reject(parsed)
|
|
|
|
parsed = parsed as Program
|
|
|
|
|
2024-05-24 20:54:42 +10:00
|
|
|
const { modifiedAst: _modifiedAst, pathToReplacedNode } =
|
|
|
|
moveValueIntoNewVariablePath(
|
2024-06-24 11:45:40 -04:00
|
|
|
parsed,
|
2024-05-24 20:54:42 +10:00
|
|
|
kclManager.programMemory,
|
|
|
|
data.pathToNode,
|
|
|
|
variableName
|
|
|
|
)
|
2024-06-24 11:45:40 -04:00
|
|
|
parsed = parse(recast(_modifiedAst))
|
|
|
|
if (trap(parsed)) return Promise.reject(parsed)
|
|
|
|
parsed = parsed as Program
|
|
|
|
if (!pathToReplacedNode)
|
|
|
|
return Promise.reject(new Error('No path to replaced node'))
|
|
|
|
|
|
|
|
const updatedAst = await sceneEntitiesManager.updateAstAndRejigSketch(
|
2024-05-24 20:54:42 +10:00
|
|
|
pathToReplacedNode || [],
|
2024-06-24 11:45:40 -04:00
|
|
|
parsed,
|
2024-05-24 20:54:42 +10:00
|
|
|
sketchDetails.zAxis,
|
|
|
|
sketchDetails.yAxis,
|
|
|
|
sketchDetails.origin
|
|
|
|
)
|
2024-06-24 11:45:40 -04:00
|
|
|
if (err(updatedAst)) return Promise.reject(updatedAst)
|
|
|
|
const selection = updateSelections(
|
|
|
|
{ 0: pathToReplacedNode },
|
|
|
|
selectionRanges,
|
|
|
|
updatedAst.newAst
|
|
|
|
)
|
|
|
|
if (err(selection)) return Promise.reject(selection)
|
|
|
|
return {
|
|
|
|
selectionType: 'completeSelection',
|
|
|
|
selection,
|
|
|
|
updatedPathToNode: pathToReplacedNode,
|
|
|
|
}
|
2024-05-24 20:54:42 +10:00
|
|
|
},
|
2023-12-01 20:18:51 +11:00
|
|
|
},
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
devTools: true,
|
|
|
|
}
|
|
|
|
)
|
2023-10-11 13:36:54 +11:00
|
|
|
|
2023-10-18 08:03:02 +11:00
|
|
|
useEffect(() => {
|
|
|
|
kclManager.registerExecuteCallback(() => {
|
|
|
|
modelingSend({ type: 'Re-execute' })
|
|
|
|
})
|
2024-05-24 16:01:16 -04:00
|
|
|
|
|
|
|
// Before this component unmounts, call the 'Cancel'
|
|
|
|
// event to clean up any state in the modeling machine.
|
|
|
|
return () => {
|
|
|
|
modelingSend({ type: 'Cancel' })
|
|
|
|
}
|
2023-10-18 08:03:02 +11:00
|
|
|
}, [modelingSend])
|
|
|
|
|
2024-04-19 14:24:40 -07:00
|
|
|
// Give the state back to the editorManager.
|
|
|
|
useEffect(() => {
|
|
|
|
editorManager.modelingSend = modelingSend
|
|
|
|
}, [modelingSend])
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
editorManager.modelingEvent = modelingState.event
|
|
|
|
}, [modelingState.event])
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
editorManager.selectionRanges = modelingState.context.selectionRanges
|
|
|
|
}, [modelingState.context.selectionRanges])
|
|
|
|
|
2024-05-24 16:11:49 -07:00
|
|
|
useEffect(() => {
|
|
|
|
const offlineCallback = () => {
|
|
|
|
// If we are in sketch mode we need to exit it.
|
|
|
|
// TODO: how do i check if we are in a sketch mode, I only want to call
|
|
|
|
// this then.
|
|
|
|
modelingSend({ type: 'Cancel' })
|
|
|
|
}
|
|
|
|
window.addEventListener('offline', offlineCallback)
|
|
|
|
return () => {
|
|
|
|
window.removeEventListener('offline', offlineCallback)
|
|
|
|
}
|
|
|
|
}, [modelingSend])
|
|
|
|
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
useStateMachineCommands({
|
|
|
|
machineId: 'modeling',
|
|
|
|
state: modelingState,
|
|
|
|
send: modelingSend,
|
|
|
|
actor: modelingActor,
|
|
|
|
commandBarConfig: modelingMachineConfig,
|
2024-02-26 21:02:33 +11:00
|
|
|
allCommandsRequireNetwork: true,
|
2024-05-24 16:01:16 -04:00
|
|
|
// TODO for when sketch tools are in the toolbar: This was added when we used one "Cancel" event,
|
|
|
|
// but we need to support "SketchCancel" and basically
|
|
|
|
// make this function take the actor or state so it
|
|
|
|
// can call the correct event.
|
2024-02-11 12:59:00 +11:00
|
|
|
onCancel: () => modelingSend({ type: 'Cancel' }),
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
})
|
2023-10-11 13:36:54 +11:00
|
|
|
|
|
|
|
return (
|
|
|
|
<ModelingMachineContext.Provider
|
|
|
|
value={{
|
|
|
|
state: modelingState,
|
|
|
|
context: modelingState.context,
|
|
|
|
send: modelingSend,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{/* TODO #818: maybe pass reff down to children/app.ts or render app.tsx directly?
|
|
|
|
since realistically it won't ever have generic children that isn't app.tsx */}
|
|
|
|
<div className="h-screen overflow-hidden select-none" ref={streamRef}>
|
|
|
|
{children}
|
|
|
|
</div>
|
|
|
|
</ModelingMachineContext.Provider>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ModelingMachineProvider
|