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/pts.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * pts.js 0.10.5 - Copyright © 2017-2021 William Ngan and contributors.
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
- /*! Source code licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
113
+ /*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
114
114
  Object.defineProperty(exports, "__esModule", { value: true });
115
115
  exports.CanvasForm = exports.CanvasSpace = void 0;
116
116
  const Space_1 = __webpack_require__(/*! ./Space */ "./src/Space.ts");
@@ -202,6 +202,9 @@ class CanvasSpace extends Space_1.MultiTouchSpace {
202
202
  else {
203
203
  this._offscreen = false;
204
204
  }
205
+ if (opt.pixelDensity) {
206
+ this._pixelScale = opt.pixelDensity;
207
+ }
205
208
  return this;
206
209
  }
207
210
  set autoResize(auto) {
@@ -218,13 +221,13 @@ class CanvasSpace extends Space_1.MultiTouchSpace {
218
221
  get autoResize() { return this._autoResize; }
219
222
  resize(b, evt) {
220
223
  this.bound = b;
221
- this._canvas.width = this.bound.size.x * this._pixelScale;
222
- this._canvas.height = this.bound.size.y * this._pixelScale;
223
- this._canvas.style.width = Math.floor(this.bound.size.x) + "px";
224
- this._canvas.style.height = Math.floor(this.bound.size.y) + "px";
224
+ this._canvas.width = Math.ceil(this.bound.size.x) * this._pixelScale;
225
+ this._canvas.height = Math.ceil(this.bound.size.y) * this._pixelScale;
226
+ this._canvas.style.width = Math.ceil(this.bound.size.x) + "px";
227
+ this._canvas.style.height = Math.ceil(this.bound.size.y) + "px";
225
228
  if (this._offscreen) {
226
- this._offCanvas.width = this.bound.size.x * this._pixelScale;
227
- this._offCanvas.height = this.bound.size.y * this._pixelScale;
229
+ this._offCanvas.width = Math.ceil(this.bound.size.x) * this._pixelScale;
230
+ this._offCanvas.height = Math.ceil(this.bound.size.y) * this._pixelScale;
228
231
  }
229
232
  if (this._pixelScale != 1) {
230
233
  this._ctx.scale(this._pixelScale, this._pixelScale);
@@ -279,27 +282,29 @@ class CanvasSpace extends Space_1.MultiTouchSpace {
279
282
  if (bg)
280
283
  this._bgcolor = bg;
281
284
  const lastColor = this._ctx.fillStyle;
285
+ const px = Math.ceil(this.pixelScale);
282
286
  if (!this._bgcolor || this._bgcolor === "transparent") {
283
- this._ctx.clearRect(-1, -1, this._canvas.width + 1, this._canvas.height + 1);
287
+ this._ctx.clearRect(-px, -px, this._canvas.width + px, this._canvas.height + px);
284
288
  }
285
289
  else {
286
290
  if (this._bgcolor.indexOf("rgba") === 0 || (this._bgcolor.length === 9 && this._bgcolor.indexOf("#") === 0)) {
287
- this._ctx.clearRect(-1, -1, this._canvas.width + 1, this._canvas.height + 1);
291
+ this._ctx.clearRect(-px, -px, this._canvas.width + px, this._canvas.height + px);
288
292
  }
289
293
  this._ctx.fillStyle = this._bgcolor;
290
- this._ctx.fillRect(-1, -1, this._canvas.width + 1, this._canvas.height + 1);
294
+ this._ctx.fillRect(-px, -px, this._canvas.width + px, this._canvas.height + px);
291
295
  }
292
296
  this._ctx.fillStyle = lastColor;
293
297
  return this;
294
298
  }
295
299
  clearOffscreen(bg) {
296
300
  if (this._offscreen) {
301
+ const px = Math.ceil(this.pixelScale);
297
302
  if (bg) {
298
303
  this._offCtx.fillStyle = bg;
299
- this._offCtx.fillRect(-1, -1, this._canvas.width + 1, this._canvas.height + 1);
304
+ this._offCtx.fillRect(-px, -px, this._canvas.width + px, this._canvas.height + px);
300
305
  }
301
306
  else {
302
- this._offCtx.clearRect(-1, -1, this._offCanvas.width + 1, this._offCanvas.height + 1);
307
+ this._offCtx.clearRect(-px, -px, this._offCanvas.width + px, this._offCanvas.height + px);
303
308
  }
304
309
  }
305
310
  return this;
@@ -352,6 +357,8 @@ class CanvasForm extends Form_1.VisualForm {
352
357
  lineWidth: 1, lineJoin: "bevel", lineCap: "butt",
353
358
  globalAlpha: 1
354
359
  };
360
+ if (!space)
361
+ return this;
355
362
  const _setup = (ctx) => {
356
363
  this._ctx = ctx;
357
364
  this._ctx.fillStyle = this._style.fillStyle;
@@ -422,6 +429,19 @@ class CanvasForm extends Form_1.VisualForm {
422
429
  }
423
430
  return this;
424
431
  }
432
+ applyFillStroke(filled = true, stroked = true, strokeWidth = 1) {
433
+ if (filled) {
434
+ if (typeof filled === 'string')
435
+ this.fill(filled);
436
+ this._ctx.fill();
437
+ }
438
+ if (stroked) {
439
+ if (typeof stroked === 'string')
440
+ this.stroke(stroked, strokeWidth);
441
+ this._ctx.stroke();
442
+ }
443
+ return this;
444
+ }
425
445
  gradient(stops) {
426
446
  let vals = [];
427
447
  if (stops.length < 2)
@@ -790,7 +810,7 @@ exports.CanvasForm = CanvasForm;
790
810
 
791
811
  "use strict";
792
812
 
793
- /*! Source code licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
813
+ /*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
794
814
  Object.defineProperty(exports, "__esModule", { value: true });
795
815
  exports.Color = void 0;
796
816
  const Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
@@ -1046,12 +1066,12 @@ class Color extends Pt_1.Pt {
1046
1066
  static XYZtoRGB(xyz, normalizedInput = false, normalizedOutput = false) {
1047
1067
  let [x, y, z] = (!normalizedInput) ? xyz.$normalize() : xyz;
1048
1068
  let rgb = [
1049
- x * 3.2404542 + y * -1.5371385 + z * -0.4985314,
1050
- x * -0.9692660 + y * 1.8760108 + z * 0.0415560,
1051
- x * 0.0556434 + y * -0.2040259 + z * 1.0572252
1069
+ x * 3.2406254773200533 + y * -1.5372079722103187 + z * -0.4986285986982479,
1070
+ x * -0.9689307147293197 + y * 1.8757560608852415 + z * 0.041517523842953964,
1071
+ x * 0.055710120445510616 + y * -0.2040210505984867 + z * 1.0569959422543882
1052
1072
  ];
1053
1073
  for (let i = 0; i < 3; i++) {
1054
- rgb[i] = (rgb[i] < 0) ? 0 : (rgb[i] > 0.0031308) ? (1.055 * Math.pow(rgb[i], 1 / 2.4) - 0.055) : (12.92 * rgb[i]);
1074
+ rgb[i] = (rgb[i] > 0.0031308) ? (1.055 * Math.pow(rgb[i], 1 / 2.4) - 0.055) : (12.92 * rgb[i]);
1055
1075
  rgb[i] = Math.max(0, Math.min(1, rgb[i]));
1056
1076
  if (!normalizedOutput)
1057
1077
  rgb[i] = Math.round(rgb[i] * 255);
@@ -1061,8 +1081,10 @@ class Color extends Pt_1.Pt {
1061
1081
  }
1062
1082
  static XYZtoLAB(xyz, normalizedInput = false, normalizedOutput = false) {
1063
1083
  let c = (normalizedInput) ? xyz.$normalize(false) : xyz.clone();
1084
+ const eps = 0.00885645167;
1085
+ const kap = 903.296296296;
1064
1086
  c.divide(Color.D65);
1065
- let fn = (n) => (n > 0.008856) ? Math.pow(n, 1 / 3) : (7.787 * n) + 16 / 116;
1087
+ let fn = (n) => (n > eps) ? Math.pow(n, 1 / 3) : (kap * n + 16) / 116;
1066
1088
  let cy = fn(c[1]);
1067
1089
  let cc = Color.lab((116 * cy) - 16, 500 * (fn(c[0]) - cy), 200 * (cy - fn(c[2])), xyz.alpha);
1068
1090
  return (normalizedOutput) ? cc.normalize() : cc;
@@ -1072,12 +1094,12 @@ class Color extends Pt_1.Pt {
1072
1094
  let y = (c[0] + 16) / 116;
1073
1095
  let x = (c[1] / 500) + y;
1074
1096
  let z = y - c[2] / 200;
1075
- let fn = (n) => {
1076
- let nnn = n * n * n;
1077
- return (nnn > 0.008856) ? nnn : (n - 16 / 116) / 7.787;
1078
- };
1097
+ const eps = 0.00885645167;
1098
+ const kap = 903.296296296;
1079
1099
  let d = Color.D65;
1080
- let cc = Color.xyz(Math.max(0, d[0] * fn(x)), Math.max(0, d[1] * fn(y)), Math.max(0, d[2] * fn(z)), lab.alpha);
1100
+ const xxx = Math.pow(x, 3);
1101
+ const zzz = Math.pow(z, 3);
1102
+ let 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);
1081
1103
  return (normalizedOutput) ? cc.normalize() : cc;
1082
1104
  }
1083
1105
  static XYZtoLUV(xyz, normalizedInput = false, normalizedOutput = false) {
@@ -1140,7 +1162,7 @@ Color.ranges = {
1140
1162
 
1141
1163
  "use strict";
1142
1164
 
1143
- /*! Source code licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
1165
+ /*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
1144
1166
  Object.defineProperty(exports, "__esModule", { value: true });
1145
1167
  exports.Delaunay = exports.Noise = exports.Create = void 0;
1146
1168
  const Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
@@ -1152,11 +1174,11 @@ class Create {
1152
1174
  static distributeRandom(bound, count, dimensions = 2) {
1153
1175
  let pts = new Pt_1.Group();
1154
1176
  for (let i = 0; i < count; i++) {
1155
- let p = [bound.x + Math.random() * bound.width];
1177
+ let p = [bound.x + Num_1.Num.random() * bound.width];
1156
1178
  if (dimensions > 1)
1157
- p.push(bound.y + Math.random() * bound.height);
1179
+ p.push(bound.y + Num_1.Num.random() * bound.height);
1158
1180
  if (dimensions > 2)
1159
- p.push(bound.z + Math.random() * bound.depth);
1181
+ p.push(bound.z + Num_1.Num.random() * bound.depth);
1160
1182
  pts.push(new Pt_1.Pt(p));
1161
1183
  }
1162
1184
  return pts;
@@ -1202,7 +1224,7 @@ class Create {
1202
1224
  return g;
1203
1225
  }
1204
1226
  static noisePts(pts, dx = 0.01, dy = 0.01, rows = 0, columns = 0) {
1205
- let seed = Math.random();
1227
+ let seed = Num_1.Num.random();
1206
1228
  let g = new Pt_1.Group();
1207
1229
  let i = 0;
1208
1230
  for (let p of pts) {
@@ -1432,7 +1454,7 @@ exports.Delaunay = Delaunay;
1432
1454
 
1433
1455
  "use strict";
1434
1456
 
1435
- /*! Source code licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
1457
+ /*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
1436
1458
  Object.defineProperty(exports, "__esModule", { value: true });
1437
1459
  exports.HTMLForm = exports.HTMLSpace = exports.DOMSpace = void 0;
1438
1460
  const Space_1 = __webpack_require__(/*! ./Space */ "./src/Space.ts");
@@ -1897,7 +1919,7 @@ HTMLForm.domID = 0;
1897
1919
 
1898
1920
  "use strict";
1899
1921
 
1900
- /*! Source code licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
1922
+ /*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
1901
1923
  Object.defineProperty(exports, "__esModule", { value: true });
1902
1924
  exports.Font = exports.VisualForm = exports.Form = void 0;
1903
1925
  class Form {
@@ -2163,7 +2185,7 @@ exports.Img = Img;
2163
2185
 
2164
2186
  "use strict";
2165
2187
 
2166
- /*! Source code licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
2188
+ /*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
2167
2189
  Object.defineProperty(exports, "__esModule", { value: true });
2168
2190
  exports.Mat = exports.Vec = void 0;
2169
2191
  const Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
@@ -2430,13 +2452,14 @@ exports.Mat = Mat;
2430
2452
 
2431
2453
  "use strict";
2432
2454
 
2433
- /*! Source code licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
2455
+ /*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
2434
2456
  Object.defineProperty(exports, "__esModule", { value: true });
2435
2457
  exports.Range = exports.Shaping = exports.Geom = exports.Num = void 0;
2436
2458
  const Util_1 = __webpack_require__(/*! ./Util */ "./src/Util.ts");
2437
2459
  const Op_1 = __webpack_require__(/*! ./Op */ "./src/Op.ts");
2438
2460
  const Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
2439
2461
  const LinearAlgebra_1 = __webpack_require__(/*! ./LinearAlgebra */ "./src/LinearAlgebra.ts");
2462
+ const uheprng_1 = __webpack_require__(/*! ./uheprng */ "./src/uheprng.ts");
2440
2463
  class Num {
2441
2464
  static equals(a, b, threshold = 0.00001) {
2442
2465
  return Math.abs(a - b) < threshold;
@@ -2461,14 +2484,14 @@ class Num {
2461
2484
  }
2462
2485
  static randomRange(a, b = 0) {
2463
2486
  let r = (a > b) ? (a - b) : (b - a);
2464
- return a + Math.random() * r;
2487
+ return a + Num.random() * r;
2465
2488
  }
2466
2489
  static randomPt(a, b) {
2467
2490
  let p = new Pt_1.Pt(a.length);
2468
2491
  let range = b ? LinearAlgebra_1.Vec.subtract(b, a) : a;
2469
2492
  let start = b ? a : new Pt_1.Pt(a.length).fill(0);
2470
2493
  for (let i = 0, len = p.length; i < len; i++) {
2471
- p[i] = Math.random() * range[i] + start[i];
2494
+ p[i] = Num.random() * range[i] + start[i];
2472
2495
  }
2473
2496
  return p;
2474
2497
  }
@@ -2499,6 +2522,14 @@ class Num {
2499
2522
  let max = Math.max(targetA, targetB);
2500
2523
  return Num.normalizeValue(n, currA, currB) * (max - min) + min;
2501
2524
  }
2525
+ static seed(seed) {
2526
+ this.generator = uheprng_1.default(seed);
2527
+ }
2528
+ static random() {
2529
+ return this.generator
2530
+ ? this.generator.random()
2531
+ : Math.random();
2532
+ }
2502
2533
  }
2503
2534
  exports.Num = Num;
2504
2535
  class Geom {
@@ -2916,7 +2947,7 @@ exports.Range = Range;
2916
2947
 
2917
2948
  "use strict";
2918
2949
 
2919
- /*! Source code licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
2950
+ /*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
2920
2951
  Object.defineProperty(exports, "__esModule", { value: true });
2921
2952
  exports.Curve = exports.Polygon = exports.Triangle = exports.Circle = exports.Rectangle = exports.Line = void 0;
2922
2953
  const Util_1 = __webpack_require__(/*! ./Util */ "./src/Util.ts");
@@ -3914,7 +3945,7 @@ exports.Curve = Curve;
3914
3945
 
3915
3946
  "use strict";
3916
3947
 
3917
- /*! Source code licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
3948
+ /*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
3918
3949
  Object.defineProperty(exports, "__esModule", { value: true });
3919
3950
  exports.Body = exports.Particle = exports.World = void 0;
3920
3951
  const Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
@@ -4669,7 +4700,7 @@ exports.Sound = Sound;
4669
4700
 
4670
4701
  "use strict";
4671
4702
 
4672
- /*! Source code licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
4703
+ /*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
4673
4704
  Object.defineProperty(exports, "__esModule", { value: true });
4674
4705
  exports.Bound = exports.Group = exports.Pt = void 0;
4675
4706
  const Util_1 = __webpack_require__(/*! ./Util */ "./src/Util.ts");
@@ -4690,7 +4721,7 @@ class Pt extends Float32Array {
4690
4721
  p.fill(defaultValue);
4691
4722
  if (randomize) {
4692
4723
  for (let i = 0, len = p.length; i < len; i++) {
4693
- p[i] = p[i] * Math.random();
4724
+ p[i] = p[i] * Num_1.Num.random();
4694
4725
  }
4695
4726
  }
4696
4727
  return new Pt(p);
@@ -5146,7 +5177,7 @@ exports.Bound = Bound;
5146
5177
 
5147
5178
  "use strict";
5148
5179
 
5149
- /*! Source code licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
5180
+ /*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
5150
5181
  Object.defineProperty(exports, "__esModule", { value: true });
5151
5182
  exports.MultiTouchSpace = exports.Space = void 0;
5152
5183
  const Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
@@ -5241,7 +5272,7 @@ class Space {
5241
5272
  this._time.end = t;
5242
5273
  return this;
5243
5274
  }
5244
- playOnce(duration = 5000) {
5275
+ playOnce(duration = 0) {
5245
5276
  this.play();
5246
5277
  this.stop(duration);
5247
5278
  return this;
@@ -5278,44 +5309,51 @@ class MultiTouchSpace extends Space {
5278
5309
  bindCanvas(evt, callback, options = {}) {
5279
5310
  this._canvas.addEventListener(evt, callback, options);
5280
5311
  }
5281
- unbindCanvas(evt, callback) {
5282
- this._canvas.removeEventListener(evt, callback);
5312
+ unbindCanvas(evt, callback, options = {}) {
5313
+ this._canvas.removeEventListener(evt, callback, options);
5283
5314
  }
5284
5315
  bindMouse(_bind = true) {
5285
5316
  if (_bind) {
5286
- this.bindCanvas("mousedown", this._mouseDown.bind(this));
5287
- this.bindCanvas("mouseup", this._mouseUp.bind(this));
5288
- this.bindCanvas("mouseover", this._mouseOver.bind(this));
5289
- this.bindCanvas("mouseout", this._mouseOut.bind(this));
5290
- this.bindCanvas("mousemove", this._mouseMove.bind(this));
5291
- this.bindCanvas("click", this._mouseClick.bind(this));
5292
- this.bindCanvas("contextmenu", this._contextMenu.bind(this));
5317
+ this._mouseDown = this._mouseDown.bind(this);
5318
+ this._mouseUp = this._mouseUp.bind(this);
5319
+ this._mouseOver = this._mouseOver.bind(this);
5320
+ this._mouseOut = this._mouseOut.bind(this);
5321
+ this._mouseMove = this._mouseMove.bind(this);
5322
+ this._mouseClick = this._mouseClick.bind(this);
5323
+ this._contextMenu = this._contextMenu.bind(this);
5324
+ this.bindCanvas("mousedown", this._mouseDown);
5325
+ this.bindCanvas("mouseup", this._mouseUp);
5326
+ this.bindCanvas("mouseover", this._mouseOver);
5327
+ this.bindCanvas("mouseout", this._mouseOut);
5328
+ this.bindCanvas("mousemove", this._mouseMove);
5329
+ this.bindCanvas("click", this._mouseClick);
5330
+ this.bindCanvas("contextmenu", this._contextMenu);
5293
5331
  this._hasMouse = true;
5294
5332
  }
5295
5333
  else {
5296
- this.unbindCanvas("mousedown", this._mouseDown.bind(this));
5297
- this.unbindCanvas("mouseup", this._mouseUp.bind(this));
5298
- this.unbindCanvas("mouseover", this._mouseOver.bind(this));
5299
- this.unbindCanvas("mouseout", this._mouseOut.bind(this));
5300
- this.unbindCanvas("mousemove", this._mouseMove.bind(this));
5301
- this.unbindCanvas("click", this._mouseClick.bind(this));
5302
- this.unbindCanvas("contextmenu", this._contextMenu.bind(this));
5334
+ this.unbindCanvas("mousedown", this._mouseDown);
5335
+ this.unbindCanvas("mouseup", this._mouseUp);
5336
+ this.unbindCanvas("mouseover", this._mouseOver);
5337
+ this.unbindCanvas("mouseout", this._mouseOut);
5338
+ this.unbindCanvas("mousemove", this._mouseMove);
5339
+ this.unbindCanvas("click", this._mouseClick);
5340
+ this.unbindCanvas("contextmenu", this._contextMenu);
5303
5341
  this._hasMouse = false;
5304
5342
  }
5305
5343
  return this;
5306
5344
  }
5307
- bindTouch(_bind = true) {
5308
- if (_bind) {
5309
- this.bindCanvas("touchstart", this._touchStart.bind(this), { passive: true });
5345
+ bindTouch(bind = true, passive = false) {
5346
+ if (bind) {
5347
+ this.bindCanvas("touchstart", this._touchStart.bind(this), { passive: passive });
5310
5348
  this.bindCanvas("touchend", this._mouseUp.bind(this));
5311
- this.bindCanvas("touchmove", this._touchMove.bind(this), { passive: true });
5349
+ this.bindCanvas("touchmove", this._touchMove.bind(this), { passive: passive });
5312
5350
  this.bindCanvas("touchcancel", this._mouseOut.bind(this));
5313
5351
  this._hasTouch = true;
5314
5352
  }
5315
5353
  else {
5316
- this.unbindCanvas("touchstart", this._touchStart.bind(this));
5354
+ this.unbindCanvas("touchstart", this._touchStart.bind(this), { passive: passive });
5317
5355
  this.unbindCanvas("touchend", this._mouseUp.bind(this));
5318
- this.unbindCanvas("touchmove", this._touchMove.bind(this));
5356
+ this.unbindCanvas("touchmove", this._touchMove.bind(this), { passive: passive });
5319
5357
  this.unbindCanvas("touchcancel", this._mouseOut.bind(this));
5320
5358
  this._hasTouch = false;
5321
5359
  }
@@ -5432,7 +5470,7 @@ exports.MultiTouchSpace = MultiTouchSpace;
5432
5470
 
5433
5471
  "use strict";
5434
5472
 
5435
- /*! Source code licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
5473
+ /*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
5436
5474
  Object.defineProperty(exports, "__esModule", { value: true });
5437
5475
  exports.SVGForm = exports.SVGSpace = void 0;
5438
5476
  const Form_1 = __webpack_require__(/*! ./Form */ "./src/Form.ts");
@@ -5815,7 +5853,7 @@ SVGForm.domID = 0;
5815
5853
 
5816
5854
  "use strict";
5817
5855
 
5818
- /*! Source code licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
5856
+ /*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
5819
5857
  Object.defineProperty(exports, "__esModule", { value: true });
5820
5858
 
5821
5859
 
@@ -5830,7 +5868,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
5830
5868
 
5831
5869
  "use strict";
5832
5870
 
5833
- /*! Source code licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
5871
+ /*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
5834
5872
  Object.defineProperty(exports, "__esModule", { value: true });
5835
5873
  exports.Typography = void 0;
5836
5874
  const Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
@@ -5885,7 +5923,7 @@ exports.Typography = Typography;
5885
5923
 
5886
5924
  "use strict";
5887
5925
 
5888
- /*! Source code licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
5926
+ /*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
5889
5927
  Object.defineProperty(exports, "__esModule", { value: true });
5890
5928
  exports.UIDragger = exports.UIButton = exports.UI = exports.UIPointerActions = exports.UIShape = void 0;
5891
5929
  const Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
@@ -6171,9 +6209,10 @@ exports.UIDragger = UIDragger;
6171
6209
 
6172
6210
  "use strict";
6173
6211
 
6174
- /*! Source code licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
6212
+ /*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
6175
6213
  Object.defineProperty(exports, "__esModule", { value: true });
6176
6214
  exports.Util = exports.Const = void 0;
6215
+ const Num_1 = __webpack_require__(/*! ./Num */ "./src/Num.ts");
6177
6216
  const Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
6178
6217
  exports.Const = {
6179
6218
  xy: "xy",
@@ -6245,7 +6284,7 @@ class Util {
6245
6284
  }
6246
6285
  static randomInt(range, start = 0) {
6247
6286
  Util.warn("Util.randomInt is deprecated. Please use `Num.randomRange`");
6248
- return Math.floor(Math.random() * range) + start;
6287
+ return Math.floor(Num_1.Num.random() * range) + start;
6249
6288
  }
6250
6289
  static split(pts, size, stride, loopBack = false, matchSize = true) {
6251
6290
  let chunks = [];
@@ -6432,6 +6471,88 @@ let quickStart = (id, bg = "#9ab") => {
6432
6471
  exports.quickStart = quickStart;
6433
6472
 
6434
6473
 
6474
+ /***/ }),
6475
+
6476
+ /***/ "./src/uheprng.ts":
6477
+ /*!************************!*\
6478
+ !*** ./src/uheprng.ts ***!
6479
+ \************************/
6480
+ /*! no static exports found */
6481
+ /***/ (function(module, exports, __webpack_require__) {
6482
+
6483
+ "use strict";
6484
+
6485
+ Object.defineProperty(exports, "__esModule", { value: true });
6486
+ function Mash() {
6487
+ var n = 0xefc8249d;
6488
+ var mash = function (data) {
6489
+ if (data) {
6490
+ data = data.toString();
6491
+ for (var i = 0; i < data.length; i++) {
6492
+ n += data.charCodeAt(i);
6493
+ var h = 0.02519603282416938 * n;
6494
+ n = h >>> 0;
6495
+ h -= n;
6496
+ h *= n;
6497
+ n = h >>> 0;
6498
+ h -= n;
6499
+ n += h * 0x100000000;
6500
+ }
6501
+ return (n >>> 0) * 2.3283064365386963e-10;
6502
+ }
6503
+ else
6504
+ n = 0xefc8249d;
6505
+ };
6506
+ return mash;
6507
+ }
6508
+ function default_1(seed) {
6509
+ var o = 48;
6510
+ var c = 1;
6511
+ var p = o;
6512
+ var s = new Array(o);
6513
+ var i, j, k = 0;
6514
+ var mash = Mash();
6515
+ for (i = 0; i < o; i++)
6516
+ s[i] = mash(Math.random().toString());
6517
+ function initState() {
6518
+ mash();
6519
+ for (i = 0; i < o; i++)
6520
+ s[i] = mash(' ');
6521
+ c = 1;
6522
+ p = o;
6523
+ }
6524
+ function cleanString(inStr) {
6525
+ inStr = inStr.replace(/(^\s*)|(\s*$)/gi, '');
6526
+ inStr = inStr.replace(/[\x00-\x1F]/gi, '');
6527
+ inStr = inStr.replace(/\n /, '\n');
6528
+ return inStr;
6529
+ }
6530
+ function hashString(inStr) {
6531
+ inStr = cleanString(inStr);
6532
+ mash(inStr);
6533
+ for (i = 0; i < inStr.length; i++) {
6534
+ k = inStr.charCodeAt(i);
6535
+ for (j = 0; j < o; j++) {
6536
+ s[j] -= mash(k.toString());
6537
+ if (s[j] < 0)
6538
+ s[j] += 1;
6539
+ }
6540
+ }
6541
+ }
6542
+ initState();
6543
+ hashString(seed);
6544
+ return {
6545
+ random() {
6546
+ if (++p >= o)
6547
+ p = 0;
6548
+ var t = 1768863 * s[p] + c * 2.3283064365386963e-10;
6549
+ return (s[p] = t - (c = t | 0));
6550
+ }
6551
+ };
6552
+ }
6553
+ exports.default = default_1;
6554
+
6555
+
6435
6556
  /***/ })
6436
6557
 
6437
6558
  /******/ });