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

@ -26,8 +26,8 @@ export const EqualLength = () => {
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
@ -52,7 +52,10 @@ export const EqualLength = () => {
)
const theTransforms = getTransformInfos(
selectionRanges.slice(1),
{
...selectionRanges,
codeBasedSelections: selectionRanges.codeBasedSelections.slice(1),
},
ast,
'equalLength'
)