1
0
Fork 0

sparkles: Added support for offset and margin options

This commit is contained in:
Joost De Cock 2019-02-13 14:17:18 +01:00
parent 93b3a8faa6
commit d7cdbe1680
2 changed files with 13 additions and 6 deletions

View file

@ -66,8 +66,8 @@ This plugin provides the `cutonfold` macro.
```js
macro('cutonfold', {
from: points.cbNeck
, to: points.cbHips
from: points.cbNeck,
to: points.cbHips
});
```
@ -75,6 +75,8 @@ macro('cutonfold', {
- `to`: A point object at the start of the cut-on-fold indicator
- `from`: A point object at the end of the cut-on-fold indicator
- `offset`: Distance in mm that the cut-on-fold line is offset from the line between `from` and `to`. Default: 50mm.
- `margin`: Percentange the cut-on-fold line will remain from the `from` and `to` points. Default: 5%.
As all freesewing macros, bundle these parameters into a single object.

View file

@ -15,13 +15,18 @@ export default {
macros: {
cutonfold: function(so) {
let points = this.points;
points.cutonfoldFrom = so.to.shiftTowards(so.from, 30);
points.cutonfoldTo = so.from.shiftTowards(so.to, 30);
let so = {
offset: 50,
margin: 0.05,
...so
};
points.cutonfoldFrom = so.to.shiftFractionTowards(so.from, so.margin);
points.cutonfoldTo = so.from.shiftFractionTowards(so.to, so.margin);
points.cutonfoldVia1 = so.to
.shiftTowards(so.from, 50)
.shiftTowards(so.from, so.offset)
.rotate(-90, points.cutonfoldFrom);
points.cutonfoldVia2 = so.from
.shiftTowards(so.to, 50)
.shiftTowards(so.to, so.offset)
.rotate(90, points.cutonfoldTo);
let text = so.grainline ? "cutOnFoldAndGrainline" : "cutOnFold";
this.paths.cutonfold = new this.Path()