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/README.md
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -357,7 +357,8 @@ class VertexListeners {
|
|
|
357
357
|
* @modified 2022-01-31 Added `Vertex.utils.arrayToJSON`.
|
|
358
358
|
* @modified 2022-02-02 Added the `destroy` method.
|
|
359
359
|
* @modified 2022-02-02 Cleared the `Vertex.toSVGString` function (deprecated). Use `drawutilssvg` instead.
|
|
360
|
-
* @
|
|
360
|
+
* @modified 2022-11-28 Added the `subXY`, `subX` and `subY` methods to the `Vertex` class.
|
|
361
|
+
* @version 2.8.0
|
|
361
362
|
*
|
|
362
363
|
* @file Vertex
|
|
363
364
|
* @public
|
|
@@ -626,6 +627,47 @@ class Vertex {
|
|
|
626
627
|
}
|
|
627
628
|
return this;
|
|
628
629
|
}
|
|
630
|
+
/**
|
|
631
|
+
* Substract the passed amounts from the x- and y- components of this vertex.
|
|
632
|
+
*
|
|
633
|
+
* @method subXY
|
|
634
|
+
* @param {number} x - The amount to substract from x.
|
|
635
|
+
* @param {number} y - The amount to substract from y.
|
|
636
|
+
* @return {Vertex} this
|
|
637
|
+
* @instance
|
|
638
|
+
* @memberof Vertex
|
|
639
|
+
**/
|
|
640
|
+
subXY(amountX, amountY) {
|
|
641
|
+
this.x -= amountX;
|
|
642
|
+
this.y -= amountY;
|
|
643
|
+
return this;
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Substract the passed amounts from the x-component of this vertex.
|
|
647
|
+
*
|
|
648
|
+
* @method addX
|
|
649
|
+
* @param {number} x - The amount to substract from x.
|
|
650
|
+
* @return {Vertex} this
|
|
651
|
+
* @instance
|
|
652
|
+
* @memberof Vertex
|
|
653
|
+
**/
|
|
654
|
+
subX(amountX) {
|
|
655
|
+
this.x -= amountX;
|
|
656
|
+
return this;
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Substract the passed amounts from the y-component of this vertex.
|
|
660
|
+
*
|
|
661
|
+
* @method subY
|
|
662
|
+
* @param {number} y - The amount to substract from y.
|
|
663
|
+
* @return {Vertex} this
|
|
664
|
+
* @instance
|
|
665
|
+
* @memberof Vertex
|
|
666
|
+
**/
|
|
667
|
+
subY(amountY) {
|
|
668
|
+
this.y -= amountY;
|
|
669
|
+
return this;
|
|
670
|
+
}
|
|
629
671
|
/**
|
|
630
672
|
* Check if this vertex equals the passed one.
|
|
631
673
|
* <br>
|
|
@@ -982,7 +1024,7 @@ class Polygon {
|
|
|
982
1024
|
if (typeof vertices == "undefined")
|
|
983
1025
|
vertices = [];
|
|
984
1026
|
this.vertices = vertices;
|
|
985
|
-
this.isOpen = isOpen;
|
|
1027
|
+
this.isOpen = isOpen || false;
|
|
986
1028
|
}
|
|
987
1029
|
/**
|
|
988
1030
|
* Add a vertex to the end of the `vertices` array.
|
|
@@ -1412,7 +1454,9 @@ Polygon.utils = {
|
|
|
1412
1454
|
* @modified 2021-02-02 Added the `toPolygon` method.
|
|
1413
1455
|
* @modified 2021-06-21 (mid-summer) Added `getCenter` method.
|
|
1414
1456
|
* @modified 2022-02-01 Added the `toString` function.
|
|
1415
|
-
* @
|
|
1457
|
+
* @modified 2022-10-09 Added the `fromDimension` function.
|
|
1458
|
+
* @modified 2022-11-28 Added the `clone` method.
|
|
1459
|
+
* @version 1.6.0
|
|
1416
1460
|
**/
|
|
1417
1461
|
/**
|
|
1418
1462
|
* @classdesc A bounds class with min and max values. Implementing IBounds.
|
|
@@ -1475,17 +1519,14 @@ class Bounds {
|
|
|
1475
1519
|
/**
|
|
1476
1520
|
* Clone this bounds object (create a deep clone).
|
|
1477
1521
|
*
|
|
1478
|
-
* Note: the returned format might change in the future, so please do not
|
|
1479
|
-
* rely on the returned string format.
|
|
1480
|
-
*
|
|
1481
1522
|
* @method clone
|
|
1482
1523
|
* @instance
|
|
1483
1524
|
* @memberof Bounds
|
|
1484
|
-
* @returns {
|
|
1525
|
+
* @returns {Bounds} Creates a deep clone of this bounds object.
|
|
1485
1526
|
*/
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1527
|
+
clone() {
|
|
1528
|
+
return new Bounds({ x: this.min.x, y: this.min.y }, { x: this.max.x, y: this.max.y });
|
|
1529
|
+
}
|
|
1489
1530
|
/**
|
|
1490
1531
|
* Compute the minimal bounding box for a given set of vertices.
|
|
1491
1532
|
*
|
|
@@ -1514,6 +1555,17 @@ class Bounds {
|
|
|
1514
1555
|
}
|
|
1515
1556
|
return new Bounds(new Vertex(xMin, yMin), new Vertex(xMax, yMax));
|
|
1516
1557
|
}
|
|
1558
|
+
/**
|
|
1559
|
+
* Create a new `Bounds` instance just from `width` and `height`, located at (0,0) or the optionally given origin.
|
|
1560
|
+
*
|
|
1561
|
+
* @param {number} width - The width of the bounds
|
|
1562
|
+
* @param {number} height - The height of the bounds
|
|
1563
|
+
* @param {XYCoords={x:0,y:0}} origin - [optional] A origin to locate the new Bounds object at.
|
|
1564
|
+
* @returns {Bounds} A new `Bounds` instance width given width and height, located at (0,0) or the given origin..
|
|
1565
|
+
*/
|
|
1566
|
+
static fromDimension(width, height, origin) {
|
|
1567
|
+
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 });
|
|
1568
|
+
}
|
|
1517
1569
|
} // END class bounds
|
|
1518
1570
|
|
|
1519
1571
|
/**
|
|
@@ -1831,7 +1883,8 @@ VertTuple.vtutils = {
|
|
|
1831
1883
|
* @modified 2021-01-20 Added UID.
|
|
1832
1884
|
* @modified 2022-02-02 Added the `destroy` method.
|
|
1833
1885
|
* @modified 2022-02-02 Cleared the `Vector.toSVGString` function (deprecated). Use `drawutilssvg` instead.
|
|
1834
|
-
* @
|
|
1886
|
+
* @modified 2022-10-25 Added the `getOrthogonal` method.
|
|
1887
|
+
* @version 1.5.0
|
|
1835
1888
|
*
|
|
1836
1889
|
* @file Vector
|
|
1837
1890
|
* @public
|
|
@@ -1877,7 +1930,7 @@ class Vector extends VertTuple {
|
|
|
1877
1930
|
return v;
|
|
1878
1931
|
}
|
|
1879
1932
|
/**
|
|
1880
|
-
* The inverse of a vector is a vector
|
|
1933
|
+
* The inverse of a vector is a vector with the same magnitude but oppose direction.
|
|
1881
1934
|
*
|
|
1882
1935
|
* Please not that the origin of this vector changes here: a->b becomes b->a.
|
|
1883
1936
|
*
|
|
@@ -1923,6 +1976,24 @@ class Vector extends VertTuple {
|
|
|
1923
1976
|
// if we cast these lines infinitely in both directions, they intersect here:
|
|
1924
1977
|
return new Vertex(this.a.x + a * (this.b.x - this.a.x), this.a.y + a * (this.b.y - this.a.y));
|
|
1925
1978
|
}
|
|
1979
|
+
/**
|
|
1980
|
+
* Get the orthogonal "vector" of this vector (rotated by 90° clockwise).
|
|
1981
|
+
*
|
|
1982
|
+
* @name getOrthogonal
|
|
1983
|
+
* @method getOrthogonal
|
|
1984
|
+
* @return {Vector} A new vector with the same length that stands on this vector's point a.
|
|
1985
|
+
* @instance
|
|
1986
|
+
* @memberof Vector
|
|
1987
|
+
**/
|
|
1988
|
+
getOrthogonal() {
|
|
1989
|
+
// Orthogonal of vector (0,0)->(x,y) is (0,0)->(-y,x)
|
|
1990
|
+
const linePoint = this.a.clone();
|
|
1991
|
+
const startPoint = this.b.clone().sub(this.a);
|
|
1992
|
+
const tmp = startPoint.x;
|
|
1993
|
+
startPoint.x = -startPoint.y;
|
|
1994
|
+
startPoint.y = tmp;
|
|
1995
|
+
return new Vector(linePoint, startPoint.add(this.a));
|
|
1996
|
+
}
|
|
1926
1997
|
}
|
|
1927
1998
|
Vector.utils = {
|
|
1928
1999
|
/**
|
|
@@ -1951,8 +2022,8 @@ Vector.utils = {
|
|
|
1951
2022
|
* @param {number} scaleY - the vertical scaling during draw.
|
|
1952
2023
|
**/
|
|
1953
2024
|
buildArrowHead: (zA, zB, headlen, scaleX, scaleY) => {
|
|
1954
|
-
|
|
1955
|
-
|
|
2025
|
+
const angle = Math.atan2((zB.y - zA.y) * scaleY, (zB.x - zA.x) * scaleX);
|
|
2026
|
+
const vertices = [];
|
|
1956
2027
|
vertices.push(new Vertex(zB.x * scaleX - headlen * Math.cos(angle), zB.y * scaleY - headlen * Math.sin(angle)));
|
|
1957
2028
|
vertices.push(new Vertex(zB.x * scaleX - headlen * 1.35 * Math.cos(angle - Math.PI / 8), zB.y * scaleY - headlen * 1.35 * Math.sin(angle - Math.PI / 8)));
|
|
1958
2029
|
vertices.push(new Vertex(zB.x * scaleX, zB.y * scaleY));
|
|
@@ -1983,7 +2054,8 @@ Vector.utils = {
|
|
|
1983
2054
|
* @modified 2021-01-20 Added UID.
|
|
1984
2055
|
* @modified 2022-02-02 Added the `destroy` method.
|
|
1985
2056
|
* @modified 2022-02-02 Cleared the `toSVGPathData` function (deprecated). Use `drawutilssvg` instead.
|
|
1986
|
-
* @
|
|
2057
|
+
* @modified 2022-10-17 The `CubicBezierCurve` class now implements the new `PathSegment` interface.
|
|
2058
|
+
* @version 2.7.1
|
|
1987
2059
|
*
|
|
1988
2060
|
* @file CubicBezierCurve
|
|
1989
2061
|
* @public
|
|
@@ -2029,7 +2101,7 @@ class CubicBezierCurve {
|
|
|
2029
2101
|
// An array of floats
|
|
2030
2102
|
this.segmentLengths = [];
|
|
2031
2103
|
// float
|
|
2032
|
-
this.arcLength = null;
|
|
2104
|
+
// this.arcLength = null;
|
|
2033
2105
|
this.updateArcLengths();
|
|
2034
2106
|
}
|
|
2035
2107
|
/**
|
|
@@ -2461,6 +2533,28 @@ class CubicBezierCurve {
|
|
|
2461
2533
|
clone() {
|
|
2462
2534
|
return new CubicBezierCurve(this.getStartPoint().clone(), this.getEndPoint().clone(), this.getStartControlPoint().clone(), this.getEndControlPoint().clone());
|
|
2463
2535
|
}
|
|
2536
|
+
//---BEGIN PathSegment-------------------------
|
|
2537
|
+
/**
|
|
2538
|
+
* Get the tangent's end point at the start point of this segment.
|
|
2539
|
+
*
|
|
2540
|
+
* @method getStartTangent
|
|
2541
|
+
* @memberof PathSegment
|
|
2542
|
+
* @return {Vertex} The end point of the starting point's tangent.
|
|
2543
|
+
*/
|
|
2544
|
+
getStartTangent() {
|
|
2545
|
+
return this.startControlPoint;
|
|
2546
|
+
}
|
|
2547
|
+
/**
|
|
2548
|
+
* Get the tangent's end point at the end point of this segment.
|
|
2549
|
+
*
|
|
2550
|
+
* @method getEndTangent
|
|
2551
|
+
* @memberof PathSegment
|
|
2552
|
+
* @return {Vertex} The end point of the ending point's tangent.
|
|
2553
|
+
*/
|
|
2554
|
+
getEndTangent() {
|
|
2555
|
+
return this.endControlPoint;
|
|
2556
|
+
}
|
|
2557
|
+
//---END PathSegment-------------------------
|
|
2464
2558
|
/**
|
|
2465
2559
|
* Check if this and the specified curve are equal.<br>
|
|
2466
2560
|
* <br>
|
|
@@ -3874,7 +3968,9 @@ BezierPath.END_POINT = 3;
|
|
|
3874
3968
|
* @modified 2020-03-23 Ported to Typescript from JS.
|
|
3875
3969
|
* @modified 2020-12-04 The `intersection` function returns undefined if both lines are parallel.
|
|
3876
3970
|
* @modified 2022-02-02 Added the `destroy` method.
|
|
3877
|
-
* @
|
|
3971
|
+
* @modified 2022-10-09 Changed the actual return value of the `intersection` function to null (was undefined before).
|
|
3972
|
+
* @modified 2022-10-17 Adding these methods from the `PathSegment` interface: getStartPoint, getEndPoint, revert.
|
|
3973
|
+
* @version 2.3.0
|
|
3878
3974
|
*
|
|
3879
3975
|
* @file Line
|
|
3880
3976
|
* @public
|
|
@@ -3915,8 +4011,9 @@ class Line extends VertTuple {
|
|
|
3915
4011
|
// !!! DO NOT MOVE TO VertTuple
|
|
3916
4012
|
intersection(line) {
|
|
3917
4013
|
const denominator = this.denominator(line);
|
|
3918
|
-
if (denominator == 0)
|
|
4014
|
+
if (denominator == 0) {
|
|
3919
4015
|
return null;
|
|
4016
|
+
}
|
|
3920
4017
|
let a = this.a.y - line.a.y;
|
|
3921
4018
|
let b = this.a.x - line.a.x;
|
|
3922
4019
|
const numerator1 = (line.b.x - line.a.x) * a - (line.b.y - line.a.y) * b;
|
|
@@ -3927,11 +4024,65 @@ class Line extends VertTuple {
|
|
|
3927
4024
|
const x = this.a.x + a * (this.b.x - this.a.x);
|
|
3928
4025
|
const y = this.a.y + a * (this.b.y - this.a.y);
|
|
3929
4026
|
if (isNaN(a) || isNaN(x) || isNaN(y)) {
|
|
3930
|
-
return
|
|
4027
|
+
return null;
|
|
3931
4028
|
}
|
|
3932
4029
|
// if we cast these lines infinitely in both directions, they intersect here:
|
|
3933
4030
|
return new Vertex(x, y);
|
|
3934
4031
|
}
|
|
4032
|
+
//--- Implement PathSegment ---
|
|
4033
|
+
/**
|
|
4034
|
+
* Get the start point of this path segment.
|
|
4035
|
+
*
|
|
4036
|
+
* @method getStartPoint
|
|
4037
|
+
* @memberof PathSegment
|
|
4038
|
+
* @return {Vertex} The start point of this path segment.
|
|
4039
|
+
*/
|
|
4040
|
+
getStartPoint() {
|
|
4041
|
+
return this.a;
|
|
4042
|
+
}
|
|
4043
|
+
/**
|
|
4044
|
+
* Get the end point of this path segment.
|
|
4045
|
+
*
|
|
4046
|
+
* @method getEndPoint
|
|
4047
|
+
* @memberof PathSegment
|
|
4048
|
+
* @return {Vertex} The end point of this path segment.
|
|
4049
|
+
*/
|
|
4050
|
+
getEndPoint() {
|
|
4051
|
+
return this.b;
|
|
4052
|
+
}
|
|
4053
|
+
/**
|
|
4054
|
+
* Get the tangent's end point at the start point of this segment.
|
|
4055
|
+
*
|
|
4056
|
+
* @method getStartTangent
|
|
4057
|
+
* @memberof PathSegment
|
|
4058
|
+
* @return {Vertex} The end point of the starting point's tangent.
|
|
4059
|
+
*/
|
|
4060
|
+
getStartTangent() {
|
|
4061
|
+
return this.b;
|
|
4062
|
+
}
|
|
4063
|
+
/**
|
|
4064
|
+
* Get the tangent's end point at the end point of this segment.
|
|
4065
|
+
*
|
|
4066
|
+
* @method getEndTangent
|
|
4067
|
+
* @memberof PathSegment
|
|
4068
|
+
* @return {Vertex} The end point of the ending point's tangent.
|
|
4069
|
+
*/
|
|
4070
|
+
getEndTangent() {
|
|
4071
|
+
return this.a;
|
|
4072
|
+
}
|
|
4073
|
+
/**
|
|
4074
|
+
* Inverse this path segment (in-place) and return this same instance (useful for chaining).
|
|
4075
|
+
*
|
|
4076
|
+
* @method reverse
|
|
4077
|
+
* @memberof PathSegment
|
|
4078
|
+
* @return {PathSegment} This path segment instance (for chaining).
|
|
4079
|
+
*/
|
|
4080
|
+
reverse() {
|
|
4081
|
+
var tmp = this.a;
|
|
4082
|
+
this.a = this.b;
|
|
4083
|
+
this.b = tmp;
|
|
4084
|
+
return this;
|
|
4085
|
+
}
|
|
3935
4086
|
}
|
|
3936
4087
|
|
|
3937
4088
|
/**
|
|
@@ -4323,7 +4474,8 @@ CircleSector.circleSectorUtils = {
|
|
|
4323
4474
|
* @modified 2022-03-26 Added the private `nodeDefs` and `bufferedNodeDefs` attributes.
|
|
4324
4475
|
* @modified 2022-03-26 Added the `texturedPoly` function to draw textures polygons.
|
|
4325
4476
|
* @modified 2022-07-26 Adding `alpha` to the `image(...)` function.
|
|
4326
|
-
* @
|
|
4477
|
+
* @modified 2022-11-10 Tweaking some type issues.
|
|
4478
|
+
* @version 1.6.2
|
|
4327
4479
|
**/
|
|
4328
4480
|
const RAD_TO_DEG = 180 / Math.PI;
|
|
4329
4481
|
/**
|
|
@@ -5316,7 +5468,7 @@ class drawutilssvg {
|
|
|
5316
5468
|
* @memberof drawutils
|
|
5317
5469
|
*/
|
|
5318
5470
|
text(text, x, y, options) {
|
|
5319
|
-
var _a, _b;
|
|
5471
|
+
var _a, _b, _c;
|
|
5320
5472
|
options = options || {};
|
|
5321
5473
|
const color = options.color || "black";
|
|
5322
5474
|
const lineHeight = ((_b = (_a = options.lineHeight) !== null && _a !== void 0 ? _a : options.fontSize) !== null && _b !== void 0 ? _b : 0) * this.scale.x;
|
|
@@ -5341,10 +5493,10 @@ class drawutilssvg {
|
|
|
5341
5493
|
this.curId = curId + "_text";
|
|
5342
5494
|
const textNode = this.makeNode("text");
|
|
5343
5495
|
node.appendChild(textNode);
|
|
5344
|
-
textNode.setAttribute("font-family", options.fontFamily); // May be undefined
|
|
5345
|
-
textNode.setAttribute("font-size", options.fontSize ? `${options.fontSize * this.scale.x}` :
|
|
5346
|
-
textNode.setAttribute("font-style", options.fontStyle ? `${options.fontStyle}` :
|
|
5347
|
-
textNode.setAttribute("font-weight", options.fontWeight ? `${options.fontWeight}` :
|
|
5496
|
+
textNode.setAttribute("font-family", (_c = options.fontFamily) !== null && _c !== void 0 ? _c : ""); // May be undefined
|
|
5497
|
+
textNode.setAttribute("font-size", options.fontSize ? `${options.fontSize * this.scale.x}` : "");
|
|
5498
|
+
textNode.setAttribute("font-style", options.fontStyle ? `${options.fontStyle}` : "");
|
|
5499
|
+
textNode.setAttribute("font-weight", options.fontWeight ? `${options.fontWeight}` : "");
|
|
5348
5500
|
textNode.setAttribute("text-anchor", textAlign);
|
|
5349
5501
|
textNode.setAttribute("transform-origin", "0 0");
|
|
5350
5502
|
textNode.setAttribute("transform", rotate);
|
|
@@ -9645,10 +9797,11 @@ VEllipse.utils = {
|
|
|
9645
9797
|
* Implementation of elliptic sectors.
|
|
9646
9798
|
* Note that sectors are constructed in clockwise direction.
|
|
9647
9799
|
*
|
|
9648
|
-
* @author
|
|
9649
|
-
* @date
|
|
9800
|
+
* @author Ikaros Kappler
|
|
9801
|
+
* @date 2021-02-26
|
|
9650
9802
|
* @modified 2022-02-02 Added the `destroy` method.
|
|
9651
|
-
* @
|
|
9803
|
+
* @modified 2022-11-01 Tweaked the `endpointToCenterParameters` function to handle negative values, too, without errors.
|
|
9804
|
+
* @version 1.1.1
|
|
9652
9805
|
*/
|
|
9653
9806
|
/**
|
|
9654
9807
|
* @classdesc A class for elliptic sectors.
|
|
@@ -9724,10 +9877,14 @@ class VEllipseSector {
|
|
|
9724
9877
|
let intersection = startTangent.intersection(endTangent);
|
|
9725
9878
|
// What if intersection is undefined?
|
|
9726
9879
|
// --> This *can* not happen if segmentCount > 2 and height and width of the ellipse are not zero.
|
|
9727
|
-
|
|
9728
|
-
|
|
9729
|
-
|
|
9730
|
-
|
|
9880
|
+
if (intersection) {
|
|
9881
|
+
// It's VERY LIKELY hat this ALWAYS happens; it's just a typesave variant.
|
|
9882
|
+
// Intersection cannot be null.
|
|
9883
|
+
let startDiff = startPoint.difference(intersection);
|
|
9884
|
+
let endDiff = endPoint.difference(intersection);
|
|
9885
|
+
let curve = new CubicBezierCurve(startPoint.clone(), endPoint.clone(), startPoint.clone().add(startDiff.scale(threshold)), endPoint.clone().add(endDiff.scale(threshold)));
|
|
9886
|
+
curves.push(curve);
|
|
9887
|
+
}
|
|
9731
9888
|
}
|
|
9732
9889
|
startPoint = endPoint;
|
|
9733
9890
|
curAngle = nextAngle;
|
|
@@ -9891,7 +10048,8 @@ VEllipseSector.ellipseSectorUtils = {
|
|
|
9891
10048
|
}
|
|
9892
10049
|
// Step 2 + 3: compute center
|
|
9893
10050
|
const sign = fa === fs ? -1 : 1;
|
|
9894
|
-
const M = sqrt((prx * pry - prx * py - pry * px) / (prx * py + pry * px)) * sign;
|
|
10051
|
+
// const M: number = sqrt((prx * pry - prx * py - pry * px) / (prx * py + pry * px)) * sign;
|
|
10052
|
+
const M = sqrt(Math.abs((prx * pry - prx * py - pry * px) / (prx * py + pry * px))) * sign;
|
|
9895
10053
|
const _cx = (M * (rx * y)) / ry;
|
|
9896
10054
|
const _cy = (M * (-ry * x)) / rx;
|
|
9897
10055
|
const cx = cosphi * _cx - sinphi * _cy + (x1 + x2) / 2;
|
|
@@ -9900,6 +10058,7 @@ VEllipseSector.ellipseSectorUtils = {
|
|
|
9900
10058
|
const center = new Vertex(cx, cy);
|
|
9901
10059
|
const axis = center.clone().addXY(rx, ry);
|
|
9902
10060
|
const ellipse = new VEllipse(center, axis, 0);
|
|
10061
|
+
// console.log("VELLIPSE::::::", ellipse);
|
|
9903
10062
|
ellipse.rotate(phi);
|
|
9904
10063
|
const startAngle = new Line(ellipse.center, new Vertex(x1, y1)).angle();
|
|
9905
10064
|
const endAngle = new Line(ellipse.center, new Vertex(x2, y2)).angle();
|
|
@@ -9984,7 +10143,10 @@ VEllipseSector.ellipseSectorUtils = {
|
|
|
9984
10143
|
* @modified 2021-04-25 Extending `remove` to accept arrays of drawables.
|
|
9985
10144
|
* @modified 2021-11-16 Adding the `PBText` drawable.
|
|
9986
10145
|
* @modified 2022-08-01 Added `title` to the params.
|
|
9987
|
-
* @
|
|
10146
|
+
* @modified 2022-10-25 Added the `origin` to the default draw config.
|
|
10147
|
+
* @modified 2022-11-06 Adding an XML declaration to the SVG export routine.
|
|
10148
|
+
* @modified 2022-11-23 Added the `drawRaster` (default=true) option to the config/drawconfig.
|
|
10149
|
+
* @version 1.17.0
|
|
9988
10150
|
*
|
|
9989
10151
|
* @file PlotBoilerplate
|
|
9990
10152
|
* @fileoverview The main class.
|
|
@@ -10080,6 +10242,7 @@ class PlotBoilerplate {
|
|
|
10080
10242
|
* @param {string=} [config.title=null] - Specify any hover tile here. It will be attached as a `title` attribute to the most elevated element.
|
|
10081
10243
|
*/
|
|
10082
10244
|
constructor(config) {
|
|
10245
|
+
var _a, _b;
|
|
10083
10246
|
/**
|
|
10084
10247
|
* A discrete timestamp to identify single render cycles.
|
|
10085
10248
|
* Note that using system time milliseconds is not a safe way to identify render frames, as on modern powerful machines
|
|
@@ -10119,6 +10282,7 @@ class PlotBoilerplate {
|
|
|
10119
10282
|
offsetX: f.num(config, "offsetX", 0.0),
|
|
10120
10283
|
offsetY: f.num(config, "offsetY", 0.0),
|
|
10121
10284
|
rasterGrid: f.bool(config, "rasterGrid", true),
|
|
10285
|
+
drawRaster: f.bool(config, "drawRaster", true),
|
|
10122
10286
|
rasterScaleX: f.num(config, "rasterScaleX", 1.0),
|
|
10123
10287
|
rasterScaleY: f.num(config, "rasterScaleY", 1.0),
|
|
10124
10288
|
rasterAdjustFactor: f.num(config, "rasterAdjustdFactror", 2.0),
|
|
@@ -10169,6 +10333,7 @@ class PlotBoilerplate {
|
|
|
10169
10333
|
drawHandleLines: f.bool(config, "drawHandleLines", true),
|
|
10170
10334
|
drawHandlePoints: f.bool(config, "drawHandlePoints", true),
|
|
10171
10335
|
drawGrid: f.bool(config, "drawGrid", true),
|
|
10336
|
+
drawRaster: f.bool(config, "drawRaster", true),
|
|
10172
10337
|
bezier: {
|
|
10173
10338
|
color: "#00a822",
|
|
10174
10339
|
lineWidth: 2,
|
|
@@ -10236,6 +10401,9 @@ class PlotBoilerplate {
|
|
|
10236
10401
|
lineWidth: 1,
|
|
10237
10402
|
fill: true,
|
|
10238
10403
|
anchor: true
|
|
10404
|
+
},
|
|
10405
|
+
origin: {
|
|
10406
|
+
color: "#000000"
|
|
10239
10407
|
}
|
|
10240
10408
|
}; // END drawConfig
|
|
10241
10409
|
// +---------------------------------------------------------------------------------
|
|
@@ -10254,6 +10422,7 @@ class PlotBoilerplate {
|
|
|
10254
10422
|
this.config.enableGL = false;
|
|
10255
10423
|
}
|
|
10256
10424
|
if (this.config.enableGL) {
|
|
10425
|
+
// Override the case 'null' here. If GL is not supported, well then nothing works.
|
|
10257
10426
|
const ctx = this.canvas.getContext("webgl"); // webgl-experimental?
|
|
10258
10427
|
this.draw = new drawutilsgl(ctx, false);
|
|
10259
10428
|
// PROBLEM: same instance of fill and draw when using WebGL.
|
|
@@ -10262,6 +10431,7 @@ class PlotBoilerplate {
|
|
|
10262
10431
|
console.warn("Initialized with experimental mode enableGL=true. Note that this is not yet fully implemented.");
|
|
10263
10432
|
}
|
|
10264
10433
|
else {
|
|
10434
|
+
// Override the case 'null' here. If context creation is not supported, well then nothing works.
|
|
10265
10435
|
const ctx = this.canvas.getContext("2d");
|
|
10266
10436
|
this.draw = new drawutils(ctx, false);
|
|
10267
10437
|
this.fill = new drawutils(ctx, true);
|
|
@@ -10298,8 +10468,8 @@ class PlotBoilerplate {
|
|
|
10298
10468
|
if (config.title) {
|
|
10299
10469
|
this.eventCatcher.setAttribute("title", config.title);
|
|
10300
10470
|
}
|
|
10301
|
-
this.draw.scale.set(this.config.scaleX, this.config.scaleY);
|
|
10302
|
-
this.fill.scale.set(this.config.scaleX, this.config.scaleY);
|
|
10471
|
+
this.draw.scale.set((_a = this.config.scaleX) !== null && _a !== void 0 ? _a : 1.0, this.config.scaleY);
|
|
10472
|
+
this.fill.scale.set((_b = this.config.scaleX) !== null && _b !== void 0 ? _b : 1.0, this.config.scaleY);
|
|
10303
10473
|
this.vertices = [];
|
|
10304
10474
|
this.selectPolygon = null;
|
|
10305
10475
|
this.draggedElements = [];
|
|
@@ -10344,11 +10514,13 @@ class PlotBoilerplate {
|
|
|
10344
10514
|
var tosvgFill = tosvgDraw.copyInstance(true); // fillShapes=true
|
|
10345
10515
|
tosvgDraw.beginDrawCycle(0);
|
|
10346
10516
|
tosvgFill.beginDrawCycle(0);
|
|
10347
|
-
if (pb.config.preClear)
|
|
10517
|
+
if (pb.config.preClear) {
|
|
10348
10518
|
pb.config.preClear();
|
|
10349
|
-
|
|
10350
|
-
|
|
10519
|
+
}
|
|
10520
|
+
tosvgDraw.clear(pb.config.backgroundColor || "white");
|
|
10521
|
+
if (pb.config.preDraw) {
|
|
10351
10522
|
pb.config.preDraw(tosvgDraw, tosvgFill);
|
|
10523
|
+
}
|
|
10352
10524
|
pb.drawAll(0, tosvgDraw, tosvgFill);
|
|
10353
10525
|
pb.drawVertices(0, tosvgDraw);
|
|
10354
10526
|
if (pb.config.postDraw)
|
|
@@ -10359,7 +10531,8 @@ class PlotBoilerplate {
|
|
|
10359
10531
|
// https://caniuse.com/xml-serializer
|
|
10360
10532
|
var serializer = new XMLSerializer();
|
|
10361
10533
|
var svgCode = serializer.serializeToString(svgNode);
|
|
10362
|
-
|
|
10534
|
+
// Add: '<?xml version="1.0" encoding="utf-8"?>\n' ?
|
|
10535
|
+
var blob = new Blob(['<?xml version="1.0" encoding="utf-8"?>\n' + svgCode], { type: "image/svg;charset=utf-8" });
|
|
10363
10536
|
// See documentation for FileSaver.js for usage.
|
|
10364
10537
|
// https://github.com/eligrey/FileSaver.js
|
|
10365
10538
|
if (typeof globalThis["saveAs"] !== "function")
|
|
@@ -10434,11 +10607,12 @@ class PlotBoilerplate {
|
|
|
10434
10607
|
* @private
|
|
10435
10608
|
**/
|
|
10436
10609
|
updateCSSscale() {
|
|
10610
|
+
var _a, _b, _c, _d;
|
|
10437
10611
|
if (this.config.cssUniformScale) {
|
|
10438
|
-
PlotBoilerplate.utils.setCSSscale(this.canvas, this.config.cssScaleX, this.config.cssScaleX);
|
|
10612
|
+
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);
|
|
10439
10613
|
}
|
|
10440
10614
|
else {
|
|
10441
|
-
PlotBoilerplate.utils.setCSSscale(this.canvas, this.config.cssScaleX, this.config.cssScaleY);
|
|
10615
|
+
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);
|
|
10442
10616
|
}
|
|
10443
10617
|
}
|
|
10444
10618
|
/**
|
|
@@ -10711,7 +10885,8 @@ class PlotBoilerplate {
|
|
|
10711
10885
|
* @return The vertex near the given position or undefined if none was found there.
|
|
10712
10886
|
**/
|
|
10713
10887
|
getVertexNear(pixelPosition, pixelTolerance) {
|
|
10714
|
-
var
|
|
10888
|
+
var _a, _b;
|
|
10889
|
+
const 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));
|
|
10715
10890
|
if (p && p.typeName == "vertex") {
|
|
10716
10891
|
return this.vertices[p.vindex];
|
|
10717
10892
|
}
|
|
@@ -10777,7 +10952,7 @@ class PlotBoilerplate {
|
|
|
10777
10952
|
drawOrigin(draw) {
|
|
10778
10953
|
// Add a crosshair to mark the origin
|
|
10779
10954
|
draw.setCurrentId("origin");
|
|
10780
|
-
draw.crosshair({ x: 0, y: 0 }, 10,
|
|
10955
|
+
draw.crosshair({ x: 0, y: 0 }, 10, this.drawConfig.origin.color);
|
|
10781
10956
|
}
|
|
10782
10957
|
/**
|
|
10783
10958
|
* This is just a tiny helper function to determine the render color of vertices.
|
|
@@ -10994,10 +11169,10 @@ class PlotBoilerplate {
|
|
|
10994
11169
|
else {
|
|
10995
11170
|
console.error("Cannot draw object. Unknown class.");
|
|
10996
11171
|
}
|
|
10997
|
-
draw.setCurrentClassName(
|
|
10998
|
-
draw.setCurrentId(
|
|
10999
|
-
fill.setCurrentClassName(
|
|
11000
|
-
fill.setCurrentId(
|
|
11172
|
+
draw.setCurrentClassName(undefined);
|
|
11173
|
+
draw.setCurrentId(undefined);
|
|
11174
|
+
fill.setCurrentClassName(undefined);
|
|
11175
|
+
fill.setCurrentId(undefined);
|
|
11001
11176
|
}
|
|
11002
11177
|
/**
|
|
11003
11178
|
* Draw the select-polygon (if there is one).
|
|
@@ -11076,9 +11251,12 @@ class PlotBoilerplate {
|
|
|
11076
11251
|
* @return {void}
|
|
11077
11252
|
**/
|
|
11078
11253
|
drawAll(renderTime, draw, fill) {
|
|
11079
|
-
this.
|
|
11080
|
-
|
|
11254
|
+
if (this.config.drawRaster) {
|
|
11255
|
+
this.drawGrid(draw);
|
|
11256
|
+
}
|
|
11257
|
+
if (this.config.drawOrigin) {
|
|
11081
11258
|
this.drawOrigin(draw);
|
|
11259
|
+
}
|
|
11082
11260
|
this.drawDrawables(renderTime, draw, fill);
|
|
11083
11261
|
this.drawVertices(renderTime, draw);
|
|
11084
11262
|
this.drawSelectPolygon(draw);
|
|
@@ -11100,7 +11278,7 @@ class PlotBoilerplate {
|
|
|
11100
11278
|
**/
|
|
11101
11279
|
clear() {
|
|
11102
11280
|
// Note that elements might have an alpha channel. Clear the scene first.
|
|
11103
|
-
this.draw.clear(this.config.backgroundColor);
|
|
11281
|
+
this.draw.clear(this.config.backgroundColor || "white");
|
|
11104
11282
|
}
|
|
11105
11283
|
/**
|
|
11106
11284
|
* Clear the selection.<br>
|
|
@@ -11130,7 +11308,8 @@ class PlotBoilerplate {
|
|
|
11130
11308
|
* @return {Bounds} The current viewport.
|
|
11131
11309
|
**/
|
|
11132
11310
|
viewport() {
|
|
11133
|
-
|
|
11311
|
+
var _a, _b;
|
|
11312
|
+
return new 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)));
|
|
11134
11313
|
}
|
|
11135
11314
|
/**
|
|
11136
11315
|
* Trigger the saveFile.hook.
|
|
@@ -11178,10 +11357,12 @@ class PlotBoilerplate {
|
|
|
11178
11357
|
* @return {void}
|
|
11179
11358
|
**/
|
|
11180
11359
|
resizeCanvas() {
|
|
11360
|
+
var _a, _b, _c, _d, _e, _f;
|
|
11181
11361
|
const _self = this;
|
|
11182
11362
|
const _setSize = (w, h) => {
|
|
11183
|
-
|
|
11184
|
-
|
|
11363
|
+
var _a, _b;
|
|
11364
|
+
w *= (_a = _self.config.canvasWidthFactor) !== null && _a !== void 0 ? _a : 1.0;
|
|
11365
|
+
h *= (_b = _self.config.canvasHeightFactor) !== null && _b !== void 0 ? _b : 1.0;
|
|
11185
11366
|
_self.canvasSize.width = w;
|
|
11186
11367
|
_self.canvasSize.height = h;
|
|
11187
11368
|
if (_self.canvas instanceof HTMLCanvasElement) {
|
|
@@ -11210,8 +11391,8 @@ class PlotBoilerplate {
|
|
|
11210
11391
|
var width = globalThis.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
|
|
11211
11392
|
var height = globalThis.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
|
|
11212
11393
|
_self.canvas.style.position = "absolute";
|
|
11213
|
-
_self.canvas.style.width = _self.config.canvasWidthFactor * width + "px";
|
|
11214
|
-
_self.canvas.style.height = _self.config.canvasWidthFactor * height + "px";
|
|
11394
|
+
_self.canvas.style.width = ((_a = _self.config.canvasWidthFactor) !== null && _a !== void 0 ? _a : 1.0) * width + "px";
|
|
11395
|
+
_self.canvas.style.height = ((_b = _self.config.canvasWidthFactor) !== null && _b !== void 0 ? _b : 1.0) * height + "px";
|
|
11215
11396
|
_self.canvas.style.top = "0px";
|
|
11216
11397
|
_self.canvas.style.left = "0px";
|
|
11217
11398
|
_setSize(width, height);
|
|
@@ -11220,16 +11401,16 @@ class PlotBoilerplate {
|
|
|
11220
11401
|
// Set editor size
|
|
11221
11402
|
_self.canvas.style.position = "absolute";
|
|
11222
11403
|
const space = this.getAvailableContainerSpace();
|
|
11223
|
-
_self.canvas.style.width = _self.config.canvasWidthFactor * space.width + "px";
|
|
11224
|
-
_self.canvas.style.height = _self.config.canvasHeightFactor * space.height + "px";
|
|
11225
|
-
_self.canvas.style.top =
|
|
11226
|
-
_self.canvas.style.left =
|
|
11404
|
+
_self.canvas.style.width = ((_c = _self.config.canvasWidthFactor) !== null && _c !== void 0 ? _c : 1.0) * space.width + "px";
|
|
11405
|
+
_self.canvas.style.height = ((_d = _self.config.canvasHeightFactor) !== null && _d !== void 0 ? _d : 1.0) * space.height + "px";
|
|
11406
|
+
_self.canvas.style.top = "";
|
|
11407
|
+
_self.canvas.style.left = "";
|
|
11227
11408
|
_setSize(space.width, space.height);
|
|
11228
11409
|
}
|
|
11229
11410
|
else {
|
|
11230
|
-
_self.canvas.style.width =
|
|
11231
|
-
_self.canvas.style.height =
|
|
11232
|
-
_setSize(_self.config.defaultCanvasWidth, _self.config.defaultCanvasHeight);
|
|
11411
|
+
_self.canvas.style.width = "";
|
|
11412
|
+
_self.canvas.style.height = "";
|
|
11413
|
+
_setSize((_e = _self.config.defaultCanvasWidth) !== null && _e !== void 0 ? _e : 1024, (_f = _self.config.defaultCanvasHeight) !== null && _f !== void 0 ? _f : 768);
|
|
11233
11414
|
}
|
|
11234
11415
|
if (_self.config.redrawOnResize)
|
|
11235
11416
|
_self.redraw();
|