plotboilerplate 1.21.0 → 1.23.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 (325) hide show
  1. package/README.md +2 -0
  2. package/dist/index.esm.js +252 -77
  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 +522 -338
  9. package/dist/plotboilerplate.min.js +1 -1
  10. package/package.json +7 -5
  11. package/src/cjs/BezierPath.js.map +1 -1
  12. package/src/cjs/Bounds.js +1 -1
  13. package/src/cjs/Bounds.js.map +1 -1
  14. package/src/cjs/Circle.js.map +1 -1
  15. package/src/cjs/CircleSector.d.ts +64 -1
  16. package/src/cjs/CircleSector.js +121 -1
  17. package/src/cjs/CircleSector.js.map +1 -1
  18. package/src/cjs/CubicBezierCurve.js +2 -2
  19. package/src/cjs/CubicBezierCurve.js.map +1 -1
  20. package/src/cjs/Grid.js.map +1 -1
  21. package/src/cjs/KeyHandler.d.ts +1 -1
  22. package/src/cjs/KeyHandler.js +13 -13
  23. package/src/cjs/KeyHandler.js.map +1 -1
  24. package/src/cjs/Line.js +2 -0
  25. package/src/cjs/Line.js.map +1 -1
  26. package/src/cjs/MouseHandler.d.ts +2 -2
  27. package/src/cjs/MouseHandler.js +7 -5
  28. package/src/cjs/MouseHandler.js.map +1 -1
  29. package/src/cjs/PlotBoilerplate.d.ts +1 -1
  30. package/src/cjs/PlotBoilerplate.js +77 -63
  31. package/src/cjs/PlotBoilerplate.js.map +1 -1
  32. package/src/cjs/Polygon.d.ts +13 -1
  33. package/src/cjs/Polygon.js +30 -1
  34. package/src/cjs/Polygon.js.map +1 -1
  35. package/src/cjs/Triangle.js +1 -1
  36. package/src/cjs/Triangle.js.map +1 -1
  37. package/src/cjs/UIDGenerator.js +1 -1
  38. package/src/cjs/UIDGenerator.js.map +1 -1
  39. package/src/cjs/VEllipse.js.map +1 -1
  40. package/src/cjs/VEllipseSector.js +1 -1
  41. package/src/cjs/VEllipseSector.js.map +1 -1
  42. package/src/cjs/Vector.js +2 -0
  43. package/src/cjs/Vector.js.map +1 -1
  44. package/src/cjs/VertTuple.js.map +1 -1
  45. package/src/cjs/Vertex.d.ts +3 -2
  46. package/src/cjs/Vertex.js +13 -7
  47. package/src/cjs/Vertex.js.map +1 -1
  48. package/src/cjs/VertexAttr.d.ts +2 -1
  49. package/src/cjs/VertexAttr.js +2 -1
  50. package/src/cjs/VertexAttr.js.map +1 -1
  51. package/src/cjs/VertexListeners.d.ts +1 -1
  52. package/src/cjs/VertexListeners.js.map +1 -1
  53. package/src/cjs/draw.js +1 -1
  54. package/src/cjs/draw.js.map +1 -1
  55. package/src/cjs/drawgl.js.map +1 -1
  56. package/src/cjs/drawutilssvg.d.ts +17 -3
  57. package/src/cjs/drawutilssvg.js +97 -91
  58. package/src/cjs/drawutilssvg.js.map +1 -1
  59. package/src/cjs/geomutils.js +2 -2
  60. package/src/cjs/geomutils.js.map +1 -1
  61. package/src/cjs/index.js +5 -1
  62. package/src/cjs/index.js.map +1 -1
  63. package/src/cjs/interfaces/DrawLib.d.ts +2 -2
  64. package/src/cjs/interfaces/core.d.ts +3 -3
  65. package/src/cjs/interfaces/index.js +5 -1
  66. package/src/cjs/interfaces/index.js.map +1 -1
  67. package/src/cjs/utils/NGons.d.ts +13 -0
  68. package/src/cjs/utils/NGons.js +36 -0
  69. package/src/cjs/utils/NGons.js.map +1 -0
  70. package/src/cjs/utils/Params.d.ts +15 -0
  71. package/src/cjs/utils/Params.js +49 -0
  72. package/src/cjs/utils/Params.js.map +1 -0
  73. package/src/cjs/utils/WebColors.js.map +1 -1
  74. package/src/cjs/utils/WebColorsContrast.js +1 -1
  75. package/src/cjs/utils/WebColorsContrast.js.map +1 -1
  76. package/src/cjs/utils/algorithms/CatmullRomPath.js.map +1 -1
  77. package/src/cjs/utils/algorithms/CircleIntersections.d.ts +3 -2
  78. package/src/cjs/utils/algorithms/CircleIntersections.js +12 -20
  79. package/src/cjs/utils/algorithms/CircleIntersections.js.map +1 -1
  80. package/src/cjs/utils/algorithms/ContourLineDetection.d.ts +150 -0
  81. package/src/cjs/utils/algorithms/ContourLineDetection.js +367 -0
  82. package/src/cjs/utils/algorithms/ContourLineDetection.js.map +1 -0
  83. package/src/cjs/utils/algorithms/CubicSplinePath.js.map +1 -1
  84. package/src/cjs/utils/algorithms/HobbyPath.js.map +1 -1
  85. package/src/cjs/utils/algorithms/Metaballs.d.ts +30 -0
  86. package/src/cjs/utils/algorithms/Metaballs.js +114 -0
  87. package/src/cjs/utils/algorithms/Metaballs.js.map +1 -0
  88. package/src/cjs/utils/algorithms/arrayResize.d.ts +8 -0
  89. package/src/cjs/utils/algorithms/arrayResize.js +24 -0
  90. package/src/cjs/utils/algorithms/arrayResize.js.map +1 -0
  91. package/src/cjs/utils/algorithms/clearDuplicateVertices.d.ts +21 -0
  92. package/src/cjs/utils/algorithms/clearDuplicateVertices.js +48 -0
  93. package/src/cjs/utils/algorithms/clearDuplicateVertices.js.map +1 -0
  94. package/src/cjs/utils/algorithms/clearPolygonDuplicateVertices.js.map +1 -1
  95. package/src/cjs/utils/algorithms/convexHull.js.map +1 -1
  96. package/src/cjs/utils/algorithms/convexPolygonIncircle.js.map +1 -1
  97. package/src/cjs/utils/algorithms/delaunay.js.map +1 -1
  98. package/src/cjs/utils/algorithms/delaunay2voronoi.js.map +1 -1
  99. package/src/cjs/utils/algorithms/detectPaths.js.map +1 -1
  100. package/src/cjs/utils/algorithms/findPolygonSelfIntersections.js.map +1 -1
  101. package/src/cjs/utils/algorithms/matrixFill.js +1 -1
  102. package/src/cjs/utils/algorithms/matrixFill.js.map +1 -1
  103. package/src/cjs/utils/algorithms/splitPolygonToNonIntersecting.js.map +1 -1
  104. package/src/cjs/utils/algorithms/sutherlandHodgman.js.map +1 -1
  105. package/src/cjs/utils/cloneVertexArray.js.map +1 -1
  106. package/src/cjs/utils/creategui.js +20 -12
  107. package/src/cjs/utils/datastructures/CircularIntervalSet.js.map +1 -1
  108. package/src/cjs/utils/datastructures/Color.d.ts +2 -1
  109. package/src/cjs/utils/datastructures/Color.js +35 -16
  110. package/src/cjs/utils/datastructures/Color.js.map +1 -1
  111. package/src/cjs/utils/datastructures/DataGrid2d.d.ts +47 -0
  112. package/src/cjs/utils/datastructures/DataGrid2d.js +20 -0
  113. package/src/cjs/utils/datastructures/DataGrid2d.js.map +1 -0
  114. package/src/cjs/utils/datastructures/DataGrid2dListAdapter.d.ts +65 -0
  115. package/src/cjs/utils/datastructures/DataGrid2dListAdapter.js +84 -0
  116. package/src/cjs/utils/datastructures/DataGrid2dListAdapter.js.map +1 -0
  117. package/src/cjs/utils/datastructures/GenericPath.d.ts +14 -3
  118. package/src/cjs/utils/datastructures/GenericPath.js +20 -3
  119. package/src/cjs/utils/datastructures/GenericPath.js.map +1 -1
  120. package/src/cjs/utils/datastructures/Girih.d.ts +3 -2
  121. package/src/cjs/utils/datastructures/Girih.js +2 -1
  122. package/src/cjs/utils/datastructures/Girih.js.map +1 -1
  123. package/src/cjs/utils/datastructures/GirihBowtie.js +2 -0
  124. package/src/cjs/utils/datastructures/GirihBowtie.js.map +1 -1
  125. package/src/cjs/utils/datastructures/GirihDecagon.js +2 -0
  126. package/src/cjs/utils/datastructures/GirihDecagon.js.map +1 -1
  127. package/src/cjs/utils/datastructures/GirihHexagon.js +2 -0
  128. package/src/cjs/utils/datastructures/GirihHexagon.js.map +1 -1
  129. package/src/cjs/utils/datastructures/GirihPenroseRhombus.js +3 -1
  130. package/src/cjs/utils/datastructures/GirihPenroseRhombus.js.map +1 -1
  131. package/src/cjs/utils/datastructures/GirihPentagon.js +2 -0
  132. package/src/cjs/utils/datastructures/GirihPentagon.js.map +1 -1
  133. package/src/cjs/utils/datastructures/GirihRhombus.js +2 -0
  134. package/src/cjs/utils/datastructures/GirihRhombus.js.map +1 -1
  135. package/src/cjs/utils/datastructures/GirihTile.js +4 -2
  136. package/src/cjs/utils/datastructures/GirihTile.js.map +1 -1
  137. package/src/cjs/utils/datastructures/Matrix4x4.js.map +1 -1
  138. package/src/cjs/utils/datastructures/VoronoiCell.js.map +1 -1
  139. package/src/cjs/utils/datastructures/interfaces.d.ts +3 -3
  140. package/src/cjs/utils/detectDarkMode.js.map +1 -1
  141. package/src/cjs/utils/dom/getAvailableContainerSpace.js +1 -1
  142. package/src/cjs/utils/dom/getAvailableContainerSpace.js.map +1 -1
  143. package/src/cjs/utils/findInVertexArray.js.map +1 -1
  144. package/src/cjs/utils/gup.d.ts +8 -0
  145. package/src/cjs/utils/gup.js +8 -0
  146. package/src/cjs/utils/gup.js.map +1 -1
  147. package/src/cjs/utils/helpers/BezierPathInteractionHelper.d.ts +6 -5
  148. package/src/cjs/utils/helpers/BezierPathInteractionHelper.js +3 -2
  149. package/src/cjs/utils/helpers/BezierPathInteractionHelper.js.map +1 -1
  150. package/src/cjs/utils/helpers/CircleHelper.d.ts +38 -3
  151. package/src/cjs/utils/helpers/CircleHelper.js +51 -11
  152. package/src/cjs/utils/helpers/CircleHelper.js.map +1 -1
  153. package/src/cjs/utils/helpers/CircleSectorHelper.d.ts +47 -1
  154. package/src/cjs/utils/helpers/CircleSectorHelper.js +85 -14
  155. package/src/cjs/utils/helpers/CircleSectorHelper.js.map +1 -1
  156. package/src/cjs/utils/io/FileDrop.d.ts +3 -3
  157. package/src/cjs/utils/io/FileDrop.js.map +1 -1
  158. package/src/cjs/utils/parsers/OBJParser.d.ts +2 -2
  159. package/src/cjs/utils/parsers/OBJParser.js.map +1 -1
  160. package/src/cjs/utils/parsers/STLParser.d.ts +4 -3
  161. package/src/cjs/utils/parsers/STLParser.js +62 -12
  162. package/src/cjs/utils/parsers/STLParser.js.map +1 -1
  163. package/src/cjs/utils/parsers/svg/parseSVGPathData.js +1 -1
  164. package/src/cjs/utils/parsers/svg/parseSVGPathData.js.map +1 -1
  165. package/src/cjs/utils/parsers/svg/splitSVGPathData.js.map +1 -1
  166. package/src/cjs/utils/parsers/svg/types.d.ts +13 -13
  167. package/src/createDemoDrawables.js +48 -3
  168. package/src/esm/BezierPath.js.map +1 -1
  169. package/src/esm/Bounds.js.map +1 -1
  170. package/src/esm/Circle.js.map +1 -1
  171. package/src/esm/CircleSector.d.ts +64 -1
  172. package/src/esm/CircleSector.js +121 -1
  173. package/src/esm/CircleSector.js.map +1 -1
  174. package/src/esm/CubicBezierCurve.js.map +1 -1
  175. package/src/esm/Grid.js.map +1 -1
  176. package/src/esm/KeyHandler.d.ts +1 -1
  177. package/src/esm/KeyHandler.js +13 -13
  178. package/src/esm/KeyHandler.js.map +1 -1
  179. package/src/esm/Line.js.map +1 -1
  180. package/src/esm/MouseHandler.d.ts +2 -2
  181. package/src/esm/MouseHandler.js +4 -4
  182. package/src/esm/MouseHandler.js.map +1 -1
  183. package/src/esm/PlotBoilerplate.d.ts +1 -1
  184. package/src/esm/PlotBoilerplate.js +43 -29
  185. package/src/esm/PlotBoilerplate.js.map +1 -1
  186. package/src/esm/Polygon.d.ts +13 -1
  187. package/src/esm/Polygon.js +30 -1
  188. package/src/esm/Polygon.js.map +1 -1
  189. package/src/esm/Triangle.js.map +1 -1
  190. package/src/esm/VEllipse.js.map +1 -1
  191. package/src/esm/VEllipseSector.js +1 -1
  192. package/src/esm/VEllipseSector.js.map +1 -1
  193. package/src/esm/Vector.js.map +1 -1
  194. package/src/esm/VertTuple.js.map +1 -1
  195. package/src/esm/Vertex.d.ts +3 -2
  196. package/src/esm/Vertex.js +9 -3
  197. package/src/esm/Vertex.js.map +1 -1
  198. package/src/esm/VertexAttr.d.ts +2 -1
  199. package/src/esm/VertexAttr.js +2 -1
  200. package/src/esm/VertexAttr.js.map +1 -1
  201. package/src/esm/VertexListeners.d.ts +1 -1
  202. package/src/esm/VertexListeners.js.map +1 -1
  203. package/src/esm/draw.js.map +1 -1
  204. package/src/esm/drawgl.js.map +1 -1
  205. package/src/esm/drawutilssvg.d.ts +17 -3
  206. package/src/esm/drawutilssvg.js +28 -22
  207. package/src/esm/drawutilssvg.js.map +1 -1
  208. package/src/esm/geomutils.js +2 -2
  209. package/src/esm/geomutils.js.map +1 -1
  210. package/src/esm/interfaces/DrawLib.d.ts +2 -2
  211. package/src/esm/interfaces/core.d.ts +3 -3
  212. package/src/esm/utils/NGons.d.ts +13 -0
  213. package/src/esm/utils/NGons.js +33 -0
  214. package/src/esm/utils/NGons.js.map +1 -0
  215. package/src/esm/utils/Params.d.ts +15 -0
  216. package/src/esm/utils/Params.js +44 -0
  217. package/src/esm/utils/Params.js.map +1 -0
  218. package/src/esm/utils/WebColors.js.map +1 -1
  219. package/src/esm/utils/algorithms/CatmullRomPath.js.map +1 -1
  220. package/src/esm/utils/algorithms/CircleIntersections.d.ts +3 -2
  221. package/src/esm/utils/algorithms/CircleIntersections.js +11 -19
  222. package/src/esm/utils/algorithms/CircleIntersections.js.map +1 -1
  223. package/src/esm/utils/algorithms/ContourLineDetection.d.ts +150 -0
  224. package/src/esm/utils/algorithms/ContourLineDetection.js +362 -0
  225. package/src/esm/utils/algorithms/ContourLineDetection.js.map +1 -0
  226. package/src/esm/utils/algorithms/CubicSplinePath.js.map +1 -1
  227. package/src/esm/utils/algorithms/HobbyPath.js.map +1 -1
  228. package/src/esm/utils/algorithms/Metaballs.d.ts +30 -0
  229. package/src/esm/utils/algorithms/Metaballs.js +109 -0
  230. package/src/esm/utils/algorithms/Metaballs.js.map +1 -0
  231. package/src/esm/utils/algorithms/arrayResize.d.ts +8 -0
  232. package/src/esm/utils/algorithms/arrayResize.js +20 -0
  233. package/src/esm/utils/algorithms/arrayResize.js.map +1 -0
  234. package/src/esm/utils/algorithms/clearDuplicateVertices.d.ts +21 -0
  235. package/src/esm/utils/algorithms/clearDuplicateVertices.js +44 -0
  236. package/src/esm/utils/algorithms/clearDuplicateVertices.js.map +1 -0
  237. package/src/esm/utils/algorithms/clearPolygonDuplicateVertices.js.map +1 -1
  238. package/src/esm/utils/algorithms/convexHull.js.map +1 -1
  239. package/src/esm/utils/algorithms/convexPolygonIncircle.js.map +1 -1
  240. package/src/esm/utils/algorithms/delaunay.js.map +1 -1
  241. package/src/esm/utils/algorithms/delaunay2voronoi.js.map +1 -1
  242. package/src/esm/utils/algorithms/detectPaths.js.map +1 -1
  243. package/src/esm/utils/algorithms/findPolygonSelfIntersections.js.map +1 -1
  244. package/src/esm/utils/algorithms/matrixFill.js.map +1 -1
  245. package/src/esm/utils/algorithms/splitPolygonToNonIntersecting.js.map +1 -1
  246. package/src/esm/utils/algorithms/sutherlandHodgman.js.map +1 -1
  247. package/src/esm/utils/cloneVertexArray.js.map +1 -1
  248. package/src/esm/utils/datastructures/CircularIntervalSet.js.map +1 -1
  249. package/src/esm/utils/datastructures/Color.d.ts +2 -1
  250. package/src/esm/utils/datastructures/Color.js +33 -14
  251. package/src/esm/utils/datastructures/Color.js.map +1 -1
  252. package/src/esm/utils/datastructures/DataGrid2d.d.ts +47 -0
  253. package/src/esm/utils/datastructures/DataGrid2d.js +19 -0
  254. package/src/esm/utils/datastructures/DataGrid2d.js.map +1 -0
  255. package/src/esm/utils/datastructures/DataGrid2dListAdapter.d.ts +65 -0
  256. package/src/esm/utils/datastructures/DataGrid2dListAdapter.js +79 -0
  257. package/src/esm/utils/datastructures/DataGrid2dListAdapter.js.map +1 -0
  258. package/src/esm/utils/datastructures/GenericPath.d.ts +14 -3
  259. package/src/esm/utils/datastructures/GenericPath.js +20 -3
  260. package/src/esm/utils/datastructures/GenericPath.js.map +1 -1
  261. package/src/esm/utils/datastructures/Girih.d.ts +3 -2
  262. package/src/esm/utils/datastructures/Girih.js +2 -1
  263. package/src/esm/utils/datastructures/Girih.js.map +1 -1
  264. package/src/esm/utils/datastructures/GirihBowtie.js.map +1 -1
  265. package/src/esm/utils/datastructures/GirihDecagon.js.map +1 -1
  266. package/src/esm/utils/datastructures/GirihHexagon.js.map +1 -1
  267. package/src/esm/utils/datastructures/GirihPenroseRhombus.js +1 -1
  268. package/src/esm/utils/datastructures/GirihPenroseRhombus.js.map +1 -1
  269. package/src/esm/utils/datastructures/GirihPentagon.js.map +1 -1
  270. package/src/esm/utils/datastructures/GirihRhombus.js.map +1 -1
  271. package/src/esm/utils/datastructures/GirihTile.js.map +1 -1
  272. package/src/esm/utils/datastructures/Matrix4x4.js.map +1 -1
  273. package/src/esm/utils/datastructures/VoronoiCell.js.map +1 -1
  274. package/src/esm/utils/datastructures/interfaces.d.ts +3 -3
  275. package/src/esm/utils/detectDarkMode.js.map +1 -1
  276. package/src/esm/utils/findInVertexArray.js.map +1 -1
  277. package/src/esm/utils/gup.d.ts +8 -0
  278. package/src/esm/utils/gup.js +8 -0
  279. package/src/esm/utils/gup.js.map +1 -1
  280. package/src/esm/utils/helpers/BezierPathInteractionHelper.d.ts +6 -5
  281. package/src/esm/utils/helpers/BezierPathInteractionHelper.js +3 -2
  282. package/src/esm/utils/helpers/BezierPathInteractionHelper.js.map +1 -1
  283. package/src/esm/utils/helpers/CircleHelper.d.ts +38 -3
  284. package/src/esm/utils/helpers/CircleHelper.js +51 -11
  285. package/src/esm/utils/helpers/CircleHelper.js.map +1 -1
  286. package/src/esm/utils/helpers/CircleSectorHelper.d.ts +47 -1
  287. package/src/esm/utils/helpers/CircleSectorHelper.js +85 -14
  288. package/src/esm/utils/helpers/CircleSectorHelper.js.map +1 -1
  289. package/src/esm/utils/io/FileDrop.d.ts +3 -3
  290. package/src/esm/utils/io/FileDrop.js.map +1 -1
  291. package/src/esm/utils/parsers/OBJParser.d.ts +2 -2
  292. package/src/esm/utils/parsers/OBJParser.js.map +1 -1
  293. package/src/esm/utils/parsers/STLParser.d.ts +4 -3
  294. package/src/esm/utils/parsers/STLParser.js +63 -13
  295. package/src/esm/utils/parsers/STLParser.js.map +1 -1
  296. package/src/esm/utils/parsers/svg/parseSVGPathData.js.map +1 -1
  297. package/src/esm/utils/parsers/svg/splitSVGPathData.js.map +1 -1
  298. package/src/esm/utils/parsers/svg/types.d.ts +13 -13
  299. package/src/index-gl.js +77 -85
  300. package/src/index.js +124 -129
  301. package/src/ts/CircleSector.ts +134 -3
  302. package/src/ts/PlotBoilerplate.ts +20 -11
  303. package/src/ts/Polygon.ts +31 -1
  304. package/src/ts/Vertex.ts +8 -3
  305. package/src/ts/VertexAttr.ts +3 -2
  306. package/src/ts/drawutilssvg.ts +38 -25
  307. package/src/ts/geomutils.ts +60 -64
  308. package/src/ts/interfaces/DrawLib.ts +0 -15
  309. package/src/ts/utils/NGons.ts +35 -0
  310. package/src/ts/utils/Params.ts +47 -0
  311. package/src/ts/utils/algorithms/CircleIntersections.ts +280 -288
  312. package/src/ts/utils/algorithms/ContourLineDetection.ts +485 -0
  313. package/src/ts/utils/algorithms/Metaballs.ts +144 -0
  314. package/src/ts/utils/algorithms/arrayResize.ts +22 -0
  315. package/src/ts/utils/algorithms/clearDuplicateVertices.ts +49 -0
  316. package/src/ts/utils/datastructures/Color.ts +39 -15
  317. package/src/ts/utils/datastructures/DataGrid2d.ts +54 -0
  318. package/src/ts/utils/datastructures/DataGrid2dListAdapter.ts +121 -0
  319. package/src/ts/utils/datastructures/GenericPath.ts +21 -3
  320. package/src/ts/utils/datastructures/Girih.ts +9 -8
  321. package/src/ts/utils/gup.ts +10 -2
  322. package/src/ts/utils/helpers/BezierPathInteractionHelper.ts +9 -8
  323. package/src/ts/utils/helpers/CircleHelper.ts +70 -22
  324. package/src/ts/utils/helpers/CircleSectorHelper.ts +101 -17
  325. package/src/ts/utils/parsers/STLParser.ts +50 -16
