From 27d3c85e829aa6323448a9c2e4ce3d534d252e69 Mon Sep 17 00:00:00 2001 From: Benjamin F Date: Sun, 19 Mar 2023 05:32:09 -0700 Subject: [PATCH 1/4] fix(plugin-cutlist): Correct updated method names --- plugins/plugin-cutlist/src/index.mjs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/plugin-cutlist/src/index.mjs b/plugins/plugin-cutlist/src/index.mjs index dbf97bbca9a..2ac39995683 100644 --- a/plugins/plugin-cutlist/src/index.mjs +++ b/plugins/plugin-cutlist/src/index.mjs @@ -4,10 +4,10 @@ export const plugin = { name, version, store: [ - [['cutlist.addCut'], addCut], - [['cutlist.removeCut'], removeCut], - [['cutlist.setGrain'], setGrain], - [['cutlist.setCutOnFold'], setCutOnFold], + ['cutlist.addCut', addCut], + ['cutlist.removeCut', removeCut], + ['cutlist.setGrain', setGrain], + ['cutlist.setCutOnFold', setCutOnFold], ], } From 9012fe26b48d0326e96c2190caba8d8ee66c970d Mon Sep 17 00:00:00 2001 From: Benjamin F Date: Sun, 19 Mar 2023 05:44:57 -0700 Subject: [PATCH 2/4] fix(plugin-cutlist): Prevent store.get() warning messages --- plugins/plugin-cutlist/src/index.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/plugin-cutlist/src/index.mjs b/plugins/plugin-cutlist/src/index.mjs index 2ac39995683..7400a3862cd 100644 --- a/plugins/plugin-cutlist/src/index.mjs +++ b/plugins/plugin-cutlist/src/index.mjs @@ -42,7 +42,7 @@ function addCut(store, so = {}) { return store } const path = ['cutlist', partName, 'materials', material] - const existing = store.get(path) || [] + const existing = store.get(path, []) store.set(path, existing.concat({ cut, identical, bias, ignoreOnFold })) return store From 2efc3d7f205f4c0553e705bd91394e2888d32a16 Mon Sep 17 00:00:00 2001 From: Benjamin F Date: Sun, 19 Mar 2023 05:45:13 -0700 Subject: [PATCH 3/4] fix(plugin-title): Prevent store.get() warning messages --- plugins/plugin-title/src/index.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/plugin-title/src/index.mjs b/plugins/plugin-title/src/index.mjs index 9f8d1d840eb..73c138e2ba2 100644 --- a/plugins/plugin-title/src/index.mjs +++ b/plugins/plugin-title/src/index.mjs @@ -79,7 +79,7 @@ export const plugin = { } // Cut List instructions - const partCutlist = store.get(['cutlist', part.name]) + const partCutlist = store.get(['cutlist', part.name], []) // if there's a cutlist and it should be included if (so.cutlist && partCutlist?.materials) { // get the default cutonfold From ae0a311328d0cf4cbe78751db3942d9b8a86131b Mon Sep 17 00:00:00 2001 From: Benjamin F Date: Sun, 19 Mar 2023 05:51:41 -0700 Subject: [PATCH 4/4] 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