use svg transforms to flip and rotate cutlist parts
This commit is contained in:
parent
cf3d85b223
commit
5c80c8dbc3
3 changed files with 50 additions and 100 deletions
|
@ -17,16 +17,16 @@ export const cutonfoldHooks = {
|
|||
}
|
||||
// Export macros
|
||||
export const cutonfoldMacros = {
|
||||
cutonfold: function (so, { points, paths, Path, complete, setCutOnFold, setGrain, scale }) {
|
||||
cutonfold: function (so, { points, paths, Path, complete, store, scale }) {
|
||||
if (so === false) {
|
||||
delete points.cutonfoldFrom
|
||||
delete points.cutonfoldTo
|
||||
delete points.cutonfoldVia1
|
||||
delete points.cutonfoldVia2
|
||||
delete paths.cutonfold
|
||||
delete paths.cutonfoldCutonfold
|
||||
// setCutOnFold relies on plugin-cutlist
|
||||
if (typeof setCutOnFold === 'function') {
|
||||
setCutOnFold(false) // Restore default
|
||||
if (typeof store.cutlist?.setCutOnFold === 'function') {
|
||||
store.cutlist.setCutOnFold(false) // Restore default
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
@ -36,9 +36,9 @@ export const cutonfoldMacros = {
|
|||
prefix: 'cutonfold',
|
||||
...so,
|
||||
}
|
||||
if (typeof setCutOnFold === 'function') {
|
||||
setCutOnFold(so.from, so.to)
|
||||
if (so.grainline) setGrain(so.from.angle(so.to))
|
||||
if (typeof store.cutlist?.setCutOnFold === 'function') {
|
||||
store.cutlist.setCutOnFold(so.from, so.to)
|
||||
if (so.grainline) store.cutlist.setGrain(so.from.angle(so.to))
|
||||
}
|
||||
if (complete) {
|
||||
points[so.prefix + 'From'] = so.from.shiftFractionTowards(so.to, so.margin / 100)
|
||||
|
|
|
@ -17,12 +17,12 @@ export const grainlineHooks = {
|
|||
],
|
||||
}
|
||||
export const grainlineMacros = {
|
||||
grainline: function (so = {}, { points, paths, Path, complete, setGrain }) {
|
||||
grainline: function (so = {}, { points, paths, Path, complete, store }) {
|
||||
if (so === false) {
|
||||
delete points.grainlineFrom
|
||||
delete points.grainlineTo
|
||||
delete paths.grainline
|
||||
setGrain(90) // Restoring default
|
||||
if (store.cutlist?.setGrain) store.cutlist.setGrain(90) // Restoring default
|
||||
return true
|
||||
}
|
||||
so = {
|
||||
|
@ -30,8 +30,8 @@ export const grainlineMacros = {
|
|||
...so,
|
||||
}
|
||||
// setGrain relies on plugin-cutlist
|
||||
if (typeof setGrain === 'function') {
|
||||
setGrain(so.from.angle(so.to))
|
||||
if (typeof store.cutlist?.setGrain === 'function') {
|
||||
store.cutlist.setGrain(so.from.angle(so.to))
|
||||
}
|
||||
if (complete) {
|
||||
points.grainlineFrom = so.from.shiftFractionTowards(so.to, 0.05)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue