diff --git a/docs/docs/api/interfaces/makerjs.exporter.iflowannotation.html b/docs/docs/api/interfaces/makerjs.exporter.iflowannotation.html index 135713cd..162b41be 100644 --- a/docs/docs/api/interfaces/makerjs.exporter.iflowannotation.html +++ b/docs/docs/api/interfaces/makerjs.exporter.iflowannotation.html @@ -39,7 +39,7 @@
Optional className
Optional cssStyle
Optional fill
Optional stroke
Optional strokeWidth
Optional byLayers
Optional fillRule
Optional origin
Optional annotate
Optional className
Optional closingTags
Optional cssStyle
Optional fill
Optional fillRule
Optional flow
Optional fontSize
Optional layerOptions
layerOptional origin
Optional scale
Optional scalingStrokescalingStroke: boolean
Optional stroke
Optional strokeLineC
strokeLineCap: string
@@ -305,7 +305,7 @@
@@ -320,7 +320,7 @@ svgAttrs: IXmlTagAttrs
@@ -351,7 +351,7 @@
Optional strokeWidth
Optional svgAttrs
Optional useSvgPath<
useSvgPathOnly: boolean
@@ -366,7 +366,7 @@ viewBox: boolean
diff --git a/docs/docs/api/interfaces/makerjs.importer.isvgimportoptions.html b/docs/docs/api/interfaces/makerjs.importer.isvgimportoptions.html
index c3a2ca08..b4d4595e 100644
--- a/docs/docs/api/interfaces/makerjs.importer.isvgimportoptions.html
+++ b/docs/docs/api/interfaces/makerjs.importer.isvgimportoptions.html
@@ -39,7 +39,7 @@
Optional viewBox
Optional bezierAccuracy
bezierAccuracy: number
diff --git a/docs/docs/api/modules/makerjs.exporter.html b/docs/docs/api/modules/makerjs.exporter.html
index 0df8c75e..5a88e4ec 100644
--- a/docs/docs/api/modules/makerjs.exporter.html
+++ b/docs/docs/api/modules/makerjs.exporter.html
@@ -68,7 +68,7 @@ svgUnit: svgUnitConversion
@@ -84,13 +84,13 @@ -
@@ -101,7 +101,7 @@ -
-
@@ -118,6 +118,12 @@
+ -
+
+
+
@@ -549,7 +555,7 @@
@@ -577,7 +583,7 @@
svgUnit
Functions
chainToSVGPathData
-- chain
ToSVGPathData(chain: IChain, offset: IPoint, accuracy?: number): string
+ - chain
ToSVGPathData(c: IChain, offset: IPoint, accuracy?: number, clockwise?: boolean): string
chainToSVGPathData
Parameters
chain: IChain
+c: IChain
Chain to convert.
Optional accuracy: Optional accuracy of SVG path data.
Optional clockwise: boolean
+Optional flag to specify desired winding direction for nonzero fill rule.
+Returns string
String of SVG path data.
@@ -134,7 +140,7 @@pathToSVGPathData
toSVG
Returns string
@@ -600,7 +606,7 @@
Returns string
@@ -633,7 +639,7 @@
@@ -665,7 +671,7 @@
toSVGPathData
Returns
diff --git a/docs/docs/api/modules/makerjs.importer.html b/docs/docs/api/modules/makerjs.importer.html
index f4fd03bc..ab00caf8 100644
--- a/docs/docs/api/modules/makerjs.importer.html
+++ b/docs/docs/api/modules/makerjs.importer.html
@@ -35,7 +35,7 @@
diff --git a/docs/target/js/browser.maker.js b/docs/target/js/browser.maker.js
index e6a9547f..37e8fe3b 100644
--- a/docs/target/js/browser.maker.js
+++ b/docs/target/js/browser.maker.js
@@ -39,7 +39,7 @@ and limitations under the License.
* author: Dan Marshall / Microsoft Corporation
* maintainers: Dan Marshall
* homepage: https://maker.js.org
- * version: 0.19.0
+ * version: 0.19.1
*
* browserify:
* license: MIT (http://opensource.org/licenses/MIT)
@@ -7592,20 +7592,29 @@ var MakerJs;
/**
* Convert a chain to SVG path data.
*
- * @param chain Chain to convert.
+ * @param c Chain to convert.
* @param offset IPoint relative offset point.
* @param accuracy Optional accuracy of SVG path data.
+ * @param clockwise Optional flag to specify desired winding direction for nonzero fill rule.
* @returns String of SVG path data.
*/
- function chainToSVGPathData(chain, offset, accuracy) {
+ function chainToSVGPathData(c, offset, accuracy, clockwise) {
function offsetPoint(p) {
return MakerJs.point.add(p, offset);
}
- var first = chain.links[0];
+ // If clockwise direction is specified, check if chain needs to be reversed
+ if (clockwise !== undefined) {
+ var isClockwise = MakerJs.measure.isChainClockwise(c);
+ if (isClockwise !== null && isClockwise !== clockwise) {
+ c = MakerJs.cloneObject(c);
+ MakerJs.chain.reverse(c);
+ }
+ }
+ var first = c.links[0];
var firstPoint = offsetPoint(svgCoords(first.endPoints[first.reversed ? 1 : 0]));
var d = ['M', MakerJs.round(firstPoint[0], accuracy), MakerJs.round(firstPoint[1], accuracy)];
- for (var i = 0; i < chain.links.length; i++) {
- var link = chain.links[i];
+ for (var i = 0; i < c.links.length; i++) {
+ var link = c.links[i];
var pathContext = link.walkedPath.pathContext;
var fn = chainLinkToPathDataMap[pathContext.type];
if (fn) {
@@ -7617,7 +7626,7 @@ var MakerJs;
fn(fixedPath, offsetPoint(svgCoords(link.endPoints[link.reversed ? 0 : 1])), link.reversed, d, accuracy);
}
}
- if (chain.endless) {
+ if (c.endless) {
d.push('Z');
}
return d.join(' ');
@@ -7693,16 +7702,16 @@ var MakerJs;
}
pathDataByLayer[layer] = [];
function doChains(cs, clockwise) {
- cs.forEach(function (chain) {
- if (chain.links.length > 1) {
- var pathData = chainToSVGPathData(chain, offset, accuracy);
+ cs.forEach(function (c) {
+ if (c.links.length > 1) {
+ var pathData = chainToSVGPathData(c, offset, accuracy, clockwise);
pathDataByLayer[layer].push(pathData);
}
else {
- single(chain.links[0].walkedPath, clockwise);
+ single(c.links[0].walkedPath, clockwise);
}
- if (chain.contains) {
- doChains(chain.contains, !clockwise);
+ if (c.contains) {
+ doChains(c.contains, !clockwise);
}
});
}
@@ -10523,7 +10532,7 @@ var MakerJs;
];
})(models = MakerJs.models || (MakerJs.models = {}));
})(MakerJs || (MakerJs = {}));
-MakerJs.version = "0.19.0";
+MakerJs.version = "0.19.1";
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"clone":2,"graham_scan":3,"kdbush":4}]},{},[]);
diff --git a/package-lock.json b/package-lock.json
index 23c7ce21..fcf1c3bb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -4524,7 +4524,7 @@
},
"packages/maker.js": {
"name": "makerjs",
- "version": "0.19.0",
+ "version": "0.19.1",
"license": "Apache-2.0",
"dependencies": {
"@danmarshall/jscad-typings": "^1.0.0",
diff --git a/packages/maker.js/package-lock.json b/packages/maker.js/package-lock.json
index 1a7c03e7..9f9f4fc4 100644
--- a/packages/maker.js/package-lock.json
+++ b/packages/maker.js/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "makerjs",
- "version": "0.19.0",
+ "version": "0.19.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/maker.js/package.json b/packages/maker.js/package.json
index 69dfea1a..faac64ba 100644
--- a/packages/maker.js/package.json
+++ b/packages/maker.js/package.json
@@ -1,6 +1,6 @@
{
"name": "makerjs",
- "version": "0.19.0",
+ "version": "0.19.1",
"description": "Maker.js, a Microsoft Garage project, is a JavaScript library for creating and sharing modular line drawings for CNC and laser cutters.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
fromSVGPathData