pts 0.10.4 → 0.10.8
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/es2015/Canvas.js +34 -14
- package/dist/es2015/Color.js +13 -11
- package/dist/es2015/Create.js +5 -5
- package/dist/es2015/Dom.js +1 -1
- package/dist/es2015/Form.js +1 -1
- package/dist/es2015/Image.js +2 -0
- package/dist/es2015/LinearAlgebra.js +1 -1
- package/dist/es2015/Num.js +12 -3
- package/dist/es2015/Op.js +1 -1
- package/dist/es2015/Physics.js +1 -1
- package/dist/es2015/Pt.js +2 -2
- package/dist/es2015/Space.js +30 -24
- package/dist/es2015/Svg.js +1 -1
- package/dist/es2015/Types.js +1 -1
- package/dist/es2015/Typography.js +1 -1
- package/dist/es2015/UI.js +1 -1
- package/dist/es2015/Util.js +3 -2
- package/dist/es2015/_module.js +1 -0
- package/dist/es2015/uheprng.js +69 -0
- package/dist/es5.js +198 -66
- package/dist/index.js +193 -70
- package/dist/pts.d.ts +19 -9
- package/dist/pts.js +193 -71
- package/dist/pts.min.js +2 -2
- package/package.json +2 -2
package/dist/es5.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* pts.js 0.10.
|
|
2
|
+
* pts.js 0.10.8 - Copyright © 2017-2021 William Ngan and contributors.
|
|
3
3
|
* Licensed under Apache 2.0 License.
|
|
4
4
|
* See https://github.com/williamngan/pts for details.
|
|
5
5
|
*/
|
|
@@ -110,7 +110,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
110
110
|
|
|
111
111
|
"use strict";
|
|
112
112
|
|
|
113
|
-
/*!
|
|
113
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
114
114
|
|
|
115
115
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
116
116
|
|
|
@@ -225,19 +225,22 @@ var CanvasSpace = function (_Space_1$MultiTouchSp) {
|
|
|
225
225
|
} else {
|
|
226
226
|
this._offscreen = false;
|
|
227
227
|
}
|
|
228
|
+
if (opt.pixelDensity) {
|
|
229
|
+
this._pixelScale = opt.pixelDensity;
|
|
230
|
+
}
|
|
228
231
|
return this;
|
|
229
232
|
}
|
|
230
233
|
}, {
|
|
231
234
|
key: "resize",
|
|
232
235
|
value: function resize(b, evt) {
|
|
233
236
|
this.bound = b;
|
|
234
|
-
this._canvas.width = this.bound.size.x * this._pixelScale;
|
|
235
|
-
this._canvas.height = this.bound.size.y * this._pixelScale;
|
|
236
|
-
this._canvas.style.width = Math.
|
|
237
|
-
this._canvas.style.height = Math.
|
|
237
|
+
this._canvas.width = Math.ceil(this.bound.size.x) * this._pixelScale;
|
|
238
|
+
this._canvas.height = Math.ceil(this.bound.size.y) * this._pixelScale;
|
|
239
|
+
this._canvas.style.width = Math.ceil(this.bound.size.x) + "px";
|
|
240
|
+
this._canvas.style.height = Math.ceil(this.bound.size.y) + "px";
|
|
238
241
|
if (this._offscreen) {
|
|
239
|
-
this._offCanvas.width = this.bound.size.x * this._pixelScale;
|
|
240
|
-
this._offCanvas.height = this.bound.size.y * this._pixelScale;
|
|
242
|
+
this._offCanvas.width = Math.ceil(this.bound.size.x) * this._pixelScale;
|
|
243
|
+
this._offCanvas.height = Math.ceil(this.bound.size.y) * this._pixelScale;
|
|
241
244
|
}
|
|
242
245
|
if (this._pixelScale != 1) {
|
|
243
246
|
this._ctx.scale(this._pixelScale, this._pixelScale);
|
|
@@ -276,14 +279,15 @@ var CanvasSpace = function (_Space_1$MultiTouchSp) {
|
|
|
276
279
|
value: function clear(bg) {
|
|
277
280
|
if (bg) this._bgcolor = bg;
|
|
278
281
|
var lastColor = this._ctx.fillStyle;
|
|
282
|
+
var px = Math.ceil(this.pixelScale);
|
|
279
283
|
if (!this._bgcolor || this._bgcolor === "transparent") {
|
|
280
|
-
this._ctx.clearRect(-
|
|
284
|
+
this._ctx.clearRect(-px, -px, this._canvas.width + px, this._canvas.height + px);
|
|
281
285
|
} else {
|
|
282
286
|
if (this._bgcolor.indexOf("rgba") === 0 || this._bgcolor.length === 9 && this._bgcolor.indexOf("#") === 0) {
|
|
283
|
-
this._ctx.clearRect(-
|
|
287
|
+
this._ctx.clearRect(-px, -px, this._canvas.width + px, this._canvas.height + px);
|
|
284
288
|
}
|
|
285
289
|
this._ctx.fillStyle = this._bgcolor;
|
|
286
|
-
this._ctx.fillRect(-
|
|
290
|
+
this._ctx.fillRect(-px, -px, this._canvas.width + px, this._canvas.height + px);
|
|
287
291
|
}
|
|
288
292
|
this._ctx.fillStyle = lastColor;
|
|
289
293
|
return this;
|
|
@@ -292,11 +296,12 @@ var CanvasSpace = function (_Space_1$MultiTouchSp) {
|
|
|
292
296
|
key: "clearOffscreen",
|
|
293
297
|
value: function clearOffscreen(bg) {
|
|
294
298
|
if (this._offscreen) {
|
|
299
|
+
var px = Math.ceil(this.pixelScale);
|
|
295
300
|
if (bg) {
|
|
296
301
|
this._offCtx.fillStyle = bg;
|
|
297
|
-
this._offCtx.fillRect(-
|
|
302
|
+
this._offCtx.fillRect(-px, -px, this._canvas.width + px, this._canvas.height + px);
|
|
298
303
|
} else {
|
|
299
|
-
this._offCtx.clearRect(-
|
|
304
|
+
this._offCtx.clearRect(-px, -px, this._offCanvas.width + px, this._offCanvas.height + px);
|
|
300
305
|
}
|
|
301
306
|
}
|
|
302
307
|
return this;
|
|
@@ -326,9 +331,10 @@ var CanvasSpace = function (_Space_1$MultiTouchSp) {
|
|
|
326
331
|
key: "recorder",
|
|
327
332
|
value: function recorder(downloadOrCallback) {
|
|
328
333
|
var filetype = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "webm";
|
|
334
|
+
var bitrate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 15000000;
|
|
329
335
|
|
|
330
336
|
var stream = this._canvas.captureStream();
|
|
331
|
-
var recorder = new MediaRecorder(stream, { mimeType: "video/" + filetype });
|
|
337
|
+
var recorder = new MediaRecorder(stream, { mimeType: "video/" + filetype, bitsPerSecond: bitrate });
|
|
332
338
|
recorder.ondataavailable = function (d) {
|
|
333
339
|
var url = URL.createObjectURL(new Blob([d.data], { type: "video/" + filetype }));
|
|
334
340
|
if (typeof downloadOrCallback === "function") {
|
|
@@ -416,6 +422,8 @@ var CanvasForm = function (_Form_1$VisualForm) {
|
|
|
416
422
|
_inherits(CanvasForm, _Form_1$VisualForm);
|
|
417
423
|
|
|
418
424
|
function CanvasForm(space) {
|
|
425
|
+
var _ret;
|
|
426
|
+
|
|
419
427
|
_classCallCheck(this, CanvasForm);
|
|
420
428
|
|
|
421
429
|
var _this2 = _possibleConstructorReturn(this, (CanvasForm.__proto__ || Object.getPrototypeOf(CanvasForm)).call(this));
|
|
@@ -425,6 +433,7 @@ var CanvasForm = function (_Form_1$VisualForm) {
|
|
|
425
433
|
lineWidth: 1, lineJoin: "bevel", lineCap: "butt",
|
|
426
434
|
globalAlpha: 1
|
|
427
435
|
};
|
|
436
|
+
if (!space) return _ret = _this2, _possibleConstructorReturn(_this2, _ret);
|
|
428
437
|
var _setup = function _setup(ctx) {
|
|
429
438
|
_this2._ctx = ctx;
|
|
430
439
|
_this2._ctx.fillStyle = _this2._style.fillStyle;
|
|
@@ -506,6 +515,23 @@ var CanvasForm = function (_Form_1$VisualForm) {
|
|
|
506
515
|
}
|
|
507
516
|
return this;
|
|
508
517
|
}
|
|
518
|
+
}, {
|
|
519
|
+
key: "applyFillStroke",
|
|
520
|
+
value: function applyFillStroke() {
|
|
521
|
+
var filled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
522
|
+
var stroked = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
523
|
+
var strokeWidth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
524
|
+
|
|
525
|
+
if (filled) {
|
|
526
|
+
if (typeof filled === 'string') this.fill(filled);
|
|
527
|
+
this._ctx.fill();
|
|
528
|
+
}
|
|
529
|
+
if (stroked) {
|
|
530
|
+
if (typeof stroked === 'string') this.stroke(stroked, strokeWidth);
|
|
531
|
+
this._ctx.stroke();
|
|
532
|
+
}
|
|
533
|
+
return this;
|
|
534
|
+
}
|
|
509
535
|
}, {
|
|
510
536
|
key: "gradient",
|
|
511
537
|
value: function gradient(stops) {
|
|
@@ -992,7 +1018,7 @@ exports.CanvasForm = CanvasForm;
|
|
|
992
1018
|
|
|
993
1019
|
"use strict";
|
|
994
1020
|
|
|
995
|
-
/*!
|
|
1021
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
996
1022
|
|
|
997
1023
|
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
|
998
1024
|
|
|
@@ -1476,9 +1502,9 @@ var Color = function (_Pt_1$Pt) {
|
|
|
1476
1502
|
y = _ref7[1],
|
|
1477
1503
|
z = _ref7[2];
|
|
1478
1504
|
|
|
1479
|
-
var rgb = [x * 3.
|
|
1505
|
+
var rgb = [x * 3.2406254773200533 + y * -1.5372079722103187 + z * -0.4986285986982479, x * -0.9689307147293197 + y * 1.8757560608852415 + z * 0.041517523842953964, x * 0.055710120445510616 + y * -0.2040210505984867 + z * 1.0569959422543882];
|
|
1480
1506
|
for (var i = 0; i < 3; i++) {
|
|
1481
|
-
rgb[i] = rgb[i]
|
|
1507
|
+
rgb[i] = rgb[i] > 0.0031308 ? 1.055 * Math.pow(rgb[i], 1 / 2.4) - 0.055 : 12.92 * rgb[i];
|
|
1482
1508
|
rgb[i] = Math.max(0, Math.min(1, rgb[i]));
|
|
1483
1509
|
if (!normalizedOutput) rgb[i] = Math.round(rgb[i] * 255);
|
|
1484
1510
|
}
|
|
@@ -1492,9 +1518,11 @@ var Color = function (_Pt_1$Pt) {
|
|
|
1492
1518
|
var normalizedOutput = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
1493
1519
|
|
|
1494
1520
|
var c = normalizedInput ? xyz.$normalize(false) : xyz.clone();
|
|
1521
|
+
var eps = 0.00885645167;
|
|
1522
|
+
var kap = 903.296296296;
|
|
1495
1523
|
c.divide(Color.D65);
|
|
1496
1524
|
var fn = function fn(n) {
|
|
1497
|
-
return n >
|
|
1525
|
+
return n > eps ? Math.pow(n, 1 / 3) : (kap * n + 16) / 116;
|
|
1498
1526
|
};
|
|
1499
1527
|
var cy = fn(c[1]);
|
|
1500
1528
|
var cc = Color.lab(116 * cy - 16, 500 * (fn(c[0]) - cy), 200 * (cy - fn(c[2])), xyz.alpha);
|
|
@@ -1510,12 +1538,12 @@ var Color = function (_Pt_1$Pt) {
|
|
|
1510
1538
|
var y = (c[0] + 16) / 116;
|
|
1511
1539
|
var x = c[1] / 500 + y;
|
|
1512
1540
|
var z = y - c[2] / 200;
|
|
1513
|
-
var
|
|
1514
|
-
|
|
1515
|
-
return nnn > 0.008856 ? nnn : (n - 16 / 116) / 7.787;
|
|
1516
|
-
};
|
|
1541
|
+
var eps = 0.00885645167;
|
|
1542
|
+
var kap = 903.296296296;
|
|
1517
1543
|
var d = Color.D65;
|
|
1518
|
-
var
|
|
1544
|
+
var xxx = Math.pow(x, 3);
|
|
1545
|
+
var zzz = Math.pow(z, 3);
|
|
1546
|
+
var cc = Color.xyz(d[0] * (xxx > eps ? xxx : (116 * x - 16) / kap), d[1] * (c[0] > kap * eps ? Math.pow((c[0] + 16) / 116, 3) : c[0] / kap), d[2] * (zzz > eps ? zzz : (116 * z - 16) / kap), lab.alpha);
|
|
1519
1547
|
return normalizedOutput ? cc.normalize() : cc;
|
|
1520
1548
|
}
|
|
1521
1549
|
}, {
|
|
@@ -1611,7 +1639,7 @@ Color.ranges = {
|
|
|
1611
1639
|
|
|
1612
1640
|
"use strict";
|
|
1613
1641
|
|
|
1614
|
-
/*!
|
|
1642
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
1615
1643
|
|
|
1616
1644
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
1617
1645
|
|
|
@@ -1641,9 +1669,9 @@ var Create = function () {
|
|
|
1641
1669
|
|
|
1642
1670
|
var pts = new Pt_1.Group();
|
|
1643
1671
|
for (var i = 0; i < count; i++) {
|
|
1644
|
-
var p = [bound.x +
|
|
1645
|
-
if (dimensions > 1) p.push(bound.y +
|
|
1646
|
-
if (dimensions > 2) p.push(bound.z +
|
|
1672
|
+
var p = [bound.x + Num_1.Num.random() * bound.width];
|
|
1673
|
+
if (dimensions > 1) p.push(bound.y + Num_1.Num.random() * bound.height);
|
|
1674
|
+
if (dimensions > 2) p.push(bound.z + Num_1.Num.random() * bound.depth);
|
|
1647
1675
|
pts.push(new Pt_1.Pt(p));
|
|
1648
1676
|
}
|
|
1649
1677
|
return pts;
|
|
@@ -1706,7 +1734,7 @@ var Create = function () {
|
|
|
1706
1734
|
var rows = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
1707
1735
|
var columns = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
1708
1736
|
|
|
1709
|
-
var seed =
|
|
1737
|
+
var seed = Num_1.Num.random();
|
|
1710
1738
|
var g = new Pt_1.Group();
|
|
1711
1739
|
var i = 0;
|
|
1712
1740
|
var _iteratorNormalCompletion = true;
|
|
@@ -2019,7 +2047,7 @@ exports.Delaunay = Delaunay;
|
|
|
2019
2047
|
|
|
2020
2048
|
"use strict";
|
|
2021
2049
|
|
|
2022
|
-
/*!
|
|
2050
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
2023
2051
|
|
|
2024
2052
|
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
|
|
2025
2053
|
|
|
@@ -2628,7 +2656,7 @@ HTMLForm.domID = 0;
|
|
|
2628
2656
|
|
|
2629
2657
|
"use strict";
|
|
2630
2658
|
|
|
2631
|
-
/*!
|
|
2659
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
2632
2660
|
|
|
2633
2661
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
2634
2662
|
|
|
@@ -2929,6 +2957,8 @@ var Img = function () {
|
|
|
2929
2957
|
key: "filter",
|
|
2930
2958
|
value: function filter(css) {
|
|
2931
2959
|
this._ctx.filter = css;
|
|
2960
|
+
this._ctx.drawImage(this._cv, 0, 0);
|
|
2961
|
+
this._ctx.filter = "none";
|
|
2932
2962
|
return this;
|
|
2933
2963
|
}
|
|
2934
2964
|
}, {
|
|
@@ -3063,7 +3093,7 @@ exports.Img = Img;
|
|
|
3063
3093
|
|
|
3064
3094
|
"use strict";
|
|
3065
3095
|
|
|
3066
|
-
/*!
|
|
3096
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
3067
3097
|
|
|
3068
3098
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
3069
3099
|
|
|
@@ -3410,7 +3440,7 @@ exports.Mat = Mat;
|
|
|
3410
3440
|
|
|
3411
3441
|
"use strict";
|
|
3412
3442
|
|
|
3413
|
-
/*!
|
|
3443
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
3414
3444
|
|
|
3415
3445
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
3416
3446
|
|
|
@@ -3422,6 +3452,7 @@ var Util_1 = __webpack_require__(/*! ./Util */ "./src/Util.ts");
|
|
|
3422
3452
|
var Op_1 = __webpack_require__(/*! ./Op */ "./src/Op.ts");
|
|
3423
3453
|
var Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
|
|
3424
3454
|
var LinearAlgebra_1 = __webpack_require__(/*! ./LinearAlgebra */ "./src/LinearAlgebra.ts");
|
|
3455
|
+
var uheprng_1 = __webpack_require__(/*! ./uheprng */ "./src/uheprng.ts");
|
|
3425
3456
|
|
|
3426
3457
|
var Num = function () {
|
|
3427
3458
|
function Num() {
|
|
@@ -3464,7 +3495,7 @@ var Num = function () {
|
|
|
3464
3495
|
var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3465
3496
|
|
|
3466
3497
|
var r = a > b ? a - b : b - a;
|
|
3467
|
-
return a +
|
|
3498
|
+
return a + Num.random() * r;
|
|
3468
3499
|
}
|
|
3469
3500
|
}, {
|
|
3470
3501
|
key: "randomPt",
|
|
@@ -3473,7 +3504,7 @@ var Num = function () {
|
|
|
3473
3504
|
var range = b ? LinearAlgebra_1.Vec.subtract(b, a) : a;
|
|
3474
3505
|
var start = b ? a : new Pt_1.Pt(a.length).fill(0);
|
|
3475
3506
|
for (var i = 0, len = p.length; i < len; i++) {
|
|
3476
|
-
p[i] =
|
|
3507
|
+
p[i] = Num.random() * range[i] + start[i];
|
|
3477
3508
|
}
|
|
3478
3509
|
return p;
|
|
3479
3510
|
}
|
|
@@ -3515,6 +3546,16 @@ var Num = function () {
|
|
|
3515
3546
|
var max = Math.max(targetA, targetB);
|
|
3516
3547
|
return Num.normalizeValue(n, currA, currB) * (max - min) + min;
|
|
3517
3548
|
}
|
|
3549
|
+
}, {
|
|
3550
|
+
key: "seed",
|
|
3551
|
+
value: function seed(_seed) {
|
|
3552
|
+
this.generator = uheprng_1.default(_seed);
|
|
3553
|
+
}
|
|
3554
|
+
}, {
|
|
3555
|
+
key: "random",
|
|
3556
|
+
value: function random() {
|
|
3557
|
+
return this.generator ? this.generator.random() : Math.random();
|
|
3558
|
+
}
|
|
3518
3559
|
}]);
|
|
3519
3560
|
|
|
3520
3561
|
return Num;
|
|
@@ -4189,7 +4230,7 @@ exports.Range = Range;
|
|
|
4189
4230
|
|
|
4190
4231
|
"use strict";
|
|
4191
4232
|
|
|
4192
|
-
/*!
|
|
4233
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
4193
4234
|
|
|
4194
4235
|
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
|
4195
4236
|
|
|
@@ -5552,7 +5593,7 @@ exports.Curve = Curve;
|
|
|
5552
5593
|
|
|
5553
5594
|
"use strict";
|
|
5554
5595
|
|
|
5555
|
-
/*!
|
|
5596
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
5556
5597
|
|
|
5557
5598
|
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
|
5558
5599
|
|
|
@@ -6724,7 +6765,7 @@ exports.Sound = Sound;
|
|
|
6724
6765
|
|
|
6725
6766
|
"use strict";
|
|
6726
6767
|
|
|
6727
|
-
/*!
|
|
6768
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
6728
6769
|
|
|
6729
6770
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
6730
6771
|
|
|
@@ -7212,7 +7253,7 @@ var Pt = function (_extendableBuiltin2) {
|
|
|
7212
7253
|
if (defaultValue) p.fill(defaultValue);
|
|
7213
7254
|
if (randomize) {
|
|
7214
7255
|
for (var i = 0, len = p.length; i < len; i++) {
|
|
7215
|
-
p[i] = p[i] *
|
|
7256
|
+
p[i] = p[i] * Num_1.Num.random();
|
|
7216
7257
|
}
|
|
7217
7258
|
}
|
|
7218
7259
|
return new Pt(p);
|
|
@@ -7777,7 +7818,7 @@ exports.Bound = Bound;
|
|
|
7777
7818
|
|
|
7778
7819
|
"use strict";
|
|
7779
7820
|
|
|
7780
|
-
/*!
|
|
7821
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
7781
7822
|
|
|
7782
7823
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
7783
7824
|
|
|
@@ -7908,7 +7949,7 @@ var Space = function () {
|
|
|
7908
7949
|
}, {
|
|
7909
7950
|
key: "playOnce",
|
|
7910
7951
|
value: function playOnce() {
|
|
7911
|
-
var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :
|
|
7952
|
+
var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
7912
7953
|
|
|
7913
7954
|
this.play();
|
|
7914
7955
|
this.stop(duration);
|
|
@@ -7995,7 +8036,9 @@ var MultiTouchSpace = function (_Space) {
|
|
|
7995
8036
|
}, {
|
|
7996
8037
|
key: "unbindCanvas",
|
|
7997
8038
|
value: function unbindCanvas(evt, callback) {
|
|
7998
|
-
|
|
8039
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
8040
|
+
|
|
8041
|
+
this._canvas.removeEventListener(evt, callback, options);
|
|
7999
8042
|
}
|
|
8000
8043
|
}, {
|
|
8001
8044
|
key: "bindMouse",
|
|
@@ -8003,22 +8046,28 @@ var MultiTouchSpace = function (_Space) {
|
|
|
8003
8046
|
var _bind = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
8004
8047
|
|
|
8005
8048
|
if (_bind) {
|
|
8006
|
-
this.
|
|
8007
|
-
this.
|
|
8008
|
-
this.
|
|
8009
|
-
this.
|
|
8010
|
-
this.
|
|
8011
|
-
this.
|
|
8012
|
-
this.bindCanvas("
|
|
8049
|
+
this._mouseDown = this._mouseDown.bind(this);
|
|
8050
|
+
this._mouseUp = this._mouseUp.bind(this);
|
|
8051
|
+
this._mouseOver = this._mouseOver.bind(this);
|
|
8052
|
+
this._mouseMove = this._mouseMove.bind(this);
|
|
8053
|
+
this._mouseClick = this._mouseClick.bind(this);
|
|
8054
|
+
this._contextMenu = this._contextMenu.bind(this);
|
|
8055
|
+
this.bindCanvas("mousedown", this._mouseDown);
|
|
8056
|
+
this.bindCanvas("mouseup", this._mouseUp);
|
|
8057
|
+
this.bindCanvas("mouseover", this._mouseOver);
|
|
8058
|
+
this.bindCanvas("mouseout", this._mouseOut);
|
|
8059
|
+
this.bindCanvas("mousemove", this._mouseMove);
|
|
8060
|
+
this.bindCanvas("click", this._mouseClick);
|
|
8061
|
+
this.bindCanvas("contextmenu", this._contextMenu);
|
|
8013
8062
|
this._hasMouse = true;
|
|
8014
8063
|
} else {
|
|
8015
|
-
this.unbindCanvas("mousedown", this._mouseDown
|
|
8016
|
-
this.unbindCanvas("mouseup", this._mouseUp
|
|
8017
|
-
this.unbindCanvas("mouseover", this._mouseOver
|
|
8018
|
-
this.unbindCanvas("mouseout", this._mouseOut
|
|
8019
|
-
this.unbindCanvas("mousemove", this._mouseMove
|
|
8020
|
-
this.unbindCanvas("click", this._mouseClick
|
|
8021
|
-
this.unbindCanvas("contextmenu", this._contextMenu
|
|
8064
|
+
this.unbindCanvas("mousedown", this._mouseDown);
|
|
8065
|
+
this.unbindCanvas("mouseup", this._mouseUp);
|
|
8066
|
+
this.unbindCanvas("mouseover", this._mouseOver);
|
|
8067
|
+
this.unbindCanvas("mouseout", this._mouseOut);
|
|
8068
|
+
this.unbindCanvas("mousemove", this._mouseMove);
|
|
8069
|
+
this.unbindCanvas("click", this._mouseClick);
|
|
8070
|
+
this.unbindCanvas("contextmenu", this._contextMenu);
|
|
8022
8071
|
this._hasMouse = false;
|
|
8023
8072
|
}
|
|
8024
8073
|
return this;
|
|
@@ -8026,18 +8075,19 @@ var MultiTouchSpace = function (_Space) {
|
|
|
8026
8075
|
}, {
|
|
8027
8076
|
key: "bindTouch",
|
|
8028
8077
|
value: function bindTouch() {
|
|
8029
|
-
var
|
|
8078
|
+
var bind = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
8079
|
+
var passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
8030
8080
|
|
|
8031
|
-
if (
|
|
8032
|
-
this.bindCanvas("touchstart", this._touchStart.bind(this), { passive:
|
|
8081
|
+
if (bind) {
|
|
8082
|
+
this.bindCanvas("touchstart", this._touchStart.bind(this), { passive: passive });
|
|
8033
8083
|
this.bindCanvas("touchend", this._mouseUp.bind(this));
|
|
8034
|
-
this.bindCanvas("touchmove", this._touchMove.bind(this), { passive:
|
|
8084
|
+
this.bindCanvas("touchmove", this._touchMove.bind(this), { passive: passive });
|
|
8035
8085
|
this.bindCanvas("touchcancel", this._mouseOut.bind(this));
|
|
8036
8086
|
this._hasTouch = true;
|
|
8037
8087
|
} else {
|
|
8038
|
-
this.unbindCanvas("touchstart", this._touchStart.bind(this));
|
|
8088
|
+
this.unbindCanvas("touchstart", this._touchStart.bind(this), { passive: passive });
|
|
8039
8089
|
this.unbindCanvas("touchend", this._mouseUp.bind(this));
|
|
8040
|
-
this.unbindCanvas("touchmove", this._touchMove.bind(this));
|
|
8090
|
+
this.unbindCanvas("touchmove", this._touchMove.bind(this), { passive: passive });
|
|
8041
8091
|
this.unbindCanvas("touchcancel", this._mouseOut.bind(this));
|
|
8042
8092
|
this._hasTouch = false;
|
|
8043
8093
|
}
|
|
@@ -8183,7 +8233,7 @@ exports.MultiTouchSpace = MultiTouchSpace;
|
|
|
8183
8233
|
|
|
8184
8234
|
"use strict";
|
|
8185
8235
|
|
|
8186
|
-
/*!
|
|
8236
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
8187
8237
|
|
|
8188
8238
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
8189
8239
|
|
|
@@ -8691,7 +8741,7 @@ SVGForm.domID = 0;
|
|
|
8691
8741
|
|
|
8692
8742
|
"use strict";
|
|
8693
8743
|
|
|
8694
|
-
/*!
|
|
8744
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
8695
8745
|
|
|
8696
8746
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
8697
8747
|
|
|
@@ -8776,7 +8826,7 @@ exports.Typography = Typography;
|
|
|
8776
8826
|
|
|
8777
8827
|
"use strict";
|
|
8778
8828
|
|
|
8779
|
-
/*!
|
|
8829
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
8780
8830
|
|
|
8781
8831
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
8782
8832
|
|
|
@@ -9164,7 +9214,7 @@ exports.UIDragger = UIDragger;
|
|
|
9164
9214
|
|
|
9165
9215
|
"use strict";
|
|
9166
9216
|
|
|
9167
|
-
/*!
|
|
9217
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
9168
9218
|
|
|
9169
9219
|
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
9170
9220
|
|
|
@@ -9176,6 +9226,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
9176
9226
|
|
|
9177
9227
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9178
9228
|
exports.Util = exports.Const = void 0;
|
|
9229
|
+
var Num_1 = __webpack_require__(/*! ./Num */ "./src/Num.ts");
|
|
9179
9230
|
var Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
|
|
9180
9231
|
exports.Const = {
|
|
9181
9232
|
xy: "xy",
|
|
@@ -9260,7 +9311,7 @@ var Util = function () {
|
|
|
9260
9311
|
var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
9261
9312
|
|
|
9262
9313
|
Util.warn("Util.randomInt is deprecated. Please use `Num.randomRange`");
|
|
9263
|
-
return Math.floor(
|
|
9314
|
+
return Math.floor(Num_1.Num.random() * range) + start;
|
|
9264
9315
|
}
|
|
9265
9316
|
}, {
|
|
9266
9317
|
key: "split",
|
|
@@ -9456,6 +9507,87 @@ __exportStar(__webpack_require__(/*! ./Typography */ "./src/Typography.ts"), exp
|
|
|
9456
9507
|
__exportStar(__webpack_require__(/*! ./Physics */ "./src/Physics.ts"), exports);
|
|
9457
9508
|
__exportStar(__webpack_require__(/*! ./Play */ "./src/Play.ts"), exports);
|
|
9458
9509
|
__exportStar(__webpack_require__(/*! ./UI */ "./src/UI.ts"), exports);
|
|
9510
|
+
__exportStar(__webpack_require__(/*! ./Image */ "./src/Image.ts"), exports);
|
|
9511
|
+
|
|
9512
|
+
/***/ }),
|
|
9513
|
+
|
|
9514
|
+
/***/ "./src/uheprng.ts":
|
|
9515
|
+
/*!************************!*\
|
|
9516
|
+
!*** ./src/uheprng.ts ***!
|
|
9517
|
+
\************************/
|
|
9518
|
+
/*! no static exports found */
|
|
9519
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
9520
|
+
|
|
9521
|
+
"use strict";
|
|
9522
|
+
|
|
9523
|
+
|
|
9524
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9525
|
+
function Mash() {
|
|
9526
|
+
var n = 0xefc8249d;
|
|
9527
|
+
var mash = function mash(data) {
|
|
9528
|
+
if (data) {
|
|
9529
|
+
data = data.toString();
|
|
9530
|
+
for (var i = 0; i < data.length; i++) {
|
|
9531
|
+
n += data.charCodeAt(i);
|
|
9532
|
+
var h = 0.02519603282416938 * n;
|
|
9533
|
+
n = h >>> 0;
|
|
9534
|
+
h -= n;
|
|
9535
|
+
h *= n;
|
|
9536
|
+
n = h >>> 0;
|
|
9537
|
+
h -= n;
|
|
9538
|
+
n += h * 0x100000000;
|
|
9539
|
+
}
|
|
9540
|
+
return (n >>> 0) * 2.3283064365386963e-10;
|
|
9541
|
+
} else n = 0xefc8249d;
|
|
9542
|
+
};
|
|
9543
|
+
return mash;
|
|
9544
|
+
}
|
|
9545
|
+
function default_1(seed) {
|
|
9546
|
+
var o = 48;
|
|
9547
|
+
var c = 1;
|
|
9548
|
+
var p = o;
|
|
9549
|
+
var s = new Array(o);
|
|
9550
|
+
var i,
|
|
9551
|
+
j,
|
|
9552
|
+
k = 0;
|
|
9553
|
+
var mash = Mash();
|
|
9554
|
+
for (i = 0; i < o; i++) {
|
|
9555
|
+
s[i] = mash(Math.random().toString());
|
|
9556
|
+
}function initState() {
|
|
9557
|
+
mash();
|
|
9558
|
+
for (i = 0; i < o; i++) {
|
|
9559
|
+
s[i] = mash(' ');
|
|
9560
|
+
}c = 1;
|
|
9561
|
+
p = o;
|
|
9562
|
+
}
|
|
9563
|
+
function cleanString(inStr) {
|
|
9564
|
+
inStr = inStr.replace(/(^\s*)|(\s*$)/gi, '');
|
|
9565
|
+
inStr = inStr.replace(/[\x00-\x1F]/gi, '');
|
|
9566
|
+
inStr = inStr.replace(/\n /, '\n');
|
|
9567
|
+
return inStr;
|
|
9568
|
+
}
|
|
9569
|
+
function hashString(inStr) {
|
|
9570
|
+
inStr = cleanString(inStr);
|
|
9571
|
+
mash(inStr);
|
|
9572
|
+
for (i = 0; i < inStr.length; i++) {
|
|
9573
|
+
k = inStr.charCodeAt(i);
|
|
9574
|
+
for (j = 0; j < o; j++) {
|
|
9575
|
+
s[j] -= mash(k.toString());
|
|
9576
|
+
if (s[j] < 0) s[j] += 1;
|
|
9577
|
+
}
|
|
9578
|
+
}
|
|
9579
|
+
}
|
|
9580
|
+
initState();
|
|
9581
|
+
hashString(seed);
|
|
9582
|
+
return {
|
|
9583
|
+
random: function random() {
|
|
9584
|
+
if (++p >= o) p = 0;
|
|
9585
|
+
var t = 1768863 * s[p] + c * 2.3283064365386963e-10;
|
|
9586
|
+
return s[p] = t - (c = t | 0);
|
|
9587
|
+
}
|
|
9588
|
+
};
|
|
9589
|
+
}
|
|
9590
|
+
exports.default = default_1;
|
|
9459
9591
|
|
|
9460
9592
|
/***/ })
|
|
9461
9593
|
|