pts 0.10.7 → 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 +27 -12
- package/dist/es2015/Color.js +1 -1
- package/dist/es2015/Create.js +1 -1
- 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 +1 -1
- package/dist/es2015/Op.js +1 -1
- package/dist/es2015/Physics.js +1 -1
- package/dist/es2015/Pt.js +1 -1
- package/dist/es2015/Space.js +22 -16
- 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 +1 -1
- package/dist/es5.js +67 -42
- package/dist/index.js +63 -42
- package/dist/pts.d.ts +1 -0
- package/dist/pts.js +64 -43
- package/dist/pts.min.js +2 -2
- package/package.json +1 -1
package/dist/index.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
|
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");
|
|
@@ -221,13 +221,13 @@ class CanvasSpace extends Space_1.MultiTouchSpace {
|
|
|
221
221
|
get autoResize() { return this._autoResize; }
|
|
222
222
|
resize(b, evt) {
|
|
223
223
|
this.bound = b;
|
|
224
|
-
this._canvas.width = this.bound.size.x * this._pixelScale;
|
|
225
|
-
this._canvas.height = this.bound.size.y * this._pixelScale;
|
|
226
|
-
this._canvas.style.width = Math.
|
|
227
|
-
this._canvas.style.height = Math.
|
|
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";
|
|
228
228
|
if (this._offscreen) {
|
|
229
|
-
this._offCanvas.width = this.bound.size.x * this._pixelScale;
|
|
230
|
-
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;
|
|
231
231
|
}
|
|
232
232
|
if (this._pixelScale != 1) {
|
|
233
233
|
this._ctx.scale(this._pixelScale, this._pixelScale);
|
|
@@ -282,27 +282,29 @@ class CanvasSpace extends Space_1.MultiTouchSpace {
|
|
|
282
282
|
if (bg)
|
|
283
283
|
this._bgcolor = bg;
|
|
284
284
|
const lastColor = this._ctx.fillStyle;
|
|
285
|
+
const px = Math.ceil(this.pixelScale);
|
|
285
286
|
if (!this._bgcolor || this._bgcolor === "transparent") {
|
|
286
|
-
this._ctx.clearRect(-
|
|
287
|
+
this._ctx.clearRect(-px, -px, this._canvas.width + px, this._canvas.height + px);
|
|
287
288
|
}
|
|
288
289
|
else {
|
|
289
290
|
if (this._bgcolor.indexOf("rgba") === 0 || (this._bgcolor.length === 9 && this._bgcolor.indexOf("#") === 0)) {
|
|
290
|
-
this._ctx.clearRect(-
|
|
291
|
+
this._ctx.clearRect(-px, -px, this._canvas.width + px, this._canvas.height + px);
|
|
291
292
|
}
|
|
292
293
|
this._ctx.fillStyle = this._bgcolor;
|
|
293
|
-
this._ctx.fillRect(-
|
|
294
|
+
this._ctx.fillRect(-px, -px, this._canvas.width + px, this._canvas.height + px);
|
|
294
295
|
}
|
|
295
296
|
this._ctx.fillStyle = lastColor;
|
|
296
297
|
return this;
|
|
297
298
|
}
|
|
298
299
|
clearOffscreen(bg) {
|
|
299
300
|
if (this._offscreen) {
|
|
301
|
+
const px = Math.ceil(this.pixelScale);
|
|
300
302
|
if (bg) {
|
|
301
303
|
this._offCtx.fillStyle = bg;
|
|
302
|
-
this._offCtx.fillRect(-
|
|
304
|
+
this._offCtx.fillRect(-px, -px, this._canvas.width + px, this._canvas.height + px);
|
|
303
305
|
}
|
|
304
306
|
else {
|
|
305
|
-
this._offCtx.clearRect(-
|
|
307
|
+
this._offCtx.clearRect(-px, -px, this._offCanvas.width + px, this._offCanvas.height + px);
|
|
306
308
|
}
|
|
307
309
|
}
|
|
308
310
|
return this;
|
|
@@ -427,6 +429,19 @@ class CanvasForm extends Form_1.VisualForm {
|
|
|
427
429
|
}
|
|
428
430
|
return this;
|
|
429
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
|
+
}
|
|
430
445
|
gradient(stops) {
|
|
431
446
|
let vals = [];
|
|
432
447
|
if (stops.length < 2)
|
|
@@ -795,7 +810,7 @@ exports.CanvasForm = CanvasForm;
|
|
|
795
810
|
|
|
796
811
|
"use strict";
|
|
797
812
|
|
|
798
|
-
/*!
|
|
813
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
799
814
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
800
815
|
exports.Color = void 0;
|
|
801
816
|
const Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
|
|
@@ -1147,7 +1162,7 @@ Color.ranges = {
|
|
|
1147
1162
|
|
|
1148
1163
|
"use strict";
|
|
1149
1164
|
|
|
1150
|
-
/*!
|
|
1165
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
1151
1166
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1152
1167
|
exports.Delaunay = exports.Noise = exports.Create = void 0;
|
|
1153
1168
|
const Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
|
|
@@ -1439,7 +1454,7 @@ exports.Delaunay = Delaunay;
|
|
|
1439
1454
|
|
|
1440
1455
|
"use strict";
|
|
1441
1456
|
|
|
1442
|
-
/*!
|
|
1457
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
1443
1458
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1444
1459
|
exports.HTMLForm = exports.HTMLSpace = exports.DOMSpace = void 0;
|
|
1445
1460
|
const Space_1 = __webpack_require__(/*! ./Space */ "./src/Space.ts");
|
|
@@ -1904,7 +1919,7 @@ HTMLForm.domID = 0;
|
|
|
1904
1919
|
|
|
1905
1920
|
"use strict";
|
|
1906
1921
|
|
|
1907
|
-
/*!
|
|
1922
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
1908
1923
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1909
1924
|
exports.Font = exports.VisualForm = exports.Form = void 0;
|
|
1910
1925
|
class Form {
|
|
@@ -2170,7 +2185,7 @@ exports.Img = Img;
|
|
|
2170
2185
|
|
|
2171
2186
|
"use strict";
|
|
2172
2187
|
|
|
2173
|
-
/*!
|
|
2188
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
2174
2189
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2175
2190
|
exports.Mat = exports.Vec = void 0;
|
|
2176
2191
|
const Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
|
|
@@ -2437,7 +2452,7 @@ exports.Mat = Mat;
|
|
|
2437
2452
|
|
|
2438
2453
|
"use strict";
|
|
2439
2454
|
|
|
2440
|
-
/*!
|
|
2455
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
2441
2456
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2442
2457
|
exports.Range = exports.Shaping = exports.Geom = exports.Num = void 0;
|
|
2443
2458
|
const Util_1 = __webpack_require__(/*! ./Util */ "./src/Util.ts");
|
|
@@ -2932,7 +2947,7 @@ exports.Range = Range;
|
|
|
2932
2947
|
|
|
2933
2948
|
"use strict";
|
|
2934
2949
|
|
|
2935
|
-
/*!
|
|
2950
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
2936
2951
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2937
2952
|
exports.Curve = exports.Polygon = exports.Triangle = exports.Circle = exports.Rectangle = exports.Line = void 0;
|
|
2938
2953
|
const Util_1 = __webpack_require__(/*! ./Util */ "./src/Util.ts");
|
|
@@ -3930,7 +3945,7 @@ exports.Curve = Curve;
|
|
|
3930
3945
|
|
|
3931
3946
|
"use strict";
|
|
3932
3947
|
|
|
3933
|
-
/*!
|
|
3948
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
3934
3949
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3935
3950
|
exports.Body = exports.Particle = exports.World = void 0;
|
|
3936
3951
|
const Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
|
|
@@ -4685,7 +4700,7 @@ exports.Sound = Sound;
|
|
|
4685
4700
|
|
|
4686
4701
|
"use strict";
|
|
4687
4702
|
|
|
4688
|
-
/*!
|
|
4703
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
4689
4704
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4690
4705
|
exports.Bound = exports.Group = exports.Pt = void 0;
|
|
4691
4706
|
const Util_1 = __webpack_require__(/*! ./Util */ "./src/Util.ts");
|
|
@@ -5162,7 +5177,7 @@ exports.Bound = Bound;
|
|
|
5162
5177
|
|
|
5163
5178
|
"use strict";
|
|
5164
5179
|
|
|
5165
|
-
/*!
|
|
5180
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
5166
5181
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5167
5182
|
exports.MultiTouchSpace = exports.Space = void 0;
|
|
5168
5183
|
const Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
|
|
@@ -5257,7 +5272,7 @@ class Space {
|
|
|
5257
5272
|
this._time.end = t;
|
|
5258
5273
|
return this;
|
|
5259
5274
|
}
|
|
5260
|
-
playOnce(duration =
|
|
5275
|
+
playOnce(duration = 0) {
|
|
5261
5276
|
this.play();
|
|
5262
5277
|
this.stop(duration);
|
|
5263
5278
|
return this;
|
|
@@ -5299,23 +5314,29 @@ class MultiTouchSpace extends Space {
|
|
|
5299
5314
|
}
|
|
5300
5315
|
bindMouse(_bind = true) {
|
|
5301
5316
|
if (_bind) {
|
|
5302
|
-
this.
|
|
5303
|
-
this.
|
|
5304
|
-
this.
|
|
5305
|
-
this.
|
|
5306
|
-
this.
|
|
5307
|
-
this.
|
|
5308
|
-
this.bindCanvas("
|
|
5317
|
+
this._mouseDown = this._mouseDown.bind(this);
|
|
5318
|
+
this._mouseUp = this._mouseUp.bind(this);
|
|
5319
|
+
this._mouseOver = this._mouseOver.bind(this);
|
|
5320
|
+
this._mouseMove = this._mouseMove.bind(this);
|
|
5321
|
+
this._mouseClick = this._mouseClick.bind(this);
|
|
5322
|
+
this._contextMenu = this._contextMenu.bind(this);
|
|
5323
|
+
this.bindCanvas("mousedown", this._mouseDown);
|
|
5324
|
+
this.bindCanvas("mouseup", this._mouseUp);
|
|
5325
|
+
this.bindCanvas("mouseover", this._mouseOver);
|
|
5326
|
+
this.bindCanvas("mouseout", this._mouseOut);
|
|
5327
|
+
this.bindCanvas("mousemove", this._mouseMove);
|
|
5328
|
+
this.bindCanvas("click", this._mouseClick);
|
|
5329
|
+
this.bindCanvas("contextmenu", this._contextMenu);
|
|
5309
5330
|
this._hasMouse = true;
|
|
5310
5331
|
}
|
|
5311
5332
|
else {
|
|
5312
|
-
this.unbindCanvas("mousedown", this._mouseDown
|
|
5313
|
-
this.unbindCanvas("mouseup", this._mouseUp
|
|
5314
|
-
this.unbindCanvas("mouseover", this._mouseOver
|
|
5315
|
-
this.unbindCanvas("mouseout", this._mouseOut
|
|
5316
|
-
this.unbindCanvas("mousemove", this._mouseMove
|
|
5317
|
-
this.unbindCanvas("click", this._mouseClick
|
|
5318
|
-
this.unbindCanvas("contextmenu", this._contextMenu
|
|
5333
|
+
this.unbindCanvas("mousedown", this._mouseDown);
|
|
5334
|
+
this.unbindCanvas("mouseup", this._mouseUp);
|
|
5335
|
+
this.unbindCanvas("mouseover", this._mouseOver);
|
|
5336
|
+
this.unbindCanvas("mouseout", this._mouseOut);
|
|
5337
|
+
this.unbindCanvas("mousemove", this._mouseMove);
|
|
5338
|
+
this.unbindCanvas("click", this._mouseClick);
|
|
5339
|
+
this.unbindCanvas("contextmenu", this._contextMenu);
|
|
5319
5340
|
this._hasMouse = false;
|
|
5320
5341
|
}
|
|
5321
5342
|
return this;
|
|
@@ -5448,7 +5469,7 @@ exports.MultiTouchSpace = MultiTouchSpace;
|
|
|
5448
5469
|
|
|
5449
5470
|
"use strict";
|
|
5450
5471
|
|
|
5451
|
-
/*!
|
|
5472
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
5452
5473
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5453
5474
|
exports.SVGForm = exports.SVGSpace = void 0;
|
|
5454
5475
|
const Form_1 = __webpack_require__(/*! ./Form */ "./src/Form.ts");
|
|
@@ -5831,7 +5852,7 @@ SVGForm.domID = 0;
|
|
|
5831
5852
|
|
|
5832
5853
|
"use strict";
|
|
5833
5854
|
|
|
5834
|
-
/*!
|
|
5855
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
5835
5856
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5836
5857
|
exports.Typography = void 0;
|
|
5837
5858
|
const Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
|
|
@@ -5886,7 +5907,7 @@ exports.Typography = Typography;
|
|
|
5886
5907
|
|
|
5887
5908
|
"use strict";
|
|
5888
5909
|
|
|
5889
|
-
/*!
|
|
5910
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
5890
5911
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5891
5912
|
exports.UIDragger = exports.UIButton = exports.UI = exports.UIPointerActions = exports.UIShape = void 0;
|
|
5892
5913
|
const Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
|
|
@@ -6172,7 +6193,7 @@ exports.UIDragger = UIDragger;
|
|
|
6172
6193
|
|
|
6173
6194
|
"use strict";
|
|
6174
6195
|
|
|
6175
|
-
/*!
|
|
6196
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
6176
6197
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6177
6198
|
exports.Util = exports.Const = void 0;
|
|
6178
6199
|
const Num_1 = __webpack_require__(/*! ./Num */ "./src/Num.ts");
|
package/dist/pts.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ export class CanvasForm extends VisualForm {
|
|
|
51
51
|
alpha(a: number): this;
|
|
52
52
|
fill(c: string | boolean | CanvasGradient | CanvasPattern): this;
|
|
53
53
|
stroke(c: string | boolean | CanvasGradient | CanvasPattern, width?: number, linejoin?: CanvasLineJoin, linecap?: CanvasLineCap): this;
|
|
54
|
+
applyFillStroke(filled?: boolean | string, stroked?: boolean | string, strokeWidth?: number): this;
|
|
54
55
|
gradient(stops: [number, string][] | string[]): ((area1: GroupLike, area2?: GroupLike) => CanvasGradient);
|
|
55
56
|
composite(mode?: string): this;
|
|
56
57
|
clip(): this;
|
package/dist/pts.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
|
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");
|
|
@@ -221,13 +221,13 @@ class CanvasSpace extends Space_1.MultiTouchSpace {
|
|
|
221
221
|
get autoResize() { return this._autoResize; }
|
|
222
222
|
resize(b, evt) {
|
|
223
223
|
this.bound = b;
|
|
224
|
-
this._canvas.width = this.bound.size.x * this._pixelScale;
|
|
225
|
-
this._canvas.height = this.bound.size.y * this._pixelScale;
|
|
226
|
-
this._canvas.style.width = Math.
|
|
227
|
-
this._canvas.style.height = Math.
|
|
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";
|
|
228
228
|
if (this._offscreen) {
|
|
229
|
-
this._offCanvas.width = this.bound.size.x * this._pixelScale;
|
|
230
|
-
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;
|
|
231
231
|
}
|
|
232
232
|
if (this._pixelScale != 1) {
|
|
233
233
|
this._ctx.scale(this._pixelScale, this._pixelScale);
|
|
@@ -282,27 +282,29 @@ class CanvasSpace extends Space_1.MultiTouchSpace {
|
|
|
282
282
|
if (bg)
|
|
283
283
|
this._bgcolor = bg;
|
|
284
284
|
const lastColor = this._ctx.fillStyle;
|
|
285
|
+
const px = Math.ceil(this.pixelScale);
|
|
285
286
|
if (!this._bgcolor || this._bgcolor === "transparent") {
|
|
286
|
-
this._ctx.clearRect(-
|
|
287
|
+
this._ctx.clearRect(-px, -px, this._canvas.width + px, this._canvas.height + px);
|
|
287
288
|
}
|
|
288
289
|
else {
|
|
289
290
|
if (this._bgcolor.indexOf("rgba") === 0 || (this._bgcolor.length === 9 && this._bgcolor.indexOf("#") === 0)) {
|
|
290
|
-
this._ctx.clearRect(-
|
|
291
|
+
this._ctx.clearRect(-px, -px, this._canvas.width + px, this._canvas.height + px);
|
|
291
292
|
}
|
|
292
293
|
this._ctx.fillStyle = this._bgcolor;
|
|
293
|
-
this._ctx.fillRect(-
|
|
294
|
+
this._ctx.fillRect(-px, -px, this._canvas.width + px, this._canvas.height + px);
|
|
294
295
|
}
|
|
295
296
|
this._ctx.fillStyle = lastColor;
|
|
296
297
|
return this;
|
|
297
298
|
}
|
|
298
299
|
clearOffscreen(bg) {
|
|
299
300
|
if (this._offscreen) {
|
|
301
|
+
const px = Math.ceil(this.pixelScale);
|
|
300
302
|
if (bg) {
|
|
301
303
|
this._offCtx.fillStyle = bg;
|
|
302
|
-
this._offCtx.fillRect(-
|
|
304
|
+
this._offCtx.fillRect(-px, -px, this._canvas.width + px, this._canvas.height + px);
|
|
303
305
|
}
|
|
304
306
|
else {
|
|
305
|
-
this._offCtx.clearRect(-
|
|
307
|
+
this._offCtx.clearRect(-px, -px, this._offCanvas.width + px, this._offCanvas.height + px);
|
|
306
308
|
}
|
|
307
309
|
}
|
|
308
310
|
return this;
|
|
@@ -427,6 +429,19 @@ class CanvasForm extends Form_1.VisualForm {
|
|
|
427
429
|
}
|
|
428
430
|
return this;
|
|
429
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
|
+
}
|
|
430
445
|
gradient(stops) {
|
|
431
446
|
let vals = [];
|
|
432
447
|
if (stops.length < 2)
|
|
@@ -795,7 +810,7 @@ exports.CanvasForm = CanvasForm;
|
|
|
795
810
|
|
|
796
811
|
"use strict";
|
|
797
812
|
|
|
798
|
-
/*!
|
|
813
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
799
814
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
800
815
|
exports.Color = void 0;
|
|
801
816
|
const Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
|
|
@@ -1147,7 +1162,7 @@ Color.ranges = {
|
|
|
1147
1162
|
|
|
1148
1163
|
"use strict";
|
|
1149
1164
|
|
|
1150
|
-
/*!
|
|
1165
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
1151
1166
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1152
1167
|
exports.Delaunay = exports.Noise = exports.Create = void 0;
|
|
1153
1168
|
const Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
|
|
@@ -1439,7 +1454,7 @@ exports.Delaunay = Delaunay;
|
|
|
1439
1454
|
|
|
1440
1455
|
"use strict";
|
|
1441
1456
|
|
|
1442
|
-
/*!
|
|
1457
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
1443
1458
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1444
1459
|
exports.HTMLForm = exports.HTMLSpace = exports.DOMSpace = void 0;
|
|
1445
1460
|
const Space_1 = __webpack_require__(/*! ./Space */ "./src/Space.ts");
|
|
@@ -1904,7 +1919,7 @@ HTMLForm.domID = 0;
|
|
|
1904
1919
|
|
|
1905
1920
|
"use strict";
|
|
1906
1921
|
|
|
1907
|
-
/*!
|
|
1922
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
1908
1923
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1909
1924
|
exports.Font = exports.VisualForm = exports.Form = void 0;
|
|
1910
1925
|
class Form {
|
|
@@ -2170,7 +2185,7 @@ exports.Img = Img;
|
|
|
2170
2185
|
|
|
2171
2186
|
"use strict";
|
|
2172
2187
|
|
|
2173
|
-
/*!
|
|
2188
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
2174
2189
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2175
2190
|
exports.Mat = exports.Vec = void 0;
|
|
2176
2191
|
const Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
|
|
@@ -2437,7 +2452,7 @@ exports.Mat = Mat;
|
|
|
2437
2452
|
|
|
2438
2453
|
"use strict";
|
|
2439
2454
|
|
|
2440
|
-
/*!
|
|
2455
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
2441
2456
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2442
2457
|
exports.Range = exports.Shaping = exports.Geom = exports.Num = void 0;
|
|
2443
2458
|
const Util_1 = __webpack_require__(/*! ./Util */ "./src/Util.ts");
|
|
@@ -2932,7 +2947,7 @@ exports.Range = Range;
|
|
|
2932
2947
|
|
|
2933
2948
|
"use strict";
|
|
2934
2949
|
|
|
2935
|
-
/*!
|
|
2950
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
2936
2951
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2937
2952
|
exports.Curve = exports.Polygon = exports.Triangle = exports.Circle = exports.Rectangle = exports.Line = void 0;
|
|
2938
2953
|
const Util_1 = __webpack_require__(/*! ./Util */ "./src/Util.ts");
|
|
@@ -3930,7 +3945,7 @@ exports.Curve = Curve;
|
|
|
3930
3945
|
|
|
3931
3946
|
"use strict";
|
|
3932
3947
|
|
|
3933
|
-
/*!
|
|
3948
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
3934
3949
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3935
3950
|
exports.Body = exports.Particle = exports.World = void 0;
|
|
3936
3951
|
const Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
|
|
@@ -4685,7 +4700,7 @@ exports.Sound = Sound;
|
|
|
4685
4700
|
|
|
4686
4701
|
"use strict";
|
|
4687
4702
|
|
|
4688
|
-
/*!
|
|
4703
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
4689
4704
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4690
4705
|
exports.Bound = exports.Group = exports.Pt = void 0;
|
|
4691
4706
|
const Util_1 = __webpack_require__(/*! ./Util */ "./src/Util.ts");
|
|
@@ -5162,7 +5177,7 @@ exports.Bound = Bound;
|
|
|
5162
5177
|
|
|
5163
5178
|
"use strict";
|
|
5164
5179
|
|
|
5165
|
-
/*!
|
|
5180
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
5166
5181
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5167
5182
|
exports.MultiTouchSpace = exports.Space = void 0;
|
|
5168
5183
|
const Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
|
|
@@ -5257,7 +5272,7 @@ class Space {
|
|
|
5257
5272
|
this._time.end = t;
|
|
5258
5273
|
return this;
|
|
5259
5274
|
}
|
|
5260
|
-
playOnce(duration =
|
|
5275
|
+
playOnce(duration = 0) {
|
|
5261
5276
|
this.play();
|
|
5262
5277
|
this.stop(duration);
|
|
5263
5278
|
return this;
|
|
@@ -5299,23 +5314,29 @@ class MultiTouchSpace extends Space {
|
|
|
5299
5314
|
}
|
|
5300
5315
|
bindMouse(_bind = true) {
|
|
5301
5316
|
if (_bind) {
|
|
5302
|
-
this.
|
|
5303
|
-
this.
|
|
5304
|
-
this.
|
|
5305
|
-
this.
|
|
5306
|
-
this.
|
|
5307
|
-
this.
|
|
5308
|
-
this.bindCanvas("
|
|
5317
|
+
this._mouseDown = this._mouseDown.bind(this);
|
|
5318
|
+
this._mouseUp = this._mouseUp.bind(this);
|
|
5319
|
+
this._mouseOver = this._mouseOver.bind(this);
|
|
5320
|
+
this._mouseMove = this._mouseMove.bind(this);
|
|
5321
|
+
this._mouseClick = this._mouseClick.bind(this);
|
|
5322
|
+
this._contextMenu = this._contextMenu.bind(this);
|
|
5323
|
+
this.bindCanvas("mousedown", this._mouseDown);
|
|
5324
|
+
this.bindCanvas("mouseup", this._mouseUp);
|
|
5325
|
+
this.bindCanvas("mouseover", this._mouseOver);
|
|
5326
|
+
this.bindCanvas("mouseout", this._mouseOut);
|
|
5327
|
+
this.bindCanvas("mousemove", this._mouseMove);
|
|
5328
|
+
this.bindCanvas("click", this._mouseClick);
|
|
5329
|
+
this.bindCanvas("contextmenu", this._contextMenu);
|
|
5309
5330
|
this._hasMouse = true;
|
|
5310
5331
|
}
|
|
5311
5332
|
else {
|
|
5312
|
-
this.unbindCanvas("mousedown", this._mouseDown
|
|
5313
|
-
this.unbindCanvas("mouseup", this._mouseUp
|
|
5314
|
-
this.unbindCanvas("mouseover", this._mouseOver
|
|
5315
|
-
this.unbindCanvas("mouseout", this._mouseOut
|
|
5316
|
-
this.unbindCanvas("mousemove", this._mouseMove
|
|
5317
|
-
this.unbindCanvas("click", this._mouseClick
|
|
5318
|
-
this.unbindCanvas("contextmenu", this._contextMenu
|
|
5333
|
+
this.unbindCanvas("mousedown", this._mouseDown);
|
|
5334
|
+
this.unbindCanvas("mouseup", this._mouseUp);
|
|
5335
|
+
this.unbindCanvas("mouseover", this._mouseOver);
|
|
5336
|
+
this.unbindCanvas("mouseout", this._mouseOut);
|
|
5337
|
+
this.unbindCanvas("mousemove", this._mouseMove);
|
|
5338
|
+
this.unbindCanvas("click", this._mouseClick);
|
|
5339
|
+
this.unbindCanvas("contextmenu", this._contextMenu);
|
|
5319
5340
|
this._hasMouse = false;
|
|
5320
5341
|
}
|
|
5321
5342
|
return this;
|
|
@@ -5448,7 +5469,7 @@ exports.MultiTouchSpace = MultiTouchSpace;
|
|
|
5448
5469
|
|
|
5449
5470
|
"use strict";
|
|
5450
5471
|
|
|
5451
|
-
/*!
|
|
5472
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
5452
5473
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5453
5474
|
exports.SVGForm = exports.SVGSpace = void 0;
|
|
5454
5475
|
const Form_1 = __webpack_require__(/*! ./Form */ "./src/Form.ts");
|
|
@@ -5831,7 +5852,7 @@ SVGForm.domID = 0;
|
|
|
5831
5852
|
|
|
5832
5853
|
"use strict";
|
|
5833
5854
|
|
|
5834
|
-
/*!
|
|
5855
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
5835
5856
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5836
5857
|
|
|
5837
5858
|
|
|
@@ -5846,7 +5867,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5846
5867
|
|
|
5847
5868
|
"use strict";
|
|
5848
5869
|
|
|
5849
|
-
/*!
|
|
5870
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
5850
5871
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5851
5872
|
exports.Typography = void 0;
|
|
5852
5873
|
const Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
|
|
@@ -5901,7 +5922,7 @@ exports.Typography = Typography;
|
|
|
5901
5922
|
|
|
5902
5923
|
"use strict";
|
|
5903
5924
|
|
|
5904
|
-
/*!
|
|
5925
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
5905
5926
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5906
5927
|
exports.UIDragger = exports.UIButton = exports.UI = exports.UIPointerActions = exports.UIShape = void 0;
|
|
5907
5928
|
const Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
|
|
@@ -6187,7 +6208,7 @@ exports.UIDragger = UIDragger;
|
|
|
6187
6208
|
|
|
6188
6209
|
"use strict";
|
|
6189
6210
|
|
|
6190
|
-
/*!
|
|
6211
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
6191
6212
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6192
6213
|
exports.Util = exports.Const = void 0;
|
|
6193
6214
|
const Num_1 = __webpack_require__(/*! ./Num */ "./src/Num.ts");
|