update types ready for new selections
This commit is contained in:
@ -77,7 +77,7 @@ import {
|
|||||||
createPipeSubstitution,
|
createPipeSubstitution,
|
||||||
findUniqueName,
|
findUniqueName,
|
||||||
} from 'lang/modifyAst'
|
} from 'lang/modifyAst'
|
||||||
import { Selections, getEventForSegmentSelection } from 'lib/selections'
|
import { Selections__old, getEventForSegmentSelection } from 'lib/selections'
|
||||||
import { createGridHelper, orthoScale, perspScale } from './helpers'
|
import { createGridHelper, orthoScale, perspScale } from './helpers'
|
||||||
import { Models } from '@kittycad/lib'
|
import { Models } from '@kittycad/lib'
|
||||||
import { uuidv4 } from 'lib/utils'
|
import { uuidv4 } from 'lib/utils'
|
||||||
@ -374,7 +374,7 @@ export class SceneEntities {
|
|||||||
forward: [number, number, number]
|
forward: [number, number, number]
|
||||||
up: [number, number, number]
|
up: [number, number, number]
|
||||||
position?: [number, number, number]
|
position?: [number, number, number]
|
||||||
selectionRanges?: Selections
|
selectionRanges?: Selections__old
|
||||||
}): Promise<{
|
}): Promise<{
|
||||||
truncatedAst: Program
|
truncatedAst: Program
|
||||||
programMemoryOverride: ProgramMemory
|
programMemoryOverride: ProgramMemory
|
||||||
|
@ -2,7 +2,7 @@ import { useCommandsContext } from 'hooks/useCommandsContext'
|
|||||||
import { CustomIcon } from '../CustomIcon'
|
import { CustomIcon } from '../CustomIcon'
|
||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
import { ActionButton } from '../ActionButton'
|
import { ActionButton } from '../ActionButton'
|
||||||
import { Selections, getSelectionTypeDisplayText } from 'lib/selections'
|
import { Selections__old, getSelectionTypeDisplayText } from 'lib/selections'
|
||||||
import { useHotkeys } from 'react-hotkeys-hook'
|
import { useHotkeys } from 'react-hotkeys-hook'
|
||||||
import { KclCommandValue, KclExpressionWithVariable } from 'lib/commandTypes'
|
import { KclCommandValue, KclExpressionWithVariable } from 'lib/commandTypes'
|
||||||
import Tooltip from 'components/Tooltip'
|
import Tooltip from 'components/Tooltip'
|
||||||
@ -125,7 +125,9 @@ function CommandBarHeader({ children }: React.PropsWithChildren<{}>) {
|
|||||||
<span data-testid="header-arg-value">
|
<span data-testid="header-arg-value">
|
||||||
{argValue ? (
|
{argValue ? (
|
||||||
arg.inputType === 'selection' ? (
|
arg.inputType === 'selection' ? (
|
||||||
getSelectionTypeDisplayText(argValue as Selections)
|
getSelectionTypeDisplayText(
|
||||||
|
argValue as Selections__old
|
||||||
|
)
|
||||||
) : arg.inputType === 'kcl' ? (
|
) : arg.inputType === 'kcl' ? (
|
||||||
roundOff(
|
roundOff(
|
||||||
Number(
|
Number(
|
||||||
|
@ -3,7 +3,7 @@ import { useCommandsContext } from 'hooks/useCommandsContext'
|
|||||||
import { useKclContext } from 'lang/KclProvider'
|
import { useKclContext } from 'lang/KclProvider'
|
||||||
import { CommandArgument } from 'lib/commandTypes'
|
import { CommandArgument } from 'lib/commandTypes'
|
||||||
import {
|
import {
|
||||||
Selection,
|
Selection__old,
|
||||||
canSubmitSelectionArg,
|
canSubmitSelectionArg,
|
||||||
getSelectionType,
|
getSelectionType,
|
||||||
getSelectionTypeDisplayText,
|
getSelectionTypeDisplayText,
|
||||||
@ -12,13 +12,15 @@ import { modelingMachine } from 'machines/modelingMachine'
|
|||||||
import { useEffect, useMemo, useRef, useState } from 'react'
|
import { useEffect, useMemo, useRef, useState } from 'react'
|
||||||
import { StateFrom } from 'xstate'
|
import { StateFrom } from 'xstate'
|
||||||
|
|
||||||
const semanticEntityNames: { [key: string]: Array<Selection['type']> } = {
|
const semanticEntityNames: { [key: string]: Array<Selection__old['type']> } = {
|
||||||
face: ['extrude-wall', 'start-cap', 'end-cap'],
|
face: ['extrude-wall', 'start-cap', 'end-cap'],
|
||||||
edge: ['edge', 'line', 'arc'],
|
edge: ['edge', 'line', 'arc'],
|
||||||
point: ['point', 'line-end', 'line-mid'],
|
point: ['point', 'line-end', 'line-mid'],
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSemanticSelectionType(selectionType: Array<Selection['type']>) {
|
function getSemanticSelectionType(
|
||||||
|
selectionType: Array<Selection__old['type']>
|
||||||
|
) {
|
||||||
const semanticSelectionType = new Set()
|
const semanticSelectionType = new Set()
|
||||||
selectionType.forEach((type) => {
|
selectionType.forEach((type) => {
|
||||||
Object.entries(semanticEntityNames).forEach(([entity, entityTypes]) => {
|
Object.entries(semanticEntityNames).forEach(([entity, entityTypes]) => {
|
||||||
|
@ -21,6 +21,7 @@ export const EngineCommands = () => {
|
|||||||
const [engineCommands, clearEngineCommands] = useEngineCommands()
|
const [engineCommands, clearEngineCommands] = useEngineCommands()
|
||||||
const [containsFilter, setContainsFilter] = useState('')
|
const [containsFilter, setContainsFilter] = useState('')
|
||||||
const [customCmd, setCustomCmd] = useState('')
|
const [customCmd, setCustomCmd] = useState('')
|
||||||
|
console.log(JSON.stringify(engineCommands, null, 2))
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<input
|
<input
|
||||||
@ -64,7 +65,10 @@ export const EngineCommands = () => {
|
|||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
<button data-testid="clear-commands" onClick={clearEngineCommands}>
|
<button
|
||||||
|
data-testid="clear-commands"
|
||||||
|
onClick={() => clearEngineCommands()}
|
||||||
|
>
|
||||||
Clear
|
Clear
|
||||||
</button>
|
</button>
|
||||||
<br />
|
<br />
|
||||||
|
@ -37,7 +37,7 @@ import {
|
|||||||
} from './Toolbar/SetAngleBetween'
|
} from './Toolbar/SetAngleBetween'
|
||||||
import { applyConstraintAngleLength } from './Toolbar/setAngleLength'
|
import { applyConstraintAngleLength } from './Toolbar/setAngleLength'
|
||||||
import {
|
import {
|
||||||
Selections,
|
Selections__old,
|
||||||
canSweepSelection,
|
canSweepSelection,
|
||||||
handleSelectionBatch,
|
handleSelectionBatch,
|
||||||
isSelectionLastLine,
|
isSelectionLastLine,
|
||||||
@ -275,7 +275,7 @@ export const ModelingMachineProvider = ({
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
let selections: Selections = {
|
let selections: Selections__old = {
|
||||||
codeBasedSelections: [],
|
codeBasedSelections: [],
|
||||||
otherSelections: [],
|
otherSelections: [],
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { toolTips } from 'lang/langHelpers'
|
import { toolTips } from 'lang/langHelpers'
|
||||||
import { Selections } from 'lib/selections'
|
import { Selections__old } from 'lib/selections'
|
||||||
import { Program, Expr, VariableDeclarator } from '../../lang/wasm'
|
import { Program, Expr, VariableDeclarator } from '../../lang/wasm'
|
||||||
import {
|
import {
|
||||||
getNodePathFromSourceRange,
|
getNodePathFromSourceRange,
|
||||||
@ -18,7 +18,7 @@ import { TransformInfo } from 'lang/std/stdTypes'
|
|||||||
export function equalAngleInfo({
|
export function equalAngleInfo({
|
||||||
selectionRanges,
|
selectionRanges,
|
||||||
}: {
|
}: {
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections__old
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
transforms: TransformInfo[]
|
transforms: TransformInfo[]
|
||||||
@ -82,7 +82,7 @@ export function equalAngleInfo({
|
|||||||
export function applyConstraintEqualAngle({
|
export function applyConstraintEqualAngle({
|
||||||
selectionRanges,
|
selectionRanges,
|
||||||
}: {
|
}: {
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections__old
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
modifiedAst: Program
|
modifiedAst: Program
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { toolTips } from 'lang/langHelpers'
|
import { toolTips } from 'lang/langHelpers'
|
||||||
import { Selections } from 'lib/selections'
|
import { Selections__old } from 'lib/selections'
|
||||||
import { Program, Expr, VariableDeclarator } from '../../lang/wasm'
|
import { Program, Expr, VariableDeclarator } from '../../lang/wasm'
|
||||||
import {
|
import {
|
||||||
getNodePathFromSourceRange,
|
getNodePathFromSourceRange,
|
||||||
@ -18,7 +18,7 @@ import { err } from 'lib/trap'
|
|||||||
export function setEqualLengthInfo({
|
export function setEqualLengthInfo({
|
||||||
selectionRanges,
|
selectionRanges,
|
||||||
}: {
|
}: {
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections__old
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
transforms: TransformInfo[]
|
transforms: TransformInfo[]
|
||||||
@ -83,7 +83,7 @@ export function setEqualLengthInfo({
|
|||||||
export function applyConstraintEqualLength({
|
export function applyConstraintEqualLength({
|
||||||
selectionRanges,
|
selectionRanges,
|
||||||
}: {
|
}: {
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections__old
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
modifiedAst: Program
|
modifiedAst: Program
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { toolTips } from 'lang/langHelpers'
|
import { toolTips } from 'lang/langHelpers'
|
||||||
import { Selections } from 'lib/selections'
|
import { Selections__old } from 'lib/selections'
|
||||||
import { Program, ProgramMemory, Expr } from '../../lang/wasm'
|
import { Program, ProgramMemory, Expr } from '../../lang/wasm'
|
||||||
import {
|
import {
|
||||||
getNodePathFromSourceRange,
|
getNodePathFromSourceRange,
|
||||||
@ -15,7 +15,7 @@ import { kclManager } from 'lib/singletons'
|
|||||||
import { err } from 'lib/trap'
|
import { err } from 'lib/trap'
|
||||||
|
|
||||||
export function horzVertInfo(
|
export function horzVertInfo(
|
||||||
selectionRanges: Selections,
|
selectionRanges: Selections__old,
|
||||||
horOrVert: 'vertical' | 'horizontal'
|
horOrVert: 'vertical' | 'horizontal'
|
||||||
):
|
):
|
||||||
| {
|
| {
|
||||||
@ -53,7 +53,7 @@ export function horzVertInfo(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function applyConstraintHorzVert(
|
export function applyConstraintHorzVert(
|
||||||
selectionRanges: Selections,
|
selectionRanges: Selections__old,
|
||||||
horOrVert: 'vertical' | 'horizontal',
|
horOrVert: 'vertical' | 'horizontal',
|
||||||
ast: Program,
|
ast: Program,
|
||||||
programMemory: ProgramMemory
|
programMemory: ProgramMemory
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { toolTips } from 'lang/langHelpers'
|
import { toolTips } from 'lang/langHelpers'
|
||||||
import { Selections } from 'lib/selections'
|
|
||||||
import { Program, Expr, VariableDeclarator } from '../../lang/wasm'
|
import { Program, Expr, VariableDeclarator } from '../../lang/wasm'
|
||||||
|
import { Selections__old } from 'lib/selections'
|
||||||
import {
|
import {
|
||||||
getNodePathFromSourceRange,
|
getNodePathFromSourceRange,
|
||||||
getNodeFromPath,
|
getNodeFromPath,
|
||||||
@ -25,12 +25,12 @@ const getModalInfo = createInfoModal(GetInfoModal)
|
|||||||
export function intersectInfo({
|
export function intersectInfo({
|
||||||
selectionRanges,
|
selectionRanges,
|
||||||
}: {
|
}: {
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections__old
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
transforms: TransformInfo[]
|
transforms: TransformInfo[]
|
||||||
enabled: boolean
|
enabled: boolean
|
||||||
forcedSelectionRanges: Selections
|
forcedSelectionRanges: Selections__old
|
||||||
}
|
}
|
||||||
| Error {
|
| Error {
|
||||||
if (selectionRanges.codeBasedSelections.length < 2) {
|
if (selectionRanges.codeBasedSelections.length < 2) {
|
||||||
@ -134,7 +134,7 @@ export function intersectInfo({
|
|||||||
export async function applyConstraintIntersect({
|
export async function applyConstraintIntersect({
|
||||||
selectionRanges,
|
selectionRanges,
|
||||||
}: {
|
}: {
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections__old
|
||||||
}): Promise<{
|
}): Promise<{
|
||||||
modifiedAst: Program
|
modifiedAst: Program
|
||||||
pathToNodeMap: PathToNodeMap
|
pathToNodeMap: PathToNodeMap
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { toolTips } from 'lang/langHelpers'
|
import { toolTips } from 'lang/langHelpers'
|
||||||
import { Selection, Selections } from 'lib/selections'
|
import { Selection__old, Selections__old } from 'lib/selections'
|
||||||
import { PathToNode, Program, Expr } from '../../lang/wasm'
|
import { PathToNode, Program, Expr } from '../../lang/wasm'
|
||||||
import {
|
import {
|
||||||
getNodePathFromSourceRange,
|
getNodePathFromSourceRange,
|
||||||
@ -18,13 +18,13 @@ export function removeConstrainingValuesInfo({
|
|||||||
selectionRanges,
|
selectionRanges,
|
||||||
pathToNodes,
|
pathToNodes,
|
||||||
}: {
|
}: {
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections__old
|
||||||
pathToNodes?: Array<PathToNode>
|
pathToNodes?: Array<PathToNode>
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
transforms: TransformInfo[]
|
transforms: TransformInfo[]
|
||||||
enabled: boolean
|
enabled: boolean
|
||||||
updatedSelectionRanges: Selections
|
updatedSelectionRanges: Selections__old
|
||||||
}
|
}
|
||||||
| Error {
|
| Error {
|
||||||
const paths =
|
const paths =
|
||||||
@ -45,7 +45,7 @@ export function removeConstrainingValuesInfo({
|
|||||||
? {
|
? {
|
||||||
otherSelections: [],
|
otherSelections: [],
|
||||||
codeBasedSelections: nodes.map(
|
codeBasedSelections: nodes.map(
|
||||||
(node): Selection => ({
|
(node): Selection__old => ({
|
||||||
range: [node.start, node.end],
|
range: [node.start, node.end],
|
||||||
type: 'default',
|
type: 'default',
|
||||||
})
|
})
|
||||||
@ -73,7 +73,7 @@ export function applyRemoveConstrainingValues({
|
|||||||
selectionRanges,
|
selectionRanges,
|
||||||
pathToNodes,
|
pathToNodes,
|
||||||
}: {
|
}: {
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections__old
|
||||||
pathToNodes?: Array<PathToNode>
|
pathToNodes?: Array<PathToNode>
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { toolTips } from 'lang/langHelpers'
|
import { toolTips } from 'lang/langHelpers'
|
||||||
import { Selections } from 'lib/selections'
|
|
||||||
import { Program, Expr } from '../../lang/wasm'
|
import { Program, Expr } from '../../lang/wasm'
|
||||||
|
import { Selections__old } from 'lib/selections'
|
||||||
import {
|
import {
|
||||||
getNodePathFromSourceRange,
|
getNodePathFromSourceRange,
|
||||||
getNodeFromPath,
|
getNodeFromPath,
|
||||||
@ -32,7 +32,7 @@ export function absDistanceInfo({
|
|||||||
selectionRanges,
|
selectionRanges,
|
||||||
constraint,
|
constraint,
|
||||||
}: {
|
}: {
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections__old
|
||||||
constraint: Constraint
|
constraint: Constraint
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
@ -93,7 +93,7 @@ export async function applyConstraintAbsDistance({
|
|||||||
selectionRanges,
|
selectionRanges,
|
||||||
constraint,
|
constraint,
|
||||||
}: {
|
}: {
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections__old
|
||||||
constraint: 'xAbs' | 'yAbs'
|
constraint: 'xAbs' | 'yAbs'
|
||||||
}): Promise<{
|
}): Promise<{
|
||||||
modifiedAst: Program
|
modifiedAst: Program
|
||||||
@ -157,7 +157,7 @@ export function applyConstraintAxisAlign({
|
|||||||
selectionRanges,
|
selectionRanges,
|
||||||
constraint,
|
constraint,
|
||||||
}: {
|
}: {
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections__old
|
||||||
constraint: 'snapToYAxis' | 'snapToXAxis'
|
constraint: 'snapToYAxis' | 'snapToXAxis'
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { toolTips } from 'lang/langHelpers'
|
import { toolTips } from 'lang/langHelpers'
|
||||||
import { Selections } from 'lib/selections'
|
|
||||||
import { Program, Expr, VariableDeclarator } from '../../lang/wasm'
|
import { Program, Expr, VariableDeclarator } from '../../lang/wasm'
|
||||||
|
import { Selections__old } from 'lib/selections'
|
||||||
import {
|
import {
|
||||||
getNodePathFromSourceRange,
|
getNodePathFromSourceRange,
|
||||||
getNodeFromPath,
|
getNodeFromPath,
|
||||||
@ -24,7 +24,7 @@ const getModalInfo = createInfoModal(GetInfoModal)
|
|||||||
export function angleBetweenInfo({
|
export function angleBetweenInfo({
|
||||||
selectionRanges,
|
selectionRanges,
|
||||||
}: {
|
}: {
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections__old
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
transforms: TransformInfo[]
|
transforms: TransformInfo[]
|
||||||
@ -90,7 +90,7 @@ export async function applyConstraintAngleBetween({
|
|||||||
selectionRanges,
|
selectionRanges,
|
||||||
}: // constraint,
|
}: // constraint,
|
||||||
{
|
{
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections__old
|
||||||
// constraint: 'setHorzDistance' | 'setVertDistance'
|
// constraint: 'setHorzDistance' | 'setVertDistance'
|
||||||
}): Promise<{
|
}): Promise<{
|
||||||
modifiedAst: Program
|
modifiedAst: Program
|
||||||
|
@ -16,7 +16,7 @@ import { GetInfoModal, createInfoModal } from '../SetHorVertDistanceModal'
|
|||||||
import { createLiteral, createVariableDeclaration } from '../../lang/modifyAst'
|
import { createLiteral, createVariableDeclaration } from '../../lang/modifyAst'
|
||||||
import { removeDoubleNegatives } from '../AvailableVarsHelpers'
|
import { removeDoubleNegatives } from '../AvailableVarsHelpers'
|
||||||
import { kclManager } from 'lib/singletons'
|
import { kclManager } from 'lib/singletons'
|
||||||
import { Selections } from 'lib/selections'
|
import { Selections__old } from 'lib/selections'
|
||||||
import { cleanErrs, err } from 'lib/trap'
|
import { cleanErrs, err } from 'lib/trap'
|
||||||
|
|
||||||
const getModalInfo = createInfoModal(GetInfoModal)
|
const getModalInfo = createInfoModal(GetInfoModal)
|
||||||
@ -25,7 +25,7 @@ export function horzVertDistanceInfo({
|
|||||||
selectionRanges,
|
selectionRanges,
|
||||||
constraint,
|
constraint,
|
||||||
}: {
|
}: {
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections__old
|
||||||
constraint: 'setHorzDistance' | 'setVertDistance'
|
constraint: 'setHorzDistance' | 'setVertDistance'
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
@ -95,7 +95,7 @@ export async function applyConstraintHorzVertDistance({
|
|||||||
// TODO align will always be false (covered by synconous applyConstraintHorzVertAlign), remove it
|
// TODO align will always be false (covered by synconous applyConstraintHorzVertAlign), remove it
|
||||||
isAlign = false,
|
isAlign = false,
|
||||||
}: {
|
}: {
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections__old
|
||||||
constraint: 'setHorzDistance' | 'setVertDistance'
|
constraint: 'setHorzDistance' | 'setVertDistance'
|
||||||
isAlign?: false
|
isAlign?: false
|
||||||
}): Promise<{
|
}): Promise<{
|
||||||
@ -181,7 +181,7 @@ export function applyConstraintHorzVertAlign({
|
|||||||
selectionRanges,
|
selectionRanges,
|
||||||
constraint,
|
constraint,
|
||||||
}: {
|
}: {
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections__old
|
||||||
constraint: 'setHorzDistance' | 'setVertDistance'
|
constraint: 'setHorzDistance' | 'setVertDistance'
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { toolTips } from 'lang/langHelpers'
|
import { toolTips } from 'lang/langHelpers'
|
||||||
import { Selections } from 'lib/selections'
|
|
||||||
import { Program, Expr } from '../../lang/wasm'
|
import { Program, Expr } from '../../lang/wasm'
|
||||||
|
import { Selections__old } from 'lib/selections'
|
||||||
import {
|
import {
|
||||||
getNodePathFromSourceRange,
|
getNodePathFromSourceRange,
|
||||||
getNodeFromPath,
|
getNodeFromPath,
|
||||||
@ -32,7 +32,7 @@ export function angleLengthInfo({
|
|||||||
selectionRanges,
|
selectionRanges,
|
||||||
angleOrLength = 'setLength',
|
angleOrLength = 'setLength',
|
||||||
}: {
|
}: {
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections__old
|
||||||
angleOrLength?: 'setLength' | 'setAngle'
|
angleOrLength?: 'setLength' | 'setAngle'
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
@ -74,7 +74,7 @@ export async function applyConstraintAngleLength({
|
|||||||
selectionRanges,
|
selectionRanges,
|
||||||
angleOrLength = 'setLength',
|
angleOrLength = 'setLength',
|
||||||
}: {
|
}: {
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections__old
|
||||||
angleOrLength?: 'setLength' | 'setAngle'
|
angleOrLength?: 'setLength' | 'setAngle'
|
||||||
}): Promise<{
|
}): Promise<{
|
||||||
modifiedAst: Program
|
modifiedAst: Program
|
||||||
|
@ -2,7 +2,11 @@ import { EditorView, ViewUpdate } from '@codemirror/view'
|
|||||||
import { EditorSelection, Annotation, Transaction } from '@codemirror/state'
|
import { EditorSelection, Annotation, Transaction } from '@codemirror/state'
|
||||||
import { engineCommandManager } from 'lib/singletons'
|
import { engineCommandManager } from 'lib/singletons'
|
||||||
import { modelingMachine, ModelingMachineEvent } from 'machines/modelingMachine'
|
import { modelingMachine, ModelingMachineEvent } from 'machines/modelingMachine'
|
||||||
import { Selections, processCodeMirrorRanges, Selection } from 'lib/selections'
|
import {
|
||||||
|
Selections__old,
|
||||||
|
Selection__old,
|
||||||
|
processCodeMirrorRanges,
|
||||||
|
} from 'lib/selections'
|
||||||
import { undo, redo } from '@codemirror/commands'
|
import { undo, redo } from '@codemirror/commands'
|
||||||
import { CommandBarMachineEvent } from 'machines/commandBarMachine'
|
import { CommandBarMachineEvent } from 'machines/commandBarMachine'
|
||||||
import { addLineHighlight, addLineHighlightEvent } from './highlightextension'
|
import { addLineHighlight, addLineHighlightEvent } from './highlightextension'
|
||||||
@ -31,7 +35,7 @@ export default class EditorManager {
|
|||||||
private _copilotEnabled: boolean = true
|
private _copilotEnabled: boolean = true
|
||||||
|
|
||||||
private _isShiftDown: boolean = false
|
private _isShiftDown: boolean = false
|
||||||
private _selectionRanges: Selections = {
|
private _selectionRanges: Selections__old = {
|
||||||
otherSelections: [],
|
otherSelections: [],
|
||||||
codeBasedSelections: [],
|
codeBasedSelections: [],
|
||||||
}
|
}
|
||||||
@ -73,7 +77,7 @@ export default class EditorManager {
|
|||||||
this._isShiftDown = isShiftDown
|
this._isShiftDown = isShiftDown
|
||||||
}
|
}
|
||||||
|
|
||||||
set selectionRanges(selectionRanges: Selections) {
|
set selectionRanges(selectionRanges: Selections__old) {
|
||||||
this._selectionRanges = selectionRanges
|
this._selectionRanges = selectionRanges
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +101,7 @@ export default class EditorManager {
|
|||||||
return this._highlightRange
|
return this._highlightRange
|
||||||
}
|
}
|
||||||
|
|
||||||
setHighlightRange(selections: Array<Selection['range']>): void {
|
setHighlightRange(selections: Array<Selection__old['range']>): void {
|
||||||
this._highlightRange = selections
|
this._highlightRange = selections
|
||||||
|
|
||||||
const selectionsWithSafeEnds = selections.map((s): [number, number] => {
|
const selectionsWithSafeEnds = selections.map((s): [number, number] => {
|
||||||
@ -203,7 +207,7 @@ export default class EditorManager {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
selectRange(selections: Selections) {
|
selectRange(selections: Selections__old) {
|
||||||
if (selections.codeBasedSelections.length === 0) {
|
if (selections.codeBasedSelections.length === 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { executeAst, lintAst } from 'lang/langHelpers'
|
import { executeAst, lintAst } from 'lang/langHelpers'
|
||||||
import { Selections } from 'lib/selections'
|
import { Selections__old } from 'lib/selections'
|
||||||
import { KCLError, kclErrorsToDiagnostics } from './errors'
|
import { KCLError, kclErrorsToDiagnostics } from './errors'
|
||||||
import { uuidv4 } from 'lib/utils'
|
import { uuidv4 } from 'lib/utils'
|
||||||
import { EngineCommandManager } from './std/engineConnection'
|
import { EngineCommandManager } from './std/engineConnection'
|
||||||
@ -425,14 +425,14 @@ export class KclManager {
|
|||||||
}
|
}
|
||||||
): Promise<{
|
): Promise<{
|
||||||
newAst: Program
|
newAst: Program
|
||||||
selections?: Selections
|
selections?: Selections__old
|
||||||
}> {
|
}> {
|
||||||
const newCode = recast(ast)
|
const newCode = recast(ast)
|
||||||
if (err(newCode)) return Promise.reject(newCode)
|
if (err(newCode)) return Promise.reject(newCode)
|
||||||
|
|
||||||
const astWithUpdatedSource = this.safeParse(newCode)
|
const astWithUpdatedSource = this.safeParse(newCode)
|
||||||
if (!astWithUpdatedSource) return Promise.reject(new Error('bad ast'))
|
if (!astWithUpdatedSource) return Promise.reject(new Error('bad ast'))
|
||||||
let returnVal: Selections | undefined = undefined
|
let returnVal: Selections__old | undefined = undefined
|
||||||
|
|
||||||
if (optionalParams?.focusPath) {
|
if (optionalParams?.focusPath) {
|
||||||
returnVal = {
|
returnVal = {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Selection } from 'lib/selections'
|
|
||||||
import { err, reportRejection, trap } from 'lib/trap'
|
import { err, reportRejection, trap } from 'lib/trap'
|
||||||
|
import { Selection__old } from 'lib/selections'
|
||||||
import {
|
import {
|
||||||
Program,
|
Program,
|
||||||
CallExpression,
|
CallExpression,
|
||||||
@ -762,7 +762,7 @@ export function createBinaryExpressionWithUnary([left, right]: [
|
|||||||
|
|
||||||
export function giveSketchFnCallTag(
|
export function giveSketchFnCallTag(
|
||||||
ast: Program,
|
ast: Program,
|
||||||
range: Selection['range'],
|
range: Selection__old['range'],
|
||||||
tag?: string
|
tag?: string
|
||||||
):
|
):
|
||||||
| {
|
| {
|
||||||
@ -836,7 +836,7 @@ export function moveValueIntoNewVariablePath(
|
|||||||
export function moveValueIntoNewVariable(
|
export function moveValueIntoNewVariable(
|
||||||
ast: Program,
|
ast: Program,
|
||||||
programMemory: ProgramMemory,
|
programMemory: ProgramMemory,
|
||||||
sourceRange: Selection['range'],
|
sourceRange: Selection__old['range'],
|
||||||
variableName: string
|
variableName: string
|
||||||
): {
|
): {
|
||||||
modifiedAst: Program
|
modifiedAst: Program
|
||||||
@ -955,7 +955,7 @@ export function removeSingleConstraintInfo(
|
|||||||
|
|
||||||
export async function deleteFromSelection(
|
export async function deleteFromSelection(
|
||||||
ast: Program,
|
ast: Program,
|
||||||
selection: Selection,
|
selection: Selection__old,
|
||||||
programMemory: ProgramMemory,
|
programMemory: ProgramMemory,
|
||||||
getFaceDetails: (id: string) => Promise<Models['FaceIsPlanar_type']> = () =>
|
getFaceDetails: (id: string) => Promise<Models['FaceIsPlanar_type']> = () =>
|
||||||
({} as any)
|
({} as any)
|
||||||
|
@ -19,7 +19,7 @@ import {
|
|||||||
import { getNodeFromPath, getNodePathFromSourceRange } from '../queryAst'
|
import { getNodeFromPath, getNodePathFromSourceRange } from '../queryAst'
|
||||||
import { createLiteral } from 'lang/modifyAst'
|
import { createLiteral } from 'lang/modifyAst'
|
||||||
import { err } from 'lib/trap'
|
import { err } from 'lib/trap'
|
||||||
import { Selections } from 'lib/selections'
|
import { Selections__old } from 'lib/selections'
|
||||||
import { engineCommandManager, kclManager } from 'lib/singletons'
|
import { engineCommandManager, kclManager } from 'lib/singletons'
|
||||||
import { VITE_KC_DEV_TOKEN } from 'env'
|
import { VITE_KC_DEV_TOKEN } from 'env'
|
||||||
import { KclCommandValue } from 'lib/commandTypes'
|
import { KclCommandValue } from 'lib/commandTypes'
|
||||||
@ -106,7 +106,7 @@ const runGetPathToExtrudeForSegmentSelectionTest = async (
|
|||||||
code.indexOf(selectedSegmentSnippet),
|
code.indexOf(selectedSegmentSnippet),
|
||||||
code.indexOf(selectedSegmentSnippet) + selectedSegmentSnippet.length,
|
code.indexOf(selectedSegmentSnippet) + selectedSegmentSnippet.length,
|
||||||
]
|
]
|
||||||
const selection: Selections = {
|
const selection: Selections__old = {
|
||||||
codeBasedSelections: [
|
codeBasedSelections: [
|
||||||
{
|
{
|
||||||
range: segmentRange,
|
range: segmentRange,
|
||||||
@ -469,7 +469,7 @@ const runModifyAstWithFilletAndTagTest = async (
|
|||||||
code.indexOf(selectionSnippet) + selectionSnippet.length,
|
code.indexOf(selectionSnippet) + selectionSnippet.length,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
const selection: Selections = {
|
const selection: Selections__old = {
|
||||||
codeBasedSelections: segmentRanges.map((segmentRange) => ({
|
codeBasedSelections: segmentRanges.map((segmentRange) => ({
|
||||||
range: segmentRange,
|
range: segmentRange,
|
||||||
type: 'default',
|
type: 'default',
|
||||||
@ -730,7 +730,7 @@ describe('Testing button states', () => {
|
|||||||
]
|
]
|
||||||
: [ast.end, ast.end] // empty line in the end of the code
|
: [ast.end, ast.end] // empty line in the end of the code
|
||||||
|
|
||||||
const selectionRanges: Selections = {
|
const selectionRanges: Selections__old = {
|
||||||
codeBasedSelections: [
|
codeBasedSelections: [
|
||||||
{
|
{
|
||||||
range,
|
range,
|
||||||
|
@ -31,7 +31,7 @@ import {
|
|||||||
sketchLineHelperMap,
|
sketchLineHelperMap,
|
||||||
} from '../std/sketch'
|
} from '../std/sketch'
|
||||||
import { err, trap } from 'lib/trap'
|
import { err, trap } from 'lib/trap'
|
||||||
import { Selections, canFilletSelection } from 'lib/selections'
|
import { Selections__old, canFilletSelection } from 'lib/selections'
|
||||||
import { KclCommandValue } from 'lib/commandTypes'
|
import { KclCommandValue } from 'lib/commandTypes'
|
||||||
import {
|
import {
|
||||||
ArtifactGraph,
|
ArtifactGraph,
|
||||||
@ -45,7 +45,7 @@ import { kclManager, engineCommandManager, editorManager } from 'lib/singletons'
|
|||||||
|
|
||||||
export function applyFilletToSelection(
|
export function applyFilletToSelection(
|
||||||
ast: Program,
|
ast: Program,
|
||||||
selection: Selections,
|
selection: Selections__old,
|
||||||
radius: KclCommandValue
|
radius: KclCommandValue
|
||||||
): void | Error {
|
): void | Error {
|
||||||
// 1. clone ast
|
// 1. clone ast
|
||||||
@ -63,7 +63,7 @@ export function applyFilletToSelection(
|
|||||||
|
|
||||||
export function modifyAstWithFilletAndTag(
|
export function modifyAstWithFilletAndTag(
|
||||||
ast: Program,
|
ast: Program,
|
||||||
selection: Selections,
|
selection: Selections__old,
|
||||||
radius: KclCommandValue
|
radius: KclCommandValue
|
||||||
): { modifiedAst: Program; pathToFilletNode: Array<PathToNode> } | Error {
|
): { modifiedAst: Program; pathToFilletNode: Array<PathToNode> } | Error {
|
||||||
const astResult = insertRadiusIntoAst(ast, radius)
|
const astResult = insertRadiusIntoAst(ast, radius)
|
||||||
@ -130,7 +130,7 @@ function insertRadiusIntoAst(
|
|||||||
|
|
||||||
export function getPathToExtrudeForSegmentSelection(
|
export function getPathToExtrudeForSegmentSelection(
|
||||||
ast: Program,
|
ast: Program,
|
||||||
selection: Selections,
|
selection: Selections__old,
|
||||||
programMemory: ProgramMemory,
|
programMemory: ProgramMemory,
|
||||||
artifactGraph: ArtifactGraph
|
artifactGraph: ArtifactGraph
|
||||||
): { pathToSegmentNode: PathToNode; pathToExtrudeNode: PathToNode } | Error {
|
): { pathToSegmentNode: PathToNode; pathToExtrudeNode: PathToNode } | Error {
|
||||||
@ -447,7 +447,7 @@ export const hasValidFilletSelection = ({
|
|||||||
ast,
|
ast,
|
||||||
code,
|
code,
|
||||||
}: {
|
}: {
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections__old
|
||||||
ast: Program
|
ast: Program
|
||||||
code: string
|
code: string
|
||||||
}) => {
|
}) => {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { ToolTip } from 'lang/langHelpers'
|
import { ToolTip } from 'lang/langHelpers'
|
||||||
import { Selection, Selections } from 'lib/selections'
|
import { Selection__old, Selections__old } from 'lib/selections'
|
||||||
import {
|
import {
|
||||||
ArrayExpression,
|
ArrayExpression,
|
||||||
BinaryExpression,
|
BinaryExpression,
|
||||||
@ -120,7 +120,7 @@ export function getNodeFromPathCurry(
|
|||||||
|
|
||||||
function moreNodePathFromSourceRange(
|
function moreNodePathFromSourceRange(
|
||||||
node: Expr | ExpressionStatement | VariableDeclaration | ReturnStatement,
|
node: Expr | ExpressionStatement | VariableDeclaration | ReturnStatement,
|
||||||
sourceRange: Selection['range'],
|
sourceRange: Selection__old['range'],
|
||||||
previousPath: PathToNode = [['body', '']]
|
previousPath: PathToNode = [['body', '']]
|
||||||
): PathToNode {
|
): PathToNode {
|
||||||
const [start, end] = sourceRange
|
const [start, end] = sourceRange
|
||||||
@ -315,7 +315,7 @@ function moreNodePathFromSourceRange(
|
|||||||
|
|
||||||
export function getNodePathFromSourceRange(
|
export function getNodePathFromSourceRange(
|
||||||
node: Program,
|
node: Program,
|
||||||
sourceRange: Selection['range'],
|
sourceRange: Selection__old['range'],
|
||||||
previousPath: PathToNode = [['body', '']]
|
previousPath: PathToNode = [['body', '']]
|
||||||
): PathToNode {
|
): PathToNode {
|
||||||
const [start, end] = sourceRange || []
|
const [start, end] = sourceRange || []
|
||||||
@ -493,7 +493,7 @@ export function findAllPreviousVariablesPath(
|
|||||||
export function findAllPreviousVariables(
|
export function findAllPreviousVariables(
|
||||||
ast: Program,
|
ast: Program,
|
||||||
programMemory: ProgramMemory,
|
programMemory: ProgramMemory,
|
||||||
sourceRange: Selection['range'],
|
sourceRange: Selection__old['range'],
|
||||||
type: 'number' | 'string' = 'number'
|
type: 'number' | 'string' = 'number'
|
||||||
): {
|
): {
|
||||||
variables: PrevVariable<typeof type extends 'number' ? number : string>[]
|
variables: PrevVariable<typeof type extends 'number' ? number : string>[]
|
||||||
@ -639,8 +639,8 @@ export function isValueZero(val?: Expr): boolean {
|
|||||||
export function isLinesParallelAndConstrained(
|
export function isLinesParallelAndConstrained(
|
||||||
ast: Program,
|
ast: Program,
|
||||||
programMemory: ProgramMemory,
|
programMemory: ProgramMemory,
|
||||||
primaryLine: Selection,
|
primaryLine: Selection__old,
|
||||||
secondaryLine: Selection
|
secondaryLine: Selection__old
|
||||||
):
|
):
|
||||||
| {
|
| {
|
||||||
isParallelAndConstrained: boolean
|
isParallelAndConstrained: boolean
|
||||||
@ -735,7 +735,7 @@ export function doesPipeHaveCallExp({
|
|||||||
}: {
|
}: {
|
||||||
calleeName: string
|
calleeName: string
|
||||||
ast: Program
|
ast: Program
|
||||||
selection: Selection
|
selection: Selection__old
|
||||||
}): boolean {
|
}): boolean {
|
||||||
const pathToNode = getNodePathFromSourceRange(ast, selection.range)
|
const pathToNode = getNodePathFromSourceRange(ast, selection.range)
|
||||||
const pipeExpressionMeta = getNodeFromPath<PipeExpression>(
|
const pipeExpressionMeta = getNodeFromPath<PipeExpression>(
|
||||||
@ -762,7 +762,7 @@ export function hasExtrudeSketchGroup({
|
|||||||
programMemory,
|
programMemory,
|
||||||
}: {
|
}: {
|
||||||
ast: Program
|
ast: Program
|
||||||
selection: Selection
|
selection: Selection__old
|
||||||
programMemory: ProgramMemory
|
programMemory: ProgramMemory
|
||||||
}): boolean {
|
}): boolean {
|
||||||
const pathToNode = getNodePathFromSourceRange(ast, selection.range)
|
const pathToNode = getNodePathFromSourceRange(ast, selection.range)
|
||||||
@ -786,7 +786,7 @@ export function hasExtrudeSketchGroup({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function isSingleCursorInPipe(
|
export function isSingleCursorInPipe(
|
||||||
selectionRanges: Selections,
|
selectionRanges: Selections__old,
|
||||||
ast: Program
|
ast: Program
|
||||||
) {
|
) {
|
||||||
if (selectionRanges.codeBasedSelections.length !== 1) return false
|
if (selectionRanges.codeBasedSelections.length !== 1) return false
|
||||||
@ -860,7 +860,10 @@ export function findUsesOfTagInPipe(
|
|||||||
return dependentRanges
|
return dependentRanges
|
||||||
}
|
}
|
||||||
|
|
||||||
export function hasSketchPipeBeenExtruded(selection: Selection, ast: Program) {
|
export function hasSketchPipeBeenExtruded(
|
||||||
|
selection: Selection__old,
|
||||||
|
ast: Program
|
||||||
|
) {
|
||||||
const path = getNodePathFromSourceRange(ast, selection.range)
|
const path = getNodePathFromSourceRange(ast, selection.range)
|
||||||
const _node = getNodeFromPath<PipeExpression>(ast, path, 'PipeExpression')
|
const _node = getNodeFromPath<PipeExpression>(ast, path, 'PipeExpression')
|
||||||
if (err(_node)) return false
|
if (err(_node)) return false
|
||||||
|
@ -5,86 +5,90 @@ import { err } from 'lib/trap'
|
|||||||
|
|
||||||
export type ArtifactId = string
|
export type ArtifactId = string
|
||||||
|
|
||||||
interface CommonCommandProperties {
|
interface BaseArtifact {
|
||||||
|
id: ArtifactId
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CodeRef {
|
||||||
range: SourceRange
|
range: SourceRange
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PlaneArtifact {
|
export interface PlaneArtifact extends BaseArtifact {
|
||||||
type: 'plane'
|
type: 'plane'
|
||||||
pathIds: Array<ArtifactId>
|
pathIds: Array<ArtifactId>
|
||||||
codeRef: CommonCommandProperties
|
codeRef: CodeRef
|
||||||
}
|
}
|
||||||
export interface PlaneArtifactRich {
|
export interface PlaneArtifactRich extends BaseArtifact {
|
||||||
type: 'plane'
|
type: 'plane'
|
||||||
paths: Array<PathArtifact>
|
paths: Array<PathArtifact>
|
||||||
codeRef: CommonCommandProperties
|
codeRef: CodeRef
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PathArtifact {
|
export interface PathArtifact extends BaseArtifact {
|
||||||
type: 'path'
|
type: 'path'
|
||||||
planeId: ArtifactId
|
planeId: ArtifactId
|
||||||
segIds: Array<ArtifactId>
|
segIds: Array<ArtifactId>
|
||||||
sweepId: ArtifactId
|
sweepId: ArtifactId
|
||||||
solid2dId?: ArtifactId
|
solid2dId?: ArtifactId
|
||||||
codeRef: CommonCommandProperties
|
codeRef: CodeRef
|
||||||
}
|
}
|
||||||
|
|
||||||
interface solid2D {
|
interface solid2D extends BaseArtifact {
|
||||||
type: 'solid2D'
|
type: 'solid2D'
|
||||||
pathId: ArtifactId
|
pathId: ArtifactId
|
||||||
}
|
}
|
||||||
export interface PathArtifactRich {
|
export interface PathArtifactRich extends BaseArtifact {
|
||||||
type: 'path'
|
type: 'path'
|
||||||
plane: PlaneArtifact | WallArtifact
|
plane: PlaneArtifact | WallArtifact
|
||||||
segments: Array<SegmentArtifact>
|
segments: Array<SegmentArtifact>
|
||||||
sweep: SweepArtifact
|
sweep: SweepArtifact
|
||||||
codeRef: CommonCommandProperties
|
codeRef: CodeRef
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SegmentArtifact {
|
interface SegmentArtifact extends BaseArtifact {
|
||||||
type: 'segment'
|
type: 'segment'
|
||||||
pathId: ArtifactId
|
pathId: ArtifactId
|
||||||
surfaceId: ArtifactId
|
surfaceId: ArtifactId
|
||||||
edgeIds: Array<ArtifactId>
|
edgeIds: Array<ArtifactId>
|
||||||
edgeCutId?: ArtifactId
|
edgeCutId?: ArtifactId
|
||||||
codeRef: CommonCommandProperties
|
codeRef: CodeRef
|
||||||
}
|
}
|
||||||
interface SegmentArtifactRich {
|
interface SegmentArtifactRich extends BaseArtifact {
|
||||||
type: 'segment'
|
type: 'segment'
|
||||||
path: PathArtifact
|
path: PathArtifact
|
||||||
surf: WallArtifact
|
surf: WallArtifact
|
||||||
edges: Array<SweepEdge>
|
edges: Array<SweepEdge>
|
||||||
edgeCut?: EdgeCut
|
edgeCut?: EdgeCut
|
||||||
codeRef: CommonCommandProperties
|
codeRef: CodeRef
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A Sweep is a more generic term for extrude, revolve, loft and sweep*/
|
/** A Sweep is a more generic term for extrude, revolve, loft and sweep*/
|
||||||
interface SweepArtifact {
|
interface SweepArtifact extends BaseArtifact {
|
||||||
type: 'sweep'
|
type: 'sweep'
|
||||||
subType: 'extrusion' | 'revolve'
|
subType: 'extrusion' | 'revolve'
|
||||||
pathId: string
|
pathId: string
|
||||||
surfaceIds: Array<string>
|
surfaceIds: Array<string>
|
||||||
edgeIds: Array<string>
|
edgeIds: Array<string>
|
||||||
codeRef: CommonCommandProperties
|
codeRef: CodeRef
|
||||||
}
|
}
|
||||||
interface SweepArtifactRich {
|
interface SweepArtifactRich extends BaseArtifact {
|
||||||
type: 'sweep'
|
type: 'sweep'
|
||||||
subType: 'extrusion' | 'revolve'
|
subType: 'extrusion' | 'revolve'
|
||||||
path: PathArtifact
|
path: PathArtifact
|
||||||
surfaces: Array<WallArtifact | CapArtifact>
|
surfaces: Array<WallArtifact | CapArtifact>
|
||||||
edges: Array<SweepEdge>
|
edges: Array<SweepEdge>
|
||||||
codeRef: CommonCommandProperties
|
codeRef: CodeRef
|
||||||
}
|
}
|
||||||
|
|
||||||
interface WallArtifact {
|
interface WallArtifact extends BaseArtifact {
|
||||||
type: 'wall'
|
type: 'wall'
|
||||||
segId: ArtifactId
|
segId: ArtifactId
|
||||||
edgeCutEdgeIds: Array<ArtifactId>
|
edgeCutEdgeIds: Array<ArtifactId>
|
||||||
sweepId: ArtifactId
|
sweepId: ArtifactId
|
||||||
pathIds: Array<ArtifactId>
|
pathIds: Array<ArtifactId>
|
||||||
}
|
}
|
||||||
interface CapArtifact {
|
interface CapArtifact extends BaseArtifact {
|
||||||
type: 'cap'
|
type: 'cap'
|
||||||
subType: 'start' | 'end'
|
subType: 'start' | 'end'
|
||||||
edgeCutEdgeIds: Array<ArtifactId>
|
edgeCutEdgeIds: Array<ArtifactId>
|
||||||
@ -92,7 +96,7 @@ interface CapArtifact {
|
|||||||
pathIds: Array<ArtifactId>
|
pathIds: Array<ArtifactId>
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SweepEdge {
|
interface SweepEdge extends BaseArtifact {
|
||||||
type: 'sweepEdge'
|
type: 'sweepEdge'
|
||||||
segId: ArtifactId
|
segId: ArtifactId
|
||||||
sweepId: ArtifactId
|
sweepId: ArtifactId
|
||||||
@ -100,16 +104,16 @@ interface SweepEdge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** A edgeCut is a more generic term for both fillet or chamfer */
|
/** A edgeCut is a more generic term for both fillet or chamfer */
|
||||||
interface EdgeCut {
|
interface EdgeCut extends BaseArtifact {
|
||||||
type: 'edgeCut'
|
type: 'edgeCut'
|
||||||
subType: 'fillet' | 'chamfer'
|
subType: 'fillet' | 'chamfer'
|
||||||
consumedEdgeId: ArtifactId
|
consumedEdgeId: ArtifactId
|
||||||
edgeIds: Array<ArtifactId>
|
edgeIds: Array<ArtifactId>
|
||||||
surfaceId: ArtifactId
|
surfaceId: ArtifactId
|
||||||
codeRef: CommonCommandProperties
|
codeRef: CodeRef
|
||||||
}
|
}
|
||||||
|
|
||||||
interface EdgeCutEdge {
|
interface EdgeCutEdge extends BaseArtifact {
|
||||||
type: 'edgeCutEdge'
|
type: 'edgeCutEdge'
|
||||||
edgeCutId: ArtifactId
|
edgeCutId: ArtifactId
|
||||||
surfaceId: ArtifactId
|
surfaceId: ArtifactId
|
||||||
@ -258,6 +262,7 @@ export function getArtifactsToUpdate({
|
|||||||
id: currentPlaneId,
|
id: currentPlaneId,
|
||||||
artifact: {
|
artifact: {
|
||||||
type: 'wall',
|
type: 'wall',
|
||||||
|
id,
|
||||||
segId: existingPlane.segId,
|
segId: existingPlane.segId,
|
||||||
edgeCutEdgeIds: existingPlane.edgeCutEdgeIds,
|
edgeCutEdgeIds: existingPlane.edgeCutEdgeIds,
|
||||||
sweepId: existingPlane.sweepId,
|
sweepId: existingPlane.sweepId,
|
||||||
@ -267,7 +272,10 @@ export function getArtifactsToUpdate({
|
|||||||
]
|
]
|
||||||
} else {
|
} else {
|
||||||
return [
|
return [
|
||||||
{ id: currentPlaneId, artifact: { type: 'plane', pathIds, codeRef } },
|
{
|
||||||
|
id: currentPlaneId,
|
||||||
|
artifact: { type: 'plane', id: currentPlaneId, pathIds, codeRef },
|
||||||
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
} else if (cmd.type === 'start_path') {
|
} else if (cmd.type === 'start_path') {
|
||||||
@ -275,6 +283,7 @@ export function getArtifactsToUpdate({
|
|||||||
id,
|
id,
|
||||||
artifact: {
|
artifact: {
|
||||||
type: 'path',
|
type: 'path',
|
||||||
|
id,
|
||||||
segIds: [],
|
segIds: [],
|
||||||
planeId: currentPlaneId,
|
planeId: currentPlaneId,
|
||||||
sweepId: '',
|
sweepId: '',
|
||||||
@ -287,7 +296,7 @@ export function getArtifactsToUpdate({
|
|||||||
if (plane?.type === 'plane') {
|
if (plane?.type === 'plane') {
|
||||||
returnArr.push({
|
returnArr.push({
|
||||||
id: currentPlaneId,
|
id: currentPlaneId,
|
||||||
artifact: { type: 'plane', pathIds: [id], codeRef },
|
artifact: { type: 'plane', id: currentPlaneId, pathIds: [id], codeRef },
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (plane?.type === 'wall') {
|
if (plane?.type === 'wall') {
|
||||||
@ -295,6 +304,7 @@ export function getArtifactsToUpdate({
|
|||||||
id: currentPlaneId,
|
id: currentPlaneId,
|
||||||
artifact: {
|
artifact: {
|
||||||
type: 'wall',
|
type: 'wall',
|
||||||
|
id,
|
||||||
segId: plane.segId,
|
segId: plane.segId,
|
||||||
edgeCutEdgeIds: plane.edgeCutEdgeIds,
|
edgeCutEdgeIds: plane.edgeCutEdgeIds,
|
||||||
sweepId: plane.sweepId,
|
sweepId: plane.sweepId,
|
||||||
@ -309,6 +319,7 @@ export function getArtifactsToUpdate({
|
|||||||
id,
|
id,
|
||||||
artifact: {
|
artifact: {
|
||||||
type: 'segment',
|
type: 'segment',
|
||||||
|
id,
|
||||||
pathId,
|
pathId,
|
||||||
surfaceId: '',
|
surfaceId: '',
|
||||||
edgeIds: [],
|
edgeIds: [],
|
||||||
@ -327,7 +338,11 @@ export function getArtifactsToUpdate({
|
|||||||
) {
|
) {
|
||||||
returnArr.push({
|
returnArr.push({
|
||||||
id: response.data.modeling_response.data.face_id,
|
id: response.data.modeling_response.data.face_id,
|
||||||
artifact: { type: 'solid2D', pathId },
|
artifact: {
|
||||||
|
type: 'solid2D',
|
||||||
|
id: response.data.modeling_response.data.face_id,
|
||||||
|
pathId,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
const path = getArtifact(pathId)
|
const path = getArtifact(pathId)
|
||||||
if (path?.type === 'path')
|
if (path?.type === 'path')
|
||||||
@ -347,6 +362,7 @@ export function getArtifactsToUpdate({
|
|||||||
artifact: {
|
artifact: {
|
||||||
type: 'sweep',
|
type: 'sweep',
|
||||||
subType: subType,
|
subType: subType,
|
||||||
|
id,
|
||||||
pathId: cmd.target,
|
pathId: cmd.target,
|
||||||
surfaceIds: [],
|
surfaceIds: [],
|
||||||
edgeIds: [],
|
edgeIds: [],
|
||||||
@ -378,6 +394,7 @@ export function getArtifactsToUpdate({
|
|||||||
id: face_id,
|
id: face_id,
|
||||||
artifact: {
|
artifact: {
|
||||||
type: 'wall',
|
type: 'wall',
|
||||||
|
id: face_id,
|
||||||
segId: curve_id,
|
segId: curve_id,
|
||||||
edgeCutEdgeIds: [],
|
edgeCutEdgeIds: [],
|
||||||
sweepId: path.sweepId,
|
sweepId: path.sweepId,
|
||||||
@ -410,6 +427,7 @@ export function getArtifactsToUpdate({
|
|||||||
id: face_id,
|
id: face_id,
|
||||||
artifact: {
|
artifact: {
|
||||||
type: 'cap',
|
type: 'cap',
|
||||||
|
id: face_id,
|
||||||
subType: cap === 'bottom' ? 'start' : 'end',
|
subType: cap === 'bottom' ? 'start' : 'end',
|
||||||
edgeCutEdgeIds: [],
|
edgeCutEdgeIds: [],
|
||||||
sweepId: path.sweepId,
|
sweepId: path.sweepId,
|
||||||
@ -456,6 +474,7 @@ export function getArtifactsToUpdate({
|
|||||||
id: response.data.modeling_response.data.edge,
|
id: response.data.modeling_response.data.edge,
|
||||||
artifact: {
|
artifact: {
|
||||||
type: 'sweepEdge',
|
type: 'sweepEdge',
|
||||||
|
id: response.data.modeling_response.data.edge,
|
||||||
subType:
|
subType:
|
||||||
cmd.type === 'solid3d_get_prev_adjacent_edge'
|
cmd.type === 'solid3d_get_prev_adjacent_edge'
|
||||||
? 'adjacent'
|
? 'adjacent'
|
||||||
@ -484,6 +503,7 @@ export function getArtifactsToUpdate({
|
|||||||
id,
|
id,
|
||||||
artifact: {
|
artifact: {
|
||||||
type: 'edgeCut',
|
type: 'edgeCut',
|
||||||
|
id,
|
||||||
subType: cmd.cut_type,
|
subType: cmd.cut_type,
|
||||||
consumedEdgeId: cmd.edge_id,
|
consumedEdgeId: cmd.edge_id,
|
||||||
edgeIds: [],
|
edgeIds: [],
|
||||||
@ -574,6 +594,7 @@ export function expandPlane(
|
|||||||
)
|
)
|
||||||
return {
|
return {
|
||||||
type: 'plane',
|
type: 'plane',
|
||||||
|
id: plane.id,
|
||||||
paths: Array.from(paths.values()),
|
paths: Array.from(paths.values()),
|
||||||
codeRef: plane.codeRef,
|
codeRef: plane.codeRef,
|
||||||
}
|
}
|
||||||
@ -602,6 +623,7 @@ export function expandPath(
|
|||||||
if (err(plane)) return plane
|
if (err(plane)) return plane
|
||||||
return {
|
return {
|
||||||
type: 'path',
|
type: 'path',
|
||||||
|
id: path.id,
|
||||||
segments: Array.from(segs.values()),
|
segments: Array.from(segs.values()),
|
||||||
sweep,
|
sweep,
|
||||||
plane,
|
plane,
|
||||||
@ -629,6 +651,7 @@ export function expandSweep(
|
|||||||
return {
|
return {
|
||||||
type: 'sweep',
|
type: 'sweep',
|
||||||
subType: 'extrusion',
|
subType: 'extrusion',
|
||||||
|
id: sweep.id,
|
||||||
surfaces: Array.from(surfs.values()),
|
surfaces: Array.from(surfs.values()),
|
||||||
edges: Array.from(edges.values()),
|
edges: Array.from(edges.values()),
|
||||||
path,
|
path,
|
||||||
@ -664,6 +687,7 @@ export function expandSegment(
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
type: 'segment',
|
type: 'segment',
|
||||||
|
id: segment.id,
|
||||||
path,
|
path,
|
||||||
surf,
|
surf,
|
||||||
edges: Array.from(edges.values()),
|
edges: Array.from(edges.values()),
|
||||||
@ -675,7 +699,7 @@ export function expandSegment(
|
|||||||
export function getCapCodeRef(
|
export function getCapCodeRef(
|
||||||
cap: CapArtifact,
|
cap: CapArtifact,
|
||||||
artifactGraph: ArtifactGraph
|
artifactGraph: ArtifactGraph
|
||||||
): CommonCommandProperties | Error {
|
): CodeRef | Error {
|
||||||
const sweep = getArtifactOfTypes(
|
const sweep = getArtifactOfTypes(
|
||||||
{ key: cap.sweepId, types: ['sweep'] },
|
{ key: cap.sweepId, types: ['sweep'] },
|
||||||
artifactGraph
|
artifactGraph
|
||||||
@ -692,7 +716,7 @@ export function getCapCodeRef(
|
|||||||
export function getSolid2dCodeRef(
|
export function getSolid2dCodeRef(
|
||||||
solid2D: solid2D,
|
solid2D: solid2D,
|
||||||
artifactGraph: ArtifactGraph
|
artifactGraph: ArtifactGraph
|
||||||
): CommonCommandProperties | Error {
|
): CodeRef | Error {
|
||||||
const path = getArtifactOfTypes(
|
const path = getArtifactOfTypes(
|
||||||
{ key: solid2D.pathId, types: ['path'] },
|
{ key: solid2D.pathId, types: ['path'] },
|
||||||
artifactGraph
|
artifactGraph
|
||||||
@ -704,7 +728,7 @@ export function getSolid2dCodeRef(
|
|||||||
export function getWallCodeRef(
|
export function getWallCodeRef(
|
||||||
wall: WallArtifact,
|
wall: WallArtifact,
|
||||||
artifactGraph: ArtifactGraph
|
artifactGraph: ArtifactGraph
|
||||||
): CommonCommandProperties | Error {
|
): CodeRef | Error {
|
||||||
const seg = getArtifactOfTypes(
|
const seg = getArtifactOfTypes(
|
||||||
{ key: wall.segId, types: ['segment'] },
|
{ key: wall.segId, types: ['segment'] },
|
||||||
artifactGraph
|
artifactGraph
|
||||||
@ -716,7 +740,7 @@ export function getWallCodeRef(
|
|||||||
export function getSweepEdgeCodeRef(
|
export function getSweepEdgeCodeRef(
|
||||||
edge: SweepEdge,
|
edge: SweepEdge,
|
||||||
artifactGraph: ArtifactGraph
|
artifactGraph: ArtifactGraph
|
||||||
): CommonCommandProperties | Error {
|
): CodeRef | Error {
|
||||||
const seg = getArtifactOfTypes(
|
const seg = getArtifactOfTypes(
|
||||||
{ key: edge.segId, types: ['segment'] },
|
{ key: edge.segId, types: ['segment'] },
|
||||||
artifactGraph
|
artifactGraph
|
||||||
|
@ -1912,11 +1912,13 @@ export function getConstraintInfo(
|
|||||||
): ConstrainInfo[] {
|
): ConstrainInfo[] {
|
||||||
const fnName = callExpression?.callee?.name || ''
|
const fnName = callExpression?.callee?.name || ''
|
||||||
if (!(fnName in sketchLineHelperMap)) return []
|
if (!(fnName in sketchLineHelperMap)) return []
|
||||||
return sketchLineHelperMap[fnName].getConstraintInfo(
|
const result = sketchLineHelperMap[fnName].getConstraintInfo(
|
||||||
callExpression,
|
callExpression,
|
||||||
code,
|
code,
|
||||||
pathToNode
|
pathToNode
|
||||||
)
|
)
|
||||||
|
console.log('result path', result[0].pathToNode)
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
export function compareVec2Epsilon(
|
export function compareVec2Epsilon(
|
||||||
|
@ -11,7 +11,7 @@ import {
|
|||||||
transformAstSketchLines,
|
transformAstSketchLines,
|
||||||
} from './sketchcombos'
|
} from './sketchcombos'
|
||||||
import { getSketchSegmentFromSourceRange } from './sketchConstraints'
|
import { getSketchSegmentFromSourceRange } from './sketchConstraints'
|
||||||
import { Selection } from 'lib/selections'
|
import { Selection__old } from 'lib/selections'
|
||||||
import { enginelessExecutor } from '../../lib/testHelpers'
|
import { enginelessExecutor } from '../../lib/testHelpers'
|
||||||
import { err } from 'lib/trap'
|
import { err } from 'lib/trap'
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ async function testingSwapSketchFnCall({
|
|||||||
originalRange: [number, number]
|
originalRange: [number, number]
|
||||||
}> {
|
}> {
|
||||||
const startIndex = inputCode.indexOf(callToSwap)
|
const startIndex = inputCode.indexOf(callToSwap)
|
||||||
const range: Selection = {
|
const range: Selection__old = {
|
||||||
type: 'default',
|
type: 'default',
|
||||||
range: [startIndex, startIndex + callToSwap.length],
|
range: [startIndex, startIndex + callToSwap.length],
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import {
|
|||||||
getConstraintLevelFromSourceRange,
|
getConstraintLevelFromSourceRange,
|
||||||
} from './sketchcombos'
|
} from './sketchcombos'
|
||||||
import { ToolTip } from 'lang/langHelpers'
|
import { ToolTip } from 'lang/langHelpers'
|
||||||
import { Selections } from 'lib/selections'
|
import { Selections__old } from 'lib/selections'
|
||||||
import { err } from 'lib/trap'
|
import { err } from 'lib/trap'
|
||||||
import { enginelessExecutor } from '../../lib/testHelpers'
|
import { enginelessExecutor } from '../../lib/testHelpers'
|
||||||
|
|
||||||
@ -87,8 +87,8 @@ function getConstraintTypeFromSourceHelper2(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function makeSelections(
|
function makeSelections(
|
||||||
codeBaseSelections: Selections['codeBasedSelections']
|
codeBaseSelections: Selections__old['codeBasedSelections']
|
||||||
): Selections {
|
): Selections__old {
|
||||||
return {
|
return {
|
||||||
codeBasedSelections: codeBaseSelections,
|
codeBasedSelections: codeBaseSelections,
|
||||||
otherSelections: [],
|
otherSelections: [],
|
||||||
@ -208,7 +208,7 @@ const part001 = startSketchOn('XY')
|
|||||||
const ast = parse(inputScript)
|
const ast = parse(inputScript)
|
||||||
if (err(ast)) return Promise.reject(ast)
|
if (err(ast)) return Promise.reject(ast)
|
||||||
|
|
||||||
const selectionRanges: Selections['codeBasedSelections'] = inputScript
|
const selectionRanges: Selections__old['codeBasedSelections'] = inputScript
|
||||||
.split('\n')
|
.split('\n')
|
||||||
.filter((ln) => ln.includes('//'))
|
.filter((ln) => ln.includes('//'))
|
||||||
.map((ln) => {
|
.map((ln) => {
|
||||||
@ -299,7 +299,7 @@ const part001 = startSketchOn('XY')
|
|||||||
const ast = parse(inputScript)
|
const ast = parse(inputScript)
|
||||||
if (err(ast)) return Promise.reject(ast)
|
if (err(ast)) return Promise.reject(ast)
|
||||||
|
|
||||||
const selectionRanges: Selections['codeBasedSelections'] = inputScript
|
const selectionRanges: Selections__old['codeBasedSelections'] = inputScript
|
||||||
.split('\n')
|
.split('\n')
|
||||||
.filter((ln) => ln.includes('// select for horizontal constraint'))
|
.filter((ln) => ln.includes('// select for horizontal constraint'))
|
||||||
.map((ln) => {
|
.map((ln) => {
|
||||||
@ -361,7 +361,7 @@ const part001 = startSketchOn('XY')
|
|||||||
const ast = parse(inputScript)
|
const ast = parse(inputScript)
|
||||||
if (err(ast)) return Promise.reject(ast)
|
if (err(ast)) return Promise.reject(ast)
|
||||||
|
|
||||||
const selectionRanges: Selections['codeBasedSelections'] = inputScript
|
const selectionRanges: Selections__old['codeBasedSelections'] = inputScript
|
||||||
.split('\n')
|
.split('\n')
|
||||||
.filter((ln) => ln.includes('// select for vertical constraint'))
|
.filter((ln) => ln.includes('// select for vertical constraint'))
|
||||||
.map((ln) => {
|
.map((ln) => {
|
||||||
@ -434,7 +434,7 @@ const part001 = startSketchOn('XY')
|
|||||||
segEndY(seg01) + 2.93
|
segEndY(seg01) + 2.93
|
||||||
], %) // xRelative`)
|
], %) // xRelative`)
|
||||||
})
|
})
|
||||||
it('testing for yRelative to horizontal distance', async () => {
|
it.only('testing for yRelative to horizontal distance', async () => {
|
||||||
const expectedCode = await helperThing(
|
const expectedCode = await helperThing(
|
||||||
inputScript,
|
inputScript,
|
||||||
['// base selection', '// yRelative'],
|
['// base selection', '// yRelative'],
|
||||||
@ -456,7 +456,7 @@ async function helperThing(
|
|||||||
const ast = parse(inputScript)
|
const ast = parse(inputScript)
|
||||||
if (err(ast)) return Promise.reject(ast)
|
if (err(ast)) return Promise.reject(ast)
|
||||||
|
|
||||||
const selectionRanges: Selections['codeBasedSelections'] = inputScript
|
const selectionRanges: Selections__old['codeBasedSelections'] = inputScript
|
||||||
.split('\n')
|
.split('\n')
|
||||||
.filter((ln) =>
|
.filter((ln) =>
|
||||||
linesOfInterest.some((lineOfInterest) => ln.includes(lineOfInterest))
|
linesOfInterest.some((lineOfInterest) => ln.includes(lineOfInterest))
|
||||||
|
@ -7,7 +7,7 @@ import {
|
|||||||
TransformInfo,
|
TransformInfo,
|
||||||
} from './stdTypes'
|
} from './stdTypes'
|
||||||
import { ToolTip, toolTips } from 'lang/langHelpers'
|
import { ToolTip, toolTips } from 'lang/langHelpers'
|
||||||
import { Selections, Selection } from 'lib/selections'
|
import { Selections__old, Selection__old } from 'lib/selections'
|
||||||
import { cleanErrs, err } from 'lib/trap'
|
import { cleanErrs, err } from 'lib/trap'
|
||||||
import {
|
import {
|
||||||
CallExpression,
|
CallExpression,
|
||||||
@ -1470,7 +1470,7 @@ export function getConstraintType(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getTransformInfos(
|
export function getTransformInfos(
|
||||||
selectionRanges: Selections,
|
selectionRanges: Selections__old,
|
||||||
ast: Program,
|
ast: Program,
|
||||||
constraintType: ConstraintType
|
constraintType: ConstraintType
|
||||||
): TransformInfo[] {
|
): TransformInfo[] {
|
||||||
@ -1502,7 +1502,7 @@ export function getTransformInfos(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getRemoveConstraintsTransforms(
|
export function getRemoveConstraintsTransforms(
|
||||||
selectionRanges: Selections,
|
selectionRanges: Selections__old,
|
||||||
ast: Program,
|
ast: Program,
|
||||||
constraintType: ConstraintType
|
constraintType: ConstraintType
|
||||||
): TransformInfo[] | Error {
|
): TransformInfo[] | Error {
|
||||||
@ -1542,7 +1542,7 @@ export function transformSecondarySketchLinesTagFirst({
|
|||||||
forceValueUsedInTransform,
|
forceValueUsedInTransform,
|
||||||
}: {
|
}: {
|
||||||
ast: Program
|
ast: Program
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections__old
|
||||||
transformInfos: TransformInfo[]
|
transformInfos: TransformInfo[]
|
||||||
programMemory: ProgramMemory
|
programMemory: ProgramMemory
|
||||||
forceSegName?: string
|
forceSegName?: string
|
||||||
@ -1613,12 +1613,12 @@ export function transformAstSketchLines({
|
|||||||
referencedSegmentRange,
|
referencedSegmentRange,
|
||||||
}: {
|
}: {
|
||||||
ast: Program
|
ast: Program
|
||||||
selectionRanges: Selections | PathToNode[]
|
selectionRanges: Selections__old | PathToNode[]
|
||||||
transformInfos: TransformInfo[]
|
transformInfos: TransformInfo[]
|
||||||
programMemory: ProgramMemory
|
programMemory: ProgramMemory
|
||||||
referenceSegName: string
|
referenceSegName: string
|
||||||
|
referencedSegmentRange?: Selection__old['range']
|
||||||
forceValueUsedInTransform?: BinaryPart
|
forceValueUsedInTransform?: BinaryPart
|
||||||
referencedSegmentRange?: Selection['range']
|
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
modifiedAst: Program
|
modifiedAst: Program
|
||||||
@ -1658,6 +1658,7 @@ export function transformAstSketchLines({
|
|||||||
''
|
''
|
||||||
const inputs: InputArgs = []
|
const inputs: InputArgs = []
|
||||||
|
|
||||||
|
console.log('getConstraintInfo', callExp.node, _pathToNode)
|
||||||
getConstraintInfo(callExp.node, '', _pathToNode).forEach((a) => {
|
getConstraintInfo(callExp.node, '', _pathToNode).forEach((a) => {
|
||||||
if (
|
if (
|
||||||
a.type === 'tangentialWithPrevious' ||
|
a.type === 'tangentialWithPrevious' ||
|
||||||
@ -1822,7 +1823,7 @@ function getArgLiteralVal(arg: Literal): number | Error {
|
|||||||
export type ConstraintLevel = 'free' | 'partial' | 'full'
|
export type ConstraintLevel = 'free' | 'partial' | 'full'
|
||||||
|
|
||||||
export function getConstraintLevelFromSourceRange(
|
export function getConstraintLevelFromSourceRange(
|
||||||
cursorRange: Selection['range'],
|
cursorRange: Selection__old['range'],
|
||||||
ast: Program | Error
|
ast: Program | Error
|
||||||
): Error | { range: [number, number]; level: ConstraintLevel } {
|
): Error | { range: [number, number]; level: ConstraintLevel } {
|
||||||
if (err(ast)) return ast
|
if (err(ast)) return ast
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Selections } from 'lib/selections'
|
import { Selections__old } from 'lib/selections'
|
||||||
import { Program, PathToNode } from './wasm'
|
import { Program, PathToNode } from './wasm'
|
||||||
import { getNodeFromPath } from './queryAst'
|
import { getNodeFromPath } from './queryAst'
|
||||||
import { ArtifactGraph, filterArtifacts } from 'lang/std/artifactGraph'
|
import { ArtifactGraph, filterArtifacts } from 'lang/std/artifactGraph'
|
||||||
@ -7,10 +7,10 @@ import { err } from 'lib/trap'
|
|||||||
|
|
||||||
export function pathMapToSelections(
|
export function pathMapToSelections(
|
||||||
ast: Program,
|
ast: Program,
|
||||||
prevSelections: Selections,
|
prevSelections: Selections__old,
|
||||||
pathToNodeMap: { [key: number]: PathToNode }
|
pathToNodeMap: { [key: number]: PathToNode }
|
||||||
): Selections {
|
): Selections__old {
|
||||||
const newSelections: Selections = {
|
const newSelections: Selections__old = {
|
||||||
...prevSelections,
|
...prevSelections,
|
||||||
codeBasedSelections: [],
|
codeBasedSelections: [],
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ export function updatePathToNodeFromMap(
|
|||||||
|
|
||||||
export function isCursorInSketchCommandRange(
|
export function isCursorInSketchCommandRange(
|
||||||
artifactGraph: ArtifactGraph,
|
artifactGraph: ArtifactGraph,
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections__old
|
||||||
): string | false {
|
): string | false {
|
||||||
const overlappingEntries = filterArtifacts(
|
const overlappingEntries = filterArtifacts(
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@ import { Models } from '@kittycad/lib'
|
|||||||
import { StateMachineCommandSetConfig, KclCommandValue } from 'lib/commandTypes'
|
import { StateMachineCommandSetConfig, KclCommandValue } from 'lib/commandTypes'
|
||||||
import { KCL_DEFAULT_LENGTH, KCL_DEFAULT_DEGREE } from 'lib/constants'
|
import { KCL_DEFAULT_LENGTH, KCL_DEFAULT_DEGREE } from 'lib/constants'
|
||||||
import { components } from 'lib/machine-api'
|
import { components } from 'lib/machine-api'
|
||||||
import { Selections } from 'lib/selections'
|
import { Selections__old } from 'lib/selections'
|
||||||
import { machineManager } from 'lib/machineManager'
|
import { machineManager } from 'lib/machineManager'
|
||||||
import { modelingMachine, SketchTool } from 'machines/modelingMachine'
|
import { modelingMachine, SketchTool } from 'machines/modelingMachine'
|
||||||
|
|
||||||
@ -28,17 +28,17 @@ export type ModelingCommandSchema = {
|
|||||||
machine: components['schemas']['MachineInfoResponse']
|
machine: components['schemas']['MachineInfoResponse']
|
||||||
}
|
}
|
||||||
Extrude: {
|
Extrude: {
|
||||||
selection: Selections // & { type: 'face' } would be cool to lock that down
|
selection: Selections__old // & { type: 'face' } would be cool to lock that down
|
||||||
// result: (typeof EXTRUSION_RESULTS)[number]
|
// result: (typeof EXTRUSION_RESULTS)[number]
|
||||||
distance: KclCommandValue
|
distance: KclCommandValue
|
||||||
}
|
}
|
||||||
Revolve: {
|
Revolve: {
|
||||||
selection: Selections
|
selection: Selections__old
|
||||||
angle: KclCommandValue
|
angle: KclCommandValue
|
||||||
}
|
}
|
||||||
Fillet: {
|
Fillet: {
|
||||||
// todo
|
// todo
|
||||||
selection: Selections
|
selection: Selections__old
|
||||||
radius: KclCommandValue
|
radius: KclCommandValue
|
||||||
}
|
}
|
||||||
'change tool': {
|
'change tool': {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { CustomIconName } from 'components/CustomIcon'
|
import { CustomIconName } from 'components/CustomIcon'
|
||||||
import { AllMachines } from 'hooks/useStateMachineCommands'
|
import { AllMachines } from 'hooks/useStateMachineCommands'
|
||||||
import { Actor, AnyStateMachine, ContextFrom, EventFrom } from 'xstate'
|
import { Actor, AnyStateMachine, ContextFrom, EventFrom } from 'xstate'
|
||||||
import { Selection } from './selections'
|
import { Selection__old } from './selections'
|
||||||
import { Identifier, Expr, VariableDeclaration } from 'lang/wasm'
|
import { Identifier, Expr, VariableDeclaration } from 'lang/wasm'
|
||||||
import { commandBarMachine } from 'machines/commandBarMachine'
|
import { commandBarMachine } from 'machines/commandBarMachine'
|
||||||
import { ReactNode } from 'react'
|
import { ReactNode } from 'react'
|
||||||
@ -140,7 +140,7 @@ export type CommandArgumentConfig<
|
|||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
inputType: 'selection'
|
inputType: 'selection'
|
||||||
selectionTypes: Selection['type'][]
|
selectionTypes: Selection__old['type'][]
|
||||||
multiple: boolean
|
multiple: boolean
|
||||||
}
|
}
|
||||||
| { inputType: 'kcl'; defaultValue?: string } // KCL expression inputs have simple strings as default values
|
| { inputType: 'kcl'; defaultValue?: string } // KCL expression inputs have simple strings as default values
|
||||||
@ -213,7 +213,7 @@ export type CommandArgument<
|
|||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
inputType: 'selection'
|
inputType: 'selection'
|
||||||
selectionTypes: Selection['type'][]
|
selectionTypes: Selection__old['type'][]
|
||||||
multiple: boolean
|
multiple: boolean
|
||||||
}
|
}
|
||||||
| { inputType: 'kcl'; defaultValue?: string } // KCL expression inputs have simple strings as default value
|
| { inputType: 'kcl'; defaultValue?: string } // KCL expression inputs have simple strings as default value
|
||||||
|
@ -28,6 +28,7 @@ import { AXIS_GROUP, X_AXIS } from 'clientSideScene/sceneInfra'
|
|||||||
import { PathToNodeMap } from 'lang/std/sketchcombos'
|
import { PathToNodeMap } from 'lang/std/sketchcombos'
|
||||||
import { err } from 'lib/trap'
|
import { err } from 'lib/trap'
|
||||||
import {
|
import {
|
||||||
|
Artifact,
|
||||||
getArtifactOfTypes,
|
getArtifactOfTypes,
|
||||||
getArtifactsOfTypes,
|
getArtifactsOfTypes,
|
||||||
getCapCodeRef,
|
getCapCodeRef,
|
||||||
@ -41,7 +42,8 @@ export const Y_AXIS_UUID = '680fd157-266f-4b8a-984f-cdf46b8bdf01'
|
|||||||
|
|
||||||
export type Axis = 'y-axis' | 'x-axis' | 'z-axis'
|
export type Axis = 'y-axis' | 'x-axis' | 'z-axis'
|
||||||
|
|
||||||
export type Selection = {
|
/** @deprecated Use {@link Artifact} instead. */
|
||||||
|
export type Selection__old = {
|
||||||
type:
|
type:
|
||||||
| 'default'
|
| 'default'
|
||||||
| 'line-end'
|
| 'line-end'
|
||||||
@ -58,9 +60,29 @@ export type Selection = {
|
|||||||
| 'all'
|
| 'all'
|
||||||
range: SourceRange
|
range: SourceRange
|
||||||
}
|
}
|
||||||
|
/** @deprecated Use {@link Selection} instead. */
|
||||||
|
export type Selections__old = {
|
||||||
|
otherSelections: Axis[]
|
||||||
|
codeBasedSelections: Selection__old[]
|
||||||
|
}
|
||||||
export type Selections = {
|
export type Selections = {
|
||||||
otherSelections: Axis[]
|
otherSelections: Axis[]
|
||||||
codeBasedSelections: Selection[]
|
graphSelections: Artifact[]
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @deprecated If you're writing a new function, it should use {@link Selection} and not {@link Selection__old}
|
||||||
|
* this function should only be used for backwards compatibility with old functions.
|
||||||
|
*/
|
||||||
|
export function convertSelectionToOld(selection: Selection__old): Artifact {
|
||||||
|
return {} as Artifact
|
||||||
|
// TODO implementation
|
||||||
|
}
|
||||||
|
/** @deprecated If you're writing a new function, it should use {@link Selection} and not {@link Selection__old}
|
||||||
|
* this function should only be used for backwards compatibility with old functions.
|
||||||
|
*/
|
||||||
|
export function convertSelectionsToOld(selection: Selections__old): Selections {
|
||||||
|
// TODO implementation
|
||||||
|
return { otherSelections: [], graphSelections: [] }
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getEventForSelectWithPoint({
|
export async function getEventForSelectWithPoint({
|
||||||
@ -211,7 +233,7 @@ export function getEventForSegmentSelection(
|
|||||||
export function handleSelectionBatch({
|
export function handleSelectionBatch({
|
||||||
selections,
|
selections,
|
||||||
}: {
|
}: {
|
||||||
selections: Selections
|
selections: Selections__old
|
||||||
}): {
|
}): {
|
||||||
engineEvents: Models['WebSocketRequest_type'][]
|
engineEvents: Models['WebSocketRequest_type'][]
|
||||||
codeMirrorSelection: EditorSelection
|
codeMirrorSelection: EditorSelection
|
||||||
@ -252,7 +274,7 @@ export function handleSelectionBatch({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type SelectionToEngine = { type: Selection['type']; id: string }
|
type SelectionToEngine = { type: Selection__old['type']; id: string }
|
||||||
|
|
||||||
export function processCodeMirrorRanges({
|
export function processCodeMirrorRanges({
|
||||||
codeMirrorRanges,
|
codeMirrorRanges,
|
||||||
@ -260,7 +282,7 @@ export function processCodeMirrorRanges({
|
|||||||
isShiftDown,
|
isShiftDown,
|
||||||
}: {
|
}: {
|
||||||
codeMirrorRanges: readonly SelectionRange[]
|
codeMirrorRanges: readonly SelectionRange[]
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections__old
|
||||||
isShiftDown: boolean
|
isShiftDown: boolean
|
||||||
}): null | {
|
}): null | {
|
||||||
modelingEvent: ModelingMachineEvent
|
modelingEvent: ModelingMachineEvent
|
||||||
@ -276,7 +298,7 @@ export function processCodeMirrorRanges({
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (!isChange) return null
|
if (!isChange) return null
|
||||||
const codeBasedSelections: Selections['codeBasedSelections'] =
|
const codeBasedSelections: Selections__old['codeBasedSelections'] =
|
||||||
codeMirrorRanges.map(({ from, to }) => {
|
codeMirrorRanges.map(({ from, to }) => {
|
||||||
return {
|
return {
|
||||||
type: 'default',
|
type: 'default',
|
||||||
@ -303,7 +325,7 @@ export function processCodeMirrorRanges({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateSceneObjectColors(codeBasedSelections: Selection[]) {
|
function updateSceneObjectColors(codeBasedSelections: Selection__old[]) {
|
||||||
const updated = kclManager.ast
|
const updated = kclManager.ast
|
||||||
|
|
||||||
Object.values(sceneEntitiesManager.activeSegments).forEach((segmentGroup) => {
|
Object.values(sceneEntitiesManager.activeSegments).forEach((segmentGroup) => {
|
||||||
@ -358,7 +380,7 @@ function resetAndSetEngineEntitySelectionCmds(
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isSketchPipe(selectionRanges: Selections) {
|
export function isSketchPipe(selectionRanges: Selections__old) {
|
||||||
if (!isSingleCursorInPipe(selectionRanges, kclManager.ast)) return false
|
if (!isSingleCursorInPipe(selectionRanges, kclManager.ast)) return false
|
||||||
return isCursorInSketchCommandRange(
|
return isCursorInSketchCommandRange(
|
||||||
engineCommandManager.artifactGraph,
|
engineCommandManager.artifactGraph,
|
||||||
@ -367,14 +389,14 @@ export function isSketchPipe(selectionRanges: Selections) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function isSelectionLastLine(
|
export function isSelectionLastLine(
|
||||||
selectionRanges: Selections,
|
selectionRanges: Selections__old,
|
||||||
code: string,
|
code: string,
|
||||||
i = 0
|
i = 0
|
||||||
) {
|
) {
|
||||||
return selectionRanges.codeBasedSelections[i].range[1] === code.length
|
return selectionRanges.codeBasedSelections[i].range[1] === code.length
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isRangeBetweenCharacters(selectionRanges: Selections) {
|
export function isRangeBetweenCharacters(selectionRanges: Selections__old) {
|
||||||
return (
|
return (
|
||||||
selectionRanges.codeBasedSelections.length === 1 &&
|
selectionRanges.codeBasedSelections.length === 1 &&
|
||||||
selectionRanges.codeBasedSelections[0].range[0] === 0 &&
|
selectionRanges.codeBasedSelections[0].range[0] === 0 &&
|
||||||
@ -383,11 +405,14 @@ export function isRangeBetweenCharacters(selectionRanges: Selections) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type CommonASTNode = {
|
export type CommonASTNode = {
|
||||||
selection: Selection
|
selection: Selection__old
|
||||||
ast: Program
|
ast: Program
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildCommonNodeFromSelection(selectionRanges: Selections, i: number) {
|
function buildCommonNodeFromSelection(
|
||||||
|
selectionRanges: Selections__old,
|
||||||
|
i: number
|
||||||
|
) {
|
||||||
return {
|
return {
|
||||||
selection: selectionRanges.codeBasedSelections[i],
|
selection: selectionRanges.codeBasedSelections[i],
|
||||||
ast: kclManager.ast,
|
ast: kclManager.ast,
|
||||||
@ -420,7 +445,7 @@ function nodeHasCircle(node: CommonASTNode) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function canSweepSelection(selection: Selections) {
|
export function canSweepSelection(selection: Selections__old) {
|
||||||
const commonNodes = selection.codeBasedSelections.map((_, i) =>
|
const commonNodes = selection.codeBasedSelections.map((_, i) =>
|
||||||
buildCommonNodeFromSelection(selection, i)
|
buildCommonNodeFromSelection(selection, i)
|
||||||
)
|
)
|
||||||
@ -433,7 +458,7 @@ export function canSweepSelection(selection: Selections) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function canFilletSelection(selection: Selections) {
|
export function canFilletSelection(selection: Selections__old) {
|
||||||
const commonNodes = selection.codeBasedSelections.map((_, i) =>
|
const commonNodes = selection.codeBasedSelections.map((_, i) =>
|
||||||
buildCommonNodeFromSelection(selection, i)
|
buildCommonNodeFromSelection(selection, i)
|
||||||
) // TODO FILLET DUMMY PLACEHOLDER
|
) // TODO FILLET DUMMY PLACEHOLDER
|
||||||
@ -444,7 +469,7 @@ export function canFilletSelection(selection: Selections) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function canExtrudeSelectionItem(selection: Selections, i: number) {
|
function canExtrudeSelectionItem(selection: Selections__old, i: number) {
|
||||||
const isolatedSelection = {
|
const isolatedSelection = {
|
||||||
...selection,
|
...selection,
|
||||||
codeBasedSelections: [selection.codeBasedSelections[i]],
|
codeBasedSelections: [selection.codeBasedSelections[i]],
|
||||||
@ -459,7 +484,7 @@ function canExtrudeSelectionItem(selection: Selections, i: number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This accounts for non-geometry selections under "other"
|
// This accounts for non-geometry selections under "other"
|
||||||
export type ResolvedSelectionType = [Selection['type'] | 'other', number]
|
export type ResolvedSelectionType = [Selection__old['type'] | 'other', number]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In the future, I'd like this function to properly return the type of each selected entity based on
|
* In the future, I'd like this function to properly return the type of each selected entity based on
|
||||||
@ -469,7 +494,7 @@ export type ResolvedSelectionType = [Selection['type'] | 'other', number]
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function getSelectionType(
|
export function getSelectionType(
|
||||||
selection?: Selections
|
selection?: Selections__old
|
||||||
): ResolvedSelectionType[] {
|
): ResolvedSelectionType[] {
|
||||||
if (!selection) return []
|
if (!selection) return []
|
||||||
const extrudableCount = selection.codeBasedSelections.filter((_, i) => {
|
const extrudableCount = selection.codeBasedSelections.filter((_, i) => {
|
||||||
@ -486,7 +511,7 @@ export function getSelectionType(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getSelectionTypeDisplayText(
|
export function getSelectionTypeDisplayText(
|
||||||
selection?: Selections
|
selection?: Selections__old
|
||||||
): string | null {
|
): string | null {
|
||||||
const selectionsByType = getSelectionType(selection)
|
const selectionsByType = getSelectionType(selection)
|
||||||
|
|
||||||
@ -518,7 +543,7 @@ export function canSubmitSelectionArg(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function codeToIdSelections(
|
function codeToIdSelections(
|
||||||
codeBasedSelections: Selection[]
|
codeBasedSelections: Selection__old[]
|
||||||
): SelectionToEngine[] {
|
): SelectionToEngine[] {
|
||||||
return codeBasedSelections
|
return codeBasedSelections
|
||||||
.flatMap(({ type, range, ...rest }): null | SelectionToEngine[] => {
|
.flatMap(({ type, range, ...rest }): null | SelectionToEngine[] => {
|
||||||
@ -684,13 +709,13 @@ export async function sendSelectEventToEngine(
|
|||||||
|
|
||||||
export function updateSelections(
|
export function updateSelections(
|
||||||
pathToNodeMap: PathToNodeMap,
|
pathToNodeMap: PathToNodeMap,
|
||||||
prevSelectionRanges: Selections,
|
prevSelectionRanges: Selections__old,
|
||||||
ast: Program | Error
|
ast: Program | Error
|
||||||
): Selections | Error {
|
): Selections__old | Error {
|
||||||
if (err(ast)) return ast
|
if (err(ast)) return ast
|
||||||
|
|
||||||
const newSelections = Object.entries(pathToNodeMap)
|
const newSelections = Object.entries(pathToNodeMap)
|
||||||
.map(([index, pathToNode]): Selection | undefined => {
|
.map(([index, pathToNode]): Selection__old | undefined => {
|
||||||
const nodeMeta = getNodeFromPath<Expr>(ast, pathToNode)
|
const nodeMeta = getNodeFromPath<Expr>(ast, pathToNode)
|
||||||
if (err(nodeMeta)) return undefined
|
if (err(nodeMeta)) return undefined
|
||||||
const node = nodeMeta.node
|
const node = nodeMeta.node
|
||||||
@ -699,7 +724,7 @@ export function updateSelections(
|
|||||||
type: prevSelectionRanges.codeBasedSelections[Number(index)]?.type,
|
type: prevSelectionRanges.codeBasedSelections[Number(index)]?.type,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.filter((x?: Selection) => x !== undefined) as Selection[]
|
.filter((x?: Selection__old) => x !== undefined) as Selection__old[]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
codeBasedSelections:
|
codeBasedSelections:
|
||||||
|
@ -5,14 +5,14 @@ import {
|
|||||||
CommandArgumentWithName,
|
CommandArgumentWithName,
|
||||||
KclCommandValue,
|
KclCommandValue,
|
||||||
} from 'lib/commandTypes'
|
} from 'lib/commandTypes'
|
||||||
import { Selections } from 'lib/selections'
|
import { Selections__old } from 'lib/selections'
|
||||||
import { getCommandArgumentKclValuesOnly } from 'lib/commandUtils'
|
import { getCommandArgumentKclValuesOnly } from 'lib/commandUtils'
|
||||||
|
|
||||||
export type CommandBarContext = {
|
export type CommandBarContext = {
|
||||||
commands: Command[]
|
commands: Command[]
|
||||||
selectedCommand?: Command
|
selectedCommand?: Command
|
||||||
currentArgument?: CommandArgument<unknown> & { name: string }
|
currentArgument?: CommandArgument<unknown> & { name: string }
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections__old
|
||||||
argumentsToSubmit: { [x: string]: unknown }
|
argumentsToSubmit: { [x: string]: unknown }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,12 @@ import {
|
|||||||
parse,
|
parse,
|
||||||
recast,
|
recast,
|
||||||
} from 'lang/wasm'
|
} from 'lang/wasm'
|
||||||
import { Axis, Selection, Selections, updateSelections } from 'lib/selections'
|
import {
|
||||||
|
Axis,
|
||||||
|
Selection__old,
|
||||||
|
Selections__old,
|
||||||
|
updateSelections,
|
||||||
|
} from 'lib/selections'
|
||||||
import { assign, fromPromise, setup } from 'xstate'
|
import { assign, fromPromise, setup } from 'xstate'
|
||||||
import { SidebarType } from 'components/ModelingSidebar/ModelingPanes'
|
import { SidebarType } from 'components/ModelingSidebar/ModelingPanes'
|
||||||
import {
|
import {
|
||||||
@ -70,7 +75,7 @@ export const MODELING_PERSIST_KEY = 'MODELING_PERSIST_KEY'
|
|||||||
export type SetSelections =
|
export type SetSelections =
|
||||||
| {
|
| {
|
||||||
selectionType: 'singleCodeCursor'
|
selectionType: 'singleCodeCursor'
|
||||||
selection?: Selection
|
selection?: Selection__old
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
selectionType: 'otherSelection'
|
selectionType: 'otherSelection'
|
||||||
@ -78,12 +83,12 @@ export type SetSelections =
|
|||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
selectionType: 'completeSelection'
|
selectionType: 'completeSelection'
|
||||||
selection: Selections
|
selection: Selections__old
|
||||||
updatedPathToNode?: PathToNode
|
updatedPathToNode?: PathToNode
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
selectionType: 'mirrorCodeMirrorSelections'
|
selectionType: 'mirrorCodeMirrorSelections'
|
||||||
selection: Selections
|
selection: Selections__old
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MouseState =
|
export type MouseState =
|
||||||
@ -283,7 +288,7 @@ export interface ModelingMachineContext {
|
|||||||
currentMode: ToolbarModeName
|
currentMode: ToolbarModeName
|
||||||
currentTool: SketchTool
|
currentTool: SketchTool
|
||||||
selection: string[]
|
selection: string[]
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections__old
|
||||||
sketchDetails: SketchDetails | null
|
sketchDetails: SketchDetails | null
|
||||||
sketchPlaneId: string
|
sketchPlaneId: string
|
||||||
sketchEnginePathId: string
|
sketchEnginePathId: string
|
||||||
|
Reference in New Issue
Block a user