package/src/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * The main script of the generic plotter.
3
3
  *
4
4
  * @requires PlotBoilerplate, MouseHandler, gup, dat.gui, draw
5
- *
5
+ *
6
6
  * @projectname Plotboilerplate.js
7
7
  * @author Ikaros Kappler
8
8
  * @date 2018-10-23
@@ -13,131 +13,126 @@
13
13
  * @version 1.0.4
14
14
  **/
15
15
 
16
-
17
- (function(_context) {
18
- "use strict";
19
-
20
- window.initializePB = function() {
21
- if( window.pbInitialized )
22
- return;
23
- window.pbInitialized = true;
24
- // Fetch the GET params
25
- let GUP = gup();
26
-
27
- // All config params are optional.
28
- var pb = new PlotBoilerplate(
29
- PlotBoilerplate.utils.safeMergeByKeys(
30
- { canvas : document.getElementById('my-canvas'),
31
- fullSize : true,
32
- fitToParent : true,
33
- scaleX : 1.0,
34
- scaleY : 1.0,
35
- rasterGrid : true,
36
- drawOrigin : true,
37
- rasterAdjustFactor : 2.0,
38
- redrawOnResize : true,
39
- defaultCanvasWidth : 1024,
40
- defaultCanvasHeight : 768,
41
- canvasWidthFactor : 1.0,
42
- canvasHeightFactor : 1.0,
43
- cssScaleX : 1.0,
44
- cssScaleY : 1.0,
45
- cssUniformScale : true,
46
- autoAdjustOffset : true,
47
- offsetAdjustXPercent : 50,
48
- offsetAdjustYPercent : 50,
49
- autoDetectRetina : false,
50
- backgroundColor : '#ffffff',
51
- enableMouse : true,
52
- enableTouch : true,
53
- enableKeys : true,
54
- enableGL : false // experimental
55
- }, GUP
56
- )
57
- );
58
-
59
- if( typeof humane != 'undefined' ) {
60
- pb.setConsole( { warn : function() {
61
- console.warn(arguments);
62
- humane.log(arguments[0]);
63
- },
64
- log : function() {
65
- console.log(arguments);
66
- // humane.log(arguments[0]);
67
- },
68
- error : function() {
69
- console.error(arguments);
70
- humane.log(arguments[0]);
71
- }
72
- } );
73
- humane.log('plotboilerplate');
74
- }
75
-
76
- // +---------------------------------------------------------------------------------
77
- // | Initialize dat.gui
78
- // +-------------------------------
79
- pb.createGUI();
80
-
81
-
82
- // +---------------------------------------------------------------------------------
83
- // | Add stats.
84
- // +-------------------------------
85
- var stats = {
86
- mouseX : 0,
87
- mouseY : 0
88
- };
89
- var uiStats = new UIStats( stats );
90
- stats = uiStats.proxy;
91
- uiStats.add( 'mouseX' );
92
- uiStats.add( 'mouseY' );
93
-
94
-
95
- // +---------------------------------------------------------------------------------
96
- // | Add a mouse listener to track the mouse position.
97
- // +-------------------------------
98
- new MouseHandler(pb.eventCatcher)
99
- .move( function(e) {
100
- var relPos = pb.transformMousePosition( e.params.pos.x, e.params.pos.y );
101
- stats.mouseX = relPos.x;
102
- stats.mouseY = relPos.y;
103
- } );
104
-
105
- // Use a helper function to build all demo-drawables.
106
- var drawables = createDemoDrawables( pb.canvasSize,
107
- 'example-image.png',
108
- function() { pb.redraw(); }
109
- );
110
- pb.add( drawables );
111
-
112
- // Retrieve desired drawables from the array.
113
- var polygon = drawables[9];
114
- var triangles = [ drawables[17], drawables[18], drawables[19], drawables[20] ];
115
-
116
- function animate(time) {
117
- polygon.rotate(0.01);
118
- pb.redraw();
119
- window.requestAnimationFrame( animate );
120
- }
121
- if( GUP.hasOwnProperty('animate') && PlotBoilerplate.utils.fetch.bool(GUP,'animate',true) ) {
122
- console.log('Staring animation');
123
- animate(0);
124
- }
125
-
126
- pb.config.postDraw = function() {
127
- for( var i in triangles ) {
128
- var circle = triangles[i].getIncircle();
129
- pb.fill.circle( circle.center, circle.radius, 'rgba(192,192,192,0.33)',1.0 );
130
- }
131
- };
132
-
133
- }; // End initializePB
134
-
135
- if( !window.pbPreventAutoLoad )
136
- window.addEventListener('load', window.initializePB );
137
-
138
-
139
- })(window);
140
-
141
-
142
-
143
-
16
+ (function (_context) {
17
+ "use strict";
18
+
19
+ window.initializePB = function () {
20
+ if (window.pbInitialized) {
21
+ return;
22
+ }
23
+ window.pbInitialized = true;
24
+ // Fetch the GET params
25
+ let GUP = gup();
26
+ var isInitialized = false;
27
+
28
+ // All config params are optional.
29
+ var pb = new PlotBoilerplate(
30
+ PlotBoilerplate.utils.safeMergeByKeys(
31
+ {
32
+ canvas: document.getElementById("my-canvas"),
33
+ fullSize: true,
34
+ fitToParent: true,
35
+ scaleX: 1.0,
36
+ scaleY: 1.0,
37
+ rasterGrid: true,
38
+ drawOrigin: true,
39
+ rasterAdjustFactor: 2.0,
40
+ redrawOnResize: true,
41
+ defaultCanvasWidth: 1024,
42
+ defaultCanvasHeight: 768,
43
+ canvasWidthFactor: 1.0,
44
+ canvasHeightFactor: 1.0,
45
+ cssScaleX: 1.0,
46
+ cssScaleY: 1.0,
47
+ cssUniformScale: true,
48
+ autoAdjustOffset: true,
49
+ offsetAdjustXPercent: 50,
50
+ offsetAdjustYPercent: 50,
51
+ autoDetectRetina: false,
52
+ backgroundColor: "#ffffff",
53
+ enableMouse: true,
54
+ enableTouch: true,
55
+ enableKeys: true,
56
+ enableGL: false // experimental
57
+ },
58
+ GUP
59
+ )
60
+ );
61
+
62
+ if (typeof humane != "undefined") {
63
+ pb.setConsole({
64
+ warn: function () {
65
+ console.warn(arguments);
66
+ humane.log(arguments[0]);
67
+ },
68
+ log: function () {
69
+ console.log(arguments);
70
+ // humane.log(arguments[0]);
71
+ },
72
+ error: function () {
73
+ console.error(arguments);
74
+ humane.log(arguments[0]);
75
+ }
76
+ });
77
+ humane.log("plotboilerplate");
78
+ }
79
+
80
+ // +---------------------------------------------------------------------------------
81
+ // | Initialize dat.gui
82
+ // +-------------------------------
83
+ pb.createGUI();
84
+
85
+ // +---------------------------------------------------------------------------------
86
+ // | Add stats.
87
+ // +-------------------------------
88
+ var stats = {
89
+ mouseX: 0,
90
+ mouseY: 0
91
+ };
92
+ var uiStats = new UIStats(stats);
93
+ stats = uiStats.proxy;
94
+ uiStats.add("mouseX");
95
+ uiStats.add("mouseY");
96
+
97
+ // +---------------------------------------------------------------------------------
98
+ // | Add a mouse listener to track the mouse position.
99
+ // +-------------------------------
100
+ new MouseHandler(pb.eventCatcher).move(function (e) {
101
+ var relPos = pb.transformMousePosition(e.params.pos.x, e.params.pos.y);
102
+ stats.mouseX = relPos.x;
103
+ stats.mouseY = relPos.y;
104
+ });
105
+
106
+ // Use a helper function to build all demo-drawables.
107
+ var drawables = createDemoDrawables(pb, "example-image.png", function () {
108
+ if (isInitialized) {
109
+ pb.redraw();
110
+ }
111
+ });
112
+ pb.add(drawables);
113
+
114
+ // Retrieve desired drawables from the array.
115
+ var polygon = drawables[9];
116
+ var triangles = [drawables[17], drawables[18], drawables[19], drawables[20]];
117
+
118
+ function animate(time) {
119
+ polygon.rotate(0.01);
120
+ pb.redraw();
121
+ window.requestAnimationFrame(animate);
122
+ }
123
+ if (GUP.hasOwnProperty("animate") && PlotBoilerplate.utils.fetch.bool(GUP, "animate", true)) {
124
+ console.log("Staring animation");
125
+ animate(0);
126
+ }
127
+
128
+ pb.config.postDraw = function () {
129
+ for (var i in triangles) {
130
+ var circle = triangles[i].getIncircle();
131
+ pb.fill.circle(circle.center, circle.radius, "rgba(192,192,192,0.33)", 1.0);
132
+ }
133
+ };
134
+ isInitialized = true;
135
+ }; // End initializePB
136
+
137
+ if (!window.pbPreventAutoLoad) window.addEventListener("load", window.initializePB);
138
+ })(window);
@@ -3,12 +3,19 @@
3
3
  * @date 2020-12-17
