makerjs 0.17.4 → 0.17.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.maker.js +18 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -4
- package/package.json +1 -1
package/dist/browser.maker.js
CHANGED
|
@@ -39,7 +39,7 @@ and limitations under the License.
|
|
|
39
39
|
* author: Dan Marshall / Microsoft Corporation
|
|
40
40
|
* maintainers: Dan Marshall <danmar@microsoft.com>
|
|
41
41
|
* homepage: https://maker.js.org
|
|
42
|
-
* version: 0.17.
|
|
42
|
+
* version: 0.17.6
|
|
43
43
|
*
|
|
44
44
|
* browserify:
|
|
45
45
|
* license: MIT (http://opensource.org/licenses/MIT)
|
|
@@ -2356,7 +2356,7 @@ var MakerJs;
|
|
|
2356
2356
|
var captions = [];
|
|
2357
2357
|
function tryAddCaption(m, offset, layer) {
|
|
2358
2358
|
if (m.caption) {
|
|
2359
|
-
captions.push({ text: m.caption.text, anchor: MakerJs.path.clone(m.caption.anchor, offset), layer: (m.caption.anchor.layer || layer) });
|
|
2359
|
+
captions.push({ text: m.caption.text, anchor: MakerJs.path.clone(m.caption.anchor, MakerJs.point.add(m.origin, offset)), layer: (m.caption.anchor.layer || layer) });
|
|
2360
2360
|
}
|
|
2361
2361
|
}
|
|
2362
2362
|
tryAddCaption(modelContext, modelContext.origin, modelContext.layer);
|
|
@@ -4104,8 +4104,21 @@ var MakerJs;
|
|
|
4104
4104
|
//lines are both vertical, see if x are the same
|
|
4105
4105
|
return MakerJs.round(slopeA.line.origin[0] - slopeB.line.origin[0]) == 0;
|
|
4106
4106
|
}
|
|
4107
|
-
//lines are parallel, but not vertical
|
|
4108
|
-
|
|
4107
|
+
//lines are parallel, but not vertical
|
|
4108
|
+
//create array of slopes
|
|
4109
|
+
var slopes = [slopeA, slopeB];
|
|
4110
|
+
//get angle of each line
|
|
4111
|
+
var angles = slopes.map(function (s) { return MakerJs.angle.toDegrees(Math.atan(s.slope)); });
|
|
4112
|
+
//create an array of each line cloned
|
|
4113
|
+
var lines = slopes.map(function (s) { return MakerJs.path.clone(s.line); });
|
|
4114
|
+
//use the first line as the rotation origin
|
|
4115
|
+
var origin = lines[0].origin;
|
|
4116
|
+
//rotate each line to flat
|
|
4117
|
+
lines.forEach(function (l, i) { return MakerJs.path.rotate(l, -angles[i], origin); });
|
|
4118
|
+
//get average y-intercept of each line
|
|
4119
|
+
var averageYs = lines.map(function (l) { return (l.origin[1] + l.end[1]) / 2; });
|
|
4120
|
+
//see if y-intercept is the same
|
|
4121
|
+
return MakerJs.round(averageYs[0] - averageYs[1], .00001) == 0;
|
|
4109
4122
|
}
|
|
4110
4123
|
measure.isSlopeEqual = isSlopeEqual;
|
|
4111
4124
|
/**
|
|
@@ -10305,6 +10318,6 @@ var MakerJs;
|
|
|
10305
10318
|
];
|
|
10306
10319
|
})(models = MakerJs.models || (MakerJs.models = {}));
|
|
10307
10320
|
})(MakerJs || (MakerJs = {}));
|
|
10308
|
-
MakerJs.version = "0.17.
|
|
10321
|
+
MakerJs.version = "0.17.6";
|
|
10309
10322
|
|
|
10310
10323
|
},{"clone":2,"graham_scan":3,"kdbush":4}]},{},[]);
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1939,7 +1939,7 @@ var MakerJs;
|
|
|
1939
1939
|
var captions = [];
|
|
1940
1940
|
function tryAddCaption(m, offset, layer) {
|
|
1941
1941
|
if (m.caption) {
|
|
1942
|
-
captions.push({ text: m.caption.text, anchor: MakerJs.path.clone(m.caption.anchor, offset), layer: (m.caption.anchor.layer || layer) });
|
|
1942
|
+
captions.push({ text: m.caption.text, anchor: MakerJs.path.clone(m.caption.anchor, MakerJs.point.add(m.origin, offset)), layer: (m.caption.anchor.layer || layer) });
|
|
1943
1943
|
}
|
|
1944
1944
|
}
|
|
1945
1945
|
tryAddCaption(modelContext, modelContext.origin, modelContext.layer);
|
|
@@ -3687,8 +3687,21 @@ var MakerJs;
|
|
|
3687
3687
|
//lines are both vertical, see if x are the same
|
|
3688
3688
|
return MakerJs.round(slopeA.line.origin[0] - slopeB.line.origin[0]) == 0;
|
|
3689
3689
|
}
|
|
3690
|
-
//lines are parallel, but not vertical
|
|
3691
|
-
|
|
3690
|
+
//lines are parallel, but not vertical
|
|
3691
|
+
//create array of slopes
|
|
3692
|
+
var slopes = [slopeA, slopeB];
|
|
3693
|
+
//get angle of each line
|
|
3694
|
+
var angles = slopes.map(function (s) { return MakerJs.angle.toDegrees(Math.atan(s.slope)); });
|
|
3695
|
+
//create an array of each line cloned
|
|
3696
|
+
var lines = slopes.map(function (s) { return MakerJs.path.clone(s.line); });
|
|
3697
|
+
//use the first line as the rotation origin
|
|
3698
|
+
var origin = lines[0].origin;
|
|
3699
|
+
//rotate each line to flat
|
|
3700
|
+
lines.forEach(function (l, i) { return MakerJs.path.rotate(l, -angles[i], origin); });
|
|
3701
|
+
//get average y-intercept of each line
|
|
3702
|
+
var averageYs = lines.map(function (l) { return (l.origin[1] + l.end[1]) / 2; });
|
|
3703
|
+
//see if y-intercept is the same
|
|
3704
|
+
return MakerJs.round(averageYs[0] - averageYs[1], .00001) == 0;
|
|
3692
3705
|
}
|
|
3693
3706
|
measure.isSlopeEqual = isSlopeEqual;
|
|
3694
3707
|
/**
|
|
@@ -9888,5 +9901,5 @@ var MakerJs;
|
|
|
9888
9901
|
];
|
|
9889
9902
|
})(models = MakerJs.models || (MakerJs.models = {}));
|
|
9890
9903
|
})(MakerJs || (MakerJs = {}));
|
|
9891
|
-
MakerJs.version = "0.17.
|
|
9904
|
+
MakerJs.version = "0.17.6";
|
|
9892
9905
|
var Bezier = require('bezier-js');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "makerjs",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.6",
|
|
4
4
|
"description": "Maker.js, a Microsoft Garage project, is a JavaScript library for creating and sharing modular line drawings for CNC and laser cutters.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|