plotboilerplate 1.25.0 → 1.27.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.
Files changed (174) hide show
  1. package/README.md +3 -0
  2. package/dist/index.esm.js +171 -43
  3. package/dist/index.esm.js.map +1 -1
  4. package/dist/index.esm.min.js +1 -1
  5. package/dist/index.esm.min.js.map +1 -1
  6. package/dist/plotboilerplate.browser.min.js +1 -1
  7. package/dist/plotboilerplate.browser.min.js.map +1 -1
  8. package/dist/plotboilerplate.js +171 -43
  9. package/dist/plotboilerplate.min.js +1 -1
  10. package/package.json +6 -2
  11. package/src/cjs/Bounds.d.ts +79 -25
  12. package/src/cjs/Bounds.js +102 -29
  13. package/src/cjs/Bounds.js.map +1 -1
  14. package/src/cjs/CircleSector.d.ts +3 -0
  15. package/src/cjs/CircleSector.js +28 -1
  16. package/src/cjs/CircleSector.js.map +1 -1
  17. package/src/cjs/PlotBoilerplate.d.ts +4 -3
  18. package/src/cjs/PlotBoilerplate.js +2 -1
  19. package/src/cjs/PlotBoilerplate.js.map +1 -1
  20. package/src/cjs/draw.d.ts +4 -2
  21. package/src/cjs/draw.js +9 -4
  22. package/src/cjs/draw.js.map +1 -1
  23. package/src/cjs/drawgl.d.ts +3 -2
  24. package/src/cjs/drawgl.js +2 -1
  25. package/src/cjs/drawgl.js.map +1 -1
  26. package/src/cjs/drawutilssvg.d.ts +10 -4
  27. package/src/cjs/drawutilssvg.js +28 -7
  28. package/src/cjs/drawutilssvg.js.map +1 -1
  29. package/src/cjs/interfaces/DrawLib.d.ts +2 -0
  30. package/src/cjs/interfaces/DrawLib.js +1 -0
  31. package/src/cjs/interfaces/DrawLib.js.map +1 -1
  32. package/src/cjs/utils/LissajousFigure.d.ts +34 -0
  33. package/src/cjs/utils/LissajousFigure.js +100 -0
  34. package/src/cjs/utils/LissajousFigure.js.map +1 -0
  35. package/src/cjs/utils/PerlinNoise.d.ts +19 -0
  36. package/src/cjs/utils/PerlinNoise.js +352 -0
  37. package/src/cjs/utils/PerlinNoise.js.map +1 -0
  38. package/src/cjs/utils/SVGPathUtils.d.ts +22 -0
  39. package/src/cjs/utils/SVGPathUtils.js +45 -0
  40. package/src/cjs/utils/SVGPathUtils.js.map +1 -0
  41. package/src/cjs/utils/WebColors.d.ts +2 -1
  42. package/src/cjs/utils/WebColors.js +14 -25
  43. package/src/cjs/utils/WebColors.js.map +1 -1
  44. package/src/cjs/utils/algorithms/PolygonTesselationOutlines.d.ts +145 -0
  45. package/src/cjs/utils/algorithms/PolygonTesselationOutlines.js +269 -0
  46. package/src/cjs/utils/algorithms/PolygonTesselationOutlines.js.map +1 -0
  47. package/src/cjs/utils/algorithms/pixelCornersToRoundPaths.d.ts +23 -0
  48. package/src/cjs/utils/algorithms/pixelCornersToRoundPaths.js +270 -0
  49. package/src/cjs/utils/algorithms/pixelCornersToRoundPaths.js.map +1 -0
  50. package/src/cjs/utils/datastructures/Color.js +0 -19
  51. package/src/cjs/utils/datastructures/Color.js.map +1 -1
  52. package/src/cjs/utils/datastructures/ColorGradient.d.ts +2 -0
  53. package/src/cjs/utils/datastructures/ColorGradient.js +5 -0
  54. package/src/cjs/utils/datastructures/ColorGradient.js.map +1 -1
  55. package/src/cjs/utils/datastructures/DataGrid2d.d.ts +6 -0
  56. package/src/cjs/utils/datastructures/DataGrid2dArrayMatrix.d.ts +88 -0
  57. package/src/cjs/utils/datastructures/DataGrid2dArrayMatrix.js +155 -0
  58. package/src/cjs/utils/datastructures/DataGrid2dArrayMatrix.js.map +1 -0
  59. package/src/cjs/utils/datastructures/DataGrid2dListAdapter.d.ts +1 -7
  60. package/src/cjs/utils/datastructures/DataGrid2dListAdapter.js +3 -3
  61. package/src/cjs/utils/datastructures/DataGrid2dListAdapter.js.map +1 -1
  62. package/src/cjs/utils/datastructures/GeometryMesh.d.ts +49 -0
  63. package/src/cjs/utils/datastructures/GeometryMesh.js +58 -0
  64. package/src/cjs/utils/datastructures/GeometryMesh.js.map +1 -0
  65. package/src/cjs/utils/datastructures/Girih.d.ts +38 -1
  66. package/src/cjs/utils/datastructures/Girih.js +71 -1
  67. package/src/cjs/utils/datastructures/Girih.js.map +1 -1
  68. package/src/cjs/utils/detectDarkMode.js +16 -7
  69. package/src/cjs/utils/detectDarkMode.js.map +1 -1
  70. package/src/cjs/utils/dom/components/ColorGradientPicker.d.ts +4 -3
  71. package/src/cjs/utils/dom/components/ColorGradientPicker.js +8 -8
  72. package/src/cjs/utils/dom/components/ColorGradientPicker.js.map +1 -1
  73. package/src/cjs/utils/dom/components/ColorGradientSelector.d.ts +1 -0
  74. package/src/cjs/utils/dom/components/ColorGradientSelector.js +4 -2
  75. package/src/cjs/utils/dom/components/ColorGradientSelector.js.map +1 -1
  76. package/src/cjs/utils/io/FileDrop.d.ts +2 -0
  77. package/src/cjs/utils/io/FileDrop.js +4 -0
  78. package/src/cjs/utils/io/FileDrop.js.map +1 -1
  79. package/src/cjs/utils/parsers/svg/types.d.ts +8 -8
  80. package/src/esm/Bounds.d.ts +79 -25
  81. package/src/esm/Bounds.js +102 -29
  82. package/src/esm/Bounds.js.map +1 -1
  83. package/src/esm/CircleSector.d.ts +3 -0
  84. package/src/esm/CircleSector.js +28 -1
  85. package/src/esm/CircleSector.js.map +1 -1
  86. package/src/esm/PlotBoilerplate.d.ts +4 -3
  87. package/src/esm/PlotBoilerplate.js +2 -1
  88. package/src/esm/PlotBoilerplate.js.map +1 -1
  89. package/src/esm/draw.d.ts +4 -2
  90. package/src/esm/draw.js +9 -4
  91. package/src/esm/draw.js.map +1 -1
  92. package/src/esm/drawgl.d.ts +3 -2
  93. package/src/esm/drawgl.js +2 -1
  94. package/src/esm/drawgl.js.map +1 -1
  95. package/src/esm/drawutilssvg.d.ts +10 -4
  96. package/src/esm/drawutilssvg.js +28 -7
  97. package/src/esm/drawutilssvg.js.map +1 -1
  98. package/src/esm/interfaces/DrawLib.d.ts +2 -0
  99. package/src/esm/interfaces/DrawLib.js +1 -0
  100. package/src/esm/interfaces/DrawLib.js.map +1 -1
  101. package/src/esm/utils/LissajousFigure.d.ts +34 -0
  102. package/src/esm/utils/LissajousFigure.js +95 -0
  103. package/src/esm/utils/LissajousFigure.js.map +1 -0
  104. package/src/esm/utils/PerlinNoise.d.ts +19 -0
  105. package/src/esm/utils/PerlinNoise.js +346 -0
  106. package/src/esm/utils/PerlinNoise.js.map +1 -0
  107. package/src/esm/utils/SVGPathUtils.d.ts +22 -0
  108. package/src/esm/utils/SVGPathUtils.js +42 -0
  109. package/src/esm/utils/SVGPathUtils.js.map +1 -0
  110. package/src/esm/utils/WebColors.d.ts +2 -1
  111. package/src/esm/utils/WebColors.js +14 -25
  112. package/src/esm/utils/WebColors.js.map +1 -1
  113. package/src/esm/utils/algorithms/PolygonTesselationOutlines.d.ts +145 -0
  114. package/src/esm/utils/algorithms/PolygonTesselationOutlines.js +262 -0
  115. package/src/esm/utils/algorithms/PolygonTesselationOutlines.js.map +1 -0
  116. package/src/esm/utils/algorithms/pixelCornersToRoundPaths.d.ts +23 -0
  117. package/src/esm/utils/algorithms/pixelCornersToRoundPaths.js +266 -0
  118. package/src/esm/utils/algorithms/pixelCornersToRoundPaths.js.map +1 -0
  119. package/src/esm/utils/datastructures/Color.js +0 -19
  120. package/src/esm/utils/datastructures/Color.js.map +1 -1
  121. package/src/esm/utils/datastructures/ColorGradient.d.ts +2 -0
  122. package/src/esm/utils/datastructures/ColorGradient.js +5 -0
  123. package/src/esm/utils/datastructures/ColorGradient.js.map +1 -1
  124. package/src/esm/utils/datastructures/DataGrid2d.d.ts +6 -0
  125. package/src/esm/utils/datastructures/DataGrid2dArrayMatrix.d.ts +88 -0
  126. package/src/esm/utils/datastructures/DataGrid2dArrayMatrix.js +150 -0
  127. package/src/esm/utils/datastructures/DataGrid2dArrayMatrix.js.map +1 -0
  128. package/src/esm/utils/datastructures/DataGrid2dListAdapter.d.ts +1 -7
  129. package/src/esm/utils/datastructures/DataGrid2dListAdapter.js +3 -3
  130. package/src/esm/utils/datastructures/DataGrid2dListAdapter.js.map +1 -1
  131. package/src/esm/utils/datastructures/GeometryMesh.d.ts +49 -0
  132. package/src/esm/utils/datastructures/GeometryMesh.js +53 -0
  133. package/src/esm/utils/datastructures/GeometryMesh.js.map +1 -0
  134. package/src/esm/utils/datastructures/Girih.d.ts +38 -1
  135. package/src/esm/utils/datastructures/Girih.js +71 -1
  136. package/src/esm/utils/datastructures/Girih.js.map +1 -1
  137. package/src/esm/utils/detectDarkMode.js +16 -7
  138. package/src/esm/utils/detectDarkMode.js.map +1 -1
  139. package/src/esm/utils/dom/components/ColorGradientPicker.d.ts +4 -3
  140. package/src/esm/utils/dom/components/ColorGradientPicker.js +18 -7
  141. package/src/esm/utils/dom/components/ColorGradientPicker.js.map +1 -1
  142. package/src/esm/utils/dom/components/ColorGradientSelector.d.ts +1 -0
  143. package/src/esm/utils/dom/components/ColorGradientSelector.js +9 -2
  144. package/src/esm/utils/dom/components/ColorGradientSelector.js.map +1 -1
  145. package/src/esm/utils/io/FileDrop.d.ts +2 -0
  146. package/src/esm/utils/io/FileDrop.js +4 -0
  147. package/src/esm/utils/io/FileDrop.js.map +1 -1
  148. package/src/esm/utils/parsers/svg/types.d.ts +8 -8
  149. package/src/ts/Bounds.ts +107 -22
  150. package/src/ts/CircleSector.ts +39 -6
  151. package/src/ts/PlotBoilerplate.ts +4 -3
  152. package/src/ts/draw.ts +8 -3
  153. package/src/ts/drawgl.ts +3 -2
  154. package/src/ts/drawutilssvg.ts +34 -7
  155. package/src/ts/interfaces/DrawLib.ts +3 -0
  156. package/src/ts/utils/LissajousFigure.ts +110 -0
  157. package/src/ts/utils/PerlinNoise.ts +368 -0
  158. package/src/ts/utils/SVGPathUtils.ts +55 -0
  159. package/src/ts/utils/WebColors.ts +20 -33
  160. package/src/ts/utils/algorithms/PolygonTesselationOutlines.ts +296 -0
  161. package/src/ts/utils/algorithms/pixelCornersToRoundPaths.ts +379 -0
  162. package/src/ts/utils/datastructures/Color.ts +0 -19
  163. package/src/ts/utils/datastructures/ColorGradient.ts +6 -0
  164. package/src/ts/utils/datastructures/DataGrid2d.ts +7 -0
  165. package/src/ts/utils/datastructures/DataGrid2dArrayMatrix.ts +182 -0
  166. package/src/ts/utils/datastructures/DataGrid2dListAdapter.ts +4 -11
  167. package/src/ts/utils/datastructures/GeometryMesh.ts +79 -0
  168. package/src/ts/utils/datastructures/Girih.ts +78 -1
  169. package/src/ts/utils/datastructures/interfaces.ts +4 -4
  170. package/src/ts/utils/detectDarkMode.ts +17 -8
  171. package/src/ts/utils/dom/components/ColorGradientPicker.tsx +18 -6
  172. package/src/ts/utils/dom/components/ColorGradientSelector.tsx +9 -2
  173. package/src/ts/utils/io/FileDrop.ts +5 -0
  174. package/src/ts/utils/parsers/svg/types.ts +8 -8
