plotboilerplate 1.27.0 → 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 (1107) hide show
  1. package/dist/index.esm.js +11286 -166
  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/index.d.ts +75 -0
  1046. package/src/cjs/index.js +84 -0
  1047. package/src/cjs/index.js.map +1 -1
  1048. package/src/cjs/interfaces/DrawLib.d.ts +18 -1
  1049. package/src/cjs/interfaces/DrawLib.js +2 -0
  1050. package/src/cjs/interfaces/DrawLib.js.map +1 -1
  1051. package/src/cjs/utils/Params.d.ts +3 -2
  1052. package/src/cjs/utils/Params.js +11 -3
  1053. package/src/cjs/utils/Params.js.map +1 -1
  1054. package/src/cjs/utils/WebColors.d.ts +2 -1
  1055. package/src/cjs/utils/WebColors.js +15 -2
  1056. package/src/cjs/utils/WebColors.js.map +1 -1
  1057. package/src/cjs/utils/WebColorsContrast.d.ts +1 -1
  1058. package/src/cjs/utils/algorithms/HobbyPath.js +13 -16
  1059. package/src/cjs/utils/algorithms/HobbyPath.js.map +1 -1
  1060. package/src/cjs/utils/helpers/BezierResizeHelper.d.ts +144 -0
  1061. package/src/cjs/utils/helpers/BezierResizeHelper.js +319 -0
  1062. package/src/cjs/utils/helpers/BezierResizeHelper.js.map +1 -0
  1063. package/src/esm/PlotBoilerplate.d.ts +11 -1
  1064. package/src/esm/PlotBoilerplate.js +23 -7
  1065. package/src/esm/PlotBoilerplate.js.map +1 -1
  1066. package/src/esm/VertexListeners.d.ts +2 -1
  1067. package/src/esm/VertexListeners.js +5 -1
  1068. package/src/esm/VertexListeners.js.map +1 -1
  1069. package/src/esm/draw.d.ts +18 -2
  1070. package/src/esm/draw.js +21 -2
  1071. package/src/esm/draw.js.map +1 -1
  1072. package/src/esm/drawgl.d.ts +18 -3
  1073. package/src/esm/drawgl.js +19 -2
  1074. package/src/esm/drawgl.js.map +1 -1
  1075. package/src/esm/drawutilssvg.d.ts +19 -1
  1076. package/src/esm/drawutilssvg.js +28 -5
  1077. package/src/esm/drawutilssvg.js.map +1 -1
  1078. package/src/esm/index.d.ts +75 -0
  1079. package/src/esm/index.js +84 -0
  1080. package/src/esm/index.js.map +1 -1
  1081. package/src/esm/interfaces/DrawLib.d.ts +18 -1
  1082. package/src/esm/interfaces/DrawLib.js +2 -0
  1083. package/src/esm/interfaces/DrawLib.js.map +1 -1
  1084. package/src/esm/utils/Params.d.ts +3 -2
  1085. package/src/esm/utils/Params.js +11 -3
  1086. package/src/esm/utils/Params.js.map +1 -1
  1087. package/src/esm/utils/WebColors.d.ts +2 -1
  1088. package/src/esm/utils/WebColors.js +15 -2
  1089. package/src/esm/utils/WebColors.js.map +1 -1
  1090. package/src/esm/utils/WebColorsContrast.d.ts +1 -1
  1091. package/src/esm/utils/algorithms/HobbyPath.js +13 -16
  1092. package/src/esm/utils/algorithms/HobbyPath.js.map +1 -1
  1093. package/src/esm/utils/helpers/BezierResizeHelper.d.ts +144 -0
  1094. package/src/esm/utils/helpers/BezierResizeHelper.js +314 -0
  1095. package/src/esm/utils/helpers/BezierResizeHelper.js.map +1 -0
  1096. package/src/ts/PlotBoilerplate.ts +37 -11
  1097. package/src/ts/VertexListeners.ts +5 -1
  1098. package/src/ts/draw.ts +32 -2
  1099. package/src/ts/drawgl.ts +38 -3
  1100. package/src/ts/drawutilssvg.ts +33 -6
  1101. package/src/ts/index.ts +94 -0
  1102. package/src/ts/interfaces/DrawLib.ts +19 -1
  1103. package/src/ts/utils/Params.ts +11 -3
  1104. package/src/ts/utils/WebColors.ts +15 -2
  1105. package/src/ts/utils/algorithms/HobbyPath.ts +248 -272
  1106. package/src/ts/utils/helpers/BezierResizeHelper.ts +390 -0
  1107. /package/src/{cjs → _cjs}/utils/_gup.js_ +0 -0
