plotboilerplate 1.25.0 → 1.26.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 -0
- package/dist/index.esm.js +139 -33
- 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 +139 -33
- package/dist/plotboilerplate.min.js +1 -1
- package/package.json +1 -1
- package/src/cjs/Bounds.d.ts +79 -25
- package/src/cjs/Bounds.js +102 -29
- package/src/cjs/Bounds.js.map +1 -1
- package/src/cjs/CircleSector.d.ts +3 -0
- package/src/cjs/CircleSector.js +28 -1
- package/src/cjs/CircleSector.js.map +1 -1
- package/src/cjs/drawutilssvg.d.ts +2 -1
- package/src/cjs/drawutilssvg.js +9 -3
- package/src/cjs/drawutilssvg.js.map +1 -1
- package/src/cjs/utils/LissajousFigure.d.ts +34 -0
- package/src/cjs/utils/LissajousFigure.js +100 -0
- package/src/cjs/utils/LissajousFigure.js.map +1 -0
- package/src/cjs/utils/PerlinNoise.d.ts +19 -0
- package/src/cjs/utils/PerlinNoise.js +352 -0
- package/src/cjs/utils/PerlinNoise.js.map +1 -0
- package/src/cjs/utils/SVGPathUtils.d.ts +22 -0
- package/src/cjs/utils/SVGPathUtils.js +45 -0
- package/src/cjs/utils/SVGPathUtils.js.map +1 -0
- package/src/cjs/utils/algorithms/pixelCornersToRoundPaths.d.ts +23 -0
- package/src/cjs/utils/algorithms/pixelCornersToRoundPaths.js +270 -0
- package/src/cjs/utils/algorithms/pixelCornersToRoundPaths.js.map +1 -0
- package/src/cjs/utils/datastructures/DataGrid2d.d.ts +6 -0
- package/src/cjs/utils/datastructures/DataGrid2dArrayMatrix.d.ts +88 -0
- package/src/cjs/utils/datastructures/DataGrid2dArrayMatrix.js +155 -0
- package/src/cjs/utils/datastructures/DataGrid2dArrayMatrix.js.map +1 -0
- package/src/cjs/utils/datastructures/DataGrid2dListAdapter.d.ts +1 -7
- package/src/cjs/utils/datastructures/DataGrid2dListAdapter.js +3 -3
- package/src/cjs/utils/datastructures/DataGrid2dListAdapter.js.map +1 -1
- package/src/cjs/utils/datastructures/GeometryMesh.d.ts +49 -0
- package/src/cjs/utils/datastructures/GeometryMesh.js +58 -0
- package/src/cjs/utils/datastructures/GeometryMesh.js.map +1 -0
- package/src/cjs/utils/detectDarkMode.js +16 -7
- package/src/cjs/utils/detectDarkMode.js.map +1 -1
- package/src/cjs/utils/dom/components/ColorGradientPicker.d.ts +4 -3
- package/src/cjs/utils/dom/components/ColorGradientPicker.js +8 -8
- package/src/cjs/utils/dom/components/ColorGradientPicker.js.map +1 -1
- package/src/cjs/utils/dom/components/ColorGradientSelector.d.ts +1 -0
- package/src/cjs/utils/dom/components/ColorGradientSelector.js +4 -2
- package/src/cjs/utils/dom/components/ColorGradientSelector.js.map +1 -1
- package/src/cjs/utils/parsers/svg/types.d.ts +8 -8
- package/src/esm/Bounds.d.ts +79 -25
- package/src/esm/Bounds.js +102 -29
- package/src/esm/Bounds.js.map +1 -1
- package/src/esm/CircleSector.d.ts +3 -0
- package/src/esm/CircleSector.js +28 -1
- package/src/esm/CircleSector.js.map +1 -1
- package/src/esm/drawutilssvg.d.ts +2 -1
- package/src/esm/drawutilssvg.js +9 -3
- package/src/esm/drawutilssvg.js.map +1 -1
- package/src/esm/utils/LissajousFigure.d.ts +34 -0
- package/src/esm/utils/LissajousFigure.js +95 -0
- package/src/esm/utils/LissajousFigure.js.map +1 -0
- package/src/esm/utils/PerlinNoise.d.ts +19 -0
- package/src/esm/utils/PerlinNoise.js +346 -0
- package/src/esm/utils/PerlinNoise.js.map +1 -0
- package/src/esm/utils/SVGPathUtils.d.ts +22 -0
- package/src/esm/utils/SVGPathUtils.js +42 -0
- package/src/esm/utils/SVGPathUtils.js.map +1 -0
- package/src/esm/utils/algorithms/pixelCornersToRoundPaths.d.ts +23 -0
- package/src/esm/utils/algorithms/pixelCornersToRoundPaths.js +266 -0
- package/src/esm/utils/algorithms/pixelCornersToRoundPaths.js.map +1 -0
- package/src/esm/utils/datastructures/DataGrid2d.d.ts +6 -0
- package/src/esm/utils/datastructures/DataGrid2dArrayMatrix.d.ts +88 -0
- package/src/esm/utils/datastructures/DataGrid2dArrayMatrix.js +150 -0
- package/src/esm/utils/datastructures/DataGrid2dArrayMatrix.js.map +1 -0
- package/src/esm/utils/datastructures/DataGrid2dListAdapter.d.ts +1 -7
- package/src/esm/utils/datastructures/DataGrid2dListAdapter.js +3 -3
- package/src/esm/utils/datastructures/DataGrid2dListAdapter.js.map +1 -1
- package/src/esm/utils/datastructures/GeometryMesh.d.ts +49 -0
- package/src/esm/utils/datastructures/GeometryMesh.js +53 -0
- package/src/esm/utils/datastructures/GeometryMesh.js.map +1 -0
- package/src/esm/utils/detectDarkMode.js +16 -7
- package/src/esm/utils/detectDarkMode.js.map +1 -1
- package/src/esm/utils/dom/components/ColorGradientPicker.d.ts +4 -3
- package/src/esm/utils/dom/components/ColorGradientPicker.js +18 -7
- package/src/esm/utils/dom/components/ColorGradientPicker.js.map +1 -1
- package/src/esm/utils/dom/components/ColorGradientSelector.d.ts +1 -0
- package/src/esm/utils/dom/components/ColorGradientSelector.js +9 -2
- package/src/esm/utils/dom/components/ColorGradientSelector.js.map +1 -1
- package/src/esm/utils/parsers/svg/types.d.ts +8 -8
- package/src/ts/Bounds.ts +107 -22
- package/src/ts/CircleSector.ts +39 -6
- package/src/ts/drawutilssvg.ts +8 -3
- package/src/ts/utils/LissajousFigure.ts +110 -0
- package/src/ts/utils/PerlinNoise.ts +368 -0
- package/src/ts/utils/SVGPathUtils.ts +55 -0
- package/src/ts/utils/algorithms/pixelCornersToRoundPaths.ts +379 -0
- package/src/ts/utils/datastructures/DataGrid2d.ts +7 -0
- package/src/ts/utils/datastructures/DataGrid2dArrayMatrix.ts +182 -0
- package/src/ts/utils/datastructures/DataGrid2dListAdapter.ts +4 -11
- package/src/ts/utils/datastructures/GeometryMesh.ts +79 -0
- package/src/ts/utils/detectDarkMode.ts +17 -8
- package/src/ts/utils/dom/components/ColorGradientPicker.tsx +18 -6
- package/src/ts/utils/dom/components/ColorGradientSelector.tsx +9 -2
- package/src/ts/utils/parsers/svg/types.ts +8 -8
package/README.md
CHANGED
|
@@ -576,6 +576,7 @@ new MouseHandler(document.getElementById("mycanvas"))
|
|
|
576
576
|
- [Cuixiping](https://stackoverflow.com/users/988089/cuixiping) for the helpful insights on cubic Bézier bounds at [Stackoverflow](https://stackoverflow.com/questions/24809978/calculating-the-bounding-box-of-cubic-bezier-curve)
|
|
577
577
|
- Thanks to Ana Tudor for the Multi-Range-Slider tutorial: https://css-tricks.com/multi-thumb-sliders-particular-two-thumb-case/
|
|
578
578
|
- Thanks to Dean Taylor for the css linear gradient parser howto: https://stackoverflow.com/questions/20215440/parse-css-gradient-rule-with-javascript-regex
|
|
579
|
+
- Thanks to Stefan Gustavson (stegu@itn.liu.se) for the Perlin noise on example C code (https://github.com/MethanePowered/PerlinNoise). And for Peter Eastman (peastman@drizzle.stanford.edu) for Perlin noise optimizations.
|
|
579
580
|
|
|
580
581
|
## Todos
|
|
581
582
|
|
package/dist/index.esm.js
CHANGED
|
@@ -3584,7 +3584,11 @@ Polygon.utils = {
|
|
|
3584
3584
|
* @modified 2025-04-18 Change parameter type in `Bounds.computeFromVertices` from `Vertex` to more general `XYCoords`.
|
|
3585
3585
|
* @modified 2025-04-19 Added methods to `Bounds` class: `getNorthPoint`, `getSouthPoint`, `getEastPoint` and `getWestPoint`.
|
|
3586
3586
|
* @modified 2025-04-26 Added static method `Bounds.computeFromBoundsSet` to calculate containing bounds for a set of bounding boxes.
|
|
3587
|
-
* @
|
|
3587
|
+
* @modified 2025-10-17 Added the methods `Bounds.getSouthWestPoint`, `getNorthWestPoint`, `getNorthEastPoint` and `getSouthEastPoint`.
|
|
3588
|
+
* @modified 2025-10-18 Added method `Bounds.containsVert(XYCoords)`.
|
|
3589
|
+
* @modified 2025-10-28 Added the `Bounds.getWidth()` and `Bounds.getHeight()`.
|
|
3590
|
+
* @modified 2025-11-12 Added the `Bounds.getMoved()` method.
|
|
3591
|
+
* @version 1.11.0
|
|
3588
3592
|
**/
|
|
3589
3593
|
/**
|
|
3590
3594
|
* @classdesc A bounds class with min and max values. Implementing IBounds.
|
|
@@ -3608,6 +3612,35 @@ class Bounds {
|
|
|
3608
3612
|
this.width = max.x - min.x;
|
|
3609
3613
|
this.height = max.y - min.y;
|
|
3610
3614
|
}
|
|
3615
|
+
/**
|
|
3616
|
+
* Check if the given vertex is inside this bounds.
|
|
3617
|
+
*
|
|
3618
|
+
* @method containsVert
|
|
3619
|
+
* @param {XYCoords} vert - The vertex to check.
|
|
3620
|
+
* @return {boolean} True if the passed vertex is inside this bounds.
|
|
3621
|
+
* @instance
|
|
3622
|
+
* @memberof Bounds
|
|
3623
|
+
**/
|
|
3624
|
+
containsVert(vert) {
|
|
3625
|
+
return this.min.x <= vert.x && vert.x < this.max.x && this.min.y <= vert.y && vert.y < this.max.y;
|
|
3626
|
+
}
|
|
3627
|
+
getWidth() {
|
|
3628
|
+
return this.max.x - this.min.x;
|
|
3629
|
+
}
|
|
3630
|
+
getHeight() {
|
|
3631
|
+
return this.max.y - this.min.y;
|
|
3632
|
+
}
|
|
3633
|
+
getScaled(scaleFactor) {
|
|
3634
|
+
const center = this.getCenter();
|
|
3635
|
+
const newMin = new Vertex(this.min).scale(scaleFactor, center);
|
|
3636
|
+
const newMax = new Vertex(this.max).scale(scaleFactor, center);
|
|
3637
|
+
return new Bounds(newMin, newMax);
|
|
3638
|
+
}
|
|
3639
|
+
getMoved(moveAmount) {
|
|
3640
|
+
const newMin = new Vertex(this.min).move(moveAmount);
|
|
3641
|
+
const newMax = new Vertex(this.max).move(moveAmount);
|
|
3642
|
+
return new Bounds(newMin, newMax);
|
|
3643
|
+
}
|
|
3611
3644
|
/**
|
|
3612
3645
|
* Get the center point of the north bound.
|
|
3613
3646
|
*
|
|
@@ -3619,7 +3652,6 @@ class Bounds {
|
|
|
3619
3652
|
getNorthPoint() {
|
|
3620
3653
|
return new Vertex(this.min.x + this.width / 2.0, this.min.y);
|
|
3621
3654
|
}
|
|
3622
|
-
;
|
|
3623
3655
|
/**
|
|
3624
3656
|
* Get the center point of the south bound.
|
|
3625
3657
|
*
|
|
@@ -3631,31 +3663,72 @@ class Bounds {
|
|
|
3631
3663
|
getSouthPoint() {
|
|
3632
3664
|
return new Vertex(this.min.x + this.width / 2.0, this.max.y);
|
|
3633
3665
|
}
|
|
3634
|
-
;
|
|
3635
3666
|
/**
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3667
|
+
* Get the center point of the west bound.
|
|
3668
|
+
*
|
|
3669
|
+
* @method getWestPoint
|
|
3670
|
+
* @instance
|
|
3671
|
+
* @memberof Bounds
|
|
3672
|
+
* @return {Vertex} The "westhmost" centered point of this bounding box.
|
|
3673
|
+
*/
|
|
3643
3674
|
getWestPoint() {
|
|
3644
3675
|
return new Vertex(this.min.x, this.min.y + this.height / 2.0);
|
|
3645
3676
|
}
|
|
3646
|
-
;
|
|
3647
3677
|
/**
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3678
|
+
* Get the center point of the east bound.
|
|
3679
|
+
*
|
|
3680
|
+
* @method getEastPoint
|
|
3681
|
+
* @instance
|
|
3682
|
+
* @memberof Bounds
|
|
3683
|
+
* @return {Vertex} The "easthmost" centered point of this bounding box.
|
|
3684
|
+
*/
|
|
3655
3685
|
getEastPoint() {
|
|
3656
3686
|
return new Vertex(this.max.x, this.min.y + this.height / 2.0);
|
|
3657
3687
|
}
|
|
3658
|
-
|
|
3688
|
+
/**
|
|
3689
|
+
* Get the upper left corner point these bounds box.
|
|
3690
|
+
*
|
|
3691
|
+
* @method getNorthWestPoint
|
|
3692
|
+
* @instance
|
|
3693
|
+
* @memberof Bounds
|
|
3694
|
+
* @return {Vertex} The "northwestmost" point of this bounding box.
|
|
3695
|
+
*/
|
|
3696
|
+
getNorthWestPoint() {
|
|
3697
|
+
return new Vertex(this.min.x, this.min.y);
|
|
3698
|
+
}
|
|
3699
|
+
/**
|
|
3700
|
+
* Get the upper right corner point these bounds box.
|
|
3701
|
+
*
|
|
3702
|
+
* @method getNorthEastPoint
|
|
3703
|
+
* @instance
|
|
3704
|
+
* @memberof Bounds
|
|
3705
|
+
* @return {Vertex} The "northeastmost" point of this bounding box.
|
|
3706
|
+
*/
|
|
3707
|
+
getNorthEastPoint() {
|
|
3708
|
+
return new Vertex(this.max.x, this.min.y);
|
|
3709
|
+
}
|
|
3710
|
+
/**
|
|
3711
|
+
* Get the lower right corner point these bounds box.
|
|
3712
|
+
*
|
|
3713
|
+
* @method getSouthEastPoint
|
|
3714
|
+
* @instance
|
|
3715
|
+
* @memberof Bounds
|
|
3716
|
+
* @return {Vertex} The "southeastmost" point of this bounding box.
|
|
3717
|
+
*/
|
|
3718
|
+
getSouthEastPoint() {
|
|
3719
|
+
return new Vertex(this.max.x, this.max.y);
|
|
3720
|
+
}
|
|
3721
|
+
/**
|
|
3722
|
+
* Get the lower left corner point these bounds box.
|
|
3723
|
+
*
|
|
3724
|
+
* @method getSouthWestPoint
|
|
3725
|
+
* @instance
|
|
3726
|
+
* @memberof Bounds
|
|
3727
|
+
* @return {Vertex} The "southwestmost" point of this bounding box.
|
|
3728
|
+
*/
|
|
3729
|
+
getSouthWestPoint() {
|
|
3730
|
+
return new Vertex(this.min.x, this.max.y);
|
|
3731
|
+
}
|
|
3659
3732
|
/**
|
|
3660
3733
|
* Convert this rectangular bounding box to a polygon with four vertices.
|
|
3661
3734
|
*
|
|
@@ -3766,16 +3839,16 @@ class Bounds {
|
|
|
3766
3839
|
return new Bounds(new Vertex(xMin, yMin), new Vertex(xMax, yMax));
|
|
3767
3840
|
}
|
|
3768
3841
|
/**
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3842
|
+
* Compute the minimal bounding box for a given set of existing bounding boxes.
|
|
3843
|
+
*
|
|
3844
|
+
* An empty vertex array will return an empty bounding box located at (0,0).
|
|
3845
|
+
*
|
|
3846
|
+
* @static
|
|
3847
|
+
* @method computeFromBoundsSet
|
|
3848
|
+
* @memberof Bounds
|
|
3849
|
+
* @param {Array<IBounds>} boundingBoxes - The set of existing bounding boxes to get the containing bounding box for.
|
|
3850
|
+
* @return The minimal Bounds for the given bounds instances.
|
|
3851
|
+
**/
|
|
3779
3852
|
static computeFromBoundsSet(boundingBoxes) {
|
|
3780
3853
|
if (boundingBoxes.length == 0) {
|
|
3781
3854
|
return new Bounds(new Vertex(0, 0), new Vertex(0, 0));
|
|
@@ -6223,6 +6296,32 @@ class CircleSector {
|
|
|
6223
6296
|
});
|
|
6224
6297
|
}
|
|
6225
6298
|
//--- END --- Implement interface `Intersectable`
|
|
6299
|
+
describeSVGPath(options) {
|
|
6300
|
+
// const buffer: SVGPathParams = [];
|
|
6301
|
+
// const start = this.getStartPoint();
|
|
6302
|
+
// const end = this.getEndPoint();
|
|
6303
|
+
// // describeSVGArc
|
|
6304
|
+
// // x: number,
|
|
6305
|
+
// // y: number,
|
|
6306
|
+
// // radius: number,
|
|
6307
|
+
// // startAngle: number,
|
|
6308
|
+
// // endAngle: number,
|
|
6309
|
+
// // options?: { moveToStart: boolean }
|
|
6310
|
+
// // ): SVGPathParams => {
|
|
6311
|
+
// var arcRotation = 0.0;
|
|
6312
|
+
// var largeArcFlag = 1;
|
|
6313
|
+
// var sweepFlag = 0;
|
|
6314
|
+
// if (options && options.moveToStart) {
|
|
6315
|
+
// buffer.push("M", start.x, start.y);
|
|
6316
|
+
// }
|
|
6317
|
+
// buffer.push("A", cSector.circle.radius, cSector.circle.radius, arcRotation, largeArcFlag, sweepFlag, end.x, end.y);
|
|
6318
|
+
// return buffer;
|
|
6319
|
+
const arc = CircleSector.circleSectorUtils.describeSVGArc(this.circle.center.x, // end.x,
|
|
6320
|
+
this.circle.center.y, // end.y,
|
|
6321
|
+
this.circle.radius, this.startAngle, this.endAngle, options // options?: { moveToStart: boolean }
|
|
6322
|
+
);
|
|
6323
|
+
return arc;
|
|
6324
|
+
}
|
|
6226
6325
|
/**
|
|
6227
6326
|
* This function should invalidate any installed listeners and invalidate this object.
|
|
6228
6327
|
* After calling this function the object might not hold valid data any more and
|
|
@@ -6262,8 +6361,9 @@ CircleSector.circleSectorUtils = {
|
|
|
6262
6361
|
* @return [ 'A', radiusx, radiusy, rotation=0, largeArcFlag=1|0, sweepFlag=0, endx, endy ]
|
|
6263
6362
|
*/
|
|
6264
6363
|
describeSVGArc: (x, y, radius, startAngle, endAngle, options) => {
|
|
6265
|
-
if (typeof options === "undefined")
|
|
6364
|
+
if (typeof options === "undefined") {
|
|
6266
6365
|
options = { moveToStart: true };
|
|
6366
|
+
}
|
|
6267
6367
|
const end = CircleSector.circleSectorUtils.polarToCartesian(x, y, radius, endAngle);
|
|
6268
6368
|
const start = CircleSector.circleSectorUtils.polarToCartesian(x, y, radius, startAngle);
|
|
6269
6369
|
// Split full circles into two halves.
|
|
@@ -6343,7 +6443,8 @@ CircleSector.circleSectorUtils = {
|
|
|
6343
6443
|
* @modified 2024-01-30 Fixing an issue with immutable style sets; changes to the global draw config did not reflect here (do now).
|
|
6344
6444
|
* @modified 2024-03-10 Fixing some types for Typescript 5 compatibility.
|
|
6345
6445
|
* @modified 2024-07-24 Caching custom style defs in a private buffer variable.
|
|
6346
|
-
* @
|
|
6446
|
+
* @modified 2025-11-14 Fixing a bug in the CSS `mix-blend-mode` property handling (caused a runtime error).
|
|
6447
|
+
* @version 1.6.11
|
|
6347
6448
|
**/
|
|
6348
6449
|
const RAD_TO_DEG = 180 / Math.PI;
|
|
6349
6450
|
/**
|
|
@@ -6541,8 +6642,13 @@ class drawutilssvg {
|
|
|
6541
6642
|
node = this.createSVGNode(nodeName);
|
|
6542
6643
|
}
|
|
6543
6644
|
if (this.drawlibConfiguration.blendMode) {
|
|
6544
|
-
|
|
6545
|
-
|
|
6645
|
+
const blendMode = node.style["mix-blend-mode"];
|
|
6646
|
+
if (typeof blendMode === "function") {
|
|
6647
|
+
blendMode(this.drawlibConfiguration.blendMode);
|
|
6648
|
+
}
|
|
6649
|
+
else {
|
|
6650
|
+
node.style["mix-blend-mode"] = this.drawlibConfiguration.blendMode;
|
|
6651
|
+
}
|
|
6546
6652
|
}
|
|
6547
6653
|
// if (this.lineDashEnabled && this.lineDash && this.lineDash.length > 0 && drawutilssvg.nodeSupportsLineDash(nodeName)) {
|
|
6548
6654
|
// node.setAttribute("stroke-dasharray", this.lineDash.join(" "));
|