Fix bug with selection order on multi-select constraints (#4138)

* Sort selections in order of appearance before applying `transformSecondarySketchLinesTagFirst`

* Add an integration test for this sorting behavior

* Remove console logs from test
This commit is contained in:
Frank Noirot
2024-10-11 09:49:58 -04:00
committed by GitHub
parent 1fd4aa9ede
commit 23c2aa948a
2 changed files with 84 additions and 2 deletions

View File

@ -1559,7 +1559,9 @@ export function transformSecondarySketchLinesTagFirst({
}
| Error {
// let node = structuredClone(ast)
const primarySelection = selectionRanges.codeBasedSelections[0].range
const primarySelection = selectionRanges.codeBasedSelections.sort(
(a, b) => a.range[0] - b.range[0]
)[0].range
const _tag = giveSketchFnCallTag(ast, primarySelection, forceSegName)
if (err(_tag)) return _tag