plotboilerplate 1.27.1 → 1.28.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 (1098) hide show
  1. package/dist/index.esm.js +135 -36
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/index.esm.min.js +1 -1
  4. package/dist/index.esm.min.js.map +1 -1
  5. package/dist/plotboilerplate.browser.min.js +1 -1
  6. package/dist/plotboilerplate.browser.min.js.map +1 -1
  7. package/dist/plotboilerplate.js +96 -17
  8. package/dist/plotboilerplate.min.js +1 -1
  9. package/package.json +2 -1
  10. package/src/_cjs/BezierPath.d.ts +610 -0
  11. package/src/_cjs/BezierPath.js +1127 -0
  12. package/src/_cjs/BezierPath.js.map +1 -0
  13. package/src/_cjs/Bounds.d.ts +252 -0
  14. package/src/_cjs/Bounds.js +320 -0
  15. package/src/_cjs/Bounds.js.map +1 -0
  16. package/src/_cjs/Circle.d.ts +214 -0
  17. package/src/_cjs/Circle.js +339 -0
  18. package/src/_cjs/Circle.js.map +1 -0
  19. package/src/_cjs/CircleSector.d.ts +211 -0
  20. package/src/_cjs/CircleSector.js +364 -0
  21. package/src/_cjs/CircleSector.js.map +1 -0
  22. package/src/_cjs/CubicBezierCurve.d.ts +656 -0
  23. package/src/_cjs/CubicBezierCurve.js +1062 -0
  24. package/src/_cjs/CubicBezierCurve.js.map +1 -0
  25. package/src/_cjs/Grid.d.ts +83 -0
  26. package/src/_cjs/Grid.js +90 -0
  27. package/src/_cjs/Grid.js.map +1 -0
  28. package/src/_cjs/KeyHandler.d.ts +177 -0
  29. package/src/_cjs/KeyHandler.js +435 -0
  30. package/src/_cjs/KeyHandler.js.map +1 -0
  31. package/src/_cjs/Line.d.ts +134 -0
  32. package/src/_cjs/Line.js +220 -0
  33. package/src/_cjs/Line.js.map +1 -0
  34. package/src/_cjs/MouseHandler.d.ts +283 -0
  35. package/src/_cjs/MouseHandler.js +423 -0
  36. package/src/_cjs/MouseHandler.js.map +1 -0
  37. package/src/_cjs/PBImage.d.ts +81 -0
  38. package/src/_cjs/PBImage.js +61 -0
  39. package/src/_cjs/PBImage.js.map +1 -0
  40. package/src/_cjs/PBText.d.ts +118 -0
  41. package/src/_cjs/PBText.js +63 -0
  42. package/src/_cjs/PBText.js.map +1 -0
  43. package/src/_cjs/PlotBoilerplate.d.ts +899 -0
  44. package/src/_cjs/PlotBoilerplate.js +2348 -0
  45. package/src/_cjs/PlotBoilerplate.js.map +1 -0
  46. package/src/_cjs/Polygon.d.ts +520 -0
  47. package/src/_cjs/Polygon.js +933 -0
  48. package/src/_cjs/Polygon.js.map +1 -0
  49. package/src/_cjs/SVGBuilder.d.ts +47 -0
  50. package/src/_cjs/SVGBuilder.js +100 -0
  51. package/src/_cjs/SVGBuilder.js.map +1 -0
  52. package/src/_cjs/Triangle.d.ts +392 -0
  53. package/src/_cjs/Triangle.js +497 -0
  54. package/src/_cjs/Triangle.js.map +1 -0
  55. package/src/_cjs/UIDGenerator.d.ts +12 -0
  56. package/src/_cjs/UIDGenerator.js +21 -0
  57. package/src/_cjs/UIDGenerator.js.map +1 -0
  58. package/src/_cjs/VEllipse.d.ts +319 -0
  59. package/src/_cjs/VEllipse.js +578 -0
  60. package/src/_cjs/VEllipse.js.map +1 -0
  61. package/src/_cjs/VEllipseSector.d.ts +230 -0
  62. package/src/_cjs/VEllipseSector.js +428 -0
  63. package/src/_cjs/VEllipseSector.js.map +1 -0
  64. package/src/_cjs/Vector.d.ts +126 -0
  65. package/src/_cjs/Vector.js +199 -0
  66. package/src/_cjs/Vector.js.map +1 -0
  67. package/src/_cjs/VertTuple.d.ts +284 -0
  68. package/src/_cjs/VertTuple.js +348 -0
  69. package/src/_cjs/VertTuple.js.map +1 -0
  70. package/src/_cjs/Vertex.d.ts +498 -0
  71. package/src/_cjs/Vertex.js +703 -0
  72. package/src/_cjs/Vertex.js.map +1 -0
  73. package/src/_cjs/VertexAttr.d.ts +72 -0
  74. package/src/_cjs/VertexAttr.js +59 -0
  75. package/src/_cjs/VertexAttr.js.map +1 -0
  76. package/src/_cjs/VertexListeners.d.ts +208 -0
  77. package/src/_cjs/VertexListeners.js +267 -0
  78. package/src/_cjs/VertexListeners.js.map +1 -0
  79. package/src/_cjs/draw.d.ts +657 -0
  80. package/src/_cjs/draw.js +1164 -0
  81. package/src/_cjs/draw.js.map +1 -0
  82. package/src/_cjs/drawgl.d.ts +544 -0
  83. package/src/_cjs/drawgl.js +794 -0
  84. package/src/_cjs/drawgl.js.map +1 -0
  85. package/src/_cjs/drawutilssvg.d.ts +954 -0
  86. package/src/_cjs/drawutilssvg.js +1713 -0
  87. package/src/_cjs/drawutilssvg.js.map +1 -0
  88. package/src/_cjs/entry-glsupport.js +28 -0
  89. package/src/_cjs/entry.js +29 -0
  90. package/src/_cjs/geomutils.d.ts +77 -0
  91. package/src/_cjs/geomutils.js +126 -0
  92. package/src/_cjs/geomutils.js.map +1 -0
  93. package/src/_cjs/index.d.ts +102 -0
  94. package/src/_cjs/index.js +128 -0
  95. package/src/_cjs/index.js.map +1 -0
  96. package/src/_cjs/interfaces/DrawLib.d.ts +582 -0
  97. package/src/_cjs/interfaces/DrawLib.js +32 -0
  98. package/src/_cjs/interfaces/DrawLib.js.map +1 -0
  99. package/src/_cjs/interfaces/additionals.d.ts +95 -0
  100. package/src/_cjs/interfaces/additionals.js +3 -0
  101. package/src/_cjs/interfaces/additionals.js.map +1 -0
  102. package/src/_cjs/interfaces/core.d.ts +286 -0
  103. package/src/_cjs/interfaces/core.js +30 -0
  104. package/src/_cjs/interfaces/core.js.map +1 -0
  105. package/src/_cjs/interfaces/externals.d.ts +56 -0
  106. package/src/_cjs/interfaces/externals.js +8 -0
  107. package/src/_cjs/interfaces/externals.js.map +1 -0
  108. package/src/_cjs/interfaces/index.d.ts +4 -0
  109. package/src/_cjs/interfaces/index.js +21 -0
  110. package/src/_cjs/interfaces/index.js.map +1 -0
  111. package/src/_cjs/module.d.ts +26 -0
  112. package/src/_cjs/module.js +60 -0
  113. package/src/_cjs/module.js.map +1 -0
  114. package/src/_cjs/utils/InitializationObserver.d.ts +18 -0
  115. package/src/_cjs/utils/InitializationObserver.js +63 -0
  116. package/src/_cjs/utils/InitializationObserver.js.map +1 -0
  117. package/src/_cjs/utils/LissajousFigure.d.ts +34 -0
  118. package/src/_cjs/utils/LissajousFigure.js +100 -0
  119. package/src/_cjs/utils/LissajousFigure.js.map +1 -0
  120. package/src/_cjs/utils/NGons.d.ts +13 -0
  121. package/src/_cjs/utils/NGons.js +36 -0
  122. package/src/_cjs/utils/NGons.js.map +1 -0
  123. package/src/_cjs/utils/Params.d.ts +17 -0
  124. package/src/_cjs/utils/Params.js +53 -0
  125. package/src/_cjs/utils/Params.js.map +1 -0
  126. package/src/_cjs/utils/PerlinNoise.d.ts +19 -0
  127. package/src/_cjs/utils/PerlinNoise.js +352 -0
  128. package/src/_cjs/utils/PerlinNoise.js.map +1 -0
  129. package/src/_cjs/utils/SVGPathUtils.d.ts +22 -0
  130. package/src/_cjs/utils/SVGPathUtils.js +45 -0
  131. package/src/_cjs/utils/SVGPathUtils.js.map +1 -0
  132. package/src/_cjs/utils/WebColors.d.ts +35 -0
  133. package/src/_cjs/utils/WebColors.js +58 -0
  134. package/src/_cjs/utils/WebColors.js.map +1 -0
  135. package/src/_cjs/utils/WebColorsContrast.d.ts +6 -0
  136. package/src/_cjs/utils/WebColorsContrast.js +12 -0
  137. package/src/_cjs/utils/WebColorsContrast.js.map +1 -0
  138. package/src/_cjs/utils/WebColorsMalachite.d.ts +12 -0
  139. package/src/_cjs/utils/WebColorsMalachite.js +28 -0
  140. package/src/_cjs/utils/WebColorsMalachite.js.map +1 -0
  141. package/src/_cjs/utils/algorithms/CatmullRomPath.d.ts +60 -0
  142. package/src/_cjs/utils/algorithms/CatmullRomPath.js +108 -0
  143. package/src/_cjs/utils/algorithms/CatmullRomPath.js.map +1 -0
  144. package/src/_cjs/utils/algorithms/CircleIntersections.d.ts +170 -0
  145. package/src/_cjs/utils/algorithms/CircleIntersections.js +310 -0
  146. package/src/_cjs/utils/algorithms/CircleIntersections.js.map +1 -0
  147. package/src/_cjs/utils/algorithms/ContourLineDetection.d.ts +150 -0
  148. package/src/_cjs/utils/algorithms/ContourLineDetection.js +367 -0
  149. package/src/_cjs/utils/algorithms/ContourLineDetection.js.map +1 -0
  150. package/src/_cjs/utils/algorithms/CubicSplinePath.d.ts +63 -0
  151. package/src/_cjs/utils/algorithms/CubicSplinePath.js +175 -0
  152. package/src/_cjs/utils/algorithms/CubicSplinePath.js.map +1 -0
  153. package/src/_cjs/utils/algorithms/HobbyPath.d.ts +81 -0
  154. package/src/_cjs/utils/algorithms/HobbyPath.js +278 -0
  155. package/src/_cjs/utils/algorithms/HobbyPath.js.map +1 -0
  156. package/src/_cjs/utils/algorithms/Metaballs.d.ts +30 -0
  157. package/src/_cjs/utils/algorithms/Metaballs.js +114 -0
  158. package/src/_cjs/utils/algorithms/Metaballs.js.map +1 -0
  159. package/src/_cjs/utils/algorithms/PolygonInset.d.ts +184 -0
  160. package/src/_cjs/utils/algorithms/PolygonInset.js +431 -0
  161. package/src/_cjs/utils/algorithms/PolygonInset.js.map +1 -0
  162. package/src/_cjs/utils/algorithms/PolygonTesselationOutlines.d.ts +145 -0
  163. package/src/_cjs/utils/algorithms/PolygonTesselationOutlines.js +269 -0
  164. package/src/_cjs/utils/algorithms/PolygonTesselationOutlines.js.map +1 -0
  165. package/src/_cjs/utils/algorithms/arrayFill.d.ts +8 -0
  166. package/src/_cjs/utils/algorithms/arrayFill.js +18 -0
  167. package/src/_cjs/utils/algorithms/arrayFill.js.map +1 -0
  168. package/src/_cjs/utils/algorithms/arrayResize.d.ts +8 -0
  169. package/src/_cjs/utils/algorithms/arrayResize.js +24 -0
  170. package/src/_cjs/utils/algorithms/arrayResize.js.map +1 -0
  171. package/src/_cjs/utils/algorithms/arrayShuffle.d.ts +8 -0
  172. package/src/_cjs/utils/algorithms/arrayShuffle.js +15 -0
  173. package/src/_cjs/utils/algorithms/arrayShuffle.js.map +1 -0
  174. package/src/_cjs/utils/algorithms/clearDuplicateVertices.d.ts +22 -0
  175. package/src/_cjs/utils/algorithms/clearDuplicateVertices.js +51 -0
  176. package/src/_cjs/utils/algorithms/clearDuplicateVertices.js.map +1 -0
  177. package/src/_cjs/utils/algorithms/clearPolygonDuplicateVertices.d.ts +24 -0
  178. package/src/_cjs/utils/algorithms/clearPolygonDuplicateVertices.js +61 -0
  179. package/src/_cjs/utils/algorithms/clearPolygonDuplicateVertices.js.map +1 -0
  180. package/src/_cjs/utils/algorithms/convexHull.d.ts +23 -0
  181. package/src/_cjs/utils/algorithms/convexHull.js +71 -0
  182. package/src/_cjs/utils/algorithms/convexHull.js.map +1 -0
  183. package/src/_cjs/utils/algorithms/convexPolygonIncircle.d.ts +41 -0
  184. package/src/_cjs/utils/algorithms/convexPolygonIncircle.js +145 -0
  185. package/src/_cjs/utils/algorithms/convexPolygonIncircle.js.map +1 -0
  186. package/src/_cjs/utils/algorithms/delaunay.d.ts +30 -0
  187. package/src/_cjs/utils/algorithms/delaunay.js +158 -0
  188. package/src/_cjs/utils/algorithms/delaunay.js.map +1 -0
  189. package/src/_cjs/utils/algorithms/delaunay2voronoi.d.ts +25 -0
  190. package/src/_cjs/utils/algorithms/delaunay2voronoi.js +104 -0
  191. package/src/_cjs/utils/algorithms/delaunay2voronoi.js.map +1 -0
  192. package/src/_cjs/utils/algorithms/detectPaths.d.ts +21 -0
  193. package/src/_cjs/utils/algorithms/detectPaths.js +169 -0
  194. package/src/_cjs/utils/algorithms/detectPaths.js.map +1 -0
  195. package/src/_cjs/utils/algorithms/findPolygonSelfIntersections.d.ts +21 -0
  196. package/src/_cjs/utils/algorithms/findPolygonSelfIntersections.js +51 -0
  197. package/src/_cjs/utils/algorithms/findPolygonSelfIntersections.js.map +1 -0
  198. package/src/_cjs/utils/algorithms/getContrastColor.d.ts +13 -0
  199. package/src/_cjs/utils/algorithms/getContrastColor.js +26 -0
  200. package/src/_cjs/utils/algorithms/getContrastColor.js.map +1 -0
  201. package/src/_cjs/utils/algorithms/matrixFill.d.ts +10 -0
  202. package/src/_cjs/utils/algorithms/matrixFill.js +21 -0
  203. package/src/_cjs/utils/algorithms/matrixFill.js.map +1 -0
  204. package/src/_cjs/utils/algorithms/pixelCornersToRoundPaths.d.ts +23 -0
  205. package/src/_cjs/utils/algorithms/pixelCornersToRoundPaths.js +270 -0
  206. package/src/_cjs/utils/algorithms/pixelCornersToRoundPaths.js.map +1 -0
  207. package/src/_cjs/utils/algorithms/splitPolygonToNonIntersecting.d.ts +28 -0
  208. package/src/_cjs/utils/algorithms/splitPolygonToNonIntersecting.js +102 -0
  209. package/src/_cjs/utils/algorithms/splitPolygonToNonIntersecting.js.map +1 -0
  210. package/src/_cjs/utils/algorithms/sutherlandHodgman.d.ts +16 -0
  211. package/src/_cjs/utils/algorithms/sutherlandHodgman.js +76 -0
  212. package/src/_cjs/utils/algorithms/sutherlandHodgman.js.map +1 -0
  213. package/src/_cjs/utils/cloneVertexArray.d.ts +13 -0
  214. package/src/_cjs/utils/cloneVertexArray.js +23 -0
  215. package/src/_cjs/utils/cloneVertexArray.js.map +1 -0
  216. package/src/_cjs/utils/createRandomizedPolygon.d.ts +14 -0
  217. package/src/_cjs/utils/createRandomizedPolygon.js +32 -0
  218. package/src/_cjs/utils/createRandomizedPolygon.js.map +1 -0
  219. package/src/_cjs/utils/creategui.js +434 -0
  220. package/src/_cjs/utils/dat.gui.arrowbounce.polyfill.js +128 -0
  221. package/src/_cjs/utils/dat.gui.title.polyfill.js +35 -0
  222. package/src/_cjs/utils/datastructures/CircularIntervalSet.d.ts +83 -0
  223. package/src/_cjs/utils/datastructures/CircularIntervalSet.js +163 -0
  224. package/src/_cjs/utils/datastructures/CircularIntervalSet.js.map +1 -0
  225. package/src/_cjs/utils/datastructures/Color.d.ts +391 -0
  226. package/src/_cjs/utils/datastructures/Color.js +1084 -0
  227. package/src/_cjs/utils/datastructures/Color.js.map +1 -0
  228. package/src/_cjs/utils/datastructures/ColorGradient.d.ts +81 -0
  229. package/src/_cjs/utils/datastructures/ColorGradient.js +176 -0
  230. package/src/_cjs/utils/datastructures/ColorGradient.js.map +1 -0
  231. package/src/_cjs/utils/datastructures/DataGrid2d.d.ts +53 -0
  232. package/src/_cjs/utils/datastructures/DataGrid2d.js +20 -0
  233. package/src/_cjs/utils/datastructures/DataGrid2d.js.map +1 -0
  234. package/src/_cjs/utils/datastructures/DataGrid2dArrayMatrix.d.ts +88 -0
  235. package/src/_cjs/utils/datastructures/DataGrid2dArrayMatrix.js +155 -0
  236. package/src/_cjs/utils/datastructures/DataGrid2dArrayMatrix.js.map +1 -0
  237. package/src/_cjs/utils/datastructures/DataGrid2dListAdapter.d.ts +59 -0
  238. package/src/_cjs/utils/datastructures/DataGrid2dListAdapter.js +84 -0
  239. package/src/_cjs/utils/datastructures/DataGrid2dListAdapter.js.map +1 -0
  240. package/src/_cjs/utils/datastructures/GenericPath.d.ts +86 -0
  241. package/src/_cjs/utils/datastructures/GenericPath.js +122 -0
  242. package/src/_cjs/utils/datastructures/GenericPath.js.map +1 -0
  243. package/src/_cjs/utils/datastructures/GeometryMesh.d.ts +49 -0
  244. package/src/_cjs/utils/datastructures/GeometryMesh.js +58 -0
  245. package/src/_cjs/utils/datastructures/GeometryMesh.js.map +1 -0
  246. package/src/_cjs/utils/datastructures/Girih.d.ts +181 -0
  247. package/src/_cjs/utils/datastructures/Girih.js +266 -0
  248. package/src/_cjs/utils/datastructures/Girih.js.map +1 -0
  249. package/src/_cjs/utils/datastructures/GirihBowtie.d.ts +37 -0
  250. package/src/_cjs/utils/datastructures/GirihBowtie.js +152 -0
  251. package/src/_cjs/utils/datastructures/GirihBowtie.js.map +1 -0
  252. package/src/_cjs/utils/datastructures/GirihDecagon.d.ts +52 -0
  253. package/src/_cjs/utils/datastructures/GirihDecagon.js +132 -0
  254. package/src/_cjs/utils/datastructures/GirihDecagon.js.map +1 -0
  255. package/src/_cjs/utils/datastructures/GirihHexagon.d.ts +39 -0
  256. package/src/_cjs/utils/datastructures/GirihHexagon.js +200 -0
  257. package/src/_cjs/utils/datastructures/GirihHexagon.js.map +1 -0
  258. package/src/_cjs/utils/datastructures/GirihPenroseRhombus.d.ts +46 -0
  259. package/src/_cjs/utils/datastructures/GirihPenroseRhombus.js +189 -0
  260. package/src/_cjs/utils/datastructures/GirihPenroseRhombus.js.map +1 -0
  261. package/src/_cjs/utils/datastructures/GirihPentagon.d.ts +37 -0
  262. package/src/_cjs/utils/datastructures/GirihPentagon.js +109 -0
  263. package/src/_cjs/utils/datastructures/GirihPentagon.js.map +1 -0
  264. package/src/_cjs/utils/datastructures/GirihRhombus.d.ts +38 -0
  265. package/src/_cjs/utils/datastructures/GirihRhombus.js +155 -0
  266. package/src/_cjs/utils/datastructures/GirihRhombus.js.map +1 -0
  267. package/src/_cjs/utils/datastructures/GirihTile.d.ts +283 -0
  268. package/src/_cjs/utils/datastructures/GirihTile.js +308 -0
  269. package/src/_cjs/utils/datastructures/GirihTile.js.map +1 -0
  270. package/src/_cjs/utils/datastructures/Matrix4x4.d.ts +244 -0
  271. package/src/_cjs/utils/datastructures/Matrix4x4.js +262 -0
  272. package/src/_cjs/utils/datastructures/Matrix4x4.js.map +1 -0
  273. package/src/_cjs/utils/datastructures/VoronoiCell.d.ts +122 -0
  274. package/src/_cjs/utils/datastructures/VoronoiCell.js +183 -0
  275. package/src/_cjs/utils/datastructures/VoronoiCell.js.map +1 -0
  276. package/src/_cjs/utils/datastructures/interfaces.d.ts +13 -0
  277. package/src/_cjs/utils/datastructures/interfaces.js +10 -0
  278. package/src/_cjs/utils/datastructures/interfaces.js.map +1 -0
  279. package/src/_cjs/utils/detectDarkMode.d.ts +10 -0
  280. package/src/_cjs/utils/detectDarkMode.js +41 -0
  281. package/src/_cjs/utils/detectDarkMode.js.map +1 -0
  282. package/src/_cjs/utils/dom/components/ColorGradientPicker.d.ts +246 -0
  283. package/src/_cjs/utils/dom/components/ColorGradientPicker.js +667 -0
  284. package/src/_cjs/utils/dom/components/ColorGradientPicker.js.map +1 -0
  285. package/src/_cjs/utils/dom/components/ColorGradientPickerJSX.d.ts +129 -0
  286. package/src/_cjs/utils/dom/components/ColorGradientPickerJSX.js +520 -0
  287. package/src/_cjs/utils/dom/components/ColorGradientPickerJSX.js.map +1 -0
  288. package/src/_cjs/utils/dom/components/ColorGradientSelector.d.ts +118 -0
  289. package/src/_cjs/utils/dom/components/ColorGradientSelector.js +327 -0
  290. package/src/_cjs/utils/dom/components/ColorGradientSelector.js.map +1 -0
  291. package/src/_cjs/utils/dom/components/Test.d.ts +7 -0
  292. package/src/_cjs/utils/dom/components/Test.js +30 -0
  293. package/src/_cjs/utils/dom/components/Test.js.map +1 -0
  294. package/src/_cjs/utils/dom/getAvailableContainerSpace.d.ts +2 -0
  295. package/src/_cjs/utils/dom/getAvailableContainerSpace.js +29 -0
  296. package/src/_cjs/utils/dom/getAvailableContainerSpace.js.map +1 -0
  297. package/src/_cjs/utils/dom/getFProp.d.ts +5 -0
  298. package/src/_cjs/utils/dom/getFProp.js +12 -0
  299. package/src/_cjs/utils/dom/getFProp.js.map +1 -0
  300. package/src/_cjs/utils/dom/guiSizeToggler.d.ts +18 -0
  301. package/src/_cjs/utils/dom/guiSizeToggler.js +44 -0
  302. package/src/_cjs/utils/dom/guiSizeToggler.js.map +1 -0
  303. package/src/_cjs/utils/findInVertexArray.d.ts +19 -0
  304. package/src/_cjs/utils/findInVertexArray.js +29 -0
  305. package/src/_cjs/utils/findInVertexArray.js.map +1 -0
  306. package/src/_cjs/utils/getFProp.d.ts +5 -0
  307. package/src/_cjs/utils/getFProp.js +12 -0
  308. package/src/_cjs/utils/getFProp.js.map +1 -0
  309. package/src/_cjs/utils/gup.d.ts +14 -0
  310. package/src/_cjs/utils/gup.js +31 -0
  311. package/src/_cjs/utils/gup.js.map +1 -0
  312. package/src/_cjs/utils/helpers/BezierPathInteractionHelper.d.ts +272 -0
  313. package/src/_cjs/utils/helpers/BezierPathInteractionHelper.js +655 -0
  314. package/src/_cjs/utils/helpers/BezierPathInteractionHelper.js.map +1 -0
  315. package/src/_cjs/utils/helpers/CircleHelper.d.ts +73 -0
  316. package/src/_cjs/utils/helpers/CircleHelper.js +93 -0
  317. package/src/_cjs/utils/helpers/CircleHelper.js.map +1 -0
  318. package/src/_cjs/utils/helpers/CircleSectorHelper.d.ts +90 -0
  319. package/src/_cjs/utils/helpers/CircleSectorHelper.js +114 -0
  320. package/src/_cjs/utils/helpers/CircleSectorHelper.js.map +1 -0
  321. package/src/_cjs/utils/helpers/TriangleHelper.d.ts +57 -0
  322. package/src/_cjs/utils/helpers/TriangleHelper.js +83 -0
  323. package/src/_cjs/utils/helpers/TriangleHelper.js.map +1 -0
  324. package/src/_cjs/utils/helpers/VEllipseHelper.d.ts +32 -0
  325. package/src/_cjs/utils/helpers/VEllipseHelper.js +88 -0
  326. package/src/_cjs/utils/helpers/VEllipseHelper.js.map +1 -0
  327. package/src/_cjs/utils/helpers/VEllipseSectorHelper.d.ts +52 -0
  328. package/src/_cjs/utils/helpers/VEllipseSectorHelper.js +135 -0
  329. package/src/_cjs/utils/helpers/VEllipseSectorHelper.js.map +1 -0
  330. package/src/_cjs/utils/io/DndFileHandler.d.ts +63 -0
  331. package/src/_cjs/utils/io/DndFileHandler.js +112 -0
  332. package/src/_cjs/utils/io/DndFileHandler.js.map +1 -0
  333. package/src/_cjs/utils/io/FileDrop.d.ts +110 -0
  334. package/src/_cjs/utils/io/FileDrop.js +177 -0
  335. package/src/_cjs/utils/io/FileDrop.js.map +1 -0
  336. package/src/_cjs/utils/lil.gui.arrowbounce.polyfill.js +133 -0
  337. package/src/_cjs/utils/lil.gui.title.polyfill.js +32 -0
  338. package/src/_cjs/utils/module.js +18 -0
  339. package/src/_cjs/utils/parsers/LinearColorGradientParser.d.ts +78 -0
  340. package/src/_cjs/utils/parsers/LinearColorGradientParser.js +224 -0
  341. package/src/_cjs/utils/parsers/LinearColorGradientParser.js.map +1 -0
  342. package/src/_cjs/utils/parsers/OBJParser.d.ts +24 -0
  343. package/src/_cjs/utils/parsers/OBJParser.js +77 -0
  344. package/src/_cjs/utils/parsers/OBJParser.js.map +1 -0
  345. package/src/_cjs/utils/parsers/STLParser.d.ts +61 -0
  346. package/src/_cjs/utils/parsers/STLParser.js +182 -0
  347. package/src/_cjs/utils/parsers/STLParser.js.map +1 -0
  348. package/src/_cjs/utils/parsers/svg/parseSVGPathData.d.ts +27 -0
  349. package/src/_cjs/utils/parsers/svg/parseSVGPathData.js +486 -0
  350. package/src/_cjs/utils/parsers/svg/parseSVGPathData.js.map +1 -0
  351. package/src/_cjs/utils/parsers/svg/splitSVGPathData.d.ts +20 -0
  352. package/src/_cjs/utils/parsers/svg/splitSVGPathData.js +53 -0
  353. package/src/_cjs/utils/parsers/svg/splitSVGPathData.js.map +1 -0
  354. package/src/_cjs/utils/parsers/svg/types.d.ts +63 -0
  355. package/src/_cjs/utils/parsers/svg/types.js +17 -0
  356. package/src/_cjs/utils/parsers/svg/types.js.map +1 -0
  357. package/src/_cjs/utils/ts-runner.js +146 -0
  358. package/src/_cjs/utils/tsAsyncScriptLoader.js +74 -0
  359. package/src/_esm/BezierPath.d.ts +610 -0
  360. package/src/_esm/BezierPath.js +1124 -0
  361. package/src/_esm/BezierPath.js.map +1 -0
  362. package/src/_esm/Bounds.d.ts +252 -0
  363. package/src/_esm/Bounds.js +317 -0
  364. package/src/_esm/Bounds.js.map +1 -0
  365. package/src/_esm/Circle.d.ts +214 -0
  366. package/src/_esm/Circle.js +335 -0
  367. package/src/_esm/Circle.js.map +1 -0
  368. package/src/_esm/CircleSector.d.ts +211 -0
  369. package/src/_esm/CircleSector.js +359 -0
  370. package/src/_esm/CircleSector.js.map +1 -0
  371. package/src/_esm/CubicBezierCurve.d.ts +656 -0
  372. package/src/_esm/CubicBezierCurve.js +1057 -0
  373. package/src/_esm/CubicBezierCurve.js.map +1 -0
  374. package/src/_esm/Grid.d.ts +83 -0
  375. package/src/_esm/Grid.js +89 -0
  376. package/src/_esm/Grid.js.map +1 -0
  377. package/src/_esm/KeyHandler.d.ts +177 -0
  378. package/src/_esm/KeyHandler.js +434 -0
  379. package/src/_esm/KeyHandler.js.map +1 -0
  380. package/src/_esm/Line.d.ts +134 -0
  381. package/src/_esm/Line.js +200 -0
  382. package/src/_esm/Line.js.map +1 -0
  383. package/src/_esm/MouseHandler.d.ts +283 -0
  384. package/src/_esm/MouseHandler.js +397 -0
  385. package/src/_esm/MouseHandler.js.map +1 -0
  386. package/src/_esm/PBImage.d.ts +81 -0
  387. package/src/_esm/PBImage.js +60 -0
  388. package/src/_esm/PBImage.js.map +1 -0
  389. package/src/_esm/PBText.d.ts +118 -0
  390. package/src/_esm/PBText.js +62 -0
  391. package/src/_esm/PBText.js.map +1 -0
  392. package/src/_esm/PlotBoilerplate.d.ts +899 -0
  393. package/src/_esm/PlotBoilerplate.js +2347 -0
  394. package/src/_esm/PlotBoilerplate.js.map +1 -0
  395. package/src/_esm/Polygon.d.ts +520 -0
  396. package/src/_esm/Polygon.js +924 -0
  397. package/src/_esm/Polygon.js.map +1 -0
  398. package/src/_esm/SVGBuilder.d.ts +47 -0
  399. package/src/_esm/SVGBuilder.js +95 -0
  400. package/src/_esm/SVGBuilder.js.map +1 -0
  401. package/src/_esm/Triangle.d.ts +392 -0
  402. package/src/_esm/Triangle.js +493 -0
  403. package/src/_esm/Triangle.js.map +1 -0
  404. package/src/_esm/UIDGenerator.d.ts +12 -0
  405. package/src/_esm/UIDGenerator.js +18 -0
  406. package/src/_esm/UIDGenerator.js.map +1 -0
  407. package/src/_esm/VEllipse.d.ts +319 -0
  408. package/src/_esm/VEllipse.js +574 -0
  409. package/src/_esm/VEllipse.js.map +1 -0
  410. package/src/_esm/VEllipseSector.d.ts +230 -0
  411. package/src/_esm/VEllipseSector.js +422 -0
  412. package/src/_esm/VEllipseSector.js.map +1 -0
  413. package/src/_esm/Vector.d.ts +126 -0
  414. package/src/_esm/Vector.js +181 -0
  415. package/src/_esm/Vector.js.map +1 -0
  416. package/src/_esm/VertTuple.d.ts +284 -0
  417. package/src/_esm/VertTuple.js +347 -0
  418. package/src/_esm/VertTuple.js.map +1 -0
  419. package/src/_esm/Vertex.d.ts +498 -0
  420. package/src/_esm/Vertex.js +702 -0
  421. package/src/_esm/Vertex.js.map +1 -0
  422. package/src/_esm/VertexAttr.d.ts +72 -0
  423. package/src/_esm/VertexAttr.js +58 -0
  424. package/src/_esm/VertexAttr.js.map +1 -0
  425. package/src/_esm/VertexListeners.d.ts +209 -0
  426. package/src/_esm/VertexListeners.js +270 -0
  427. package/src/_esm/VertexListeners.js.map +1 -0
  428. package/src/_esm/draw.d.ts +657 -0
  429. package/src/_esm/draw.js +1159 -0
  430. package/src/_esm/draw.js.map +1 -0
  431. package/src/_esm/drawgl.d.ts +544 -0
  432. package/src/_esm/drawgl.js +812 -0
  433. package/src/_esm/drawgl.js.map +1 -0
  434. package/src/_esm/drawutilssvg.d.ts +954 -0
  435. package/src/_esm/drawutilssvg.js +1705 -0
  436. package/src/_esm/drawutilssvg.js.map +1 -0
  437. package/src/_esm/entry-glsupport.js +28 -0
  438. package/src/_esm/entry.js +29 -0
  439. package/src/_esm/geomutils.d.ts +77 -0
  440. package/src/_esm/geomutils.js +126 -0
  441. package/src/_esm/geomutils.js.map +1 -0
  442. package/src/_esm/index.d.ts +102 -0
  443. package/src/_esm/index.js +128 -0
  444. package/src/_esm/index.js.map +1 -0
  445. package/src/_esm/interfaces/DrawLib.d.ts +582 -0
  446. package/src/_esm/interfaces/DrawLib.js +32 -0
  447. package/src/_esm/interfaces/DrawLib.js.map +1 -0
  448. package/src/_esm/interfaces/additionals.d.ts +95 -0
  449. package/src/_esm/interfaces/additionals.js +3 -0
  450. package/src/_esm/interfaces/additionals.js.map +1 -0
  451. package/src/_esm/interfaces/core.d.ts +286 -0
  452. package/src/_esm/interfaces/core.js +30 -0
  453. package/src/_esm/interfaces/core.js.map +1 -0
  454. package/src/_esm/interfaces/externals.d.ts +56 -0
  455. package/src/_esm/interfaces/externals.js +8 -0
  456. package/src/_esm/interfaces/externals.js.map +1 -0
  457. package/src/_esm/interfaces/index.d.ts +4 -0
  458. package/src/_esm/interfaces/index.js +21 -0
  459. package/src/_esm/interfaces/index.js.map +1 -0
  460. package/src/_esm/module.d.ts +26 -0
  461. package/src/_esm/module.js +60 -0
  462. package/src/_esm/module.js.map +1 -0
  463. package/src/_esm/src/ts/BezierPath.d.ts +610 -0
  464. package/src/_esm/src/ts/BezierPath.js +1120 -0
  465. package/src/_esm/src/ts/BezierPath.js.map +1 -0
  466. package/src/_esm/src/ts/Bounds.d.ts +252 -0
  467. package/src/_esm/src/ts/Bounds.js +313 -0
  468. package/src/_esm/src/ts/Bounds.js.map +1 -0
  469. package/src/_esm/src/ts/Circle.d.ts +214 -0
  470. package/src/_esm/src/ts/Circle.js +331 -0
  471. package/src/_esm/src/ts/Circle.js.map +1 -0
  472. package/src/_esm/src/ts/CircleSector.d.ts +211 -0
  473. package/src/_esm/src/ts/CircleSector.js +355 -0
  474. package/src/_esm/src/ts/CircleSector.js.map +1 -0
  475. package/src/_esm/src/ts/CubicBezierCurve.d.ts +656 -0
  476. package/src/_esm/src/ts/CubicBezierCurve.js +1053 -0
  477. package/src/_esm/src/ts/CubicBezierCurve.js.map +1 -0
  478. package/src/_esm/src/ts/Grid.d.ts +83 -0
  479. package/src/_esm/src/ts/Grid.js +85 -0
  480. package/src/_esm/src/ts/Grid.js.map +1 -0
  481. package/src/_esm/src/ts/KeyHandler.d.ts +177 -0
  482. package/src/_esm/src/ts/KeyHandler.js +430 -0
  483. package/src/_esm/src/ts/KeyHandler.js.map +1 -0
  484. package/src/_esm/src/ts/Line.d.ts +134 -0
  485. package/src/_esm/src/ts/Line.js +196 -0
  486. package/src/_esm/src/ts/Line.js.map +1 -0
  487. package/src/_esm/src/ts/MouseHandler.d.ts +283 -0
  488. package/src/_esm/src/ts/MouseHandler.js +391 -0
  489. package/src/_esm/src/ts/MouseHandler.js.map +1 -0
  490. package/src/_esm/src/ts/PBImage.d.ts +81 -0
  491. package/src/_esm/src/ts/PBImage.js +56 -0
  492. package/src/_esm/src/ts/PBImage.js.map +1 -0
  493. package/src/_esm/src/ts/PBText.d.ts +118 -0
  494. package/src/_esm/src/ts/PBText.js +58 -0
  495. package/src/_esm/src/ts/PBText.js.map +1 -0
  496. package/src/_esm/src/ts/PlotBoilerplate.d.ts +899 -0
  497. package/src/_esm/src/ts/PlotBoilerplate.js +2340 -0
  498. package/src/_esm/src/ts/PlotBoilerplate.js.map +1 -0
  499. package/src/_esm/src/ts/Polygon.d.ts +520 -0
  500. package/src/_esm/src/ts/Polygon.js +920 -0
  501. package/src/_esm/src/ts/Polygon.js.map +1 -0
  502. package/src/_esm/src/ts/Triangle.d.ts +392 -0
  503. package/src/_esm/src/ts/Triangle.js +489 -0
  504. package/src/_esm/src/ts/Triangle.js.map +1 -0
  505. package/src/_esm/src/ts/UIDGenerator.d.ts +12 -0
  506. package/src/_esm/src/ts/UIDGenerator.js +14 -0
  507. package/src/_esm/src/ts/UIDGenerator.js.map +1 -0
  508. package/src/_esm/src/ts/VEllipse.d.ts +319 -0
  509. package/src/_esm/src/ts/VEllipse.js +570 -0
  510. package/src/_esm/src/ts/VEllipse.js.map +1 -0
  511. package/src/_esm/src/ts/VEllipseSector.d.ts +230 -0
  512. package/src/_esm/src/ts/VEllipseSector.js +418 -0
  513. package/src/_esm/src/ts/VEllipseSector.js.map +1 -0
  514. package/src/_esm/src/ts/Vector.d.ts +126 -0
  515. package/src/_esm/src/ts/Vector.js +177 -0
  516. package/src/_esm/src/ts/Vector.js.map +1 -0
  517. package/src/_esm/src/ts/VertTuple.d.ts +284 -0
  518. package/src/_esm/src/ts/VertTuple.js +343 -0
  519. package/src/_esm/src/ts/VertTuple.js.map +1 -0
  520. package/src/_esm/src/ts/Vertex.d.ts +498 -0
  521. package/src/_esm/src/ts/Vertex.js +698 -0
  522. package/src/_esm/src/ts/Vertex.js.map +1 -0
  523. package/src/_esm/src/ts/VertexAttr.d.ts +72 -0
  524. package/src/_esm/src/ts/VertexAttr.js +54 -0
  525. package/src/_esm/src/ts/VertexAttr.js.map +1 -0
  526. package/src/_esm/src/ts/VertexListeners.d.ts +209 -0
  527. package/src/_esm/src/ts/VertexListeners.js +266 -0
  528. package/src/_esm/src/ts/VertexListeners.js.map +1 -0
  529. package/src/_esm/src/ts/draw.d.ts +657 -0
  530. package/src/_esm/src/ts/draw.js +1155 -0
  531. package/src/_esm/src/ts/draw.js.map +1 -0
  532. package/src/_esm/src/ts/drawgl.d.ts +544 -0
  533. package/src/_esm/src/ts/drawgl.js +808 -0
  534. package/src/_esm/src/ts/drawgl.js.map +1 -0
  535. package/src/_esm/src/ts/drawutilssvg.d.ts +954 -0
  536. package/src/_esm/src/ts/drawutilssvg.js +1701 -0
  537. package/src/_esm/src/ts/drawutilssvg.js.map +1 -0
  538. package/src/_esm/src/ts/geomutils.d.ts +77 -0
  539. package/src/_esm/src/ts/geomutils.js +123 -0
  540. package/src/_esm/src/ts/geomutils.js.map +1 -0
  541. package/src/_esm/src/ts/index.d.ts +102 -0
  542. package/src/_esm/src/ts/index.js +112 -0
  543. package/src/_esm/src/ts/index.js.map +1 -0
  544. package/src/_esm/src/ts/interfaces/DrawLib.d.ts +582 -0
  545. package/src/_esm/src/ts/interfaces/DrawLib.js +31 -0
  546. package/src/_esm/src/ts/interfaces/DrawLib.js.map +1 -0
  547. package/src/_esm/src/ts/interfaces/additionals.d.ts +95 -0
  548. package/src/_esm/src/ts/interfaces/additionals.js +2 -0
  549. package/src/_esm/src/ts/interfaces/additionals.js.map +1 -0
  550. package/src/_esm/src/ts/interfaces/core.d.ts +286 -0
  551. package/src/_esm/src/ts/interfaces/core.js +29 -0
  552. package/src/_esm/src/ts/interfaces/core.js.map +1 -0
  553. package/src/_esm/src/ts/interfaces/externals.d.ts +56 -0
  554. package/src/_esm/src/ts/interfaces/externals.js +7 -0
  555. package/src/_esm/src/ts/interfaces/externals.js.map +1 -0
  556. package/src/_esm/src/ts/interfaces/index.d.ts +4 -0
  557. package/src/_esm/src/ts/interfaces/index.js +5 -0
  558. package/src/_esm/src/ts/interfaces/index.js.map +1 -0
  559. package/src/_esm/src/ts/module.d.ts +26 -0
  560. package/src/_esm/src/ts/module.js +38 -0
  561. package/src/_esm/src/ts/module.js.map +1 -0
  562. package/src/_esm/src/ts/utils/InitializationObserver.d.ts +18 -0
  563. package/src/_esm/src/ts/utils/InitializationObserver.js +57 -0
  564. package/src/_esm/src/ts/utils/InitializationObserver.js.map +1 -0
  565. package/src/_esm/src/ts/utils/LissajousFigure.d.ts +34 -0
  566. package/src/_esm/src/ts/utils/LissajousFigure.js +95 -0
  567. package/src/_esm/src/ts/utils/LissajousFigure.js.map +1 -0
  568. package/src/_esm/src/ts/utils/NGons.d.ts +13 -0
  569. package/src/_esm/src/ts/utils/NGons.js +33 -0
  570. package/src/_esm/src/ts/utils/NGons.js.map +1 -0
  571. package/src/_esm/src/ts/utils/Params.d.ts +17 -0
  572. package/src/_esm/src/ts/utils/Params.js +48 -0
  573. package/src/_esm/src/ts/utils/Params.js.map +1 -0
  574. package/src/_esm/src/ts/utils/PerlinNoise.d.ts +19 -0
  575. package/src/_esm/src/ts/utils/PerlinNoise.js +346 -0
  576. package/src/_esm/src/ts/utils/PerlinNoise.js.map +1 -0
  577. package/src/_esm/src/ts/utils/SVGPathUtils.d.ts +22 -0
  578. package/src/_esm/src/ts/utils/SVGPathUtils.js +42 -0
  579. package/src/_esm/src/ts/utils/SVGPathUtils.js.map +1 -0
  580. package/src/_esm/src/ts/utils/WebColors.d.ts +35 -0
  581. package/src/_esm/src/ts/utils/WebColors.js +54 -0
  582. package/src/_esm/src/ts/utils/WebColors.js.map +1 -0
  583. package/src/_esm/src/ts/utils/WebColorsContrast.d.ts +6 -0
  584. package/src/_esm/src/ts/utils/WebColorsContrast.js +9 -0
  585. package/src/_esm/src/ts/utils/WebColorsContrast.js.map +1 -0
  586. package/src/_esm/src/ts/utils/WebColorsMalachite.d.ts +12 -0
  587. package/src/_esm/src/ts/utils/WebColorsMalachite.js +25 -0
  588. package/src/_esm/src/ts/utils/WebColorsMalachite.js.map +1 -0
  589. package/src/_esm/src/ts/utils/algorithms/CatmullRomPath.d.ts +60 -0
  590. package/src/_esm/src/ts/utils/algorithms/CatmullRomPath.js +103 -0
  591. package/src/_esm/src/ts/utils/algorithms/CatmullRomPath.js.map +1 -0
  592. package/src/_esm/src/ts/utils/algorithms/CircleIntersections.d.ts +170 -0
  593. package/src/_esm/src/ts/utils/algorithms/CircleIntersections.js +303 -0
  594. package/src/_esm/src/ts/utils/algorithms/CircleIntersections.js.map +1 -0
  595. package/src/_esm/src/ts/utils/algorithms/ContourLineDetection.d.ts +150 -0
  596. package/src/_esm/src/ts/utils/algorithms/ContourLineDetection.js +362 -0
  597. package/src/_esm/src/ts/utils/algorithms/ContourLineDetection.js.map +1 -0
  598. package/src/_esm/src/ts/utils/algorithms/CubicSplinePath.d.ts +63 -0
  599. package/src/_esm/src/ts/utils/algorithms/CubicSplinePath.js +170 -0
  600. package/src/_esm/src/ts/utils/algorithms/CubicSplinePath.js.map +1 -0
  601. package/src/_esm/src/ts/utils/algorithms/HobbyPath.d.ts +81 -0
  602. package/src/_esm/src/ts/utils/algorithms/HobbyPath.js +273 -0
  603. package/src/_esm/src/ts/utils/algorithms/HobbyPath.js.map +1 -0
  604. package/src/_esm/src/ts/utils/algorithms/Metaballs.d.ts +30 -0
  605. package/src/_esm/src/ts/utils/algorithms/Metaballs.js +109 -0
  606. package/src/_esm/src/ts/utils/algorithms/Metaballs.js.map +1 -0
  607. package/src/_esm/src/ts/utils/algorithms/PolygonInset.d.ts +184 -0
  608. package/src/_esm/src/ts/utils/algorithms/PolygonInset.js +424 -0
  609. package/src/_esm/src/ts/utils/algorithms/PolygonInset.js.map +1 -0
  610. package/src/_esm/src/ts/utils/algorithms/PolygonTesselationOutlines.d.ts +145 -0
  611. package/src/_esm/src/ts/utils/algorithms/PolygonTesselationOutlines.js +262 -0
  612. package/src/_esm/src/ts/utils/algorithms/PolygonTesselationOutlines.js.map +1 -0
  613. package/src/_esm/src/ts/utils/algorithms/arrayFill.d.ts +8 -0
  614. package/src/_esm/src/ts/utils/algorithms/arrayFill.js +14 -0
  615. package/src/_esm/src/ts/utils/algorithms/arrayFill.js.map +1 -0
  616. package/src/_esm/src/ts/utils/algorithms/arrayResize.d.ts +8 -0
  617. package/src/_esm/src/ts/utils/algorithms/arrayResize.js +20 -0
  618. package/src/_esm/src/ts/utils/algorithms/arrayResize.js.map +1 -0
  619. package/src/_esm/src/ts/utils/algorithms/arrayShuffle.d.ts +8 -0
  620. package/src/_esm/src/ts/utils/algorithms/arrayShuffle.js +11 -0
  621. package/src/_esm/src/ts/utils/algorithms/arrayShuffle.js.map +1 -0
  622. package/src/_esm/src/ts/utils/algorithms/clearDuplicateVertices.d.ts +22 -0
  623. package/src/_esm/src/ts/utils/algorithms/clearDuplicateVertices.js +47 -0
  624. package/src/_esm/src/ts/utils/algorithms/clearDuplicateVertices.js.map +1 -0
  625. package/src/_esm/src/ts/utils/algorithms/clearPolygonDuplicateVertices.d.ts +24 -0
  626. package/src/_esm/src/ts/utils/algorithms/clearPolygonDuplicateVertices.js +57 -0
  627. package/src/_esm/src/ts/utils/algorithms/clearPolygonDuplicateVertices.js.map +1 -0
  628. package/src/_esm/src/ts/utils/algorithms/convexHull.d.ts +23 -0
  629. package/src/_esm/src/ts/utils/algorithms/convexHull.js +67 -0
  630. package/src/_esm/src/ts/utils/algorithms/convexHull.js.map +1 -0
  631. package/src/_esm/src/ts/utils/algorithms/convexPolygonIncircle.d.ts +41 -0
  632. package/src/_esm/src/ts/utils/algorithms/convexPolygonIncircle.js +141 -0
  633. package/src/_esm/src/ts/utils/algorithms/convexPolygonIncircle.js.map +1 -0
  634. package/src/_esm/src/ts/utils/algorithms/delaunay.d.ts +30 -0
  635. package/src/_esm/src/ts/utils/algorithms/delaunay.js +153 -0
  636. package/src/_esm/src/ts/utils/algorithms/delaunay.js.map +1 -0
  637. package/src/_esm/src/ts/utils/algorithms/delaunay2voronoi.d.ts +25 -0
  638. package/src/_esm/src/ts/utils/algorithms/delaunay2voronoi.js +99 -0
  639. package/src/_esm/src/ts/utils/algorithms/delaunay2voronoi.js.map +1 -0
  640. package/src/_esm/src/ts/utils/algorithms/detectPaths.d.ts +21 -0
  641. package/src/_esm/src/ts/utils/algorithms/detectPaths.js +165 -0
  642. package/src/_esm/src/ts/utils/algorithms/detectPaths.js.map +1 -0
  643. package/src/_esm/src/ts/utils/algorithms/findPolygonSelfIntersections.d.ts +21 -0
  644. package/src/_esm/src/ts/utils/algorithms/findPolygonSelfIntersections.js +47 -0
  645. package/src/_esm/src/ts/utils/algorithms/findPolygonSelfIntersections.js.map +1 -0
  646. package/src/_esm/src/ts/utils/algorithms/getContrastColor.d.ts +13 -0
  647. package/src/_esm/src/ts/utils/algorithms/getContrastColor.js +22 -0
  648. package/src/_esm/src/ts/utils/algorithms/getContrastColor.js.map +1 -0
  649. package/src/_esm/src/ts/utils/algorithms/matrixFill.d.ts +10 -0
  650. package/src/_esm/src/ts/utils/algorithms/matrixFill.js +17 -0
  651. package/src/_esm/src/ts/utils/algorithms/matrixFill.js.map +1 -0
  652. package/src/_esm/src/ts/utils/algorithms/pixelCornersToRoundPaths.d.ts +23 -0
  653. package/src/_esm/src/ts/utils/algorithms/pixelCornersToRoundPaths.js +266 -0
  654. package/src/_esm/src/ts/utils/algorithms/pixelCornersToRoundPaths.js.map +1 -0
  655. package/src/_esm/src/ts/utils/algorithms/splitPolygonToNonIntersecting.d.ts +28 -0
  656. package/src/_esm/src/ts/utils/algorithms/splitPolygonToNonIntersecting.js +99 -0
  657. package/src/_esm/src/ts/utils/algorithms/splitPolygonToNonIntersecting.js.map +1 -0
  658. package/src/_esm/src/ts/utils/algorithms/sutherlandHodgman.d.ts +16 -0
  659. package/src/_esm/src/ts/utils/algorithms/sutherlandHodgman.js +72 -0
  660. package/src/_esm/src/ts/utils/algorithms/sutherlandHodgman.js.map +1 -0
  661. package/src/_esm/src/ts/utils/cloneVertexArray.d.ts +13 -0
  662. package/src/_esm/src/ts/utils/cloneVertexArray.js +19 -0
  663. package/src/_esm/src/ts/utils/cloneVertexArray.js.map +1 -0
  664. package/src/_esm/src/ts/utils/createRandomizedPolygon.d.ts +14 -0
  665. package/src/_esm/src/ts/utils/createRandomizedPolygon.js +28 -0
  666. package/src/_esm/src/ts/utils/createRandomizedPolygon.js.map +1 -0
  667. package/src/_esm/src/ts/utils/datastructures/CircularIntervalSet.d.ts +83 -0
  668. package/src/_esm/src/ts/utils/datastructures/CircularIntervalSet.js +158 -0
  669. package/src/_esm/src/ts/utils/datastructures/CircularIntervalSet.js.map +1 -0
  670. package/src/_esm/src/ts/utils/datastructures/Color.d.ts +391 -0
  671. package/src/_esm/src/ts/utils/datastructures/Color.js +1063 -0
  672. package/src/_esm/src/ts/utils/datastructures/Color.js.map +1 -0
  673. package/src/_esm/src/ts/utils/datastructures/ColorGradient.d.ts +81 -0
  674. package/src/_esm/src/ts/utils/datastructures/ColorGradient.js +171 -0
  675. package/src/_esm/src/ts/utils/datastructures/ColorGradient.js.map +1 -0
  676. package/src/_esm/src/ts/utils/datastructures/DataGrid2d.d.ts +53 -0
  677. package/src/_esm/src/ts/utils/datastructures/DataGrid2d.js +19 -0
  678. package/src/_esm/src/ts/utils/datastructures/DataGrid2d.js.map +1 -0
  679. package/src/_esm/src/ts/utils/datastructures/DataGrid2dArrayMatrix.d.ts +88 -0
  680. package/src/_esm/src/ts/utils/datastructures/DataGrid2dArrayMatrix.js +150 -0
  681. package/src/_esm/src/ts/utils/datastructures/DataGrid2dArrayMatrix.js.map +1 -0
  682. package/src/_esm/src/ts/utils/datastructures/DataGrid2dListAdapter.d.ts +59 -0
  683. package/src/_esm/src/ts/utils/datastructures/DataGrid2dListAdapter.js +79 -0
  684. package/src/_esm/src/ts/utils/datastructures/DataGrid2dListAdapter.js.map +1 -0
  685. package/src/_esm/src/ts/utils/datastructures/GenericPath.d.ts +86 -0
  686. package/src/_esm/src/ts/utils/datastructures/GenericPath.js +117 -0
  687. package/src/_esm/src/ts/utils/datastructures/GenericPath.js.map +1 -0
  688. package/src/_esm/src/ts/utils/datastructures/GeometryMesh.d.ts +49 -0
  689. package/src/_esm/src/ts/utils/datastructures/GeometryMesh.js +53 -0
  690. package/src/_esm/src/ts/utils/datastructures/GeometryMesh.js.map +1 -0
  691. package/src/_esm/src/ts/utils/datastructures/Girih.d.ts +181 -0
  692. package/src/_esm/src/ts/utils/datastructures/Girih.js +261 -0
  693. package/src/_esm/src/ts/utils/datastructures/Girih.js.map +1 -0
  694. package/src/_esm/src/ts/utils/datastructures/GirihBowtie.d.ts +37 -0
  695. package/src/_esm/src/ts/utils/datastructures/GirihBowtie.js +130 -0
  696. package/src/_esm/src/ts/utils/datastructures/GirihBowtie.js.map +1 -0
  697. package/src/_esm/src/ts/utils/datastructures/GirihDecagon.d.ts +52 -0
  698. package/src/_esm/src/ts/utils/datastructures/GirihDecagon.js +110 -0
  699. package/src/_esm/src/ts/utils/datastructures/GirihDecagon.js.map +1 -0
  700. package/src/_esm/src/ts/utils/datastructures/GirihHexagon.d.ts +39 -0
  701. package/src/_esm/src/ts/utils/datastructures/GirihHexagon.js +178 -0
  702. package/src/_esm/src/ts/utils/datastructures/GirihHexagon.js.map +1 -0
  703. package/src/_esm/src/ts/utils/datastructures/GirihPenroseRhombus.d.ts +46 -0
  704. package/src/_esm/src/ts/utils/datastructures/GirihPenroseRhombus.js +167 -0
  705. package/src/_esm/src/ts/utils/datastructures/GirihPenroseRhombus.js.map +1 -0
  706. package/src/_esm/src/ts/utils/datastructures/GirihPentagon.d.ts +37 -0
  707. package/src/_esm/src/ts/utils/datastructures/GirihPentagon.js +87 -0
  708. package/src/_esm/src/ts/utils/datastructures/GirihPentagon.js.map +1 -0
  709. package/src/_esm/src/ts/utils/datastructures/GirihRhombus.d.ts +38 -0
  710. package/src/_esm/src/ts/utils/datastructures/GirihRhombus.js +133 -0
  711. package/src/_esm/src/ts/utils/datastructures/GirihRhombus.js.map +1 -0
  712. package/src/_esm/src/ts/utils/datastructures/GirihTile.d.ts +283 -0
  713. package/src/_esm/src/ts/utils/datastructures/GirihTile.js +286 -0
  714. package/src/_esm/src/ts/utils/datastructures/GirihTile.js.map +1 -0
  715. package/src/_esm/src/ts/utils/datastructures/Matrix4x4.d.ts +244 -0
  716. package/src/_esm/src/ts/utils/datastructures/Matrix4x4.js +246 -0
  717. package/src/_esm/src/ts/utils/datastructures/Matrix4x4.js.map +1 -0
  718. package/src/_esm/src/ts/utils/datastructures/VoronoiCell.d.ts +122 -0
  719. package/src/_esm/src/ts/utils/datastructures/VoronoiCell.js +178 -0
  720. package/src/_esm/src/ts/utils/datastructures/VoronoiCell.js.map +1 -0
  721. package/src/_esm/src/ts/utils/datastructures/interfaces.d.ts +13 -0
  722. package/src/_esm/src/ts/utils/datastructures/interfaces.js +9 -0
  723. package/src/_esm/src/ts/utils/datastructures/interfaces.js.map +1 -0
  724. package/src/_esm/src/ts/utils/detectDarkMode.d.ts +10 -0
  725. package/src/_esm/src/ts/utils/detectDarkMode.js +37 -0
  726. package/src/_esm/src/ts/utils/detectDarkMode.js.map +1 -0
  727. package/src/_esm/src/ts/utils/dom/components/ColorGradientPicker.d.ts +246 -0
  728. package/src/_esm/src/ts/utils/dom/components/ColorGradientPicker.js +743 -0
  729. package/src/_esm/src/ts/utils/dom/components/ColorGradientPicker.js.map +1 -0
  730. package/src/_esm/src/ts/utils/dom/components/ColorGradientSelector.d.ts +118 -0
  731. package/src/_esm/src/ts/utils/dom/components/ColorGradientSelector.js +339 -0
  732. package/src/_esm/src/ts/utils/dom/components/ColorGradientSelector.js.map +1 -0
  733. package/src/_esm/src/ts/utils/dom/components/Test.d.ts +7 -0
  734. package/src/_esm/src/ts/utils/dom/components/Test.js +26 -0
  735. package/src/_esm/src/ts/utils/dom/components/Test.js.map +1 -0
  736. package/src/_esm/src/ts/utils/dom/getAvailableContainerSpace.d.ts +2 -0
  737. package/src/_esm/src/ts/utils/dom/getAvailableContainerSpace.js +25 -0
  738. package/src/_esm/src/ts/utils/dom/getAvailableContainerSpace.js.map +1 -0
  739. package/src/_esm/src/ts/utils/dom/getFProp.d.ts +5 -0
  740. package/src/_esm/src/ts/utils/dom/getFProp.js +8 -0
  741. package/src/_esm/src/ts/utils/dom/getFProp.js.map +1 -0
  742. package/src/_esm/src/ts/utils/dom/guiSizeToggler.d.ts +18 -0
  743. package/src/_esm/src/ts/utils/dom/guiSizeToggler.js +40 -0
  744. package/src/_esm/src/ts/utils/dom/guiSizeToggler.js.map +1 -0
  745. package/src/_esm/src/ts/utils/findInVertexArray.d.ts +19 -0
  746. package/src/_esm/src/ts/utils/findInVertexArray.js +25 -0
  747. package/src/_esm/src/ts/utils/findInVertexArray.js.map +1 -0
  748. package/src/_esm/src/ts/utils/gup.d.ts +14 -0
  749. package/src/_esm/src/ts/utils/gup.js +27 -0
  750. package/src/_esm/src/ts/utils/gup.js.map +1 -0
  751. package/src/_esm/src/ts/utils/helpers/BezierPathInteractionHelper.d.ts +272 -0
  752. package/src/_esm/src/ts/utils/helpers/BezierPathInteractionHelper.js +648 -0
  753. package/src/_esm/src/ts/utils/helpers/BezierPathInteractionHelper.js.map +1 -0
  754. package/src/_esm/src/ts/utils/helpers/CircleHelper.d.ts +73 -0
  755. package/src/_esm/src/ts/utils/helpers/CircleHelper.js +88 -0
  756. package/src/_esm/src/ts/utils/helpers/CircleHelper.js.map +1 -0
  757. package/src/_esm/src/ts/utils/helpers/CircleSectorHelper.d.ts +90 -0
  758. package/src/_esm/src/ts/utils/helpers/CircleSectorHelper.js +109 -0
  759. package/src/_esm/src/ts/utils/helpers/CircleSectorHelper.js.map +1 -0
  760. package/src/_esm/src/ts/utils/helpers/TriangleHelper.d.ts +57 -0
  761. package/src/_esm/src/ts/utils/helpers/TriangleHelper.js +78 -0
  762. package/src/_esm/src/ts/utils/helpers/TriangleHelper.js.map +1 -0
  763. package/src/_esm/src/ts/utils/helpers/VEllipseHelper.d.ts +32 -0
  764. package/src/_esm/src/ts/utils/helpers/VEllipseHelper.js +83 -0
  765. package/src/_esm/src/ts/utils/helpers/VEllipseHelper.js.map +1 -0
  766. package/src/_esm/src/ts/utils/helpers/VEllipseSectorHelper.d.ts +52 -0
  767. package/src/_esm/src/ts/utils/helpers/VEllipseSectorHelper.js +130 -0
  768. package/src/_esm/src/ts/utils/helpers/VEllipseSectorHelper.js.map +1 -0
  769. package/src/_esm/src/ts/utils/io/FileDrop.d.ts +110 -0
  770. package/src/_esm/src/ts/utils/io/FileDrop.js +171 -0
  771. package/src/_esm/src/ts/utils/io/FileDrop.js.map +1 -0
  772. package/src/_esm/src/ts/utils/parsers/LinearColorGradientParser.d.ts +78 -0
  773. package/src/_esm/src/ts/utils/parsers/LinearColorGradientParser.js +217 -0
  774. package/src/_esm/src/ts/utils/parsers/LinearColorGradientParser.js.map +1 -0
  775. package/src/_esm/src/ts/utils/parsers/OBJParser.d.ts +24 -0
  776. package/src/_esm/src/ts/utils/parsers/OBJParser.js +72 -0
  777. package/src/_esm/src/ts/utils/parsers/OBJParser.js.map +1 -0
  778. package/src/_esm/src/ts/utils/parsers/STLParser.d.ts +61 -0
  779. package/src/_esm/src/ts/utils/parsers/STLParser.js +175 -0
  780. package/src/_esm/src/ts/utils/parsers/STLParser.js.map +1 -0
  781. package/src/_esm/src/ts/utils/parsers/svg/parseSVGPathData.d.ts +27 -0
  782. package/src/_esm/src/ts/utils/parsers/svg/parseSVGPathData.js +482 -0
  783. package/src/_esm/src/ts/utils/parsers/svg/parseSVGPathData.js.map +1 -0
  784. package/src/_esm/src/ts/utils/parsers/svg/splitSVGPathData.d.ts +20 -0
  785. package/src/_esm/src/ts/utils/parsers/svg/splitSVGPathData.js +49 -0
  786. package/src/_esm/src/ts/utils/parsers/svg/splitSVGPathData.js.map +1 -0
  787. package/src/_esm/src/ts/utils/parsers/svg/types.d.ts +63 -0
  788. package/src/_esm/src/ts/utils/parsers/svg/types.js +16 -0
  789. package/src/_esm/src/ts/utils/parsers/svg/types.js.map +1 -0
  790. package/src/_esm/utils/InitializationObserver.d.ts +18 -0
  791. package/src/_esm/utils/InitializationObserver.js +61 -0
  792. package/src/_esm/utils/InitializationObserver.js.map +1 -0
  793. package/src/_esm/utils/LissajousFigure.d.ts +34 -0
  794. package/src/_esm/utils/LissajousFigure.js +99 -0
  795. package/src/_esm/utils/LissajousFigure.js.map +1 -0
  796. package/src/_esm/utils/NGons.d.ts +13 -0
  797. package/src/_esm/utils/NGons.js +36 -0
  798. package/src/_esm/utils/NGons.js.map +1 -0
  799. package/src/_esm/utils/Params.d.ts +17 -0
  800. package/src/_esm/utils/Params.js +52 -0
  801. package/src/_esm/utils/Params.js.map +1 -0
  802. package/src/_esm/utils/PerlinNoise.d.ts +19 -0
  803. package/src/_esm/utils/PerlinNoise.js +350 -0
  804. package/src/_esm/utils/PerlinNoise.js.map +1 -0
  805. package/src/_esm/utils/SVGPathUtils.d.ts +22 -0
  806. package/src/_esm/utils/SVGPathUtils.js +45 -0
  807. package/src/_esm/utils/SVGPathUtils.js.map +1 -0
  808. package/src/_esm/utils/WebColors.d.ts +35 -0
  809. package/src/_esm/utils/WebColors.js +58 -0
  810. package/src/_esm/utils/WebColors.js.map +1 -0
  811. package/src/_esm/utils/WebColorsContrast.d.ts +6 -0
  812. package/src/_esm/utils/WebColorsContrast.js +12 -0
  813. package/src/_esm/utils/WebColorsContrast.js.map +1 -0
  814. package/src/_esm/utils/WebColorsMalachite.d.ts +12 -0
  815. package/src/_esm/utils/WebColorsMalachite.js +28 -0
  816. package/src/_esm/utils/WebColorsMalachite.js.map +1 -0
  817. package/src/_esm/utils/algorithms/CatmullRomPath.d.ts +60 -0
  818. package/src/_esm/utils/algorithms/CatmullRomPath.js +107 -0
  819. package/src/_esm/utils/algorithms/CatmullRomPath.js.map +1 -0
  820. package/src/_esm/utils/algorithms/CircleIntersections.d.ts +170 -0
  821. package/src/_esm/utils/algorithms/CircleIntersections.js +307 -0
  822. package/src/_esm/utils/algorithms/CircleIntersections.js.map +1 -0
  823. package/src/_esm/utils/algorithms/ContourLineDetection.d.ts +150 -0
  824. package/src/_esm/utils/algorithms/ContourLineDetection.js +366 -0
  825. package/src/_esm/utils/algorithms/ContourLineDetection.js.map +1 -0
  826. package/src/_esm/utils/algorithms/CubicSplinePath.d.ts +63 -0
  827. package/src/_esm/utils/algorithms/CubicSplinePath.js +174 -0
  828. package/src/_esm/utils/algorithms/CubicSplinePath.js.map +1 -0
  829. package/src/_esm/utils/algorithms/HobbyPath.d.ts +81 -0
  830. package/src/_esm/utils/algorithms/HobbyPath.js +277 -0
  831. package/src/_esm/utils/algorithms/HobbyPath.js.map +1 -0
  832. package/src/_esm/utils/algorithms/Metaballs.d.ts +30 -0
  833. package/src/_esm/utils/algorithms/Metaballs.js +113 -0
  834. package/src/_esm/utils/algorithms/Metaballs.js.map +1 -0
  835. package/src/_esm/utils/algorithms/PolygonInset.d.ts +184 -0
  836. package/src/_esm/utils/algorithms/PolygonInset.js +428 -0
  837. package/src/_esm/utils/algorithms/PolygonInset.js.map +1 -0
  838. package/src/_esm/utils/algorithms/PolygonTesselationOutlines.d.ts +145 -0
  839. package/src/_esm/utils/algorithms/PolygonTesselationOutlines.js +267 -0
  840. package/src/_esm/utils/algorithms/PolygonTesselationOutlines.js.map +1 -0
  841. package/src/_esm/utils/algorithms/arrayFill.d.ts +8 -0
  842. package/src/_esm/utils/algorithms/arrayFill.js +18 -0
  843. package/src/_esm/utils/algorithms/arrayFill.js.map +1 -0
  844. package/src/_esm/utils/algorithms/arrayResize.d.ts +8 -0
  845. package/src/_esm/utils/algorithms/arrayResize.js +24 -0
  846. package/src/_esm/utils/algorithms/arrayResize.js.map +1 -0
  847. package/src/_esm/utils/algorithms/arrayShuffle.d.ts +8 -0
  848. package/src/_esm/utils/algorithms/arrayShuffle.js +15 -0
  849. package/src/_esm/utils/algorithms/arrayShuffle.js.map +1 -0
  850. package/src/_esm/utils/algorithms/clearDuplicateVertices.d.ts +22 -0
  851. package/src/_esm/utils/algorithms/clearDuplicateVertices.js +51 -0
  852. package/src/_esm/utils/algorithms/clearDuplicateVertices.js.map +1 -0
  853. package/src/_esm/utils/algorithms/clearPolygonDuplicateVertices.d.ts +24 -0
  854. package/src/_esm/utils/algorithms/clearPolygonDuplicateVertices.js +61 -0
  855. package/src/_esm/utils/algorithms/clearPolygonDuplicateVertices.js.map +1 -0
  856. package/src/_esm/utils/algorithms/convexHull.d.ts +23 -0
  857. package/src/_esm/utils/algorithms/convexHull.js +71 -0
  858. package/src/_esm/utils/algorithms/convexHull.js.map +1 -0
  859. package/src/_esm/utils/algorithms/convexPolygonIncircle.d.ts +41 -0
  860. package/src/_esm/utils/algorithms/convexPolygonIncircle.js +145 -0
  861. package/src/_esm/utils/algorithms/convexPolygonIncircle.js.map +1 -0
  862. package/src/_esm/utils/algorithms/createRandomizedPolygon.d.ts +14 -0
  863. package/src/_esm/utils/algorithms/createRandomizedPolygon.js +28 -0
  864. package/src/_esm/utils/algorithms/createRandomizedPolygon.js.map +1 -0
  865. package/src/_esm/utils/algorithms/delaunay.d.ts +30 -0
  866. package/src/_esm/utils/algorithms/delaunay.js +157 -0
  867. package/src/_esm/utils/algorithms/delaunay.js.map +1 -0
  868. package/src/_esm/utils/algorithms/delaunay2voronoi.d.ts +25 -0
  869. package/src/_esm/utils/algorithms/delaunay2voronoi.js +103 -0
  870. package/src/_esm/utils/algorithms/delaunay2voronoi.js.map +1 -0
  871. package/src/_esm/utils/algorithms/detectPaths.d.ts +21 -0
  872. package/src/_esm/utils/algorithms/detectPaths.js +169 -0
  873. package/src/_esm/utils/algorithms/detectPaths.js.map +1 -0
  874. package/src/_esm/utils/algorithms/findPolygonSelfIntersections.d.ts +21 -0
  875. package/src/_esm/utils/algorithms/findPolygonSelfIntersections.js +51 -0
  876. package/src/_esm/utils/algorithms/findPolygonSelfIntersections.js.map +1 -0
  877. package/src/_esm/utils/algorithms/getContrastColor.d.ts +13 -0
  878. package/src/_esm/utils/algorithms/getContrastColor.js +26 -0
  879. package/src/_esm/utils/algorithms/getContrastColor.js.map +1 -0
  880. package/src/_esm/utils/algorithms/matrixFill.d.ts +10 -0
  881. package/src/_esm/utils/algorithms/matrixFill.js +21 -0
  882. package/src/_esm/utils/algorithms/matrixFill.js.map +1 -0
  883. package/src/_esm/utils/algorithms/pixelCornersToRoundPaths.d.ts +23 -0
  884. package/src/_esm/utils/algorithms/pixelCornersToRoundPaths.js +270 -0
  885. package/src/_esm/utils/algorithms/pixelCornersToRoundPaths.js.map +1 -0
  886. package/src/_esm/utils/algorithms/splitPolygonToNonIntersecting.d.ts +28 -0
  887. package/src/_esm/utils/algorithms/splitPolygonToNonIntersecting.js +102 -0
  888. package/src/_esm/utils/algorithms/splitPolygonToNonIntersecting.js.map +1 -0
  889. package/src/_esm/utils/algorithms/sutherlandHodgman.d.ts +16 -0
  890. package/src/_esm/utils/algorithms/sutherlandHodgman.js +76 -0
  891. package/src/_esm/utils/algorithms/sutherlandHodgman.js.map +1 -0
  892. package/src/_esm/utils/cloneVertexArray.d.ts +13 -0
  893. package/src/_esm/utils/cloneVertexArray.js +23 -0
  894. package/src/_esm/utils/cloneVertexArray.js.map +1 -0
  895. package/src/_esm/utils/createRandomizedPolygon.d.ts +14 -0
  896. package/src/_esm/utils/createRandomizedPolygon.js +32 -0
  897. package/src/_esm/utils/createRandomizedPolygon.js.map +1 -0
  898. package/src/_esm/utils/datastructures/CircularIntervalSet.d.ts +83 -0
  899. package/src/_esm/utils/datastructures/CircularIntervalSet.js +162 -0
  900. package/src/_esm/utils/datastructures/CircularIntervalSet.js.map +1 -0
  901. package/src/_esm/utils/datastructures/Color.d.ts +391 -0
  902. package/src/_esm/utils/datastructures/Color.js +1067 -0
  903. package/src/_esm/utils/datastructures/Color.js.map +1 -0
  904. package/src/_esm/utils/datastructures/ColorGradient.d.ts +81 -0
  905. package/src/_esm/utils/datastructures/ColorGradient.js +175 -0
  906. package/src/_esm/utils/datastructures/ColorGradient.js.map +1 -0
  907. package/src/_esm/utils/datastructures/DataGrid2d.d.ts +53 -0
  908. package/src/_esm/utils/datastructures/DataGrid2d.js +20 -0
  909. package/src/_esm/utils/datastructures/DataGrid2d.js.map +1 -0
  910. package/src/_esm/utils/datastructures/DataGrid2dArrayMatrix.d.ts +88 -0
  911. package/src/_esm/utils/datastructures/DataGrid2dArrayMatrix.js +154 -0
  912. package/src/_esm/utils/datastructures/DataGrid2dArrayMatrix.js.map +1 -0
  913. package/src/_esm/utils/datastructures/DataGrid2dListAdapter.d.ts +59 -0
  914. package/src/_esm/utils/datastructures/DataGrid2dListAdapter.js +83 -0
  915. package/src/_esm/utils/datastructures/DataGrid2dListAdapter.js.map +1 -0
  916. package/src/_esm/utils/datastructures/GenericPath.d.ts +86 -0
  917. package/src/_esm/utils/datastructures/GenericPath.js +121 -0
  918. package/src/_esm/utils/datastructures/GenericPath.js.map +1 -0
  919. package/src/_esm/utils/datastructures/GeometryMesh.d.ts +49 -0
  920. package/src/_esm/utils/datastructures/GeometryMesh.js +57 -0
  921. package/src/_esm/utils/datastructures/GeometryMesh.js.map +1 -0
  922. package/src/_esm/utils/datastructures/Girih.d.ts +181 -0
  923. package/src/_esm/utils/datastructures/Girih.js +265 -0
  924. package/src/_esm/utils/datastructures/Girih.js.map +1 -0
  925. package/src/_esm/utils/datastructures/GirihBowtie.d.ts +37 -0
  926. package/src/_esm/utils/datastructures/GirihBowtie.js +134 -0
  927. package/src/_esm/utils/datastructures/GirihBowtie.js.map +1 -0
  928. package/src/_esm/utils/datastructures/GirihDecagon.d.ts +52 -0
  929. package/src/_esm/utils/datastructures/GirihDecagon.js +114 -0
  930. package/src/_esm/utils/datastructures/GirihDecagon.js.map +1 -0
  931. package/src/_esm/utils/datastructures/GirihHexagon.d.ts +39 -0
  932. package/src/_esm/utils/datastructures/GirihHexagon.js +182 -0
  933. package/src/_esm/utils/datastructures/GirihHexagon.js.map +1 -0
  934. package/src/_esm/utils/datastructures/GirihPenroseRhombus.d.ts +46 -0
  935. package/src/_esm/utils/datastructures/GirihPenroseRhombus.js +171 -0
  936. package/src/_esm/utils/datastructures/GirihPenroseRhombus.js.map +1 -0
  937. package/src/_esm/utils/datastructures/GirihPentagon.d.ts +37 -0
  938. package/src/_esm/utils/datastructures/GirihPentagon.js +91 -0
  939. package/src/_esm/utils/datastructures/GirihPentagon.js.map +1 -0
  940. package/src/_esm/utils/datastructures/GirihRhombus.d.ts +38 -0
  941. package/src/_esm/utils/datastructures/GirihRhombus.js +137 -0
  942. package/src/_esm/utils/datastructures/GirihRhombus.js.map +1 -0
  943. package/src/_esm/utils/datastructures/GirihTile.d.ts +283 -0
  944. package/src/_esm/utils/datastructures/GirihTile.js +290 -0
  945. package/src/_esm/utils/datastructures/GirihTile.js.map +1 -0
  946. package/src/_esm/utils/datastructures/Matrix4x4.d.ts +244 -0
  947. package/src/_esm/utils/datastructures/Matrix4x4.js +250 -0
  948. package/src/_esm/utils/datastructures/Matrix4x4.js.map +1 -0
  949. package/src/_esm/utils/datastructures/VoronoiCell.d.ts +122 -0
  950. package/src/_esm/utils/datastructures/VoronoiCell.js +182 -0
  951. package/src/_esm/utils/datastructures/VoronoiCell.js.map +1 -0
  952. package/src/_esm/utils/datastructures/interfaces.d.ts +13 -0
  953. package/src/_esm/utils/datastructures/interfaces.js +10 -0
  954. package/src/_esm/utils/datastructures/interfaces.js.map +1 -0
  955. package/src/_esm/utils/detectDarkMode.d.ts +10 -0
  956. package/src/_esm/utils/detectDarkMode.js +41 -0
  957. package/src/_esm/utils/detectDarkMode.js.map +1 -0
  958. package/src/_esm/utils/dom/components/ColorGradientPicker.d.ts +246 -0
  959. package/src/_esm/utils/dom/components/ColorGradientPicker.js +780 -0
  960. package/src/_esm/utils/dom/components/ColorGradientPicker.js.map +1 -0
  961. package/src/_esm/utils/dom/components/ColorGradientPickerJSX.d.ts +129 -0
  962. package/src/_esm/utils/dom/components/ColorGradientPickerJSX.js +582 -0
  963. package/src/_esm/utils/dom/components/ColorGradientPickerJSX.js.map +1 -0
  964. package/src/_esm/utils/dom/components/ColorGradientSelector.d.ts +118 -0
  965. package/src/_esm/utils/dom/components/ColorGradientSelector.js +376 -0
  966. package/src/_esm/utils/dom/components/ColorGradientSelector.js.map +1 -0
  967. package/src/_esm/utils/dom/components/Test.d.ts +7 -0
  968. package/src/_esm/utils/dom/components/Test.js +63 -0
  969. package/src/_esm/utils/dom/components/Test.js.map +1 -0
  970. package/src/_esm/utils/dom/getAvailableContainerSpace.d.ts +2 -0
  971. package/src/_esm/utils/dom/getAvailableContainerSpace.js +29 -0
  972. package/src/_esm/utils/dom/getAvailableContainerSpace.js.map +1 -0
  973. package/src/_esm/utils/dom/getFProp.d.ts +5 -0
  974. package/src/_esm/utils/dom/getFProp.js +12 -0
  975. package/src/_esm/utils/dom/getFProp.js.map +1 -0
  976. package/src/_esm/utils/dom/guiSizeToggler.d.ts +18 -0
  977. package/src/_esm/utils/dom/guiSizeToggler.js +44 -0
  978. package/src/_esm/utils/dom/guiSizeToggler.js.map +1 -0
  979. package/src/_esm/utils/findInVertexArray.d.ts +19 -0
  980. package/src/_esm/utils/findInVertexArray.js +29 -0
  981. package/src/_esm/utils/findInVertexArray.js.map +1 -0
  982. package/src/_esm/utils/getFProp.d.ts +5 -0
  983. package/src/_esm/utils/getFProp.js +8 -0
  984. package/src/_esm/utils/getFProp.js.map +1 -0
  985. package/src/_esm/utils/gup.d.ts +14 -0
  986. package/src/_esm/utils/gup.js +31 -0
  987. package/src/_esm/utils/gup.js.map +1 -0
  988. package/src/_esm/utils/helpers/BezierPathInteractionHelper.d.ts +272 -0
  989. package/src/_esm/utils/helpers/BezierPathInteractionHelper.js +655 -0
  990. package/src/_esm/utils/helpers/BezierPathInteractionHelper.js.map +1 -0
  991. package/src/_esm/utils/helpers/CircleHelper.d.ts +73 -0
  992. package/src/_esm/utils/helpers/CircleHelper.js +92 -0
  993. package/src/_esm/utils/helpers/CircleHelper.js.map +1 -0
  994. package/src/_esm/utils/helpers/CircleSectorHelper.d.ts +90 -0
  995. package/src/_esm/utils/helpers/CircleSectorHelper.js +113 -0
  996. package/src/_esm/utils/helpers/CircleSectorHelper.js.map +1 -0
  997. package/src/_esm/utils/helpers/TriangleHelper.d.ts +57 -0
  998. package/src/_esm/utils/helpers/TriangleHelper.js +82 -0
  999. package/src/_esm/utils/helpers/TriangleHelper.js.map +1 -0
  1000. package/src/_esm/utils/helpers/VEllipseHelper.d.ts +32 -0
  1001. package/src/_esm/utils/helpers/VEllipseHelper.js +87 -0
  1002. package/src/_esm/utils/helpers/VEllipseHelper.js.map +1 -0
  1003. package/src/_esm/utils/helpers/VEllipseSectorHelper.d.ts +52 -0
  1004. package/src/_esm/utils/helpers/VEllipseSectorHelper.js +134 -0
  1005. package/src/_esm/utils/helpers/VEllipseSectorHelper.js.map +1 -0
  1006. package/src/_esm/utils/io/DndFileHandler.d.ts +63 -0
  1007. package/src/_esm/utils/io/DndFileHandler.js +106 -0
  1008. package/src/_esm/utils/io/DndFileHandler.js.map +1 -0
  1009. package/src/_esm/utils/io/FileDrop.d.ts +110 -0
  1010. package/src/_esm/utils/io/FileDrop.js +175 -0
  1011. package/src/_esm/utils/io/FileDrop.js.map +1 -0
  1012. package/src/_esm/utils/parsers/LinearColorGradientParser.d.ts +78 -0
  1013. package/src/_esm/utils/parsers/LinearColorGradientParser.js +223 -0
  1014. package/src/_esm/utils/parsers/LinearColorGradientParser.js.map +1 -0
  1015. package/src/_esm/utils/parsers/OBJParser.d.ts +25 -0
  1016. package/src/_esm/utils/parsers/OBJParser.js +78 -0
  1017. package/src/_esm/utils/parsers/OBJParser.js.map +1 -0
  1018. package/src/_esm/utils/parsers/STLParser.d.ts +61 -0
  1019. package/src/_esm/utils/parsers/STLParser.js +179 -0
  1020. package/src/_esm/utils/parsers/STLParser.js.map +1 -0
  1021. package/src/_esm/utils/parsers/svg/parseSVGPathData.d.ts +27 -0
  1022. package/src/_esm/utils/parsers/svg/parseSVGPathData.js +486 -0
  1023. package/src/_esm/utils/parsers/svg/parseSVGPathData.js.map +1 -0
  1024. package/src/_esm/utils/parsers/svg/splitSVGPathData.d.ts +20 -0
  1025. package/src/_esm/utils/parsers/svg/splitSVGPathData.js +53 -0
  1026. package/src/_esm/utils/parsers/svg/splitSVGPathData.js.map +1 -0
  1027. package/src/_esm/utils/parsers/svg/types.d.ts +63 -0
  1028. package/src/_esm/utils/parsers/svg/types.js +17 -0
  1029. package/src/_esm/utils/parsers/svg/types.js.map +1 -0
  1030. package/src/cjs/PlotBoilerplate.d.ts +11 -1
  1031. package/src/cjs/PlotBoilerplate.js +23 -7
  1032. package/src/cjs/PlotBoilerplate.js.map +1 -1
  1033. package/src/cjs/VertexListeners.d.ts +2 -1
  1034. package/src/cjs/VertexListeners.js +5 -1
  1035. package/src/cjs/VertexListeners.js.map +1 -1
  1036. package/src/cjs/draw.d.ts +18 -2
  1037. package/src/cjs/draw.js +21 -2
  1038. package/src/cjs/draw.js.map +1 -1
  1039. package/src/cjs/drawgl.d.ts +18 -3
  1040. package/src/cjs/drawgl.js +19 -2
  1041. package/src/cjs/drawgl.js.map +1 -1
  1042. package/src/cjs/drawutilssvg.d.ts +19 -1
  1043. package/src/cjs/drawutilssvg.js +28 -5
  1044. package/src/cjs/drawutilssvg.js.map +1 -1
  1045. package/src/cjs/interfaces/DrawLib.d.ts +18 -1
  1046. package/src/cjs/interfaces/DrawLib.js +2 -0
  1047. package/src/cjs/interfaces/DrawLib.js.map +1 -1
  1048. package/src/cjs/utils/Params.d.ts +3 -2
  1049. package/src/cjs/utils/Params.js +11 -3
  1050. package/src/cjs/utils/Params.js.map +1 -1
  1051. package/src/cjs/utils/WebColors.d.ts +2 -1
  1052. package/src/cjs/utils/WebColors.js +15 -2
  1053. package/src/cjs/utils/WebColors.js.map +1 -1
  1054. package/src/cjs/utils/algorithms/HobbyPath.js +13 -16
  1055. package/src/cjs/utils/algorithms/HobbyPath.js.map +1 -1
  1056. package/src/cjs/utils/helpers/BezierResizeHelper.d.ts +144 -0
  1057. package/src/cjs/utils/helpers/BezierResizeHelper.js +319 -0
  1058. package/src/cjs/utils/helpers/BezierResizeHelper.js.map +1 -0
  1059. package/src/esm/PlotBoilerplate.d.ts +11 -1
  1060. package/src/esm/PlotBoilerplate.js +23 -7
  1061. package/src/esm/PlotBoilerplate.js.map +1 -1
  1062. package/src/esm/VertexListeners.d.ts +2 -1
  1063. package/src/esm/VertexListeners.js +5 -1
  1064. package/src/esm/VertexListeners.js.map +1 -1
  1065. package/src/esm/draw.d.ts +18 -2
  1066. package/src/esm/draw.js +21 -2
  1067. package/src/esm/draw.js.map +1 -1
  1068. package/src/esm/drawgl.d.ts +18 -3
  1069. package/src/esm/drawgl.js +19 -2
  1070. package/src/esm/drawgl.js.map +1 -1
  1071. package/src/esm/drawutilssvg.d.ts +19 -1
  1072. package/src/esm/drawutilssvg.js +28 -5
  1073. package/src/esm/drawutilssvg.js.map +1 -1
  1074. package/src/esm/interfaces/DrawLib.d.ts +18 -1
  1075. package/src/esm/interfaces/DrawLib.js +2 -0
  1076. package/src/esm/interfaces/DrawLib.js.map +1 -1
  1077. package/src/esm/utils/Params.d.ts +3 -2
  1078. package/src/esm/utils/Params.js +11 -3
  1079. package/src/esm/utils/Params.js.map +1 -1
  1080. package/src/esm/utils/WebColors.d.ts +2 -1
  1081. package/src/esm/utils/WebColors.js +15 -2
  1082. package/src/esm/utils/WebColors.js.map +1 -1
  1083. package/src/esm/utils/algorithms/HobbyPath.js +13 -16
  1084. package/src/esm/utils/algorithms/HobbyPath.js.map +1 -1
  1085. package/src/esm/utils/helpers/BezierResizeHelper.d.ts +144 -0
  1086. package/src/esm/utils/helpers/BezierResizeHelper.js +314 -0
  1087. package/src/esm/utils/helpers/BezierResizeHelper.js.map +1 -0
  1088. package/src/ts/PlotBoilerplate.ts +37 -11
  1089. package/src/ts/VertexListeners.ts +5 -1
  1090. package/src/ts/draw.ts +32 -2
  1091. package/src/ts/drawgl.ts +38 -3
  1092. package/src/ts/drawutilssvg.ts +33 -6
  1093. package/src/ts/interfaces/DrawLib.ts +19 -1
  1094. package/src/ts/utils/Params.ts +11 -3
  1095. package/src/ts/utils/WebColors.ts +15 -2
  1096. package/src/ts/utils/algorithms/HobbyPath.ts +248 -272
  1097. package/src/ts/utils/helpers/BezierResizeHelper.ts +390 -0
  1098. /package/src/{cjs → _cjs}/utils/_gup.js_ +0 -0
