From ae0a311328d0cf4cbe78751db3942d9b8a86131b Mon Sep 17 00:00:00 2001 From: Benjamin F Date: Sun, 19 Mar 2023 05:51:41 -0700 Subject: [PATCH] fix(workbench): Rotate parts in both directions to align grainline in cutting layout --- .../components/workbench/layout/cut/plugin-cut-layout.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sites/shared/components/workbench/layout/cut/plugin-cut-layout.mjs b/sites/shared/components/workbench/layout/cut/plugin-cut-layout.mjs index 686f56dacc7..e70e1ae5371 100644 --- a/sites/shared/components/workbench/layout/cut/plugin-cut-layout.mjs +++ b/sites/shared/components/workbench/layout/cut/plugin-cut-layout.mjs @@ -167,9 +167,10 @@ export const cutLayoutPlugin = function (material, grainAngle) { if (partGrain === undefined) return // the amount to rotate is the difference between this part's grain angle (as drafted) and the fabric's grain angle - let toRotate = Math.abs(grainAngle - partGrain) + let toRotate = grainAngle - partGrain // don't over rotate if (toRotate >= 180) toRotate -= 180 + else if (toRotate <= -180) toRotate += 180 // if there's no difference, don't rotate if (toRotate === 0) return