4
4
  * @modified 2021-01-20 Added UID.
5
5
  * @modified 2021-02-26 Fixed an error in the svg-arc-calculation (case angle<90deg and anti-clockwise).
6
- * @version 1.1.1
6
+ * @modified 2024-01-30 Added a missing type in the `describeSVGArc` function.
7
+ * @modified 2024-03-01 Added the `getStartPoint` and `getEndPoint` methods.
8
+ * @modified 2024-03-08 Added the `containsAngle` method.
9
+ * @modified 2024-03-09 Added the `circleSectorIntersection` method to find coherent sector intersections..
10
+ * @modified 2024-03-09 Added the `angleAt` method to determine any angle at some ratio.
11
+ * @version 1.2.0
7
12
  **/
8
13
 
9
14
  import { Circle } from "./Circle";
15
+ import { Line } from "./Line";
10
16
  import { UIDGenerator } from "./UIDGenerator";
11
- import { SVGPathParams, SVGSerializable, UID, XYCoords } from "./interfaces";
17
+ import { Vertex } from "./Vertex";
18
+ import { PathSegment, SVGPathParams, SVGSerializable, UID, XYCoords } from "./interfaces";
12
19
 
13
20
  /**
14
21
  * @classdesc A simple circle sector: circle, start- and end-angle.
@@ -80,10 +87,134 @@ export class CircleSector implements SVGSerializable {
80
87
  this.endAngle = endAngle;
81
88
  }
82
89
 
90
+ /**
91
+ * Checks wether the given angle (must be inside 0 and PI*2) is contained inside this sector.
92
+ *
93
+ * @param {number} angle - The numeric angle to check.
94
+ * @method containsAngle
95
+ * @instance
96
+ * @memberof CircleSector
97
+ * @return {boolean} True if (and only if) this sector contains the given angle.
98
+ */
99
+ containsAngle(angle: number) {
100
+ if (this.startAngle <= this.endAngle) {
101
+ return angle >= this.startAngle && angle < this.endAngle;
102
+ } else {
103
+ // startAngle > endAngle
104
+ return angle >= this.startAngle || angle < this.endAngle;
105
+ }
106
+ }
107
+
108
+ /**
109
+ * Get the angle inside this sector for a given ratio. 0.0 means startAngle, and 1.0 means endAngle.
110
+ *
111
+ * @param {number} t - The ratio inside [0..1].
112
+ * @method angleAt
113
+ * @instance
114
+ * @memberof CircleSector
115
+ * @return {number} The angle inside this sector at a given ratio.
116
+ */
117
+ angleAt(t: number): number {
118
+ if (this.startAngle <= this.endAngle) {
119
+ const angleAtRatio: number = this.startAngle + (this.endAngle - this.startAngle) * t;
120
+ return angleAtRatio % (Math.PI * 2.0);
121
+ } else {
122
+ // startAngle > endAngle
123
+ const angleAtRatio: number = this.startAngle + (Math.PI * 2 - this.startAngle + this.endAngle) * t;
124
+ return angleAtRatio % (Math.PI * 2.0);
125
+ }
126
+ }
127
+
128
+ /**
129
+ * Get the sectors starting point (on the underlying circle, located at the start angle).
130
+ *
131
+ * @method getStartPoint
132
+ * @instance
133
+ * @memberof CircleSector
134
+ * @return {Vertex} The sector's stating point.
135
+ */
136
+ getStartPoint(): Vertex {
137
+ return this.circle.vertAt(this.startAngle);
138
+ }
139
+
140
+ /**
141
+ * Get the sectors ending point (on the underlying circle, located at the end angle).
142
+ *
143
+ * @method getEndPoint
144
+ * @instance
145
+ * @memberof CircleSector
146
+ * @return {Vertex} The sector's ending point.
147
+ */
148
+ getEndPoint(): Vertex {
149
+ return this.circle.vertAt(this.endAngle);
150
+ }
151
+
152
+ /**
153
+ * Calculate the intersection of this circle sector and some other sector.
154
+ *
155
+ * If the two sectors do not corerently intersect (when not both points of the
156
+ * radical line are containted in both source sectors) then null is returned.
157
+ *
158
+ * See demo/53-circle-sector-intersections for a geometric visualisation.
159
+ *
160
+ * @method circleSectorIntersection
161
+ * @instance
162
+ * @memberof CircleSector
163
+ * @return {CircleSector | null} The intersecion of both sectors or null if they don't intersect.
164
+ */
165
+ circleSectorIntersection(sector: CircleSector): CircleSector | null {
166
+ const radicalLine: Line | null = this.circle.circleIntersection(sector.circle);
167
+ if (!radicalLine) {
168
+ // The circles to not intersect at all.
169
+ return null;
170
+ }
171
+ // Circles intersect. Check if this sector interval intersects, too.
172
+ const thisIntersectionAngleA = this.circle.center.angle(radicalLine.a);
173
+ const thisIntersectionAngleB = this.circle.center.angle(radicalLine.b);
174
+ // Is intersection inside this sector?
175
+ if (!this.containsAngle(thisIntersectionAngleA) || !this.containsAngle(thisIntersectionAngleB)) {
176
+ // At least one circle intersection point is not located in this sector.
177
+ // -> no valid intersection at all
178
+ return null;
179
+ }
180
+
181
+ // Circles intersect. Check if the passed sector interval intersects, too.
182
+ const thatIntersectionAngleA = sector.circle.center.angle(radicalLine.a);
183
+ const thatIntersectionAngleB = sector.circle.center.angle(radicalLine.b);
184
+ // Is intersection inside this sector?
185
+ if (!sector.containsAngle(thatIntersectionAngleA) || !sector.containsAngle(thatIntersectionAngleB)) {
186
+ // At least one circle intersection point is not located in this sector.
187
+ // -> no valid intersection at all
188
+ return null;
189
+ }
190
+
191
+ // The radical line has no direction. Thus the resulting sector _might_ be in reverse order.
192
+ // Make a quick logical check: the center of the gap must still be located inside the result sector.
193
+ // If not: reverse result.
194
+ var gapSector = new CircleSector(this.circle, this.endAngle, this.startAngle);
195
+ var centerOfOriginalGap = gapSector.angleAt(0.5);
196
+
197
+ const resultSector = new CircleSector(
198
+ new Circle(this.circle.center.clone(), this.circle.radius),
199
+ thisIntersectionAngleA,
200
+ thisIntersectionAngleB
201
+ );
202
+ if (resultSector.containsAngle(centerOfOriginalGap)) {
203
+ resultSector.startAngle = thisIntersectionAngleB;
204
+ resultSector.endAngle = thisIntersectionAngleA;
205
+ }
206
+ return resultSector;
207
+ }
208
+
83
209
  /**
84
210
  * This function should invalidate any installed listeners and invalidate this object.
85
211
  * After calling this function the object might not hold valid data any more and
86
212
  * should not be used.
213
+ *
214
+ * @method destroy
215
+ * @instance
216
+ * @memberof CircleSector
217
+ * @return {void}
87
218
  */
