pts 0.10.5 → 0.10.9
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 +32 -12
- 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/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 +31 -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 +195 -65
- package/dist/index.js +190 -68
- package/dist/pts.d.ts +18 -8
- package/dist/pts.js +190 -69
- 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.9 - 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;
|
|
@@ -417,6 +422,8 @@ var CanvasForm = function (_Form_1$VisualForm) {
|
|
|
417
422
|
_inherits(CanvasForm, _Form_1$VisualForm);
|
|
418
423
|
|
|
419
424
|
function CanvasForm(space) {
|
|
425
|
+
var _ret;
|
|
426
|
+
|
|
420
427
|
_classCallCheck(this, CanvasForm);
|
|
421
428
|
|
|
422
429
|
var _this2 = _possibleConstructorReturn(this, (CanvasForm.__proto__ || Object.getPrototypeOf(CanvasForm)).call(this));
|
|
@@ -426,6 +433,7 @@ var CanvasForm = function (_Form_1$VisualForm) {
|
|
|
426
433
|
lineWidth: 1, lineJoin: "bevel", lineCap: "butt",
|
|
427
434
|
globalAlpha: 1
|
|
428
435
|
};
|
|
436
|
+
if (!space) return _ret = _this2, _possibleConstructorReturn(_this2, _ret);
|
|
429
437
|
var _setup = function _setup(ctx) {
|
|
430
438
|
_this2._ctx = ctx;
|
|
431
439
|
_this2._ctx.fillStyle = _this2._style.fillStyle;
|
|
@@ -507,6 +515,23 @@ var CanvasForm = function (_Form_1$VisualForm) {
|
|
|
507
515
|
}
|
|
508
516
|
return this;
|
|
509
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
|
+
}
|
|
510
535
|
}, {
|
|
511
536
|
key: "gradient",
|
|
512
537
|
value: function gradient(stops) {
|
|
@@ -993,7 +1018,7 @@ exports.CanvasForm = CanvasForm;
|
|
|
993
1018
|
|
|
994
1019
|
"use strict";
|
|
995
1020
|
|
|
996
|
-
/*!
|
|
1021
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
997
1022
|
|
|
998
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"); } }; }();
|
|
999
1024
|
|
|
@@ -1477,9 +1502,9 @@ var Color = function (_Pt_1$Pt) {
|
|
|
1477
1502
|
y = _ref7[1],
|
|
1478
1503
|
z = _ref7[2];
|
|
1479
1504
|
|
|
1480
|
-
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];
|
|
1481
1506
|
for (var i = 0; i < 3; i++) {
|
|
1482
|
-
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];
|
|
1483
1508
|
rgb[i] = Math.max(0, Math.min(1, rgb[i]));
|
|
1484
1509
|
if (!normalizedOutput) rgb[i] = Math.round(rgb[i] * 255);
|
|
1485
1510
|
}
|
|
@@ -1493,9 +1518,11 @@ var Color = function (_Pt_1$Pt) {
|
|
|
1493
1518
|
var normalizedOutput = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
1494
1519
|
|
|
1495
1520
|
var c = normalizedInput ? xyz.$normalize(false) : xyz.clone();
|
|
1521
|
+
var eps = 0.00885645167;
|
|
1522
|
+
var kap = 903.296296296;
|
|
1496
1523
|
c.divide(Color.D65);
|
|
1497
1524
|
var fn = function fn(n) {
|
|
1498
|
-
return n >
|
|
1525
|
+
return n > eps ? Math.pow(n, 1 / 3) : (kap * n + 16) / 116;
|
|
1499
1526
|
};
|
|
1500
1527
|
var cy = fn(c[1]);
|
|
1501
1528
|
var cc = Color.lab(116 * cy - 16, 500 * (fn(c[0]) - cy), 200 * (cy - fn(c[2])), xyz.alpha);
|
|
@@ -1511,12 +1538,12 @@ var Color = function (_Pt_1$Pt) {
|
|
|
1511
1538
|
var y = (c[0] + 16) / 116;
|
|
1512
1539
|
var x = c[1] / 500 + y;
|
|
1513
1540
|
var z = y - c[2] / 200;
|
|
1514
|
-
var
|
|
1515
|
-
|
|
1516
|
-
return nnn > 0.008856 ? nnn : (n - 16 / 116) / 7.787;
|
|
1517
|
-
};
|
|
1541
|
+
var eps = 0.00885645167;
|
|
1542
|
+
var kap = 903.296296296;
|
|
1518
1543
|
var d = Color.D65;
|
|
1519
|
-
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);
|
|
1520
1547
|
return normalizedOutput ? cc.normalize() : cc;
|
|
1521
1548
|
}
|
|
1522
1549
|
}, {
|
|
@@ -1612,7 +1639,7 @@ Color.ranges = {
|
|
|
1612
1639
|
|
|
1613
1640
|
"use strict";
|
|
1614
1641
|
|
|
1615
|
-
/*!
|
|
1642
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
1616
1643
|
|
|
1617
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; }; }();
|
|
1618
1645
|
|
|
@@ -1642,9 +1669,9 @@ var Create = function () {
|
|
|
1642
1669
|
|
|
1643
1670
|
var pts = new Pt_1.Group();
|
|
1644
1671
|
for (var i = 0; i < count; i++) {
|
|
1645
|
-
var p = [bound.x +
|
|
1646
|
-
if (dimensions > 1) p.push(bound.y +
|
|
1647
|
-
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);
|
|
1648
1675
|
pts.push(new Pt_1.Pt(p));
|
|
1649
1676
|
}
|
|
1650
1677
|
return pts;
|
|
@@ -1707,7 +1734,7 @@ var Create = function () {
|
|
|
1707
1734
|
var rows = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
1708
1735
|
var columns = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
1709
1736
|
|
|
1710
|
-
var seed =
|
|
1737
|
+
var seed = Num_1.Num.random();
|
|
1711
1738
|
var g = new Pt_1.Group();
|
|
1712
1739
|
var i = 0;
|
|
1713
1740
|
var _iteratorNormalCompletion = true;
|
|
@@ -2020,7 +2047,7 @@ exports.Delaunay = Delaunay;
|
|
|
2020
2047
|
|
|
2021
2048
|
"use strict";
|
|
2022
2049
|
|
|
2023
|
-
/*!
|
|
2050
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
2024
2051
|
|
|
2025
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); } };
|
|
2026
2053
|
|
|
@@ -2629,7 +2656,7 @@ HTMLForm.domID = 0;
|
|
|
2629
2656
|
|
|
2630
2657
|
"use strict";
|
|
2631
2658
|
|
|
2632
|
-
/*!
|
|
2659
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
2633
2660
|
|
|
2634
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; }; }();
|
|
2635
2662
|
|
|
@@ -3066,7 +3093,7 @@ exports.Img = Img;
|
|
|
3066
3093
|
|
|
3067
3094
|
"use strict";
|
|
3068
3095
|
|
|
3069
|
-
/*!
|
|
3096
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
3070
3097
|
|
|
3071
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; }; }();
|
|
3072
3099
|
|
|
@@ -3413,7 +3440,7 @@ exports.Mat = Mat;
|
|
|
3413
3440
|
|
|
3414
3441
|
"use strict";
|
|
3415
3442
|
|
|
3416
|
-
/*!
|
|
3443
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
3417
3444
|
|
|
3418
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; }; }();
|
|
3419
3446
|
|
|
@@ -3425,6 +3452,7 @@ var Util_1 = __webpack_require__(/*! ./Util */ "./src/Util.ts");
|
|
|
3425
3452
|
var Op_1 = __webpack_require__(/*! ./Op */ "./src/Op.ts");
|
|
3426
3453
|
var Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
|
|
3427
3454
|
var LinearAlgebra_1 = __webpack_require__(/*! ./LinearAlgebra */ "./src/LinearAlgebra.ts");
|
|
3455
|
+
var uheprng_1 = __webpack_require__(/*! ./uheprng */ "./src/uheprng.ts");
|
|
3428
3456
|
|
|
3429
3457
|
var Num = function () {
|
|
3430
3458
|
function Num() {
|
|
@@ -3467,7 +3495,7 @@ var Num = function () {
|
|
|
3467
3495
|
var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3468
3496
|
|
|
3469
3497
|
var r = a > b ? a - b : b - a;
|
|
3470
|
-
return a +
|
|
3498
|
+
return a + Num.random() * r;
|
|
3471
3499
|
}
|
|
3472
3500
|
}, {
|
|
3473
3501
|
key: "randomPt",
|
|
@@ -3476,7 +3504,7 @@ var Num = function () {
|
|
|
3476
3504
|
var range = b ? LinearAlgebra_1.Vec.subtract(b, a) : a;
|
|
3477
3505
|
var start = b ? a : new Pt_1.Pt(a.length).fill(0);
|
|
3478
3506
|
for (var i = 0, len = p.length; i < len; i++) {
|
|
3479
|
-
p[i] =
|
|
3507
|
+
p[i] = Num.random() * range[i] + start[i];
|
|
3480
3508
|
}
|
|
3481
3509
|
return p;
|
|
3482
3510
|
}
|
|
@@ -3518,6 +3546,16 @@ var Num = function () {
|
|
|
3518
3546
|
var max = Math.max(targetA, targetB);
|
|
3519
3547
|
return Num.normalizeValue(n, currA, currB) * (max - min) + min;
|
|
3520
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
|
+
}
|
|
3521
3559
|
}]);
|
|
3522
3560
|
|
|
3523
3561
|
return Num;
|
|
@@ -4192,7 +4230,7 @@ exports.Range = Range;
|
|
|
4192
4230
|
|
|
4193
4231
|
"use strict";
|
|
4194
4232
|
|
|
4195
|
-
/*!
|
|
4233
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
4196
4234
|
|
|
4197
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"); } }; }();
|
|
4198
4236
|
|
|
@@ -5555,7 +5593,7 @@ exports.Curve = Curve;
|
|
|
5555
5593
|
|
|
5556
5594
|
"use strict";
|
|
5557
5595
|
|
|
5558
|
-
/*!
|
|
5596
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
5559
5597
|
|
|
5560
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"); } }; }();
|
|
5561
5599
|
|
|
@@ -6727,7 +6765,7 @@ exports.Sound = Sound;
|
|
|
6727
6765
|
|
|
6728
6766
|
"use strict";
|
|
6729
6767
|
|
|
6730
|
-
/*!
|
|
6768
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
6731
6769
|
|
|
6732
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; }; }();
|
|
6733
6771
|
|
|
@@ -7215,7 +7253,7 @@ var Pt = function (_extendableBuiltin2) {
|
|
|
7215
7253
|
if (defaultValue) p.fill(defaultValue);
|
|
7216
7254
|
if (randomize) {
|
|
7217
7255
|
for (var i = 0, len = p.length; i < len; i++) {
|
|
7218
|
-
p[i] = p[i] *
|
|
7256
|
+
p[i] = p[i] * Num_1.Num.random();
|
|
7219
7257
|
}
|
|
7220
7258
|
}
|
|
7221
7259
|
return new Pt(p);
|
|
@@ -7780,7 +7818,7 @@ exports.Bound = Bound;
|
|
|
7780
7818
|
|
|
7781
7819
|
"use strict";
|
|
7782
7820
|
|
|
7783
|
-
/*!
|
|
7821
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
7784
7822
|
|
|
7785
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; }; }();
|
|
7786
7824
|
|
|
@@ -7911,7 +7949,7 @@ var Space = function () {
|
|
|
7911
7949
|
}, {
|
|
7912
7950
|
key: "playOnce",
|
|
7913
7951
|
value: function playOnce() {
|
|
7914
|
-
var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :
|
|
7952
|
+
var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
7915
7953
|
|
|
7916
7954
|
this.play();
|
|
7917
7955
|
this.stop(duration);
|
|
@@ -7998,7 +8036,9 @@ var MultiTouchSpace = function (_Space) {
|
|
|
7998
8036
|
}, {
|
|
7999
8037
|
key: "unbindCanvas",
|
|
8000
8038
|
value: function unbindCanvas(evt, callback) {
|
|
8001
|
-
|
|
8039
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
8040
|
+
|
|
8041
|
+
this._canvas.removeEventListener(evt, callback, options);
|
|
8002
8042
|
}
|
|
8003
8043
|
}, {
|
|
8004
8044
|
key: "bindMouse",
|
|
@@ -8006,22 +8046,29 @@ var MultiTouchSpace = function (_Space) {
|
|
|
8006
8046
|
var _bind = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
8007
8047
|
|
|
8008
8048
|
if (_bind) {
|
|
8009
|
-
this.
|
|
8010
|
-
this.
|
|
8011
|
-
this.
|
|
8012
|
-
this.
|
|
8013
|
-
this.
|
|
8014
|
-
this.
|
|
8015
|
-
this.
|
|
8049
|
+
this._mouseDown = this._mouseDown.bind(this);
|
|
8050
|
+
this._mouseUp = this._mouseUp.bind(this);
|
|
8051
|
+
this._mouseOver = this._mouseOver.bind(this);
|
|
8052
|
+
this._mouseOut = this._mouseOut.bind(this);
|
|
8053
|
+
this._mouseMove = this._mouseMove.bind(this);
|
|
8054
|
+
this._mouseClick = this._mouseClick.bind(this);
|
|
8055
|
+
this._contextMenu = this._contextMenu.bind(this);
|
|
8056
|
+
this.bindCanvas("mousedown", this._mouseDown);
|
|
8057
|
+
this.bindCanvas("mouseup", this._mouseUp);
|
|
8058
|
+
this.bindCanvas("mouseover", this._mouseOver);
|
|
8059
|
+
this.bindCanvas("mouseout", this._mouseOut);
|
|
8060
|
+
this.bindCanvas("mousemove", this._mouseMove);
|
|
8061
|
+
this.bindCanvas("click", this._mouseClick);
|
|
8062
|
+
this.bindCanvas("contextmenu", this._contextMenu);
|
|
8016
8063
|
this._hasMouse = true;
|
|
8017
8064
|
} else {
|
|
8018
|
-
this.unbindCanvas("mousedown", this._mouseDown
|
|
8019
|
-
this.unbindCanvas("mouseup", this._mouseUp
|
|
8020
|
-
this.unbindCanvas("mouseover", this._mouseOver
|
|
8021
|
-
this.unbindCanvas("mouseout", this._mouseOut
|
|
8022
|
-
this.unbindCanvas("mousemove", this._mouseMove
|
|
8023
|
-
this.unbindCanvas("click", this._mouseClick
|
|
8024
|
-
this.unbindCanvas("contextmenu", this._contextMenu
|
|
8065
|
+
this.unbindCanvas("mousedown", this._mouseDown);
|
|
8066
|
+
this.unbindCanvas("mouseup", this._mouseUp);
|
|
8067
|
+
this.unbindCanvas("mouseover", this._mouseOver);
|
|
8068
|
+
this.unbindCanvas("mouseout", this._mouseOut);
|
|
8069
|
+
this.unbindCanvas("mousemove", this._mouseMove);
|
|
8070
|
+
this.unbindCanvas("click", this._mouseClick);
|
|
8071
|
+
this.unbindCanvas("contextmenu", this._contextMenu);
|
|
8025
8072
|
this._hasMouse = false;
|
|
8026
8073
|
}
|
|
8027
8074
|
return this;
|
|
@@ -8029,18 +8076,19 @@ var MultiTouchSpace = function (_Space) {
|
|
|
8029
8076
|
}, {
|
|
8030
8077
|
key: "bindTouch",
|
|
8031
8078
|
value: function bindTouch() {
|
|
8032
|
-
var
|
|
8079
|
+
var bind = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
8080
|
+
var passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
8033
8081
|
|
|
8034
|
-
if (
|
|
8035
|
-
this.bindCanvas("touchstart", this._touchStart.bind(this), { passive:
|
|
8082
|
+
if (bind) {
|
|
8083
|
+
this.bindCanvas("touchstart", this._touchStart.bind(this), { passive: passive });
|
|
8036
8084
|
this.bindCanvas("touchend", this._mouseUp.bind(this));
|
|
8037
|
-
this.bindCanvas("touchmove", this._touchMove.bind(this), { passive:
|
|
8085
|
+
this.bindCanvas("touchmove", this._touchMove.bind(this), { passive: passive });
|
|
8038
8086
|
this.bindCanvas("touchcancel", this._mouseOut.bind(this));
|
|
8039
8087
|
this._hasTouch = true;
|
|
8040
8088
|
} else {
|
|
8041
|
-
this.unbindCanvas("touchstart", this._touchStart.bind(this));
|
|
8089
|
+
this.unbindCanvas("touchstart", this._touchStart.bind(this), { passive: passive });
|
|
8042
8090
|
this.unbindCanvas("touchend", this._mouseUp.bind(this));
|
|
8043
|
-
this.unbindCanvas("touchmove", this._touchMove.bind(this));
|
|
8091
|
+
this.unbindCanvas("touchmove", this._touchMove.bind(this), { passive: passive });
|
|
8044
8092
|
this.unbindCanvas("touchcancel", this._mouseOut.bind(this));
|
|
8045
8093
|
this._hasTouch = false;
|
|
8046
8094
|
}
|
|
@@ -8186,7 +8234,7 @@ exports.MultiTouchSpace = MultiTouchSpace;
|
|
|
8186
8234
|
|
|
8187
8235
|
"use strict";
|
|
8188
8236
|
|
|
8189
|
-
/*!
|
|
8237
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
8190
8238
|
|
|
8191
8239
|
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; }; }();
|
|
8192
8240
|
|
|
@@ -8694,7 +8742,7 @@ SVGForm.domID = 0;
|
|
|
8694
8742
|
|
|
8695
8743
|
"use strict";
|
|
8696
8744
|
|
|
8697
|
-
/*!
|
|
8745
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
8698
8746
|
|
|
8699
8747
|
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; }; }();
|
|
8700
8748
|
|
|
@@ -8779,7 +8827,7 @@ exports.Typography = Typography;
|
|
|
8779
8827
|
|
|
8780
8828
|
"use strict";
|
|
8781
8829
|
|
|
8782
|
-
/*!
|
|
8830
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
8783
8831
|
|
|
8784
8832
|
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; }; }();
|
|
8785
8833
|
|
|
@@ -9167,7 +9215,7 @@ exports.UIDragger = UIDragger;
|
|
|
9167
9215
|
|
|
9168
9216
|
"use strict";
|
|
9169
9217
|
|
|
9170
|
-
/*!
|
|
9218
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
9171
9219
|
|
|
9172
9220
|
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; };
|
|
9173
9221
|
|
|
@@ -9179,6 +9227,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
9179
9227
|
|
|
9180
9228
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9181
9229
|
exports.Util = exports.Const = void 0;
|
|
9230
|
+
var Num_1 = __webpack_require__(/*! ./Num */ "./src/Num.ts");
|
|
9182
9231
|
var Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
|
|
9183
9232
|
exports.Const = {
|
|
9184
9233
|
xy: "xy",
|
|
@@ -9263,7 +9312,7 @@ var Util = function () {
|
|
|
9263
9312
|
var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
9264
9313
|
|
|
9265
9314
|
Util.warn("Util.randomInt is deprecated. Please use `Num.randomRange`");
|
|
9266
|
-
return Math.floor(
|
|
9315
|
+
return Math.floor(Num_1.Num.random() * range) + start;
|
|
9267
9316
|
}
|
|
9268
9317
|
}, {
|
|
9269
9318
|
key: "split",
|
|
@@ -9459,6 +9508,87 @@ __exportStar(__webpack_require__(/*! ./Typography */ "./src/Typography.ts"), exp
|
|
|
9459
9508
|
__exportStar(__webpack_require__(/*! ./Physics */ "./src/Physics.ts"), exports);
|
|
9460
9509
|
__exportStar(__webpack_require__(/*! ./Play */ "./src/Play.ts"), exports);
|
|
9461
9510
|
__exportStar(__webpack_require__(/*! ./UI */ "./src/UI.ts"), exports);
|
|
9511
|
+
__exportStar(__webpack_require__(/*! ./Image */ "./src/Image.ts"), exports);
|
|
9512
|
+
|
|
9513
|
+
/***/ }),
|
|
9514
|
+
|
|
9515
|
+
/***/ "./src/uheprng.ts":
|
|
9516
|
+
/*!************************!*\
|
|
9517
|
+
!*** ./src/uheprng.ts ***!
|
|
9518
|
+
\************************/
|
|
9519
|
+
/*! no static exports found */
|
|
9520
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
9521
|
+
|
|
9522
|
+
"use strict";
|
|
9523
|
+
|
|
9524
|
+
|
|
9525
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9526
|
+
function Mash() {
|
|
9527
|
+
var n = 0xefc8249d;
|
|
9528
|
+
var mash = function mash(data) {
|
|
9529
|
+
if (data) {
|
|
9530
|
+
data = data.toString();
|
|
9531
|
+
for (var i = 0; i < data.length; i++) {
|
|
9532
|
+
n += data.charCodeAt(i);
|
|
9533
|
+
var h = 0.02519603282416938 * n;
|
|
9534
|
+
n = h >>> 0;
|
|
9535
|
+
h -= n;
|
|
9536
|
+
h *= n;
|
|
9537
|
+
n = h >>> 0;
|
|
9538
|
+
h -= n;
|
|
9539
|
+
n += h * 0x100000000;
|
|
9540
|
+
}
|
|
9541
|
+
return (n >>> 0) * 2.3283064365386963e-10;
|
|
9542
|
+
} else n = 0xefc8249d;
|
|
9543
|
+
};
|
|
9544
|
+
return mash;
|
|
9545
|
+
}
|
|
9546
|
+
function default_1(seed) {
|
|
9547
|
+
var o = 48;
|
|
9548
|
+
var c = 1;
|
|
9549
|
+
var p = o;
|
|
9550
|
+
var s = new Array(o);
|
|
9551
|
+
var i,
|
|
9552
|
+
j,
|
|
9553
|
+
k = 0;
|
|
9554
|
+
var mash = Mash();
|
|
9555
|
+
for (i = 0; i < o; i++) {
|
|
9556
|
+
s[i] = mash(Math.random().toString());
|
|
9557
|
+
}function initState() {
|
|
9558
|
+
mash();
|
|
9559
|
+
for (i = 0; i < o; i++) {
|
|
9560
|
+
s[i] = mash(' ');
|
|
9561
|
+
}c = 1;
|
|
9562
|
+
p = o;
|
|
9563
|
+
}
|
|
9564
|
+
function cleanString(inStr) {
|
|
9565
|
+
inStr = inStr.replace(/(^\s*)|(\s*$)/gi, '');
|
|
9566
|
+
inStr = inStr.replace(/[\x00-\x1F]/gi, '');
|
|
9567
|
+
inStr = inStr.replace(/\n /, '\n');
|
|
9568
|
+
return inStr;
|
|
9569
|
+
}
|
|
9570
|
+
function hashString(inStr) {
|
|
9571
|
+
inStr = cleanString(inStr);
|
|
9572
|
+
mash(inStr);
|
|
9573
|
+
for (i = 0; i < inStr.length; i++) {
|
|
9574
|
+
k = inStr.charCodeAt(i);
|
|
9575
|
+
for (j = 0; j < o; j++) {
|
|
9576
|
+
s[j] -= mash(k.toString());
|
|
9577
|
+
if (s[j] < 0) s[j] += 1;
|
|
9578
|
+
}
|
|
9579
|
+
}
|
|
9580
|
+
}
|
|
9581
|
+
initState();
|
|
9582
|
+
hashString(seed);
|
|
9583
|
+
return {
|
|
9584
|
+
random: function random() {
|
|
9585
|
+
if (++p >= o) p = 0;
|
|
9586
|
+
var t = 1768863 * s[p] + c * 2.3283064365386963e-10;
|
|
9587
|
+
return s[p] = t - (c = t | 0);
|
|
9588
|
+
}
|
|
9589
|
+
};
|
|
9590
|
+
}
|
|
9591
|
+
exports.default = default_1;
|
|
9462
9592
|
|
|
9463
9593
|
/***/ })
|
|
9464
9594
|
|