plotboilerplate 1.28.0 → 1.28.1

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 (1022) hide show
  1. package/package.json +1 -1
  2. package/src/_cjs/BezierPath.d.ts +0 -610
  3. package/src/_cjs/BezierPath.js +0 -1127
  4. package/src/_cjs/BezierPath.js.map +0 -1
  5. package/src/_cjs/Bounds.d.ts +0 -252
  6. package/src/_cjs/Bounds.js +0 -320
  7. package/src/_cjs/Bounds.js.map +0 -1
  8. package/src/_cjs/Circle.d.ts +0 -214
  9. package/src/_cjs/Circle.js +0 -339
  10. package/src/_cjs/Circle.js.map +0 -1
  11. package/src/_cjs/CircleSector.d.ts +0 -211
  12. package/src/_cjs/CircleSector.js +0 -364
  13. package/src/_cjs/CircleSector.js.map +0 -1
  14. package/src/_cjs/CubicBezierCurve.d.ts +0 -656
  15. package/src/_cjs/CubicBezierCurve.js +0 -1062
  16. package/src/_cjs/CubicBezierCurve.js.map +0 -1
  17. package/src/_cjs/Grid.d.ts +0 -83
  18. package/src/_cjs/Grid.js +0 -90
  19. package/src/_cjs/Grid.js.map +0 -1
  20. package/src/_cjs/KeyHandler.d.ts +0 -177
  21. package/src/_cjs/KeyHandler.js +0 -435
  22. package/src/_cjs/KeyHandler.js.map +0 -1
  23. package/src/_cjs/Line.d.ts +0 -134
  24. package/src/_cjs/Line.js +0 -220
  25. package/src/_cjs/Line.js.map +0 -1
  26. package/src/_cjs/MouseHandler.d.ts +0 -283
  27. package/src/_cjs/MouseHandler.js +0 -423
  28. package/src/_cjs/MouseHandler.js.map +0 -1
  29. package/src/_cjs/PBImage.d.ts +0 -81
  30. package/src/_cjs/PBImage.js +0 -61
  31. package/src/_cjs/PBImage.js.map +0 -1
  32. package/src/_cjs/PBText.d.ts +0 -118
  33. package/src/_cjs/PBText.js +0 -63
  34. package/src/_cjs/PBText.js.map +0 -1
  35. package/src/_cjs/PlotBoilerplate.d.ts +0 -899
  36. package/src/_cjs/PlotBoilerplate.js +0 -2348
  37. package/src/_cjs/PlotBoilerplate.js.map +0 -1
  38. package/src/_cjs/Polygon.d.ts +0 -520
  39. package/src/_cjs/Polygon.js +0 -933
  40. package/src/_cjs/Polygon.js.map +0 -1
  41. package/src/_cjs/SVGBuilder.d.ts +0 -47
  42. package/src/_cjs/SVGBuilder.js +0 -100
  43. package/src/_cjs/SVGBuilder.js.map +0 -1
  44. package/src/_cjs/Triangle.d.ts +0 -392
  45. package/src/_cjs/Triangle.js +0 -497
  46. package/src/_cjs/Triangle.js.map +0 -1
  47. package/src/_cjs/UIDGenerator.d.ts +0 -12
  48. package/src/_cjs/UIDGenerator.js +0 -21
  49. package/src/_cjs/UIDGenerator.js.map +0 -1
  50. package/src/_cjs/VEllipse.d.ts +0 -319
  51. package/src/_cjs/VEllipse.js +0 -578
  52. package/src/_cjs/VEllipse.js.map +0 -1
  53. package/src/_cjs/VEllipseSector.d.ts +0 -230
  54. package/src/_cjs/VEllipseSector.js +0 -428
  55. package/src/_cjs/VEllipseSector.js.map +0 -1
  56. package/src/_cjs/Vector.d.ts +0 -126
  57. package/src/_cjs/Vector.js +0 -199
  58. package/src/_cjs/Vector.js.map +0 -1
  59. package/src/_cjs/VertTuple.d.ts +0 -284
  60. package/src/_cjs/VertTuple.js +0 -348
  61. package/src/_cjs/VertTuple.js.map +0 -1
  62. package/src/_cjs/Vertex.d.ts +0 -498
  63. package/src/_cjs/Vertex.js +0 -703
  64. package/src/_cjs/Vertex.js.map +0 -1
  65. package/src/_cjs/VertexAttr.d.ts +0 -72
  66. package/src/_cjs/VertexAttr.js +0 -59
  67. package/src/_cjs/VertexAttr.js.map +0 -1
  68. package/src/_cjs/VertexListeners.d.ts +0 -208
  69. package/src/_cjs/VertexListeners.js +0 -267
  70. package/src/_cjs/VertexListeners.js.map +0 -1
  71. package/src/_cjs/draw.d.ts +0 -657
  72. package/src/_cjs/draw.js +0 -1164
  73. package/src/_cjs/draw.js.map +0 -1
  74. package/src/_cjs/drawgl.d.ts +0 -544
  75. package/src/_cjs/drawgl.js +0 -794
  76. package/src/_cjs/drawgl.js.map +0 -1
  77. package/src/_cjs/drawutilssvg.d.ts +0 -954
  78. package/src/_cjs/drawutilssvg.js +0 -1713
  79. package/src/_cjs/drawutilssvg.js.map +0 -1
  80. package/src/_cjs/entry-glsupport.js +0 -28
  81. package/src/_cjs/entry.js +0 -29
  82. package/src/_cjs/geomutils.d.ts +0 -77
  83. package/src/_cjs/geomutils.js +0 -126
  84. package/src/_cjs/geomutils.js.map +0 -1
  85. package/src/_cjs/index.d.ts +0 -102
  86. package/src/_cjs/index.js +0 -128
  87. package/src/_cjs/index.js.map +0 -1
  88. package/src/_cjs/interfaces/DrawLib.d.ts +0 -582
  89. package/src/_cjs/interfaces/DrawLib.js +0 -32
  90. package/src/_cjs/interfaces/DrawLib.js.map +0 -1
  91. package/src/_cjs/interfaces/additionals.d.ts +0 -95
  92. package/src/_cjs/interfaces/additionals.js +0 -3
  93. package/src/_cjs/interfaces/additionals.js.map +0 -1
  94. package/src/_cjs/interfaces/core.d.ts +0 -286
  95. package/src/_cjs/interfaces/core.js +0 -30
  96. package/src/_cjs/interfaces/core.js.map +0 -1
  97. package/src/_cjs/interfaces/externals.d.ts +0 -56
  98. package/src/_cjs/interfaces/externals.js +0 -8
  99. package/src/_cjs/interfaces/externals.js.map +0 -1
  100. package/src/_cjs/interfaces/index.d.ts +0 -4
  101. package/src/_cjs/interfaces/index.js +0 -21
  102. package/src/_cjs/interfaces/index.js.map +0 -1
  103. package/src/_cjs/module.d.ts +0 -26
  104. package/src/_cjs/module.js +0 -60
  105. package/src/_cjs/module.js.map +0 -1
  106. package/src/_cjs/utils/InitializationObserver.d.ts +0 -18
  107. package/src/_cjs/utils/InitializationObserver.js +0 -63
  108. package/src/_cjs/utils/InitializationObserver.js.map +0 -1
  109. package/src/_cjs/utils/LissajousFigure.d.ts +0 -34
  110. package/src/_cjs/utils/LissajousFigure.js +0 -100
  111. package/src/_cjs/utils/LissajousFigure.js.map +0 -1
  112. package/src/_cjs/utils/NGons.d.ts +0 -13
  113. package/src/_cjs/utils/NGons.js +0 -36
  114. package/src/_cjs/utils/NGons.js.map +0 -1
  115. package/src/_cjs/utils/Params.d.ts +0 -17
  116. package/src/_cjs/utils/Params.js +0 -53
  117. package/src/_cjs/utils/Params.js.map +0 -1
  118. package/src/_cjs/utils/PerlinNoise.d.ts +0 -19
  119. package/src/_cjs/utils/PerlinNoise.js +0 -352
  120. package/src/_cjs/utils/PerlinNoise.js.map +0 -1
  121. package/src/_cjs/utils/SVGPathUtils.d.ts +0 -22
  122. package/src/_cjs/utils/SVGPathUtils.js +0 -45
  123. package/src/_cjs/utils/SVGPathUtils.js.map +0 -1
  124. package/src/_cjs/utils/WebColors.d.ts +0 -35
  125. package/src/_cjs/utils/WebColors.js +0 -58
  126. package/src/_cjs/utils/WebColors.js.map +0 -1
  127. package/src/_cjs/utils/WebColorsContrast.d.ts +0 -6
  128. package/src/_cjs/utils/WebColorsContrast.js +0 -12
  129. package/src/_cjs/utils/WebColorsContrast.js.map +0 -1
  130. package/src/_cjs/utils/WebColorsMalachite.d.ts +0 -12
  131. package/src/_cjs/utils/WebColorsMalachite.js +0 -28
  132. package/src/_cjs/utils/WebColorsMalachite.js.map +0 -1
  133. package/src/_cjs/utils/_gup.js_ +0 -13
  134. package/src/_cjs/utils/algorithms/CatmullRomPath.d.ts +0 -60
  135. package/src/_cjs/utils/algorithms/CatmullRomPath.js +0 -108
  136. package/src/_cjs/utils/algorithms/CatmullRomPath.js.map +0 -1
  137. package/src/_cjs/utils/algorithms/CircleIntersections.d.ts +0 -170
  138. package/src/_cjs/utils/algorithms/CircleIntersections.js +0 -310
  139. package/src/_cjs/utils/algorithms/CircleIntersections.js.map +0 -1
  140. package/src/_cjs/utils/algorithms/ContourLineDetection.d.ts +0 -150
  141. package/src/_cjs/utils/algorithms/ContourLineDetection.js +0 -367
  142. package/src/_cjs/utils/algorithms/ContourLineDetection.js.map +0 -1
  143. package/src/_cjs/utils/algorithms/CubicSplinePath.d.ts +0 -63
  144. package/src/_cjs/utils/algorithms/CubicSplinePath.js +0 -175
  145. package/src/_cjs/utils/algorithms/CubicSplinePath.js.map +0 -1
  146. package/src/_cjs/utils/algorithms/HobbyPath.d.ts +0 -81
  147. package/src/_cjs/utils/algorithms/HobbyPath.js +0 -278
  148. package/src/_cjs/utils/algorithms/HobbyPath.js.map +0 -1
  149. package/src/_cjs/utils/algorithms/Metaballs.d.ts +0 -30
  150. package/src/_cjs/utils/algorithms/Metaballs.js +0 -114
  151. package/src/_cjs/utils/algorithms/Metaballs.js.map +0 -1
  152. package/src/_cjs/utils/algorithms/PolygonInset.d.ts +0 -184
  153. package/src/_cjs/utils/algorithms/PolygonInset.js +0 -431
  154. package/src/_cjs/utils/algorithms/PolygonInset.js.map +0 -1
  155. package/src/_cjs/utils/algorithms/PolygonTesselationOutlines.d.ts +0 -145
  156. package/src/_cjs/utils/algorithms/PolygonTesselationOutlines.js +0 -269
  157. package/src/_cjs/utils/algorithms/PolygonTesselationOutlines.js.map +0 -1
  158. package/src/_cjs/utils/algorithms/arrayFill.d.ts +0 -8
  159. package/src/_cjs/utils/algorithms/arrayFill.js +0 -18
  160. package/src/_cjs/utils/algorithms/arrayFill.js.map +0 -1
  161. package/src/_cjs/utils/algorithms/arrayResize.d.ts +0 -8
  162. package/src/_cjs/utils/algorithms/arrayResize.js +0 -24
  163. package/src/_cjs/utils/algorithms/arrayResize.js.map +0 -1
  164. package/src/_cjs/utils/algorithms/arrayShuffle.d.ts +0 -8
  165. package/src/_cjs/utils/algorithms/arrayShuffle.js +0 -15
  166. package/src/_cjs/utils/algorithms/arrayShuffle.js.map +0 -1
  167. package/src/_cjs/utils/algorithms/clearDuplicateVertices.d.ts +0 -22
  168. package/src/_cjs/utils/algorithms/clearDuplicateVertices.js +0 -51
  169. package/src/_cjs/utils/algorithms/clearDuplicateVertices.js.map +0 -1
  170. package/src/_cjs/utils/algorithms/clearPolygonDuplicateVertices.d.ts +0 -24
  171. package/src/_cjs/utils/algorithms/clearPolygonDuplicateVertices.js +0 -61
  172. package/src/_cjs/utils/algorithms/clearPolygonDuplicateVertices.js.map +0 -1
  173. package/src/_cjs/utils/algorithms/convexHull.d.ts +0 -23
  174. package/src/_cjs/utils/algorithms/convexHull.js +0 -71
  175. package/src/_cjs/utils/algorithms/convexHull.js.map +0 -1
  176. package/src/_cjs/utils/algorithms/convexPolygonIncircle.d.ts +0 -41
  177. package/src/_cjs/utils/algorithms/convexPolygonIncircle.js +0 -145
  178. package/src/_cjs/utils/algorithms/convexPolygonIncircle.js.map +0 -1
  179. package/src/_cjs/utils/algorithms/delaunay.d.ts +0 -30
  180. package/src/_cjs/utils/algorithms/delaunay.js +0 -158
  181. package/src/_cjs/utils/algorithms/delaunay.js.map +0 -1
  182. package/src/_cjs/utils/algorithms/delaunay2voronoi.d.ts +0 -25
  183. package/src/_cjs/utils/algorithms/delaunay2voronoi.js +0 -104
  184. package/src/_cjs/utils/algorithms/delaunay2voronoi.js.map +0 -1
  185. package/src/_cjs/utils/algorithms/detectPaths.d.ts +0 -21
  186. package/src/_cjs/utils/algorithms/detectPaths.js +0 -169
  187. package/src/_cjs/utils/algorithms/detectPaths.js.map +0 -1
  188. package/src/_cjs/utils/algorithms/findPolygonSelfIntersections.d.ts +0 -21
  189. package/src/_cjs/utils/algorithms/findPolygonSelfIntersections.js +0 -51
  190. package/src/_cjs/utils/algorithms/findPolygonSelfIntersections.js.map +0 -1
  191. package/src/_cjs/utils/algorithms/getContrastColor.d.ts +0 -13
  192. package/src/_cjs/utils/algorithms/getContrastColor.js +0 -26
  193. package/src/_cjs/utils/algorithms/getContrastColor.js.map +0 -1
  194. package/src/_cjs/utils/algorithms/matrixFill.d.ts +0 -10
  195. package/src/_cjs/utils/algorithms/matrixFill.js +0 -21
  196. package/src/_cjs/utils/algorithms/matrixFill.js.map +0 -1
  197. package/src/_cjs/utils/algorithms/pixelCornersToRoundPaths.d.ts +0 -23
  198. package/src/_cjs/utils/algorithms/pixelCornersToRoundPaths.js +0 -270
  199. package/src/_cjs/utils/algorithms/pixelCornersToRoundPaths.js.map +0 -1
  200. package/src/_cjs/utils/algorithms/splitPolygonToNonIntersecting.d.ts +0 -28
  201. package/src/_cjs/utils/algorithms/splitPolygonToNonIntersecting.js +0 -102
  202. package/src/_cjs/utils/algorithms/splitPolygonToNonIntersecting.js.map +0 -1
  203. package/src/_cjs/utils/algorithms/sutherlandHodgman.d.ts +0 -16
  204. package/src/_cjs/utils/algorithms/sutherlandHodgman.js +0 -76
  205. package/src/_cjs/utils/algorithms/sutherlandHodgman.js.map +0 -1
  206. package/src/_cjs/utils/cloneVertexArray.d.ts +0 -13
  207. package/src/_cjs/utils/cloneVertexArray.js +0 -23
  208. package/src/_cjs/utils/cloneVertexArray.js.map +0 -1
  209. package/src/_cjs/utils/createRandomizedPolygon.d.ts +0 -14
  210. package/src/_cjs/utils/createRandomizedPolygon.js +0 -32
  211. package/src/_cjs/utils/createRandomizedPolygon.js.map +0 -1
  212. package/src/_cjs/utils/creategui.js +0 -434
  213. package/src/_cjs/utils/dat.gui.arrowbounce.polyfill.js +0 -128
  214. package/src/_cjs/utils/dat.gui.title.polyfill.js +0 -35
  215. package/src/_cjs/utils/datastructures/CircularIntervalSet.d.ts +0 -83
  216. package/src/_cjs/utils/datastructures/CircularIntervalSet.js +0 -163
  217. package/src/_cjs/utils/datastructures/CircularIntervalSet.js.map +0 -1
  218. package/src/_cjs/utils/datastructures/Color.d.ts +0 -391
  219. package/src/_cjs/utils/datastructures/Color.js +0 -1084
  220. package/src/_cjs/utils/datastructures/Color.js.map +0 -1
  221. package/src/_cjs/utils/datastructures/ColorGradient.d.ts +0 -81
  222. package/src/_cjs/utils/datastructures/ColorGradient.js +0 -176
  223. package/src/_cjs/utils/datastructures/ColorGradient.js.map +0 -1
  224. package/src/_cjs/utils/datastructures/DataGrid2d.d.ts +0 -53
  225. package/src/_cjs/utils/datastructures/DataGrid2d.js +0 -20
  226. package/src/_cjs/utils/datastructures/DataGrid2d.js.map +0 -1
  227. package/src/_cjs/utils/datastructures/DataGrid2dArrayMatrix.d.ts +0 -88
  228. package/src/_cjs/utils/datastructures/DataGrid2dArrayMatrix.js +0 -155
  229. package/src/_cjs/utils/datastructures/DataGrid2dArrayMatrix.js.map +0 -1
  230. package/src/_cjs/utils/datastructures/DataGrid2dListAdapter.d.ts +0 -59
  231. package/src/_cjs/utils/datastructures/DataGrid2dListAdapter.js +0 -84
  232. package/src/_cjs/utils/datastructures/DataGrid2dListAdapter.js.map +0 -1
  233. package/src/_cjs/utils/datastructures/GenericPath.d.ts +0 -86
  234. package/src/_cjs/utils/datastructures/GenericPath.js +0 -122
  235. package/src/_cjs/utils/datastructures/GenericPath.js.map +0 -1
  236. package/src/_cjs/utils/datastructures/GeometryMesh.d.ts +0 -49
  237. package/src/_cjs/utils/datastructures/GeometryMesh.js +0 -58
  238. package/src/_cjs/utils/datastructures/GeometryMesh.js.map +0 -1
  239. package/src/_cjs/utils/datastructures/Girih.d.ts +0 -181
  240. package/src/_cjs/utils/datastructures/Girih.js +0 -266
  241. package/src/_cjs/utils/datastructures/Girih.js.map +0 -1
  242. package/src/_cjs/utils/datastructures/GirihBowtie.d.ts +0 -37
  243. package/src/_cjs/utils/datastructures/GirihBowtie.js +0 -152
  244. package/src/_cjs/utils/datastructures/GirihBowtie.js.map +0 -1
  245. package/src/_cjs/utils/datastructures/GirihDecagon.d.ts +0 -52
  246. package/src/_cjs/utils/datastructures/GirihDecagon.js +0 -132
  247. package/src/_cjs/utils/datastructures/GirihDecagon.js.map +0 -1
  248. package/src/_cjs/utils/datastructures/GirihHexagon.d.ts +0 -39
  249. package/src/_cjs/utils/datastructures/GirihHexagon.js +0 -200
  250. package/src/_cjs/utils/datastructures/GirihHexagon.js.map +0 -1
  251. package/src/_cjs/utils/datastructures/GirihPenroseRhombus.d.ts +0 -46
  252. package/src/_cjs/utils/datastructures/GirihPenroseRhombus.js +0 -189
  253. package/src/_cjs/utils/datastructures/GirihPenroseRhombus.js.map +0 -1
  254. package/src/_cjs/utils/datastructures/GirihPentagon.d.ts +0 -37
  255. package/src/_cjs/utils/datastructures/GirihPentagon.js +0 -109
  256. package/src/_cjs/utils/datastructures/GirihPentagon.js.map +0 -1
  257. package/src/_cjs/utils/datastructures/GirihRhombus.d.ts +0 -38
  258. package/src/_cjs/utils/datastructures/GirihRhombus.js +0 -155
  259. package/src/_cjs/utils/datastructures/GirihRhombus.js.map +0 -1
  260. package/src/_cjs/utils/datastructures/GirihTile.d.ts +0 -283
  261. package/src/_cjs/utils/datastructures/GirihTile.js +0 -308
  262. package/src/_cjs/utils/datastructures/GirihTile.js.map +0 -1
  263. package/src/_cjs/utils/datastructures/Matrix4x4.d.ts +0 -244
  264. package/src/_cjs/utils/datastructures/Matrix4x4.js +0 -262
  265. package/src/_cjs/utils/datastructures/Matrix4x4.js.map +0 -1
  266. package/src/_cjs/utils/datastructures/VoronoiCell.d.ts +0 -122
  267. package/src/_cjs/utils/datastructures/VoronoiCell.js +0 -183
  268. package/src/_cjs/utils/datastructures/VoronoiCell.js.map +0 -1
  269. package/src/_cjs/utils/datastructures/interfaces.d.ts +0 -13
  270. package/src/_cjs/utils/datastructures/interfaces.js +0 -10
  271. package/src/_cjs/utils/datastructures/interfaces.js.map +0 -1
  272. package/src/_cjs/utils/detectDarkMode.d.ts +0 -10
  273. package/src/_cjs/utils/detectDarkMode.js +0 -41
  274. package/src/_cjs/utils/detectDarkMode.js.map +0 -1
  275. package/src/_cjs/utils/dom/components/ColorGradientPicker.d.ts +0 -246
  276. package/src/_cjs/utils/dom/components/ColorGradientPicker.js +0 -667
  277. package/src/_cjs/utils/dom/components/ColorGradientPicker.js.map +0 -1
  278. package/src/_cjs/utils/dom/components/ColorGradientPickerJSX.d.ts +0 -129
  279. package/src/_cjs/utils/dom/components/ColorGradientPickerJSX.js +0 -520
  280. package/src/_cjs/utils/dom/components/ColorGradientPickerJSX.js.map +0 -1
  281. package/src/_cjs/utils/dom/components/ColorGradientSelector.d.ts +0 -118
  282. package/src/_cjs/utils/dom/components/ColorGradientSelector.js +0 -327
  283. package/src/_cjs/utils/dom/components/ColorGradientSelector.js.map +0 -1
  284. package/src/_cjs/utils/dom/components/Test.d.ts +0 -7
  285. package/src/_cjs/utils/dom/components/Test.js +0 -30
  286. package/src/_cjs/utils/dom/components/Test.js.map +0 -1
  287. package/src/_cjs/utils/dom/getAvailableContainerSpace.d.ts +0 -2
  288. package/src/_cjs/utils/dom/getAvailableContainerSpace.js +0 -29
  289. package/src/_cjs/utils/dom/getAvailableContainerSpace.js.map +0 -1
  290. package/src/_cjs/utils/dom/getFProp.d.ts +0 -5
  291. package/src/_cjs/utils/dom/getFProp.js +0 -12
  292. package/src/_cjs/utils/dom/getFProp.js.map +0 -1
  293. package/src/_cjs/utils/dom/guiSizeToggler.d.ts +0 -18
  294. package/src/_cjs/utils/dom/guiSizeToggler.js +0 -44
  295. package/src/_cjs/utils/dom/guiSizeToggler.js.map +0 -1
  296. package/src/_cjs/utils/findInVertexArray.d.ts +0 -19
  297. package/src/_cjs/utils/findInVertexArray.js +0 -29
  298. package/src/_cjs/utils/findInVertexArray.js.map +0 -1
  299. package/src/_cjs/utils/getFProp.d.ts +0 -5
  300. package/src/_cjs/utils/getFProp.js +0 -12
  301. package/src/_cjs/utils/getFProp.js.map +0 -1
  302. package/src/_cjs/utils/gup.d.ts +0 -14
  303. package/src/_cjs/utils/gup.js +0 -31
  304. package/src/_cjs/utils/gup.js.map +0 -1
  305. package/src/_cjs/utils/helpers/BezierPathInteractionHelper.d.ts +0 -272
  306. package/src/_cjs/utils/helpers/BezierPathInteractionHelper.js +0 -655
  307. package/src/_cjs/utils/helpers/BezierPathInteractionHelper.js.map +0 -1
  308. package/src/_cjs/utils/helpers/CircleHelper.d.ts +0 -73
  309. package/src/_cjs/utils/helpers/CircleHelper.js +0 -93
  310. package/src/_cjs/utils/helpers/CircleHelper.js.map +0 -1
  311. package/src/_cjs/utils/helpers/CircleSectorHelper.d.ts +0 -90
  312. package/src/_cjs/utils/helpers/CircleSectorHelper.js +0 -114
  313. package/src/_cjs/utils/helpers/CircleSectorHelper.js.map +0 -1
  314. package/src/_cjs/utils/helpers/TriangleHelper.d.ts +0 -57
  315. package/src/_cjs/utils/helpers/TriangleHelper.js +0 -83
  316. package/src/_cjs/utils/helpers/TriangleHelper.js.map +0 -1
  317. package/src/_cjs/utils/helpers/VEllipseHelper.d.ts +0 -32
  318. package/src/_cjs/utils/helpers/VEllipseHelper.js +0 -88
  319. package/src/_cjs/utils/helpers/VEllipseHelper.js.map +0 -1
  320. package/src/_cjs/utils/helpers/VEllipseSectorHelper.d.ts +0 -52
  321. package/src/_cjs/utils/helpers/VEllipseSectorHelper.js +0 -135
  322. package/src/_cjs/utils/helpers/VEllipseSectorHelper.js.map +0 -1
  323. package/src/_cjs/utils/io/DndFileHandler.d.ts +0 -63
  324. package/src/_cjs/utils/io/DndFileHandler.js +0 -112
  325. package/src/_cjs/utils/io/DndFileHandler.js.map +0 -1
  326. package/src/_cjs/utils/io/FileDrop.d.ts +0 -110
  327. package/src/_cjs/utils/io/FileDrop.js +0 -177
  328. package/src/_cjs/utils/io/FileDrop.js.map +0 -1
  329. package/src/_cjs/utils/lil.gui.arrowbounce.polyfill.js +0 -133
  330. package/src/_cjs/utils/lil.gui.title.polyfill.js +0 -32
  331. package/src/_cjs/utils/module.js +0 -18
  332. package/src/_cjs/utils/parsers/LinearColorGradientParser.d.ts +0 -78
  333. package/src/_cjs/utils/parsers/LinearColorGradientParser.js +0 -224
  334. package/src/_cjs/utils/parsers/LinearColorGradientParser.js.map +0 -1
  335. package/src/_cjs/utils/parsers/OBJParser.d.ts +0 -24
  336. package/src/_cjs/utils/parsers/OBJParser.js +0 -77
  337. package/src/_cjs/utils/parsers/OBJParser.js.map +0 -1
  338. package/src/_cjs/utils/parsers/STLParser.d.ts +0 -61
  339. package/src/_cjs/utils/parsers/STLParser.js +0 -182
  340. package/src/_cjs/utils/parsers/STLParser.js.map +0 -1
  341. package/src/_cjs/utils/parsers/svg/parseSVGPathData.d.ts +0 -27
  342. package/src/_cjs/utils/parsers/svg/parseSVGPathData.js +0 -486
  343. package/src/_cjs/utils/parsers/svg/parseSVGPathData.js.map +0 -1
  344. package/src/_cjs/utils/parsers/svg/splitSVGPathData.d.ts +0 -20
  345. package/src/_cjs/utils/parsers/svg/splitSVGPathData.js +0 -53
  346. package/src/_cjs/utils/parsers/svg/splitSVGPathData.js.map +0 -1
  347. package/src/_cjs/utils/parsers/svg/types.d.ts +0 -63
  348. package/src/_cjs/utils/parsers/svg/types.js +0 -17
  349. package/src/_cjs/utils/parsers/svg/types.js.map +0 -1
  350. package/src/_cjs/utils/ts-runner.js +0 -146
  351. package/src/_cjs/utils/tsAsyncScriptLoader.js +0 -74
  352. package/src/_esm/BezierPath.d.ts +0 -610
  353. package/src/_esm/BezierPath.js +0 -1124
  354. package/src/_esm/BezierPath.js.map +0 -1
  355. package/src/_esm/Bounds.d.ts +0 -252
  356. package/src/_esm/Bounds.js +0 -317
  357. package/src/_esm/Bounds.js.map +0 -1
  358. package/src/_esm/Circle.d.ts +0 -214
  359. package/src/_esm/Circle.js +0 -335
  360. package/src/_esm/Circle.js.map +0 -1
  361. package/src/_esm/CircleSector.d.ts +0 -211
  362. package/src/_esm/CircleSector.js +0 -359
  363. package/src/_esm/CircleSector.js.map +0 -1
  364. package/src/_esm/CubicBezierCurve.d.ts +0 -656
  365. package/src/_esm/CubicBezierCurve.js +0 -1057
  366. package/src/_esm/CubicBezierCurve.js.map +0 -1
  367. package/src/_esm/Grid.d.ts +0 -83
  368. package/src/_esm/Grid.js +0 -89
  369. package/src/_esm/Grid.js.map +0 -1
  370. package/src/_esm/KeyHandler.d.ts +0 -177
  371. package/src/_esm/KeyHandler.js +0 -434
  372. package/src/_esm/KeyHandler.js.map +0 -1
  373. package/src/_esm/Line.d.ts +0 -134
  374. package/src/_esm/Line.js +0 -200
  375. package/src/_esm/Line.js.map +0 -1
  376. package/src/_esm/MouseHandler.d.ts +0 -283
  377. package/src/_esm/MouseHandler.js +0 -397
  378. package/src/_esm/MouseHandler.js.map +0 -1
  379. package/src/_esm/PBImage.d.ts +0 -81
  380. package/src/_esm/PBImage.js +0 -60
  381. package/src/_esm/PBImage.js.map +0 -1
  382. package/src/_esm/PBText.d.ts +0 -118
  383. package/src/_esm/PBText.js +0 -62
  384. package/src/_esm/PBText.js.map +0 -1
  385. package/src/_esm/PlotBoilerplate.d.ts +0 -899
  386. package/src/_esm/PlotBoilerplate.js +0 -2347
  387. package/src/_esm/PlotBoilerplate.js.map +0 -1
  388. package/src/_esm/Polygon.d.ts +0 -520
  389. package/src/_esm/Polygon.js +0 -924
  390. package/src/_esm/Polygon.js.map +0 -1
  391. package/src/_esm/SVGBuilder.d.ts +0 -47
  392. package/src/_esm/SVGBuilder.js +0 -95
  393. package/src/_esm/SVGBuilder.js.map +0 -1
  394. package/src/_esm/Triangle.d.ts +0 -392
  395. package/src/_esm/Triangle.js +0 -493
  396. package/src/_esm/Triangle.js.map +0 -1
  397. package/src/_esm/UIDGenerator.d.ts +0 -12
  398. package/src/_esm/UIDGenerator.js +0 -18
  399. package/src/_esm/UIDGenerator.js.map +0 -1
  400. package/src/_esm/VEllipse.d.ts +0 -319
  401. package/src/_esm/VEllipse.js +0 -574
  402. package/src/_esm/VEllipse.js.map +0 -1
  403. package/src/_esm/VEllipseSector.d.ts +0 -230
  404. package/src/_esm/VEllipseSector.js +0 -422
  405. package/src/_esm/VEllipseSector.js.map +0 -1
  406. package/src/_esm/Vector.d.ts +0 -126
  407. package/src/_esm/Vector.js +0 -181
  408. package/src/_esm/Vector.js.map +0 -1
  409. package/src/_esm/VertTuple.d.ts +0 -284
  410. package/src/_esm/VertTuple.js +0 -347
  411. package/src/_esm/VertTuple.js.map +0 -1
  412. package/src/_esm/Vertex.d.ts +0 -498
  413. package/src/_esm/Vertex.js +0 -702
  414. package/src/_esm/Vertex.js.map +0 -1
  415. package/src/_esm/VertexAttr.d.ts +0 -72
  416. package/src/_esm/VertexAttr.js +0 -58
  417. package/src/_esm/VertexAttr.js.map +0 -1
  418. package/src/_esm/VertexListeners.d.ts +0 -209
  419. package/src/_esm/VertexListeners.js +0 -270
  420. package/src/_esm/VertexListeners.js.map +0 -1
  421. package/src/_esm/draw.d.ts +0 -657
  422. package/src/_esm/draw.js +0 -1159
  423. package/src/_esm/draw.js.map +0 -1
  424. package/src/_esm/drawgl.d.ts +0 -544
  425. package/src/_esm/drawgl.js +0 -812
  426. package/src/_esm/drawgl.js.map +0 -1
  427. package/src/_esm/drawutilssvg.d.ts +0 -954
  428. package/src/_esm/drawutilssvg.js +0 -1705
  429. package/src/_esm/drawutilssvg.js.map +0 -1
  430. package/src/_esm/entry-glsupport.js +0 -28
  431. package/src/_esm/entry.js +0 -29
  432. package/src/_esm/geomutils.d.ts +0 -77
  433. package/src/_esm/geomutils.js +0 -126
  434. package/src/_esm/geomutils.js.map +0 -1
  435. package/src/_esm/index.d.ts +0 -102
  436. package/src/_esm/index.js +0 -128
  437. package/src/_esm/index.js.map +0 -1
  438. package/src/_esm/interfaces/DrawLib.d.ts +0 -582
  439. package/src/_esm/interfaces/DrawLib.js +0 -32
  440. package/src/_esm/interfaces/DrawLib.js.map +0 -1
  441. package/src/_esm/interfaces/additionals.d.ts +0 -95
  442. package/src/_esm/interfaces/additionals.js +0 -3
  443. package/src/_esm/interfaces/additionals.js.map +0 -1
  444. package/src/_esm/interfaces/core.d.ts +0 -286
  445. package/src/_esm/interfaces/core.js +0 -30
  446. package/src/_esm/interfaces/core.js.map +0 -1
  447. package/src/_esm/interfaces/externals.d.ts +0 -56
  448. package/src/_esm/interfaces/externals.js +0 -8
  449. package/src/_esm/interfaces/externals.js.map +0 -1
  450. package/src/_esm/interfaces/index.d.ts +0 -4
  451. package/src/_esm/interfaces/index.js +0 -21
  452. package/src/_esm/interfaces/index.js.map +0 -1
  453. package/src/_esm/module.d.ts +0 -26
  454. package/src/_esm/module.js +0 -60
  455. package/src/_esm/module.js.map +0 -1
  456. package/src/_esm/src/ts/BezierPath.d.ts +0 -610
  457. package/src/_esm/src/ts/BezierPath.js +0 -1120
  458. package/src/_esm/src/ts/BezierPath.js.map +0 -1
  459. package/src/_esm/src/ts/Bounds.d.ts +0 -252
  460. package/src/_esm/src/ts/Bounds.js +0 -313
  461. package/src/_esm/src/ts/Bounds.js.map +0 -1
  462. package/src/_esm/src/ts/Circle.d.ts +0 -214
  463. package/src/_esm/src/ts/Circle.js +0 -331
  464. package/src/_esm/src/ts/Circle.js.map +0 -1
  465. package/src/_esm/src/ts/CircleSector.d.ts +0 -211
  466. package/src/_esm/src/ts/CircleSector.js +0 -355
  467. package/src/_esm/src/ts/CircleSector.js.map +0 -1
  468. package/src/_esm/src/ts/CubicBezierCurve.d.ts +0 -656
  469. package/src/_esm/src/ts/CubicBezierCurve.js +0 -1053
  470. package/src/_esm/src/ts/CubicBezierCurve.js.map +0 -1
  471. package/src/_esm/src/ts/Grid.d.ts +0 -83
  472. package/src/_esm/src/ts/Grid.js +0 -85
  473. package/src/_esm/src/ts/Grid.js.map +0 -1
  474. package/src/_esm/src/ts/KeyHandler.d.ts +0 -177
  475. package/src/_esm/src/ts/KeyHandler.js +0 -430
  476. package/src/_esm/src/ts/KeyHandler.js.map +0 -1
  477. package/src/_esm/src/ts/Line.d.ts +0 -134
  478. package/src/_esm/src/ts/Line.js +0 -196
  479. package/src/_esm/src/ts/Line.js.map +0 -1
  480. package/src/_esm/src/ts/MouseHandler.d.ts +0 -283
  481. package/src/_esm/src/ts/MouseHandler.js +0 -391
  482. package/src/_esm/src/ts/MouseHandler.js.map +0 -1
  483. package/src/_esm/src/ts/PBImage.d.ts +0 -81
  484. package/src/_esm/src/ts/PBImage.js +0 -56
  485. package/src/_esm/src/ts/PBImage.js.map +0 -1
  486. package/src/_esm/src/ts/PBText.d.ts +0 -118
  487. package/src/_esm/src/ts/PBText.js +0 -58
  488. package/src/_esm/src/ts/PBText.js.map +0 -1
  489. package/src/_esm/src/ts/PlotBoilerplate.d.ts +0 -899
  490. package/src/_esm/src/ts/PlotBoilerplate.js +0 -2340
  491. package/src/_esm/src/ts/PlotBoilerplate.js.map +0 -1
  492. package/src/_esm/src/ts/Polygon.d.ts +0 -520
  493. package/src/_esm/src/ts/Polygon.js +0 -920
  494. package/src/_esm/src/ts/Polygon.js.map +0 -1
  495. package/src/_esm/src/ts/Triangle.d.ts +0 -392
  496. package/src/_esm/src/ts/Triangle.js +0 -489
  497. package/src/_esm/src/ts/Triangle.js.map +0 -1
  498. package/src/_esm/src/ts/UIDGenerator.d.ts +0 -12
  499. package/src/_esm/src/ts/UIDGenerator.js +0 -14
  500. package/src/_esm/src/ts/UIDGenerator.js.map +0 -1
  501. package/src/_esm/src/ts/VEllipse.d.ts +0 -319
  502. package/src/_esm/src/ts/VEllipse.js +0 -570
  503. package/src/_esm/src/ts/VEllipse.js.map +0 -1
  504. package/src/_esm/src/ts/VEllipseSector.d.ts +0 -230
  505. package/src/_esm/src/ts/VEllipseSector.js +0 -418
  506. package/src/_esm/src/ts/VEllipseSector.js.map +0 -1
  507. package/src/_esm/src/ts/Vector.d.ts +0 -126
  508. package/src/_esm/src/ts/Vector.js +0 -177
  509. package/src/_esm/src/ts/Vector.js.map +0 -1
  510. package/src/_esm/src/ts/VertTuple.d.ts +0 -284
  511. package/src/_esm/src/ts/VertTuple.js +0 -343
  512. package/src/_esm/src/ts/VertTuple.js.map +0 -1
  513. package/src/_esm/src/ts/Vertex.d.ts +0 -498
  514. package/src/_esm/src/ts/Vertex.js +0 -698
  515. package/src/_esm/src/ts/Vertex.js.map +0 -1
  516. package/src/_esm/src/ts/VertexAttr.d.ts +0 -72
  517. package/src/_esm/src/ts/VertexAttr.js +0 -54
  518. package/src/_esm/src/ts/VertexAttr.js.map +0 -1
  519. package/src/_esm/src/ts/VertexListeners.d.ts +0 -209
  520. package/src/_esm/src/ts/VertexListeners.js +0 -266
  521. package/src/_esm/src/ts/VertexListeners.js.map +0 -1
  522. package/src/_esm/src/ts/draw.d.ts +0 -657
  523. package/src/_esm/src/ts/draw.js +0 -1155
  524. package/src/_esm/src/ts/draw.js.map +0 -1
  525. package/src/_esm/src/ts/drawgl.d.ts +0 -544
  526. package/src/_esm/src/ts/drawgl.js +0 -808
  527. package/src/_esm/src/ts/drawgl.js.map +0 -1
  528. package/src/_esm/src/ts/drawutilssvg.d.ts +0 -954
  529. package/src/_esm/src/ts/drawutilssvg.js +0 -1701
  530. package/src/_esm/src/ts/drawutilssvg.js.map +0 -1
  531. package/src/_esm/src/ts/geomutils.d.ts +0 -77
  532. package/src/_esm/src/ts/geomutils.js +0 -123
  533. package/src/_esm/src/ts/geomutils.js.map +0 -1
  534. package/src/_esm/src/ts/index.d.ts +0 -102
  535. package/src/_esm/src/ts/index.js +0 -112
  536. package/src/_esm/src/ts/index.js.map +0 -1
  537. package/src/_esm/src/ts/interfaces/DrawLib.d.ts +0 -582
  538. package/src/_esm/src/ts/interfaces/DrawLib.js +0 -31
  539. package/src/_esm/src/ts/interfaces/DrawLib.js.map +0 -1
  540. package/src/_esm/src/ts/interfaces/additionals.d.ts +0 -95
  541. package/src/_esm/src/ts/interfaces/additionals.js +0 -2
  542. package/src/_esm/src/ts/interfaces/additionals.js.map +0 -1
  543. package/src/_esm/src/ts/interfaces/core.d.ts +0 -286
  544. package/src/_esm/src/ts/interfaces/core.js +0 -29
  545. package/src/_esm/src/ts/interfaces/core.js.map +0 -1
  546. package/src/_esm/src/ts/interfaces/externals.d.ts +0 -56
  547. package/src/_esm/src/ts/interfaces/externals.js +0 -7
  548. package/src/_esm/src/ts/interfaces/externals.js.map +0 -1
  549. package/src/_esm/src/ts/interfaces/index.d.ts +0 -4
  550. package/src/_esm/src/ts/interfaces/index.js +0 -5
  551. package/src/_esm/src/ts/interfaces/index.js.map +0 -1
  552. package/src/_esm/src/ts/module.d.ts +0 -26
  553. package/src/_esm/src/ts/module.js +0 -38
  554. package/src/_esm/src/ts/module.js.map +0 -1
  555. package/src/_esm/src/ts/utils/InitializationObserver.d.ts +0 -18
  556. package/src/_esm/src/ts/utils/InitializationObserver.js +0 -57
  557. package/src/_esm/src/ts/utils/InitializationObserver.js.map +0 -1
  558. package/src/_esm/src/ts/utils/LissajousFigure.d.ts +0 -34
  559. package/src/_esm/src/ts/utils/LissajousFigure.js +0 -95
  560. package/src/_esm/src/ts/utils/LissajousFigure.js.map +0 -1
  561. package/src/_esm/src/ts/utils/NGons.d.ts +0 -13
  562. package/src/_esm/src/ts/utils/NGons.js +0 -33
  563. package/src/_esm/src/ts/utils/NGons.js.map +0 -1
  564. package/src/_esm/src/ts/utils/Params.d.ts +0 -17
  565. package/src/_esm/src/ts/utils/Params.js +0 -48
  566. package/src/_esm/src/ts/utils/Params.js.map +0 -1
  567. package/src/_esm/src/ts/utils/PerlinNoise.d.ts +0 -19
  568. package/src/_esm/src/ts/utils/PerlinNoise.js +0 -346
  569. package/src/_esm/src/ts/utils/PerlinNoise.js.map +0 -1
  570. package/src/_esm/src/ts/utils/SVGPathUtils.d.ts +0 -22
  571. package/src/_esm/src/ts/utils/SVGPathUtils.js +0 -42
  572. package/src/_esm/src/ts/utils/SVGPathUtils.js.map +0 -1
  573. package/src/_esm/src/ts/utils/WebColors.d.ts +0 -35
  574. package/src/_esm/src/ts/utils/WebColors.js +0 -54
  575. package/src/_esm/src/ts/utils/WebColors.js.map +0 -1
  576. package/src/_esm/src/ts/utils/WebColorsContrast.d.ts +0 -6
  577. package/src/_esm/src/ts/utils/WebColorsContrast.js +0 -9
  578. package/src/_esm/src/ts/utils/WebColorsContrast.js.map +0 -1
  579. package/src/_esm/src/ts/utils/WebColorsMalachite.d.ts +0 -12
  580. package/src/_esm/src/ts/utils/WebColorsMalachite.js +0 -25
  581. package/src/_esm/src/ts/utils/WebColorsMalachite.js.map +0 -1
  582. package/src/_esm/src/ts/utils/algorithms/CatmullRomPath.d.ts +0 -60
  583. package/src/_esm/src/ts/utils/algorithms/CatmullRomPath.js +0 -103
  584. package/src/_esm/src/ts/utils/algorithms/CatmullRomPath.js.map +0 -1
  585. package/src/_esm/src/ts/utils/algorithms/CircleIntersections.d.ts +0 -170
  586. package/src/_esm/src/ts/utils/algorithms/CircleIntersections.js +0 -303
  587. package/src/_esm/src/ts/utils/algorithms/CircleIntersections.js.map +0 -1
  588. package/src/_esm/src/ts/utils/algorithms/ContourLineDetection.d.ts +0 -150
  589. package/src/_esm/src/ts/utils/algorithms/ContourLineDetection.js +0 -362
  590. package/src/_esm/src/ts/utils/algorithms/ContourLineDetection.js.map +0 -1
  591. package/src/_esm/src/ts/utils/algorithms/CubicSplinePath.d.ts +0 -63
  592. package/src/_esm/src/ts/utils/algorithms/CubicSplinePath.js +0 -170
  593. package/src/_esm/src/ts/utils/algorithms/CubicSplinePath.js.map +0 -1
  594. package/src/_esm/src/ts/utils/algorithms/HobbyPath.d.ts +0 -81
  595. package/src/_esm/src/ts/utils/algorithms/HobbyPath.js +0 -273
  596. package/src/_esm/src/ts/utils/algorithms/HobbyPath.js.map +0 -1
  597. package/src/_esm/src/ts/utils/algorithms/Metaballs.d.ts +0 -30
  598. package/src/_esm/src/ts/utils/algorithms/Metaballs.js +0 -109
  599. package/src/_esm/src/ts/utils/algorithms/Metaballs.js.map +0 -1
  600. package/src/_esm/src/ts/utils/algorithms/PolygonInset.d.ts +0 -184
  601. package/src/_esm/src/ts/utils/algorithms/PolygonInset.js +0 -424
  602. package/src/_esm/src/ts/utils/algorithms/PolygonInset.js.map +0 -1
  603. package/src/_esm/src/ts/utils/algorithms/PolygonTesselationOutlines.d.ts +0 -145
  604. package/src/_esm/src/ts/utils/algorithms/PolygonTesselationOutlines.js +0 -262
  605. package/src/_esm/src/ts/utils/algorithms/PolygonTesselationOutlines.js.map +0 -1
  606. package/src/_esm/src/ts/utils/algorithms/arrayFill.d.ts +0 -8
  607. package/src/_esm/src/ts/utils/algorithms/arrayFill.js +0 -14
  608. package/src/_esm/src/ts/utils/algorithms/arrayFill.js.map +0 -1
  609. package/src/_esm/src/ts/utils/algorithms/arrayResize.d.ts +0 -8
  610. package/src/_esm/src/ts/utils/algorithms/arrayResize.js +0 -20
  611. package/src/_esm/src/ts/utils/algorithms/arrayResize.js.map +0 -1
  612. package/src/_esm/src/ts/utils/algorithms/arrayShuffle.d.ts +0 -8
  613. package/src/_esm/src/ts/utils/algorithms/arrayShuffle.js +0 -11
  614. package/src/_esm/src/ts/utils/algorithms/arrayShuffle.js.map +0 -1
  615. package/src/_esm/src/ts/utils/algorithms/clearDuplicateVertices.d.ts +0 -22
  616. package/src/_esm/src/ts/utils/algorithms/clearDuplicateVertices.js +0 -47
  617. package/src/_esm/src/ts/utils/algorithms/clearDuplicateVertices.js.map +0 -1
  618. package/src/_esm/src/ts/utils/algorithms/clearPolygonDuplicateVertices.d.ts +0 -24
  619. package/src/_esm/src/ts/utils/algorithms/clearPolygonDuplicateVertices.js +0 -57
  620. package/src/_esm/src/ts/utils/algorithms/clearPolygonDuplicateVertices.js.map +0 -1
  621. package/src/_esm/src/ts/utils/algorithms/convexHull.d.ts +0 -23
  622. package/src/_esm/src/ts/utils/algorithms/convexHull.js +0 -67
  623. package/src/_esm/src/ts/utils/algorithms/convexHull.js.map +0 -1
  624. package/src/_esm/src/ts/utils/algorithms/convexPolygonIncircle.d.ts +0 -41
  625. package/src/_esm/src/ts/utils/algorithms/convexPolygonIncircle.js +0 -141
  626. package/src/_esm/src/ts/utils/algorithms/convexPolygonIncircle.js.map +0 -1
  627. package/src/_esm/src/ts/utils/algorithms/delaunay.d.ts +0 -30
  628. package/src/_esm/src/ts/utils/algorithms/delaunay.js +0 -153
  629. package/src/_esm/src/ts/utils/algorithms/delaunay.js.map +0 -1
  630. package/src/_esm/src/ts/utils/algorithms/delaunay2voronoi.d.ts +0 -25
  631. package/src/_esm/src/ts/utils/algorithms/delaunay2voronoi.js +0 -99
  632. package/src/_esm/src/ts/utils/algorithms/delaunay2voronoi.js.map +0 -1
  633. package/src/_esm/src/ts/utils/algorithms/detectPaths.d.ts +0 -21
  634. package/src/_esm/src/ts/utils/algorithms/detectPaths.js +0 -165
  635. package/src/_esm/src/ts/utils/algorithms/detectPaths.js.map +0 -1
  636. package/src/_esm/src/ts/utils/algorithms/findPolygonSelfIntersections.d.ts +0 -21
  637. package/src/_esm/src/ts/utils/algorithms/findPolygonSelfIntersections.js +0 -47
  638. package/src/_esm/src/ts/utils/algorithms/findPolygonSelfIntersections.js.map +0 -1
  639. package/src/_esm/src/ts/utils/algorithms/getContrastColor.d.ts +0 -13
  640. package/src/_esm/src/ts/utils/algorithms/getContrastColor.js +0 -22
  641. package/src/_esm/src/ts/utils/algorithms/getContrastColor.js.map +0 -1
  642. package/src/_esm/src/ts/utils/algorithms/matrixFill.d.ts +0 -10
  643. package/src/_esm/src/ts/utils/algorithms/matrixFill.js +0 -17
  644. package/src/_esm/src/ts/utils/algorithms/matrixFill.js.map +0 -1
  645. package/src/_esm/src/ts/utils/algorithms/pixelCornersToRoundPaths.d.ts +0 -23
  646. package/src/_esm/src/ts/utils/algorithms/pixelCornersToRoundPaths.js +0 -266
  647. package/src/_esm/src/ts/utils/algorithms/pixelCornersToRoundPaths.js.map +0 -1
  648. package/src/_esm/src/ts/utils/algorithms/splitPolygonToNonIntersecting.d.ts +0 -28
  649. package/src/_esm/src/ts/utils/algorithms/splitPolygonToNonIntersecting.js +0 -99
  650. package/src/_esm/src/ts/utils/algorithms/splitPolygonToNonIntersecting.js.map +0 -1
  651. package/src/_esm/src/ts/utils/algorithms/sutherlandHodgman.d.ts +0 -16
  652. package/src/_esm/src/ts/utils/algorithms/sutherlandHodgman.js +0 -72
  653. package/src/_esm/src/ts/utils/algorithms/sutherlandHodgman.js.map +0 -1
  654. package/src/_esm/src/ts/utils/cloneVertexArray.d.ts +0 -13
  655. package/src/_esm/src/ts/utils/cloneVertexArray.js +0 -19
  656. package/src/_esm/src/ts/utils/cloneVertexArray.js.map +0 -1
  657. package/src/_esm/src/ts/utils/createRandomizedPolygon.d.ts +0 -14
  658. package/src/_esm/src/ts/utils/createRandomizedPolygon.js +0 -28
  659. package/src/_esm/src/ts/utils/createRandomizedPolygon.js.map +0 -1
  660. package/src/_esm/src/ts/utils/datastructures/CircularIntervalSet.d.ts +0 -83
  661. package/src/_esm/src/ts/utils/datastructures/CircularIntervalSet.js +0 -158
  662. package/src/_esm/src/ts/utils/datastructures/CircularIntervalSet.js.map +0 -1
  663. package/src/_esm/src/ts/utils/datastructures/Color.d.ts +0 -391
  664. package/src/_esm/src/ts/utils/datastructures/Color.js +0 -1063
  665. package/src/_esm/src/ts/utils/datastructures/Color.js.map +0 -1
  666. package/src/_esm/src/ts/utils/datastructures/ColorGradient.d.ts +0 -81
  667. package/src/_esm/src/ts/utils/datastructures/ColorGradient.js +0 -171
  668. package/src/_esm/src/ts/utils/datastructures/ColorGradient.js.map +0 -1
  669. package/src/_esm/src/ts/utils/datastructures/DataGrid2d.d.ts +0 -53
  670. package/src/_esm/src/ts/utils/datastructures/DataGrid2d.js +0 -19
  671. package/src/_esm/src/ts/utils/datastructures/DataGrid2d.js.map +0 -1
  672. package/src/_esm/src/ts/utils/datastructures/DataGrid2dArrayMatrix.d.ts +0 -88
  673. package/src/_esm/src/ts/utils/datastructures/DataGrid2dArrayMatrix.js +0 -150
  674. package/src/_esm/src/ts/utils/datastructures/DataGrid2dArrayMatrix.js.map +0 -1
  675. package/src/_esm/src/ts/utils/datastructures/DataGrid2dListAdapter.d.ts +0 -59
  676. package/src/_esm/src/ts/utils/datastructures/DataGrid2dListAdapter.js +0 -79
  677. package/src/_esm/src/ts/utils/datastructures/DataGrid2dListAdapter.js.map +0 -1
  678. package/src/_esm/src/ts/utils/datastructures/GenericPath.d.ts +0 -86
  679. package/src/_esm/src/ts/utils/datastructures/GenericPath.js +0 -117
  680. package/src/_esm/src/ts/utils/datastructures/GenericPath.js.map +0 -1
  681. package/src/_esm/src/ts/utils/datastructures/GeometryMesh.d.ts +0 -49
  682. package/src/_esm/src/ts/utils/datastructures/GeometryMesh.js +0 -53
  683. package/src/_esm/src/ts/utils/datastructures/GeometryMesh.js.map +0 -1
  684. package/src/_esm/src/ts/utils/datastructures/Girih.d.ts +0 -181
  685. package/src/_esm/src/ts/utils/datastructures/Girih.js +0 -261
  686. package/src/_esm/src/ts/utils/datastructures/Girih.js.map +0 -1
  687. package/src/_esm/src/ts/utils/datastructures/GirihBowtie.d.ts +0 -37
  688. package/src/_esm/src/ts/utils/datastructures/GirihBowtie.js +0 -130
  689. package/src/_esm/src/ts/utils/datastructures/GirihBowtie.js.map +0 -1
  690. package/src/_esm/src/ts/utils/datastructures/GirihDecagon.d.ts +0 -52
  691. package/src/_esm/src/ts/utils/datastructures/GirihDecagon.js +0 -110
  692. package/src/_esm/src/ts/utils/datastructures/GirihDecagon.js.map +0 -1
  693. package/src/_esm/src/ts/utils/datastructures/GirihHexagon.d.ts +0 -39
  694. package/src/_esm/src/ts/utils/datastructures/GirihHexagon.js +0 -178
  695. package/src/_esm/src/ts/utils/datastructures/GirihHexagon.js.map +0 -1
  696. package/src/_esm/src/ts/utils/datastructures/GirihPenroseRhombus.d.ts +0 -46
  697. package/src/_esm/src/ts/utils/datastructures/GirihPenroseRhombus.js +0 -167
  698. package/src/_esm/src/ts/utils/datastructures/GirihPenroseRhombus.js.map +0 -1
  699. package/src/_esm/src/ts/utils/datastructures/GirihPentagon.d.ts +0 -37
  700. package/src/_esm/src/ts/utils/datastructures/GirihPentagon.js +0 -87
  701. package/src/_esm/src/ts/utils/datastructures/GirihPentagon.js.map +0 -1
  702. package/src/_esm/src/ts/utils/datastructures/GirihRhombus.d.ts +0 -38
  703. package/src/_esm/src/ts/utils/datastructures/GirihRhombus.js +0 -133
  704. package/src/_esm/src/ts/utils/datastructures/GirihRhombus.js.map +0 -1
  705. package/src/_esm/src/ts/utils/datastructures/GirihTile.d.ts +0 -283
  706. package/src/_esm/src/ts/utils/datastructures/GirihTile.js +0 -286
  707. package/src/_esm/src/ts/utils/datastructures/GirihTile.js.map +0 -1
  708. package/src/_esm/src/ts/utils/datastructures/Matrix4x4.d.ts +0 -244
  709. package/src/_esm/src/ts/utils/datastructures/Matrix4x4.js +0 -246
  710. package/src/_esm/src/ts/utils/datastructures/Matrix4x4.js.map +0 -1
  711. package/src/_esm/src/ts/utils/datastructures/VoronoiCell.d.ts +0 -122
  712. package/src/_esm/src/ts/utils/datastructures/VoronoiCell.js +0 -178
  713. package/src/_esm/src/ts/utils/datastructures/VoronoiCell.js.map +0 -1
  714. package/src/_esm/src/ts/utils/datastructures/interfaces.d.ts +0 -13
  715. package/src/_esm/src/ts/utils/datastructures/interfaces.js +0 -9
  716. package/src/_esm/src/ts/utils/datastructures/interfaces.js.map +0 -1
  717. package/src/_esm/src/ts/utils/detectDarkMode.d.ts +0 -10
  718. package/src/_esm/src/ts/utils/detectDarkMode.js +0 -37
  719. package/src/_esm/src/ts/utils/detectDarkMode.js.map +0 -1
  720. package/src/_esm/src/ts/utils/dom/components/ColorGradientPicker.d.ts +0 -246
  721. package/src/_esm/src/ts/utils/dom/components/ColorGradientPicker.js +0 -743
  722. package/src/_esm/src/ts/utils/dom/components/ColorGradientPicker.js.map +0 -1
  723. package/src/_esm/src/ts/utils/dom/components/ColorGradientSelector.d.ts +0 -118
  724. package/src/_esm/src/ts/utils/dom/components/ColorGradientSelector.js +0 -339
  725. package/src/_esm/src/ts/utils/dom/components/ColorGradientSelector.js.map +0 -1
  726. package/src/_esm/src/ts/utils/dom/components/Test.d.ts +0 -7
  727. package/src/_esm/src/ts/utils/dom/components/Test.js +0 -26
  728. package/src/_esm/src/ts/utils/dom/components/Test.js.map +0 -1
  729. package/src/_esm/src/ts/utils/dom/getAvailableContainerSpace.d.ts +0 -2
  730. package/src/_esm/src/ts/utils/dom/getAvailableContainerSpace.js +0 -25
  731. package/src/_esm/src/ts/utils/dom/getAvailableContainerSpace.js.map +0 -1
  732. package/src/_esm/src/ts/utils/dom/getFProp.d.ts +0 -5
  733. package/src/_esm/src/ts/utils/dom/getFProp.js +0 -8
  734. package/src/_esm/src/ts/utils/dom/getFProp.js.map +0 -1
  735. package/src/_esm/src/ts/utils/dom/guiSizeToggler.d.ts +0 -18
  736. package/src/_esm/src/ts/utils/dom/guiSizeToggler.js +0 -40
  737. package/src/_esm/src/ts/utils/dom/guiSizeToggler.js.map +0 -1
  738. package/src/_esm/src/ts/utils/findInVertexArray.d.ts +0 -19
  739. package/src/_esm/src/ts/utils/findInVertexArray.js +0 -25
  740. package/src/_esm/src/ts/utils/findInVertexArray.js.map +0 -1
  741. package/src/_esm/src/ts/utils/gup.d.ts +0 -14
  742. package/src/_esm/src/ts/utils/gup.js +0 -27
  743. package/src/_esm/src/ts/utils/gup.js.map +0 -1
  744. package/src/_esm/src/ts/utils/helpers/BezierPathInteractionHelper.d.ts +0 -272
  745. package/src/_esm/src/ts/utils/helpers/BezierPathInteractionHelper.js +0 -648
  746. package/src/_esm/src/ts/utils/helpers/BezierPathInteractionHelper.js.map +0 -1
  747. package/src/_esm/src/ts/utils/helpers/CircleHelper.d.ts +0 -73
  748. package/src/_esm/src/ts/utils/helpers/CircleHelper.js +0 -88
  749. package/src/_esm/src/ts/utils/helpers/CircleHelper.js.map +0 -1
  750. package/src/_esm/src/ts/utils/helpers/CircleSectorHelper.d.ts +0 -90
  751. package/src/_esm/src/ts/utils/helpers/CircleSectorHelper.js +0 -109
  752. package/src/_esm/src/ts/utils/helpers/CircleSectorHelper.js.map +0 -1
  753. package/src/_esm/src/ts/utils/helpers/TriangleHelper.d.ts +0 -57
  754. package/src/_esm/src/ts/utils/helpers/TriangleHelper.js +0 -78
  755. package/src/_esm/src/ts/utils/helpers/TriangleHelper.js.map +0 -1
  756. package/src/_esm/src/ts/utils/helpers/VEllipseHelper.d.ts +0 -32
  757. package/src/_esm/src/ts/utils/helpers/VEllipseHelper.js +0 -83
  758. package/src/_esm/src/ts/utils/helpers/VEllipseHelper.js.map +0 -1
  759. package/src/_esm/src/ts/utils/helpers/VEllipseSectorHelper.d.ts +0 -52
  760. package/src/_esm/src/ts/utils/helpers/VEllipseSectorHelper.js +0 -130
  761. package/src/_esm/src/ts/utils/helpers/VEllipseSectorHelper.js.map +0 -1
  762. package/src/_esm/src/ts/utils/io/FileDrop.d.ts +0 -110
  763. package/src/_esm/src/ts/utils/io/FileDrop.js +0 -171
  764. package/src/_esm/src/ts/utils/io/FileDrop.js.map +0 -1
  765. package/src/_esm/src/ts/utils/parsers/LinearColorGradientParser.d.ts +0 -78
  766. package/src/_esm/src/ts/utils/parsers/LinearColorGradientParser.js +0 -217
  767. package/src/_esm/src/ts/utils/parsers/LinearColorGradientParser.js.map +0 -1
  768. package/src/_esm/src/ts/utils/parsers/OBJParser.d.ts +0 -24
  769. package/src/_esm/src/ts/utils/parsers/OBJParser.js +0 -72
  770. package/src/_esm/src/ts/utils/parsers/OBJParser.js.map +0 -1
  771. package/src/_esm/src/ts/utils/parsers/STLParser.d.ts +0 -61
  772. package/src/_esm/src/ts/utils/parsers/STLParser.js +0 -175
  773. package/src/_esm/src/ts/utils/parsers/STLParser.js.map +0 -1
  774. package/src/_esm/src/ts/utils/parsers/svg/parseSVGPathData.d.ts +0 -27
  775. package/src/_esm/src/ts/utils/parsers/svg/parseSVGPathData.js +0 -482
  776. package/src/_esm/src/ts/utils/parsers/svg/parseSVGPathData.js.map +0 -1
  777. package/src/_esm/src/ts/utils/parsers/svg/splitSVGPathData.d.ts +0 -20
  778. package/src/_esm/src/ts/utils/parsers/svg/splitSVGPathData.js +0 -49
  779. package/src/_esm/src/ts/utils/parsers/svg/splitSVGPathData.js.map +0 -1
  780. package/src/_esm/src/ts/utils/parsers/svg/types.d.ts +0 -63
  781. package/src/_esm/src/ts/utils/parsers/svg/types.js +0 -16
  782. package/src/_esm/src/ts/utils/parsers/svg/types.js.map +0 -1
  783. package/src/_esm/utils/InitializationObserver.d.ts +0 -18
  784. package/src/_esm/utils/InitializationObserver.js +0 -61
  785. package/src/_esm/utils/InitializationObserver.js.map +0 -1
  786. package/src/_esm/utils/LissajousFigure.d.ts +0 -34
  787. package/src/_esm/utils/LissajousFigure.js +0 -99
  788. package/src/_esm/utils/LissajousFigure.js.map +0 -1
  789. package/src/_esm/utils/NGons.d.ts +0 -13
  790. package/src/_esm/utils/NGons.js +0 -36
  791. package/src/_esm/utils/NGons.js.map +0 -1
  792. package/src/_esm/utils/Params.d.ts +0 -17
  793. package/src/_esm/utils/Params.js +0 -52
  794. package/src/_esm/utils/Params.js.map +0 -1
  795. package/src/_esm/utils/PerlinNoise.d.ts +0 -19
  796. package/src/_esm/utils/PerlinNoise.js +0 -350
  797. package/src/_esm/utils/PerlinNoise.js.map +0 -1
  798. package/src/_esm/utils/SVGPathUtils.d.ts +0 -22
  799. package/src/_esm/utils/SVGPathUtils.js +0 -45
  800. package/src/_esm/utils/SVGPathUtils.js.map +0 -1
  801. package/src/_esm/utils/WebColors.d.ts +0 -35
  802. package/src/_esm/utils/WebColors.js +0 -58
  803. package/src/_esm/utils/WebColors.js.map +0 -1
  804. package/src/_esm/utils/WebColorsContrast.d.ts +0 -6
  805. package/src/_esm/utils/WebColorsContrast.js +0 -12
  806. package/src/_esm/utils/WebColorsContrast.js.map +0 -1
  807. package/src/_esm/utils/WebColorsMalachite.d.ts +0 -12
  808. package/src/_esm/utils/WebColorsMalachite.js +0 -28
  809. package/src/_esm/utils/WebColorsMalachite.js.map +0 -1
  810. package/src/_esm/utils/algorithms/CatmullRomPath.d.ts +0 -60
  811. package/src/_esm/utils/algorithms/CatmullRomPath.js +0 -107
  812. package/src/_esm/utils/algorithms/CatmullRomPath.js.map +0 -1
  813. package/src/_esm/utils/algorithms/CircleIntersections.d.ts +0 -170
  814. package/src/_esm/utils/algorithms/CircleIntersections.js +0 -307
  815. package/src/_esm/utils/algorithms/CircleIntersections.js.map +0 -1
  816. package/src/_esm/utils/algorithms/ContourLineDetection.d.ts +0 -150
  817. package/src/_esm/utils/algorithms/ContourLineDetection.js +0 -366
  818. package/src/_esm/utils/algorithms/ContourLineDetection.js.map +0 -1
  819. package/src/_esm/utils/algorithms/CubicSplinePath.d.ts +0 -63
  820. package/src/_esm/utils/algorithms/CubicSplinePath.js +0 -174
  821. package/src/_esm/utils/algorithms/CubicSplinePath.js.map +0 -1
  822. package/src/_esm/utils/algorithms/HobbyPath.d.ts +0 -81
  823. package/src/_esm/utils/algorithms/HobbyPath.js +0 -277
  824. package/src/_esm/utils/algorithms/HobbyPath.js.map +0 -1
  825. package/src/_esm/utils/algorithms/Metaballs.d.ts +0 -30
  826. package/src/_esm/utils/algorithms/Metaballs.js +0 -113
  827. package/src/_esm/utils/algorithms/Metaballs.js.map +0 -1
  828. package/src/_esm/utils/algorithms/PolygonInset.d.ts +0 -184
  829. package/src/_esm/utils/algorithms/PolygonInset.js +0 -428
  830. package/src/_esm/utils/algorithms/PolygonInset.js.map +0 -1
  831. package/src/_esm/utils/algorithms/PolygonTesselationOutlines.d.ts +0 -145
  832. package/src/_esm/utils/algorithms/PolygonTesselationOutlines.js +0 -267
  833. package/src/_esm/utils/algorithms/PolygonTesselationOutlines.js.map +0 -1
  834. package/src/_esm/utils/algorithms/arrayFill.d.ts +0 -8
  835. package/src/_esm/utils/algorithms/arrayFill.js +0 -18
  836. package/src/_esm/utils/algorithms/arrayFill.js.map +0 -1
  837. package/src/_esm/utils/algorithms/arrayResize.d.ts +0 -8
  838. package/src/_esm/utils/algorithms/arrayResize.js +0 -24
  839. package/src/_esm/utils/algorithms/arrayResize.js.map +0 -1
  840. package/src/_esm/utils/algorithms/arrayShuffle.d.ts +0 -8
  841. package/src/_esm/utils/algorithms/arrayShuffle.js +0 -15
  842. package/src/_esm/utils/algorithms/arrayShuffle.js.map +0 -1
  843. package/src/_esm/utils/algorithms/clearDuplicateVertices.d.ts +0 -22
  844. package/src/_esm/utils/algorithms/clearDuplicateVertices.js +0 -51
  845. package/src/_esm/utils/algorithms/clearDuplicateVertices.js.map +0 -1
  846. package/src/_esm/utils/algorithms/clearPolygonDuplicateVertices.d.ts +0 -24
  847. package/src/_esm/utils/algorithms/clearPolygonDuplicateVertices.js +0 -61
  848. package/src/_esm/utils/algorithms/clearPolygonDuplicateVertices.js.map +0 -1
  849. package/src/_esm/utils/algorithms/convexHull.d.ts +0 -23
  850. package/src/_esm/utils/algorithms/convexHull.js +0 -71
  851. package/src/_esm/utils/algorithms/convexHull.js.map +0 -1
  852. package/src/_esm/utils/algorithms/convexPolygonIncircle.d.ts +0 -41
  853. package/src/_esm/utils/algorithms/convexPolygonIncircle.js +0 -145
  854. package/src/_esm/utils/algorithms/convexPolygonIncircle.js.map +0 -1
  855. package/src/_esm/utils/algorithms/createRandomizedPolygon.d.ts +0 -14
  856. package/src/_esm/utils/algorithms/createRandomizedPolygon.js +0 -28
  857. package/src/_esm/utils/algorithms/createRandomizedPolygon.js.map +0 -1
  858. package/src/_esm/utils/algorithms/delaunay.d.ts +0 -30
  859. package/src/_esm/utils/algorithms/delaunay.js +0 -157
  860. package/src/_esm/utils/algorithms/delaunay.js.map +0 -1
  861. package/src/_esm/utils/algorithms/delaunay2voronoi.d.ts +0 -25
  862. package/src/_esm/utils/algorithms/delaunay2voronoi.js +0 -103
  863. package/src/_esm/utils/algorithms/delaunay2voronoi.js.map +0 -1
  864. package/src/_esm/utils/algorithms/detectPaths.d.ts +0 -21
  865. package/src/_esm/utils/algorithms/detectPaths.js +0 -169
  866. package/src/_esm/utils/algorithms/detectPaths.js.map +0 -1
  867. package/src/_esm/utils/algorithms/findPolygonSelfIntersections.d.ts +0 -21
  868. package/src/_esm/utils/algorithms/findPolygonSelfIntersections.js +0 -51
  869. package/src/_esm/utils/algorithms/findPolygonSelfIntersections.js.map +0 -1
  870. package/src/_esm/utils/algorithms/getContrastColor.d.ts +0 -13
  871. package/src/_esm/utils/algorithms/getContrastColor.js +0 -26
  872. package/src/_esm/utils/algorithms/getContrastColor.js.map +0 -1
  873. package/src/_esm/utils/algorithms/matrixFill.d.ts +0 -10
  874. package/src/_esm/utils/algorithms/matrixFill.js +0 -21
  875. package/src/_esm/utils/algorithms/matrixFill.js.map +0 -1
  876. package/src/_esm/utils/algorithms/pixelCornersToRoundPaths.d.ts +0 -23
  877. package/src/_esm/utils/algorithms/pixelCornersToRoundPaths.js +0 -270
  878. package/src/_esm/utils/algorithms/pixelCornersToRoundPaths.js.map +0 -1
  879. package/src/_esm/utils/algorithms/splitPolygonToNonIntersecting.d.ts +0 -28
  880. package/src/_esm/utils/algorithms/splitPolygonToNonIntersecting.js +0 -102
  881. package/src/_esm/utils/algorithms/splitPolygonToNonIntersecting.js.map +0 -1
  882. package/src/_esm/utils/algorithms/sutherlandHodgman.d.ts +0 -16
  883. package/src/_esm/utils/algorithms/sutherlandHodgman.js +0 -76
  884. package/src/_esm/utils/algorithms/sutherlandHodgman.js.map +0 -1
  885. package/src/_esm/utils/cloneVertexArray.d.ts +0 -13
  886. package/src/_esm/utils/cloneVertexArray.js +0 -23
  887. package/src/_esm/utils/cloneVertexArray.js.map +0 -1
  888. package/src/_esm/utils/createRandomizedPolygon.d.ts +0 -14
  889. package/src/_esm/utils/createRandomizedPolygon.js +0 -32
  890. package/src/_esm/utils/createRandomizedPolygon.js.map +0 -1
  891. package/src/_esm/utils/datastructures/CircularIntervalSet.d.ts +0 -83
  892. package/src/_esm/utils/datastructures/CircularIntervalSet.js +0 -162
  893. package/src/_esm/utils/datastructures/CircularIntervalSet.js.map +0 -1
  894. package/src/_esm/utils/datastructures/Color.d.ts +0 -391
  895. package/src/_esm/utils/datastructures/Color.js +0 -1067
  896. package/src/_esm/utils/datastructures/Color.js.map +0 -1
  897. package/src/_esm/utils/datastructures/ColorGradient.d.ts +0 -81
  898. package/src/_esm/utils/datastructures/ColorGradient.js +0 -175
  899. package/src/_esm/utils/datastructures/ColorGradient.js.map +0 -1
  900. package/src/_esm/utils/datastructures/DataGrid2d.d.ts +0 -53
  901. package/src/_esm/utils/datastructures/DataGrid2d.js +0 -20
  902. package/src/_esm/utils/datastructures/DataGrid2d.js.map +0 -1
  903. package/src/_esm/utils/datastructures/DataGrid2dArrayMatrix.d.ts +0 -88
  904. package/src/_esm/utils/datastructures/DataGrid2dArrayMatrix.js +0 -154
  905. package/src/_esm/utils/datastructures/DataGrid2dArrayMatrix.js.map +0 -1
  906. package/src/_esm/utils/datastructures/DataGrid2dListAdapter.d.ts +0 -59
  907. package/src/_esm/utils/datastructures/DataGrid2dListAdapter.js +0 -83
  908. package/src/_esm/utils/datastructures/DataGrid2dListAdapter.js.map +0 -1
  909. package/src/_esm/utils/datastructures/GenericPath.d.ts +0 -86
  910. package/src/_esm/utils/datastructures/GenericPath.js +0 -121
  911. package/src/_esm/utils/datastructures/GenericPath.js.map +0 -1
  912. package/src/_esm/utils/datastructures/GeometryMesh.d.ts +0 -49
  913. package/src/_esm/utils/datastructures/GeometryMesh.js +0 -57
  914. package/src/_esm/utils/datastructures/GeometryMesh.js.map +0 -1
  915. package/src/_esm/utils/datastructures/Girih.d.ts +0 -181
  916. package/src/_esm/utils/datastructures/Girih.js +0 -265
  917. package/src/_esm/utils/datastructures/Girih.js.map +0 -1
  918. package/src/_esm/utils/datastructures/GirihBowtie.d.ts +0 -37
  919. package/src/_esm/utils/datastructures/GirihBowtie.js +0 -134
  920. package/src/_esm/utils/datastructures/GirihBowtie.js.map +0 -1
  921. package/src/_esm/utils/datastructures/GirihDecagon.d.ts +0 -52
  922. package/src/_esm/utils/datastructures/GirihDecagon.js +0 -114
  923. package/src/_esm/utils/datastructures/GirihDecagon.js.map +0 -1
  924. package/src/_esm/utils/datastructures/GirihHexagon.d.ts +0 -39
  925. package/src/_esm/utils/datastructures/GirihHexagon.js +0 -182
  926. package/src/_esm/utils/datastructures/GirihHexagon.js.map +0 -1
  927. package/src/_esm/utils/datastructures/GirihPenroseRhombus.d.ts +0 -46
  928. package/src/_esm/utils/datastructures/GirihPenroseRhombus.js +0 -171
  929. package/src/_esm/utils/datastructures/GirihPenroseRhombus.js.map +0 -1
  930. package/src/_esm/utils/datastructures/GirihPentagon.d.ts +0 -37
  931. package/src/_esm/utils/datastructures/GirihPentagon.js +0 -91
  932. package/src/_esm/utils/datastructures/GirihPentagon.js.map +0 -1
  933. package/src/_esm/utils/datastructures/GirihRhombus.d.ts +0 -38
  934. package/src/_esm/utils/datastructures/GirihRhombus.js +0 -137
  935. package/src/_esm/utils/datastructures/GirihRhombus.js.map +0 -1
  936. package/src/_esm/utils/datastructures/GirihTile.d.ts +0 -283
  937. package/src/_esm/utils/datastructures/GirihTile.js +0 -290
  938. package/src/_esm/utils/datastructures/GirihTile.js.map +0 -1
  939. package/src/_esm/utils/datastructures/Matrix4x4.d.ts +0 -244
  940. package/src/_esm/utils/datastructures/Matrix4x4.js +0 -250
  941. package/src/_esm/utils/datastructures/Matrix4x4.js.map +0 -1
  942. package/src/_esm/utils/datastructures/VoronoiCell.d.ts +0 -122
  943. package/src/_esm/utils/datastructures/VoronoiCell.js +0 -182
  944. package/src/_esm/utils/datastructures/VoronoiCell.js.map +0 -1
  945. package/src/_esm/utils/datastructures/interfaces.d.ts +0 -13
  946. package/src/_esm/utils/datastructures/interfaces.js +0 -10
  947. package/src/_esm/utils/datastructures/interfaces.js.map +0 -1
  948. package/src/_esm/utils/detectDarkMode.d.ts +0 -10
  949. package/src/_esm/utils/detectDarkMode.js +0 -41
  950. package/src/_esm/utils/detectDarkMode.js.map +0 -1
  951. package/src/_esm/utils/dom/components/ColorGradientPicker.d.ts +0 -246
  952. package/src/_esm/utils/dom/components/ColorGradientPicker.js +0 -780
  953. package/src/_esm/utils/dom/components/ColorGradientPicker.js.map +0 -1
  954. package/src/_esm/utils/dom/components/ColorGradientPickerJSX.d.ts +0 -129
  955. package/src/_esm/utils/dom/components/ColorGradientPickerJSX.js +0 -582
  956. package/src/_esm/utils/dom/components/ColorGradientPickerJSX.js.map +0 -1
  957. package/src/_esm/utils/dom/components/ColorGradientSelector.d.ts +0 -118
  958. package/src/_esm/utils/dom/components/ColorGradientSelector.js +0 -376
  959. package/src/_esm/utils/dom/components/ColorGradientSelector.js.map +0 -1
  960. package/src/_esm/utils/dom/components/Test.d.ts +0 -7
  961. package/src/_esm/utils/dom/components/Test.js +0 -63
  962. package/src/_esm/utils/dom/components/Test.js.map +0 -1
  963. package/src/_esm/utils/dom/getAvailableContainerSpace.d.ts +0 -2
  964. package/src/_esm/utils/dom/getAvailableContainerSpace.js +0 -29
  965. package/src/_esm/utils/dom/getAvailableContainerSpace.js.map +0 -1
  966. package/src/_esm/utils/dom/getFProp.d.ts +0 -5
  967. package/src/_esm/utils/dom/getFProp.js +0 -12
  968. package/src/_esm/utils/dom/getFProp.js.map +0 -1
  969. package/src/_esm/utils/dom/guiSizeToggler.d.ts +0 -18
  970. package/src/_esm/utils/dom/guiSizeToggler.js +0 -44
  971. package/src/_esm/utils/dom/guiSizeToggler.js.map +0 -1
  972. package/src/_esm/utils/findInVertexArray.d.ts +0 -19
  973. package/src/_esm/utils/findInVertexArray.js +0 -29
  974. package/src/_esm/utils/findInVertexArray.js.map +0 -1
  975. package/src/_esm/utils/getFProp.d.ts +0 -5
  976. package/src/_esm/utils/getFProp.js +0 -8
  977. package/src/_esm/utils/getFProp.js.map +0 -1
  978. package/src/_esm/utils/gup.d.ts +0 -14
  979. package/src/_esm/utils/gup.js +0 -31
  980. package/src/_esm/utils/gup.js.map +0 -1
  981. package/src/_esm/utils/helpers/BezierPathInteractionHelper.d.ts +0 -272
  982. package/src/_esm/utils/helpers/BezierPathInteractionHelper.js +0 -655
  983. package/src/_esm/utils/helpers/BezierPathInteractionHelper.js.map +0 -1
  984. package/src/_esm/utils/helpers/CircleHelper.d.ts +0 -73
  985. package/src/_esm/utils/helpers/CircleHelper.js +0 -92
  986. package/src/_esm/utils/helpers/CircleHelper.js.map +0 -1
  987. package/src/_esm/utils/helpers/CircleSectorHelper.d.ts +0 -90
  988. package/src/_esm/utils/helpers/CircleSectorHelper.js +0 -113
  989. package/src/_esm/utils/helpers/CircleSectorHelper.js.map +0 -1
  990. package/src/_esm/utils/helpers/TriangleHelper.d.ts +0 -57
  991. package/src/_esm/utils/helpers/TriangleHelper.js +0 -82
  992. package/src/_esm/utils/helpers/TriangleHelper.js.map +0 -1
  993. package/src/_esm/utils/helpers/VEllipseHelper.d.ts +0 -32
  994. package/src/_esm/utils/helpers/VEllipseHelper.js +0 -87
  995. package/src/_esm/utils/helpers/VEllipseHelper.js.map +0 -1
  996. package/src/_esm/utils/helpers/VEllipseSectorHelper.d.ts +0 -52
  997. package/src/_esm/utils/helpers/VEllipseSectorHelper.js +0 -134
  998. package/src/_esm/utils/helpers/VEllipseSectorHelper.js.map +0 -1
  999. package/src/_esm/utils/io/DndFileHandler.d.ts +0 -63
  1000. package/src/_esm/utils/io/DndFileHandler.js +0 -106
  1001. package/src/_esm/utils/io/DndFileHandler.js.map +0 -1
  1002. package/src/_esm/utils/io/FileDrop.d.ts +0 -110
  1003. package/src/_esm/utils/io/FileDrop.js +0 -175
  1004. package/src/_esm/utils/io/FileDrop.js.map +0 -1
  1005. package/src/_esm/utils/parsers/LinearColorGradientParser.d.ts +0 -78
  1006. package/src/_esm/utils/parsers/LinearColorGradientParser.js +0 -223
  1007. package/src/_esm/utils/parsers/LinearColorGradientParser.js.map +0 -1
  1008. package/src/_esm/utils/parsers/OBJParser.d.ts +0 -25
  1009. package/src/_esm/utils/parsers/OBJParser.js +0 -78
  1010. package/src/_esm/utils/parsers/OBJParser.js.map +0 -1
  1011. package/src/_esm/utils/parsers/STLParser.d.ts +0 -61
  1012. package/src/_esm/utils/parsers/STLParser.js +0 -179
  1013. package/src/_esm/utils/parsers/STLParser.js.map +0 -1
  1014. package/src/_esm/utils/parsers/svg/parseSVGPathData.d.ts +0 -27
  1015. package/src/_esm/utils/parsers/svg/parseSVGPathData.js +0 -486
  1016. package/src/_esm/utils/parsers/svg/parseSVGPathData.js.map +0 -1
  1017. package/src/_esm/utils/parsers/svg/splitSVGPathData.d.ts +0 -20
  1018. package/src/_esm/utils/parsers/svg/splitSVGPathData.js +0 -53
  1019. package/src/_esm/utils/parsers/svg/splitSVGPathData.js.map +0 -1
  1020. package/src/_esm/utils/parsers/svg/types.d.ts +0 -63
  1021. package/src/_esm/utils/parsers/svg/types.js +0 -17
  1022. package/src/_esm/utils/parsers/svg/types.js.map +0 -1
