plotboilerplate 1.28.0 → 1.29.0

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