Improve editor history, CAD tools, and ruler workflows

This commit is contained in:
Formsmith
2026-07-14 09:43:37 +03:00
parent 20731043e4
commit 400c4bf86e
23 changed files with 1727 additions and 388 deletions
+8 -2
View File
@@ -29,8 +29,14 @@ export function shapeDepth(shape: WorkplaneShape) {
return shape.depth ?? shape.size;
}
function edgeTreatmentPreserveZone(shape: WorkplaneShape): number {
const own = Math.max(...(shape.edgeTreatments ?? []).map((feature) => feature.amount), 0);
const child = Math.max(...(shape.groupedShapes ?? []).map(edgeTreatmentPreserveZone), 0);
return Math.max(own, child);
}
export function preservesEdgeTreatmentSize(shape: WorkplaneShape) {
return shape.edgeResizeMode === "preserve" && Boolean(shape.importedMesh && shape.edgeTreatments?.length);
return shape.edgeResizeMode === "preserve" && Boolean(shape.importedMesh && edgeTreatmentPreserveZone(shape) > 0);
}
function edgePreservedCoordinate(value: number, baseSize: number, targetSize: number, centered: boolean, requestedZone: number) {
@@ -57,7 +63,7 @@ export function resizedImportedCoordinates(shape: WorkplaneShape, sourcePosition
const depth = shapeDepth(shape);
const height = shape.height;
const preserve = preservesEdgeTreatmentSize(shape);
const zone = preserve ? Math.max(...(shape.edgeTreatments ?? []).map((feature) => feature.amount), 0) : 0;
const zone = preserve ? edgeTreatmentPreserveZone(shape) : 0;
const positions = new Array<number>(sourcePositions.length);
for (let index = 0; index + 2 < sourcePositions.length; index += 3) {
if (preserve) {