Users should be able to select points (not just lines) (#97)

* update selection datastructure to accomodate more selection metadata

* Users should be able to select points (not just lines)
This commit is contained in:
Kurt Hutten
2023-04-03 16:05:25 +10:00
committed by GitHub
parent 7013eb861d
commit a8b68bab6a
25 changed files with 292 additions and 146 deletions

View File

@ -25,8 +25,8 @@ export const RemoveConstrainingValues = () => {
const [transformInfos, setTransformInfos] = useState<TransformInfo[]>()
useEffect(() => {
if (!ast) return
const paths = selectionRanges.map((selectionRange) =>
getNodePathFromSourceRange(ast, selectionRange)
const paths = selectionRanges.codeBasedSelections.map(({ range }) =>
getNodePathFromSourceRange(ast, range)
)
const nodes = paths.map(
(pathToNode) => getNodeFromPath<Value>(ast, pathToNode).node
@ -37,15 +37,19 @@ export const RemoveConstrainingValues = () => {
toolTips.includes(node.callee.name as any)
)
const theTransforms = getRemoveConstraintsTransforms(
selectionRanges,
ast,
'removeConstrainingValues'
)
setTransformInfos(theTransforms)
try {
const theTransforms = getRemoveConstraintsTransforms(
selectionRanges,
ast,
'removeConstrainingValues'
)
setTransformInfos(theTransforms)
const _enableHorz = isAllTooltips && theTransforms.every(Boolean)
setEnableHorz(_enableHorz)
const _enableHorz = isAllTooltips && theTransforms.every(Boolean)
setEnableHorz(_enableHorz)
} catch (e) {
console.error(e)
}
}, [guiMode, selectionRanges])
if (guiMode.mode !== 'sketch') return null