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'
|
2023-10-11 15:12:29 +11:00
|
|
|
import { isCursorInSketchCommandRange } from 'lang/util'
|
2024-04-17 20:18:07 -07:00
|
|
|
import {
|
|
|
|
kclManager,
|
|
|
|
sceneInfra,
|
|
|
|
engineCommandManager,
|
|
|
|
codeManager,
|
|
|
|
} 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'
|
|
|
|
import { pathMapToSelections } from 'lang/util'
|
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,
|
|
|
|
} 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 {
|
|
|
|
getSketchOrientationDetails,
|
2024-03-22 16:55:30 +11:00
|
|
|
getSketchQuaternion,
|
2024-03-22 10:23:04 +11:00
|
|
|
} from 'clientSideScene/sceneEntities'
|
|
|
|
import { sketchOnExtrudedFace, startSketchOnDefault } from 'lang/modifyAst'
|
2024-04-17 20:18:07 -07:00
|
|
|
import { Program, coreDump } from 'lang/wasm'
|
2024-03-22 10:23:04 +11:00
|
|
|
import { getNodePathFromSourceRange, 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'
|
|
|
|
import { Vector3 } from 'three'
|
|
|
|
import { quaternionFromUpNForward } from 'clientSideScene/helpers'
|
2024-04-09 18:05:36 -07:00
|
|
|
import { CoreDumpManager } from 'lib/coredump'
|
|
|
|
import { useHotkeys } from 'react-hotkeys-hook'
|
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: {
|
|
|
|
app: { theme },
|
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-19 00:58:32 -04:00
|
|
|
useSetupEngineManager(streamRef, token, {
|
|
|
|
theme: theme.current,
|
|
|
|
highlightEdges: highlightEdges.current,
|
|
|
|
})
|
2024-04-11 13:15:49 -07:00
|
|
|
const { htmlRef } = useStore((s) => ({
|
|
|
|
htmlRef: s.htmlRef,
|
|
|
|
}))
|
|
|
|
const coreDumpManager = new CoreDumpManager(
|
|
|
|
engineCommandManager,
|
|
|
|
htmlRef,
|
|
|
|
token
|
|
|
|
)
|
2024-04-09 18:05:36 -07:00
|
|
|
useHotkeys('meta + shift + .', () => coreDump(coreDumpManager, true))
|
2023-10-11 13:36:54 +11:00
|
|
|
|
2024-03-22 10:23:04 +11:00
|
|
|
const {
|
|
|
|
isShiftDown,
|
|
|
|
editorView,
|
|
|
|
setLastCodeMirrorSelectionUpdatedFromScene,
|
|
|
|
} = useStore((s) => ({
|
2023-10-11 13:36:54 +11:00
|
|
|
isShiftDown: s.isShiftDown,
|
|
|
|
editorView: s.editorView,
|
2024-03-22 10:23:04 +11:00
|
|
|
setLastCodeMirrorSelectionUpdatedFromScene:
|
|
|
|
s.setLastCodeMirrorSelectionUpdatedFromScene,
|
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-04-17 20:18:07 -07:00
|
|
|
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,
|
|
|
|
}),
|
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
|
|
|
'Set selection': assign(({ selectionRanges }, event) => {
|
|
|
|
if (event.type !== 'Set selection') return {} // this was needed for ts after adding 'Set selection' action to on done modal events
|
|
|
|
const setSelections = event.data
|
|
|
|
if (!editorView) return {}
|
2024-03-22 10:23:04 +11:00
|
|
|
const dispatchSelection = (selection?: EditorSelection) => {
|
|
|
|
if (!selection) return // TODO less of hack for the below please
|
|
|
|
setLastCodeMirrorSelectionUpdatedFromScene(Date.now())
|
|
|
|
setTimeout(() => editorView.dispatch({ selection }))
|
|
|
|
}
|
|
|
|
let selections: Selections = {
|
|
|
|
codeBasedSelections: [],
|
|
|
|
otherSelections: [],
|
|
|
|
}
|
|
|
|
if (setSelections.selectionType === 'singleCodeCursor') {
|
|
|
|
if (!setSelections.selection && isShiftDown) {
|
|
|
|
} else if (!setSelections.selection && !isShiftDown) {
|
|
|
|
selections = {
|
|
|
|
codeBasedSelections: [],
|
|
|
|
otherSelections: [],
|
|
|
|
}
|
|
|
|
} else if (setSelections.selection && !isShiftDown) {
|
|
|
|
selections = {
|
|
|
|
codeBasedSelections: [setSelections.selection],
|
|
|
|
otherSelections: [],
|
|
|
|
}
|
|
|
|
} else if (setSelections.selection && isShiftDown) {
|
|
|
|
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()
|
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') {
|
|
|
|
if (isShiftDown) {
|
|
|
|
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-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-03-04 16:06:43 -05:00
|
|
|
'Engine export': (_, event) => {
|
|
|
|
if (event.type !== 'Export' || TEST) return
|
|
|
|
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' }
|
|
|
|
}
|
|
|
|
|
|
|
|
exportFromEngine({
|
|
|
|
format: format as Models['OutputFormat_type'],
|
|
|
|
}).catch((e) => toast.error('Error while exporting', e)) // TODO I think we need to throw the error from engineCommandManager
|
|
|
|
},
|
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
|
|
|
|
if (selectionRanges.codeBasedSelections.length < 1) return false
|
|
|
|
const isPipe = isSketchPipe(selectionRanges)
|
|
|
|
|
2024-04-17 20:18:07 -07:00
|
|
|
if (isSelectionLastLine(selectionRanges, codeManager.code))
|
|
|
|
return 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
|
|
|
if (!isPipe) return false
|
|
|
|
|
|
|
|
return canExtrudeSelection(selectionRanges)
|
|
|
|
},
|
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-03-04 16:06:43 -05:00
|
|
|
'Has exportable geometry': () =>
|
|
|
|
kclManager.kclErrors.length === 0 && kclManager.ast.body.length > 0,
|
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') {
|
|
|
|
const { modifiedAst, pathToNode: pathToNewSketchNode } =
|
|
|
|
sketchOnExtrudedFace(
|
|
|
|
kclManager.ast,
|
|
|
|
data.extrudeSegmentPathToNode,
|
|
|
|
kclManager.programMemory,
|
|
|
|
data.cap
|
|
|
|
)
|
2024-04-17 20:18:07 -07:00
|
|
|
await kclManager.executeAstMock(modifiedAst)
|
2024-03-22 10:23:04 +11:00
|
|
|
|
|
|
|
const forward = new Vector3(...data.zAxis)
|
|
|
|
const up = new Vector3(...data.yAxis)
|
|
|
|
|
|
|
|
let target = new Vector3(...data.position).multiplyScalar(
|
|
|
|
sceneInfra._baseUnitMultiplier
|
|
|
|
)
|
|
|
|
const quaternion = quaternionFromUpNForward(up, forward)
|
|
|
|
await sceneInfra.camControls.tweenCameraToQuaternion(
|
|
|
|
quaternion,
|
|
|
|
target
|
|
|
|
)
|
|
|
|
|
|
|
|
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-03-22 10:23:04 +11:00
|
|
|
const quat = await getSketchQuaternion(pathToNode, data.zAxis)
|
|
|
|
await sceneInfra.camControls.tweenCameraToQuaternion(quat)
|
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 || [])
|
|
|
|
await sceneInfra.camControls.tweenCameraToQuaternion(
|
|
|
|
info.quat,
|
|
|
|
new Vector3(...info.sketchDetails.origin)
|
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,
|
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,
|
|
|
|
})
|
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
|
|
|
await kclManager.updateAst(modifiedAst, true)
|
|
|
|
return {
|
|
|
|
selectionType: 'completeSelection',
|
|
|
|
selection: pathMapToSelections(
|
|
|
|
kclManager.ast,
|
2023-12-01 20:18:51 +11:00
|
|
|
selectionRanges,
|
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
|
|
|
pathToNodeMap
|
|
|
|
),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'Get vertical info': async ({
|
2023-10-16 08:54:38 +11:00
|
|
|
selectionRanges,
|
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,
|
|
|
|
})
|
|
|
|
await kclManager.updateAst(modifiedAst, true)
|
|
|
|
return {
|
|
|
|
selectionType: 'completeSelection',
|
|
|
|
selection: pathMapToSelections(
|
|
|
|
kclManager.ast,
|
|
|
|
selectionRanges,
|
|
|
|
pathToNodeMap
|
|
|
|
),
|
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,
|
|
|
|
}): Promise<SetSelections> => {
|
|
|
|
const { modifiedAst, pathToNodeMap } = await (angleBetweenInfo({
|
2023-12-01 20:18:51 +11:00
|
|
|
selectionRanges,
|
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
|
|
|
}).enabled
|
|
|
|
? applyConstraintAngleBetween({
|
|
|
|
selectionRanges,
|
|
|
|
})
|
|
|
|
: applyConstraintAngleLength({
|
|
|
|
selectionRanges,
|
|
|
|
angleOrLength: 'setAngle',
|
|
|
|
}))
|
|
|
|
await kclManager.updateAst(modifiedAst, true)
|
|
|
|
return {
|
|
|
|
selectionType: 'completeSelection',
|
|
|
|
selection: pathMapToSelections(
|
|
|
|
kclManager.ast,
|
|
|
|
selectionRanges,
|
|
|
|
pathToNodeMap
|
|
|
|
),
|
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,
|
|
|
|
}): Promise<SetSelections> => {
|
|
|
|
const { modifiedAst, pathToNodeMap } =
|
|
|
|
await applyConstraintAngleLength({ selectionRanges })
|
|
|
|
await kclManager.updateAst(modifiedAst, true)
|
|
|
|
return {
|
|
|
|
selectionType: 'completeSelection',
|
|
|
|
selection: pathMapToSelections(
|
|
|
|
kclManager.ast,
|
|
|
|
selectionRanges,
|
|
|
|
pathToNodeMap
|
|
|
|
),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'Get perpendicular distance info': async ({
|
|
|
|
selectionRanges,
|
|
|
|
}): Promise<SetSelections> => {
|
|
|
|
const { modifiedAst, pathToNodeMap } = await applyConstraintIntersect(
|
|
|
|
{
|
|
|
|
selectionRanges,
|
|
|
|
}
|
|
|
|
)
|
|
|
|
await kclManager.updateAst(modifiedAst, true)
|
|
|
|
return {
|
|
|
|
selectionType: 'completeSelection',
|
|
|
|
selection: pathMapToSelections(
|
|
|
|
kclManager.ast,
|
|
|
|
selectionRanges,
|
|
|
|
pathToNodeMap
|
|
|
|
),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'Get ABS X info': async ({
|
|
|
|
selectionRanges,
|
|
|
|
}): Promise<SetSelections> => {
|
|
|
|
const { modifiedAst, pathToNodeMap } =
|
|
|
|
await applyConstraintAbsDistance({
|
|
|
|
constraint: 'xAbs',
|
|
|
|
selectionRanges,
|
|
|
|
})
|
|
|
|
await kclManager.updateAst(modifiedAst, true)
|
|
|
|
return {
|
|
|
|
selectionType: 'completeSelection',
|
|
|
|
selection: pathMapToSelections(
|
|
|
|
kclManager.ast,
|
|
|
|
selectionRanges,
|
|
|
|
pathToNodeMap
|
|
|
|
),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'Get ABS Y info': async ({
|
|
|
|
selectionRanges,
|
|
|
|
}): Promise<SetSelections> => {
|
|
|
|
const { modifiedAst, pathToNodeMap } =
|
|
|
|
await applyConstraintAbsDistance({
|
|
|
|
constraint: 'yAbs',
|
|
|
|
selectionRanges,
|
|
|
|
})
|
|
|
|
await kclManager.updateAst(modifiedAst, true)
|
|
|
|
return {
|
|
|
|
selectionType: 'completeSelection',
|
|
|
|
selection: pathMapToSelections(
|
|
|
|
kclManager.ast,
|
|
|
|
selectionRanges,
|
|
|
|
pathToNodeMap
|
|
|
|
),
|
|
|
|
}
|
|
|
|
},
|
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' })
|
|
|
|
})
|
|
|
|
}, [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-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
|