plotboilerplate 1.18.0 → 1.20.0
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/README.md +1 -1
- package/dist/index.esm.js +244 -63
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/plotboilerplate.browser.min.js +1 -1
- package/dist/plotboilerplate.browser.min.js.map +1 -1
- package/dist/plotboilerplate.js +243 -74
- package/dist/plotboilerplate.min.js +1 -1
- package/package.json +1 -1
- package/src/cjs/Bounds.d.ts +14 -5
- package/src/cjs/Bounds.js +18 -8
- package/src/cjs/Bounds.js.map +1 -1
- package/src/cjs/CubicBezierCurve.d.ts +20 -3
- package/src/cjs/CubicBezierCurve.js +25 -2
- package/src/cjs/CubicBezierCurve.js.map +1 -1
- package/src/cjs/Line.d.ts +46 -4
- package/src/cjs/Line.js +60 -3
- package/src/cjs/Line.js.map +1 -1
- package/src/cjs/PlotBoilerplate.d.ts +5 -2
- package/src/cjs/PlotBoilerplate.js +52 -30
- package/src/cjs/PlotBoilerplate.js.map +1 -1
- package/src/cjs/Polygon.js +1 -1
- package/src/cjs/Polygon.js.map +1 -1
- package/src/cjs/VEllipseSector.d.ts +4 -3
- package/src/cjs/VEllipseSector.js +15 -8
- package/src/cjs/VEllipseSector.js.map +1 -1
- package/src/cjs/Vector.d.ts +14 -3
- package/src/cjs/Vector.js +21 -2
- package/src/cjs/Vector.js.map +1 -1
- package/src/cjs/Vertex.d.ts +33 -1
- package/src/cjs/Vertex.js +43 -1
- package/src/cjs/Vertex.js.map +1 -1
- package/src/cjs/drawutilssvg.d.ts +2 -1
- package/src/cjs/drawutilssvg.js +7 -19
- package/src/cjs/drawutilssvg.js.map +1 -1
- package/src/cjs/entry.js +1 -0
- package/src/cjs/interfaces/additionals.d.ts +95 -0
- package/src/cjs/interfaces/additionals.js +3 -0
- package/src/cjs/interfaces/additionals.js.map +1 -0
- package/src/cjs/interfaces/core.d.ts +7 -0
- package/src/cjs/interfaces/core.js +2 -0
- package/src/cjs/interfaces/core.js.map +1 -1
- package/src/cjs/interfaces/index.d.ts +1 -0
- package/src/cjs/interfaces/index.js +1 -0
- package/src/cjs/interfaces/index.js.map +1 -1
- package/src/cjs/utils/algorithms/arrayShuffle.d.ts +8 -0
- package/src/cjs/utils/algorithms/arrayShuffle.js +15 -0
- package/src/cjs/utils/algorithms/arrayShuffle.js.map +1 -0
- package/src/cjs/utils/algorithms/detectPaths.d.ts +21 -0
- package/src/cjs/utils/algorithms/detectPaths.js +169 -0
- package/src/cjs/utils/algorithms/detectPaths.js.map +1 -0
- package/src/cjs/utils/creategui.js +7 -0
- package/src/cjs/utils/datastructures/Color.d.ts +1 -1
- package/src/cjs/utils/datastructures/Color.js +4 -2
- package/src/cjs/utils/datastructures/Color.js.map +1 -1
- package/src/cjs/utils/datastructures/GenericPath.d.ts +75 -0
- package/src/cjs/utils/datastructures/GenericPath.js +105 -0
- package/src/cjs/utils/datastructures/GenericPath.js.map +1 -0
- package/src/cjs/utils/datastructures/GirihTile.d.ts +1 -1
- package/src/cjs/utils/io/FileDrop.d.ts +11 -1
- package/src/cjs/utils/io/FileDrop.js +41 -10
- package/src/cjs/utils/io/FileDrop.js.map +1 -1
- package/src/cjs/utils/parsers/svg/parseSVGPathData.d.ts +26 -0
- package/src/cjs/utils/parsers/svg/parseSVGPathData.js +463 -0
- package/src/cjs/utils/parsers/svg/parseSVGPathData.js.map +1 -0
- package/src/cjs/utils/parsers/svg/splitSVGPathData.d.ts +20 -0
- package/src/cjs/utils/parsers/svg/splitSVGPathData.js +49 -0
- package/src/cjs/utils/parsers/svg/splitSVGPathData.js.map +1 -0
- package/src/cjs/utils/parsers/svg/types.d.ts +43 -0
- package/src/cjs/utils/parsers/svg/types.js +16 -0
- package/src/cjs/utils/parsers/svg/types.js.map +1 -0
- package/src/esm/Bounds.d.ts +14 -5
- package/src/esm/Bounds.js +18 -8
- package/src/esm/Bounds.js.map +1 -1
- package/src/esm/CubicBezierCurve.d.ts +20 -3
- package/src/esm/CubicBezierCurve.js +25 -2
- package/src/esm/CubicBezierCurve.js.map +1 -1
- package/src/esm/Line.d.ts +46 -4
- package/src/esm/Line.js +60 -3
- package/src/esm/Line.js.map +1 -1
- package/src/esm/PlotBoilerplate.d.ts +5 -2
- package/src/esm/PlotBoilerplate.js +52 -30
- package/src/esm/PlotBoilerplate.js.map +1 -1
- package/src/esm/Polygon.js +1 -1
- package/src/esm/Polygon.js.map +1 -1
- package/src/esm/VEllipseSector.d.ts +4 -3
- package/src/esm/VEllipseSector.js +15 -8
- package/src/esm/VEllipseSector.js.map +1 -1
- package/src/esm/Vector.d.ts +13 -2
- package/src/esm/Vector.js +23 -4
- package/src/esm/Vector.js.map +1 -1
- package/src/esm/Vertex.d.ts +33 -1
- package/src/esm/Vertex.js +43 -1
- package/src/esm/Vertex.js.map +1 -1
- package/src/esm/drawutilssvg.d.ts +2 -1
- package/src/esm/drawutilssvg.js +7 -19
- package/src/esm/drawutilssvg.js.map +1 -1
- package/src/esm/entry.js +1 -0
- package/src/esm/interfaces/additionals.d.ts +95 -0
- package/src/esm/interfaces/additionals.js +2 -0
- package/src/esm/interfaces/additionals.js.map +1 -0
- package/src/esm/interfaces/core.d.ts +7 -0
- package/src/esm/interfaces/core.js +2 -0
- package/src/esm/interfaces/core.js.map +1 -1
- package/src/esm/interfaces/index.d.ts +1 -0
- package/src/esm/interfaces/index.js +1 -0
- package/src/esm/interfaces/index.js.map +1 -1
- package/src/esm/utils/algorithms/arrayShuffle.d.ts +8 -0
- package/src/esm/utils/algorithms/arrayShuffle.js +11 -0
- package/src/esm/utils/algorithms/arrayShuffle.js.map +1 -0
- package/src/esm/utils/algorithms/detectPaths.d.ts +21 -0
- package/src/esm/utils/algorithms/detectPaths.js +165 -0
- package/src/esm/utils/algorithms/detectPaths.js.map +1 -0
- package/src/esm/utils/datastructures/Color.d.ts +1 -1
- package/src/esm/utils/datastructures/Color.js +4 -2
- package/src/esm/utils/datastructures/Color.js.map +1 -1
- package/src/esm/utils/datastructures/GenericPath.d.ts +75 -0
- package/src/esm/utils/datastructures/GenericPath.js +100 -0
- package/src/esm/utils/datastructures/GenericPath.js.map +1 -0
- package/src/esm/utils/datastructures/GirihTile.d.ts +1 -1
- package/src/esm/utils/io/FileDrop.d.ts +11 -1
- package/src/esm/utils/io/FileDrop.js +41 -10
- package/src/esm/utils/io/FileDrop.js.map +1 -1
- package/src/esm/utils/parsers/svg/parseSVGPathData.d.ts +26 -0
- package/src/esm/utils/parsers/svg/parseSVGPathData.js +459 -0
- package/src/esm/utils/parsers/svg/parseSVGPathData.js.map +1 -0
- package/src/esm/utils/parsers/svg/splitSVGPathData.d.ts +20 -0
- package/src/esm/utils/parsers/svg/splitSVGPathData.js +45 -0
- package/src/esm/utils/parsers/svg/splitSVGPathData.js.map +1 -0
- package/src/esm/utils/parsers/svg/types.d.ts +43 -0
- package/src/esm/utils/parsers/svg/types.js +15 -0
- package/src/esm/utils/parsers/svg/types.js.map +1 -0
- package/src/ts/Bounds.ts +19 -8
- package/src/ts/CubicBezierCurve.ts +29 -4
- package/src/ts/Line.ts +70 -6
- package/src/ts/PlotBoilerplate.ts +57 -35
- package/src/ts/Polygon.ts +1 -1
- package/src/ts/VEllipseSector.ts +22 -15
- package/src/ts/Vector.ts +24 -4
- package/src/ts/Vertex.ts +46 -1
- package/src/ts/drawutilssvg.ts +8 -19
- package/src/ts/interfaces/additionals.ts +105 -0
- package/src/ts/interfaces/core.ts +5 -0
- package/src/ts/interfaces/index.ts +1 -0
- package/src/ts/utils/algorithms/arrayShuffle.ts +11 -0
- package/src/ts/utils/algorithms/detectPaths.ts +195 -0
- package/src/ts/utils/datastructures/Color.ts +8 -4
- package/src/ts/utils/datastructures/GenericPath.ts +113 -0
- package/src/ts/utils/datastructures/GirihTile.ts +1 -1
- package/src/ts/utils/io/FileDrop.ts +51 -10
- package/src/ts/utils/parsers/svg/parseSVGPathData.ts +572 -0
- package/src/ts/utils/parsers/svg/splitSVGPathData.ts +50 -0
- package/src/ts/utils/parsers/svg/types.ts +70 -0
- package/changelog.md +0 -731
package/dist/plotboilerplate.js
CHANGED
|
@@ -1682,7 +1682,9 @@ exports.BezierPath = BezierPath;
|
|
|
1682
1682
|
* @modified 2021-02-02 Added the `toPolygon` method.
|
|
1683
1683
|
* @modified 2021-06-21 (mid-summer) Added `getCenter` method.
|
|
1684
1684
|
* @modified 2022-02-01 Added the `toString` function.
|
|
1685
|
-
* @
|
|
1685
|
+
* @modified 2022-10-09 Added the `fromDimension` function.
|
|
1686
|
+
* @modified 2022-11-28 Added the `clone` method.
|
|
1687
|
+
* @version 1.6.0
|
|
1686
1688
|
**/
|
|
1687
1689
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1688
1690
|
exports.Bounds = void 0;
|
|
@@ -1749,17 +1751,14 @@ var Bounds = /** @class */ (function () {
|
|
|
1749
1751
|
/**
|
|
1750
1752
|
* Clone this bounds object (create a deep clone).
|
|
1751
1753
|
*
|
|
1752
|
-
* Note: the returned format might change in the future, so please do not
|
|
1753
|
-
* rely on the returned string format.
|
|
1754
|
-
*
|
|
1755
1754
|
* @method clone
|
|
1756
1755
|
* @instance
|
|
1757
1756
|
* @memberof Bounds
|
|
1758
|
-
* @returns {
|
|
1757
|
+
* @returns {Bounds} Creates a deep clone of this bounds object.
|
|
1759
1758
|
*/
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1759
|
+
Bounds.prototype.clone = function () {
|
|
1760
|
+
return new Bounds({ x: this.min.x, y: this.min.y }, { x: this.max.x, y: this.max.y });
|
|
1761
|
+
};
|
|
1763
1762
|
/**
|
|
1764
1763
|
* Compute the minimal bounding box for a given set of vertices.
|
|
1765
1764
|
*
|
|
@@ -1788,6 +1787,17 @@ var Bounds = /** @class */ (function () {
|
|
|
1788
1787
|
}
|
|
1789
1788
|
return new Bounds(new Vertex_1.Vertex(xMin, yMin), new Vertex_1.Vertex(xMax, yMax));
|
|
1790
1789
|
};
|
|
1790
|
+
/**
|
|
1791
|
+
* Create a new `Bounds` instance just from `width` and `height`, located at (0,0) or the optionally given origin.
|
|
1792
|
+
*
|
|
1793
|
+
* @param {number} width - The width of the bounds
|
|
1794
|
+
* @param {number} height - The height of the bounds
|
|
1795
|
+
* @param {XYCoords={x:0,y:0}} origin - [optional] A origin to locate the new Bounds object at.
|
|
1796
|
+
* @returns {Bounds} A new `Bounds` instance width given width and height, located at (0,0) or the given origin..
|
|
1797
|
+
*/
|
|
1798
|
+
Bounds.fromDimension = function (width, height, origin) {
|
|
1799
|
+
return new Bounds(origin !== null && origin !== void 0 ? origin : { x: 0, y: 0 }, { x: (origin ? origin.x : 0) + width, y: (origin ? origin.y : 0) + height });
|
|
1800
|
+
};
|
|
1791
1801
|
return Bounds;
|
|
1792
1802
|
}()); // END class bounds
|
|
1793
1803
|
exports.Bounds = Bounds;
|
|
@@ -2201,7 +2211,8 @@ exports.CircleSector = CircleSector;
|
|
|
2201
2211
|
* @modified 2021-01-20 Added UID.
|
|
2202
2212
|
* @modified 2022-02-02 Added the `destroy` method.
|
|
2203
2213
|
* @modified 2022-02-02 Cleared the `toSVGPathData` function (deprecated). Use `drawutilssvg` instead.
|
|
2204
|
-
* @
|
|
2214
|
+
* @modified 2022-10-17 The `CubicBezierCurve` class now implements the new `PathSegment` interface.
|
|
2215
|
+
* @version 2.7.1
|
|
2205
2216
|
*
|
|
2206
2217
|
* @file CubicBezierCurve
|
|
2207
2218
|
* @public
|
|
@@ -2253,7 +2264,7 @@ var CubicBezierCurve = /** @class */ (function () {
|
|
|
2253
2264
|
// An array of floats
|
|
2254
2265
|
this.segmentLengths = [];
|
|
2255
2266
|
// float
|
|
2256
|
-
this.arcLength = null;
|
|
2267
|
+
// this.arcLength = null;
|
|
2257
2268
|
this.updateArcLengths();
|
|
2258
2269
|
}
|
|
2259
2270
|
/**
|
|
@@ -2685,6 +2696,28 @@ var CubicBezierCurve = /** @class */ (function () {
|
|
|
2685
2696
|
CubicBezierCurve.prototype.clone = function () {
|
|
2686
2697
|
return new CubicBezierCurve(this.getStartPoint().clone(), this.getEndPoint().clone(), this.getStartControlPoint().clone(), this.getEndControlPoint().clone());
|
|
2687
2698
|
};
|
|
2699
|
+
//---BEGIN PathSegment-------------------------
|
|
2700
|
+
/**
|
|
2701
|
+
* Get the tangent's end point at the start point of this segment.
|
|
2702
|
+
*
|
|
2703
|
+
* @method getStartTangent
|
|
2704
|
+
* @memberof PathSegment
|
|
2705
|
+
* @return {Vertex} The end point of the starting point's tangent.
|
|
2706
|
+
*/
|
|
2707
|
+
CubicBezierCurve.prototype.getStartTangent = function () {
|
|
2708
|
+
return this.startControlPoint;
|
|
2709
|
+
};
|
|
2710
|
+
/**
|
|
2711
|
+
* Get the tangent's end point at the end point of this segment.
|
|
2712
|
+
*
|
|
2713
|
+
* @method getEndTangent
|
|
2714
|
+
* @memberof PathSegment
|
|
2715
|
+
* @return {Vertex} The end point of the ending point's tangent.
|
|
2716
|
+
*/
|
|
2717
|
+
CubicBezierCurve.prototype.getEndTangent = function () {
|
|
2718
|
+
return this.endControlPoint;
|
|
2719
|
+
};
|
|
2720
|
+
//---END PathSegment-------------------------
|
|
2688
2721
|
/**
|
|
2689
2722
|
* Check if this and the specified curve are equal.<br>
|
|
2690
2723
|
* <br>
|
|
@@ -3410,7 +3443,9 @@ exports.KeyHandler = KeyHandler;
|
|
|
3410
3443
|
* @modified 2020-03-23 Ported to Typescript from JS.
|
|
3411
3444
|
* @modified 2020-12-04 The `intersection` function returns undefined if both lines are parallel.
|
|
3412
3445
|
* @modified 2022-02-02 Added the `destroy` method.
|
|
3413
|
-
* @
|
|
3446
|
+
* @modified 2022-10-09 Changed the actual return value of the `intersection` function to null (was undefined before).
|
|
3447
|
+
* @modified 2022-10-17 Adding these methods from the `PathSegment` interface: getStartPoint, getEndPoint, revert.
|
|
3448
|
+
* @version 2.3.0
|
|
3414
3449
|
*
|
|
3415
3450
|
* @file Line
|
|
3416
3451
|
* @public
|
|
@@ -3470,8 +3505,9 @@ var Line = /** @class */ (function (_super) {
|
|
|
3470
3505
|
// !!! DO NOT MOVE TO VertTuple
|
|
3471
3506
|
Line.prototype.intersection = function (line) {
|
|
3472
3507
|
var denominator = this.denominator(line);
|
|
3473
|
-
if (denominator == 0)
|
|
3508
|
+
if (denominator == 0) {
|
|
3474
3509
|
return null;
|
|
3510
|
+
}
|
|
3475
3511
|
var a = this.a.y - line.a.y;
|
|
3476
3512
|
var b = this.a.x - line.a.x;
|
|
3477
3513
|
var numerator1 = (line.b.x - line.a.x) * a - (line.b.y - line.a.y) * b;
|
|
@@ -3482,11 +3518,65 @@ var Line = /** @class */ (function (_super) {
|
|
|
3482
3518
|
var x = this.a.x + a * (this.b.x - this.a.x);
|
|
3483
3519
|
var y = this.a.y + a * (this.b.y - this.a.y);
|
|
3484
3520
|
if (isNaN(a) || isNaN(x) || isNaN(y)) {
|
|
3485
|
-
return
|
|
3521
|
+
return null;
|
|
3486
3522
|
}
|
|
3487
3523
|
// if we cast these lines infinitely in both directions, they intersect here:
|
|
3488
3524
|
return new Vertex_1.Vertex(x, y);
|
|
3489
3525
|
};
|
|
3526
|
+
//--- Implement PathSegment ---
|
|
3527
|
+
/**
|
|
3528
|
+
* Get the start point of this path segment.
|
|
3529
|
+
*
|
|
3530
|
+
* @method getStartPoint
|
|
3531
|
+
* @memberof PathSegment
|
|
3532
|
+
* @return {Vertex} The start point of this path segment.
|
|
3533
|
+
*/
|
|
3534
|
+
Line.prototype.getStartPoint = function () {
|
|
3535
|
+
return this.a;
|
|
3536
|
+
};
|
|
3537
|
+
/**
|
|
3538
|
+
* Get the end point of this path segment.
|
|
3539
|
+
*
|
|
3540
|
+
* @method getEndPoint
|
|
3541
|
+
* @memberof PathSegment
|
|
3542
|
+
* @return {Vertex} The end point of this path segment.
|
|
3543
|
+
*/
|
|
3544
|
+
Line.prototype.getEndPoint = function () {
|
|
3545
|
+
return this.b;
|
|
3546
|
+
};
|
|
3547
|
+
/**
|
|
3548
|
+
* Get the tangent's end point at the start point of this segment.
|
|
3549
|
+
*
|
|
3550
|
+
* @method getStartTangent
|
|
3551
|
+
* @memberof PathSegment
|
|
3552
|
+
* @return {Vertex} The end point of the starting point's tangent.
|
|
3553
|
+
*/
|
|
3554
|
+
Line.prototype.getStartTangent = function () {
|
|
3555
|
+
return this.b;
|
|
3556
|
+
};
|
|
3557
|
+
/**
|
|
3558
|
+
* Get the tangent's end point at the end point of this segment.
|
|
3559
|
+
*
|
|
3560
|
+
* @method getEndTangent
|
|
3561
|
+
* @memberof PathSegment
|
|
3562
|
+
* @return {Vertex} The end point of the ending point's tangent.
|
|
3563
|
+
*/
|
|
3564
|
+
Line.prototype.getEndTangent = function () {
|
|
3565
|
+
return this.a;
|
|
3566
|
+
};
|
|
3567
|
+
/**
|
|
3568
|
+
* Inverse this path segment (in-place) and return this same instance (useful for chaining).
|
|
3569
|
+
*
|
|
3570
|
+
* @method reverse
|
|
3571
|
+
* @memberof PathSegment
|
|
3572
|
+
* @return {PathSegment} This path segment instance (for chaining).
|
|
3573
|
+
*/
|
|
3574
|
+
Line.prototype.reverse = function () {
|
|
3575
|
+
var tmp = this.a;
|
|
3576
|
+
this.a = this.b;
|
|
3577
|
+
this.b = tmp;
|
|
3578
|
+
return this;
|
|
3579
|
+
};
|
|
3490
3580
|
return Line;
|
|
3491
3581
|
}(VertTuple_1.VertTuple));
|
|
3492
3582
|
exports.Line = Line;
|
|
@@ -4138,7 +4228,10 @@ var __webpack_unused_export__;
|
|
|
4138
4228
|
* @modified 2021-04-25 Extending `remove` to accept arrays of drawables.
|
|
4139
4229
|
* @modified 2021-11-16 Adding the `PBText` drawable.
|
|
4140
4230
|
* @modified 2022-08-01 Added `title` to the params.
|
|
4141
|
-
* @
|
|
4231
|
+
* @modified 2022-10-25 Added the `origin` to the default draw config.
|
|
4232
|
+
* @modified 2022-11-06 Adding an XML declaration to the SVG export routine.
|
|
4233
|
+
* @modified 2022-11-23 Added the `drawRaster` (default=true) option to the config/drawconfig.
|
|
4234
|
+
* @version 1.17.0
|
|
4142
4235
|
*
|
|
4143
4236
|
* @file PlotBoilerplate
|
|
4144
4237
|
* @fileoverview The main class.
|
|
@@ -4256,6 +4349,7 @@ var PlotBoilerplate = /** @class */ (function () {
|
|
|
4256
4349
|
* @param {string=} [config.title=null] - Specify any hover tile here. It will be attached as a `title` attribute to the most elevated element.
|
|
4257
4350
|
*/
|
|
4258
4351
|
function PlotBoilerplate(config) {
|
|
4352
|
+
var _a, _b;
|
|
4259
4353
|
/**
|
|
4260
4354
|
* A discrete timestamp to identify single render cycles.
|
|
4261
4355
|
* Note that using system time milliseconds is not a safe way to identify render frames, as on modern powerful machines
|
|
@@ -4295,6 +4389,7 @@ var PlotBoilerplate = /** @class */ (function () {
|
|
|
4295
4389
|
offsetX: f.num(config, "offsetX", 0.0),
|
|
4296
4390
|
offsetY: f.num(config, "offsetY", 0.0),
|
|
4297
4391
|
rasterGrid: f.bool(config, "rasterGrid", true),
|
|
4392
|
+
drawRaster: f.bool(config, "drawRaster", true),
|
|
4298
4393
|
rasterScaleX: f.num(config, "rasterScaleX", 1.0),
|
|
4299
4394
|
rasterScaleY: f.num(config, "rasterScaleY", 1.0),
|
|
4300
4395
|
rasterAdjustFactor: f.num(config, "rasterAdjustdFactror", 2.0),
|
|
@@ -4345,6 +4440,7 @@ var PlotBoilerplate = /** @class */ (function () {
|
|
|
4345
4440
|
drawHandleLines: f.bool(config, "drawHandleLines", true),
|
|
4346
4441
|
drawHandlePoints: f.bool(config, "drawHandlePoints", true),
|
|
4347
4442
|
drawGrid: f.bool(config, "drawGrid", true),
|
|
4443
|
+
drawRaster: f.bool(config, "drawRaster", true),
|
|
4348
4444
|
bezier: {
|
|
4349
4445
|
color: "#00a822",
|
|
4350
4446
|
lineWidth: 2,
|
|
@@ -4412,6 +4508,9 @@ var PlotBoilerplate = /** @class */ (function () {
|
|
|
4412
4508
|
lineWidth: 1,
|
|
4413
4509
|
fill: true,
|
|
4414
4510
|
anchor: true
|
|
4511
|
+
},
|
|
4512
|
+
origin: {
|
|
4513
|
+
color: "#000000"
|
|
4415
4514
|
}
|
|
4416
4515
|
}; // END drawConfig
|
|
4417
4516
|
// +---------------------------------------------------------------------------------
|
|
@@ -4430,6 +4529,7 @@ var PlotBoilerplate = /** @class */ (function () {
|
|
|
4430
4529
|
this.config.enableGL = false;
|
|
4431
4530
|
}
|
|
4432
4531
|
if (this.config.enableGL) {
|
|
4532
|
+
// Override the case 'null' here. If GL is not supported, well then nothing works.
|
|
4433
4533
|
var ctx = this.canvas.getContext("webgl"); // webgl-experimental?
|
|
4434
4534
|
this.draw = new drawgl_1.drawutilsgl(ctx, false);
|
|
4435
4535
|
// PROBLEM: same instance of fill and draw when using WebGL.
|
|
@@ -4438,6 +4538,7 @@ var PlotBoilerplate = /** @class */ (function () {
|
|
|
4438
4538
|
console.warn("Initialized with experimental mode enableGL=true. Note that this is not yet fully implemented.");
|
|
4439
4539
|
}
|
|
4440
4540
|
else {
|
|
4541
|
+
// Override the case 'null' here. If context creation is not supported, well then nothing works.
|
|
4441
4542
|
var ctx = this.canvas.getContext("2d");
|
|
4442
4543
|
this.draw = new draw_1.drawutils(ctx, false);
|
|
4443
4544
|
this.fill = new draw_1.drawutils(ctx, true);
|
|
@@ -4474,8 +4575,8 @@ var PlotBoilerplate = /** @class */ (function () {
|
|
|
4474
4575
|
if (config.title) {
|
|
4475
4576
|
this.eventCatcher.setAttribute("title", config.title);
|
|
4476
4577
|
}
|
|
4477
|
-
this.draw.scale.set(this.config.scaleX, this.config.scaleY);
|
|
4478
|
-
this.fill.scale.set(this.config.scaleX, this.config.scaleY);
|
|
4578
|
+
this.draw.scale.set((_a = this.config.scaleX) !== null && _a !== void 0 ? _a : 1.0, this.config.scaleY);
|
|
4579
|
+
this.fill.scale.set((_b = this.config.scaleX) !== null && _b !== void 0 ? _b : 1.0, this.config.scaleY);
|
|
4479
4580
|
this.vertices = [];
|
|
4480
4581
|
this.selectPolygon = null;
|
|
4481
4582
|
this.draggedElements = [];
|
|
@@ -4520,11 +4621,13 @@ var PlotBoilerplate = /** @class */ (function () {
|
|
|
4520
4621
|
var tosvgFill = tosvgDraw.copyInstance(true); // fillShapes=true
|
|
4521
4622
|
tosvgDraw.beginDrawCycle(0);
|
|
4522
4623
|
tosvgFill.beginDrawCycle(0);
|
|
4523
|
-
if (pb.config.preClear)
|
|
4624
|
+
if (pb.config.preClear) {
|
|
4524
4625
|
pb.config.preClear();
|
|
4525
|
-
|
|
4526
|
-
|
|
4626
|
+
}
|
|
4627
|
+
tosvgDraw.clear(pb.config.backgroundColor || "white");
|
|
4628
|
+
if (pb.config.preDraw) {
|
|
4527
4629
|
pb.config.preDraw(tosvgDraw, tosvgFill);
|
|
4630
|
+
}
|
|
4528
4631
|
pb.drawAll(0, tosvgDraw, tosvgFill);
|
|
4529
4632
|
pb.drawVertices(0, tosvgDraw);
|
|
4530
4633
|
if (pb.config.postDraw)
|
|
@@ -4535,7 +4638,8 @@ var PlotBoilerplate = /** @class */ (function () {
|
|
|
4535
4638
|
// https://caniuse.com/xml-serializer
|
|
4536
4639
|
var serializer = new XMLSerializer();
|
|
4537
4640
|
var svgCode = serializer.serializeToString(svgNode);
|
|
4538
|
-
|
|
4641
|
+
// Add: '<?xml version="1.0" encoding="utf-8"?>\n' ?
|
|
4642
|
+
var blob = new Blob(['<?xml version="1.0" encoding="utf-8"?>\n' + svgCode], { type: "image/svg;charset=utf-8" });
|
|
4539
4643
|
// See documentation for FileSaver.js for usage.
|
|
4540
4644
|
// https://github.com/eligrey/FileSaver.js
|
|
4541
4645
|
if (typeof globalThis["saveAs"] !== "function")
|
|
@@ -4610,11 +4714,12 @@ var PlotBoilerplate = /** @class */ (function () {
|
|
|
4610
4714
|
* @private
|
|
4611
4715
|
**/
|
|
4612
4716
|
PlotBoilerplate.prototype.updateCSSscale = function () {
|
|
4717
|
+
var _a, _b, _c, _d;
|
|
4613
4718
|
if (this.config.cssUniformScale) {
|
|
4614
|
-
PlotBoilerplate.utils.setCSSscale(this.canvas, this.config.cssScaleX, this.config.cssScaleX);
|
|
4719
|
+
PlotBoilerplate.utils.setCSSscale(this.canvas, (_a = this.config.cssScaleX) !== null && _a !== void 0 ? _a : 1.0, (_b = this.config.cssScaleX) !== null && _b !== void 0 ? _b : 1.0);
|
|
4615
4720
|
}
|
|
4616
4721
|
else {
|
|
4617
|
-
PlotBoilerplate.utils.setCSSscale(this.canvas, this.config.cssScaleX, this.config.cssScaleY);
|
|
4722
|
+
PlotBoilerplate.utils.setCSSscale(this.canvas, (_c = this.config.cssScaleX) !== null && _c !== void 0 ? _c : 1.0, (_d = this.config.cssScaleY) !== null && _d !== void 0 ? _d : 1.0);
|
|
4618
4723
|
}
|
|
4619
4724
|
};
|
|
4620
4725
|
/**
|
|
@@ -4887,7 +4992,8 @@ var PlotBoilerplate = /** @class */ (function () {
|
|
|
4887
4992
|
* @return The vertex near the given position or undefined if none was found there.
|
|
4888
4993
|
**/
|
|
4889
4994
|
PlotBoilerplate.prototype.getVertexNear = function (pixelPosition, pixelTolerance) {
|
|
4890
|
-
var
|
|
4995
|
+
var _a, _b;
|
|
4996
|
+
var p = this.locatePointNear(this.transformMousePosition(pixelPosition.x, pixelPosition.y), pixelTolerance / Math.min((_a = this.config.cssScaleX) !== null && _a !== void 0 ? _a : 1.0, (_b = this.config.cssScaleY) !== null && _b !== void 0 ? _b : 1.0));
|
|
4891
4997
|
if (p && p.typeName == "vertex") {
|
|
4892
4998
|
return this.vertices[p.vindex];
|
|
4893
4999
|
}
|
|
@@ -4953,7 +5059,7 @@ var PlotBoilerplate = /** @class */ (function () {
|
|
|
4953
5059
|
PlotBoilerplate.prototype.drawOrigin = function (draw) {
|
|
4954
5060
|
// Add a crosshair to mark the origin
|
|
4955
5061
|
draw.setCurrentId("origin");
|
|
4956
|
-
draw.crosshair({ x: 0, y: 0 }, 10,
|
|
5062
|
+
draw.crosshair({ x: 0, y: 0 }, 10, this.drawConfig.origin.color);
|
|
4957
5063
|
};
|
|
4958
5064
|
/**
|
|
4959
5065
|
* This is just a tiny helper function to determine the render color of vertices.
|
|
@@ -5170,10 +5276,10 @@ var PlotBoilerplate = /** @class */ (function () {
|
|
|
5170
5276
|
else {
|
|
5171
5277
|
console.error("Cannot draw object. Unknown class.");
|
|
5172
5278
|
}
|
|
5173
|
-
draw.setCurrentClassName(
|
|
5174
|
-
draw.setCurrentId(
|
|
5175
|
-
fill.setCurrentClassName(
|
|
5176
|
-
fill.setCurrentId(
|
|
5279
|
+
draw.setCurrentClassName(undefined);
|
|
5280
|
+
draw.setCurrentId(undefined);
|
|
5281
|
+
fill.setCurrentClassName(undefined);
|
|
5282
|
+
fill.setCurrentId(undefined);
|
|
5177
5283
|
};
|
|
5178
5284
|
/**
|
|
5179
5285
|
* Draw the select-polygon (if there is one).
|
|
@@ -5252,9 +5358,12 @@ var PlotBoilerplate = /** @class */ (function () {
|
|
|
5252
5358
|
* @return {void}
|
|
5253
5359
|
**/
|
|
5254
5360
|
PlotBoilerplate.prototype.drawAll = function (renderTime, draw, fill) {
|
|
5255
|
-
this.
|
|
5256
|
-
|
|
5361
|
+
if (this.config.drawRaster) {
|
|
5362
|
+
this.drawGrid(draw);
|
|
5363
|
+
}
|
|
5364
|
+
if (this.config.drawOrigin) {
|
|
5257
5365
|
this.drawOrigin(draw);
|
|
5366
|
+
}
|
|
5258
5367
|
this.drawDrawables(renderTime, draw, fill);
|
|
5259
5368
|
this.drawVertices(renderTime, draw);
|
|
5260
5369
|
this.drawSelectPolygon(draw);
|
|
@@ -5276,7 +5385,7 @@ var PlotBoilerplate = /** @class */ (function () {
|
|
|
5276
5385
|
**/
|
|
5277
5386
|
PlotBoilerplate.prototype.clear = function () {
|
|
5278
5387
|
// Note that elements might have an alpha channel. Clear the scene first.
|
|
5279
|
-
this.draw.clear(this.config.backgroundColor);
|
|
5388
|
+
this.draw.clear(this.config.backgroundColor || "white");
|
|
5280
5389
|
};
|
|
5281
5390
|
/**
|
|
5282
5391
|
* Clear the selection.<br>
|
|
@@ -5306,7 +5415,8 @@ var PlotBoilerplate = /** @class */ (function () {
|
|
|
5306
5415
|
* @return {Bounds} The current viewport.
|
|
5307
5416
|
**/
|
|
5308
5417
|
PlotBoilerplate.prototype.viewport = function () {
|
|
5309
|
-
|
|
5418
|
+
var _a, _b;
|
|
5419
|
+
return new Bounds_1.Bounds(this.transformMousePosition(0, 0), this.transformMousePosition(this.canvasSize.width * ((_a = this.config.cssScaleX) !== null && _a !== void 0 ? _a : 1.0), this.canvasSize.height * ((_b = this.config.cssScaleY) !== null && _b !== void 0 ? _b : 1.0)));
|
|
5310
5420
|
};
|
|
5311
5421
|
/**
|
|
5312
5422
|
* Trigger the saveFile.hook.
|
|
@@ -5355,10 +5465,12 @@ var PlotBoilerplate = /** @class */ (function () {
|
|
|
5355
5465
|
**/
|
|
5356
5466
|
PlotBoilerplate.prototype.resizeCanvas = function () {
|
|
5357
5467
|
var _this = this;
|
|
5468
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5358
5469
|
var _self = this;
|
|
5359
5470
|
var _setSize = function (w, h) {
|
|
5360
|
-
|
|
5361
|
-
|
|
5471
|
+
var _a, _b;
|
|
5472
|
+
w *= (_a = _self.config.canvasWidthFactor) !== null && _a !== void 0 ? _a : 1.0;
|
|
5473
|
+
h *= (_b = _self.config.canvasHeightFactor) !== null && _b !== void 0 ? _b : 1.0;
|
|
5362
5474
|
_self.canvasSize.width = w;
|
|
5363
5475
|
_self.canvasSize.height = h;
|
|
5364
5476
|
if (_self.canvas instanceof HTMLCanvasElement) {
|
|
@@ -5387,8 +5499,8 @@ var PlotBoilerplate = /** @class */ (function () {
|
|
|
5387
5499
|
var width = globalThis.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
|
|
5388
5500
|
var height = globalThis.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
|
|
5389
5501
|
_self.canvas.style.position = "absolute";
|
|
5390
|
-
_self.canvas.style.width = _self.config.canvasWidthFactor * width + "px";
|
|
5391
|
-
_self.canvas.style.height = _self.config.canvasWidthFactor * height + "px";
|
|
5502
|
+
_self.canvas.style.width = ((_a = _self.config.canvasWidthFactor) !== null && _a !== void 0 ? _a : 1.0) * width + "px";
|
|
5503
|
+
_self.canvas.style.height = ((_b = _self.config.canvasWidthFactor) !== null && _b !== void 0 ? _b : 1.0) * height + "px";
|
|
5392
5504
|
_self.canvas.style.top = "0px";
|
|
5393
5505
|
_self.canvas.style.left = "0px";
|
|
5394
5506
|
_setSize(width, height);
|
|
@@ -5397,16 +5509,16 @@ var PlotBoilerplate = /** @class */ (function () {
|
|
|
5397
5509
|
// Set editor size
|
|
5398
5510
|
_self.canvas.style.position = "absolute";
|
|
5399
5511
|
var space = this.getAvailableContainerSpace();
|
|
5400
|
-
_self.canvas.style.width = _self.config.canvasWidthFactor * space.width + "px";
|
|
5401
|
-
_self.canvas.style.height = _self.config.canvasHeightFactor * space.height + "px";
|
|
5402
|
-
_self.canvas.style.top =
|
|
5403
|
-
_self.canvas.style.left =
|
|
5512
|
+
_self.canvas.style.width = ((_c = _self.config.canvasWidthFactor) !== null && _c !== void 0 ? _c : 1.0) * space.width + "px";
|
|
5513
|
+
_self.canvas.style.height = ((_d = _self.config.canvasHeightFactor) !== null && _d !== void 0 ? _d : 1.0) * space.height + "px";
|
|
5514
|
+
_self.canvas.style.top = "";
|
|
5515
|
+
_self.canvas.style.left = "";
|
|
5404
5516
|
_setSize(space.width, space.height);
|
|
5405
5517
|
}
|
|
5406
5518
|
else {
|
|
5407
|
-
_self.canvas.style.width =
|
|
5408
|
-
_self.canvas.style.height =
|
|
5409
|
-
_setSize(_self.config.defaultCanvasWidth, _self.config.defaultCanvasHeight);
|
|
5519
|
+
_self.canvas.style.width = "";
|
|
5520
|
+
_self.canvas.style.height = "";
|
|
5521
|
+
_setSize((_e = _self.config.defaultCanvasWidth) !== null && _e !== void 0 ? _e : 1024, (_f = _self.config.defaultCanvasHeight) !== null && _f !== void 0 ? _f : 768);
|
|
5410
5522
|
}
|
|
5411
5523
|
if (_self.config.redrawOnResize)
|
|
5412
5524
|
_self.redraw();
|
|
@@ -6235,7 +6347,7 @@ var Polygon = /** @class */ (function () {
|
|
|
6235
6347
|
if (typeof vertices == "undefined")
|
|
6236
6348
|
vertices = [];
|
|
6237
6349
|
this.vertices = vertices;
|
|
6238
|
-
this.isOpen = isOpen;
|
|
6350
|
+
this.isOpen = isOpen || false;
|
|
6239
6351
|
}
|
|
6240
6352
|
/**
|
|
6241
6353
|
* Add a vertex to the end of the `vertices` array.
|
|
@@ -7527,10 +7639,11 @@ exports.VEllipse = VEllipse;
|
|
|
7527
7639
|
* Implementation of elliptic sectors.
|
|
7528
7640
|
* Note that sectors are constructed in clockwise direction.
|
|
7529
7641
|
*
|
|
7530
|
-
* @author
|
|
7531
|
-
* @date
|
|
7642
|
+
* @author Ikaros Kappler
|
|
7643
|
+
* @date 2021-02-26
|
|
7532
7644
|
* @modified 2022-02-02 Added the `destroy` method.
|
|
7533
|
-
* @
|
|
7645
|
+
* @modified 2022-11-01 Tweaked the `endpointToCenterParameters` function to handle negative values, too, without errors.
|
|
7646
|
+
* @version 1.1.1
|
|
7534
7647
|
*/
|
|
7535
7648
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
7536
7649
|
exports.VEllipseSector = void 0;
|
|
@@ -7614,10 +7727,14 @@ var VEllipseSector = /** @class */ (function () {
|
|
|
7614
7727
|
var intersection = startTangent.intersection(endTangent);
|
|
7615
7728
|
// What if intersection is undefined?
|
|
7616
7729
|
// --> This *can* not happen if segmentCount > 2 and height and width of the ellipse are not zero.
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
|
|
7730
|
+
if (intersection) {
|
|
7731
|
+
// It's VERY LIKELY hat this ALWAYS happens; it's just a typesave variant.
|
|
7732
|
+
// Intersection cannot be null.
|
|
7733
|
+
var startDiff = startPoint.difference(intersection);
|
|
7734
|
+
var endDiff = endPoint.difference(intersection);
|
|
7735
|
+
var curve = new CubicBezierCurve_1.CubicBezierCurve(startPoint.clone(), endPoint.clone(), startPoint.clone().add(startDiff.scale(threshold)), endPoint.clone().add(endDiff.scale(threshold)));
|
|
7736
|
+
curves.push(curve);
|
|
7737
|
+
}
|
|
7621
7738
|
}
|
|
7622
7739
|
startPoint = endPoint;
|
|
7623
7740
|
curAngle = nextAngle;
|
|
@@ -7780,7 +7897,8 @@ var VEllipseSector = /** @class */ (function () {
|
|
|
7780
7897
|
}
|
|
7781
7898
|
// Step 2 + 3: compute center
|
|
7782
7899
|
var sign = fa === fs ? -1 : 1;
|
|
7783
|
-
|
|
7900
|
+
// const M: number = sqrt((prx * pry - prx * py - pry * px) / (prx * py + pry * px)) * sign;
|
|
7901
|
+
var M = sqrt(Math.abs((prx * pry - prx * py - pry * px) / (prx * py + pry * px))) * sign;
|
|
7784
7902
|
var _cx = (M * (rx * y)) / ry;
|
|
7785
7903
|
var _cy = (M * (-ry * x)) / rx;
|
|
7786
7904
|
var cx = cosphi * _cx - sinphi * _cy + (x1 + x2) / 2;
|
|
@@ -7789,6 +7907,7 @@ var VEllipseSector = /** @class */ (function () {
|
|
|
7789
7907
|
var center = new Vertex_1.Vertex(cx, cy);
|
|
7790
7908
|
var axis = center.clone().addXY(rx, ry);
|
|
7791
7909
|
var ellipse = new VEllipse_1.VEllipse(center, axis, 0);
|
|
7910
|
+
// console.log("VELLIPSE::::::", ellipse);
|
|
7792
7911
|
ellipse.rotate(phi);
|
|
7793
7912
|
var startAngle = new Line_1.Line(ellipse.center, new Vertex_1.Vertex(x1, y1)).angle();
|
|
7794
7913
|
var endAngle = new Line_1.Line(ellipse.center, new Vertex_1.Vertex(x2, y2)).angle();
|
|
@@ -7819,7 +7938,8 @@ exports.VEllipseSector = VEllipseSector;
|
|
|
7819
7938
|
* @modified 2021-01-20 Added UID.
|
|
7820
7939
|
* @modified 2022-02-02 Added the `destroy` method.
|
|
7821
7940
|
* @modified 2022-02-02 Cleared the `Vector.toSVGString` function (deprecated). Use `drawutilssvg` instead.
|
|
7822
|
-
* @
|
|
7941
|
+
* @modified 2022-10-25 Added the `getOrthogonal` method.
|
|
7942
|
+
* @version 1.5.0
|
|
7823
7943
|
*
|
|
7824
7944
|
* @file Vector
|
|
7825
7945
|
* @public
|
|
@@ -7884,7 +8004,7 @@ var Vector = /** @class */ (function (_super) {
|
|
|
7884
8004
|
return v;
|
|
7885
8005
|
};
|
|
7886
8006
|
/**
|
|
7887
|
-
* The inverse of a vector is a vector
|
|
8007
|
+
* The inverse of a vector is a vector with the same magnitude but oppose direction.
|
|
7888
8008
|
*
|
|
7889
8009
|
* Please not that the origin of this vector changes here: a->b becomes b->a.
|
|
7890
8010
|
*
|
|
@@ -7930,6 +8050,24 @@ var Vector = /** @class */ (function (_super) {
|
|
|
7930
8050
|
// if we cast these lines infinitely in both directions, they intersect here:
|
|
7931
8051
|
return new Vertex_1.Vertex(this.a.x + a * (this.b.x - this.a.x), this.a.y + a * (this.b.y - this.a.y));
|
|
7932
8052
|
};
|
|
8053
|
+
/**
|
|
8054
|
+
* Get the orthogonal "vector" of this vector (rotated by 90° clockwise).
|
|
8055
|
+
*
|
|
8056
|
+
* @name getOrthogonal
|
|
8057
|
+
* @method getOrthogonal
|
|
8058
|
+
* @return {Vector} A new vector with the same length that stands on this vector's point a.
|
|
8059
|
+
* @instance
|
|
8060
|
+
* @memberof Vector
|
|
8061
|
+
**/
|
|
8062
|
+
Vector.prototype.getOrthogonal = function () {
|
|
8063
|
+
// Orthogonal of vector (0,0)->(x,y) is (0,0)->(-y,x)
|
|
8064
|
+
var linePoint = this.a.clone();
|
|
8065
|
+
var startPoint = this.b.clone().sub(this.a);
|
|
8066
|
+
var tmp = startPoint.x;
|
|
8067
|
+
startPoint.x = -startPoint.y;
|
|
8068
|
+
startPoint.y = tmp;
|
|
8069
|
+
return new Vector(linePoint, startPoint.add(this.a));
|
|
8070
|
+
};
|
|
7933
8071
|
Vector.utils = {
|
|
7934
8072
|
/**
|
|
7935
8073
|
* Generate a four-point arrow head, starting at the vector end minus the
|
|
@@ -8322,7 +8460,8 @@ exports.VertTuple = VertTuple;
|
|
|
8322
8460
|
* @modified 2022-01-31 Added `Vertex.utils.arrayToJSON`.
|
|
8323
8461
|
* @modified 2022-02-02 Added the `destroy` method.
|
|
8324
8462
|
* @modified 2022-02-02 Cleared the `Vertex.toSVGString` function (deprecated). Use `drawutilssvg` instead.
|
|
8325
|
-
* @
|
|
8463
|
+
* @modified 2022-11-28 Added the `subXY`, `subX` and `subY` methods to the `Vertex` class.
|
|
8464
|
+
* @version 2.8.0
|
|
8326
8465
|
*
|
|
8327
8466
|
* @file Vertex
|
|
8328
8467
|
* @public
|
|
@@ -8596,6 +8735,47 @@ var Vertex = /** @class */ (function () {
|
|
|
8596
8735
|
}
|
|
8597
8736
|
return this;
|
|
8598
8737
|
};
|
|
8738
|
+
/**
|
|
8739
|
+
* Substract the passed amounts from the x- and y- components of this vertex.
|
|
8740
|
+
*
|
|
8741
|
+
* @method subXY
|
|
8742
|
+
* @param {number} x - The amount to substract from x.
|
|
8743
|
+
* @param {number} y - The amount to substract from y.
|
|
8744
|
+
* @return {Vertex} this
|
|
8745
|
+
* @instance
|
|
8746
|
+
* @memberof Vertex
|
|
8747
|
+
**/
|
|
8748
|
+
Vertex.prototype.subXY = function (amountX, amountY) {
|
|
8749
|
+
this.x -= amountX;
|
|
8750
|
+
this.y -= amountY;
|
|
8751
|
+
return this;
|
|
8752
|
+
};
|
|
8753
|
+
/**
|
|
8754
|
+
* Substract the passed amounts from the x-component of this vertex.
|
|
8755
|
+
*
|
|
8756
|
+
* @method addX
|
|
8757
|
+
* @param {number} x - The amount to substract from x.
|
|
8758
|
+
* @return {Vertex} this
|
|
8759
|
+
* @instance
|
|
8760
|
+
* @memberof Vertex
|
|
8761
|
+
**/
|
|
8762
|
+
Vertex.prototype.subX = function (amountX) {
|
|
8763
|
+
this.x -= amountX;
|
|
8764
|
+
return this;
|
|
8765
|
+
};
|
|
8766
|
+
/**
|
|
8767
|
+
* Substract the passed amounts from the y-component of this vertex.
|
|
8768
|
+
*
|
|
8769
|
+
* @method subY
|
|
8770
|
+
* @param {number} y - The amount to substract from y.
|
|
8771
|
+
* @return {Vertex} this
|
|
8772
|
+
* @instance
|
|
8773
|
+
* @memberof Vertex
|
|
8774
|
+
**/
|
|
8775
|
+
Vertex.prototype.subY = function (amountY) {
|
|
8776
|
+
this.y -= amountY;
|
|
8777
|
+
return this;
|
|
8778
|
+
};
|
|
8599
8779
|
/**
|
|
8600
8780
|
* Check if this vertex equals the passed one.
|
|
8601
8781
|
* <br>
|
|
@@ -11009,7 +11189,8 @@ var GLU = /** @class */ (function () {
|
|
|
11009
11189
|
* @modified 2022-03-26 Added the private `nodeDefs` and `bufferedNodeDefs` attributes.
|
|
11010
11190
|
* @modified 2022-03-26 Added the `texturedPoly` function to draw textures polygons.
|
|
11011
11191
|
* @modified 2022-07-26 Adding `alpha` to the `image(...)` function.
|
|
11012
|
-
* @
|
|
11192
|
+
* @modified 2022-11-10 Tweaking some type issues.
|
|
11193
|
+
* @version 1.6.2
|
|
11013
11194
|
**/
|
|
11014
11195
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
11015
11196
|
exports.drawutilssvg = void 0;
|
|
@@ -12011,7 +12192,7 @@ var drawutilssvg = /** @class */ (function () {
|
|
|
12011
12192
|
* @memberof drawutils
|
|
12012
12193
|
*/
|
|
12013
12194
|
drawutilssvg.prototype.text = function (text, x, y, options) {
|
|
12014
|
-
var _a, _b;
|
|
12195
|
+
var _a, _b, _c;
|
|
12015
12196
|
options = options || {};
|
|
12016
12197
|
var color = options.color || "black";
|
|
12017
12198
|
var lineHeight = ((_b = (_a = options.lineHeight) !== null && _a !== void 0 ? _a : options.fontSize) !== null && _b !== void 0 ? _b : 0) * this.scale.x;
|
|
@@ -12036,10 +12217,10 @@ var drawutilssvg = /** @class */ (function () {
|
|
|
12036
12217
|
this.curId = curId + "_text";
|
|
12037
12218
|
var textNode = this.makeNode("text");
|
|
12038
12219
|
node.appendChild(textNode);
|
|
12039
|
-
textNode.setAttribute("font-family", options.fontFamily); // May be undefined
|
|
12040
|
-
textNode.setAttribute("font-size", options.fontSize ? "" + options.fontSize * this.scale.x :
|
|
12041
|
-
textNode.setAttribute("font-style", options.fontStyle ? "" + options.fontStyle :
|
|
12042
|
-
textNode.setAttribute("font-weight", options.fontWeight ? "" + options.fontWeight :
|
|
12220
|
+
textNode.setAttribute("font-family", (_c = options.fontFamily) !== null && _c !== void 0 ? _c : ""); // May be undefined
|
|
12221
|
+
textNode.setAttribute("font-size", options.fontSize ? "" + options.fontSize * this.scale.x : "");
|
|
12222
|
+
textNode.setAttribute("font-style", options.fontStyle ? "" + options.fontStyle : "");
|
|
12223
|
+
textNode.setAttribute("font-weight", options.fontWeight ? "" + options.fontWeight : "");
|
|
12043
12224
|
textNode.setAttribute("text-anchor", textAlign);
|
|
12044
12225
|
textNode.setAttribute("transform-origin", "0 0");
|
|
12045
12226
|
textNode.setAttribute("transform", rotate);
|
|
@@ -12191,19 +12372,6 @@ var drawutilssvg = /** @class */ (function () {
|
|
|
12191
12372
|
var _sy = function (index) {
|
|
12192
12373
|
data[index] = scale.y * Number(data[index]);
|
|
12193
12374
|
};
|
|
12194
|
-
var stx = function (value) {
|
|
12195
|
-
return offset.x + scale.x * value;
|
|
12196
|
-
};
|
|
12197
|
-
var sty = function (value) {
|
|
12198
|
-
return offset.y + scale.y * value;
|
|
12199
|
-
};
|
|
12200
|
-
// scale only {x,y}
|
|
12201
|
-
var sx = function (value) {
|
|
12202
|
-
return scale.x * value;
|
|
12203
|
-
};
|
|
12204
|
-
var sy = function (value) {
|
|
12205
|
-
return scale.y * value;
|
|
12206
|
-
};
|
|
12207
12375
|
var i = 0;
|
|
12208
12376
|
var lastPoint = { x: NaN, y: NaN };
|
|
12209
12377
|
// "save last point"
|
|
@@ -12515,6 +12683,7 @@ globalThis.BezierPath = __webpack_require__(126).BezierPath;
|
|
|
12515
12683
|
globalThis.Polygon = __webpack_require__(661).Polygon;
|
|
12516
12684
|
globalThis.Triangle = __webpack_require__(212).Triangle;
|
|
12517
12685
|
globalThis.VEllipse = __webpack_require__(112).VEllipse;
|
|
12686
|
+
globalThis.VEllipseSector = __webpack_require__(965).VEllipseSector;
|
|
12518
12687
|
globalThis.Circle = __webpack_require__(913).Circle;
|
|
12519
12688
|
globalThis.CircleSector = __webpack_require__(946).CircleSector;
|
|
12520
12689
|
globalThis.PBImage = __webpack_require__(699).PBImage;
|