@@ -1,2340 +0,0 @@
1
- /**
2
- * @author Ikaros Kappler
3
- * @date 2018-10-23
4
- * @modified 2018-11-19 Added multi-select and multi-drag.
5
- * @modified 2018-12-04 Added basic SVG export.
6
- * @modified 2018-12-09 Extended the constructor (canvas).
7
- * @modified 2018-12-18 Added the config.redrawOnResize param.
8
- * @modified 2018-12-18 Added the config.defaultCanvas{Width,Height} params.
9
- * @modified 2018-12-19 Added CSS scaling.
10
- * @modified 2018-12-28 Removed the unused 'drawLabel' param. Added the 'enableMouse' and 'enableKeys' params.
11
- * @modified 2018-12-29 Added the 'drawOrigin' param.
12
- * @modified 2018-12-29 Renamed the 'autoCenterOffset' param to 'autoAdjustOffset'. Added the params 'offsetAdjustXPercent' and 'offsetAdjustYPercent'.
13
- * @modified 2019-01-14 Added params 'drawBezierHandleLines' and 'drawBezierHandlePoints'. Added the 'redraw' praam to the add() function.
14
- * @modified 2019-01-16 Added params 'drawHandleLines' and 'drawHandlePoints'. Added the new params to the dat.gui interface.
15
- * @modified 2019-01-30 Added the 'Vector' type (extending the Line class).
16
- * @modified 2019-01-30 Added the 'PBImage' type (a wrapper for images).
17
- * @modified 2019-02-02 Added the 'canvasWidthFactor' and 'canvasHeightFactor' params.
18
- * @modified 2019-02-03 Removed the drawBackgroundImage() function, with had no purpose at all. Just add an image to the drawables-list.
19
- * @modified 2019-02-06 Vertices (instace of Vertex) can now be added. Added the 'draggable' attribute to the vertex attributes.
20
- * @modified 2019-02-10 Fixed a draggable-bug in PBImage handling (scaling was not possible).
21
- * @modified 2019-02-10 Added the 'enableTouch' option (default is true).
22
- * @modified 2019-02-14 Added the console for debugging (setConsole(object)).
23
- * @modified 2019-02-19 Added two new constants: DEFAULT_CLICK_TOLERANCE and DEFAULT_TOUCH_TOLERANCE.
24
- * @modified 2019-02-19 Added the second param to the locatePointNear(Vertex,Number) function.
25
- * @modified 2019-02-20 Removed the 'loadFile' entry from the GUI as it was experimental and never in use.
26
- * @modified 2019-02-23 Removed the 'rebuild' function as it had no purpose.
27
- * @modified 2019-02-23 Added scaling of the click-/touch-tolerance with the CSS scale.
28
- * @modified 2019-03-23 Added JSDoc tags. Changed the default value of config.drawOrigin to false.
29
- * @modified 2019-04-03 Fixed the touch-drag position detection for canvas elements that are not located at document position (0,0).
30
- * @modified 2019-04-03 Tweaked the fit-to-parent function to work with paddings and borders.
31
- * @modified 2019-04-28 Added the preClear callback param (called before the canvas was cleared on redraw and before any elements are drawn).
32
- * @modified 2019-09-18 Added basics for WebGL support (strictly experimental).
33
- * @modified 2019-10-03 Added the .beginDrawCycle call in the redraw function.
34
- * @modified 2019-11-06 Added fetch.num, fetch.val, fetch.bool, fetch.func functions.
35
- * @modified 2019-11-13 Fixed an issue with the mouse-sensitive area around vertices (were affected by zoom).
36
- * @modified 2019-11-13 Added the 'enableMouseWheel' param.
37
- * @modified 2019-11-18 Added the Triangle class as a regular drawable element.
38
- * @modified 2019-11-18 The add function now works with arrays, too.
39
- * @modified 2019-11-18 Added the _handleColor helper function to determine the render color of non-draggable vertices.
40
- * @modified 2019-11-19 Fixed a bug in the resizeCanvas function; retina resolution was not possible.
41
- * @modified 2019-12-04 Added relative positioned zooming.
42
- * @modified 2019-12-04 Added offsetX and offsetY params.
43
- * @modified 2019-12-04 Added an 'Set to fullsize retina' button to the GUI config.
44
- * @modified 2019-12-07 Added the drawConfig for lines, polygons, ellipse, triangles, bezier curves and image control lines.
45
- * @modified 2019-12-08 Fixed a css scale bug in the viewport() function.
46
- * @modified 2019-12-08 Added the drawconfig UI panel (line colors and line widths).
47
- * @modified 2020-02-06 Added handling for the end- and end-control-points of non-cirular Bézier paths (was still missing).
48
- * @modified 2020-02-06 Fixed a drag-amount bug in the move handling of end points of Bezier paths (control points was not properly moved when non circular).
49
- * @modified 2020-03-28 Ported this class from vanilla-JS to Typescript.
50
- * @modified 2020-03-29 Fixed the enableSVGExport flag (read enableEport before).
51
- * @modified 2020-05-09 Included the Cirlcle class.
52
- * @modified 2020-06-22 Added the rasterScaleX and rasterScaleY config params.
53
- * @modified 2020-06-03 Fixed the selectedVerticesOnPolyon(Polygon) function: non-selectable vertices were selected too, before.
54
- * @modified 2020-07-06 Replacing Touchy.js by AlloyFinger.js
55
- * @modified 2020-07-27 Added the getVertexNear(XYCoords,number) function
56
- * @modified 2020-07-27 Extended the remove(Drawable) function: vertices are now removed, too.
57
- * @modified 2020-07-28 Added PlotBoilerplate.revertMousePosition(number,number) – the inverse function of transformMousePosition(...).
58
- * @modified 2020-07-31 Added PlotBoilerplate.getDraggedElementCount() to check wether any elements are currently being dragged.
59
- * @modified 2020-08-19 Added the VertexAttributes.visible attribute to make vertices invisible.
60
- * @modified 2020-11-17 Added pure click handling (no dragEnd and !wasMoved jiggliny any more) to the PlotBoilerplate.
61
- * @modified 2020-12-11 Added the `removeAll(boolean)` function.
62
- * @modified 2020-12-17 Added the `CircleSector` drawable.
63
- * @modified 2021-01-04 Avoiding multiple redraw call on adding multiple Drawables (array).
64
- * @modified 2021-01-08 Added param `draw:DraLib<void>` to the methods `drawVertices`, `drawGrid` and `drawSelectPolygon`.
65
- * @modified 2021-01-08 Added the customizable `drawAll(...)` function.
66
- * @modified 2021-01-09 Added the `drawDrawable(...)` function.
67
- * @modified 2021-01-10 Added the `eventCatcher` element (used to track mouse events on SVGs).
68
- * @modified 2021-01-26 Fixed SVG resizing.
69
- * @modified 2021-01-26 Replaced the old SVGBuilder by the new `drawutilssvg` library.
70
- * @modified 2021-02-08 Fixed a lot of es2015 compatibility issues.
71
- * @modified 2021-02-18 Adding `adjustOffset(boolean)` function.
72
- * @modified 2021-03-01 Updated the `PlotBoilerplate.draw(...)` function: ellipses are now rotate-able.
73
- * @modified 2021-03-03 Added the `VEllipseSector` drawable.
74
- * @modified 2021-03-29 Clearing `currentClassName` and `currentId` after drawing each drawable.
75
- * @modified 2021-04-25 Extending `remove` to accept arrays of drawables.
76
- * @modified 2021-11-16 Adding the `PBText` drawable.
77
- * @modified 2022-08-01 Added `title` to the params.
78
- * @modified 2022-10-25 Added the `origin` to the default draw config.
79
- * @modified 2022-11-06 Adding an XML declaration to the SVG export routine.
80
- * @modified 2022-11-23 Added the `drawRaster` (default=true) option to the config/drawconfig.
81
- * @modified 2023-02-04 Fixed a bug in the `drawDrawable` function; fill's current classname was not set.
82
- * @modified 2023-02-10 Fixing an issue of the `style.position` setting when `fitToParent=true` from `absolute` to `static` (default).
83
- * @modified 2023-02-10 Cleaning up most type errors in the main class (mostly null checks).
84
- * @modified 2023-02-10 Adding `enableZoom` and `enablePan` (both default true) to have the option to disable these functions.
85
- * @modified 2023-09-29 Adding proper dicionary key and value types to the params of `PlotBoilerplate.utils.safeMergeByKeys` (was `object` before).
86
- * @modified 2024-07-08 Adding `PlotBoilerplate.getGUI()` to retrieve the GUI instance.
87
- * @modified 2024-08-25 Extending main class `PlotBoilerplate` optional param `isBackdropFiltersEnabled`.
88
- * @modified 2024-12-02 Adding the `triggerRedraw` to the `removeAll` method.
89
- * @modified 2025-05-07 Changing the return type of `removeVertex` from `void` to `boolean`.
90
- * @modified 2025-05-07 Handling content changes now with `contentChangeListeners`.
91
- * @modified 2025-05-07 Added `PlogBoilerplate.addContentChangeListener` and `.removeContentChangeListener`.
92
- * @modified 2025-05-07 Moving full vectors now by default when vector point a is moved.
93
- * @modified 2025-05-20 Applying `lineWith` parameter in the draw routine for vectors (had been missing).
94
- * @modified 2026-03-13 Changed visibility of `setZoom` and `setOffset` to public. There was no good reason to have the private.
95
- *
96
- * @version 1.21.2
97
- *
98
- * @file PlotBoilerplate
99
- * @fileoverview The main class.
100
- * @public
101
- **/
102
- var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
103
- if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
104
- return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
105
- };
106
- var _a;
107
- import AlloyFinger from "alloyfinger-typescript";
108
- import { drawutils } from "./draw";
109
- import { drawutilsgl } from "./drawgl";
110
- import { drawutilssvg } from "./drawutilssvg";
111
- import { BezierPath } from "./BezierPath";
112
- import { Bounds } from "./Bounds";
113
- import { Circle } from "./Circle";
114
- import { CircleSector } from "./CircleSector";
115
- import { Grid } from "./Grid";
116
- import { KeyHandler } from "./KeyHandler";
117
- import { Line } from "./Line";
118
- import { MouseHandler } from "./MouseHandler";
119
- import { PBImage } from "./PBImage";
120
- import { Polygon } from "./Polygon";
121
- import { Triangle } from "./Triangle";
122
- import { VEllipse } from "./VEllipse";
123
- import { VEllipseSector } from "./VEllipseSector";
124
- import { Vector } from "./Vector";
125
- import { Vertex } from "./Vertex";
126
- import { VertexAttr } from "./VertexAttr";
127
- import { PBText } from "./PBText";
128
- /**
129
- * @classdesc The main class of the PlotBoilerplate.
130
- *
131
- * @requires Vertex
132
- * @requires Line
133
- * @requires Vector
134
- * @requires Polygon
135
- * @requires PBImage
136
- * @requires VEllipse
137
- * @requires Circle
138
- * @requires MouseHandler
139
- * @requires KeyHandler
140
- * @requires VertexAttr
141
- * @requires CubicBezierCurve
142
- * @requires BezierPath
143
- * @requires Drawable
144
- * @requires DrawConfig
145
- * @requires IHooks
146
- * @requires PBParams
147
- * @requires Triangle
148
- * @requires drawutils
149
- * @requires drawutilsgl
150
- * @requires SVGSerializable
151
- * @requires XYCoords
152
- * @requires XYDimension
153
- */
154
- export class PlotBoilerplate {
155
- /**
156
- * The constructor.
157
- *
158
- * @constructor
159
- * @name PlotBoilerplate
160
- * @public
161
- * @param {object} config={} - The configuration.
162
- * @param {HTMLCanvasElement} config.canvas - Your canvas element in the DOM (required).
163
- * @param {boolean=} [config.fullSize=true] - If set to true the canvas will gain full window size.
164
- * @param {boolean=} [config.fitToParent=true] - If set to true the canvas will gain the size of its parent container (overrides fullSize).
165
- * @param {number=} [config.scaleX=1.0] - The initial x-zoom. Default is 1.0.
166
- * @param {number=} [config.scaleY=1.0] - The initial y-zoom. Default is 1.0.
167
- * @param {number=} [config.offsetX=1.0] - The initial x-offset. Default is 0.0. Note that autoAdjustOffset=true overrides these values.
168
- * @param {number=} [config.offsetY=1.0] - The initial y-offset. Default is 0.0. Note that autoAdjustOffset=true overrides these values.
169
- * @param {boolean=} [config.rasterGrid=true] - If set to true the background grid will be drawn rastered.
170
- * @param {boolean=} [config.rasterScaleX=1.0] - Define the default horizontal raster scale (default=1.0).
171
- * @param {boolean=} [config.rasterScaleY=1.0] - Define the default vertical raster scale (default=1.0).
172
- * @param {number=} [config.rasterAdjustFactor=1.0] - The exponential limit for wrapping down the grid. (2.0 means: halve the grid each 2.0*n zoom step).
173
- * @param {boolean=} [config.drawOrigin=false] - Draw a crosshair at (0,0).
174
- * @param {boolean=} [config.autoAdjustOffset=true] - When set to true then the origin of the XY plane will
175
- * be re-adjusted automatically (see the params
176
- * offsetAdjust{X,Y}Percent for more).
177
- * @param {number=} [config.offsetAdjustXPercent=50] - The x-fallback position for the origin after
178
- * resizing the canvas.
179
- * @param {number=} [config.offsetAdjustYPercent=50] - The y-fallback position for the origin after
180
- * resizing the canvas.
181
- * @param {number=} [config.defaultCanvasWidth=1024] - The canvas size fallback (width) if no automatic resizing
182
- * is switched on.
183
- * @param {number=} [config.defaultCanvasHeight=768] - The canvas size fallback (height) if no automatic resizing
184
- * is switched on.
185
- * @param {number=} [config.canvasWidthFactor=1.0] - Scaling factor (width) upon the canvas size.
186
- * In combination with cssScale{X,Y} this can be used to obtain
187
- * sub pixel resolutions for retina displays.
188
- * @param {number=} [config.canvasHeightFactor=1.0] - Scaling factor (height) upon the canvas size.
189
- * In combination with cssScale{X,Y} this can be used to obtain
190
- * sub pixel resolutions for retina displays.
191
- * @param {number=} [config.cssScaleX=1.0] - Visually resize the canvas (horizontally) using CSS transforms (scale).
192
- * @param {number=} [config.cssScaleY=1.0] - Visually resize the canvas (vertically) using CSS transforms (scale).
193
- * @param {boolan=} [config.cssUniformScale=true] - CSS scale x and y obtaining aspect ratio.
194
- * @param {boolean=} [config.autoDetectRetina=true] - When set to true (default) the canvas will try to use the display's pixel ratio.
195
- * @param {string=} [config.backgroundColor=#ffffff] - The backround color.
196
- * @param {boolean=} [config.redrawOnResize=true] - Switch auto-redrawing on resize on/off (some applications
197
- * might want to prevent automatic redrawing to avoid data loss from the draw buffer).
198
- * @param {boolean=} [config.drawBezierHandleLines=true] - Indicates if Bézier curve handles should be drawn (used for
199
- * editors, no required in pure visualizations).
200
- * @param {boolean=} [config.drawBezierHandlePoints=true] - Indicates if Bézier curve handle points should be drawn.
201
- * @param {function=} [config.preClear=null] - A callback function that will be triggered just before the
202
- * draw function clears the canvas (before anything else was drawn).
203
- * @param {function=} [config.preDraw=null] - A callback function that will be triggered just before the draw
204
- * function starts.
205
- * @param {function=} [config.postDraw=null] - A callback function that will be triggered right after the drawing
206
- * process finished.
207
- * @param {boolean=} [config.enableMouse=true] - Indicates if the application should handle mouse events for you.
208
- * @param {boolean=} [config.enableTouch=true] - Indicates if the application should handle touch events for you.
209
- * @param {boolean=} [config.enableKeys=true] - Indicates if the application should handle key events for you.
210
- * @param {boolean=} [config.enableMouseWheel=true] - Indicates if the application should handle mouse wheel events for you.
211
- * @param {boolean=} [config.enablePan=true] - (default true) Set to false if you want to disable panning completely.
212
- * @param {boolean=} [config.enableZoom=true] - (default true) Set to false if you want to disable zooming completely.
213
- * @param {boolean=} [config.enableGL=false] - Indicates if the application should use the experimental WebGL features (not recommended).
214
- * @param {boolean=} [config.enableSVGExport=true] - Indicates if the SVG export should be enabled (default is true).
215
- * Note that changes from the postDraw hook might not be visible in the export.
216
- * @param {string=} [config.title=null] - Specify any hover tile here. It will be attached as a `title` attribute to the most elevated element.
217
- */
218
- constructor(config, drawConfig) {
219
- var _b, _c;
220
- /**
221
- * A list of content change listeners.
222
- */
223
- this.contentChangeListeners = [];
224
- /**
225
- * A discrete timestamp to identify single render cycles.
226
- * Note that using system time milliseconds is not a safe way to identify render frames, as on modern powerful machines
227
- * multiple frames might be rendered within each millisecond.
228
- * @member {number}
229
- * @memberof plotboilerplate
230
- * @instance
231
- * @private
232
- */
233
- this.renderTime = 0;
234
- /**
235
- * A storage variable for retrieving the GUI instance once it was created.
236
- */
237
- this._gui = null;
238
- // This should be in some static block ...
239
- VertexAttr.model = {
240
- bezierAutoAdjust: false,
241
- renderTime: 0,
242
- selectable: true,
243
- isSelected: false,
244
- draggable: true,
245
- visible: true
246
- };
247
- if (typeof config.canvas === "undefined") {
248
- throw "No canvas specified.";
249
- }
250
- /**
251
- * A global config that's attached to the dat.gui control interface.
252
- *
253
- * @member {Object}
254
- * @memberof PlotBoilerplate
255
- * @instance
256
- */
257
- const f = PlotBoilerplate.utils.fetch;
258
- this.config = {
259
- canvas: config.canvas,
260
- fullSize: f.val(config, "fullSize", true),
261
- fitToParent: f.bool(config, "fitToParent", true),
262
- scaleX: f.num(config, "scaleX", 1.0),
263
- scaleY: f.num(config, "scaleY", 1.0),
264
- offsetX: f.num(config, "offsetX", 0.0),
265
- offsetY: f.num(config, "offsetY", 0.0),
266
- rasterGrid: f.bool(config, "rasterGrid", true),
267
- drawRaster: f.bool(config, "drawRaster", true),
268
- rasterScaleX: f.num(config, "rasterScaleX", 1.0),
269
- rasterScaleY: f.num(config, "rasterScaleY", 1.0),
270
- rasterAdjustFactor: f.num(config, "rasterAdjustdFactror", 2.0),
271
- drawOrigin: f.bool(config, "drawOrigin", false),
272
- autoAdjustOffset: f.val(config, "autoAdjustOffset", true),
273
- offsetAdjustXPercent: f.num(config, "offsetAdjustXPercent", 50),
274
- offsetAdjustYPercent: f.num(config, "offsetAdjustYPercent", 50),
275
- backgroundColor: config.backgroundColor || "#ffffff",
276
- redrawOnResize: f.bool(config, "redrawOnResize", true),
277
- defaultCanvasWidth: f.num(config, "defaultCanvasWidth", PlotBoilerplate.DEFAULT_CANVAS_WIDTH),
278
- defaultCanvasHeight: f.num(config, "defaultCanvasHeight", PlotBoilerplate.DEFAULT_CANVAS_HEIGHT),
279
- canvasWidthFactor: f.num(config, "canvasWidthFactor", 1.0),
280
- canvasHeightFactor: f.num(config, "canvasHeightFactor", 1.0),
281
- cssScaleX: f.num(config, "cssScaleX", 1.0),
282
- cssScaleY: f.num(config, "cssScaleY", 1.0),
283
- cssUniformScale: f.bool(config, "cssUniformScale", true),
284
- saveFile: () => {
285
- _self.hooks.saveFile(_self);
286
- },
287
- setToRetina: () => {
288
- _self._setToRetina();
289
- },
290
- autoDetectRetina: f.bool(config, "autoDetectRetina", true),
291
- enableSVGExport: f.bool(config, "enableSVGExport", true),
292
- // Listeners/observers
293
- preClear: f.func(config, "preClear", null),
294
- preDraw: f.func(config, "preDraw", null),
295
- postDraw: f.func(config, "postDraw", null),
296
- // Interaction
297
- enableMouse: f.bool(config, "enableMouse", true),
298
- enableTouch: f.bool(config, "enableTouch", true),
299
- enableKeys: f.bool(config, "enableKeys", true),
300
- enableMouseWheel: f.bool(config, "enableMouseWheel", true),
301
- enableZoom: f.bool(config, "enableZoom", true), // default=true
302
- enablePan: f.bool(config, "enablePan", true), // default=true
303
- // Experimental (and unfinished)
304
- enableGL: f.bool(config, "enableGL", false),
305
- isBackdropFiltersEnabled: f.bool(config, "isBackdropFiltersEnabled", true)
306
- }; // END confog
307
- /**
308
- * Configuration for drawing things.
309
- *
310
- * @member {Object}
311
- * @memberof PlotBoilerplate
312
- * @instance
313
- */
314
- this.drawConfig = {
315
- drawVertices: true,
316
- drawBezierHandleLines: f.bool(config, "drawBezierHandleLines", true),
317
- drawBezierHandlePoints: f.bool(config, "drawBezierHandlePoints", true),
318
- drawHandleLines: f.bool(config, "drawHandleLines", true),
319
- drawHandlePoints: f.bool(config, "drawHandlePoints", true),
320
- drawGrid: f.bool(config, "drawGrid", true),
321
- drawRaster: f.bool(config, "drawRaster", true),
322
- bezier: {
323
- color: "#00a822",
324
- lineWidth: 2,
325
- handleLine: {
326
- color: "rgba(180,180,180,0.5)",
327
- lineWidth: 1
328
- },
329
- pathVertex: {
330
- color: "#B400FF",
331
- lineWidth: 1,
332
- fill: true
333
- },
334
- controlVertex: {
335
- color: "#B8D438",
336
- lineWidth: 1,
337
- fill: true
338
- }
339
- },
340
- // bezierPath: {
341
- // color: "#0022a8",
342
- // lineWidth: 1
343
- // },
344
- polygon: {
345
- color: "#0022a8",
346
- lineWidth: 1
347
- },
348
- triangle: {
349
- color: "#6600ff",
350
- lineWidth: 1
351
- },
352
- ellipse: {
353
- color: "#2222a8",
354
- lineWidth: 1
355
- },
356
- ellipseSector: {
357
- color: "#a822a8",
358
- lineWidth: 2
359
- },
360
- circle: {
361
- color: "#22a8a8",
362
- lineWidth: 2
363
- },
364
- circleSector: {
365
- color: "#2280a8",
366
- lineWidth: 1
367
- },
368
- vertex: {
369
- color: "#a8a8a8",
370
- lineWidth: 1
371
- },
372
- selectedVertex: {
373
- color: "#c08000",
374
- lineWidth: 2
375
- },
376
- line: {
377
- color: "#a844a8",
378
- lineWidth: 1
379
- },
380
- vector: {
381
- color: "#ff44a8",
382
- lineWidth: 1
383
- },
384
- image: {
385
- color: "#a8a8a8",
386
- lineWidth: 1
387
- },
388
- text: {
389
- color: "rgba(192,0,128,0.5)",
390
- lineWidth: 1,
391
- fill: true,
392
- anchor: true
393
- },
394
- origin: {
395
- color: "#000000"
396
- }
397
- }; // END drawConfig
398
- // +---------------------------------------------------------------------------------
399
- // | Object members.
400
- // +-------------------------------
401
- this.grid = new Grid(new Vertex(0, 0), new Vertex(50, 50));
402
- this.canvasSize = { width: PlotBoilerplate.DEFAULT_CANVAS_WIDTH, height: PlotBoilerplate.DEFAULT_CANVAS_HEIGHT };
403
- const canvasElement = typeof config.canvas === "string" ? document.querySelector(config.canvas) : config.canvas;
404
- if (typeof canvasElement === "undefined") {
405
- throw `Cannot initialize PlotBoilerplate with a null canvas (element "${config.canvas} not found).`;
406
- }
407
- // Which renderer to use: Canvas2D, WebGL (experimental) or SVG?
408
- if (canvasElement.tagName.toLowerCase() === "canvas") {
409
- this.canvas = canvasElement;
410
- this.eventCatcher = this.canvas;
411
- if (this.config.enableGL && typeof drawutilsgl === "undefined") {
412
- console.warn(`Cannot use webgl. Package was compiled without experimental gl support. Please use plotboilerplate-glsupport.min.js instead.`);
413
- console.warn(`Disabling GL and falling back to Canvas2D.`);
414
- this.config.enableGL = false;
415
- }
416
- if (this.config.enableGL) {
417
- // Override the case 'null' here. If GL is not supported, well then nothing works.
418
- const ctx = this.canvas.getContext("webgl"); // webgl-experimental?
419
- this.draw = new drawutilsgl(ctx, false);
420
- // PROBLEM: same instance of fill and draw when using WebGL.
421
- // Shader program cannot be duplicated on the same context.
422
- this.fill = this.draw.copyInstance(true);
423
- console.warn("Initialized with experimental mode enableGL=true. Note that this is not yet fully implemented.");
424
- }
425
- else {
426
- // Override the case 'null' here. If context creation is not supported, well then nothing works.
427
- const ctx = this.canvas.getContext("2d");
428
- this.draw = new drawutils(ctx, false);
429
- this.fill = new drawutils(ctx, true);
430
- }
431
- }
432
- else if (canvasElement.tagName.toLowerCase() === "svg") {
433
- if (typeof drawutilssvg === "undefined")
434
- throw `The svg draw library is not yet integrated part of PlotBoilerplate. Please include ./src/js/utils/helpers/drawutils.svg into your document.`;
435
- this.canvas = canvasElement;
436
- this.draw = new drawutilssvg(this.canvas, new Vertex(), // offset
437
- new Vertex(), // scale
438
- this.canvasSize, false, // fillShapes=false
439
- this.drawConfig, false // isSecondary=false
440
- );
441
- this.fill = this.draw.copyInstance(true); // fillShapes=true
442
- if (this.canvas.parentElement) {
443
- this.eventCatcher = document.createElement("div");
444
- this.eventCatcher.style.position = "absolute";
445
- this.eventCatcher.style.left = "0";
446
- this.eventCatcher.style.top = "0";
447
- this.eventCatcher.style.cursor = "pointer";
448
- this.canvas.parentElement.style.position = "relative";
449
- this.canvas.parentElement.appendChild(this.eventCatcher);
450
- }
451
- else {
452
- this.eventCatcher = document.body;
453
- }
454
- }
455
- else {
456
- throw "Element is neither a canvas nor an svg element.";
457
- }
458
- // At this point the event cacher element is deinfed and located at highest elevation.
459
- // Set `title` attribut?
460
- if (config.title) {
461
- this.eventCatcher.setAttribute("title", config.title);
462
- }
463
- this.draw.scale.set((_b = this.config.scaleX) !== null && _b !== void 0 ? _b : 1.0, this.config.scaleY);
464
- this.fill.scale.set((_c = this.config.scaleX) !== null && _c !== void 0 ? _c : 1.0, this.config.scaleY);
465
- this.vertices = [];
466
- this.selectPolygon = null;
467
- this.draggedElements = [];
468
- this.drawables = [];
469
- this.console = console;
470
- this.hooks = {
471
- // This is changable from the outside
472
- saveFile: PlotBoilerplate._saveFile
473
- };
474
- var _self = this;
475
- globalThis.addEventListener("resize", () => _self.resizeCanvas());
476
- this.resizeCanvas();
477
- if (config.autoDetectRetina) {
478
- this._setToRetina();
479
- }
480
- this.installInputListeners();
481
- // Apply the configured CSS scale.
482
- this.updateCSSscale();
483
- // Init
484
- this.redraw();
485
- // Gain focus
486
- this.canvas.focus();
487
- } // END constructor
488
- /**
489
- * This function opens a save-as file dialog and – once an output file is
490
- * selected – stores the current canvas contents as an SVG image.
491
- *
492
- * It is the default hook for saving files and can be overwritten.
493
- *
494
- * @method _saveFile
495
- * @instance
496
- * @memberof PlotBoilerplate
497
- * @return {void}
498
- * @private
499
- **/
500
- static _saveFile(pb) {
501
- // Create fake SVG node
502
- const svgNode = document.createElementNS("http://www.w3.org/2000/svg", "svg");
503
- // Draw everything to fake node.
504
- var tosvgDraw = new drawutilssvg(svgNode, pb.draw.offset, pb.draw.scale, pb.canvasSize, false, // fillShapes=false
505
- pb.drawConfig);
506
- var tosvgFill = tosvgDraw.copyInstance(true); // fillShapes=true
507
- tosvgDraw.beginDrawCycle(0);
508
- tosvgFill.beginDrawCycle(0);
509
- if (pb.config.preClear) {
510
- pb.config.preClear();
511
- }
512
- tosvgDraw.clear(pb.config.backgroundColor || "white");
513
- if (pb.config.preDraw) {
514
- pb.config.preDraw(tosvgDraw, tosvgFill);
515
- }
516
- pb.drawAll(0, tosvgDraw, tosvgFill);
517
- pb.drawVertices(0, tosvgDraw);
518
- if (pb.config.postDraw)
519
- pb.config.postDraw(tosvgDraw, tosvgFill);
520
- tosvgDraw.endDrawCycle(0);
521
- tosvgFill.endDrawCycle(0);
522
- // Full support in all browsers \o/
523
- // https://caniuse.com/xml-serializer
524
- var serializer = new XMLSerializer();
525
- var svgCode = serializer.serializeToString(svgNode);
526
- // Add: '<?xml version="1.0" encoding="utf-8"?>\n' ?
527
- var blob = new Blob(['<?xml version="1.0" encoding="utf-8"?>\n' + svgCode], { type: "image/svg;charset=utf-8" });
528
- // See documentation for FileSaver.js for usage.
529
- // https://github.com/eligrey/FileSaver.js
530
- if (typeof globalThis["saveAs"] !== "function") {
531
- throw "Cannot save file; did you load the ./utils/savefile helper function and the eligrey/SaveFile library?";
532
- }
533
- var _saveAs = globalThis["saveAs"];
534
- _saveAs(blob, "plotboilerplate.svg");
535
- }
536
- /**
537
- * This function sets the canvas resolution to factor 2.0 (or the preferred pixel ratio of your device) for retina displays.
538
- * Please not that in non-GL mode this might result in very slow rendering as the canvas buffer size may increase.
539
- *
540
- * @method _setToRetina
541
- * @instance
542
- * @memberof PlotBoilerplate
543
- * @return {void}
544
- * @private
545
- **/
546
- _setToRetina() {
547
- this.config.autoDetectRetina = true;
548
- const pixelRatio = globalThis.devicePixelRatio || 1;
549
- this.config.cssScaleX = this.config.cssScaleY = 1.0 / pixelRatio;
550
- this.config.canvasWidthFactor = this.config.canvasHeightFactor = pixelRatio;
551
- this.resizeCanvas();
552
- this.updateCSSscale();
553
- }
554
- /**
555
- * Set the current zoom and draw offset to fit the given bounds.
556
- *
557
- * This method currently restores the aspect zoom ratio.
558
- *
559
- **/
560
- fitToView(bounds) {
561
- const canvasCenter = new Vertex(this.canvasSize.width / 2.0, this.canvasSize.height / 2.0);
562
- const canvasRatio = this.canvasSize.width / this.canvasSize.height;
563
- const ratio = bounds.width / bounds.height;
564
- // Find the new draw offset
565
- const center = new Vertex(bounds.max.x - bounds.width / 2.0, bounds.max.y - bounds.height / 2.0)
566
- .inv()
567
- .addXY(this.canvasSize.width / 2.0, this.canvasSize.height / 2.0);
568
- this.setOffset(center);
569
- if (canvasRatio < ratio) {
570
- const newUniformZoom = this.canvasSize.width / bounds.width;
571
- this.setZoom(newUniformZoom, newUniformZoom, canvasCenter);
572
- }
573
- else {
574
- const newUniformZoom = this.canvasSize.height / bounds.height;
575
- this.setZoom(newUniformZoom, newUniformZoom, canvasCenter);
576
- }
577
- this.redraw();
578
- }
579
- /**
580
- * Set the console for this instance.
581
- *
582
- * @method setConsole
583
- * @param {Console} con - The new console object (default is globalThis.console).
584
- * @instance
585
- * @memberof PlotBoilerplate
586
- * @return {void}
587
- **/
588
- setConsole(con) {
589
- this.console = con;
590
- }
591
- /**
592
- * Update the CSS scale for the canvas depending onf the cssScale{X,Y} settings.<br>
593
- * <br>
594
- * This function is usually only used inernally.
595
- *
596
- * @method updateCSSscale
597
- * @instance
598
- * @memberof PlotBoilerplate
599
- * @return {void}
600
- * @private
601
- **/
602
- updateCSSscale() {
603
- var _b, _c, _d, _e;
604
- if (this.config.cssUniformScale) {
605
- PlotBoilerplate.utils.setCSSscale(this.canvas, (_b = this.config.cssScaleX) !== null && _b !== void 0 ? _b : 1.0, (_c = this.config.cssScaleX) !== null && _c !== void 0 ? _c : 1.0);
606
- }
607
- else {
608
- PlotBoilerplate.utils.setCSSscale(this.canvas, (_d = this.config.cssScaleX) !== null && _d !== void 0 ? _d : 1.0, (_e = this.config.cssScaleY) !== null && _e !== void 0 ? _e : 1.0);
609
- }
610
- }
611
- /**
612
- * Adds a new content change listener to this instance. Adding duplicates is not possible.
613
- *
614
- * @param {PBContentChangeListener} listener - The listenre to add.
615
- * @method addContentChangeListener
616
- * @instance
617
- * @memberof PlotBoilerplate
618
- * @returns {void}
619
- */
620
- addContentChangeListener(listener) {
621
- for (var i in this.contentChangeListeners) {
622
- if (this.contentChangeListeners[i] === listener) {
623
- return;
624
- }
625
- }
626
- this.contentChangeListeners.push(listener);
627
- }
628
- /**
629
- * Removes an existing content change listener from this instance.
630
- *
631
- * @param {PBContentChangeListener} listener - The listenre to add.
632
- * @method removeContentChangeListener
633
- * @instance
634
- * @memberof PlotBoilerplate
635
- * @returns {void}
636
- */
637
- removeContentChangeListener(listener) {
638
- for (var i = 0; i < this.contentChangeListeners.length; i++) {
639
- if (this.contentChangeListeners[i] === listener) {
640
- this.contentChangeListeners.splice(i, 1);
641
- return;
642
- }
643
- }
644
- }
645
- _fireContentChanged(addedDrawables, removedDrawables) {
646
- for (var i in this.contentChangeListeners) {
647
- const listener = this.contentChangeListeners[i];
648
- if (listener && typeof listener === "function") {
649
- listener({
650
- type: addedDrawables.length > 0 ? "DRAWABLES_ADDED" : "DRAWABLES_REMOVED",
651
- addedDrawables: addedDrawables,
652
- removedDrawables: removedDrawables
653
- });
654
- }
655
- }
656
- }
657
- /**
658
- * Add a drawable object.<br>
659
- * <br>
660
- * This must be either:<br>
661
- * <pre>
662
- * * a Vertex
663
- * * a Line
664
- * * a Vector
665
- * * a VEllipse
666
- * * a VEllipseSector
667
- * * a Circle
668
- * * a Polygon
669
- * * a Triangle
670
- * * a BezierPath
671
- * * a BPImage
672
- * </pre>
673
- *
674
- * @param {Drawable|Drawable[]} drawable - The drawable (of one of the allowed class instance) to add.
675
- * @param {boolean} [redraw=true] - If true the function will trigger redraw after the drawable(s) was/were added.
676
- * @method add
677
- * @instance
678
- * @memberof PlotBoilerplate
679
- * @return {void}
680
- **/
681
- add(drawable, redraw, doNotFireEvent) {
682
- if (Array.isArray(drawable)) {
683
- const arr = drawable;
684
- for (var i = 0; i < arr.length; i++) {
685
- this.add(arr[i], false, doNotFireEvent);
686
- }
687
- // !doNotFireEvent && this._fireContentChanged(arr, []);
688
- }
689
- else {
690
- const addedDrawables = [drawable];
691
- if (drawable instanceof Vertex) {
692
- this.drawables.push(drawable);
693
- this.vertices.push(drawable);
694
- }
695
- else if (drawable instanceof Line) {
696
- // Add some lines
697
- this.drawables.push(drawable);
698
- this.vertices.push(drawable.a);
699
- this.vertices.push(drawable.b);
700
- addedDrawables.push(drawable.a, drawable.b);
701
- }
702
- else if (drawable instanceof Vector) {
703
- this.drawables.push(drawable);
704
- this.vertices.push(drawable.a);
705
- this.vertices.push(drawable.b);
706
- addedDrawables.push(drawable.a, drawable.b);
707
- drawable.a.listeners.addDragListener((event) => {
708
- drawable.b.add(event.params.dragAmount);
709
- });
710
- }
711
- else if (drawable instanceof VEllipse) {
712
- this.vertices.push(drawable.center);
713
- this.vertices.push(drawable.axis);
714
- addedDrawables.push(drawable.center, drawable.axis);
715
- this.drawables.push(drawable);
716
- drawable.center.listeners.addDragListener((event) => {
717
- drawable.axis.add(event.params.dragAmount);
718
- });
719
- }
720
- else if (drawable instanceof VEllipseSector) {
721
- this.vertices.push(drawable.ellipse.center);
722
- this.vertices.push(drawable.ellipse.axis);
723
- addedDrawables.push(drawable.ellipse.center, drawable.ellipse.axis);
724
- this.drawables.push(drawable);
725
- drawable.ellipse.center.listeners.addDragListener((event) => {
726
- drawable.ellipse.axis.add(event.params.dragAmount);
727
- });
728
- }
729
- else if (drawable instanceof Circle) {
730
- this.vertices.push(drawable.center);
731
- addedDrawables.push(drawable.center);
732
- this.drawables.push(drawable);
733
- }
734
- else if (drawable instanceof CircleSector) {
735
- this.vertices.push(drawable.circle.center);
736
- addedDrawables.push(drawable.circle.center);
737
- this.drawables.push(drawable);
738
- }
739
- else if (drawable instanceof Polygon) {
740
- this.drawables.push(drawable);
741
- for (var i = 0; i < drawable.vertices.length; i++) {
742
- this.vertices.push(drawable.vertices[i]);
743
- addedDrawables.push(drawable.vertices[i]);
744
- }
745
- }
746
- else if (drawable instanceof Triangle) {
747
- this.drawables.push(drawable);
748
- this.vertices.push(drawable.a);
749
- this.vertices.push(drawable.b);
750
- this.vertices.push(drawable.c);
751
- addedDrawables.push(drawable.a, drawable.b, drawable.c);
752
- }
753
- else if (drawable instanceof BezierPath) {
754
- this.drawables.push(drawable);
755
- const bezierPath = drawable;
756
- for (var i = 0; i < bezierPath.bezierCurves.length; i++) {
757
- if (!drawable.adjustCircular && i == 0) {
758
- this.vertices.push(bezierPath.bezierCurves[i].startPoint);
759
- addedDrawables.push(bezierPath.bezierCurves[i].startPoint);
760
- }
761
- this.vertices.push(bezierPath.bezierCurves[i].endPoint);
762
- this.vertices.push(bezierPath.bezierCurves[i].startControlPoint);
763
- this.vertices.push(bezierPath.bezierCurves[i].endControlPoint);
764
- addedDrawables.push(bezierPath.bezierCurves[i].endPoint, bezierPath.bezierCurves[i].startControlPoint, bezierPath.bezierCurves[i].endControlPoint);
765
- bezierPath.bezierCurves[i].startControlPoint.attr.selectable = false;
766
- bezierPath.bezierCurves[i].endControlPoint.attr.selectable = false;
767
- }
768
- PlotBoilerplate.utils.enableBezierPathAutoAdjust(drawable);
769
- }
770
- else if (drawable instanceof PBImage) {
771
- this.vertices.push(drawable.upperLeft);
772
- this.vertices.push(drawable.lowerRight);
773
- addedDrawables.push(drawable.upperLeft, drawable.lowerRight);
774
- this.drawables.push(drawable);
775
- // Todo: think about a IDragEvent interface
776
- drawable.upperLeft.listeners.addDragListener((e) => {
777
- drawable.lowerRight.add(e.params.dragAmount);
778
- });
779
- drawable.lowerRight.attr.selectable = false;
780
- }
781
- else if (drawable instanceof PBText) {
782
- this.vertices.push(drawable.anchor);
783
- addedDrawables.push(drawable.anchor);
784
- this.drawables.push(drawable);
785
- drawable.anchor.attr.selectable = false;
786
- }
787
- else {
788
- throw "Cannot add drawable of unrecognized type: " + typeof drawable + ".";
789
- }
790
- !doNotFireEvent && this._fireContentChanged(addedDrawables, []);
791
- }
792
- // This is a workaround for backwards compatibility when the 'redraw' param was not yet present.
793
- if (redraw || typeof redraw == "undefined") {
794
- this.redraw();
795
- }
796
- }
797
- /**
798
- * Remove a drawable object.<br>
799
- * <br>
800
- * This must be either:<br>
801
- * <pre>
802
- * * a Vertex
803
- * * a Line
804
- * * a Vector
805
- * * a VEllipse
806
- * * a Circle
807
- * * a Polygon
808
- * * a BezierPath
809
- * * a BPImage
810
- * * a Triangle
811
- * </pre>
812
- *
813
- * @param {Drawable|Array<Drawable>} drawable - The drawable (of one of the allowed class instance) to remove.
814
- * @param {boolean} [redraw=false]
815
- * @param {removeWidth}
816
- * @method remove
817
- * @instance
818
- * @memberof PlotBoilerplate
819
- * @return {void}
820
- **/
821
- remove(drawable, redraw, removeWithVertices, doNotFireEvent) {
822
- if (Array.isArray(drawable)) {
823
- const removedDrawables = [];
824
- for (var i = 0; i < drawable.length; i++) {
825
- if (this.remove(drawable[i], false, removeWithVertices, true)) {
826
- removedDrawables.push(drawable[i]);
827
- }
828
- }
829
- if (redraw) {
830
- this.redraw();
831
- }
832
- !doNotFireEvent && this._fireContentChanged([], removedDrawables);
833
- return removedDrawables.length > 0;
834
- }
835
- if (drawable instanceof Vertex) {
836
- const wasRemoved = this.removeVertex(drawable, false, false);
837
- if (redraw) {
838
- this.redraw();
839
- }
840
- !doNotFireEvent && this._fireContentChanged([], [drawable]);
841
- return wasRemoved;
842
- }
843
- let wasRemoved = false;
844
- const removedDrawables = [];
845
- for (var i = 0; i < this.drawables.length; i++) {
846
- if (this.drawables[i] === drawable || this.drawables[i].uid === drawable.uid) {
847
- this.drawables.splice(i, 1);
848
- removedDrawables.push(drawable);
849
- if (removeWithVertices) {
850
- // Check if some listeners need to be removed
851
- if (drawable instanceof Line) {
852
- // Add some lines
853
- this.removeVertex(drawable.a, false, true);
854
- this.removeVertex(drawable.b, false, true);
855
- removedDrawables.push(drawable.a, drawable.b);
856
- }
857
- else if (drawable instanceof Vector) {
858
- this.removeVertex(drawable.a, false, true);
859
- this.removeVertex(drawable.b, false, true);
860
- removedDrawables.push(drawable.a, drawable.b);
861
- }
862
- else if (drawable instanceof VEllipse) {
863
- this.removeVertex(drawable.center, false, true);
864
- this.removeVertex(drawable.axis, false, true);
865
- removedDrawables.push(drawable.center, drawable.axis);
866
- }
867
- else if (drawable instanceof VEllipseSector) {
868
- this.removeVertex(drawable.ellipse.center, false, true);
869
- this.removeVertex(drawable.ellipse.axis, false, true);
870
- removedDrawables.push(drawable.ellipse.center, drawable.ellipse.axis);
871
- }
872
- else if (drawable instanceof Circle) {
873
- this.removeVertex(drawable.center, false, true);
874
- }
875
- else if (drawable instanceof CircleSector) {
876
- this.removeVertex(drawable.circle.center, false, true);
877
- removedDrawables.push(drawable.circle.center);
878
- }
879
- else if (drawable instanceof Polygon) {
880
- // for( var i in drawable.vertices )
881
- for (var i = 0; i < drawable.vertices.length; i++) {
882
- this.removeVertex(drawable.vertices[i], false, true);
883
- removedDrawables.push(drawable.vertices[i]);
884
- }
885
- }
886
- else if (drawable instanceof Triangle) {
887
- this.removeVertex(drawable.a, false, true);
888
- this.removeVertex(drawable.b, false, true);
889
- this.removeVertex(drawable.c, false, true);
890
- removedDrawables.push(drawable.a, drawable.b, drawable.c);
891
- }
892
- else if (drawable instanceof BezierPath) {
893
- for (var i = 0; i < drawable.bezierCurves.length; i++) {
894
- this.removeVertex(drawable.bezierCurves[i].startPoint, false, true);
895
- this.removeVertex(drawable.bezierCurves[i].startControlPoint, false, true);
896
- this.removeVertex(drawable.bezierCurves[i].endControlPoint, false, true);
897
- removedDrawables.push(drawable.bezierCurves[i].startPoint, drawable.bezierCurves[i].startControlPoint, drawable.bezierCurves[i].endControlPoint);
898
- if (i + 1 == drawable.bezierCurves.length) {
899
- this.removeVertex(drawable.bezierCurves[i].endPoint, false, true);
900
- removedDrawables.push(drawable.bezierCurves[i].endPoint);
901
- }
902
- }
903
- }
904
- else if (drawable instanceof PBImage) {
905
- this.removeVertex(drawable.upperLeft, false, true);
906
- this.removeVertex(drawable.lowerRight, false, true);
907
- removedDrawables.push(drawable.upperLeft, drawable.lowerRight);
908
- }
909
- else if (drawable instanceof PBText) {
910
- this.removeVertex(drawable.anchor, false, true);
911
- removedDrawables.push(drawable.anchor);
912
- }
913
- } // END removeWithVertices
914
- if (redraw) {
915
- this.redraw();
916
- }
917
- !doNotFireEvent && this._fireContentChanged([], removedDrawables);
918
- wasRemoved = true;
919
- } // END if
920
- } // END for
921
- return wasRemoved;
922
- }
923
- /**
924
- * Remove a vertex from the vertex list.<br>
925
- *
926
- * @param {Vertex} vert - The vertex to remove.
927
- * @param {boolean} [redraw=false]
928
- * @method removeVertex
929
- * @instance
930
- * @memberof PlotBoilerplate
931
- * @return {boolean}
932
- **/
933
- removeVertex(vert, redraw, doNotFireEvent) {
934
- for (var i = 0; i < this.vertices.length; i++) {
935
- if (this.vertices[i] === vert) {
936
- this.vertices.splice(i, 1);
937
- if (redraw) {
938
- this.redraw();
939
- }
940
- !doNotFireEvent && this._fireContentChanged([], [vert]);
941
- return true;
942
- }
943
- }
944
- return false;
945
- }
946
- /**
947
- * Remove all elements.
948
- *
949
- * If you want to keep the vertices, pass `true`.
950
- *
951
- * @method removeAll
952
- * @param {boolean=false} keepVertices
953
- * @param {boolean=true} triggerRedraw - By default this method triggers the redraw routine; passing `false` will suppress redrawing.
954
- * @instance
955
- * @memberof PlotBoilerplate
956
- * @return {void}
957
- */
958
- removeAll(keepVertices, triggerRedraw) {
959
- let removedDrawables = this.drawables;
960
- this.drawables = [];
961
- if (!Boolean(keepVertices)) {
962
- removedDrawables = removedDrawables.concat(this.vertices);
963
- this.vertices = [];
964
- }
965
- if (triggerRedraw || typeof triggerRedraw === "undefined") {
966
- this.redraw();
967
- }
968
- removedDrawables.length > 0 && this._fireContentChanged([], removedDrawables);
969
- }
970
- /**
971
- * Find the vertex near the given position.
972
- *
973
- * The position is the absolute vertex position, not the x-y-coordinates on the canvas.
974
- *
975
- * @param {XYCoords} position - The position of the vertex to search for.
976
- * @param {number} pixelTolerance - A radius around the position to include into the search.
977
- * Note that the tolerance will be scaled up/down when zoomed.
978
- * @return The vertex near the given position or undefined if none was found there.
979
- **/
980
- getVertexNear(pixelPosition, pixelTolerance) {
981
- var _b, _c;
982
- const p = this.locatePointNear(this.transformMousePosition(pixelPosition.x, pixelPosition.y), pixelTolerance / Math.min((_b = this.config.cssScaleX) !== null && _b !== void 0 ? _b : 1.0, (_c = this.config.cssScaleY) !== null && _c !== void 0 ? _c : 1.0));
983
- if (p && p.typeName == "vertex") {
984
- return this.vertices[p.vindex];
985
- }
986
- return undefined;
987
- }
988
- /**
989
- * Draw the grid with the current config settings.<br>
990
- *
991
- * This function is usually only used internally.
992
- *
993
- * @method drawGrid
994
- * @param {DrawLib} draw - The drawing library to use to draw lines.
995
- * @private
996
- * @instance
997
- * @memberof PlotBoilerplate
998
- * @return {void}
999
- **/
1000
- drawGrid(draw) {
1001
- if (typeof draw === "undefined") {
1002
- draw = this.draw;
1003
- }
1004
- const gScale = {
1005
- x: (Grid.utils.mapRasterScale(this.config.rasterAdjustFactor, this.draw.scale.x) * this.config.rasterScaleX) /
1006
- this.config.cssScaleX,
1007
- y: (Grid.utils.mapRasterScale(this.config.rasterAdjustFactor, this.draw.scale.y) * this.config.rasterScaleY) /
1008
- this.config.cssScaleY
1009
- };
1010
- var gSize = { width: this.grid.size.x * gScale.x, height: this.grid.size.y * gScale.y };
1011
- var cs = { width: this.canvasSize.width / 2, height: this.canvasSize.height / 2 };
1012
- var offset = this.draw.offset.clone().inv();
1013
- // console.log( "drawGrid", gScale, gSize, cs, offset );
1014
- offset.x =
1015
- ((Math.round(offset.x + cs.width) / Math.round(gSize.width)) * gSize.width) / this.draw.scale.x +
1016
- (((this.draw.offset.x - cs.width) / this.draw.scale.x) % gSize.width);
1017
- offset.y =
1018
- ((Math.round(offset.y + cs.height) / Math.round(gSize.height)) * gSize.height) / this.draw.scale.y +
1019
- (((this.draw.offset.y - cs.height) / this.draw.scale.x) % gSize.height);
1020
- if (this.drawConfig.drawGrid) {
1021
- draw.setCurrentClassName(null);
1022
- if (this.config.rasterGrid) {
1023
- // TODO: move config member to drawConfig
1024
- draw.setCurrentId("raster");
1025
- draw.raster(offset, this.canvasSize.width / this.draw.scale.x, this.canvasSize.height / this.draw.scale.y, gSize.width, gSize.height, "rgba(0,128,255,0.125)");
1026
- }
1027
- else {
1028
- draw.setCurrentId("grid");
1029
- draw.grid(offset, this.canvasSize.width / this.draw.scale.x, this.canvasSize.height / this.draw.scale.y, gSize.width, gSize.height, "rgba(0,128,255,0.095)");
1030
- }
1031
- }
1032
- }
1033
- /**
1034
- * Draw the origin with the current config settings.<br>
1035
- *
1036
- * This function is usually only used internally.
1037
- *
1038
- * @method drawOrigin
1039
- * @param {DrawLib} draw - The drawing library to use to draw lines.
1040
- * @private
1041
- * @instance
1042
- * @memberof PlotBoilerplate
1043
- * @return {void}
1044
- **/
1045
- drawOrigin(draw) {
1046
- // Add a crosshair to mark the origin
1047
- draw.setCurrentId("origin");
1048
- draw.crosshair({ x: 0, y: 0 }, 10, this.drawConfig.origin.color);
1049
- }
1050
- /**
1051
- * This is just a tiny helper function to determine the render color of vertices.
1052
- **/
1053
- _handleColor(h, color) {
1054
- return h.attr.isSelected ? this.drawConfig.selectedVertex.color : h.attr.draggable ? color : "rgba(128,128,128,0.5)";
1055
- }
1056
- /**
1057
- * Draw all drawables.
1058
- *
1059
- * This function is usually only used internally.
1060
- *
1061
- * @method drawDrawables
1062
- * @param {number} renderTime - The current render time. It will be used to distinct
1063
- * already draw vertices from non-draw-yet vertices.
1064
- * @param {DrawLib} draw - The drawing library to use to draw lines.
1065
- * @param {DrawLib} fill - The drawing library to use to fill areas.
1066
- * @instance
1067
- * @memberof PlotBoilerplate
1068
- * @return {void}
1069
- **/
1070
- drawDrawables(renderTime, draw, fill) {
1071
- for (var i in this.drawables) {
1072
- var d = this.drawables[i];
1073
- this.draw.setCurrentId(d.uid);
1074
- this.fill.setCurrentId(d.uid);
1075
- this.draw.setCurrentClassName(d.className);
1076
- this.fill.setCurrentClassName(d.className);
1077
- this.drawDrawable(d, renderTime, draw, fill);
1078
- }
1079
- }
1080
- /**
1081
- * Draw the given drawable.
1082
- *
1083
- * This function is usually only used internally.
1084
- *
1085
- * @method drawDrawable
1086
- * @param {Drawable} d - The drawable to draw.
1087
- * @param {number} renderTime - The current render time. It will be used to distinct
1088
- * already draw vertices from non-draw-yet vertices.
1089
- * @param {DrawLib} draw - The drawing library to use to draw lines.
1090
- * @param {DrawLib} fill - The drawing library to use to fill areas.
1091
- * @instance
1092
- * @memberof PlotBoilerplate
1093
- * @return {void}
1094
- **/
1095
- drawDrawable(d, renderTime, draw, fill) {
1096
- if (d instanceof BezierPath) {
1097
- var curveIndex = 0;
1098
- for (var c in d.bezierCurves) {
1099
- // Restore these settings again in each loop (will be overwritten)
1100
- this.draw.setCurrentId(`${d.uid}-${curveIndex}`);
1101
- this.fill.setCurrentId(`${d.uid}-${curveIndex}`);
1102
- this.draw.setCurrentClassName(d.className);
1103
- this.fill.setCurrentClassName(d.className);
1104
- draw.cubicBezier(d.bezierCurves[c].startPoint, d.bezierCurves[c].endPoint, d.bezierCurves[c].startControlPoint, d.bezierCurves[c].endControlPoint, this.drawConfig.bezier.color, this.drawConfig.bezier.lineWidth);
1105
- if (this.drawConfig.drawBezierHandlePoints && this.drawConfig.drawHandlePoints) {
1106
- if (d.bezierCurves[c].startPoint.attr.visible) {
1107
- const df = this.drawConfig.bezier.pathVertex.fill ? fill : draw;
1108
- df.setCurrentId(`${d.uid}_h0`);
1109
- df.setCurrentClassName(`${d.className}-start-handle`);
1110
- if (d.bezierCurves[c].startPoint.attr.bezierAutoAdjust) {
1111
- df.squareHandle(d.bezierCurves[c].startPoint, 5, this._handleColor(d.bezierCurves[c].startPoint, this.drawConfig.bezier.pathVertex.color));
1112
- }
1113
- else {
1114
- df.diamondHandle(d.bezierCurves[c].startPoint, 7, this._handleColor(d.bezierCurves[c].startPoint, this.drawConfig.bezier.pathVertex.color));
1115
- }
1116
- }
1117
- d.bezierCurves[c].startPoint.attr.renderTime = renderTime;
1118
- if (d.bezierCurves[c].endPoint.attr.visible) {
1119
- const df = this.drawConfig.bezier.pathVertex.fill ? fill : draw;
1120
- df.setCurrentId(`${d.uid}_h0`);
1121
- df.setCurrentClassName(`${d.className}-start-handle`);
1122
- if (d.bezierCurves[c].endPoint.attr.bezierAutoAdjust) {
1123
- df.squareHandle(d.bezierCurves[c].endPoint, 5, this._handleColor(d.bezierCurves[c].endPoint, this.drawConfig.bezier.pathVertex.color));
1124
- }
1125
- else {
1126
- df.diamondHandle(d.bezierCurves[c].endPoint, 7, this._handleColor(d.bezierCurves[c].endPoint, this.drawConfig.bezier.pathVertex.color));
1127
- }
1128
- }
1129
- if (d.bezierCurves[c].startControlPoint.attr.visible) {
1130
- const df = this.drawConfig.bezier.controlVertex.fill ? fill : draw;
1131
- df.setCurrentId(`${d.uid}_h2`);
1132
- df.setCurrentClassName(`${d.className}-start-control-handle`);
1133
- df.circleHandle(d.bezierCurves[c].startControlPoint, 3, this._handleColor(d.bezierCurves[c].startControlPoint, this.drawConfig.bezier.controlVertex.color));
1134
- }
1135
- if (d.bezierCurves[c].endControlPoint.attr.visible) {
1136
- const df = this.drawConfig.bezier.controlVertex.fill ? fill : draw;
1137
- df.setCurrentId(`${d.uid}_h3`);
1138
- df.setCurrentClassName(`${d.className}-end-control-handle`);
1139
- df.circleHandle(d.bezierCurves[c].endControlPoint, 3, this._handleColor(d.bezierCurves[c].endControlPoint, this.drawConfig.bezier.controlVertex.color));
1140
- }
1141
- d.bezierCurves[c].startPoint.attr.renderTime = renderTime;
1142
- d.bezierCurves[c].endPoint.attr.renderTime = renderTime;
1143
- d.bezierCurves[c].startControlPoint.attr.renderTime = renderTime;
1144
- d.bezierCurves[c].endControlPoint.attr.renderTime = renderTime;
1145
- }
1146
- else {
1147
- d.bezierCurves[c].startPoint.attr.renderTime = renderTime;
1148
- d.bezierCurves[c].endPoint.attr.renderTime = renderTime;
1149
- d.bezierCurves[c].startControlPoint.attr.renderTime = renderTime;
1150
- d.bezierCurves[c].endControlPoint.attr.renderTime = renderTime;
1151
- }
1152
- if (this.drawConfig.drawBezierHandleLines && this.drawConfig.drawHandleLines) {
1153
- draw.setCurrentId(`${d.uid}_l0`);
1154
- draw.setCurrentClassName(`${d.className}-start-line`);
1155
- draw.handleLine(d.bezierCurves[c].startPoint, d.bezierCurves[c].startControlPoint);
1156
- draw.setCurrentId(`${d.uid}_l1`);
1157
- draw.setCurrentClassName(`${d.className}-end-line`);
1158
- draw.handleLine(d.bezierCurves[c].endPoint, d.bezierCurves[c].endControlPoint);
1159
- }
1160
- curveIndex++;
1161
- } // END for
1162
- }
1163
- else if (d instanceof Polygon) {
1164
- draw.polygon(d, this.drawConfig.polygon.color, this.drawConfig.polygon.lineWidth);
1165
- if (!this.drawConfig.drawHandlePoints) {
1166
- for (var i in d.vertices) {
1167
- d.vertices[i].attr.renderTime = renderTime;
1168
- }
1169
- }
1170
- }
1171
- else if (d instanceof Triangle) {
1172
- draw.polyline([d.a, d.b, d.c], false, this.drawConfig.triangle.color, this.drawConfig.triangle.lineWidth);
1173
- if (!this.drawConfig.drawHandlePoints) {
1174
- d.a.attr.renderTime = d.b.attr.renderTime = d.c.attr.renderTime = renderTime;
1175
- }
1176
- }
1177
- else if (d instanceof VEllipse) {
1178
- if (this.drawConfig.drawHandleLines) {
1179
- draw.setCurrentId(`${d.uid}_e0`);
1180
- draw.setCurrentClassName(`${d.className}-v-line`);
1181
- draw.handleLine(d.center.clone().add(0, d.signedRadiusV()).rotate(d.rotation, d.center), d.axis); // , "#c8c8c8");
1182
- draw.setCurrentId(`${d.uid}_e1`);
1183
- draw.setCurrentClassName(`${d.className}-h-line`);
1184
- draw.handleLine(d.center.clone().add(d.signedRadiusH(), 0).rotate(d.rotation, d.center), d.axis); // , "#c8c8c8");
1185
- }
1186
- draw.setCurrentId(d.uid);
1187
- draw.setCurrentClassName(`${d.className}`);
1188
- draw.ellipse(d.center,
1189
- // Math.abs(d.axis.x-d.center.x), Math.abs(d.axis.y-d.center.y),
1190
- d.radiusH(), d.radiusV(), this.drawConfig.ellipse.color, this.drawConfig.ellipse.lineWidth, d.rotation);
1191
- if (!this.drawConfig.drawHandlePoints) {
1192
- d.center.attr.renderTime = renderTime;
1193
- d.axis.attr.renderTime = renderTime;
1194
- }
1195
- }
1196
- else if (d instanceof VEllipseSector) {
1197
- draw.setCurrentId(d.uid);
1198
- draw.setCurrentClassName(`${d.className}`);
1199
- const data = VEllipseSector.ellipseSectorUtils.describeSVGArc(d.ellipse.center.x, d.ellipse.center.y, d.ellipse.radiusH(), d.ellipse.radiusV(), d.startAngle, d.endAngle, d.ellipse.rotation, { moveToStart: true });
1200
- draw.path(data, this.drawConfig.ellipseSector.color, this.drawConfig.ellipseSector.lineWidth);
1201
- }
1202
- else if (d instanceof Circle) {
1203
- draw.circle(d.center, d.radius, this.drawConfig.circle.color, this.drawConfig.circle.lineWidth);
1204
- }
1205
- else if (d instanceof CircleSector) {
1206
- draw.circleArc(d.circle.center, d.circle.radius, d.startAngle, d.endAngle, this.drawConfig.circleSector.color, this.drawConfig.circleSector.lineWidth);
1207
- }
1208
- else if (d instanceof Vertex) {
1209
- if (this.drawConfig.drawVertices && (!d.attr.selectable || !d.attr.draggable) && d.attr.visible) {
1210
- // Draw as special point (grey)
1211
- draw.circleHandle(d, 7, this.drawConfig.vertex.color);
1212
- d.attr.renderTime = renderTime;
1213
- }
1214
- }
1215
- else if (d instanceof Line) {
1216
- draw.line(d.a, d.b, this.drawConfig.line.color, this.drawConfig.line.lineWidth);
1217
- if (!this.drawConfig.drawHandlePoints || !d.a.attr.selectable)
1218
- d.a.attr.renderTime = renderTime;
1219
- if (!this.drawConfig.drawHandlePoints || !d.b.attr.selectable)
1220
- d.b.attr.renderTime = renderTime;
1221
- }
1222
- else if (d instanceof Vector) {
1223
- draw.arrow(d.a, d.b, this.drawConfig.vector.color, this.drawConfig.vector.lineWidth);
1224
- if (this.drawConfig.drawHandlePoints && d.b.attr.selectable && d.b.attr.visible) {
1225
- draw.setCurrentId(`${d.uid}_h0`);
1226
- draw.setCurrentClassName(`${d.className}-handle`);
1227
- draw.circleHandle(d.b, 3, "#a8a8a8");
1228
- }
1229
- else {
1230
- d.b.attr.renderTime = renderTime;
1231
- }
1232
- if (!this.drawConfig.drawHandlePoints || !d.a.attr.selectable)
1233
- d.a.attr.renderTime = renderTime;
1234
- if (!this.drawConfig.drawHandlePoints || !d.b.attr.selectable)
1235
- d.b.attr.renderTime = renderTime;
1236
- }
1237
- else if (d instanceof PBImage) {
1238
- if (this.drawConfig.drawHandleLines) {
1239
- draw.setCurrentId(`${d.uid}_l0`);
1240
- draw.setCurrentClassName(`${d.className}-line`);
1241
- draw.line(d.upperLeft, d.lowerRight, this.drawConfig.image.color, this.drawConfig.image.lineWidth);
1242
- }
1243
- fill.setCurrentId(d.uid);
1244
- fill.image(d.image, d.upperLeft, d.lowerRight.clone().sub(d.upperLeft));
1245
- if (this.drawConfig.drawHandlePoints) {
1246
- draw.setCurrentId(`${d.uid}_h0`);
1247
- draw.setCurrentClassName(`${d.className}-lower-right`);
1248
- draw.circleHandle(d.lowerRight, 3, this.drawConfig.image.color);
1249
- d.lowerRight.attr.renderTime = renderTime;
1250
- }
1251
- }
1252
- else if (d instanceof PBText) {
1253
- fill.setCurrentId(d.uid);
1254
- fill.text(d.text, d.anchor.x, d.anchor.y, d);
1255
- if (this.drawConfig.text.anchor) {
1256
- draw.setCurrentId(`${d.uid}_a0`);
1257
- draw.setCurrentClassName(`${d.className}-anchor`);
1258
- (this.drawConfig.text.fill ? fill : draw).point(d.anchor, this.drawConfig.text.color);
1259
- }
1260
- d.anchor.attr.renderTime = renderTime;
1261
- }
1262
- else {
1263
- console.error("Cannot draw object. Unknown class.");
1264
- }
1265
- draw.setCurrentClassName(null);
1266
- draw.setCurrentId(null);
1267
- fill.setCurrentClassName(null);
1268
- fill.setCurrentId(null);
1269
- }
1270
- /**
1271
- * Draw the select-polygon (if there is one).
1272
- *
1273
- * This function is usually only used internally.
1274
- *
1275
- * @method drawSelectPolygon
1276
- * @private
1277
- * @instance
1278
- * @memberof PlotBoilerplate
1279
- * @return {void}
1280
- **/
1281
- drawSelectPolygon(draw) {
1282
- // Draw select polygon?
1283
- if (this.selectPolygon != null && this.selectPolygon.vertices.length > 0) {
1284
- draw.setCurrentId(this.selectPolygon.uid);
1285
- draw.polygon(this.selectPolygon, "#888888");
1286
- draw.crosshair(this.selectPolygon.vertices[0], 3, "#008888");
1287
- }
1288
- }
1289
- /**
1290
- * Draw all vertices that were not yet drawn with the given render time.<br>
1291
- * <br>
1292
- * This function is usually only used internally.
1293
- *
1294
- * @method drawVertices
1295
- * @private
1296
- * @param {number} renderTime - The current render time. It is used to distinct
1297
- * already draw vertices from non-draw-yet vertices.
1298
- * @instance
1299
- * @memberof PlotBoilerplate
1300
- * @return {void}
1301
- **/
1302
- drawVertices(renderTime, draw) {
1303
- // Draw all vertices as small squares if they were not already drawn by other objects
1304
- for (var i in this.vertices) {
1305
- if (this.drawConfig.drawVertices && this.vertices[i].attr.renderTime != renderTime && this.vertices[i].attr.visible) {
1306
- draw.setCurrentId(this.vertices[i].uid);
1307
- draw.squareHandle(this.vertices[i], 5, this._handleColor(this.vertices[i], "rgb(0,128,192)"));
1308
- this.vertices[i].attr.renderTime = renderTime;
1309
- }
1310
- }
1311
- }
1312
- /**
1313
- * Trigger redrawing of all objects.<br>
1314
- * <br>
1315
- * Usually this function is automatically called when objects change.
1316
- *
1317
- * @method redraw
1318
- * @instance
1319
- * @memberof PlotBoilerplate
1320
- * @return {void}
1321
- **/
1322
- redraw() {
1323
- const renderTime = this.renderTime++;
1324
- // Tell the drawing library that a new drawing cycle begins (required for the GL lib).
1325
- this.draw.beginDrawCycle(renderTime);
1326
- this.fill.beginDrawCycle(renderTime);
1327
- if (this.config.preClear)
1328
- this.config.preClear();
1329
- this.clear();
1330
- if (this.config.preDraw)
1331
- this.config.preDraw(this.draw, this.fill);
1332
- this.drawAll(renderTime, this.draw, this.fill);
1333
- if (this.config.postDraw)
1334
- this.config.postDraw(this.draw, this.fill);
1335
- this.draw.endDrawCycle(renderTime);
1336
- this.fill.endDrawCycle(renderTime);
1337
- }
1338
- /**
1339
- * Draw all: drawables, grid, select-polygon and vertices.
1340
- *
1341
- * @method drawAll
1342
- * @instance
1343
- * @memberof PlotBoilerplate
1344
- * @return {void}
1345
- **/
1346
- drawAll(renderTime, draw, fill) {
1347
- if (this.config.drawRaster) {
1348
- this.drawGrid(draw);
1349
- }
1350
- if (this.config.drawOrigin) {
1351
- this.drawOrigin(draw);
1352
- }
1353
- this.drawDrawables(renderTime, draw, fill);
1354
- this.drawVertices(renderTime, draw);
1355
- this.drawSelectPolygon(draw);
1356
- // Clear IDs and classnames (postDraw hook might draw somthing and the do not want
1357
- // to interfered with that).
1358
- draw.setCurrentId(null);
1359
- draw.setCurrentClassName(null);
1360
- } // END redraw
1361
- /**
1362
- * This function clears the canvas with the configured background color.<br>
1363
- * <br>
1364
- * This function is usually only used internally.
1365
- *
1366
- * @method clear
1367
- * @private
1368
- * @instance
1369
- * @memberof PlotBoilerplate
1370
- * @return {void}
1371
- **/
1372
- clear() {
1373
- // Note that elements might have an alpha channel. Clear the scene first.
1374
- this.draw.clear(this.config.backgroundColor || "white");
1375
- }
1376
- /**
1377
- * Clear the selection.<br>
1378
- * <br>
1379
- * This function is usually only used internally.
1380
- *
1381
- * @method clearSelection
1382
- * @private
1383
- * @param {boolean=} [redraw=false] - Indicates if the redraw function should be triggered.
1384
- * @instance
1385
- * @memberof PlotBoilerplate
1386
- * @return {PlotBoilerplate} this
1387
- **/
1388
- clearSelection(redraw) {
1389
- for (var i in this.vertices)
1390
- this.vertices[i].attr.isSelected = false;
1391
- if (redraw)
1392
- this.redraw();
1393
- return this;
1394
- }
1395
- /**
1396
- * Get the current view port.
1397
- *
1398
- * @method viewport
1399
- * @instance
1400
- * @memberof PlotBoilerplate
1401
- * @return {Bounds} The current viewport.
1402
- **/
1403
- viewport() {
1404
- var _b, _c;
1405
- return new Bounds(this.transformMousePosition(0, 0), this.transformMousePosition(this.canvasSize.width * ((_b = this.config.cssScaleX) !== null && _b !== void 0 ? _b : 1.0), this.canvasSize.height * ((_c = this.config.cssScaleY) !== null && _c !== void 0 ? _c : 1.0)));
1406
- }
1407
- /**
1408
- * Trigger the saveFile.hook.
1409
- *
1410
- * @method saveFile
1411
- * @instance
1412
- * @memberof PlotBoilerplate
1413
- * @return {void}
1414
- **/
1415
- saveFile() {
1416
- this.hooks.saveFile(this);
1417
- }
1418
- /**
1419
- * Internal helper function used to get 'float' properties from elements.
1420
- * Used to determine border withs and paddings that were defined using CSS.
1421
- */
1422
- // TODO: this was moved to the DOM utils
1423
- getFProp(elem, propName) {
1424
- return parseFloat(globalThis.getComputedStyle(elem, null).getPropertyValue(propName));
1425
- }
1426
- /**
1427
- * Get the available inner space of the given container.
1428
- *
1429
- * Size minus padding minus border.
1430
- **/
1431
- // TODO: this was moved to the DOM utils
1432
- getAvailableContainerSpace() {
1433
- const _self = this;
1434
- const container = _self.canvas.parentNode; // Element | Document | DocumentFragment;
1435
- _self.canvas.style.display = "none";
1436
- var padding = this.getFProp(container, "padding") || 0, border = this.getFProp(_self.canvas, "border-width") || 0, pl = this.getFProp(container, "padding-left") || padding, pr = this.getFProp(container, "padding-right") || padding, pt = this.getFProp(container, "padding-top") || padding, pb = this.getFProp(container, "padding-bottom") || padding, bl = this.getFProp(_self.canvas, "border-left-width") || border, br = this.getFProp(_self.canvas, "border-right-width") || border, bt = this.getFProp(_self.canvas, "border-top-width") || border, bb = this.getFProp(_self.canvas, "border-bottom-width") || border;
1437
- var w = container.clientWidth;
1438
- var h = container.clientHeight;
1439
- _self.canvas.style.display = "block";
1440
- return { width: w - pl - pr - bl - br, height: h - pt - pb - bt - bb };
1441
- }
1442
- /**
1443
- * This function resizes the canvas to the required settings (toggles fullscreen).<br>
1444
- * <br>
1445
- * This function is usually only used internally but feel free to call it if resizing required.
1446
- *
1447
- * @method resizeCanvas
1448
- * @instance
1449
- * @memberof PlotBoilerplate
1450
- * @return {void}
1451
- **/
1452
- resizeCanvas() {
1453
- var _b, _c, _d, _e, _f, _g;
1454
- const _self = this;
1455
- const _setSize = (w, h) => {
1456
- var _b, _c;
1457
- w *= (_b = _self.config.canvasWidthFactor) !== null && _b !== void 0 ? _b : 1.0;
1458
- h *= (_c = _self.config.canvasHeightFactor) !== null && _c !== void 0 ? _c : 1.0;
1459
- _self.canvasSize.width = w;
1460
- _self.canvasSize.height = h;
1461
- if (_self.canvas instanceof HTMLCanvasElement) {
1462
- _self.canvas.width = w;
1463
- _self.canvas.height = h;
1464
- }
1465
- else if (_self.canvas instanceof SVGElement) {
1466
- this.canvas.setAttribute("viewBox", `0 0 ${w} ${h}`);
1467
- this.canvas.setAttribute("width", `${w}`);
1468
- this.canvas.setAttribute("height", `${h}`);
1469
- this.draw.setSize(_self.canvasSize); // No need to set size to this.fill (instance copy)
1470
- this.eventCatcher.style.width = `${w}px`;
1471
- this.eventCatcher.style.height = `${h}px`;
1472
- }
1473
- else {
1474
- console.error("Error: cannot resize canvas element because it seems neither be a HTMLCanvasElement nor an SVGElement.");
1475
- }
1476
- if (_self.config.autoAdjustOffset) {
1477
- // _self.draw.offset.x = _self.fill.offset.x = _self.config.offsetX = w*(_self.config.offsetAdjustXPercent/100);
1478
- // _self.draw.offset.y = _self.fill.offset.y = _self.config.offsetY = h*(_self.config.offsetAdjustYPercent/100);
1479
- _self.adjustOffset(false);
1480
- }
1481
- };
1482
- if (_self.config.fullSize && !_self.config.fitToParent) {
1483
- // Set editor size
1484
- var width = globalThis.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
1485
- var height = globalThis.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
1486
- _self.canvas.style.position = "absolute";
1487
- _self.canvas.style.width = ((_b = _self.config.canvasWidthFactor) !== null && _b !== void 0 ? _b : 1.0) * width + "px";
1488
- _self.canvas.style.height = ((_c = _self.config.canvasWidthFactor) !== null && _c !== void 0 ? _c : 1.0) * height + "px";
1489
- _self.canvas.style.top = "0px";
1490
- _self.canvas.style.left = "0px";
1491
- _setSize(width, height);
1492
- }
1493
- else if (_self.config.fitToParent) {
1494
- // Set editor size
1495
- _self.canvas.style.position = "static";
1496
- const space = this.getAvailableContainerSpace();
1497
- _self.canvas.style.width = ((_d = _self.config.canvasWidthFactor) !== null && _d !== void 0 ? _d : 1.0) * space.width + "px";
1498
- _self.canvas.style.height = ((_e = _self.config.canvasHeightFactor) !== null && _e !== void 0 ? _e : 1.0) * space.height + "px";
1499
- _self.canvas.style.top = "";
1500
- _self.canvas.style.left = "";
1501
- _setSize(space.width, space.height);
1502
- }
1503
- else {
1504
- _self.canvas.style.width = "";
1505
- _self.canvas.style.height = "";
1506
- _setSize((_f = _self.config.defaultCanvasWidth) !== null && _f !== void 0 ? _f : 1024, (_g = _self.config.defaultCanvasHeight) !== null && _g !== void 0 ? _g : 768);
1507
- }
1508
- if (_self.config.redrawOnResize)
1509
- _self.redraw();
1510
- }
1511
- /**
1512
- * Add all vertices inside the polygon to the current selection.<br>
1513
- *
1514
- * @method selectVerticesInPolygon
1515
- * @param {Polygon} polygon - The polygonal selection area.
1516
- * @instance
1517
- * @memberof PlotBoilerplate
1518
- * @return {void}
1519
- **/
1520
- selectVerticesInPolygon(polygon) {
1521
- for (var i in this.vertices) {
1522
- if (this.vertices[i].attr.selectable && polygon.containsVert(this.vertices[i]))
1523
- this.vertices[i].attr.isSelected = true;
1524
- }
1525
- }
1526
- /**
1527
- * (Helper) Locates the point (index) at the passed position. Using an internal tolerance of 7 pixels.
1528
- *
1529
- * The result is an object { type : 'bpath', pindex, cindex, pid }
1530
- *
1531
- * Returns false if no point is near the passed position.
1532
- *
1533
- * @method locatePointNear
1534
- * @param {Vertex} point - The polygonal selection area.
1535
- * @param {number=} [tolerance=7] - The tolerance to use identtifying vertices.
1536
- * @private
1537
- * @return {IDraggable} Or false if none found.
1538
- **/
1539
- locatePointNear(point, tolerance) {
1540
- const _self = this;
1541
- if (typeof tolerance == "undefined")
1542
- tolerance = 7;
1543
- // Apply the zoom (the tolerant area should not shrink or grow when zooming)
1544
- tolerance /= _self.draw.scale.x;
1545
- // Search in vertices
1546
- for (var vindex = 0; vindex < _self.vertices.length; vindex++) {
1547
- var vert = _self.vertices[vindex];
1548
- if ((vert.attr.draggable || vert.attr.selectable) && vert.distance(point) < tolerance) {
1549
- // { type : 'vertex', vindex : vindex };
1550
- return new PlotBoilerplate.Draggable(vert, PlotBoilerplate.Draggable.VERTEX).setVIndex(vindex);
1551
- }
1552
- }
1553
- return null;
1554
- }
1555
- /**
1556
- * Handle left-click event.<br>
1557
- *
1558
- * @method handleClick
1559
- * @param {number} x - The click X position on the canvas.
1560
- * @param {number} y - The click Y position on the canvas.
1561
- * @private
1562
- * @return {void}
1563
- **/
1564
- handleClick(e) {
1565
- const _self = this;
1566
- var point = this.locatePointNear(_self.transformMousePosition(e.params.pos.x, e.params.pos.y), PlotBoilerplate.DEFAULT_CLICK_TOLERANCE / Math.min(_self.config.cssScaleX || 1.0, _self.config.cssScaleY || 1.0));
1567
- if (point) {
1568
- _self.vertices[point.vindex].listeners.fireClickEvent(e);
1569
- if (this.keyHandler && this.keyHandler.isDown("shift")) {
1570
- if (point.typeName == "bpath") {
1571
- let vert = _self.paths[point.pindex].bezierCurves[point.cindex].getPointByID(point.pid);
1572
- if (vert.attr.selectable)
1573
- vert.attr.isSelected = !vert.attr.isSelected;
1574
- }
1575
- else if (point.typeName == "vertex") {
1576
- let vert = _self.vertices[point.vindex];
1577
- if (vert.attr.selectable)
1578
- vert.attr.isSelected = !vert.attr.isSelected;
1579
- }
1580
- _self.redraw();
1581
- }
1582
- else if (this.keyHandler && this.keyHandler.isDown("y")) {
1583
- _self.vertices[point.vindex].attr.bezierAutoAdjust = !_self.vertices[point.vindex].attr.bezierAutoAdjust;
1584
- _self.redraw();
1585
- }
1586
- }
1587
- else if (_self.selectPolygon != null) {
1588
- const vert = _self.transformMousePosition(e.params.pos.x, e.params.pos.y);
1589
- _self.selectPolygon.vertices.push(new Vertex(vert.x, vert.y));
1590
- _self.redraw();
1591
- }
1592
- }
1593
- /**
1594
- * Transforms the given x-y-(mouse-)point to coordinates respecting the view offset
1595
- * and the zoom settings.
1596
- *
1597
- * @method transformMousePosition
1598
- * @param {number} x - The x position relative to the canvas.
1599
- * @param {number} y - The y position relative to the canvas.
1600
- * @instance
1601
- * @memberof PlotBoilerplate
1602
- * @return {XYCoords} A simple object <pre>{ x : Number, y : Number }</pre> with the transformed coordinates.
1603
- **/
1604
- transformMousePosition(x, y) {
1605
- return {
1606
- x: (x / this.config.cssScaleX - this.config.offsetX) / this.config.scaleX,
1607
- y: (y / this.config.cssScaleY - this.config.offsetY) / this.config.scaleY
1608
- };
1609
- }
1610
- /**
1611
- * Revert a transformed mouse position back to canvas coordinates.
1612
- *
1613
- * This is the inverse function of `transformMousePosition`.
1614
- *
1615
- * @method revertMousePosition
1616
- * @param {number} x - The x component of the position to revert.
1617
- * @param {number} y - The y component of the position to revert.
1618
- * @instance
1619
- * @memberof PlotBoilerplate
1620
- * @return {XYCoords} The canvas coordinates for the given position.
1621
- **/
1622
- revertMousePosition(x, y) {
1623
- return { x: x / this.config.cssScaleX + this.config.offsetX, y: y / this.config.cssScaleY + this.config.offsetY };
1624
- }
1625
- /**
1626
- * Determine if any elements are currently being dragged (on mouse move or touch move).
1627
- *
1628
- * @method getDraggedElementCount
1629
- * @instance
1630
- * @memberof PlotBoilerplate
1631
- * @return {number} The number of elements that are currently being dragged.
1632
- **/
1633
- getDraggedElementCount() {
1634
- return this.draggedElements.length;
1635
- }
1636
- /**
1637
- * (Helper) The mouse-down handler.
1638
- *
1639
- * It selects vertices for dragging.
1640
- *
1641
- * @method mouseDownHandler.
1642
- * @param {XMouseEvent} e - The event to handle
1643
- * @private
1644
- * @return {void}
1645
- **/
1646
- mouseDownHandler(e) {
1647
- const _self = this;
1648
- if (e.button != 0)
1649
- return; // Only react on left mouse or touch events
1650
- var draggablePoint = _self.locatePointNear(_self.transformMousePosition(e.params.pos.x, e.params.pos.y), PlotBoilerplate.DEFAULT_CLICK_TOLERANCE / Math.min(_self.config.cssScaleX, _self.config.cssScaleY));
1651
- if (!draggablePoint)
1652
- return;
1653
- // Drag all selected elements?
1654
- if (draggablePoint.typeName == "vertex" && _self.vertices[draggablePoint.vindex].attr.isSelected) {
1655
- // Multi drag
1656
- // for( var i in _self.vertices ) {
1657
- for (var i = 0; i < _self.vertices.length; i++) {
1658
- if (_self.vertices[i].attr.isSelected) {
1659
- _self.draggedElements.push(new PlotBoilerplate.Draggable(_self.vertices[i], PlotBoilerplate.Draggable.VERTEX).setVIndex(i));
1660
- _self.vertices[i].listeners.fireDragStartEvent(e);
1661
- }
1662
- }
1663
- }
1664
- else {
1665
- // Single drag
1666
- if (!_self.vertices[draggablePoint.vindex].attr.draggable)
1667
- return;
1668
- _self.draggedElements.push(draggablePoint);
1669
- if (draggablePoint.typeName == "bpath")
1670
- _self.paths[draggablePoint.pindex].bezierCurves[draggablePoint.cindex]
1671
- .getPointByID(draggablePoint.pid)
1672
- .listeners.fireDragStartEvent(e);
1673
- else if (draggablePoint.typeName == "vertex")
1674
- _self.vertices[draggablePoint.vindex].listeners.fireDragStartEvent(e);
1675
- }
1676
- _self.redraw();
1677
- }
1678
- /**
1679
- * The mouse-drag handler.
1680
- *
1681
- * It moves selected elements around or performs the panning if the ctrl-key if
1682
- * hold down.
1683
- *
1684
- * @method mouseDragHandler.
1685
- * @param {XMouseEvent} e - The event to handle
1686
- * @private
1687
- * @return {void}
1688
- **/
1689
- mouseDragHandler(e) {
1690
- const _self = this;
1691
- const oldDragAmount = { x: e.params.dragAmount.x, y: e.params.dragAmount.y };
1692
- e.params.dragAmount.x /= _self.config.cssScaleX;
1693
- e.params.dragAmount.y /= _self.config.cssScaleY;
1694
- // Important note to: this.keyHandler.isDown('ctrl')
1695
- // We should not use this for any input.
1696
- // Reason: most browsers use [Ctrl]+[t] to create new browser tabs.
1697
- // If so, the key-up event for [Ctrl] will be fired in the _new tab_,
1698
- // not this one. So this tab will never receive any [Ctrl-down] events
1699
- // until next keypress; the implication is, that [Ctrl] would still
1700
- // considered to be pressed which is not true.
1701
- if (this.keyHandler && (this.keyHandler.isDown("alt") || this.keyHandler.isDown("spacebar"))) {
1702
- if (!this.config.enablePan) {
1703
- return;
1704
- }
1705
- _self.setOffset(_self.draw.offset.clone().add(e.params.dragAmount));
1706
- _self.redraw();
1707
- }
1708
- else {
1709
- // Convert drag amount by scaling
1710
- // Warning: this possibly invalidates the dragEvent for other listeners!
1711
- // Rethink the solution when other features are added.
1712
- e.params.dragAmount.x /= _self.draw.scale.x;
1713
- e.params.dragAmount.y /= _self.draw.scale.y;
1714
- for (var i in _self.draggedElements) {
1715
- var p = _self.draggedElements[i];
1716
- if (p.typeName == "bpath") {
1717
- _self.paths[p.pindex].moveCurvePoint(p.cindex, p.pid, new Vertex(e.params.dragAmount.x, e.params.dragAmount.y));
1718
- _self.paths[p.pindex].bezierCurves[p.cindex].getPointByID(p.pid).listeners.fireDragEvent(e);
1719
- }
1720
- else if (p.typeName == "vertex") {
1721
- if (!_self.vertices[p.vindex].attr.draggable)
1722
- continue;
1723
- _self.vertices[p.vindex].add(e.params.dragAmount);
1724
- _self.vertices[p.vindex].listeners.fireDragEvent(e);
1725
- }
1726
- }
1727
- }
1728
- // Restore old event values!
1729
- e.params.dragAmount.x = oldDragAmount.x;
1730
- e.params.dragAmount.y = oldDragAmount.y;
1731
- _self.redraw();
1732
- }
1733
- /**
1734
- * The mouse-up handler.
1735
- *
1736
- * It clears the dragging-selection.
1737
- *
1738
- * @method mouseUpHandler.
1739
- * @param {XMouseEvent} e - The event to handle
1740
- * @private
1741
- * @return {void}
1742
- **/
1743
- mouseUpHandler(e) {
1744
- const _self = this;
1745
- if (e.button != 0)
1746
- return; // Only react on left mouse;
1747
- if (!e.params.wasDragged) {
1748
- _self.handleClick(e); // e.params.pos.x, e.params.pos.y );
1749
- }
1750
- for (var i in _self.draggedElements) {
1751
- var p = _self.draggedElements[i];
1752
- if (p.typeName == "bpath") {
1753
- _self.paths[p.pindex].bezierCurves[p.cindex].getPointByID(p.pid).listeners.fireDragEndEvent(e);
1754
- }
1755
- else if (p.typeName == "vertex") {
1756
- _self.vertices[p.vindex].listeners.fireDragEndEvent(e);
1757
- }
1758
- }
1759
- _self.draggedElements = [];
1760
- _self.redraw();
1761
- }
1762
- /**
1763
- * The mouse-wheel handler.
1764
- *
1765
- * It performs the zooming.
1766
- *
1767
- * @method mouseWheelHandler.
1768
- * @param {XMouseEvent} e - The event to handle
1769
- * @private
1770
- * @return {void}
1771
- **/
1772
- mouseWheelHandler(e) {
1773
- if (!this.config.enableZoom) {
1774
- return;
1775
- }
1776
- var zoomStep = 1.25; // Make configurable?
1777
- // CHANGED replaced _self by this
1778
- const _self = this;
1779
- const we = e;
1780
- if (we.deltaY < 0) {
1781
- _self.setZoom(_self.config.scaleX * zoomStep, _self.config.scaleY * zoomStep, new Vertex(e.params.pos.x, e.params.pos.y));
1782
- }
1783
- else if (we.deltaY > 0) {
1784
- _self.setZoom(_self.config.scaleX / zoomStep, _self.config.scaleY / zoomStep, new Vertex(e.params.pos.x, e.params.pos.y));
1785
- }
1786
- e.preventDefault();
1787
- _self.redraw();
1788
- }
1789
- /**
1790
- * Re-adjust the configured offset depending on the current canvas size and zoom (scaleX and scaleY).
1791
- *
1792
- * @method adjustOffset
1793
- * @param {boolean=false} redraw - [optional] If set the canvas will redraw with the new offset (default=false).
1794
- * @return {void}
1795
- **/
1796
- adjustOffset(redraw) {
1797
- this.draw.offset.x =
1798
- this.fill.offset.x =
1799
- this.config.offsetX =
1800
- this.canvasSize.width * (this.config.offsetAdjustXPercent / 100);
1801
- this.draw.offset.y =
1802
- this.fill.offset.y =
1803
- this.config.offsetY =
1804
- this.canvasSize.height * (this.config.offsetAdjustYPercent / 100);
1805
- if (redraw) {
1806
- this.redraw();
1807
- }
1808
- }
1809
- /**
1810
- * Set the new draw offset.
1811
- *
1812
- * Note: the function will not trigger any redraws.
1813
- *
1814
- * @param {Vertex} newOffset - The new draw offset to use.
1815
- **/
1816
- setOffset(newOffset) {
1817
- this.draw.offset.set(newOffset);
1818
- this.fill.offset.set(newOffset);
1819
- this.config.offsetX = newOffset.x;
1820
- this.config.offsetY = newOffset.y;
1821
- }
1822
- /**
1823
- * Set a new zoom value (and re-adjust the draw offset).
1824
- *
1825
- * Note: the function will not trigger any redraws.
1826
- *
1827
- * @param {number} zoomFactorX - The new horizontal zoom value.
1828
- * @param {number} zoomFactorY - The new vertical zoom value.
1829
- * @param {Vertex} interactionPos - The position of mouse/touch interaction.
1830
- **/
1831
- setZoom(zoomFactorX, zoomFactorY, interactionPos) {
1832
- let oldPos = this.transformMousePosition(interactionPos.x, interactionPos.y);
1833
- this.draw.scale.x = this.fill.scale.x = this.config.scaleX = Math.max(zoomFactorX, 0.01);
1834
- this.draw.scale.y = this.fill.scale.y = this.config.scaleY = Math.max(zoomFactorY, 0.01);
1835
- let newPos = this.transformMousePosition(interactionPos.x, interactionPos.y);
1836
- let newOffsetX = this.draw.offset.x + (newPos.x - oldPos.x) * this.draw.scale.x;
1837
- let newOffsetY = this.draw.offset.y + (newPos.y - oldPos.y) * this.draw.scale.y;
1838
- this.setOffset({ x: newOffsetX, y: newOffsetY });
1839
- }
1840
- installInputListeners() {
1841
- var _self = this;
1842
- if (this.config.enableMouse) {
1843
- // Install a mouse handler on the canvas.
1844
- new MouseHandler(this.eventCatcher ? this.eventCatcher : this.canvas)
1845
- .down((e) => {
1846
- _self.mouseDownHandler(e);
1847
- })
1848
- .drag((e) => {
1849
- _self.mouseDragHandler(e);
1850
- })
1851
- .up((e) => {
1852
- _self.mouseUpHandler(e);
1853
- });
1854
- }
1855
- else {
1856
- _self.console.log("Mouse interaction disabled.");
1857
- }
1858
- if (this.config.enableMouseWheel) {
1859
- // Install a mouse handler on the canvas.
1860
- new MouseHandler(this.eventCatcher ? this.eventCatcher : this.canvas).wheel((e) => {
1861
- _self.mouseWheelHandler(e);
1862
- });
1863
- }
1864
- else {
1865
- _self.console.log("Mouse wheel interaction disabled.");
1866
- }
1867
- if (this.config.enableTouch) {
1868
- // Install a touch handler on the canvas.
1869
- const relPos = (pos) => {
1870
- const bounds = _self.canvas.getBoundingClientRect();
1871
- return { x: pos.x - bounds.left, y: pos.y - bounds.top };
1872
- };
1873
- // Make PB work together with both, AlloyFinger as a esm module or a commonjs function.
1874
- if (typeof globalThis["AlloyFinger"] === "function" ||
1875
- typeof globalThis["createAlloyFinger"] === "function") {
1876
- try {
1877
- var touchMovePos = null;
1878
- var touchDownPos = null;
1879
- var draggedElement = null;
1880
- var multiTouchStartScale = null;
1881
- const clearTouch = () => {
1882
- touchMovePos = null;
1883
- touchDownPos = null;
1884
- draggedElement = null;
1885
- multiTouchStartScale = null;
1886
- _self.draggedElements = [];
1887
- };
1888
- const afProps = {
1889
- // touchStart: (evt: TouchEvent) => {
1890
- touchStart: (evt) => {
1891
- if (evt.touches.length == 1) {
1892
- touchMovePos = new Vertex(relPos({ x: evt.touches[0].clientX, y: evt.touches[0].clientY }));
1893
- touchDownPos = new Vertex(relPos({ x: evt.touches[0].clientX, y: evt.touches[0].clientY }));
1894
- draggedElement = _self.locatePointNear(_self.transformMousePosition(touchMovePos.x, touchMovePos.y), PlotBoilerplate.DEFAULT_TOUCH_TOLERANCE / Math.min(_self.config.cssScaleX, _self.config.cssScaleY));
1895
- if (draggedElement && draggedElement.typeName == "vertex") {
1896
- var draggingVertex = _self.vertices[draggedElement.vindex];
1897
- var fakeEvent = {
1898
- params: {
1899
- isTouchEvent: true,
1900
- dragAmount: { x: 0, y: 0 },
1901
- wasDragged: false,
1902
- mouseDownPos: touchDownPos.clone(),
1903
- mouseDragPos: touchDownPos.clone(),
1904
- vertex: draggingVertex
1905
- }
1906
- };
1907
- _self.draggedElements = [draggedElement];
1908
- draggingVertex.listeners.fireDragStartEvent(fakeEvent);
1909
- }
1910
- }
1911
- },
1912
- touchMove: (evt) => {
1913
- if (evt.touches.length == 1 && draggedElement) {
1914
- evt.preventDefault();
1915
- evt.stopPropagation();
1916
- if (!touchDownPos || !touchMovePos) {
1917
- return;
1918
- }
1919
- var rel = relPos({ x: evt.touches[0].clientX, y: evt.touches[0].clientY });
1920
- var trans = _self.transformMousePosition(rel.x, rel.y);
1921
- var diff = new Vertex(_self.transformMousePosition(touchMovePos.x, touchMovePos.y)).difference(trans);
1922
- if (draggedElement.typeName == "vertex") {
1923
- if (!_self.vertices[draggedElement.vindex].attr.draggable)
1924
- return;
1925
- _self.vertices[draggedElement.vindex].add(diff);
1926
- var draggingVertex = _self.vertices[draggedElement.vindex];
1927
- var fakeEvent = {
1928
- isTouchEvent: true,
1929
- params: {
1930
- dragAmount: diff.clone(),
1931
- wasDragged: true,
1932
- mouseDownPos: touchDownPos.clone(),
1933
- mouseDragPos: touchDownPos.clone().add(diff),
1934
- vertex: draggingVertex
1935
- }
1936
- };
1937
- draggingVertex.listeners.fireDragEvent(fakeEvent);
1938
- _self.redraw();
1939
- }
1940
- touchMovePos = new Vertex(rel);
1941
- }
1942
- else if (evt.touches.length == 2) {
1943
- if (!this.config.enablePan) {
1944
- return;
1945
- }
1946
- // If at least two fingers touch and move, then change the draw offset (panning).
1947
- evt.preventDefault();
1948
- evt.stopPropagation();
1949
- _self.setOffset(_self.draw.offset
1950
- .clone()
1951
- .addXY(evt.deltaX, evt.deltaY)); // Apply zoom?
1952
- _self.redraw();
1953
- }
1954
- },
1955
- touchEnd: (evt) => {
1956
- // Note: e.touches.length is 0 here
1957
- if (draggedElement && draggedElement.typeName == "vertex") {
1958
- if (!touchDownPos) {
1959
- return;
1960
- }
1961
- var draggingVertex = _self.vertices[draggedElement.vindex];
1962
- var fakeEvent = {
1963
- isTouchEvent: true,
1964
- params: {
1965
- dragAmount: { x: 0, y: 0 },
1966
- wasDragged: false,
1967
- mouseDownPos: touchDownPos.clone(),
1968
- mouseDragPos: touchDownPos.clone(),
1969
- vertex: draggingVertex
1970
- }
1971
- };
1972
- // Check if vertex was moved
1973
- if (touchMovePos && touchDownPos && touchDownPos.distance(touchMovePos) < 0.001) {
1974
- // if( e.touches.length == 1 && diff.x == 0 && diff.y == 0 ) {
1975
- draggingVertex.listeners.fireClickEvent(fakeEvent);
1976
- }
1977
- else {
1978
- draggingVertex.listeners.fireDragEndEvent(fakeEvent);
1979
- }
1980
- }
1981
- clearTouch();
1982
- },
1983
- touchCancel: (evt) => {
1984
- clearTouch();
1985
- },
1986
- multipointStart: (evt) => {
1987
- multiTouchStartScale = _self.draw.scale.clone();
1988
- },
1989
- multipointEnd: (evt) => {
1990
- multiTouchStartScale = null;
1991
- },
1992
- pinch: (evt) => {
1993
- if (!this.config.enableZoom) {
1994
- return;
1995
- }
1996
- const touchItem0 = evt.touches.item(0);
1997
- const touchItem1 = evt.touches.item(1);
1998
- if (!evt.touches || !multiTouchStartScale || !touchItem0 || !touchItem1) {
1999
- return;
2000
- }
2001
- // For pinching there must be at least two touch items
2002
- const fingerA = new Vertex(touchItem0.clientX, touchItem0.clientY);
2003
- const fingerB = new Vertex(touchItem1.clientX, touchItem1.clientY);
2004
- const center = new Line(fingerA, fingerB).vertAt(0.5);
2005
- _self.setZoom(multiTouchStartScale.x * evt.zoom, multiTouchStartScale.y * evt.zoom, center);
2006
- _self.redraw();
2007
- }
2008
- }; // END afProps
2009
- if (window["createAlloyFinger"]) {
2010
- // window["createAlloyFinger"](this.eventCatcher ? this.eventCatcher : this.canvas, afProps);
2011
- const createAlloyFinger = window["createAlloyFinger"];
2012
- createAlloyFinger(this.eventCatcher ? this.eventCatcher : this.canvas, afProps);
2013
- }
2014
- else {
2015
- /* tslint:disable-next-line */
2016
- new AlloyFinger(this.eventCatcher ? this.eventCatcher : this.canvas, afProps);
2017
- }
2018
- }
2019
- catch (e) {
2020
- console.error("Failed to initialize AlloyFinger!");
2021
- console.error(e);
2022
- }
2023
- }
2024
- else if (globalThis["Touchy"] && typeof globalThis["Touchy"] == "function") {
2025
- console.error("[Deprecation] Found Touchy which is not supported any more. Please use AlloyFinger instead.");
2026
- // Convert absolute touch positions to relative DOM element position (relative to canvas)
2027
- }
2028
- else {
2029
- console.warn("Cannot initialize the touch handler. AlloyFinger is missig. Did you include it?");
2030
- }
2031
- }
2032
- else {
2033
- _self.console.log("Touch interaction disabled.");
2034
- }
2035
- if (this.config.enableKeys) {
2036
- // Install key handler
2037
- this.keyHandler = new KeyHandler({ trackAll: true })
2038
- .down("escape", function () {
2039
- _self.clearSelection(true);
2040
- })
2041
- .down("shift", function () {
2042
- _self.selectPolygon = new Polygon();
2043
- _self.redraw();
2044
- })
2045
- .up("shift", function () {
2046
- // Find and select vertices in the drawn area
2047
- if (_self.selectPolygon == null)
2048
- return;
2049
- _self.selectVerticesInPolygon(_self.selectPolygon);
2050
- _self.selectPolygon = null;
2051
- _self.redraw();
2052
- });
2053
- } // END IF enableKeys?
2054
- else {
2055
- _self.console.log("Keyboard interaction disabled.");
2056
- }
2057
- }
2058
- /**
2059
- * Creates a control GUI (a dat.gui instance) for this
2060
- * plot boilerplate instance.
2061
- *
2062
- * @method createGUI
2063
- * @instance
2064
- * @memberof PlotBoilerplate
2065
- * @return {dat.gui.GUI}
2066
- **/
2067
- createGUI(props) {
2068
- // This function moved to the helper utils.
2069
- // We do not want to include the whole dat.GUI package.
2070
- const utils = globalThis["utils"];
2071
- // if (globalThis["utils"] && typeof globalThis["utils"].createGUI == "function") {
2072
- // return (globalThis["utils" as keyof Object] as any as ({createGUI : (pb:PlotBoilerplate,props:DatGuiProps|undefined)=>GUI })).createGUI(this, props);
2073
- if (utils && typeof utils.createGUI === "function") {
2074
- return (this._gui = utils.createGUI(this, props));
2075
- }
2076
- else {
2077
- throw "Cannot create dat.GUI or lil-gui instance; did you load the ./utils/creategui helper function an the dat.GUI/lil-gui library?";
2078
- }
2079
- }
2080
- /**
2081
- * Retriebe the GUI once it was created. If the `createGUI` method was not called or failed to create any
2082
- * GUI then null is returned.
2083
- * @returns {GUI | null}
2084
- */
2085
- getGUI() {
2086
- return this._gui;
2087
- }
2088
- } // END class PlotBoilerplate
2089
- /** @constant {number} */
2090
- PlotBoilerplate.DEFAULT_CANVAS_WIDTH = 1024;
2091
- /** @constant {number} */
2092
- PlotBoilerplate.DEFAULT_CANVAS_HEIGHT = 768;
2093
- /** @constant {number} */
2094
- PlotBoilerplate.DEFAULT_CLICK_TOLERANCE = 8;
2095
- /** @constant {number} */
2096
- PlotBoilerplate.DEFAULT_TOUCH_TOLERANCE = 32;
2097
- /**
2098
- * A wrapper class for draggable items (mostly vertices).
2099
- * @private
2100
- **/
2101
- PlotBoilerplate.Draggable = (_a = class {
2102
- constructor(item, typeName) {
2103
- this.item = item;
2104
- this.typeName = typeName;
2105
- }
2106
- isVertex() {
2107
- return this.typeName == PlotBoilerplate.Draggable.VERTEX;
2108
- }
2109
- setVIndex(vindex) {
2110
- this.vindex = vindex;
2111
- return this;
2112
- }
2113
- },
2114
- __setFunctionName(_a, "Draggable"),
2115
- _a.VERTEX = "vertex",
2116
- _a);
2117
- /**
2118
- * A set of helper functions.
2119
- **/
2120
- PlotBoilerplate.utils = {
2121
- /**
2122
- * Merge the elements in the 'extension' object into the 'base' object based on
2123
- * the keys of 'base'.
2124
- *
2125
- * @param {Object} base
2126
- * @param {Object} extension
2127
- * @return {Object} base extended by the new attributes.
2128
- **/
2129
- safeMergeByKeys: (base, extension) => {
2130
- for (var k in extension) {
2131
- if (!extension.hasOwnProperty(k)) {
2132
- continue;
2133
- }
2134
- if (base.hasOwnProperty(k)) {
2135
- const typ = typeof base[k];
2136
- const extVal = extension[k];
2137
- try {
2138
- if (typ == "boolean") {
2139
- if (typeof extVal === "string")
2140
- base[k] = Boolean(!!JSON.parse(extVal));
2141
- else
2142
- base[k] = extVal;
2143
- }
2144
- else if (typ == "number") {
2145
- if (typeof extVal === "string")
2146
- base[k] = Number(JSON.parse(extVal) * 1);
2147
- else
2148
- base[k] = extension[k];
2149
- }
2150
- else if (typ == "function" && typeof extVal == "function") {
2151
- base[k] = extension[k];
2152
- }
2153
- else {
2154
- // Probably a sting
2155
- base[k] = extension[k];
2156
- }
2157
- }
2158
- catch (e) {
2159
- console.error("error in key ", k, extVal, e);
2160
- }
2161
- }
2162
- else {
2163
- base[k] = extension[k];
2164
- }
2165
- }
2166
- return base;
2167
- },
2168
- /*
2169
- __safeMergeByKeys: <KeyType extends string | number | symbol, ValueType extends boolean | number | string | Function>(
2170
- base: Record<KeyType, ValueType>,
2171
- extension: Record<KeyType, string>
2172
- ): Record<KeyType, ValueType> => {
2173
- for (var k in extension) {
2174
- if (!extension.hasOwnProperty(k)) continue;
2175
- if (base.hasOwnProperty(k)) {
2176
- var typ = typeof base[k];
2177
- try {
2178
- if (typ == "boolean") base[k] = !!JSON.parse(extension[k]);
2179
- else if (typ == "number") base[k] = JSON.parse(extension[k]) * 1;
2180
- else if (typ == "function" && typeof extension[k] == "function") base[k] = extension[k];
2181
- else base[k] = extension[k];
2182
- } catch (e) {
2183
- console.error("error in key ", k, extension[k], e);
2184
- }
2185
- } else {
2186
- base[k] = extension[k];
2187
- }
2188
- }
2189
- return base;
2190
- },
2191
- *()
2192
-
2193
- /**
2194
- * A helper function to scale elements (usually the canvas) using CSS.
2195
- *
2196
- * transform-origin is at (0,0).
2197
- *
2198
- * @param {HTMLElement} element - The DOM element to scale.
2199
- * @param {number} scaleX The - X scale factor.
2200
- * @param {number} scaleY The - Y scale factor.
2201
- * @return {void}
2202
- **/
2203
- setCSSscale: (element, scaleX, scaleY) => {
2204
- // element.style["transform-origin"] = "0 0";
2205
- element.style.transformOrigin = "0 0";
2206
- if (scaleX == 1.0 && scaleY == 1.0) {
2207
- // element.style.transform = null;
2208
- element.style.removeProperty("transform");
2209
- }
2210
- else
2211
- element.style.transform = "scale(" + scaleX + "," + scaleY + ")";
2212
- },
2213
- // A helper for fetching data from objects.
2214
- fetch: {
2215
- /**
2216
- * A helper function to the the object property value specified by the given key.
2217
- *
2218
- * @param {any} object - The object to get the property's value from. Must not be null.
2219
- * @param {string} key - The key of the object property (the name).
2220
- * @param {any} fallback - A default value if the key does not exist.
2221
- **/
2222
- val: (obj, key, fallback) => {
2223
- if (!obj.hasOwnProperty(key))
2224
- return fallback;
2225
- if (typeof obj[key] == "undefined")
2226
- return fallback;
2227
- return obj[key];
2228
- },
2229
- /**
2230
- * A helper function to the the object property numeric value specified by the given key.
2231
- *
2232
- * @param {any} object - The object to get the property's value from. Must not be null.
2233
- * @param {string} key - The key of the object property (the name).
2234
- * @param {number} fallback - A default value if the key does not exist.
2235
- * @return {number}
2236
- **/
2237
- num: (obj, key, fallback) => {
2238
- if (!obj.hasOwnProperty(key))
2239
- return fallback;
2240
- if (typeof obj[key] === "number")
2241
- return obj[key];
2242
- else {
2243
- try {
2244
- return JSON.parse(obj[key]) * 1;
2245
- }
2246
- catch (e) {
2247
- return fallback;
2248
- }
2249
- }
2250
- },
2251
- /**
2252
- * A helper function to the the object property boolean value specified by the given key.
2253
- *
2254
- * @param {any} object - The object to get the property's value from. Must not be null.
2255
- * @param {string} key - The key of the object property (the name).
2256
- * @param {boolean} fallback - A default value if the key does not exist.
2257
- * @return {boolean}
2258
- **/
2259
- bool: (obj, key, fallback) => {
2260
- if (!obj.hasOwnProperty(key))
2261
- return fallback;
2262
- if (typeof obj[key] == "boolean")
2263
- return obj[key];
2264
- else {
2265
- try {
2266
- return !!JSON.parse(obj[key]);
2267
- }
2268
- catch (e) {
2269
- return fallback;
2270
- }
2271
- }
2272
- },
2273
- /**
2274
- * A helper function to the the object property function-value specified by the given key.
2275
- *
2276
- * @param {any} object - The object to get the property's value from. Must not be null.
2277
- * @param {string} key - The key of the object property (the name).
2278
- * @param {function} fallback - A default value if the key does not exist.
2279
- * @return {function}
2280
- **/
2281
- func: (obj, key, fallback) => {
2282
- if (!obj.hasOwnProperty(key))
2283
- return fallback;
2284
- if (typeof obj[key] !== "function")
2285
- return fallback;
2286
- return obj[key];
2287
- }
2288
- }, // END fetch
2289
- /**
2290
- * Installs vertex listeners to the path's vertices so that controlpoints
2291
- * move with their path points when dragged.
2292
- *
2293
- * Bézier path points with attr.bezierAutoAdjust==true will have their
2294
- * two control points audo-updated if moved, too (keep path connections smooth).
2295
- *
2296
- * @param {BezierPath} bezierPath - The path to use auto-adjustment for.
2297
- **/
2298
- enableBezierPathAutoAdjust: (bezierPath) => {
2299
- for (var i = 0; i < bezierPath.bezierCurves.length; i++) {
2300
- // This should be wrapped into the BezierPath implementation.
2301
- bezierPath.bezierCurves[i].startPoint.listeners.addDragListener(function (e) {
2302
- var cindex = bezierPath.locateCurveByStartPoint(e.params.vertex);
2303
- bezierPath.bezierCurves[cindex].startPoint.addXY(-e.params.dragAmount.x, -e.params.dragAmount.y);
2304
- bezierPath.moveCurvePoint(cindex * 1, bezierPath.START_POINT, e.params.dragAmount);
2305
- bezierPath.updateArcLengths();
2306
- });
2307
- bezierPath.bezierCurves[i].startControlPoint.listeners.addDragListener(function (e) {
2308
- var cindex = bezierPath.locateCurveByStartControlPoint(e.params.vertex);
2309
- if (!bezierPath.bezierCurves[cindex].startPoint.attr.bezierAutoAdjust)
2310
- return;
2311
- bezierPath.adjustPredecessorControlPoint(cindex * 1, true, // obtain handle length?
2312
- false // update arc lengths
2313
- );
2314
- bezierPath.updateArcLengths();
2315
- });
2316
- bezierPath.bezierCurves[i].endControlPoint.listeners.addDragListener(function (e) {
2317
- var cindex = bezierPath.locateCurveByEndControlPoint(e.params.vertex);
2318
- if (!bezierPath.bezierCurves[cindex % bezierPath.bezierCurves.length].endPoint.attr.bezierAutoAdjust)
2319
- return;
2320
- bezierPath.adjustSuccessorControlPoint(cindex * 1, true, // obtain handle length?
2321
- false // update arc lengths
2322
- );
2323
- bezierPath.updateArcLengths();
2324
- });
2325
- if (i + 1 == bezierPath.bezierCurves.length) {
2326
- // && !bezierPath.adjustCircular ) {
2327
- // Move last control point with the end point (if not circular)
2328
- bezierPath.bezierCurves[bezierPath.bezierCurves.length - 1].endPoint.listeners.addDragListener(function (e) {
2329
- if (!bezierPath.adjustCircular) {
2330
- var cindex = bezierPath.locateCurveByEndPoint(e.params.vertex);
2331
- bezierPath.moveCurvePoint(cindex * 1, bezierPath.END_CONTROL_POINT, new Vertex({ x: e.params.dragAmount.x, y: e.params.dragAmount.y }));
2332
- }
2333
- bezierPath.updateArcLengths();
2334
- });
2335
- }
2336
- } // END for
2337
- }
2338
- }; // END utils
2339
- export default PlotBoilerplate;
2340
- //# sourceMappingURL=PlotBoilerplate.js.map