Select axis and relevant constraints (#1154)

* update select logic for axis

* add abs Y and X constraints

* make selection tests much more thorough including axis selections

* fmt

* tweak

* tweak

* add snap to XY constraints

* side just for screenshot diffs

* update angle constraint to allow axis seleciton

* fix bux in absY constraint

* add sorting to constraintns

* add issue to TODO

* Revert "side just for screenshot diffs"

This reverts commit aae7874859.

* fix number because something must have updated in the engine

* typo

* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)

* Revert "add sorting to constraintns"

This reverts commit 36054a4069.

* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)

* triggre CI

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Kurt Hutten
2023-12-01 20:18:51 +11:00
committed by GitHub
parent f3083eb59d
commit 3eb92bb0c4
10 changed files with 391 additions and 72 deletions

View File

@ -25,7 +25,7 @@ import { kclManager } from 'lang/KclSinglton'
const getModalInfo = createSetAngleLengthModal(SetAngleLengthModal)
export function setAngleLengthInfo({
export function angleLengthInfo({
selectionRanges,
angleOrLength = 'setLength',
}: {
@ -50,7 +50,10 @@ export function setAngleLengthInfo({
kclManager.ast,
angleOrLength
)
const enabled = isAllTooltips && transforms.every(Boolean)
const enabled =
selectionRanges.codeBasedSelections.length <= 1 &&
isAllTooltips &&
transforms.every(Boolean)
return { enabled, transforms }
}
@ -64,7 +67,7 @@ export async function applyConstraintAngleLength({
modifiedAst: Program
pathToNodeMap: PathToNodeMap
}> {
const { transforms } = setAngleLengthInfo({ selectionRanges, angleOrLength })
const { transforms } = angleLengthInfo({ selectionRanges, angleOrLength })
const { valueUsedInTransform } = transformAstSketchLines({
ast: JSON.parse(JSON.stringify(kclManager.ast)),
selectionRanges,