feat: improve shape tools and project previews

This commit is contained in:
Formsmith746
2026-08-28 13:24:32 +03:00
parent 2486b998c8
commit 34528e6393
33 changed files with 2071 additions and 343 deletions
+24
View File
@@ -19,6 +19,7 @@ import {
shapeDepth,
shapeHasTaper,
shapeOverallFootprintDimensions,
shapeTransformShouldRemainEditable,
shapeTaperDimensions,
shapeTaperScaleAt,
shapeWidth,
@@ -129,6 +130,29 @@ describe("workplane shape helpers", () => {
expect(canonical.groupedShapes?.[0].mirrorZ).toBeUndefined();
});
it("keeps rotated groups editable so they can still be ungrouped", () => {
const child = shape({ id: "child" });
const group = shape({
id: "group",
kind: "mesh",
rotation: 45,
groupedBaseWidth: 20,
groupedBaseDepth: 20,
groupedBaseHeight: 20,
groupedShapes: [child],
});
expect(shapeTransformShouldRemainEditable(group)).toBe(true);
expect(shapeTransformShouldRemainEditable(shape({ rotation: 45 }))).toBe(false);
expect(canonicalizeShape(group)).toMatchObject({
rotation: 45,
groupedBaseWidth: 20,
groupedBaseDepth: 20,
groupedBaseHeight: 20,
groupedShapes: [{ id: "child" }],
});
});
it("assigns fresh object IDs throughout duplicated group trees", () => {
const original = shape({
id: "outer-group",