@@ -0,0 +1,1155 @@
1
+ /**
2
+ * @author Ikaros Kappler
3
+ * @date 2018-04-22
4
+ * @modified 2018-08-16 Added the curve() function to draw cubic bézier curves.
5
+ * @modified 2018-10-23 Recognizing the offset param in the circle() function.
6
+ * @modified 2018-11-27 Added the diamondHandle() function.
7
+ * @modified 2018-11-28 Added the grid() function and the ellipse() function.
8
+ * @modified 2018-11-30 Renamed the text() function to label() as it is not scaling.
9
+ * @modified 2018-12-06 Added a test function for drawing arc in SVG style.
10
+ * @modified 2018-12-09 Added the dot(Vertex,color) function (copied from Feigenbaum-plot-script).
11
+ * @modified 2019-01-30 Added the arrow(Vertex,Vertex,color) function for drawing arrow heads.
12
+ * @modified 2019-01-30 Added the image(Image,Vertex,Vertex) function for drawing images.
13
+ * @modified 2019-04-27 Fixed a severe drawing bug in the arrow(...) function. Scaling arrows did not work properly.
14
+ * @modified 2019-04-28 Added Math.round to the dot() drawing parameters to really draw a singlt dot.
15
+ * @modified 2019-06-07 Fixed an issue in the cubicBezier() function. Paths were always closed.
16
+ * @modified 2019-10-03 Added the beginDrawCycle hook.
17
+ * @modified 2019-10-25 Polygons are no longer drawn with dashed lines (solid lines instead).
18
+ * @modified 2019-11-18 Added the polyline function.
19
+ * @modified 2019-11-22 Added a second workaround for th drawImage bug in Safari.
20
+ * @modified 2019-12-07 Added the 'lineWidth' param to the line(...) function.
21
+ * @modified 2019-12-07 Added the 'lineWidth' param to the cubicBezier(...) function.
22
+ * @modified 2019-12-11 Added the 'color' param to the label(...) function.
23
+ * @modified 2019-12-18 Added the quadraticBezier(...) function (for the sake of approximating Lissajous curves).
24
+ * @modified 2019-12-20 Added the 'lineWidth' param to the polyline(...) function.
25
+ * @modified 2020-01-09 Added the 'lineWidth' param to the ellipse(...) function.
26
+ * @modified 2020-03-25 Ported this class from vanilla-JS to Typescript.
27
+ * @modified 2020-05-05 Added the 'lineWidth' param to the circle(...) function.
28
+ * @modified 2020-05-12 Drawing any handles (square, circle, diamond) with lineWidth 1 now; this was not reset before.
29
+ * @modified 2020-06-22 Added a context.clearRect() call to the clear() function; clearing with alpha channel did not work as expected.
30
+ * @modified 2020-09-07 Added the circleArc(...) function to draw sections of circles.
31
+ * @modified 2020-10-06 Removed the .closePath() instruction from the circleArc function.
32
+ * @modified 2020-10-15 Re-added the text() function.
33
+ * @modified 2020-10-28 Added the path(Path2D) function.
34
+ * @modified 2020-12-28 Added the `singleSegment` mode (test).
35
+ * @modified 2021-01-05 Added the image-loaded/broken check.
36
+ * @modified 2021-01-24 Added the `setCurrentId` function from the `DrawLib` interface.
37
+ * @modified 2021-02-22 Added the `path` drawing function to draw SVG path data.
38
+ * @modified 2021-03-31 Added the `endDrawCycle` function from `DrawLib`.
39
+ * @modified 2021-05-31 Added the `setConfiguration` function from `DrawLib`.
40
+ * @modified 2021-11-12 Adding more parameters tot the `text()` function: fontSize, textAlign, fontFamily, lineHeight.
41
+ * @modified 2021-11-19 Added the `color` param to the `label(...)` function.
42
+ * @modified 2022-02-03 Added the `lineWidth` param to the `crosshair` function.
43
+ * @modified 2022-02-03 Added the `cross(...)` function.
44
+ * @modified 2022-03-27 Added the `texturedPoly` function.
45
+ * @modified 2022-06-01 Tweaked the `polyline` function; lineWidth now scales with scale.x.
46
+ * @modified 2022-07-26 Adding `alpha` to the `image(...)` function.
47
+ * @modified 2022-08-23 Fixed a type issue in the `polyline` function.
48
+ * @modified 2022-08-23 Fixed a type issue in the `setConfiguration` function.
49
+ * @modified 2022-08-23 Fixed a type issue in the `path` function.
50
+ * @modified 2023-02-10 The methods `setCurrentClassName` and `setCurrentId` also accept `null` now.
51
+ * @modified 2023-09-29 Removed unused method stub for texturedPoly helper function (cleanup).
52
+ * @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.
53
+ * @modified 2023-09-29 Added the `headLength` parameter to the 'DrawLib.arrow()` function.
54
+ * @modified 2023-09-29 Added the `arrowHead(...)` function to the 'DrawLib.arrow()` interface.
55
+ * @modified 2023-09-29 Added the `cubicBezierArrow(...)` function to the 'DrawLib.arrow()` interface.
56
+ * @modified 2023-09-29 Added the `lineDashes` attribute.
57
+ * @modified 2023-09-30 Adding `strokeOptions` param to these draw function: line, arrow, cubicBezierArrow, cubicBezier, cubicBezierPath, circle, circleArc, ellipse, square, rect, polygon, polyline.
58
+ * @modified 2023-10-07 Adding the optional `arrowHeadBasePositionBuffer` param to the arrowHead(...) method.
59
+ * @modified 2024-09-13 Remoed the scaling of `lineWidth` in the `polygon` and `polyline` methods. This makes no sense here and doesn't match up with the behavior of other line functions.
60
+ * @modified 2026-01-04 Adding `lineJoin` attribute to the `StrokeOptions`.
61
+ * @modified 2026-03-18 Adding `isOpen` parameter to `cubicBezierPath` draw method.
62
+ * @version 1.14.0
63
+ **/
64
+ import { CubicBezierCurve } from "./CubicBezierCurve";
65
+ import { Vertex } from "./Vertex";
66
+ import { drawutilssvg } from "./drawutilssvg";
67
+ import { Vector } from "./Vector";
68
+ // Todo: rename this class to Drawutils?
69
+ /**
70
+ * @classdesc A wrapper class for basic drawing operations.
71
+ *
72
+ * @requires CubicBzierCurvce
73
+ * @requires Polygon
74
+ * @requires Vertex
75
+ * @requires XYCoords
76
+ */
77
+ export class drawutils {
78
+ /**
79
+ * The constructor.
80
+ *
81
+ * @constructor
82
+ * @name drawutils
83
+ * @param {anvasRenderingContext2D} context - The drawing context.
84
+ * @param {boolean} fillShaped - Indicates if the constructed drawutils should fill all drawn shapes (if possible).
85
+ **/
86
+ constructor(context, fillShapes) {
87
+ this.ctx = context;
88
+ // this.lineDash = [];
89
+ this.offset = new Vertex(0, 0);
90
+ this.scale = new Vertex(1, 1);
91
+ this.fillShapes = fillShapes;
92
+ }
93
+ /**
94
+ * A private helper method to apply stroke options to the current
95
+ * context.
96
+ * @param {StrokeOptions=} strokeOptions -
97
+ */
98
+ applyStrokeOpts(strokeOptions) {
99
+ var _a, _b, _c;
100
+ this.ctx.setLineDash(((_a = strokeOptions === null || strokeOptions === void 0 ? void 0 : strokeOptions.dashArray) !== null && _a !== void 0 ? _a : []).map((dashArrayElem) => {
101
+ // Note assume scale.x === scale.y
102
+ // Invariant scale makes funny stuff anyway.
103
+ return dashArrayElem * this.scale.x;
104
+ }));
105
+ this.ctx.lineDashOffset = ((_b = strokeOptions === null || strokeOptions === void 0 ? void 0 : strokeOptions.dashOffset) !== null && _b !== void 0 ? _b : 0) * this.scale.x;
106
+ this.ctx.lineJoin = (_c = strokeOptions === null || strokeOptions === void 0 ? void 0 : strokeOptions.lineJoin) !== null && _c !== void 0 ? _c : null;
107
+ }
108
+ // +---------------------------------------------------------------------------------
109
+ // | This is the final helper function for drawing and filling stuff. It is not
110
+ // | intended to be used from the outside.
111
+ // |
112
+ // | When in draw mode it draws the current shape.
113
+ // | When in fill mode it fills the current shape.
114
+ // |
115
+ // | This function is usually only called internally.
116
+ // |
117
+ // | @param color A stroke/fill color to use.
118
+ // +-------------------------------
119
+ // TODO: convert this to a STATIC function.
120
+ _fillOrDraw(color) {
121
+ if (this.fillShapes) {
122
+ this.ctx.fillStyle = color;
123
+ this.ctx.fill();
124
+ }
125
+ else {
126
+ this.ctx.strokeStyle = color;
127
+ this.ctx.stroke();
128
+ }
129
+ }
130
+ /**
131
+ * Called before each draw cycle.
132
+ * @param {UID=} uid - (optional) A UID identifying the currently drawn element(s).
133
+ **/
134
+ beginDrawCycle(renderTime) {
135
+ // NOOP
136
+ }
137
+ /**
138
+ * Called after each draw cycle.
139
+ *
140
+ * This is required for compatibility with other draw classes in the library (like drawgl).
141
+ *
142
+ * @name endDrawCycle
143
+ * @method
144
+ * @param {number} renderTime
145
+ * @instance
146
+ **/
147
+ endDrawCycle(renderTime) {
148
+ // NOOP
149
+ }
150
+ /**
151
+ * Set the current drawlib configuration.
152
+ *
153
+ * @name setConfiguration
154
+ * @method
155
+ * @param {DrawLibConfiguration} configuration - The new configuration settings to use for the next render methods.
156
+ */
157
+ setConfiguration(configuration) {
158
+ this.ctx.globalCompositeOperation = configuration.blendMode || "source-over";
159
+ }
160
+ // /**
161
+ // * Set or clear the line-dash configuration. Pass `null` for un-dashed lines.
162
+ // *
163
+ // * See https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray
164
+ // * and https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash
165
+ // * for how line dashes work.
166
+ // *
167
+ // * @method
168
+ // * @param {Array<number> lineDashes - The line-dash array configuration.
169
+ // * @returns {void}
170
+ // */
171
+ // setLineDash(lineDash: Array<number>) {
172
+ // this.lineDash = lineDash;
173
+ // }
174
+ /**
175
+ * This method shouled be called each time the currently drawn `Drawable` changes.
176
+ * It is used by some libraries for identifying elemente on re-renders.
177
+ *
178
+ * @name setCurrentId
179
+ * @method
180
+ * @param {UID|null} uid - A UID identifying the currently drawn element(s).
181
+ **/
182
+ setCurrentId(uid) {
183
+ // NOOP
184
+ }
185
+ /**
186
+ * This method shouled be called each time the currently drawn `Drawable` changes.
187
+ * Determine the class name for further usage here.
188
+ *
189
+ * @name setCurrentClassName
190
+ * @method
191
+ * @param {string|null} className - A class name for further custom use cases.
192
+ **/
193
+ setCurrentClassName(className) {
194
+ // NOOP
195
+ }
196
+ /**
197
+ * Draw the line between the given two points with the specified (CSS-) color.
198
+ *
199
+ * @method line
200
+ * @param {XYCoords} zA - The start point of the line.
201
+ * @param {XYCoords} zB - The end point of the line.
202
+ * @param {string} color - Any valid CSS color string.
203
+ * @param {number} lineWidth? - [optional] The line's width.
204
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
205
+ *
206
+ * @return {void}
207
+ * @instance
208
+ * @memberof drawutils
209
+ **/
210
+ line(zA, zB, color, lineWidth, strokeOptions) {
211
+ this.ctx.save();
212
+ this.ctx.beginPath();
213
+ this.applyStrokeOpts(strokeOptions);
214
+ this.ctx.moveTo(this.offset.x + zA.x * this.scale.x, this.offset.y + zA.y * this.scale.y);
215
+ this.ctx.lineTo(this.offset.x + zB.x * this.scale.x, this.offset.y + zB.y * this.scale.y);
216
+ this.ctx.strokeStyle = color;
217
+ this.ctx.lineWidth = lineWidth || 1;
218
+ this.ctx.stroke();
219
+ this.ctx.restore();
220
+ }
221
+ /**
222
+ * Draw a line and an arrow at the end (zB) of the given line with the specified (CSS-) color.
223
+ *
224
+ * @method arrow
225
+ * @param {XYCoords} zA - The start point of the arrow-line.
226
+ * @param {XYCoords} zB - The end point of the arrow-line.
227
+ * @param {string} color - Any valid CSS color string.
228
+ * @param {number=} lineWidth - (optional) The line width to use; default is 1.
229
+ * @param {headLength=8} headLength - (optional) The length of the arrow head (default is 8 units).
230
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
231
+ *
232
+ * @return {void}
233
+ * @instance
234
+ * @memberof drawutils
235
+ **/
236
+ arrow(zA, zB, color, lineWidth, headLength = 8, strokeOptions) {
237
+ const arrowHeadBasePosition = new Vertex(0, 0);
238
+ this.arrowHead(zA, zB, color, lineWidth, headLength, undefined, arrowHeadBasePosition); // Will NOT use dash configuration
239
+ this.line(zA, arrowHeadBasePosition, color, lineWidth, strokeOptions); // Will use dash configuration
240
+ }
241
+ /**
242
+ * 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.
243
+ *
244
+ * @method cubicBezierArrow
245
+ * @param {XYCoords} startPoint - The start point of the cubic Bézier curve
246
+ * @param {XYCoords} endPoint - The end point the cubic Bézier curve.
247
+ * @param {XYCoords} startControlPoint - The start control point the cubic Bézier curve.
248
+ * @param {XYCoords} endControlPoint - The end control point the cubic Bézier curve.
249
+ * @param {string} color - The CSS color to draw the curve with.
250
+ * @param {number} lineWidth - (optional) The line width to use.
251
+ * @param {headLength=8} headLength - (optional) The length of the arrow head (default is 8 units).
252
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
253
+ *
254
+ * @return {void}
255
+ * @instance
256
+ * @memberof DrawLib
257
+ */
258
+ cubicBezierArrow(startPoint, endPoint, startControlPoint, endControlPoint, color, lineWidth, headLength, strokeOptions) {
259
+ const arrowHeadBasePosition = new Vertex(0, 0);
260
+ // Will NOT use dash configuration
261
+ this.arrowHead(endControlPoint, endPoint, color, lineWidth, headLength, undefined, arrowHeadBasePosition);
262
+ const diff = arrowHeadBasePosition.difference(endPoint);
263
+ // Will use dash configuration
264
+ this.cubicBezier(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);
265
+ }
266
+ /**
267
+ * Draw just an arrow head a the end of an imaginary line (zB) of the given line width the specified (CSS-) color and size.
268
+ *
269
+ * @method arrow
270
+ * @param {XYCoords} zA - The start point of the arrow-line.
271
+ * @param {XYCoords} zB - The end point of the arrow-line.
272
+ * @param {string} color - Any valid CSS color string.
273
+ * @param {number=1} lineWidth - (optional) The line width to use; default is 1.
274
+ * @param {number=8} headLength - (optional) The length of the arrow head (default is 8 pixels).
275
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
276
+ * @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.
277
+ *
278
+ * @return {void}
279
+ * @instance
280
+ * @memberof DrawLib
281
+ **/
282
+ arrowHead(zA, zB, color, lineWidth, headLength = 8, strokeOptions, arrowHeadBasePositionBuffer) {
283
+ // var headLength: number = 8; // length of head in pixels
284
+ this.ctx.save();
285
+ this.ctx.beginPath();
286
+ this.applyStrokeOpts(strokeOptions);
287
+ var vertices = Vector.utils.buildArrowHead(zA, zB, headLength, this.scale.x, this.scale.y);
288
+ if (arrowHeadBasePositionBuffer) {
289
+ arrowHeadBasePositionBuffer.x = vertices[0].x / this.scale.x;
290
+ arrowHeadBasePositionBuffer.y = vertices[0].y / this.scale.y;
291
+ }
292
+ this.ctx.moveTo(this.offset.x + vertices[0].x, this.offset.y + vertices[0].y);
293
+ for (var i = 0; i < vertices.length; i++) {
294
+ this.ctx.lineTo(this.offset.x + vertices[i].x, this.offset.y + vertices[i].y);
295
+ }
296
+ this.ctx.lineTo(this.offset.x + vertices[0].x, this.offset.y + vertices[0].y);
297
+ this.ctx.lineWidth = lineWidth || 1;
298
+ this._fillOrDraw(color);
299
+ this.ctx.restore();
300
+ }
301
+ /**
302
+ * Draw an image at the given position with the given size.<br>
303
+ * <br>
304
+ * 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.
305
+ *
306
+ * @method image
307
+ * @param {Image} image - The image object to draw.
308
+ * @param {XYCoords} position - The position to draw the the upper left corner at.
309
+ * @param {XYCoords} size - The x/y-size to draw the image with.
310
+ * @param {number=0.0} alpha - (optional, default=0.0) The transparency (1.0=opaque, 0.0=transparent).
311
+ * @return {void}
312
+ * @instance
313
+ * @memberof drawutils
314
+ **/
315
+ image(image, position, size, alpha = 1.0) {
316
+ if (!image.complete || !image.naturalWidth) {
317
+ // Avoid drawing un-unloaded or broken images
318
+ return;
319
+ }
320
+ this.ctx.save();
321
+ this.ctx.globalAlpha = alpha;
322
+ // Note that there is a Safari bug with the 3 or 5 params variant.
323
+ // Only the 9-param varaint works.
324
+ this.ctx.drawImage(image, 0, 0, image.naturalWidth - 1, // There is this horrible Safari bug (fixed in newer versions)
325
+ image.naturalHeight - 1, // To avoid errors substract 1 here.
326
+ this.offset.x + position.x * this.scale.x, this.offset.y + position.y * this.scale.y, size.x * this.scale.x, size.y * this.scale.y);
327
+ this.ctx.restore();
328
+ }
329
+ /**
330
+ * Draw an image at the given position with the given size.<br>
331
+ * <br>
332
+ * 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.
333
+ *
334
+ * @method texturedPoly
335
+ * @param {Image} textureImage - The image object to draw.
336
+ * @param {Bounds} textureSize - The texture size to use; these are the original bounds to map the polygon vertices to.
337
+ * @param {Polygon} polygon - The polygon to use as clip path.
338
+ * @param {XYCoords} polygonPosition - The polygon's position (relative), measured at the bounding box's center.
339
+ * @param {number} rotation - The rotation to use for the polygon (and for the texture).
340
+ * @param {XYCoords={x:0,y:0}} rotationCenter - (optional) The rotational center; default is center of bounding box.
341
+ * @return {void}
342
+ * @instance
343
+ * @memberof drawutils
344
+ **/
345
+ texturedPoly(textureImage, textureSize, polygon, polygonPosition, rotation) {
346
+ var basePolygonBounds = polygon.getBounds();
347
+ // var targetCenterDifference = polygonPosition.clone().difference(basePolygonBounds.getCenter());
348
+ var targetCenterDifference = new Vertex(polygonPosition.x, polygonPosition.y).difference(basePolygonBounds.getCenter());
349
+ // var tileCenter = basePolygonBounds.getCenter().sub(targetCenterDifference);
350
+ // Get the position offset of the polygon
351
+ var targetTextureSize = new Vertex(textureSize.width, textureSize.height);
352
+ // var targetTextureOffset = new Vertex(-textureSize.width / 2, -textureSize.height / 2).sub(targetCenterDifference);
353
+ var targetTextureOffset = new Vertex(textureSize.min.x, textureSize.min.y).sub(polygonPosition);
354
+ this.ctx.save();
355
+ // this.ctx.translate(this.offset.x + rotationCenter.x * this.scale.x, this.offset.y + rotationCenter.y * this.scale.y);
356
+ this.ctx.translate(this.offset.x + polygonPosition.x * this.scale.x, this.offset.y + polygonPosition.y * this.scale.y);
357
+ drawutils.helpers.clipPoly(this.ctx, {
358
+ x: -polygonPosition.x * this.scale.x,
359
+ y: -polygonPosition.y * this.scale.y
360
+ }, this.scale, polygon.vertices);
361
+ this.ctx.scale(this.scale.x, this.scale.y);
362
+ this.ctx.rotate(rotation);
363
+ this.ctx.drawImage(textureImage, 0, 0, textureImage.naturalWidth - 1, // There is this horrible Safari bug (fixed in newer versions)
364
+ textureImage.naturalHeight - 1, // To avoid errors substract 1 here.
365
+ targetTextureOffset.x, // * this.scale.x,
366
+ targetTextureOffset.y, // * this.scale.y,
367
+ targetTextureSize.x, // * this.scale.x,
368
+ targetTextureSize.y // * this.scale.y
369
+ );
370
+ this.ctx.restore();
371
+ }
372
+ /*
373
+ _texturedPoly(
374
+ textureImage: HTMLImageElement,
375
+ textureSize: Bounds,
376
+ polygon: Polygon,
377
+ polygonPosition: XYCoords,
378
+ rotation: number,
379
+ rotationCenter: XYCoords = { x: 0, y: 0 }
380
+ ): void {
381
+ var basePolygonBounds = polygon.getBounds();
382
+ var targetCenterDifference = polygonPosition.clone().difference(basePolygonBounds.getCenter());
383
+ var rotationalOffset = rotationCenter ? polygonPosition.difference(rotationCenter) : { x: 0, y: 0 };
384
+ // var rotationalOffset = { x: 0, y: 0 };
385
+ var tileCenter = basePolygonBounds.getCenter().sub(targetCenterDifference);
386
+
387
+ // Get the position offset of the polygon
388
+ var targetTextureSize = new Vertex(textureSize.width, textureSize.height);
389
+ var targetTextureOffset = new Vertex(-textureSize.width / 2, -textureSize.height / 2).sub(targetCenterDifference);
390
+
391
+ this.ctx.save();
392
+
393
+ // this.ctx.translate(
394
+ // this.offset.x + (tileCenter.x - rotationalOffset.x * 0 + targetTextureOffset.x * 0.0) * this.scale.x,
395
+ // this.offset.y + (tileCenter.y - rotationalOffset.y * 0 + targetTextureOffset.y * 0.0) * this.scale.y
396
+ // );
397
+ this.ctx.translate(
398
+ this.offset.x + (tileCenter.x - rotationalOffset.x * 0 + targetTextureOffset.x * 0.0) * this.scale.x,
399
+ this.offset.y + (tileCenter.y - rotationalOffset.y * 0 + targetTextureOffset.y * 0.0) * this.scale.y
400
+ );
401
+ this.ctx.rotate(rotation);
402
+
403
+ drawutils.helpers.clipPoly(
404
+ this.ctx,
405
+ {
406
+ x: (-targetCenterDifference.x * 1 - tileCenter.x - rotationalOffset.x) * this.scale.x,
407
+ y: (-targetCenterDifference.y * 1 - tileCenter.y - rotationalOffset.y) * this.scale.y
408
+ },
409
+ this.scale,
410
+ polygon.vertices
411
+ );
412
+ this.ctx.drawImage(
413
+ textureImage,
414
+ 0,
415
+ 0,
416
+ textureImage.naturalWidth - 1, // There is this horrible Safari bug (fixed in newer versions)
417
+ textureImage.naturalHeight - 1, // To avoid errors substract 1 here.
418
+ (-polygonPosition.x + targetTextureOffset.x * 1 - rotationalOffset.x * 1) * this.scale.x,
419
+ (-polygonPosition.y + targetTextureOffset.y * 1 - rotationalOffset.y * 1) * this.scale.y,
420
+ targetTextureSize.x * this.scale.x,
421
+ targetTextureSize.y * this.scale.y
422
+ );
423
+
424
+ // const scaledTextureSize = new Bounds(
425
+ // new Vertex(
426
+ // -polygonPosition.x + targetTextureOffset.x - rotationalOffset.x,
427
+ // -polygonPosition.y + targetTextureOffset.y - rotationalOffset.y
428
+ // ).scaleXY(this.scale, rotationCenter),
429
+ // new Vertex(
430
+ // -polygonPosition.x + targetTextureOffset.x - rotationalOffset.x + targetTextureSize.x,
431
+ // -polygonPosition.y + targetTextureOffset.y - rotationalOffset.y + targetTextureSize.y
432
+ // ).scaleXY(this.scale, rotationCenter)
433
+ // );
434
+ // this.ctx.drawImage(
435
+ // textureImage,
436
+ // 0,
437
+ // 0,
438
+ // textureImage.naturalWidth - 1, // There is this horrible Safari bug (fixed in newer versions)
439
+ // textureImage.naturalHeight - 1, // To avoid errors substract 1 here.
440
+ // scaledTextureSize.min.x,
441
+ // scaledTextureSize.min.y,
442
+ // scaledTextureSize.width,
443
+ // scaledTextureSize.height
444
+ // );
445
+
446
+ this.ctx.restore();
447
+ }
448
+ */
449
+ /**
450
+ * Draw a rectangle.
451
+ *
452
+ * @param {XYCoords} position - The upper left corner of the rectangle.
453
+ * @param {number} width - The width of the rectangle.
454
+ * @param {number} height - The height of the rectangle.
455
+ * @param {string} color - The color to use.
456
+ * @param {number=1} lineWidth - (optional) The line with to use (default is 1).
457
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
458
+ *
459
+ * @return {void}
460
+ * @instance
461
+ * @memberof drawutils
462
+ **/
463
+ rect(position, width, height, color, lineWidth, strokeOptions) {
464
+ this.ctx.save();
465
+ this.ctx.beginPath();
466
+ this.applyStrokeOpts(strokeOptions);
467
+ this.ctx.moveTo(this.offset.x + position.x * this.scale.x, this.offset.y + position.y * this.scale.y);
468
+ this.ctx.lineTo(this.offset.x + (position.x + width) * this.scale.x, this.offset.y + position.y * this.scale.y);
469
+ this.ctx.lineTo(this.offset.x + (position.x + width) * this.scale.x, this.offset.y + (position.y + height) * this.scale.y);
470
+ this.ctx.lineTo(this.offset.x + position.x * this.scale.x, this.offset.y + (position.y + height) * this.scale.y);
471
+ // this.ctx.lineTo( this.offset.x+position.x*this.scale.x, this.offset.y+position.y*this.scale.y );
472
+ this.ctx.closePath();
473
+ this.ctx.lineWidth = lineWidth || 1;
474
+ this._fillOrDraw(color);
475
+ this.ctx.restore();
476
+ }
477
+ /**
478
+ * Draw the given (cubic) bézier curve.
479
+ *
480
+ * @method cubicBezier
481
+ * @param {XYCoords} startPoint - The start point of the cubic Bézier curve
482
+ * @param {XYCoords} endPoint - The end point the cubic Bézier curve.
483
+ * @param {XYCoords} startControlPoint - The start control point the cubic Bézier curve.
484
+ * @param {XYCoords} endControlPoint - The end control point the cubic Bézier curve.
485
+ * @param {string} color - The CSS color to draw the curve with.
486
+ * @param {number} lineWidth - (optional) The line width to use.
487
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
488
+ *
489
+ * @return {void}
490
+ * @instance
491
+ * @memberof drawutils
492
+ */
493
+ cubicBezier(startPoint, endPoint, startControlPoint, endControlPoint, color, lineWidth, strokeOptions) {
494
+ if (startPoint instanceof CubicBezierCurve) {
495
+ this.cubicBezier(startPoint.startPoint, startPoint.endPoint, startPoint.startControlPoint, startPoint.endControlPoint, color, lineWidth);
496
+ return;
497
+ }
498
+ // Draw curve
499
+ this.ctx.save();
500
+ this.ctx.beginPath();
501
+ this.applyStrokeOpts(strokeOptions);
502
+ this.ctx.moveTo(this.offset.x + startPoint.x * this.scale.x, this.offset.y + startPoint.y * this.scale.y);
503
+ this.ctx.bezierCurveTo(this.offset.x + startControlPoint.x * this.scale.x, this.offset.y + startControlPoint.y * this.scale.y, this.offset.x + endControlPoint.x * this.scale.x, this.offset.y + endControlPoint.y * this.scale.y, this.offset.x + endPoint.x * this.scale.x, this.offset.y + endPoint.y * this.scale.y);
504
+ //this.ctx.closePath();
505
+ this.ctx.lineWidth = lineWidth || 2;
506
+ this._fillOrDraw(color);
507
+ this.ctx.restore();
508
+ }
509
+ /**
510
+ * Draw the given (quadratic) bézier curve.
511
+ *
512
+ * @method quadraticBezier
513
+ * @param {XYCoords} startPoint - The start point of the cubic Bézier curve
514
+ * @param {XYCoords} controlPoint - The control point the cubic Bézier curve.
515
+ * @param {XYCoords} endPoint - The end control point the cubic Bézier curve.
516
+ * @param {string} color - The CSS color to draw the curve with.
517
+ * @param {number|string} lineWidth - (optional) The line width to use.
518
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
519
+ *
520
+ * @return {void}
521
+ * @instance
522
+ * @memberof drawutils
523
+ */
524
+ quadraticBezier(startPoint, controlPoint, endPoint, color, lineWidth, strokeOptions) {
525
+ // Draw curve
526
+ this.ctx.save();
527
+ this.ctx.beginPath();
528
+ this.applyStrokeOpts(strokeOptions);
529
+ this.ctx.moveTo(this.offset.x + startPoint.x * this.scale.x, this.offset.y + startPoint.y * this.scale.y);
530
+ this.ctx.quadraticCurveTo(this.offset.x + controlPoint.x * this.scale.x, this.offset.y + controlPoint.y * this.scale.y, this.offset.x + endPoint.x * this.scale.x, this.offset.y + endPoint.y * this.scale.y);
531
+ this.ctx.lineWidth = lineWidth || 2;
532
+ this._fillOrDraw(color);
533
+ this.ctx.restore();
534
+ }
535
+ /**
536
+ * Draw the given (cubic) Bézier path.
537
+ *
538
+ * The given path must be an array with n*3+1 vertices, where n is the number of
539
+ * curves in the path:
540
+ * <pre> [ point1, point1_startControl, point2_endControl, point2, point2_startControl, point3_endControl, point3, ... pointN_endControl, pointN ]</pre>
541
+ *
542
+ * @method cubicBezierPath
543
+ * @param {XYCoords[]} path - The cubic bezier path as described above.
544
+ * @param {string} color - The CSS colot to draw the path with.
545
+ * @param {number=1} lineWidth - (optional) The line width to use.
546
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
547
+ *
548
+ * @return {void}
549
+ * @instance
550
+ * @memberof drawutils
551
+ */
552
+ cubicBezierPath(path, color, lineWidth, strokeOptions, isOpen) {
553
+ if (!path || path.length == 0) {
554
+ return;
555
+ }
556
+ // Draw curve
557
+ this.ctx.save();
558
+ this.ctx.beginPath();
559
+ var endPoint;
560
+ var startControlPoint;
561
+ var endControlPoint;
562
+ this.applyStrokeOpts(strokeOptions);
563
+ this.ctx.moveTo(this.offset.x + path[0].x * this.scale.x, this.offset.y + path[0].y * this.scale.y);
564
+ for (var i = 1; i < path.length; i += 3) {
565
+ startControlPoint = path[i];
566
+ endControlPoint = path[i + 1];
567
+ endPoint = path[i + 2];
568
+ this.ctx.bezierCurveTo(this.offset.x + startControlPoint.x * this.scale.x, this.offset.y + startControlPoint.y * this.scale.y, this.offset.x + endControlPoint.x * this.scale.x, this.offset.y + endControlPoint.y * this.scale.y, this.offset.x + endPoint.x * this.scale.x, this.offset.y + endPoint.y * this.scale.y);
569
+ }
570
+ if (!isOpen) {
571
+ this.ctx.closePath();
572
+ }
573
+ this.ctx.lineWidth = lineWidth || 1;
574
+ this._fillOrDraw(color);
575
+ this.ctx.restore();
576
+ }
577
+ /**
578
+ * Draw the given handle and handle point (used to draw interactive Bézier curves).
579
+ *
580
+ * The colors for this are fixed and cannot be specified.
581
+ *
582
+ * @method handle
583
+ * @param {XYCoords} startPoint - The start of the handle.
584
+ * @param {XYCoords} endPoint - The end point of the handle.
585
+ * @return {void}
586
+ * @instance
587
+ * @memberof drawutils
588
+ */
589
+ handle(startPoint, endPoint) {
590
+ // Draw handles
591
+ // (No need to save and restore here)
592
+ this.point(startPoint, "rgb(0,32,192)");
593
+ this.square(endPoint, 5, "rgba(0,128,192,0.5)");
594
+ }
595
+ /**
596
+ * Draw a handle line (with a light grey).
597
+ *
598
+ * @method handleLine
599
+ * @param {XYCoords} startPoint - The start point to draw the handle at.
600
+ * @param {XYCoords} endPoint - The end point to draw the handle at.
601
+ * @return {void}
602
+ * @instance
603
+ * @memberof drawutils
604
+ */
605
+ handleLine(startPoint, endPoint) {
606
+ // Draw handle lines
607
+ this.line(startPoint, endPoint, "rgba(128,128,128, 0.5)", undefined);
608
+ }
609
+ /**
610
+ * Draw a 1x1 dot with the specified (CSS-) color.
611
+ *
612
+ * @method dot
613
+ * @param {XYCoords} p - The position to draw the dot at.
614
+ * @param {string} color - The CSS color to draw the dot with.
615
+ * @return {void}
616
+ * @instance
617
+ * @memberof drawutils
618
+ */
619
+ dot(p, color) {
620
+ this.ctx.save();
621
+ this.ctx.beginPath();
622
+ this.ctx.setLineDash([]); // Clear line-dash settings
623
+ this.ctx.moveTo(Math.round(this.offset.x + this.scale.x * p.x), Math.round(this.offset.y + this.scale.y * p.y));
624
+ this.ctx.lineTo(Math.round(this.offset.x + this.scale.x * p.x + 1), Math.round(this.offset.y + this.scale.y * p.y + 1));
625
+ this.ctx.closePath();
626
+ this.ctx.lineWidth = 1;
627
+ this._fillOrDraw(color);
628
+ this.ctx.restore();
629
+ }
630
+ /**
631
+ * Draw the given point with the specified (CSS-) color and radius 3.
632
+ *
633
+ * @method point
634
+ * @param {XYCoords} p - The position to draw the point at.
635
+ * @param {string} color - The CSS color to draw the point with.
636
+ * @return {void}
637
+ * @instance
638
+ * @memberof drawutils
639
+ */
640
+ point(p, color) {
641
+ var radius = 3;
642
+ this.ctx.setLineDash([]); // Clear line-dash settings
643
+ this.ctx.beginPath();
644
+ this.ctx.arc(this.offset.x + p.x * this.scale.x, this.offset.y + p.y * this.scale.y, radius, 0, 2 * Math.PI, false);
645
+ this.ctx.closePath();
646
+ this.ctx.lineWidth = 1;
647
+ this._fillOrDraw(color);
648
+ }
649
+ /**
650
+ * Draw a circle with the specified (CSS-) color and radius.<br>
651
+ * <br>
652
+ * Note that if the x- and y- scales are different the result will be an ellipse rather than a circle.
653
+ *
654
+ * @method circle
655
+ * @param {XYCoords} center - The center of the circle.
656
+ * @param {number} radius - The radius of the circle.
657
+ * @param {string} color - The CSS color to draw the circle with.
658
+ * @param {number} lineWidth - The line width (optional, default=1).
659
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
660
+ *
661
+ * @return {void}
662
+ * @instance
663
+ * @memberof drawutils
664
+ */
665
+ circle(center, radius, color, lineWidth, strokeOptions) {
666
+ this.applyStrokeOpts(strokeOptions);
667
+ this.ctx.beginPath();
668
+ this.ctx.ellipse(this.offset.x + center.x * this.scale.x, this.offset.y + center.y * this.scale.y, radius * this.scale.x, radius * this.scale.y, 0.0, 0.0, Math.PI * 2);
669
+ this.ctx.closePath();
670
+ this.ctx.lineWidth = lineWidth || 1;
671
+ this._fillOrDraw(color);
672
+ }
673
+ /**
674
+ * Draw a circular arc (section of a circle) with the given CSS color.
675
+ *
676
+ * @method circleArc
677
+ * @param {XYCoords} center - The center of the circle.
678
+ * @param {number} radius - The radius of the circle.
679
+ * @param {number} startAngle - The angle to start at.
680
+ * @param {number} endAngle - The angle to end at.
681
+ * @param {string=#000000} color - The CSS color to draw the circle with.
682
+ * @param {number=1} lineWidth - The line width to use
683
+ * @param {boolean=false} options.asSegment - If `true` then no beginPath and no draw will be applied (as part of larger path).
684
+ * @param {number=} options.dashOffset - (optional) `See StrokeOptions`.
685
+ * @param {number=[]} options.dashArray - (optional) `See StrokeOptions`.
686
+ *
687
+ * @return {void}
688
+ * @instance
689
+ * @memberof drawutils
690
+ */
691
+ circleArc(center, radius, startAngle, endAngle, color, lineWidth, options) {
692
+ if (!options || !options.asSegment) {
693
+ this.ctx.beginPath();
694
+ }
695
+ this.applyStrokeOpts(options);
696
+ this.ctx.ellipse(this.offset.x + center.x * this.scale.x, this.offset.y + center.y * this.scale.y, radius * this.scale.x, radius * this.scale.y, 0.0, startAngle, endAngle, false);
697
+ if (!options || !options.asSegment) {
698
+ // this.ctx.closePath();
699
+ this.ctx.lineWidth = lineWidth || 1;
700
+ this._fillOrDraw(color || "#000000");
701
+ }
702
+ }
703
+ /**
704
+ * Draw an ellipse with the specified (CSS-) color and thw two radii.
705
+ *
706
+ * @method ellipse
707
+ * @param {XYCoords} center - The center of the ellipse.
708
+ * @param {number} radiusX - The radius of the ellipse.
709
+ * @param {number} radiusY - The radius of the ellipse.
710
+ * @param {string} color - The CSS color to draw the ellipse with.
711
+ * @param {number} lineWidth=1 - An optional line width param (default is 1).
712
+ * @param {number=} rotation - (optional, default=0) The rotation of the ellipse.
713
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
714
+ *
715
+ * @return {void}
716
+ * @instance
717
+ * @memberof drawutils
718
+ */
719
+ ellipse(center, radiusX, radiusY, color, lineWidth, rotation, strokeOptions) {
720
+ if (typeof rotation === "undefined") {
721
+ rotation = 0.0;
722
+ }
723
+ this.applyStrokeOpts(strokeOptions);
724
+ this.ctx.beginPath();
725
+ this.ctx.ellipse(this.offset.x + center.x * this.scale.x, this.offset.y + center.y * this.scale.y, radiusX * this.scale.x, radiusY * this.scale.y, rotation, 0.0, Math.PI * 2);
726
+ this.ctx.closePath();
727
+ this.ctx.lineWidth = lineWidth || 1;
728
+ this._fillOrDraw(color);
729
+ }
730
+ /**
731
+ * Draw square at the given center, size and with the specified (CSS-) color.<br>
732
+ * <br>
733
+ * Note that if the x-scale and the y-scale are different the result will be a rectangle rather than a square.
734
+ *
735
+ * @method square
736
+ * @param {XYCoords} center - The center of the square.
737
+ * @param {number} size - The size of the square.
738
+ * @param {string} color - The CSS color to draw the square with.
739
+ * @param {number} lineWidth - The line with to use (optional, default is 1).
740
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
741
+ *
742
+ * @return {void}
743
+ * @instance
744
+ * @memberof drawutils
745
+ */
746
+ square(center, size, color, lineWidth, strokeOptions) {
747
+ this.applyStrokeOpts(strokeOptions);
748
+ this.ctx.beginPath();
749
+ this.ctx.rect(this.offset.x + (center.x - size / 2.0) * this.scale.x, this.offset.y + (center.y - size / 2.0) * this.scale.y, size * this.scale.x, size * this.scale.y);
750
+ this.ctx.closePath();
751
+ this.ctx.lineWidth = lineWidth || 1;
752
+ this._fillOrDraw(color);
753
+ }
754
+ /**
755
+ * Draw a grid of horizontal and vertical lines with the given (CSS-) color.
756
+ *
757
+ * @method grid
758
+ * @param {XYCoords} center - The center of the grid.
759
+ * @param {number} width - The total width of the grid (width/2 each to the left and to the right).
760
+ * @param {number} height - The total height of the grid (height/2 each to the top and to the bottom).
761
+ * @param {number} sizeX - The horizontal grid size.
762
+ * @param {number} sizeY - The vertical grid size.
763
+ * @param {string} color - The CSS color to draw the grid with.
764
+ * @return {void}
765
+ * @instance
766
+ * @memberof drawutils
767
+ */
768
+ grid(center, width, height, sizeX, sizeY, color) {
769
+ this.ctx.setLineDash([]); // Clear line-dash settings
770
+ this.ctx.beginPath();
771
+ var yMin = -Math.ceil((height * 0.5) / sizeY) * sizeY;
772
+ var yMax = height / 2;
773
+ for (var x = -Math.ceil((width * 0.5) / sizeX) * sizeX; x < width / 2; x += sizeX) {
774
+ this.ctx.moveTo(this.offset.x + (center.x + x) * this.scale.x, this.offset.y + (center.y + yMin) * this.scale.y);
775
+ this.ctx.lineTo(this.offset.x + (center.x + x) * this.scale.x, this.offset.y + (center.y + yMax) * this.scale.y);
776
+ }
777
+ var xMin = -Math.ceil((width * 0.5) / sizeX) * sizeX; // -Math.ceil((height*0.5)/sizeY)*sizeY;
778
+ var xMax = width / 2; // height/2;
779
+ for (var y = -Math.ceil((height * 0.5) / sizeY) * sizeY; y < height / 2; y += sizeY) {
780
+ this.ctx.moveTo(this.offset.x + (center.x + xMin) * this.scale.x - 4, this.offset.y + (center.y + y) * this.scale.y);
781
+ this.ctx.lineTo(this.offset.x + (center.x + xMax) * this.scale.x + 4, this.offset.y + (center.y + y) * this.scale.y);
782
+ }
783
+ this.ctx.strokeStyle = color;
784
+ this.ctx.lineWidth = 1.0;
785
+ this.ctx.stroke();
786
+ this.ctx.closePath();
787
+ }
788
+ /**
789
+ * Draw a raster of crosshairs in the given grid.<br>
790
+ *
791
+ * This works analogue to the grid() function
792
+ *
793
+ * @method raster
794
+ * @param {XYCoords} center - The center of the raster.
795
+ * @param {number} width - The total width of the raster (width/2 each to the left and to the right).
796
+ * @param {number} height - The total height of the raster (height/2 each to the top and to the bottom).
797
+ * @param {number} sizeX - The horizontal raster size.
798
+ * @param {number} sizeY - The vertical raster size.
799
+ * @param {string} color - The CSS color to draw the raster with.
800
+ * @return {void}
801
+ * @instance
802
+ * @memberof drawutils
803
+ */
804
+ raster(center, width, height, sizeX, sizeY, color) {
805
+ this.ctx.save();
806
+ this.ctx.setLineDash([]); // Clear line-dash settings
807
+ this.ctx.beginPath();
808
+ for (var x = -Math.ceil((width * 0.5) / sizeX) * sizeX; x < width / 2; x += sizeX) {
809
+ for (var y = -Math.ceil((height * 0.5) / sizeY) * sizeY; y < height / 2; y += sizeY) {
810
+ // Draw a crosshair
811
+ this.ctx.moveTo(this.offset.x + (center.x + x) * this.scale.x - 4, this.offset.y + (center.y + y) * this.scale.y);
812
+ this.ctx.lineTo(this.offset.x + (center.x + x) * this.scale.x + 4, this.offset.y + (center.y + y) * this.scale.y);
813
+ this.ctx.moveTo(this.offset.x + (center.x + x) * this.scale.x, this.offset.y + (center.y + y) * this.scale.y - 4);
814
+ this.ctx.lineTo(this.offset.x + (center.x + x) * this.scale.x, this.offset.y + (center.y + y) * this.scale.y + 4);
815
+ }
816
+ }
817
+ this.ctx.strokeStyle = color;
818
+ this.ctx.lineWidth = 1.0;
819
+ this.ctx.stroke();
820
+ this.ctx.closePath();
821
+ this.ctx.restore();
822
+ }
823
+ /**
824
+ * Draw a diamond handle (square rotated by 45°) with the given CSS color.
825
+ *
826
+ * It is an inherent feature of the handle functions that the drawn elements are not scaled and not
827
+ * distorted. So even if the user zooms in or changes the aspect ratio, the handles will be drawn
828
+ * as even shaped diamonds.
829
+ *
830
+ * @method diamondHandle
831
+ * @param {XYCoords} center - The center of the diamond.
832
+ * @param {number} size - The x/y-size of the diamond.
833
+ * @param {string} color - The CSS color to draw the diamond with.
834
+ * @return {void}
835
+ * @instance
836
+ * @memberof drawutils
837
+ */
838
+ diamondHandle(center, size, color) {
839
+ this.ctx.setLineDash([]); // Clear line-dash settings
840
+ this.ctx.beginPath();
841
+ this.ctx.moveTo(this.offset.x + center.x * this.scale.x - size / 2.0, this.offset.y + center.y * this.scale.y);
842
+ this.ctx.lineTo(this.offset.x + center.x * this.scale.x, this.offset.y + center.y * this.scale.y - size / 2.0);
843
+ this.ctx.lineTo(this.offset.x + center.x * this.scale.x + size / 2.0, this.offset.y + center.y * this.scale.y);
844
+ this.ctx.lineTo(this.offset.x + center.x * this.scale.x, this.offset.y + center.y * this.scale.y + size / 2.0);
845
+ this.ctx.closePath();
846
+ this.ctx.lineWidth = 1;
847
+ this._fillOrDraw(color);
848
+ }
849
+ /**
850
+ * Draw a square handle with the given CSS color.<br>
851
+ * <br>
852
+ * It is an inherent feature of the handle functions that the drawn elements are not scaled and not
853
+ * distorted. So even if the user zooms in or changes the aspect ratio, the handles will be drawn
854
+ * as even shaped squares.
855
+ *
856
+ * @method squareHandle
857
+ * @param {XYCoords} center - The center of the square.
858
+ * @param {number} size - The x/y-size of the square.
859
+ * @param {string} color - The CSS color to draw the square with.
860
+ * @return {void}
861
+ * @instance
862
+ * @memberof drawutils
863
+ */
864
+ squareHandle(center, size, color) {
865
+ this.ctx.setLineDash([]); // Clear line-dash settings
866
+ this.ctx.beginPath();
867
+ this.ctx.rect(this.offset.x + center.x * this.scale.x - size / 2.0, this.offset.y + center.y * this.scale.y - size / 2.0, size, size);
868
+ this.ctx.closePath();
869
+ this.ctx.lineWidth = 1;
870
+ this._fillOrDraw(color);
871
+ }
872
+ /**
873
+ * Draw a circle handle with the given CSS color.<br>
874
+ * <br>
875
+ * It is an inherent feature of the handle functions that the drawn elements are not scaled and not
876
+ * distorted. So even if the user zooms in or changes the aspect ratio, the handles will be drawn
877
+ * as even shaped circles.
878
+ *
879
+ * @method circleHandle
880
+ * @param {XYCoords} center - The center of the circle.
881
+ * @param {number} radius - The radius of the circle.
882
+ * @param {string} color - The CSS color to draw the circle with.
883
+ * @return {void}
884
+ * @instance
885
+ * @memberof drawutils
886
+ */
887
+ circleHandle(center, radius, color) {
888
+ radius = radius || 3;
889
+ this.ctx.setLineDash([]); // Clear line-dash settings
890
+ this.ctx.beginPath();
891
+ this.ctx.arc(this.offset.x + center.x * this.scale.x, this.offset.y + center.y * this.scale.y, radius, 0, 2 * Math.PI, false);
892
+ this.ctx.closePath();
893
+ this.ctx.lineWidth = 1;
894
+ this._fillOrDraw(color);
895
+ }
896
+ /**
897
+ * Draw a crosshair with given radius and color at the given position.<br>
898
+ * <br>
899
+ * Note that the crosshair radius will not be affected by scaling.
900
+ *
901
+ * @method crosshair
902
+ * @param {XYCoords} center - The center of the crosshair.
903
+ * @param {number} radius - The radius of the crosshair.
904
+ * @param {string} color - The CSS color to draw the crosshair with.
905
+ * @param {number=0.5} lineWidth - (optional, default=0.5) The line width to use.
906
+ * @return {void}
907
+ * @instance
908
+ * @memberof drawutils
909
+ */
910
+ crosshair(center, radius, color, lineWidth) {
911
+ this.ctx.save();
912
+ this.ctx.setLineDash([]); // Clear line-dash settings
913
+ this.ctx.beginPath();
914
+ this.ctx.moveTo(this.offset.x + center.x * this.scale.x - radius, this.offset.y + center.y * this.scale.y);
915
+ this.ctx.lineTo(this.offset.x + center.x * this.scale.x + radius, this.offset.y + center.y * this.scale.y);
916
+ this.ctx.moveTo(this.offset.x + center.x * this.scale.x, this.offset.y + center.y * this.scale.y - radius);
917
+ this.ctx.lineTo(this.offset.x + center.x * this.scale.x, this.offset.y + center.y * this.scale.y + radius);
918
+ this.ctx.strokeStyle = color;
919
+ this.ctx.lineWidth = lineWidth || 0.5;
920
+ this.ctx.stroke();
921
+ this.ctx.closePath();
922
+ this.ctx.restore();
923
+ }
924
+ /**
925
+ * Draw a cross with diagonal axes with given radius, color and lineWidth at the given position.<br>
926
+ * <br>
927
+ * Note that the x's radius will not be affected by scaling.
928
+ *
929
+ * @method crosshair
930
+ * @param {XYCoords} center - The center of the crosshair.
931
+ * @param {number} radius - The radius of the crosshair.
932
+ * @param {string} color - The CSS color to draw the crosshair with.
933
+ * @param {number=1} lineWidth - (optional, default=1.0) The line width to use.
934
+ * @return {void}
935
+ * @instance
936
+ * @memberof drawutils
937
+ */
938
+ cross(center, radius, color, lineWidth) {
939
+ this.ctx.save();
940
+ this.ctx.setLineDash([]); // Clear line-dash settings
941
+ this.ctx.beginPath();
942
+ this.ctx.moveTo(this.offset.x + center.x * this.scale.x - radius, this.offset.y + center.y * this.scale.y - radius);
943
+ this.ctx.lineTo(this.offset.x + center.x * this.scale.x + radius, this.offset.y + center.y * this.scale.y + radius);
944
+ this.ctx.moveTo(this.offset.x + center.x * this.scale.x - radius, this.offset.y + center.y * this.scale.y + radius);
945
+ this.ctx.lineTo(this.offset.x + center.x * this.scale.x + radius, this.offset.y + center.y * this.scale.y - radius);
946
+ this.ctx.strokeStyle = color;
947
+ this.ctx.lineWidth = lineWidth || 1.0;
948
+ this.ctx.stroke();
949
+ this.ctx.closePath();
950
+ this.ctx.restore();
951
+ }
952
+ /**
953
+ * Draw a polygon.
954
+ *
955
+ * @method polygon
956
+ * @param {Polygon} polygon - The polygon to draw.
957
+ * @param {string} color - The CSS color to draw the polygon with.
958
+ * @param {string} lineWidth - The line width to use.
959
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
960
+ *
961
+ * @return {void}
962
+ * @instance
963
+ * @memberof drawutils
964
+ */
965
+ polygon(polygon, color, lineWidth, strokeOptions) {
966
+ this.polyline(polygon.vertices, polygon.isOpen, color, lineWidth, strokeOptions);
967
+ }
968
+ /**
969
+ * Draw a polygon line (alternative function to the polygon).
970
+ *
971
+ * @method polyline
972
+ * @param {XYCoords[]} vertices - The polygon vertices to draw.
973
+ * @param {boolan} isOpen - If true the polyline will not be closed at its end.
974
+ * @param {string} color - The CSS color to draw the polygon with.
975
+ * @param {number} lineWidth - The line width (default is 1.0);
976
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
977
+ *
978
+ * @return {void}
979
+ * @instance
980
+ * @memberof drawutils
981
+ */
982
+ polyline(vertices, isOpen, color, lineWidth, strokeOptions) {
983
+ if (vertices.length <= 1) {
984
+ return;
985
+ }
986
+ this.ctx.save();
987
+ this.applyStrokeOpts(strokeOptions);
988
+ this.ctx.beginPath();
989
+ this.ctx.lineWidth = lineWidth || 1.0;
990
+ this.ctx.moveTo(this.offset.x + vertices[0].x * this.scale.x, this.offset.y + vertices[0].y * this.scale.y);
991
+ for (var i = 0; i < vertices.length; i++) {
992
+ this.ctx.lineTo(this.offset.x + vertices[i].x * this.scale.x, this.offset.y + vertices[i].y * this.scale.y);
993
+ }
994
+ if (!isOpen)
995
+ // && vertices.length > 2 )
996
+ this.ctx.closePath();
997
+ this._fillOrDraw(color);
998
+ this.ctx.closePath();
999
+ this.ctx.setLineDash([]);
1000
+ this.ctx.restore();
1001
+ }
1002
+ /**
1003
+ * Draw a text at the given relative position.
1004
+ *
1005
+ * @method text
1006
+ * @param {string} text - The text to draw.
1007
+ * @param {number} x - The x-position to draw the text at.
1008
+ * @param {number} y - The y-position to draw the text at.
1009
+ * @param {string=} options.color - The Color to use.
1010
+ * @param {string=} options.fontFamily - The font family to use.
1011
+ * @param {number=} options.fontSize - The font size (in pixels) to use.
1012
+ * @param {FontStyle=} options.fontStyle - The font style to use.
1013
+ * @param {FontWeight=} options.fontWeight - The font weight to use.
1014
+ * @param {number=} options.lineHeight - The line height (in pixels) to use.
1015
+ * @param {number=} options.rotation - The (optional) rotation in radians.
1016
+ * @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"`.
1017
+ * @return {void}
1018
+ * @instance
1019
+ * @memberof drawutils
1020
+ */
1021
+ text(text, x, y, options) {
1022
+ // See https://stackoverflow.com/a/23523697
1023
+ var _a, _b, _c;
1024
+ options = options || {};
1025
+ this.ctx.save();
1026
+ let relX = this.offset.x + x * this.scale.x;
1027
+ let relY = this.offset.y + y * this.scale.y;
1028
+ const color = options.color || "black";
1029
+ if (options.fontSize || options.fontFamily) {
1030
+ // Scaling of text only works in uniform mode
1031
+ this.ctx.font =
1032
+ (options.fontWeight ? options.fontWeight + " " : "") +
1033
+ (options.fontStyle ? options.fontStyle + " " : "") +
1034
+ (options.fontSize ? options.fontSize * this.scale.x + "px " : " ") +
1035
+ (options.fontFamily
1036
+ ? options.fontFamily.indexOf(" ") === -1
1037
+ ? options.fontFamily
1038
+ : `"${options.fontFamily}"`
1039
+ : "Arial");
1040
+ }
1041
+ if (options.textAlign) {
1042
+ this.ctx.textAlign = options.textAlign;
1043
+ }
1044
+ const rotation = (_a = options.rotation) !== null && _a !== void 0 ? _a : 0.0;
1045
+ const lineHeight = ((_c = (_b = options.lineHeight) !== null && _b !== void 0 ? _b : options.fontSize) !== null && _c !== void 0 ? _c : 0) * this.scale.x;
1046
+ this.ctx.translate(relX, relY);
1047
+ this.ctx.rotate(rotation);
1048
+ if (this.fillShapes) {
1049
+ this.ctx.fillStyle = color;
1050
+ this.ctx.fillText(text, 0, lineHeight / 2);
1051
+ }
1052
+ else {
1053
+ this.ctx.strokeStyle = color;
1054
+ this.ctx.strokeText(text, 0, lineHeight / 2);
1055
+ }
1056
+ // this.ctx.translate(-relX, -relY);
1057
+ // this.ctx.rotate(-rotation); // is this necessary before 'restore()'?
1058
+ this.ctx.restore();
1059
+ }
1060
+ /**
1061
+ * Draw a non-scaling text label at the given position.
1062
+ *
1063
+ * Note that these are absolute label positions, they are not affected by offset or scale.
1064
+ *
1065
+ * @method label
1066
+ * @param {string} text - The text to draw.
1067
+ * @param {number} x - The x-position to draw the text at.
1068
+ * @param {number} y - The y-position to draw the text at.
1069
+ * @param {number=} rotation - The (optional) rotation in radians (default=0).
1070
+ * @param {string=} color - The color to render the text with (default=black).
1071
+ * @return {void}
1072
+ * @instance
1073
+ * @memberof drawutils
1074
+ */
1075
+ label(text, x, y, rotation, color) {
1076
+ this.ctx.save();
1077
+ this.ctx.font = "lighter 9pt Arial";
1078
+ this.ctx.translate(x, y);
1079
+ if (typeof rotation !== "undefined")
1080
+ this.ctx.rotate(rotation);
1081
+ this.ctx.fillStyle = color || "black";
1082
+ if (this.fillShapes) {
1083
+ this.ctx.fillText(text, 0, 0);
1084
+ }
1085
+ else {
1086
+ this.ctx.strokeText(text, 0, 0);
1087
+ }
1088
+ this.ctx.restore();
1089
+ }
1090
+ /**
1091
+ * Draw an SVG-like path given by the specified path data.
1092
+ *
1093
+ *
1094
+ * @method path
1095
+ * @param {SVGPathData} pathData - An array of path commands and params.
1096
+ * @param {string=null} color - (optional) The color to draw this path with (default is null).
1097
+ * @param {number=1} lineWidth - (optional) the line width to use (default is 1).
1098
+ * @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.
1099
+ * @param {number=} options.dashOffset - (optional) `See StrokeOptions`.
1100
+ * @param {number=[]} options.dashArray - (optional) `See StrokeOptions`.
1101
+ * @instance
1102
+ * @memberof drawutils
1103
+ * @return {R} An instance representing the drawn path.
1104
+ */
1105
+ path(pathData, color, lineWidth, options) {
1106
+ const d = options && options.inplace ? pathData : drawutilssvg.copyPathData(pathData);
1107
+ drawutilssvg.transformPathData(d, this.offset, this.scale);
1108
+ if (color) {
1109
+ this.ctx.strokeStyle = color;
1110
+ }
1111
+ this.ctx.lineWidth = lineWidth || 1;
1112
+ this.applyStrokeOpts(options);
1113
+ if (this.fillShapes) {
1114
+ if (color) {
1115
+ this.ctx.fillStyle = color;
1116
+ }
1117
+ this.ctx.fill(new Path2D(d.join(" ")));
1118
+ }
1119
+ else {
1120
+ if (color) {
1121
+ this.ctx.strokeStyle = color;
1122
+ }
1123
+ this.ctx.stroke(new Path2D(d.join(" ")));
1124
+ }
1125
+ }
1126
+ /**
1127
+ * Due to gl compatibility there is a generic 'clear' function required
1128
+ * to avoid accessing the context object itself directly.
1129
+ *
1130
+ * This function just fills the whole canvas with a single color.
1131
+ *
1132
+ * @param {string} color - The color to clear with.
1133
+ **/
1134
+ clear(color) {
1135
+ this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);
1136
+ this.ctx.fillStyle = color;
1137
+ this.ctx.fillRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);
1138
+ }
1139
+ }
1140
+ drawutils.helpers = {
1141
+ // A helper function to define the clipping path.
1142
+ // This could be a candidate for the draw library.
1143
+ clipPoly: (ctx, offset, scale, vertices) => {
1144
+ ctx.beginPath();
1145
+ // Set clip mask
1146
+ ctx.moveTo(offset.x + vertices[0].x * scale.x, offset.y + vertices[0].y * scale.y);
1147
+ for (var i = 1; i < vertices.length; i++) {
1148
+ const vert = vertices[i];
1149
+ ctx.lineTo(offset.x + vert.x * scale.x, offset.y + vert.y * scale.y);
1150
+ }
1151
+ ctx.closePath();
1152
+ ctx.clip();
1153
+ }
1154
+ };
1155
+ //# sourceMappingURL=draw.js.map