fix(assembly): update flip-detection baseline during drag steps #312
Reference in New Issue
Block a user
Delete Branch "fix/assembly-drag-flip-detection"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
During drag operations,
validateNewPlacements()compared each solver result against the pre-drag positions saved once inpreDrag(). As the user dragged further, the cumulative rotation from that fixed baseline easily exceeded the 91-degree threshold, causing valid intermediate results to be rejected with "flipped orientation" warnings (107–155+ degrees observed) and making parts appear to explode.Root Cause
preDrag()callssavePlacementsForUndo()once to capture baseline positions. EachdoDragStep()then callsvalidateNewPlacements()which compares the solver result against that fixed baseline. For large or rotational drags, the cumulative angle from pre-drag to current state easily exceeds 91 degrees — even though each incremental step is small and valid.Fix
Call
savePlacementsForUndo()after each accepted drag step (aftersetNewPlacements()succeeds indoDragStep()). This updates the baseline so the flip check compares against the last accepted state rather than the original pre-drag origin.The non-drag
solve()path is unaffected — it still saves once before solving and validates against that single baseline, which is correct for one-shot solves.Testing
Ignoring bad solve, part (X) flipped orientation (155.5 degrees)