88
219
  destroy() {
89
220
  this.circle.destroy();
@@ -161,7 +292,7 @@ export class CircleSector implements SVGSerializable {
161
292
  sweepFlag = 1;
162
293
  }
163
294
 
164
- const pathData = [];
295
+ const pathData: SVGPathParams = [];
165
296
  if (options.moveToStart) {
166
297
  pathData.push("M", start.x, start.y);
167
298
  }
@@ -389,7 +389,7 @@ export class PlotBoilerplate {
389
389
  * Note that changes from the postDraw hook might not be visible in the export.
390
390
  * @param {string=} [config.title=null] - Specify any hover tile here. It will be attached as a `title` attribute to the most elevated element.
391
391
  */
392
- constructor(config: PBParams) {
392
+ constructor(config: PBParams, drawConfig: DrawConfig) {
393
393
  // This should be in some static block ...
394
394
  VertexAttr.model = {
395
395
  bezierAutoAdjust: false,
@@ -703,9 +703,10 @@ export class PlotBoilerplate {
703
703
  var blob = new Blob(['<?xml version="1.0" encoding="utf-8"?>\n' + svgCode], { type: "image/svg;charset=utf-8" });
704
704
  // See documentation for FileSaver.js for usage.
705
705
  // https://github.com/eligrey/FileSaver.js
706
- if (typeof globalThis["saveAs"] !== "function")
706
+ if (typeof globalThis["saveAs" as keyof Object] !== "function") {
707
707
  throw "Cannot save file; did you load the ./utils/savefile helper function and the eligrey/SaveFile library?";
708
- var _saveAs = globalThis["saveAs"];
708
+ }
709
+ var _saveAs : (blob:Blob, filename:string) => void = globalThis["saveAs" as keyof Object] as (blob:Blob, filename:string) => void;
709
710
  _saveAs(blob, "plotboilerplate.svg");
710
711
  }
711
712
 
@@ -2023,7 +2024,7 @@ export class PlotBoilerplate {
2023
2024
  };
2024
2025
 
2025
2026
  // Make PB work together with both, AlloyFinger as a esm module or a commonjs function.
2026
- if (typeof globalThis["AlloyFinger"] === "function" || typeof globalThis["createAlloyFinger"] === "function") {
2027
+ if (typeof globalThis["AlloyFinger" as keyof Object] === "function" || typeof globalThis["createAlloyFinger" as keyof Object] === "function") {
2027
2028
  try {
2028
2029
  var touchMovePos: Vertex | undefined | null = null;
2029
2030
  var touchDownPos: Vertex | undefined | null = null;
@@ -2159,8 +2160,10 @@ export class PlotBoilerplate {
2159
2160
  _self.redraw();
2160
2161
  }
2161
2162
  } as unknown as AlloyFingerOptions; // END afProps
2162
- if (window["createAlloyFinger"]) {
2163
- window["createAlloyFinger"](this.eventCatcher ? this.eventCatcher : this.canvas, afProps);
2163
+ if (window["createAlloyFinger" as keyof Object]) {
2164
+ // window["createAlloyFinger"](this.eventCatcher ? this.eventCatcher : this.canvas, afProps);
2165
+ const createAlloyFinger = window["createAlloyFinger" as keyof Object] as (elem:HTMLElement|SVGElement, afProps:AlloyFingerOptions ) => void;
2166
+ createAlloyFinger(this.eventCatcher ? this.eventCatcher : this.canvas, afProps);
2164
2167
  } else {
2165
2168
  /* tslint:disable-next-line */
2166
2169
  new AlloyFinger(this.eventCatcher ? this.eventCatcher : this.canvas, afProps);
@@ -2169,7 +2172,7 @@ export class PlotBoilerplate {
2169
2172
  console.error("Failed to initialize AlloyFinger!");
2170
2173
  console.error(e);
2171
2174
  }
2172
- } else if (globalThis["Touchy"] && typeof globalThis["Touchy"] == "function") {
2175
+ } else if (globalThis["Touchy" as keyof Object] && typeof globalThis["Touchy" as keyof Object] == "function") {
2173
2176
  console.error("[Deprecation] Found Touchy which is not supported any more. Please use AlloyFinger instead.");
2174
2177
  // Convert absolute touch positions to relative DOM element position (relative to canvas)
2175
2178
  } else {
@@ -2214,9 +2217,14 @@ export class PlotBoilerplate {
2214
2217
  createGUI(props?: DatGuiProps): GUI {
2215
2218
  // This function moved to the helper utils.
2216
2219
  // We do not want to include the whole dat.GUI package.
2217
- if (globalThis["utils"] && typeof globalThis["utils"].createGUI == "function")
2218
- return globalThis["utils"].createGUI(this, props);
2219
- else throw "Cannot create dat.GUI instance; did you load the ./utils/creategui helper function an the dat.GUI library?";
2220
+ const utils: {createGUI? : (pb:PlotBoilerplate,props:DatGuiProps|undefined)=>GUI } | undefined = globalThis["utils" as keyof Object] as any as {createGUI? : (pb:PlotBoilerplate,props:DatGuiProps|undefined)=>GUI } | undefined;
2221
+ // if (globalThis["utils"] && typeof globalThis["utils"].createGUI == "function") {
2222
+ // return (globalThis["utils" as keyof Object] as any as ({createGUI : (pb:PlotBoilerplate,props:DatGuiProps|undefined)=>GUI })).createGUI(this, props);
2223
+ if (utils && typeof utils.createGUI === "function") {
2224
+ return utils.createGUI(this, props);
2225
+ } else {
2226
+ throw "Cannot create dat.GUI instance; did you load the ./utils/creategui helper function an the dat.GUI library?";
2227
+ }
2220
2228
  }
2221
2229
 
2222
2230
  /**
@@ -2301,7 +2309,8 @@ export class PlotBoilerplate {
2301
2309
  * @return {void}
2302
2310
  **/
2303
2311
  setCSSscale: (element: HTMLElement | SVGElement, scaleX: number, scaleY: number): void => {
2304
- element.style["transform-origin"] = "0 0";
2312
+ // element.style["transform-origin"] = "0 0";
2313
+ element.style.transformOrigin = "0 0";
2305
2314
  if (scaleX == 1.0 && scaleY == 1.0) {
2306
2315
  // element.style.transform = null;
2307
2316
  element.style.removeProperty("transform");
package/src/ts/Polygon.ts CHANGED
@@ -27,7 +27,8 @@
27
27
  * @modified 2023-09-25 Added the `Polygon.getInterpolationPolygon(number)` function.
28
28
  * @modified 2023-09-25 Added the `Polygon.lineIntersections(Line,boolean)` function.
29
29
  * @modified 2023-09-29 Added the `Polygon.closestLineIntersection(Line,boolean)` function.
30
- * @version 1.11.0
30
+ * @modified 2023-11-24 Added the `Polygon.containsPolygon(Polygon)' function.
31
+ * @version 1.12.0
31
32
  *
32
33
  * @file Polygon
33
34
  * @public
@@ -184,6 +185,35 @@ export class Polygon implements SVGSerializable {
184
185
  return inside;
185
186
  }
186
187
 
188
+ /**
189
+ * Check if the passed polygon is completly contained inside this polygon.
190
+ *
191
+ * This means:
192
+ * - all polygon's vertices must be inside this polygon.
193
+ * - the polygon has no edge intersections with this polygon.
194
+ *
195
+ * @param {Polygon} polygon - The polygon to check if contained.
196
+ * @return {boolean}
197
+ */
198
+ containsPolygon(polygon: Polygon): boolean {
199
+ for (var i = 0; i < polygon.vertices.length; i++) {
200
+ if (!this.containsVert(polygon.vertices[i])) {
201
+ return false;
202
+ }
203
+ }
204
+ // All vertices are inside; check for intersections
205
+ const lineSegment = new Line(new Vertex(), new Vertex());
206
+ for (var i = 0; i < polygon.vertices.length; i++) {
207
+ lineSegment.a.set(polygon.vertices[i]);
208
+ lineSegment.b.set(polygon.vertices[(i + 1) % polygon.vertices.length]);
209
+ if (this.lineIntersections(lineSegment, true).length > 0) {
210
+ // Current segment has intersection(s) with this polygon.
211
+ return false;
212
+ }
213
+ }
214
+ return true;
215
+ }
216
+
187
217
  /**
188
218
  * Calculate the area of the given polygon (unsigned).
189
219
  *
package/src/ts/Vertex.ts CHANGED
@@ -31,7 +31,8 @@
31
31
  * @modified 2022-11-28 Added the `subXY`, `subX` and `subY` methods to the `Vertex` class.
32
32
  * @modified 2023-09-29 Downgraded types for the `Vertex.utils.buildArrowHead` function (replacing Vertex params by more generic XYCoords type).
33
33
  * @modified 2023-09-29 Added the `Vertex.abs()` method as it seems useful.
34
- * @version 2.8.0
34
+ * @modified 2024-03-08 Added the optional `precision` param to the `toString` method.
35
+ * @version 2.9.0
35
36
  *
36
37
  * @file Vertex
37
38
  * @public
@@ -631,8 +632,12 @@ export class Vertex implements XYCoords, SVGSerializable {
631
632
  * @instance
632
633
  * @memberof Vertex
633
634
  **/
634
- toString(): string {
635
- return "(" + this.x + "," + this.y + ")";
635
+ toString(precision?: number): string {
636
+ if (typeof precision === "undefined") {
637
+ return "(" + this.x + "," + this.y + ")";
638
+ } else {
639
+ return "(" + this.x.toFixed(precision) + "," + this.y.toFixed(precision) + ")";
640
+ }
636
641
  }
637
642
 
638
643
  /**
@@ -6,7 +6,8 @@
6
6
  * @modified 2019-03-20 Added JSDoc tags.
7
7
  * @modified 2020-02-29 Added the 'selectable' attribute.
8
8
  * @modified 2020-03-23 Ported to Typescript from JS.
9
- * @version 1.1.1
9
+ * @modified 2024-03-10 Fixed some types for Typescript 5 compatibility.
10
+ * @version 1.1.2
10
11
  *
11
12
  * @file VertexAttr
12
13
  * @public
@@ -76,7 +77,7 @@ export class VertexAttr implements IVertexAttr {
76
77
  this.visible = true;
77
78
 
78
79
  for( var key in VertexAttr.model )
79
- this[key] = VertexAttr.model[key];
80
+ this[key as keyof VertexAttr] = VertexAttr.model[key as keyof IVertexAttr] as any as boolean;
80
81
  };
81
82
 
82
83