Retain sketch selection segment color after adding a constraint to the segment (#2700)

* Start of basic test (not yet failing)

* Add a little logging to get the lay of the scene object land

* Move test colors to utility, test broken

* Get accurate test that is only broken with highlighted color behavior

* Working implementation but now initial segment color sticks around too long

* Make sure segment base color is always the theme color

* Remove console logs, refactor a couple lines to use if statements instead of inline booleans

* Fix new test

* Make origin color update like the other segment types

* fmt

* Fix issue where initially-selected segments lose highlight after hover

* Undo this tweaking of the selection logic, this is really only about the clientSideEntities

* Remove unused exports

* Remove unnecessary code change from ModelingMachineProvider

* Remove newline

* Update src/clientSideScene/sceneEntities.ts

Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>

---------

Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com>
This commit is contained in:
Frank Noirot
2024-06-22 04:49:31 -04:00
committed by GitHub
parent 8194f8b70b
commit a8c1a14d48
6 changed files with 125 additions and 17 deletions

View File

@ -278,7 +278,7 @@ export function processCodeMirrorRanges({
}
}
function updateSceneObjectColors(codeBasedSelections: Selection[]) {
export function updateSceneObjectColors(codeBasedSelections: Selection[]) {
let updated: Program
try {
updated = parse(recast(kclManager.ast))
@ -301,6 +301,7 @@ function updateSceneObjectColors(codeBasedSelections: Selection[]) {
const groupHasCursor = codeBasedSelections.some((selection) => {
return isOverlap(selection.range, [node.start, node.end])
})
const color = groupHasCursor
? 0x0000ff
: segmentGroup?.userData?.baseColor || 0xffffff