package/README.md CHANGED
@@ -159,6 +159,8 @@ A full working demo repository about the [Usage with Typescript is here](https:/
159
159
 
160
160
  [Basic Setup in a Codepen.io demo](https://codepen.io/ikaroskappler/pen/ZEjamVb)
161
161
 
162
+ [Voronoi Diagram in a Codepen.io demo](https://codepen.io/ikaroskappler/pen/RNREmje)
163
+
162
164
  ### Screenshot
163
165
 
164
166
  ![Simple Demo](https://plotboilerplate.io/repo/screenshots/screenshot-20190220_3_simpledemo.png "The simple demo")
@@ -576,6 +578,7 @@ new MouseHandler(document.getElementById("mycanvas"))
576
578
  - [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
579
  - Thanks to Ana Tudor for the Multi-Range-Slider tutorial: https://css-tricks.com/multi-thumb-sliders-particular-two-thumb-case/
578
580
  - Thanks to Dean Taylor for the css linear gradient parser howto: https://stackoverflow.com/questions/20215440/parse-css-gradient-rule-with-javascript-regex
581
+ - 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
582
 
580
583
  ## Todos
581
584
 
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
- * @version 1.8.0
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
- * Get the center point of the west bound.
3637
- *
3638
- * @method getWestPoint
3639
- * @instance
3640
- * @memberof Bounds
3641
- * @return {Vertex} The "westhmost" centered point of this bounding box.
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
- * Get the center point of the east bound.
3649
- *
3650
- * @method getEastPoint
3651
- * @instance
3652
- * @memberof Bounds
3653
- * @return {Vertex} The "easthmost" centered point of this bounding box.
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
- * Compute the minimal bounding box for a given set of existing bounding boxes.
3770
- *
3771
- * An empty vertex array will return an empty bounding box located at (0,0).
3772
- *
3773
- * @static
3774
- * @method computeFromBoundsSet
3775
- * @memberof Bounds
3776
- * @param {Array<IBounds>} boundingBoxes - The set of existing bounding boxes to get the containing bounding box for.
3777
- * @return The minimal Bounds for the given bounds instances.
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,11 @@ 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
- * @version 1.6.10
6446
+ * @modified 2025-11-14 Fixing a bug in the CSS `mix-blend-mode` property handling (caused a runtime error).
6447
+ * @modified 2026-01-04 Adding `lineJoin` attribute to the methods' `StrokeOptions` param.
6448
+ * @modified 2026-01-04 Fixing missing `strokeOptions` param in the `drawutilssvg.polygon` method.
6449
+ * @modified 2026-03-18 Adding `isOpen` parameter to `cubicBezierPath` draw method.
6450
+ * @version 1.7.0
6347
6451
  **/
6348
6452
  const RAD_TO_DEG = 180 / Math.PI;
6349
6453
  /**
@@ -6541,8 +6645,13 @@ class drawutilssvg {
6541
6645
  node = this.createSVGNode(nodeName);
6542
6646
  }
6543
6647
  if (this.drawlibConfiguration.blendMode) {
6544
- // node.style["mix-blend-mode"] = this.drawlibConfiguration.blendMode;
6545
- node.style["mix-blend-mode"](this.drawlibConfiguration.blendMode);
6648
+ const blendMode = node.style["mix-blend-mode"];
6649
+ if (typeof blendMode === "function") {
6650
+ blendMode(this.drawlibConfiguration.blendMode);
6651
+ }
6652
+ else {
6653
+ node.style["mix-blend-mode"] = this.drawlibConfiguration.blendMode;
6654
+ }
6546
6655
  }
6547
6656
  // if (this.lineDashEnabled && this.lineDash && this.lineDash.length > 0 && drawutilssvg.nodeSupportsLineDash(nodeName)) {
6548
6657
  // node.setAttribute("stroke-dasharray", this.lineDash.join(" "));
@@ -6738,6 +6847,7 @@ class drawutilssvg {
6738
6847
  * @param {StrokeOptions=} strokeOptions -
6739
6848
  */
6740
6849
  applyStrokeOpts(node, strokeOptions) {
6850
+ // Set line dash options?
6741
6851
  if (strokeOptions &&
6742
6852
  strokeOptions.dashArray &&
6743
6853
  strokeOptions.dashArray.length > 0 &&
@@ -6751,6 +6861,10 @@ class drawutilssvg {
6751
6861
  node.setAttribute("stroke-dashoffset", `${strokeOptions.dashOffset * this.scale.x}`);
6752
6862
  }
6753
6863
  }
6864
+ // Set line join option?
6865
+ if (strokeOptions && strokeOptions.lineJoin && drawutilssvg.nodeSupportsLineJoin(node.tagName)) {
6866
+ node.setAttribute("stroke-linejoin", strokeOptions.lineJoin);
6867
+ }
6754
6868
  }
6755
6869
  _x(x) {
6756
6870
  return this.offset.x + this.scale.x * x;
@@ -7000,12 +7114,12 @@ class drawutilssvg {
7000
7114
  * @param {string} color - The CSS colot to draw the path with.
7001
7115
  * @param {number=1} lineWidth - (optional) The line width to use.
7002
7116
  * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
7003
- *
7117
+ * @param {boolean} isOpen - (optional) Set to tur if the path should not be closed.
7004
7118
  * @return {void}
7005
7119
  * @instance
7006
7120
  * @memberof drawutilssvg
7007
7121
  */
7008
- cubicBezierPath(path, color, lineWidth, strokeOptions) {
7122
+ cubicBezierPath(path, color, lineWidth, strokeOptions, isOpen) {
7009
7123
  const node = this.makeNode("path");
7010
7124
  this.applyStrokeOpts(node, strokeOptions);
7011
7125
  if (!path || path.length == 0) {
@@ -7023,6 +7137,9 @@ class drawutilssvg {
7023
7137
  endPoint = path[i + 2];
7024
7138
  d.push("C", this._x(startControlPoint.x), this._y(startControlPoint.y), this._x(endControlPoint.x), this._y(endControlPoint.y), this._x(endPoint.x), this._y(endPoint.y));
7025
7139
  }
7140
+ if (!isOpen) {
7141
+ d.push("Z");
7142
+ }
7026
7143
  node.setAttribute("d", d.join(" "));
7027
7144
  return this._bindFillDraw(node, "cubicBezierPath", color, lineWidth || 1);
7028
7145
  }
@@ -7459,12 +7576,13 @@ class drawutilssvg {
7459
7576
  * @param {Polygon} polygon - The polygon to draw.
7460
7577
  * @param {string} color - The CSS color to draw the polygon with.
7461
7578
  * @param {number=} lineWidth - (optional) The line width to use; default is 1.
7579
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
7462
7580
  * @return {void}
7463
7581
  * @instance
7464
7582
  * @memberof drawutilssvg
7465
7583
  */
7466
- polygon(polygon, color, lineWidth) {
7467
- return this.polyline(polygon.vertices, polygon.isOpen, color, lineWidth);
7584
+ polygon(polygon, color, lineWidth, strokeOptions) {
7585
+ return this.polyline(polygon.vertices, polygon.isOpen, color, lineWidth, strokeOptions);
7468
7586
  }
7469
7587
  /**
7470
7588
  * Draw a polygon line (alternative function to the polygon).
@@ -7842,6 +7960,9 @@ class drawutilssvg {
7842
7960
  static nodeSupportsLineDash(nodeName) {
7843
7961
  return ["line", "path", "circle", "ellipse", "rectangle", "rect"].includes(nodeName);
7844
7962
  }
7963
+ static nodeSupportsLineJoin(nodeName) {
7964
+ return ["line", "path", "circle", "ellipse", "rectangle", "rect"].includes(nodeName);
7965
+ }
7845
7966
  /**
7846
7967
  * Creates a basic <line> node with start and end coordinates. The created node will not
7847
7968
  * be bound to any root node.
@@ -8026,7 +8147,9 @@ drawutilssvg.HEAD_XML = [
8026
8147
  * @modified 2023-09-30 Adding `strokeOptions` param to these draw function: line, arrow, cubicBezierArrow, cubicBezier, cubicBezierPath, circle, circleArc, ellipse, square, rect, polygon, polyline.
8027
8148
  * @modified 2023-10-07 Adding the optional `arrowHeadBasePositionBuffer` param to the arrowHead(...) method.
8028
8149
  * @modified 2024-09-13 Remoed the scaling of `lineWidth` in the `polygon` and `polyline` methods. This makes no sense here and doesn't match up with the behavior of other line functions.
8029
- * @version 1.13.0
8150
+ * @modified 2026-01-04 Adding `lineJoin` attribute to the `StrokeOptions`.
8151
+ * @modified 2026-03-18 Adding `isOpen` parameter to `cubicBezierPath` draw method.
8152
+ * @version 1.14.0
8030
8153
  **/
8031
8154
  // Todo: rename this class to Drawutils?
8032
8155
  /**
@@ -8059,13 +8182,14 @@ class drawutils {
8059
8182
  * @param {StrokeOptions=} strokeOptions -
8060
8183
  */
8061
8184
  applyStrokeOpts(strokeOptions) {
8062
- var _a, _b;
8185
+ var _a, _b, _c;
8063
8186
  this.ctx.setLineDash(((_a = strokeOptions === null || strokeOptions === void 0 ? void 0 : strokeOptions.dashArray) !== null && _a !== void 0 ? _a : []).map((dashArrayElem) => {
8064
8187
  // Note assume scale.x === scale.y
8065
8188
  // Invariant scale makes funny stuff anyway.
8066
8189
  return dashArrayElem * this.scale.x;
8067
8190
  }));
8068
8191
  this.ctx.lineDashOffset = ((_b = strokeOptions === null || strokeOptions === void 0 ? void 0 : strokeOptions.dashOffset) !== null && _b !== void 0 ? _b : 0) * this.scale.x;
8192
+ this.ctx.lineJoin = (_c = strokeOptions === null || strokeOptions === void 0 ? void 0 : strokeOptions.lineJoin) !== null && _c !== void 0 ? _c : null;
8069
8193
  }
8070
8194
  // +---------------------------------------------------------------------------------
8071
8195
  // | This is the final helper function for drawing and filling stuff. It is not
@@ -8511,7 +8635,7 @@ class drawutils {
8511
8635
  * @instance
8512
8636
  * @memberof drawutils
8513
8637
  */
8514
- cubicBezierPath(path, color, lineWidth, strokeOptions) {
8638
+ cubicBezierPath(path, color, lineWidth, strokeOptions, isOpen) {
8515
8639
  if (!path || path.length == 0) {
8516
8640
  return;
8517
8641
  }
@@ -8529,7 +8653,9 @@ class drawutils {
8529
8653
  endPoint = path[i + 2];
8530
8654
  this.ctx.bezierCurveTo(this.offset.x + startControlPoint.x * this.scale.x, this.offset.y + startControlPoint.y * this.scale.y, this.offset.x + endControlPoint.x * this.scale.x, this.offset.y + endControlPoint.y * this.scale.y, this.offset.x + endPoint.x * this.scale.x, this.offset.y + endPoint.y * this.scale.y);
8531
8655
  }
8532
- this.ctx.closePath();
8656
+ if (!isOpen) {
8657
+ this.ctx.closePath();
8658
+ }
8533
8659
  this.ctx.lineWidth = lineWidth || 1;
8534
8660
  this._fillOrDraw(color);
8535
8661
  this.ctx.restore();
@@ -9131,6 +9257,7 @@ drawutils.helpers = {
9131
9257
  * @modified 2023-09-29 Added the `arrowHead(...)` function to the 'DrawLib.arrow()` interface.
9132
9258
  * @modified 2023-09-29 Added the `cubicBezierArrow(...)` function to the 'DrawLib.arrow()` interface.
9133
9259
  * @modified 2023-09-29 Added the `lineDashes` attribute.
9260
+ * @modified 2026-03-18 Adding `isOpen` parameter to `cubicBezierPath` draw method.
9134
9261
  * @version 0.0.10
9135
9262
  **/
9136
9263
  /**
@@ -9443,7 +9570,7 @@ class drawutilsgl {
9443
9570
  * @instance
9444
9571
  * @memberof drawutils
9445
9572
  */
9446
- cubicBezierPath(path, color, lineWidth) {
9573
+ cubicBezierPath(path, color, lineWidth, strokeOptions, isOpen) {
9447
9574
  // NOT YET IMPLEMENTED
9448
9575
  }
9449
9576
  /**
@@ -12389,8 +12516,9 @@ VEllipseSector.ellipseSectorUtils = {
12389
12516
  * @modified 2025-05-07 Added `PlogBoilerplate.addContentChangeListener` and `.removeContentChangeListener`.
12390
12517
  * @modified 2025-05-07 Moving full vectors now by default when vector point a is moved.
12391
12518
  * @modified 2025-05-20 Applying `lineWith` parameter in the draw routine for vectors (had been missing).
12519
+ * @modified 2026-03-13 Changed visibility of `setZoom` and `setOffset` to public. There was no good reason to have the private.
12392
12520
  *
12393
- * @version 1.21.1
12521
+ * @version 1.21.2
12394
12522
  *
12395
12523
  * @file PlotBoilerplate
12396
12524
  * @fileoverview The main class.