@@ -0,0 +1,1701 @@
1
+ /**
2
+ * Draws elements into an SVG node.
3
+ *
4
+ * Note that this library uses buffers and draw cycles. To draw onto an SVG canvas, do this:
5
+ * const drawLib = new drawutilssvg( svgNode, ... );
6
+ * const fillLib = drawLib.copyInstance(true);
7
+ * // Begin draw cycle
8
+ * drawLib.beginDrawCycle(time);
9
+ * // ... draw or fill your stuff ...
10
+ * drawLib.endDrawCycle(time); // Here the elements become visible
11
+ *
12
+ * @author Ikaros Kappler
13
+ * @date 2021-01-03
14
+ * @modified 2021-01-24 Fixed the `fillShapes` attribute in the copyInstance function.
15
+ * @modified 2021-01-26 Changed the `isPrimary` (default true) attribute to `isSecondary` (default false).
16
+ * @modified 2021-02-03 Added the static `createSvg` function.
17
+ * @modified 2021-02-03 Fixed the currentId='background' bug on the clear() function.
18
+ * @modified 2021-02-03 Fixed CSSProperty `stroke-width` (was line-width before, which is wrong).
19
+ * @modified 2021-02-03 Added the static `HEAD_XML` attribute.
20
+ * @modified 2021-02-19 Added the static helper function `transformPathData(...)` for svg path transformations (scale and translate).
21
+ * @modified 2021-02-22 Added the static helper function `copyPathData(...)`.
22
+ * @modified 2021-02-22 Added the `path` drawing function to draw SVG path data.
23
+ * @modified 2021-03-01 Fixed a bug in the `clear` function (curClassName was not cleared).
24
+ * @modified 2021-03-29 Fixed a bug in the `text` function (second y param was wrong, used x here).
25
+ * @modified 2021-03-29 Moved this file from `src/ts/utils/helpers/` to `src/ts/`.
26
+ * @modified 2021-03-31 Added 'ellipseSector' the the class names.
27
+ * @modified 2021-03-31 Implemented buffering using a buffer <g> node and the beginDrawCycle and endDrawCycle methods.
28
+ * @modified 2021-05-31 Added the `setConfiguration` function from `DrawLib`.
29
+ * @modified 2021-11-15 Adding more parameters tot the `text()` function: fontSize, textAlign, fontFamily, lineHeight.
30
+ * @modified 2021-11-19 Fixing the `label(text,x,y)` position.
31
+ * @modified 2021-11-19 Added the `color` param to the `label(...)` function.
32
+ * @modified 2022-02-03 Added the `lineWidth` param to the `crosshair` function.
33
+ * @modified 2022-02-03 Added the `cross(...)` function.
34
+ * @modified 2022-03-26 Added the private `nodeDefs` and `bufferedNodeDefs` attributes.
35
+ * @modified 2022-03-26 Added the `texturedPoly` function to draw textures polygons.
36
+ * @modified 2022-07-26 Adding `alpha` to the `image(...)` function.
37
+ * @modified 2022-11-10 Tweaking some type issues.
38
+ * @modified 2023-02-04 Fixed a typo in the CSS classname for cubic Bézier paths: cubicBezier (was cubierBezier).
39
+ * @modified 2023-02-10 The methods `setCurrentClassName` and `setCurrentId` also accept `null` now.
40
+ * @modified 2023-09-29 Added initialization checks for null parameters.
41
+ * @modified 2023-09-29 Added a missing implementation to the `drawurilssvg.do(XYCoords,string)` function. Didn't draw anything.
42
+ * @modified 2023-09-29 Downgrading all `Vertex` param type to the more generic `XYCoords` type in these render functions: line, arrow, texturedPoly, cubicBezier, cubicBezierPath, handle, handleLine, dot, point, circle, circleArc, ellipse, grid, raster.
43
+ * @modified 2023-09-29 Added the `headLength` parameter to the 'DrawLib.arrow()` function.
44
+ * @modified 2023-09-29 Added the `arrowHead(...)` function to the 'DrawLib.arrow()` interface.
45
+ * @modified 2023-09-29 Added the `cubicBezierArrow(...)` function to the 'DrawLib.arrow()` interface.
46
+ * @modified 2023-10-04 Adding `strokeOptions` param to these draw function: line, arrow, cubicBezierArrow, cubicBezier, cubicBezierPath, circle, circleArc, ellipse, square, rect, polygon, polyline.
47
+ * @modified 2024-01-30 Fixing an issue with immutable style sets; changes to the global draw config did not reflect here (do now).
48
+ * @modified 2024-03-10 Fixing some types for Typescript 5 compatibility.
49
+ * @modified 2024-07-24 Caching custom style defs in a private buffer variable.
50
+ * @modified 2025-11-14 Fixing a bug in the CSS `mix-blend-mode` property handling (caused a runtime error).
51
+ * @modified 2026-01-04 Adding `lineJoin` attribute to the methods' `StrokeOptions` param.
52
+ * @modified 2026-01-04 Fixing missing `strokeOptions` param in the `drawutilssvg.polygon` method.
53
+ * @modified 2026-03-18 Adding `isOpen` parameter to `cubicBezierPath` draw method.
54
+ * @version 1.7.0
55
+ **/
56
+ import { CircleSector } from "./CircleSector";
57
+ import { CubicBezierCurve } from "./CubicBezierCurve";
58
+ import { Vertex } from "./Vertex";
59
+ import { UIDGenerator } from "./UIDGenerator";
60
+ import { Vector } from "./Vector";
61
+ const RAD_TO_DEG = 180 / Math.PI;
62
+ /**
63
+ * @classdesc A helper class for basic SVG drawing operations. This class should
64
+ * be compatible to the default 'draw' class.
65
+ *
66
+ * @requires CubicBzierCurvce
67
+ * @requires Polygon
68
+ * @requires Vertex
69
+ * @requires XYCoords
70
+ */
71
+ export class drawutilssvg {
72
+ /**
73
+ * Passed from primary to secondary instance.
74
+ */
75
+ //private nodeStyle: SVGStyleElement;
76
+ /**
77
+ * The constructor.
78
+ *
79
+ * @constructor
80
+ * @name drawutilssvg
81
+ * @param {SVGElement} svgNode - The SVG node to use.
82
+ * @param {XYCoords} offset - The draw offset to use.
83
+ * @param {XYCoords} scale - The scale factors to use.
84
+ * @param {XYDimension} canvasSize - The initial canvas size (use setSize to change).
85
+ * @param {boolean} fillShapes - Indicates if the constructed drawutils should fill all drawn shapes (if possible).
86
+ * @param {DrawConfig} drawConfig - The default draw config to use for CSS fallback styles.
87
+ * @param {boolean=} isSecondary - (optional) Indicates if this is the primary or secondary instance. Only primary instances manage child nodes.
88
+ * @param {SVGGElement=} gNode - (optional) Primary and seconday instances share the same &lt;g> node.
89
+ **/
90
+ constructor(svgNode, offset, scale, canvasSize, fillShapes, drawConfig, isSecondary, gNode, bufferGNode, nodeDefs, bufferNodeDefs, nodeStyle) {
91
+ this.svgNode = svgNode;
92
+ this.offset = new Vertex(0, 0).set(offset);
93
+ this.scale = new Vertex(1, 1).set(scale);
94
+ this.fillShapes = fillShapes;
95
+ this.isSecondary = Boolean(isSecondary);
96
+ this.drawConfig = drawConfig;
97
+ this.drawlibConfiguration = {};
98
+ this.cache = new Map();
99
+ this.setSize(canvasSize);
100
+ if (isSecondary) {
101
+ if (!gNode || !bufferGNode || !nodeDefs || !bufferNodeDefs) {
102
+ throw "Cannot create secondary svg draw lib with undefinde gNode|bufferGNode|nodeDefs|bufferNodeDefs.";
103
+ }
104
+ this.gNode = gNode;
105
+ this.bufferGNode = bufferGNode;
106
+ this.nodeDefs = nodeDefs;
107
+ this.bufferedNodeDefs = bufferNodeDefs;
108
+ if (nodeStyle) {
109
+ this.nodeStyle = nodeStyle;
110
+ }
111
+ }
112
+ else {
113
+ this.addStyleDefs(drawConfig);
114
+ this.addDefsNode();
115
+ this.gNode = this.createSVGNode("g");
116
+ this.bufferGNode = this.createSVGNode("g");
117
+ this.svgNode.appendChild(this.gNode);
118
+ }
119
+ }
120
+ /**
121
+ * Adds a default style defintion based on the passed DrawConfig.
122
+ * Twaek the draw config to change default colors or line thicknesses.
123
+ *
124
+ * @param {DrawConfig} drawConfig
125
+ */
126
+ addStyleDefs(drawConfig) {
127
+ this.nodeStyle = this.createSVGNode("style");
128
+ this.svgNode.appendChild(this.nodeStyle);
129
+ this.rebuildStyleDefs(drawConfig);
130
+ }
131
+ /**
132
+ * This method is required to re-define the global style defs. It is needed
133
+ * if any value in the DrawConfig changed in the meantime.
134
+ * @param drawConfig
135
+ */
136
+ rebuildStyleDefs(drawConfig) {
137
+ // Which default styles to add? -> All from the DrawConfig.
138
+ // Compare with DrawConfig interface
139
+ const keys = {
140
+ "bezier": "CubicBezierCurve",
141
+ //"bezierPath": "BezierPath", // TODO: is this correct?
142
+ "polygon": "Polygon",
143
+ "triangle": "Triangle",
144
+ "ellipse": "Ellipse",
145
+ "ellipseSector": "EllipseSector",
146
+ "circle": "Circle",
147
+ "circleSector": "CircleSector",
148
+ "vertex": "Vertex",
149
+ "line": "Line",
150
+ "vector": "Vector",
151
+ "image": "Image",
152
+ "text": "Text"
153
+ };
154
+ // Question: why isn't this working if the svgNode is created dynamically? (nodeStyle.sheet is null)
155
+ const rules = [];
156
+ // console.log("drawConfig", drawConfig);
157
+ for (var k in keys) {
158
+ const className = keys[k];
159
+ const drawSettings = drawConfig[k];
160
+ if (drawSettings) {
161
+ rules.push(`.${className} { fill : none; stroke: ${drawSettings.color}; stroke-width: ${drawSettings.lineWidth}px }`);
162
+ }
163
+ else {
164
+ console.warn(`Warning: your draw config is missing the key '${k}' which is required.`);
165
+ }
166
+ }
167
+ if (this.customStyleDefs) {
168
+ rules.push("\n/* Custom styles */\n");
169
+ this.customStyleDefs.forEach((value, key) => {
170
+ rules.push(key + " { " + value + " }");
171
+ });
172
+ // this.nodeStyle.innerHTML += "\n/* Custom styles */\n" + rules.join("\n");
173
+ }
174
+ this.nodeStyle.innerHTML = rules.join("\n");
175
+ }
176
+ /**
177
+ * Adds the internal <defs> node.
178
+ */
179
+ addDefsNode() {
180
+ this.nodeDefs = this.createSVGNode("defs");
181
+ // this.svgNode.appendChild(this.nodeDefs);
182
+ this.bufferedNodeDefs = this.createSVGNode("defs");
183
+ this.svgNode.appendChild(this.nodeDefs);
184
+ }
185
+ /**
186
+ * This is a simple way to include custom CSS class mappings to the style defs of the generated SVG.
187
+ *
188
+ * The mapping should be of the form
189
+ * [style-class] -> [style-def-string]
190
+ *
191
+ * Example:
192
+ * "rect.red" -> "fill: #ff0000; border: 1px solid red"
193
+ *
194
+ * @param {Map<string,string>} defs
195
+ */
196
+ addCustomStyleDefs(defs) {
197
+ this.customStyleDefs = defs;
198
+ }
199
+ /**
200
+ * Retieve an old (cached) element.
201
+ * Only if both – key and nodeName – match, the element will be returned (null otherwise).
202
+ *
203
+ * @method findElement
204
+ * @private
205
+ * @memberof drawutilssvg
206
+ * @instance
207
+ * @param {UID} key - The key of the desired element (used when re-drawing).
208
+ * @param {string} nodeName - The expected node name.
209
+ */
210
+ findElement(key, nodeName) {
211
+ if (!key) {
212
+ return null;
213
+ }
214
+ var node = this.cache.get(key);
215
+ if (node && node.nodeName.toUpperCase() === nodeName.toUpperCase()) {
216
+ this.cache.delete(key);
217
+ return node;
218
+ }
219
+ return null;
220
+ }
221
+ /**
222
+ * Create a new DOM node &lt;svg&gt; in the SVG namespace.
223
+ *
224
+ * @method createSVGNode
225
+ * @private
226
+ * @memberof drawutilssvg
227
+ * @instance
228
+ * @param {string} nodeName - The node name (tag-name).
229
+ * @return {SVGElement} A new element in the SVG namespace with the given node name.
230
+ */
231
+ createSVGNode(nodeName) {
232
+ return document.createElementNS("http://www.w3.org/2000/svg", nodeName);
233
+ }
234
+ /**
235
+ * Make a new SVG node (or recycle an old one) with the given node name (circle, path, line, rect, ...).
236
+ *
237
+ * This function is used in draw cycles to re-use old DOM nodes (in hope to boost performance).
238
+ *
239
+ * @method makeNode
240
+ * @private
241
+ * @instance
242
+ * @memberof drawutilssvg
243
+ * @param {string} nodeName - The node name.
244
+ * @return {SVGElement} The new node, which is not yet added to any document.
245
+ */
246
+ makeNode(nodeName) {
247
+ // Try to find node in current DOM cache.
248
+ // Unique node keys are strictly necessary.
249
+ // Try to recycle an old element from cache.
250
+ var node = this.findElement(this.curId, nodeName);
251
+ if (!node) {
252
+ // If no such old elements exists (key not found, tag name not matching),
253
+ // then create a new one.
254
+ node = this.createSVGNode(nodeName);
255
+ }
256
+ if (this.drawlibConfiguration.blendMode) {
257
+ const blendMode = node.style["mix-blend-mode"];
258
+ if (typeof blendMode === "function") {
259
+ blendMode(this.drawlibConfiguration.blendMode);
260
+ }
261
+ else {
262
+ node.style["mix-blend-mode"] = this.drawlibConfiguration.blendMode;
263
+ }
264
+ }
265
+ // if (this.lineDashEnabled && this.lineDash && this.lineDash.length > 0 && drawutilssvg.nodeSupportsLineDash(nodeName)) {
266
+ // node.setAttribute("stroke-dasharray", this.lineDash.join(" "));
267
+ // }
268
+ return node;
269
+ }
270
+ /**
271
+ * This is the final helper function for drawing and filling stuff and binding new
272
+ * nodes to the SVG document.
273
+ * It is not intended to be used from the outside.
274
+ *
275
+ * When in draw mode it draws the current shape.
276
+ * When in fill mode it fills the current shape.
277
+ *
278
+ * This function is usually only called internally.
279
+ *
280
+ * @method _bindFillDraw
281
+ * @private
282
+ * @instance
283
+ * @memberof drawutilssvg
284
+ * @param {SVGElement} node - The node to draw/fill and bind.
285
+ * @param {string} className - The class name(s) to use.
286
+ * @param {string} color - A stroke/fill color to use.
287
+ * @param {number=1} lineWidth - (optional) A line width to use for drawing (default is 1).
288
+ * @return {SVGElement} The node itself (for chaining).
289
+ */
290
+ _bindFillDraw(node, className, color, lineWidth, strokeOptions) {
291
+ this._configureNode(node, className, this.fillShapes, color, lineWidth, strokeOptions);
292
+ return this._bindNode(node, undefined);
293
+ }
294
+ /**
295
+ * Bind this given node to a parent. If no parent is passed then the global
296
+ * node buffer will be used.
297
+ *
298
+ * @method _bindNode
299
+ * @private
300
+ * @instance
301
+ * @memberof drawutilssvg
302
+ * @param {SVGElement} node - The SVG node to bind.
303
+ * @param {SVGElement=} bindingParent - (optional) You may pass node other than the glober buffer node.
304
+ * @returns {SVGElement} The passed node itself.
305
+ */
306
+ _bindNode(node, bindingParent) {
307
+ if (!node.parentNode) {
308
+ // Attach to DOM only if not already attached
309
+ (bindingParent !== null && bindingParent !== void 0 ? bindingParent : this.bufferGNode).appendChild(node);
310
+ }
311
+ return node;
312
+ }
313
+ /**
314
+ * Add custom CSS class names and the globally defined CSS classname to the
315
+ * given node.
316
+ *
317
+ * @method addCSSClasses
318
+ * @private
319
+ * @instance
320
+ * @memberof drawutilssvg
321
+ * @param {SVGElement} node - The SVG node to bind.
322
+ * @param {string} className - The additional custom classname to add.
323
+ * @returns {void}
324
+ */
325
+ _addCSSClasses(node, className) {
326
+ if (this.curClassName) {
327
+ node.setAttribute("class", `${className} ${this.curClassName}`);
328
+ }
329
+ else {
330
+ node.setAttribute("class", className);
331
+ }
332
+ }
333
+ _configureNode(node, className, fillMode, color, lineWidth, strokeOptions) {
334
+ this._addCSSClasses(node, className);
335
+ node.setAttribute("fill", fillMode && color ? color : "none");
336
+ node.setAttribute("stroke", fillMode ? "none" : color || "none");
337
+ node.setAttribute("stroke-width", `${lineWidth || 1}`);
338
+ if (this.curId) {
339
+ node.setAttribute("id", `${this.curId}`); // Maybe React-style 'key' would be better?
340
+ }
341
+ this.applyStrokeOpts(node, strokeOptions);
342
+ return node;
343
+ }
344
+ /**
345
+ * Sets the size and view box of the document. Call this if canvas size changes.
346
+ *
347
+ * @method setSize
348
+ * @instance
349
+ * @memberof drawutilssvg
350
+ * @param {XYDimension} canvasSize - The new canvas size.
351
+ */
352
+ setSize(canvasSize) {
353
+ this.canvasSize = canvasSize;
354
+ this.svgNode.setAttribute("viewBox", `0 0 ${this.canvasSize.width} ${this.canvasSize.height}`);
355
+ this.svgNode.setAttribute("width", `${this.canvasSize.width}`);
356
+ this.svgNode.setAttribute("height", `${this.canvasSize.height}`);
357
+ }
358
+ /**
359
+ * Creates a 'shallow' (non deep) copy of this instance. This implies
360
+ * that under the hood the same gl context and gl program will be used.
361
+ */
362
+ copyInstance(fillShapes) {
363
+ var copy = new drawutilssvg(this.svgNode, this.offset, this.scale, this.canvasSize, fillShapes, this.drawConfig, // null as any as DrawConfig, // no DrawConfig – this will work as long as `isSecondary===true`
364
+ true, // isSecondary
365
+ this.gNode, this.bufferGNode, this.nodeDefs, this.bufferedNodeDefs, this.nodeStyle);
366
+ return copy;
367
+ }
368
+ /**
369
+ * Set the current drawlib configuration.
370
+ *
371
+ * @name setConfiguration
372
+ * @method
373
+ * @param {DrawLibConfiguration} configuration - The new configuration settings to use for the next render methods.
374
+ */
375
+ setConfiguration(configuration) {
376
+ this.drawlibConfiguration = configuration;
377
+ }
378
+ /**
379
+ * This method shouled be called each time the currently drawn `Drawable` changes.
380
+ * It is used by some libraries for identifying elemente on re-renders.
381
+ *
382
+ * @name setCurrentId
383
+ * @method
384
+ * @param {UID|null} uid - A UID identifying the currently drawn element(s).
385
+ * @instance
386
+ * @memberof drawutilssvg
387
+ **/
388
+ setCurrentId(uid) {
389
+ this.curId = uid;
390
+ }
391
+ /**
392
+ * This method shouled be called each time the currently drawn `Drawable` changes.
393
+ * Determine the class name for further usage here.
394
+ *
395
+ * @name setCurrentClassName
396
+ * @method
397
+ * @param {string|null} className - A class name for further custom use cases.
398
+ * @instance
399
+ * @memberof drawutilssvg
400
+ **/
401
+ setCurrentClassName(className) {
402
+ this.curClassName = className;
403
+ }
404
+ /**
405
+ * Called before each draw cycle.
406
+ * This is required for compatibility with other draw classes in the library.
407
+ *
408
+ * @name beginDrawCycle
409
+ * @method
410
+ * @param {UID=} uid - (optional) A UID identifying the currently drawn element(s).
411
+ * @instance
412
+ * @memberof drawutilssvg
413
+ **/
414
+ beginDrawCycle(renderTime) {
415
+ // Clear non-recycable elements from last draw cycle.
416
+ this.cache.clear();
417
+ // Clearing an SVG is equivalent to removing all its child elements.
418
+ for (var i = 0; i < this.bufferGNode.childNodes.length; i++) {
419
+ // Hide all nodes here. Don't throw them away.
420
+ // We can probably re-use them in the next draw cycle.
421
+ var child = this.bufferGNode.childNodes[i];
422
+ this.cache.set(child.getAttribute("id"), child);
423
+ }
424
+ this.removeAllChildNodes();
425
+ }
426
+ /**
427
+ * Called after each draw cycle.
428
+ *
429
+ * This is required for compatibility with other draw classes in the library (like drawgl).
430
+ *
431
+ * @name endDrawCycle
432
+ * @method
433
+ * @param {number} renderTime
434
+ * @instance
435
+ **/
436
+ endDrawCycle(renderTime) {
437
+ this.rebuildStyleDefs(this.drawConfig);
438
+ if (!this.isSecondary) {
439
+ // All elements are drawn into the buffer; they are NOT yet visible, not did the browser perform any
440
+ // layout updates.
441
+ // Replace the old <g>-node with the buffer node.
442
+ // https://stackoverflow.com/questions/27442464/how-to-update-a-svg-image-without-seeing-a-blinking
443
+ this.svgNode.replaceChild(this.bufferedNodeDefs, this.nodeDefs);
444
+ this.svgNode.replaceChild(this.bufferGNode, this.gNode);
445
+ }
446
+ const tmpGNode = this.gNode;
447
+ this.gNode = this.bufferGNode;
448
+ this.bufferGNode = tmpGNode;
449
+ const tmpDefsNode = this.nodeDefs;
450
+ this.nodeDefs = this.bufferedNodeDefs;
451
+ this.bufferedNodeDefs = tmpDefsNode;
452
+ }
453
+ /**
454
+ * A private helper method to apply stroke options to the current
455
+ * context.
456
+ * @param {StrokeOptions=} strokeOptions -
457
+ */
458
+ applyStrokeOpts(node, strokeOptions) {
459
+ // Set line dash options?
460
+ if (strokeOptions &&
461
+ strokeOptions.dashArray &&
462
+ strokeOptions.dashArray.length > 0 &&
463
+ drawutilssvg.nodeSupportsLineDash(node.tagName)) {
464
+ node.setAttribute("stroke-dasharray", strokeOptions.dashArray
465
+ .map((dashArayElem) => {
466
+ return dashArayElem * this.scale.x;
467
+ })
468
+ .join(" "));
469
+ if (strokeOptions.dashOffset) {
470
+ node.setAttribute("stroke-dashoffset", `${strokeOptions.dashOffset * this.scale.x}`);
471
+ }
472
+ }
473
+ // Set line join option?
474
+ if (strokeOptions && strokeOptions.lineJoin && drawutilssvg.nodeSupportsLineJoin(node.tagName)) {
475
+ node.setAttribute("stroke-linejoin", strokeOptions.lineJoin);
476
+ }
477
+ }
478
+ _x(x) {
479
+ return this.offset.x + this.scale.x * x;
480
+ }
481
+ _y(y) {
482
+ return this.offset.y + this.scale.y * y;
483
+ }
484
+ /**
485
+ * Draw the line between the given two points with the specified (CSS-) color.
486
+ *
487
+ * @method line
488
+ * @param {XYCoords} zA - The start point of the line.
489
+ * @param {XYCoords} zB - The end point of the line.
490
+ * @param {string} color - Any valid CSS color string.
491
+ * @param {number=1} lineWidth? - [optional] The line's width.
492
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
493
+ *
494
+ * @return {void}
495
+ * @instance
496
+ * @memberof drawutilssvg
497
+ **/
498
+ line(zA, zB, color, lineWidth, strokeOptions) {
499
+ // const line: SVGElement = this.makeNode("line");
500
+ // this.applyStrokeOpts(line, strokeOptions);
501
+ // line.setAttribute("x1", `${this._x(zA.x)}`);
502
+ // line.setAttribute("y1", `${this._y(zA.y)}`);
503
+ // line.setAttribute("x2", `${this._x(zB.x)}`);
504
+ // line.setAttribute("y2", `${this._y(zB.y)}`);
505
+ const line = this.makeLineNode(zA, zB, color, lineWidth, strokeOptions);
506
+ return this._bindFillDraw(line, "line", color, lineWidth || 1, strokeOptions);
507
+ }
508
+ /**
509
+ * Draw a line and an arrow at the end (zB) of the given line with the specified (CSS-) color.
510
+ *
511
+ * @method arrow
512
+ * @param {XYCoords} zA - The start point of the arrow-line.
513
+ * @param {XYCoords} zB - The end point of the arrow-line.
514
+ * @param {string} color - Any valid CSS color string.
515
+ * @param {number=} lineWidth - (optional) The line width to use; default is 1.
516
+ * @param {headLength=8} headLength - (optional) The length of the arrow head (default is 8 units).
517
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
518
+ *
519
+ * @return {void}
520
+ * @instance
521
+ * @memberof drawutilssvg
522
+ **/
523
+ arrow(zA, zB, color, lineWidth, headLength = 8, strokeOptions) {
524
+ const group = this.makeNode("g");
525
+ const arrowHeadBasePosition = { x: 0, y: 0 };
526
+ // Just create the child nodes, don't bind them to the root node.
527
+ const arrowHead = this.makeArrowHeadNode(zA, zB, color, lineWidth, headLength, undefined, arrowHeadBasePosition);
528
+ const line = this.makeLineNode(zA, arrowHeadBasePosition, color, lineWidth, strokeOptions);
529
+ group.appendChild(line);
530
+ group.appendChild(arrowHead);
531
+ this._addCSSClasses(group, "linear-arrow");
532
+ this._bindNode(group, undefined);
533
+ return group;
534
+ }
535
+ /**
536
+ * Draw a cubic Bézier curve and and an arrow at the end (endControlPoint) of the given line width the specified (CSS-) color and arrow size.
537
+ *
538
+ * @method cubicBezierArrow
539
+ * @param {XYCoords} startPoint - The start point of the cubic Bézier curve
540
+ * @param {XYCoords} endPoint - The end point the cubic Bézier curve.
541
+ * @param {XYCoords} startControlPoint - The start control point the cubic Bézier curve.
542
+ * @param {XYCoords} endControlPoint - The end control point the cubic Bézier curve.
543
+ * @param {string} color - The CSS color to draw the curve with.
544
+ * @param {number} lineWidth - (optional) The line width to use.
545
+ * @param {headLength=8} headLength - (optional) The length of the arrow head (default is 8 units).
546
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
547
+ *
548
+ * @return {void}
549
+ * @instance
550
+ * @memberof DrawLib
551
+ */
552
+ cubicBezierArrow(startPoint, endPoint, startControlPoint, endControlPoint, color, lineWidth, headLength = 8, strokeOptions) {
553
+ const group = this.makeNode("g");
554
+ // Just create the child nodes, don't bind them to the root node.
555
+ const arrowHeadBasePosition = new Vertex(0, 0);
556
+ const arrowHead = this.makeArrowHeadNode(endControlPoint, endPoint, color, lineWidth, headLength, undefined, arrowHeadBasePosition);
557
+ const diff = arrowHeadBasePosition.difference(endPoint);
558
+ const bezier = this.makeCubicBezierNode(startPoint, { x: endPoint.x - diff.x, y: endPoint.y - diff.y }, startControlPoint, { x: endControlPoint.x - diff.x, y: endControlPoint.y - diff.y }, color, lineWidth, strokeOptions);
559
+ group.appendChild(bezier);
560
+ group.appendChild(arrowHead);
561
+ this._addCSSClasses(group, "cubicbezier-arrow");
562
+ this._bindNode(group, undefined);
563
+ return group;
564
+ }
565
+ /**
566
+ * Draw just an arrow head a the end of an imaginary line (zB) of the given line width the specified (CSS-) color and size.
567
+ *
568
+ * @method arrow
569
+ * @param {XYCoords} zA - The start point of the arrow-line.
570
+ * @param {XYCoords} zB - The end point of the arrow-line.
571
+ * @param {string} color - Any valid CSS color string.
572
+ * @param {number=1} lineWidth - (optional) The line width to use; default is 1.
573
+ * @param {number=8} headLength - (optional) The length of the arrow head (default is 8 pixels).
574
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
575
+ *
576
+ * @return {void}
577
+ * @instance
578
+ * @memberof DrawLib
579
+ **/
580
+ arrowHead(zA, zB, color, lineWidth, headLength = 8, strokeOptions) {
581
+ const node = this.makeArrowHeadNode(zA, zB, color, lineWidth, headLength, strokeOptions);
582
+ return this._bindFillDraw(node, "arrowhead", color, lineWidth || 1, strokeOptions);
583
+ }
584
+ /**
585
+ * Draw an image at the given position with the given size.<br>
586
+ * <br>
587
+ * Note: SVG images may have resizing issues at the moment.Draw a line and an arrow at the end (zB) of the given line with the specified (CSS-) color.
588
+ *
589
+ * @method image
590
+ * @param {Image} image - The image object to draw.
591
+ * @param {XYCoords} position - The position to draw the the upper left corner at.
592
+ * @param {XYCoords} size - The x/y-size to draw the image with.
593
+ * @param {number=0.0} alpha - (optional, default=0.0) The transparency (1.0=opaque, 0.0=transparent).
594
+ * @return {void}
595
+ * @instance
596
+ * @memberof drawutilssvg
597
+ **/
598
+ image(image, position, size, alpha = 1.0) {
599
+ const node = this.makeNode("image");
600
+ // We need to re-adjust the image if it was not yet fully loaded before.
601
+ const setImageSize = (image) => {
602
+ if (image.naturalWidth) {
603
+ const ratioX = size.x / image.naturalWidth;
604
+ const ratioY = size.y / image.naturalHeight;
605
+ node.setAttribute("width", `${image.naturalWidth * this.scale.x}`);
606
+ node.setAttribute("height", `${image.naturalHeight * this.scale.y}`);
607
+ node.setAttribute("display", null); // Dislay when loaded
608
+ // if (alpha) {
609
+ node.setAttribute("opacity", `${alpha}`);
610
+ // }
611
+ node.setAttribute("transform", `translate(${this._x(position.x)} ${this._y(position.y)}) scale(${ratioX} ${ratioY})`);
612
+ }
613
+ };
614
+ image.addEventListener("load", event => {
615
+ setImageSize(image);
616
+ });
617
+ // Safari has a transform-origin bug.
618
+ // Use x=0, y=0 and translate/scale instead (see above)
619
+ node.setAttribute("x", `${0}`);
620
+ node.setAttribute("y", `${0}`);
621
+ node.setAttribute("display", "none"); // Hide before loaded
622
+ setImageSize(image);
623
+ node.setAttribute("href", image.src);
624
+ return this._bindFillDraw(node, "image", null, null);
625
+ }
626
+ /**
627
+ * Draw an image at the given position with the given size.<br>
628
+ * <br>
629
+ * Note: SVG images may have resizing issues at the moment.Draw a line and an arrow at the end (zB) of the given line with the specified (CSS-) color.
630
+ *
631
+ * @method texturedPoly
632
+ * @param {Image} textureImage - The image object to draw.
633
+ * @param {Bounds} textureSize - The texture size to use; these are the original bounds to map the polygon vertices to.
634
+ * @param {Polygon} polygon - The polygon to use as clip path.
635
+ * @param {XYCoords} polygonPosition - The polygon's position (relative), measured at the bounding box's center.
636
+ * @param {number} rotation - The rotation to use for the polygon (and for the texture).
637
+ * @return {void}
638
+ * @instance
639
+ * @memberof drawutilssvg
640
+ **/
641
+ texturedPoly(textureImage, textureSize, polygon, polygonPosition, rotation) {
642
+ // const basePolygonBounds: Bounds = polygon.getBounds();
643
+ const rotatedScalingOrigin = new Vertex(textureSize.min).clone().rotate(rotation, polygonPosition);
644
+ // const rotationCenter = polygonPosition.clone().add(rotatedScalingOrigin.difference(textureSize.min).inv());
645
+ // Create something like this
646
+ // ...
647
+ // <defs>
648
+ // <clipPath id="shape">
649
+ // <path fill="none" d="..."/>
650
+ // </clipPath>
651
+ // </defs>
652
+ // ...
653
+ // <g clip-path="url(#shape)">
654
+ // <g transform="scale(...)">
655
+ // <image width="643" height="643" transform="rotate(...)" xlink:href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/222579/beagle400.jpg" >
656
+ // </g>
657
+ // </g>
658
+ // </image>
659
+ // ...
660
+ const clipPathNode = this.makeNode("clipPath");
661
+ const clipPathId = `clippath_${UIDGenerator.next()}`; // TODO: use a better UUID generator here?
662
+ clipPathNode.setAttribute("id", clipPathId);
663
+ const gNode = this.makeNode("g");
664
+ const imageNode = this.makeNode("image");
665
+ imageNode.setAttribute("x", `${this._x(rotatedScalingOrigin.x)}`);
666
+ imageNode.setAttribute("y", `${this._y(rotatedScalingOrigin.y)}`);
667
+ imageNode.setAttribute("width", `${textureSize.width}`);
668
+ imageNode.setAttribute("height", `${textureSize.height}`);
669
+ imageNode.setAttribute("href", textureImage.src);
670
+ // imageNode.setAttribute("opacity", "0.5");
671
+ // SVG rotations in degrees
672
+ imageNode.setAttribute("transform", `rotate(${rotation * RAD_TO_DEG}, ${this._x(rotatedScalingOrigin.x)}, ${this._y(rotatedScalingOrigin.y)})`);
673
+ const pathNode = this.makeNode("path");
674
+ const pathData = [];
675
+ if (polygon.vertices.length > 0) {
676
+ const self = this;
677
+ pathData.push("M", `${this._x(polygon.vertices[0].x)}`, `${this._y(polygon.vertices[0].y)}`);
678
+ for (var i = 1; i < polygon.vertices.length; i++) {
679
+ pathData.push("L", `${this._x(polygon.vertices[i].x)}`, `${this._y(polygon.vertices[i].y)}`);
680
+ }
681
+ }
682
+ pathNode.setAttribute("d", pathData.join(" "));
683
+ clipPathNode.appendChild(pathNode);
684
+ this.bufferedNodeDefs.appendChild(clipPathNode);
685
+ gNode.appendChild(imageNode);
686
+ gNode.setAttribute("transform-origin", `${this._x(rotatedScalingOrigin.x)} ${this._y(rotatedScalingOrigin.y)}`);
687
+ gNode.setAttribute("transform", `scale(${this.scale.x}, ${this.scale.y})`);
688
+ const clipNode = this.makeNode("g");
689
+ clipNode.appendChild(gNode);
690
+ clipNode.setAttribute("clip-path", `url(#${clipPathId})`);
691
+ // TODO: check if the image class is correct here or if we should use a 'clippedImage' class here
692
+ this._bindFillDraw(clipNode, "image", null, null); // No color, no lineWidth
693
+ return clipNode;
694
+ }
695
+ /**
696
+ * Draw the given (cubic) bézier curve.
697
+ *
698
+ * @method cubicBezier
699
+ * @param {XYCoords} startPoint - The start point of the cubic Bézier curve
700
+ * @param {XYCoords} endPoint - The end point the cubic Bézier curve.
701
+ * @param {XYCoords} startControlPoint - The start control point the cubic Bézier curve.
702
+ * @param {XYCoords} endControlPoint - The end control point the cubic Bézier curve.
703
+ * @param {string} color - The CSS color to draw the curve with.
704
+ * @param {number} lineWidth - (optional) The line width to use.
705
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
706
+ *
707
+ * @return {void}
708
+ * @instance
709
+ * @memberof drawutilssvg
710
+ */
711
+ cubicBezier(startPoint, endPoint, startControlPoint, endControlPoint, color, lineWidth, strokeOptions) {
712
+ const node = this.makeCubicBezierNode(startPoint, endPoint, startControlPoint, endControlPoint, color, lineWidth, strokeOptions);
713
+ return this._bindNode(node, undefined);
714
+ }
715
+ /**
716
+ * Draw the given (cubic) Bézier path.
717
+ *
718
+ * The given path must be an array with n*3+1 vertices, where n is the number of
719
+ * curves in the path:
720
+ * <pre> [ point1, point1_startControl, point2_endControl, point2, point2_startControl, point3_endControl, point3, ... pointN_endControl, pointN ]</pre>
721
+ *
722
+ * @method cubicBezierPath
723
+ * @param {XYCoords[]} path - The cubic bezier path as described above.
724
+ * @param {string} color - The CSS colot to draw the path with.
725
+ * @param {number=1} lineWidth - (optional) The line width to use.
726
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
727
+ * @param {boolean} isOpen - (optional) Set to tur if the path should not be closed.
728
+ * @return {void}
729
+ * @instance
730
+ * @memberof drawutilssvg
731
+ */
732
+ cubicBezierPath(path, color, lineWidth, strokeOptions, isOpen) {
733
+ const node = this.makeNode("path");
734
+ this.applyStrokeOpts(node, strokeOptions);
735
+ if (!path || path.length == 0) {
736
+ return node;
737
+ }
738
+ // Draw curve
739
+ const d = ["M", this._x(path[0].x), this._y(path[0].y)];
740
+ // Draw curve path
741
+ var endPoint;
742
+ var startControlPoint;
743
+ var endControlPoint;
744
+ for (var i = 1; i < path.length; i += 3) {
745
+ startControlPoint = path[i];
746
+ endControlPoint = path[i + 1];
747
+ endPoint = path[i + 2];
748
+ 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));
749
+ }
750
+ if (!isOpen) {
751
+ d.push("Z");
752
+ }
753
+ node.setAttribute("d", d.join(" "));
754
+ return this._bindFillDraw(node, "cubicBezierPath", color, lineWidth || 1);
755
+ }
756
+ /**
757
+ * Draw the given handle and handle point (used to draw interactive Bézier curves).
758
+ *
759
+ * The colors for this are fixed and cannot be specified.
760
+ *
761
+ * @method handle
762
+ * @param {Vertex} startPoint - The start of the handle.
763
+ * @param {Vertex} endPoint - The end point of the handle.
764
+ * @return {void}
765
+ * @instance
766
+ * @memberof drawutilssvg
767
+ */
768
+ handle(startPoint, endPoint) {
769
+ // TODO: redefine methods like these into an abstract class?
770
+ this.point(startPoint, "rgb(0,32,192)");
771
+ this.square(endPoint, 5, "rgba(0,128,192,0.5)");
772
+ }
773
+ /**
774
+ * Draw a handle line (with a light grey).
775
+ *
776
+ * @method handleLine
777
+ * @param {XYCoords} startPoint - The start point to draw the handle at.
778
+ * @param {XYCoords} endPoint - The end point to draw the handle at.
779
+ * @return {void}
780
+ * @instance
781
+ * @memberof drawutilssvg
782
+ */
783
+ handleLine(startPoint, endPoint) {
784
+ this.line(startPoint, endPoint, "rgb(128,128,128,0.5)");
785
+ }
786
+ /**
787
+ * Draw a 1x1 dot with the specified (CSS-) color.
788
+ *
789
+ * @method dot
790
+ * @param {XYCoords} p - The position to draw the dot at.
791
+ * @param {string} color - The CSS color to draw the dot with.
792
+ * @return {void}
793
+ * @instance
794
+ * @memberof drawutilssvg
795
+ */
796
+ dot(p, color) {
797
+ const node = this.makeNode("line");
798
+ node.setAttribute("x1", `${this._x(p.x)}`);
799
+ node.setAttribute("y1", `${this._y(p.y)}`);
800
+ node.setAttribute("x2", `${this._x(p.x)}`);
801
+ node.setAttribute("y2", `${this._y(p.y)}`);
802
+ return this._bindFillDraw(node, "dot", color, 1);
803
+ }
804
+ /**
805
+ * Draw the given point with the specified (CSS-) color and radius 3.
806
+ *
807
+ * @method point
808
+ * @param {XYCoords} p - The position to draw the point at.
809
+ * @param {string} color - The CSS color to draw the point with.
810
+ * @return {void}
811
+ * @instance
812
+ * @memberof drawutilssvg
813
+ */
814
+ point(p, color) {
815
+ var radius = 3;
816
+ const node = this.makeNode("circle");
817
+ node.setAttribute("cx", `${this._x(p.x)}`);
818
+ node.setAttribute("cy", `${this._y(p.y)}`);
819
+ node.setAttribute("r", `${radius}`);
820
+ return this._bindFillDraw(node, "point", color, 1);
821
+ }
822
+ /**
823
+ * Draw a circle with the specified (CSS-) color and radius.<br>
824
+ * <br>
825
+ * Note that if the x- and y- scales are different the result will be an ellipse rather than a circle.
826
+ *
827
+ * @method circle
828
+ * @param {XYCoords} center - The center of the circle.
829
+ * @param {number} radius - The radius of the circle.
830
+ * @param {string} color - The CSS color to draw the circle with.
831
+ * @param {number=} lineWidth - (optional) The line width to use; default is 1.
832
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
833
+ *
834
+ * @return {void}
835
+ * @instance
836
+ * @memberof drawutilssvg
837
+ */
838
+ circle(center, radius, color, lineWidth, strokeOptions) {
839
+ // Todo: draw ellipse when scalex!=scaley
840
+ const node = this.makeNode("circle");
841
+ this.applyStrokeOpts(node, strokeOptions);
842
+ node.setAttribute("cx", `${this._x(center.x)}`);
843
+ node.setAttribute("cy", `${this._y(center.y)}`);
844
+ node.setAttribute("r", `${radius * this.scale.x}`); // y?
845
+ return this._bindFillDraw(node, "circle", color, lineWidth || 1);
846
+ }
847
+ /**
848
+ * Draw a circular arc (section of a circle) with the given CSS color.
849
+ *
850
+ * @method circleArc
851
+ * @param {XYCoords} center - The center of the circle.
852
+ * @param {number} radius - The radius of the circle.
853
+ * @param {number} startAngle - The angle to start at.
854
+ * @param {number} endAngle - The angle to end at.
855
+ * @param {string} color - The CSS color to draw the circle with.
856
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
857
+ *
858
+ * @return {void}
859
+ * @instance
860
+ * @memberof drawutilssvg
861
+ */
862
+ circleArc(center, radius, startAngle, endAngle, color, lineWidth, strokeOptions) {
863
+ const node = this.makeNode("path");
864
+ this.applyStrokeOpts(node, strokeOptions);
865
+ const arcData = CircleSector.circleSectorUtils.describeSVGArc(this._x(center.x), this._y(center.y), radius * this.scale.x, // y?
866
+ startAngle, endAngle);
867
+ node.setAttribute("d", arcData.join(" "));
868
+ return this._bindFillDraw(node, "circleArc", color, lineWidth || 1);
869
+ }
870
+ /**
871
+ * Draw an ellipse with the specified (CSS-) color and thw two radii.
872
+ *
873
+ * @method ellipse
874
+ * @param {XYCoords} center - The center of the ellipse.
875
+ * @param {number} radiusX - The radius of the ellipse.
876
+ * @param {number} radiusY - The radius of the ellipse.
877
+ * @param {string} color - The CSS color to draw the ellipse with.
878
+ * @param {number=} lineWidth - (optional) The line width to use; default is 1.
879
+ * @param {number=} rotation - (optional, default=0) The rotation of the ellipse.
880
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
881
+ *
882
+ * @return {void}
883
+ * @instance
884
+ * @memberof drawutilssvg
885
+ */
886
+ ellipse(center, radiusX, radiusY, color, lineWidth, rotation, strokeOptions) {
887
+ if (typeof rotation === "undefined") {
888
+ rotation = 0.0;
889
+ }
890
+ const node = this.makeNode("ellipse");
891
+ this.applyStrokeOpts(node, strokeOptions);
892
+ node.setAttribute("cx", `${this._x(center.x)}`);
893
+ node.setAttribute("cy", `${this._y(center.y)}`);
894
+ node.setAttribute("rx", `${radiusX * this.scale.x}`);
895
+ node.setAttribute("ry", `${radiusY * this.scale.y}`);
896
+ // node.setAttribute( 'style', `transform: rotate(${rotation} ${center.x} ${center.y})` );
897
+ node.setAttribute("transform", `rotate(${(rotation * 180) / Math.PI} ${this._x(center.x)} ${this._y(center.y)})`);
898
+ return this._bindFillDraw(node, "ellipse", color, lineWidth || 1);
899
+ }
900
+ /**
901
+ * Draw square at the given center, size and with the specified (CSS-) color.<br>
902
+ * <br>
903
+ * Note that if the x-scale and the y-scale are different the result will be a rectangle rather than a square.
904
+ *
905
+ * @method square
906
+ * @param {XYCoords} center - The center of the square.
907
+ * @param {number} size - The size of the square.
908
+ * @param {string} color - The CSS color to draw the square with.
909
+ * @param {number=} lineWidth - (optional) The line width to use; default is 1.
910
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
911
+ *
912
+ * @return {SVGElement}
913
+ * @instance
914
+ * @memberof drawutilssvg
915
+ */
916
+ square(center, size, color, lineWidth, strokeOptions) {
917
+ const node = this.makeNode("rectangle");
918
+ this.applyStrokeOpts(node, strokeOptions);
919
+ node.setAttribute("x", `${this._x(center.x - size / 2.0)}`);
920
+ node.setAttribute("y", `${this._y(center.y - size / 2.0)}`);
921
+ node.setAttribute("width", `${size * this.scale.x}`);
922
+ node.setAttribute("height", `${size * this.scale.y}`);
923
+ return this._bindFillDraw(node, "square", color, lineWidth || 1);
924
+ }
925
+ /**
926
+ * Draw a rectangle.
927
+ *
928
+ * @param {XYCoords} position - The upper left corner of the rectangle.
929
+ * @param {number} width - The width of the rectangle.
930
+ * @param {number} height - The height of the rectangle.
931
+ * @param {string} color - The color to use.
932
+ * @param {number=1} lineWidth - (optional) The line with to use (default is 1).
933
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
934
+ *
935
+ * @return {SVGElement}
936
+ * @instance
937
+ * @memberof drawutilssvg
938
+ **/
939
+ rect(position, width, height, color, lineWidth, strokeOptions) {
940
+ const node = this.makeNode("rect");
941
+ this.applyStrokeOpts(node, strokeOptions);
942
+ node.setAttribute("x", `${this._x(position.x)}`);
943
+ node.setAttribute("y", `${this._y(position.y)}`);
944
+ node.setAttribute("width", `${width * this.scale.x}`);
945
+ node.setAttribute("height", `${height * this.scale.y}`);
946
+ return this._bindFillDraw(node, "rect", color, lineWidth || 1);
947
+ }
948
+ /**
949
+ * Draw a grid of horizontal and vertical lines with the given (CSS-) color.
950
+ *
951
+ * @method grid
952
+ * @param {XYCoords} center - The center of the grid.
953
+ * @param {number} width - The total width of the grid (width/2 each to the left and to the right).
954
+ * @param {number} height - The total height of the grid (height/2 each to the top and to the bottom).
955
+ * @param {number} sizeX - The horizontal grid size.
956
+ * @param {number} sizeY - The vertical grid size.
957
+ * @param {string} color - The CSS color to draw the grid with.
958
+ * @return {void}
959
+ * @instance
960
+ * @memberof drawutilssvg
961
+ */
962
+ grid(center, width, height, sizeX, sizeY, color) {
963
+ // console.log("grid");
964
+ // const node: SVGElement = this.makeNode("pattern");
965
+ // var patternId = "pattern_id_" + Math.floor(Math.random() * 65365);
966
+ // node.setAttribute("id", patternId);
967
+ // node.setAttribute("viewBox", `0,0,${sizeX},${sizeY}`);
968
+ // node.setAttribute("width", `${sizeX}`);
969
+ // node.setAttribute("height", `${sizeX}`);
970
+ // var pattern: SVGElement = this.makeNode("path");
971
+ // const d: SVGPathParams = [];
972
+ // d.push("M", sizeX / 2.0, 0);
973
+ // d.push("L", sizeX / 2.0, sizeY);
974
+ // d.push("M", 0, sizeY / 2.0);
975
+ // d.push("L", sizeX, sizeY / 2.0);
976
+ // node.setAttribute("d", d.join(" "));
977
+ // this.bufferedNodeDefs.append(pattern);
978
+ // const fillNode: SVGElement = this.makeNode("rect");
979
+ // // For some strange reason SVG rotation transforms use degrees instead of radians
980
+ // // Note that the background does not scale with the zoom level (always covers full element)
981
+ // fillNode.setAttribute("x", "0");
982
+ // fillNode.setAttribute("y", "0");
983
+ // fillNode.setAttribute("width", `${this.canvasSize.width}`);
984
+ // fillNode.setAttribute("height", `${this.canvasSize.height}`);
985
+ // fillNode.setAttribute("fill", `url(#${patternId})`);
986
+ // return this._bindFillDraw(fillNode, "grid", "red", 1);
987
+ const node = this.makeNode("path");
988
+ const d = [];
989
+ var yMin = -Math.ceil((height * 0.5) / sizeY) * sizeY;
990
+ var yMax = height / 2;
991
+ for (var x = -Math.ceil((width * 0.5) / sizeX) * sizeX; x < width / 2; x += sizeX) {
992
+ d.push("M", this._x(center.x + x), this._y(center.y + yMin));
993
+ d.push("L", this._x(center.x + x), this._y(center.y + yMax));
994
+ }
995
+ var xMin = -Math.ceil((width * 0.5) / sizeX) * sizeX;
996
+ var xMax = width / 2;
997
+ for (var y = -Math.ceil((height * 0.5) / sizeY) * sizeY; y < height / 2; y += sizeY) {
998
+ d.push("M", this._x(center.x + xMin), this._y(center.y + y));
999
+ d.push("L", this._x(center.x + xMax), this._y(center.y + y));
1000
+ }
1001
+ node.setAttribute("d", d.join(" "));
1002
+ return this._bindFillDraw(node, "grid", color, 1);
1003
+ }
1004
+ /**
1005
+ * Draw a raster of crosshairs in the given grid.<br>
1006
+ *
1007
+ * This works analogue to the grid() function
1008
+ *
1009
+ * @method raster
1010
+ * @param {XYCoords} center - The center of the raster.
1011
+ * @param {number} width - The total width of the raster (width/2 each to the left and to the right).
1012
+ * @param {number} height - The total height of the raster (height/2 each to the top and to the bottom).
1013
+ * @param {number} sizeX - The horizontal raster size.
1014
+ * @param {number} sizeY - The vertical raster size.
1015
+ * @param {string} color - The CSS color to draw the raster with.
1016
+ * @return {void}
1017
+ * @instance
1018
+ * @memberof drawutilssvg
1019
+ */
1020
+ raster(center, width, height, sizeX, sizeY, color) {
1021
+ const node = this.makeNode("path");
1022
+ const d = [];
1023
+ for (var x = -Math.ceil((width * 0.5) / sizeX) * sizeX; x < width / 2; x += sizeX) {
1024
+ for (var y = -Math.ceil((height * 0.5) / sizeY) * sizeY; y < height / 2; y += sizeY) {
1025
+ // Draw a crosshair
1026
+ d.push("M", this._x(center.x + x) - 4, this._y(center.y + y));
1027
+ d.push("L", this._x(center.x + x) + 4, this._y(center.y + y));
1028
+ d.push("M", this._x(center.x + x), this._y(center.y + y) - 4);
1029
+ d.push("L", this._x(center.x + x), this._y(center.y + y) + 4);
1030
+ }
1031
+ }
1032
+ node.setAttribute("d", d.join(" "));
1033
+ return this._bindFillDraw(node, "raster", color, 1);
1034
+ }
1035
+ /**
1036
+ * Draw a diamond handle (square rotated by 45°) with the given CSS color.
1037
+ *
1038
+ * It is an inherent featur of the handle functions that the drawn elements are not scaled and not
1039
+ * distorted. So even if the user zooms in or changes the aspect ratio, the handles will be drawn
1040
+ * as even shaped diamonds.
1041
+ *
1042
+ * @method diamondHandle
1043
+ * @param {XYCoords} center - The center of the diamond.
1044
+ * @param {number} size - The x/y-size of the diamond.
1045
+ * @param {string} color - The CSS color to draw the diamond with.
1046
+ * @return {void}
1047
+ * @instance
1048
+ * @memberof drawutilssvg
1049
+ */
1050
+ diamondHandle(center, size, color) {
1051
+ const node = this.makeNode("path");
1052
+ const d = [
1053
+ "M",
1054
+ this._x(center.x) - size / 2.0,
1055
+ this._y(center.y),
1056
+ "L",
1057
+ this._x(center.x),
1058
+ this._y(center.y) - size / 2.0,
1059
+ "L",
1060
+ this._x(center.x) + size / 2.0,
1061
+ this._y(center.y),
1062
+ "L",
1063
+ this._x(center.x),
1064
+ this._y(center.y) + size / 2.0,
1065
+ "Z"
1066
+ ];
1067
+ node.setAttribute("d", d.join(" "));
1068
+ return this._bindFillDraw(node, "diamondHandle", color, 1);
1069
+ }
1070
+ /**
1071
+ * Draw a square handle with the given CSS color.<br>
1072
+ * <br>
1073
+ * It is an inherent featur of the handle functions that the drawn elements are not scaled and not
1074
+ * distorted. So even if the user zooms in or changes the aspect ratio, the handles will be drawn
1075
+ * as even shaped squares.
1076
+ *
1077
+ * @method squareHandle
1078
+ * @param {XYCoords} center - The center of the square.
1079
+ * @param {XYCoords} size - The x/y-size of the square.
1080
+ * @param {string} color - The CSS color to draw the square with.
1081
+ * @return {void}
1082
+ * @instance
1083
+ * @memberof drawutilssvg
1084
+ */
1085
+ squareHandle(center, size, color) {
1086
+ const node = this.makeNode("rect");
1087
+ node.setAttribute("x", `${this._x(center.x) - size / 2.0}`);
1088
+ node.setAttribute("y", `${this._y(center.y) - size / 2.0}`);
1089
+ node.setAttribute("width", `${size}`);
1090
+ node.setAttribute("height", `${size}`);
1091
+ return this._bindFillDraw(node, "squareHandle", color, 1);
1092
+ }
1093
+ /**
1094
+ * Draw a circle handle with the given CSS color.<br>
1095
+ * <br>
1096
+ * It is an inherent featur of the handle functions that the drawn elements are not scaled and not
1097
+ * distorted. So even if the user zooms in or changes the aspect ratio, the handles will be drawn
1098
+ * as even shaped circles.
1099
+ *
1100
+ * @method circleHandle
1101
+ * @param {XYCoords} center - The center of the circle.
1102
+ * @param {number} radius - The radius of the circle.
1103
+ * @param {string} color - The CSS color to draw the circle with.
1104
+ * @return {void}
1105
+ * @instance
1106
+ * @memberof drawutilssvg
1107
+ */
1108
+ circleHandle(center, radius, color) {
1109
+ radius = radius || 3;
1110
+ const node = this.makeNode("circle");
1111
+ node.setAttribute("cx", `${this._x(center.x)}`);
1112
+ node.setAttribute("cy", `${this._y(center.y)}`);
1113
+ node.setAttribute("r", `${radius}`);
1114
+ return this._bindFillDraw(node, "circleHandle", color, 1);
1115
+ }
1116
+ /**
1117
+ * Draw a crosshair with given radius and color at the given position.<br>
1118
+ * <br>
1119
+ * Note that the crosshair radius will not be affected by scaling.
1120
+ *
1121
+ * @method crosshair
1122
+ * @param {XYCoords} center - The center of the crosshair.
1123
+ * @param {number} radius - The radius of the crosshair.
1124
+ * @param {string} color - The CSS color to draw the crosshair with.
1125
+ * @param {number=0.5} lineWidth - (optional, default=0.5) The line width to use.
1126
+ * @return {void}
1127
+ * @instance
1128
+ * @memberof drawutilssvg
1129
+ */
1130
+ crosshair(center, radius, color, lineWidth) {
1131
+ const node = this.makeNode("path");
1132
+ const d = [
1133
+ "M",
1134
+ this._x(center.x) - radius,
1135
+ this._y(center.y),
1136
+ "L",
1137
+ this._x(center.x) + radius,
1138
+ this._y(center.y),
1139
+ "M",
1140
+ this._x(center.x),
1141
+ this._y(center.y) - radius,
1142
+ "L",
1143
+ this._x(center.x),
1144
+ this._y(center.y) + radius
1145
+ ];
1146
+ node.setAttribute("d", d.join(" "));
1147
+ return this._bindFillDraw(node, "crosshair", color, lineWidth || 0.5);
1148
+ }
1149
+ /**
1150
+ * Draw a cross with diagonal axes with given radius, color and lineWidth at the given position.<br>
1151
+ * <br>
1152
+ * Note that the x's radius will not be affected by scaling.
1153
+ *
1154
+ * @method crosshair
1155
+ * @param {XYCoords} center - The center of the crosshair.
1156
+ * @param {number} radius - The radius of the crosshair.
1157
+ * @param {string} color - The CSS color to draw the crosshair with.
1158
+ * @param {number=1} lineWidth - (optional, default=1.0) The line width to use.
1159
+ * @return {void}
1160
+ * @instance
1161
+ * @memberof drawutils
1162
+ */
1163
+ cross(center, radius, color, lineWidth) {
1164
+ const node = this.makeNode("path");
1165
+ const d = [
1166
+ "M",
1167
+ this._x(center.x) - radius,
1168
+ this._y(center.y) - radius,
1169
+ "L",
1170
+ this._x(center.x) + radius,
1171
+ this._y(center.y) + radius,
1172
+ "M",
1173
+ this._x(center.x) - radius,
1174
+ this._y(center.y) + radius,
1175
+ "L",
1176
+ this._x(center.x) + radius,
1177
+ this._y(center.y) - radius
1178
+ ];
1179
+ node.setAttribute("d", d.join(" "));
1180
+ return this._bindFillDraw(node, "cross", color, lineWidth || 1.0);
1181
+ }
1182
+ /**
1183
+ * Draw a polygon.
1184
+ *
1185
+ * @method polygon
1186
+ * @param {Polygon} polygon - The polygon to draw.
1187
+ * @param {string} color - The CSS color to draw the polygon with.
1188
+ * @param {number=} lineWidth - (optional) The line width to use; default is 1.
1189
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
1190
+ * @return {void}
1191
+ * @instance
1192
+ * @memberof drawutilssvg
1193
+ */
1194
+ polygon(polygon, color, lineWidth, strokeOptions) {
1195
+ return this.polyline(polygon.vertices, polygon.isOpen, color, lineWidth, strokeOptions);
1196
+ }
1197
+ /**
1198
+ * Draw a polygon line (alternative function to the polygon).
1199
+ *
1200
+ * @method polyline
1201
+ * @param {XYCoords[]} vertices - The polygon vertices to draw.
1202
+ * @param {boolan} isOpen - If true the polyline will not be closed at its end.
1203
+ * @param {string} color - The CSS color to draw the polygon with.
1204
+ * @param {number=} lineWidth - (optional) The line width to use; default is 1.
1205
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
1206
+ *
1207
+ * @return {void}
1208
+ * @instance
1209
+ * @memberof drawutilssvg
1210
+ */
1211
+ polyline(vertices, isOpen, color, lineWidth, strokeOptions) {
1212
+ const node = this.makeNode("path");
1213
+ this.applyStrokeOpts(node, strokeOptions);
1214
+ if (vertices.length == 0) {
1215
+ return node;
1216
+ }
1217
+ // Draw curve
1218
+ const d = ["M", this._x(vertices[0].x), this._y(vertices[0].y)];
1219
+ var n = vertices.length;
1220
+ for (var i = 1; i < n; i++) {
1221
+ d.push("L", this._x(vertices[i].x), this._y(vertices[i].y));
1222
+ }
1223
+ if (!isOpen)
1224
+ d.push("Z");
1225
+ node.setAttribute("d", d.join(" "));
1226
+ return this._bindFillDraw(node, "polygon", color, lineWidth || 1);
1227
+ }
1228
+ /**
1229
+ * Draw a text at the given relative position.
1230
+ *
1231
+ * @method text
1232
+ * @param {string} text - The text to draw.
1233
+ * @param {number} x - The x-position to draw the text at.
1234
+ * @param {number} y - The y-position to draw the text at.
1235
+ * @param {string=} options.color - The Color to use.
1236
+ * @param {string=} options.fontFamily - The font family to use.
1237
+ * @param {number=} options.fontSize - The font size (in pixels) to use.
1238
+ * @param {FontStyle=} options.fontStyle - The font style to use.
1239
+ * @param {FontWeight=} options.fontWeight - The font weight to use.
1240
+ * @param {number=} options.lineHeight - The line height (in pixels) to use.
1241
+ * @param {number=} options.rotation - The (optional) rotation in radians.
1242
+ * @param {string=} options.textAlign - The text align to use. According to the specifiactions (https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/textAlign) valid values are `"left" || "right" || "center" || "start" || "end"`.
1243
+ * @return {void}
1244
+ * @instance
1245
+ * @memberof drawutils
1246
+ */
1247
+ text(text, x, y, options) {
1248
+ var _a, _b, _c;
1249
+ options = options || {};
1250
+ const color = options.color || "black";
1251
+ const lineHeight = ((_b = (_a = options.lineHeight) !== null && _a !== void 0 ? _a : options.fontSize) !== null && _b !== void 0 ? _b : 0) * this.scale.x;
1252
+ // https://www.w3.org/TR/SVG/text.html#TextAnchorProperty
1253
+ // start | middle | end
1254
+ const textAlign = options.textAlign === "left" || options.textAlign === "start"
1255
+ ? "start"
1256
+ : options.textAlign === "center"
1257
+ ? "middle"
1258
+ : options.textAlign === "right" || options.textAlign === "end"
1259
+ ? "end"
1260
+ : "start";
1261
+ const transformOrigin = `${this._x(x)}px ${this._y(y)}px`;
1262
+ const translate = `translate(${this._x(x)} ${this._y(y) + lineHeight / 2})`;
1263
+ // Safari has a transform-origin/rotation bug.
1264
+ // It's essential to use rotate(r,x,y) here. "rotate(r)"" with transform-origin(x,y) won't do the job.
1265
+ // And rotate and translate cannot be used is combination on a text object.
1266
+ // So wrap the text inside a <g>, translate the <g>, and rotate the text inside.
1267
+ const rotate = options.rotation ? `rotate(${options.rotation * RAD_TO_DEG} 0 0)` : ``;
1268
+ const node = this.makeNode("g");
1269
+ const curId = this.curId;
1270
+ this.curId = curId + "_text";
1271
+ const textNode = this.makeNode("text");
1272
+ node.appendChild(textNode);
1273
+ textNode.setAttribute("font-family", (_c = options.fontFamily) !== null && _c !== void 0 ? _c : ""); // May be undefined
1274
+ textNode.setAttribute("font-size", options.fontSize ? `${options.fontSize * this.scale.x}` : "");
1275
+ textNode.setAttribute("font-style", options.fontStyle ? `${options.fontStyle}` : "");
1276
+ textNode.setAttribute("font-weight", options.fontWeight ? `${options.fontWeight}` : "");
1277
+ textNode.setAttribute("text-anchor", textAlign);
1278
+ textNode.setAttribute("transform-origin", "0 0");
1279
+ textNode.setAttribute("transform", rotate);
1280
+ node.setAttribute("transform-origin", transformOrigin);
1281
+ node.setAttribute("transform", translate);
1282
+ textNode.innerHTML = text;
1283
+ // Restore old ID
1284
+ this.curId = curId;
1285
+ return this._bindFillDraw(node, "text", color, 1);
1286
+ }
1287
+ /**
1288
+ * Draw a non-scaling text label at the given position.
1289
+ *
1290
+ * @method label
1291
+ * @param {string} text - The text to draw.
1292
+ * @param {number} x - The x-position to draw the text at.
1293
+ * @param {number} y - The y-position to draw the text at.
1294
+ * @param {number=} rotation - The (optional) rotation in radians.
1295
+ * @param {string="black"} color - The color to use (default is black).
1296
+ * @return {void}
1297
+ * @instance
1298
+ * @memberof drawutilssvg
1299
+ */
1300
+ label(text, x, y, rotation, color) {
1301
+ const node = this.makeNode("text");
1302
+ // For some strange reason SVG rotation transforms use degrees instead of radians
1303
+ node.setAttribute("transform", `translate(${x},${y}), rotate(${((rotation || 0) / Math.PI) * 180})`);
1304
+ node.setAttribute("font-family", "Arial");
1305
+ node.setAttribute("font-size", "9pt");
1306
+ node.setAttribute("font-style", "normal");
1307
+ node.setAttribute("font-weight", "lighter");
1308
+ node.innerHTML = text;
1309
+ return this._bindFillDraw(node, "label", color || "black", null);
1310
+ }
1311
+ /**
1312
+ * Draw an SVG-like path given by the specified path data.
1313
+ *
1314
+ * @method path
1315
+ * @param {SVGPathData} pathData - An array of path commands and params.
1316
+ * @param {string=null} color - (optional) The color to draw this path with (default is null).
1317
+ * @param {number=1} lineWidth - (optional) the line width to use (default is 1).
1318
+ * @param {boolean=false} options.inplace - (optional) If set to true then path transforamtions (scale and translate) will be done in-place in the array. This can boost the performance.
1319
+ * @param {number=} options.dashOffset - (optional) `See StrokeOptions`.
1320
+ * @param {number=[]} options.dashArray - (optional) `See StrokeOptions`.
1321
+ *
1322
+ * @instance
1323
+ * @memberof drawutils
1324
+ * @return {R} An instance representing the drawn path.
1325
+ */
1326
+ path(pathData, color, lineWidth, options) {
1327
+ const node = this.makeNode("path");
1328
+ this.applyStrokeOpts(node, options);
1329
+ // Transform the path: in-place (fast) or copy (slower)
1330
+ const d = options && options.inplace ? pathData : drawutilssvg.copyPathData(pathData);
1331
+ drawutilssvg.transformPathData(d, this.offset, this.scale);
1332
+ node.setAttribute("d", d.join(" "));
1333
+ return this._bindFillDraw(node, "path", color, lineWidth);
1334
+ }
1335
+ /**
1336
+ * Due to gl compatibility there is a generic 'clear' function required
1337
+ * to avoid accessing the context object itself directly.
1338
+ *
1339
+ * This function just fills the whole canvas with a single color.
1340
+ *
1341
+ * @param {string} color - The color to clear with.
1342
+ * @return {void}
1343
+ * @instance
1344
+ * @memberof drawutilssvg
1345
+ **/
1346
+ clear(color) {
1347
+ // If this isn't the primary handler then do not remove anything here.
1348
+ // The primary handler will do that (no double work).
1349
+ if (this.isSecondary) {
1350
+ return;
1351
+ }
1352
+ // Add a covering rect with the given background color
1353
+ this.curId = "background";
1354
+ this.curClassName = null; // undefined;
1355
+ const node = this.makeNode("rect");
1356
+ // For some strange reason SVG rotation transforms use degrees instead of radians
1357
+ // Note that the background does not scale with the zoom level (always covers full element)
1358
+ node.setAttribute("x", "0");
1359
+ node.setAttribute("y", "0");
1360
+ node.setAttribute("width", `${this.canvasSize.width}`);
1361
+ node.setAttribute("height", `${this.canvasSize.height}`);
1362
+ // Bind this special element into the document
1363
+ this._bindFillDraw(node, this.curId, null, null);
1364
+ node.setAttribute("fill", typeof color === "undefined" ? "none" : color);
1365
+ // Clear the current ID again
1366
+ this.curId = null; // undefined;
1367
+ }
1368
+ /**
1369
+ * A private helper function to clear all SVG nodes from the &gt;g> node.
1370
+ *
1371
+ * @private
1372
+ */
1373
+ removeAllChildNodes() {
1374
+ while (this.bufferGNode.lastChild) {
1375
+ this.bufferGNode.removeChild(this.bufferGNode.lastChild);
1376
+ }
1377
+ while (this.bufferedNodeDefs.lastChild) {
1378
+ this.bufferedNodeDefs.removeChild(this.bufferedNodeDefs.lastChild);
1379
+ }
1380
+ }
1381
+ /**
1382
+ * Create a new and empty `SVGElement` &lt;svg&gt; in the svg-namespace.
1383
+ *
1384
+ * @name createSvg
1385
+ * @static
1386
+ * @memberof drawutilssvg
1387
+ * @return SVGElement
1388
+ */
1389
+ static createSvg() {
1390
+ return document.createElementNS("http://www.w3.org/2000/svg", "svg");
1391
+ }
1392
+ /**
1393
+ * Create a copy of the given path data. As path data only consists of strings and numbers,
1394
+ * the copy will be shallow by definition.
1395
+ *
1396
+ * @name copyPathData
1397
+ * @static
1398
+ * @memberof drawutilssvg
1399
+ */
1400
+ static copyPathData(data) {
1401
+ const copy = new Array(data.length);
1402
+ for (var i = 0, n = data.length; i < n; i++) {
1403
+ copy[i] = data[i];
1404
+ }
1405
+ return copy;
1406
+ }
1407
+ /**
1408
+ * Transform the given path data (translate and scale. rotating is not intended here).
1409
+ *
1410
+ * @name transformPathData
1411
+ * @static
1412
+ * @memberof drawutilssvg
1413
+ * @param {SVGPathParams} data - The data to transform.
1414
+ * @param {XYCoords} offset - The translation offset (neutral is x=0, y=0).
1415
+ * @param {XYCoords} scale - The scale factors (neutral is x=1, y=1).
1416
+ */
1417
+ static transformPathData(data, offset, scale) {
1418
+ // Scale and translate {x,y}
1419
+ const _stx = (index) => {
1420
+ data[index] = offset.x + scale.x * Number(data[index]);
1421
+ };
1422
+ const _sty = (index) => {
1423
+ data[index] = offset.y + scale.y * Number(data[index]);
1424
+ };
1425
+ // scale only {x,y}
1426
+ const _sx = (index) => {
1427
+ data[index] = scale.x * Number(data[index]);
1428
+ };
1429
+ const _sy = (index) => {
1430
+ data[index] = scale.y * Number(data[index]);
1431
+ };
1432
+ var i = 0;
1433
+ var lastPoint = { x: NaN, y: NaN };
1434
+ // "save last point"
1435
+ var _slp = (index) => {
1436
+ lastPoint.x = Number(data[index]);
1437
+ lastPoint.y = Number(data[index + 1]);
1438
+ };
1439
+ while (i < data.length) {
1440
+ const cmd = data[i];
1441
+ switch (cmd) {
1442
+ case "M":
1443
+ // MoveTo: M|m x y
1444
+ case "L":
1445
+ // LineTo L|l x y
1446
+ case "T":
1447
+ // Shorthand/smooth quadratic Bézier curveto: T|t x y
1448
+ _stx(i + 1);
1449
+ _sty(i + 2);
1450
+ _slp(i + 1);
1451
+ i += 3;
1452
+ break;
1453
+ case "m":
1454
+ // MoveTo: M|m x y
1455
+ case "l":
1456
+ // LineTo L|l x y
1457
+ case "t":
1458
+ // Shorthand/smooth quadratic Bézier curveto: T|t x y
1459
+ _sx(i + 1);
1460
+ _sy(i + 2);
1461
+ _slp(i + 1);
1462
+ i += 3;
1463
+ break;
1464
+ case "H":
1465
+ // HorizontalLineTo: H|h x
1466
+ _stx(i + 1);
1467
+ lastPoint.x = Number(data[i + 1]);
1468
+ i += 2;
1469
+ break;
1470
+ case "h":
1471
+ // HorizontalLineTo: H|h x
1472
+ _sx(i + 1);
1473
+ lastPoint.x = Number(data[i + 1]);
1474
+ i += 2;
1475
+ break;
1476
+ case "V":
1477
+ // VerticalLineTo: V|v y
1478
+ _sty(i + 1);
1479
+ lastPoint.y = Number(data[i + 1]);
1480
+ i += 2;
1481
+ break;
1482
+ case "v":
1483
+ // VerticalLineTo: V|v y
1484
+ _sy(i + 1);
1485
+ lastPoint.y = Number(data[i + 1]);
1486
+ i += 2;
1487
+ break;
1488
+ case "C":
1489
+ // CurveTo: C|c x1 y1 x2 y2 x y
1490
+ _stx(i + 1);
1491
+ _sty(i + 2);
1492
+ _stx(i + 3);
1493
+ _sty(i + 4);
1494
+ _stx(i + 5);
1495
+ _sty(i + 6);
1496
+ _slp(i + 5);
1497
+ i += 7;
1498
+ break;
1499
+ case "c":
1500
+ // CurveTo: C|c x1 y1 x2 y2 x y
1501
+ _sx(i + 1);
1502
+ _sy(i + 2);
1503
+ _sx(i + 3);
1504
+ _sy(i + 4);
1505
+ _sx(i + 5);
1506
+ _sy(i + 6);
1507
+ _slp(i + 5);
1508
+ i += 7;
1509
+ break;
1510
+ case "S":
1511
+ case "Q":
1512
+ // Shorthand-/SmoothCurveTo: S|s x2 y2 x y
1513
+ // QuadraticCurveTo: Q|q x1 y1 x y
1514
+ _stx(i + 1);
1515
+ _sty(i + 2);
1516
+ _stx(i + 3);
1517
+ _sty(i + 4);
1518
+ _slp(i + 3);
1519
+ i += 5;
1520
+ break;
1521
+ case "s":
1522
+ case "q":
1523
+ // Shorthand-/SmoothCurveTo: S|s x2 y2 x y
1524
+ // QuadraticCurveTo: Q|q x1 y1 x y
1525
+ _sx(i + 1);
1526
+ _sy(i + 2);
1527
+ _sx(i + 3);
1528
+ _sy(i + 4);
1529
+ _slp(i + 3);
1530
+ i += 5;
1531
+ break;
1532
+ case "A":
1533
+ // EllipticalArcTo: A|a rx ry x-axis-rotation large-arc-flag sweep-flag x y
1534
+ // Uniform scale: just scale
1535
+ // NOTE: here is something TODO
1536
+ // * if scalex!=scaleY this won't work
1537
+ // * Arcs have to be converted to Bézier curves here in that case
1538
+ _sx(i + 1);
1539
+ _sy(i + 2);
1540
+ _stx(i + 6);
1541
+ _sty(i + 7);
1542
+ _slp(i + 6);
1543
+ // Update the arc flag when x _or_ y scale is negative
1544
+ if ((scale.x < 0 && scale.y >= 0) || (scale.x >= 0 && scale.y < 0)) {
1545
+ data[i + 5] = data[i + 5] ? 0 : 1;
1546
+ }
1547
+ i += 8;
1548
+ break;
1549
+ case "a":
1550
+ // EllipticalArcTo: A|a rx ry x-axis-rotation large-arc-flag sweep-flag x y
1551
+ _sx(i + 1);
1552
+ _sy(i + 2);
1553
+ _sx(i + 6);
1554
+ _sy(i + 7);
1555
+ _slp(i + 6);
1556
+ i += 8;
1557
+ break;
1558
+ case "z":
1559
+ case "Z":
1560
+ // ClosePath: Z|z (no arguments)
1561
+ // lastPoint.x = firstPoint.x;
1562
+ // lastPoint.y = firstPoint.y;
1563
+ i++;
1564
+ break;
1565
+ // Safepoint: continue reading token by token until something is recognized again
1566
+ default:
1567
+ i++;
1568
+ }
1569
+ } // END while
1570
+ } // END transformPathData
1571
+ static nodeSupportsLineDash(nodeName) {
1572
+ return ["line", "path", "circle", "ellipse", "rectangle", "rect"].includes(nodeName);
1573
+ }
1574
+ static nodeSupportsLineJoin(nodeName) {
1575
+ return ["line", "path", "circle", "ellipse", "rectangle", "rect"].includes(nodeName);
1576
+ }
1577
+ /**
1578
+ * Creates a basic <line> node with start and end coordinates. The created node will not
1579
+ * be bound to any root node.
1580
+ *
1581
+ * @private
1582
+ * @method makeLineNode
1583
+ * @param {XYCoords} zA - The line's start position.
1584
+ * @param {XYCoords} zB - The line's start position.
1585
+ * @param {string} color - The CSS color to draw the point with.
1586
+ * @param {number=1} lineWidth - (optional) The line width to use.
1587
+ * @param {StrokeOptions=} strokeOptions - (optional) Additional stroke options to use.
1588
+ * @param {string=} classNameOverride - (optional) If nothing is passed the default classname 'path' will be used.
1589
+ * @return {SVGLineElement}
1590
+ * @instance
1591
+ * @memberof drawutilssvg
1592
+ */
1593
+ makeLineNode(zA, zB, color, lineWidth, strokeOptions, classNameOverride) {
1594
+ const line = this.makeNode("line");
1595
+ line.setAttribute("x1", `${this._x(zA.x)}`);
1596
+ line.setAttribute("y1", `${this._y(zA.y)}`);
1597
+ line.setAttribute("x2", `${this._x(zB.x)}`);
1598
+ line.setAttribute("y2", `${this._y(zB.y)}`);
1599
+ this._configureNode(line, classNameOverride !== null && classNameOverride !== void 0 ? classNameOverride : "line", this.fillShapes, color, lineWidth || 1, strokeOptions);
1600
+ return line;
1601
+ }
1602
+ /**
1603
+ * Creates a basic <path> node with given path string data. The created node will not
1604
+ * be bound to any root node.
1605
+ *
1606
+ * @private
1607
+ * @method makePathNode
1608
+ * @param {string} pathString - The path data (must be a valid path data string).
1609
+ * @param {string} color - The CSS color to draw the point with.
1610
+ * @param {number=1} lineWidth - (optional) The line width to use.
1611
+ * @param {StrokeOptions=} strokeOptions - (optional) Additional stroke options to use.
1612
+ * @param {string=} classNameOverride - (optional) If nothing is passed the default classname 'path' will be used.
1613
+ * @return {SVGPathElement}
1614
+ * @instance
1615
+ * @memberof drawutilssvg
1616
+ */
1617
+ makePathNode(pathString, color, lineWidth, strokeOptions, classNameOverride) {
1618
+ const path = this.makeNode("path");
1619
+ path.setAttribute("d", pathString);
1620
+ this._configureNode(path, classNameOverride !== null && classNameOverride !== void 0 ? classNameOverride : "path", this.fillShapes, color, lineWidth || 1, strokeOptions);
1621
+ return path;
1622
+ }
1623
+ /**
1624
+ * Creates a basic arrow head node (<path> node) at the end of the given line coordinates. The created node will not
1625
+ * be bound to any root node.
1626
+ *
1627
+ * @private
1628
+ * @method makeArrowHeadNode
1629
+ * @param {string} pathString - The path data (must be a valid path data string).
1630
+ * @param {string} color - The CSS color to draw the point with.
1631
+ * @param {number=1} lineWidth - (optional) The line width to use.
1632
+ * @param {number=8} headLength - (optional) The length of the arrow head; if none is specified then the head will be 8 absolute units long.
1633
+ * @param {StrokeOptions=} strokeOptions - (optional) Additional stroke options to use.
1634
+ * @param {XYCoords=} arrowHeadBasePositionBuffer - (optional) If not null, then this position will contain the arrow head's start point (after execution). Some sort of OUT variable.
1635
+ * @return {SVGPathElement}
1636
+ * @instance
1637
+ * @memberof drawutilssvg
1638
+ */
1639
+ makeArrowHeadNode(zA, zB, color, lineWidth, headLength = 8, strokeOptions, arrowHeadBasePositionBuffer) {
1640
+ var vertices = Vector.utils.buildArrowHead(zA, zB, headLength, this.scale.x, this.scale.y);
1641
+ const d = ["M", this.offset.x + vertices[0].x, this.offset.y + vertices[0].y];
1642
+ if (arrowHeadBasePositionBuffer) {
1643
+ arrowHeadBasePositionBuffer.x = vertices[0].x / this.scale.x;
1644
+ arrowHeadBasePositionBuffer.y = vertices[0].y / this.scale.y;
1645
+ }
1646
+ for (var i = 1; i <= vertices.length; i++) {
1647
+ d.push("L");
1648
+ // Note: only use offset here (the vertices are already scaled)
1649
+ d.push(this.offset.x + vertices[i % vertices.length].x);
1650
+ d.push(this.offset.y + vertices[i % vertices.length].y);
1651
+ }
1652
+ const node = this.makePathNode(d.join(" "), color, lineWidth, strokeOptions, "arrowhead");
1653
+ return node;
1654
+ }
1655
+ /**
1656
+ * Creates a basic cubic Bézier path node (<path> node) with the given cubic Bézier data. The created node will not
1657
+ * be bound to any root node.
1658
+ *
1659
+ * @private
1660
+ * @method makeCubicBezierNode
1661
+ * @param {XYCoords} startPoint - The start point of the cubic Bézier curve
1662
+ * @param {XYCoords} endPoint - The end point the cubic Bézier curve.
1663
+ * @param {XYCoords} startControlPoint - The start control point the cubic Bézier curve.
1664
+ * @param {XYCoords} endControlPoint - The end control point the cubic Bézier curve.
1665
+ * @param {string} color - The CSS color to draw the point with.
1666
+ * @param {number=1} lineWidth - (optional) The line width to use.
1667
+ * @param {StrokeOptions=} strokeOptions - (optional) Additional stroke options to use.
1668
+ * @param {string=} classNameOverride - (optional) If nothing is passed the default classname 'path' will be used.
1669
+ * @param {XYCoords=} arrowHeadBasePositionBuffer - (optional) If not null, then this position will contain the arrow head's start point (after execution). Some sort of OUT variable.
1670
+ * @return {SVGPathElement}
1671
+ * @instance
1672
+ * @memberof drawutilssvg
1673
+ */
1674
+ makeCubicBezierNode(startPoint, endPoint, startControlPoint, endControlPoint, color, lineWidth, strokeOptions) {
1675
+ if (startPoint instanceof CubicBezierCurve) {
1676
+ return this.cubicBezier(startPoint.startPoint, startPoint.endPoint, startPoint.startControlPoint, startPoint.endControlPoint, color, lineWidth);
1677
+ }
1678
+ // Draw curve
1679
+ const d = [
1680
+ "M",
1681
+ this._x(startPoint.x),
1682
+ this._y(startPoint.y),
1683
+ "C",
1684
+ this._x(startControlPoint.x),
1685
+ this._y(startControlPoint.y),
1686
+ this._x(endControlPoint.x),
1687
+ this._y(endControlPoint.y),
1688
+ this._x(endPoint.x),
1689
+ this._y(endPoint.y)
1690
+ ];
1691
+ const node = this.makePathNode(d.join(" "), color, lineWidth, strokeOptions, "cubicBezier");
1692
+ return node;
1693
+ }
1694
+ }
1695
+ drawutilssvg.HEAD_XML = [
1696
+ '<?xml version="1.0" encoding="UTF-8" standalone="no"?>',
1697
+ '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" ',
1698
+ ' "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',
1699
+ ""
1700
+ ].join("\n");
1701
+ //# sourceMappingURL=drawutilssvg.js.map