plotboilerplate 1.14.0 → 1.17.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 (232) hide show
  1. package/README.md +2 -0
  2. package/changelog.md +57 -0
  3. package/dist/index.esm.js +856 -694
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.esm.min.js +1 -1
  6. package/dist/index.esm.min.js.map +1 -1
  7. package/dist/plotboilerplate.browser.min.js +1 -1
  8. package/dist/plotboilerplate.browser.min.js.map +1 -1
  9. package/dist/plotboilerplate.js +858 -598
  10. package/dist/plotboilerplate.min.js +1 -1
  11. package/package.json +1 -1
  12. package/src/cjs/BezierPath.d.ts +32 -14
  13. package/src/cjs/BezierPath.js +65 -24
  14. package/src/cjs/BezierPath.js.map +1 -1
  15. package/src/cjs/Bounds.d.ts +22 -1
  16. package/src/cjs/Bounds.js +24 -1
  17. package/src/cjs/Bounds.js.map +1 -1
  18. package/src/cjs/Circle.d.ts +15 -13
  19. package/src/cjs/Circle.js +16 -34
  20. package/src/cjs/Circle.js.map +1 -1
  21. package/src/cjs/CircleSector.d.ts +17 -16
  22. package/src/cjs/CircleSector.js +12 -24
  23. package/src/cjs/CircleSector.js.map +1 -1
  24. package/src/cjs/CubicBezierCurve.d.ts +16 -15
  25. package/src/cjs/CubicBezierCurve.js +57 -94
  26. package/src/cjs/CubicBezierCurve.js.map +1 -1
  27. package/src/cjs/KeyHandler.d.ts +10 -3
  28. package/src/cjs/KeyHandler.js +28 -23
  29. package/src/cjs/KeyHandler.js.map +1 -1
  30. package/src/cjs/Line.d.ts +2 -15
  31. package/src/cjs/Line.js +6 -31
  32. package/src/cjs/Line.js.map +1 -1
  33. package/src/cjs/MouseHandler.js +43 -53
  34. package/src/cjs/MouseHandler.js.map +1 -1
  35. package/src/cjs/PBImage.d.ts +15 -13
  36. package/src/cjs/PBImage.js +11 -15
  37. package/src/cjs/PBImage.js.map +1 -1
  38. package/src/cjs/PBText.d.ts +13 -12
  39. package/src/cjs/PBText.js +8 -12
  40. package/src/cjs/PBText.js.map +1 -1
  41. package/src/cjs/PlotBoilerplate.js +3 -2
  42. package/src/cjs/PlotBoilerplate.js.map +1 -1
  43. package/src/cjs/Polygon.d.ts +44 -14
  44. package/src/cjs/Polygon.js +116 -66
  45. package/src/cjs/Polygon.js.map +1 -1
  46. package/src/cjs/Triangle.d.ts +15 -13
  47. package/src/cjs/Triangle.js +23 -64
  48. package/src/cjs/Triangle.js.map +1 -1
  49. package/src/cjs/VEllipse.d.ts +14 -9
  50. package/src/cjs/VEllipse.js +10 -18
  51. package/src/cjs/VEllipse.js.map +1 -1
  52. package/src/cjs/VEllipseSector.d.ts +15 -1
  53. package/src/cjs/VEllipseSector.js +11 -1
  54. package/src/cjs/VEllipseSector.js.map +1 -1
  55. package/src/cjs/Vector.d.ts +3 -15
  56. package/src/cjs/Vector.js +9 -49
  57. package/src/cjs/Vector.js.map +1 -1
  58. package/src/cjs/VertTuple.d.ts +15 -1
  59. package/src/cjs/VertTuple.js +14 -19
  60. package/src/cjs/VertTuple.js.map +1 -1
  61. package/src/cjs/Vertex.d.ts +47 -13
  62. package/src/cjs/Vertex.js +62 -22
  63. package/src/cjs/Vertex.js.map +1 -1
  64. package/src/cjs/VertexListeners.d.ts +12 -8
  65. package/src/cjs/VertexListeners.js +18 -25
  66. package/src/cjs/VertexListeners.js.map +1 -1
  67. package/src/cjs/draw.d.ts +41 -2
  68. package/src/cjs/draw.js +140 -3
  69. package/src/cjs/draw.js.map +1 -1
  70. package/src/cjs/drawgl.d.ts +38 -2
  71. package/src/cjs/drawgl.js +41 -2
  72. package/src/cjs/drawgl.js.map +1 -1
  73. package/src/cjs/drawutilssvg.d.ts +66 -3
  74. package/src/cjs/drawutilssvg.js +140 -15
  75. package/src/cjs/drawutilssvg.js.map +1 -1
  76. package/src/cjs/index.d.ts +0 -1
  77. package/src/cjs/index.js +0 -1
  78. package/src/cjs/index.js.map +1 -1
  79. package/src/cjs/interfaces/DrawLib.d.ts +61 -26
  80. package/src/cjs/interfaces/DrawLib.js +2 -0
  81. package/src/cjs/interfaces/DrawLib.js.map +1 -1
  82. package/src/cjs/interfaces/core.d.ts +0 -12
  83. package/src/cjs/module.d.ts +1 -3
  84. package/src/cjs/module.js +2 -5
  85. package/src/cjs/module.js.map +1 -1
  86. package/src/cjs/utils/creategui.js +16 -2
  87. package/src/cjs/utils/datastructures/Girih.d.ts +5 -0
  88. package/src/cjs/utils/datastructures/Girih.js +18 -14
  89. package/src/cjs/utils/datastructures/Girih.js.map +1 -1
  90. package/src/cjs/utils/datastructures/GirihPenroseRhombus.js +42 -25
  91. package/src/cjs/utils/datastructures/GirihPenroseRhombus.js.map +1 -1
  92. package/src/cjs/utils/datastructures/GirihTile.js +2 -13
  93. package/src/cjs/utils/datastructures/GirihTile.js.map +1 -1
  94. package/src/cjs/utils/findInVertexArray.d.ts +19 -0
  95. package/src/cjs/utils/findInVertexArray.js +29 -0
  96. package/src/cjs/utils/findInVertexArray.js.map +1 -0
  97. package/src/cjs/utils/helpers/BezierPathInteractionHelper.d.ts +17 -1
  98. package/src/cjs/utils/helpers/BezierPathInteractionHelper.js +50 -32
  99. package/src/cjs/utils/helpers/BezierPathInteractionHelper.js.map +1 -1
  100. package/src/cjs/utils/io/DndFileHandler.d.ts +63 -0
  101. package/src/cjs/utils/io/DndFileHandler.js +112 -0
  102. package/src/cjs/utils/io/DndFileHandler.js.map +1 -0
  103. package/src/cjs/utils/io/FileDrop.d.ts +98 -0
  104. package/src/cjs/utils/io/FileDrop.js +142 -0
  105. package/src/cjs/utils/io/FileDrop.js.map +1 -0
  106. package/src/esm/BezierPath.d.ts +32 -14
  107. package/src/esm/BezierPath.js +65 -24
  108. package/src/esm/BezierPath.js.map +1 -1
  109. package/src/esm/Bounds.d.ts +22 -1
  110. package/src/esm/Bounds.js +24 -1
  111. package/src/esm/Bounds.js.map +1 -1
  112. package/src/esm/Circle.d.ts +15 -13
  113. package/src/esm/Circle.js +16 -34
  114. package/src/esm/Circle.js.map +1 -1
  115. package/src/esm/CircleSector.d.ts +17 -16
  116. package/src/esm/CircleSector.js +12 -24
  117. package/src/esm/CircleSector.js.map +1 -1
  118. package/src/esm/CubicBezierCurve.d.ts +16 -15
  119. package/src/esm/CubicBezierCurve.js +57 -94
  120. package/src/esm/CubicBezierCurve.js.map +1 -1
  121. package/src/esm/KeyHandler.d.ts +10 -3
  122. package/src/esm/KeyHandler.js +28 -23
  123. package/src/esm/KeyHandler.js.map +1 -1
  124. package/src/esm/Line.d.ts +2 -15
  125. package/src/esm/Line.js +6 -31
  126. package/src/esm/Line.js.map +1 -1
  127. package/src/esm/MouseHandler.js +43 -53
  128. package/src/esm/MouseHandler.js.map +1 -1
  129. package/src/esm/PBImage.d.ts +15 -13
  130. package/src/esm/PBImage.js +11 -15
  131. package/src/esm/PBImage.js.map +1 -1
  132. package/src/esm/PBText.d.ts +13 -12
  133. package/src/esm/PBText.js +8 -12
  134. package/src/esm/PBText.js.map +1 -1
  135. package/src/esm/PlotBoilerplate.js +3 -2
  136. package/src/esm/PlotBoilerplate.js.map +1 -1
  137. package/src/esm/Polygon.d.ts +44 -14
  138. package/src/esm/Polygon.js +116 -66
  139. package/src/esm/Polygon.js.map +1 -1
  140. package/src/esm/Triangle.d.ts +15 -13
  141. package/src/esm/Triangle.js +23 -64
  142. package/src/esm/Triangle.js.map +1 -1
  143. package/src/esm/VEllipse.d.ts +14 -9
  144. package/src/esm/VEllipse.js +10 -18
  145. package/src/esm/VEllipse.js.map +1 -1
  146. package/src/esm/VEllipseSector.d.ts +15 -1
  147. package/src/esm/VEllipseSector.js +11 -1
  148. package/src/esm/VEllipseSector.js.map +1 -1
  149. package/src/esm/Vector.d.ts +3 -15
  150. package/src/esm/Vector.js +9 -49
  151. package/src/esm/Vector.js.map +1 -1
  152. package/src/esm/VertTuple.d.ts +15 -1
  153. package/src/esm/VertTuple.js +14 -19
  154. package/src/esm/VertTuple.js.map +1 -1
  155. package/src/esm/Vertex.d.ts +47 -13
  156. package/src/esm/Vertex.js +62 -22
  157. package/src/esm/Vertex.js.map +1 -1
  158. package/src/esm/VertexListeners.d.ts +12 -8
  159. package/src/esm/VertexListeners.js +18 -25
  160. package/src/esm/VertexListeners.js.map +1 -1
  161. package/src/esm/draw.d.ts +41 -2
  162. package/src/esm/draw.js +139 -3
  163. package/src/esm/draw.js.map +1 -1
  164. package/src/esm/drawgl.d.ts +38 -2
  165. package/src/esm/drawgl.js +41 -2
  166. package/src/esm/drawgl.js.map +1 -1
  167. package/src/esm/drawutilssvg.d.ts +66 -3
  168. package/src/esm/drawutilssvg.js +140 -15
  169. package/src/esm/drawutilssvg.js.map +1 -1
  170. package/src/esm/index.d.ts +0 -1
  171. package/src/esm/index.js +0 -1
  172. package/src/esm/index.js.map +1 -1
  173. package/src/esm/interfaces/DrawLib.d.ts +61 -26
  174. package/src/esm/interfaces/DrawLib.js +2 -0
  175. package/src/esm/interfaces/DrawLib.js.map +1 -1
  176. package/src/esm/interfaces/core.d.ts +0 -12
  177. package/src/esm/module.d.ts +1 -3
  178. package/src/esm/module.js +5 -4
  179. package/src/esm/module.js.map +1 -1
  180. package/src/esm/utils/datastructures/Girih.d.ts +5 -0
  181. package/src/esm/utils/datastructures/Girih.js +18 -14
  182. package/src/esm/utils/datastructures/Girih.js.map +1 -1
  183. package/src/esm/utils/datastructures/GirihPenroseRhombus.js +42 -25
  184. package/src/esm/utils/datastructures/GirihPenroseRhombus.js.map +1 -1
  185. package/src/esm/utils/datastructures/GirihTile.js +2 -13
  186. package/src/esm/utils/datastructures/GirihTile.js.map +1 -1
  187. package/src/esm/utils/findInVertexArray.d.ts +19 -0
  188. package/src/esm/utils/findInVertexArray.js +25 -0
  189. package/src/esm/utils/findInVertexArray.js.map +1 -0
  190. package/src/esm/utils/helpers/BezierPathInteractionHelper.d.ts +17 -1
  191. package/src/esm/utils/helpers/BezierPathInteractionHelper.js +49 -32
  192. package/src/esm/utils/helpers/BezierPathInteractionHelper.js.map +1 -1
  193. package/src/esm/utils/io/DndFileHandler.d.ts +63 -0
  194. package/src/esm/utils/io/DndFileHandler.js +106 -0
  195. package/src/esm/utils/io/DndFileHandler.js.map +1 -0
  196. package/src/esm/utils/io/FileDrop.d.ts +98 -0
  197. package/src/esm/utils/io/FileDrop.js +136 -0
  198. package/src/esm/utils/io/FileDrop.js.map +1 -0
  199. package/src/ts/BezierPath.ts +78 -22
  200. package/src/ts/Bounds.ts +25 -1
  201. package/src/ts/Circle.ts +187 -200
  202. package/src/ts/CircleSector.ts +141 -141
  203. package/src/ts/CubicBezierCurve.ts +738 -810
  204. package/src/ts/KeyHandler.ts +221 -212
  205. package/src/ts/Line.ts +48 -80
  206. package/src/ts/MouseHandler.ts +356 -368
  207. package/src/ts/PBImage.ts +67 -69
  208. package/src/ts/PBText.ts +16 -14
  209. package/src/ts/PlotBoilerplate.ts +4 -2
  210. package/src/ts/Polygon.ts +493 -451
  211. package/src/ts/Triangle.ts +444 -489
  212. package/src/ts/VEllipse.ts +18 -17
  213. package/src/ts/VEllipseSector.ts +20 -1
  214. package/src/ts/Vector.ts +124 -160
  215. package/src/ts/VertTuple.ts +333 -338
  216. package/src/ts/Vertex.ts +75 -21
  217. package/src/ts/VertexListeners.ts +248 -266
  218. package/src/ts/draw.ts +192 -3
  219. package/src/ts/drawgl.ts +44 -2
  220. package/src/ts/drawutilssvg.ts +181 -15
  221. package/src/ts/index.ts +0 -1
  222. package/src/ts/interfaces/DrawLib.ts +69 -26
  223. package/src/ts/interfaces/core.ts +0 -11
  224. package/src/ts/module.ts +2 -4
  225. package/src/ts/utils/datastructures/Girih.ts +204 -209
  226. package/src/ts/utils/datastructures/GirihPenroseRhombus.ts +170 -152
  227. package/src/ts/utils/datastructures/GirihTile.ts +394 -419
  228. package/src/ts/utils/findInVertexArray.ts +28 -0
  229. package/src/ts/utils/helpers/BezierPathInteractionHelper.ts +56 -34
  230. package/src/ts/utils/io/FileDrop.ts +178 -0
  231. package/src/ts/SVGBuilder.ts +0 -109
  232. package/src/ts/utils/algorithms/sh-tmp.ts~ +0 -59
@@ -15,7 +15,10 @@
15
15
  * @modified 2021-11-12 Added `text()` params fontSize, fontFamily, rotation, textAlign.
16
16
  * @modified 2021-11-16 Added `text()` params fontWeight and fontStyle.
17
17
  * @modified 2021-11-19 Added the `color` param to the `label(...)` function.
18
+ * @modified 2022-02-03 Added the `lineWidth` param to the `crosshair` function.
19
+ * @modified 2022-02-03 Added the `cross(...)` function.
18
20
  **/
21
+ import { Bounds } from "../Bounds";
19
22
  import { Polygon } from "../Polygon";
20
23
  import { Vertex } from "../Vertex";
21
24
  import { SVGPathParams, UID, XYCoords } from "./core";
@@ -104,7 +107,7 @@ export interface DrawLib<R> {
104
107
  * @param {number=1} lineWidth? - [optional] The line's width.
105
108
  * @return {void}
106
109
  * @instance
107
- * @memberof drawutils
110
+ * @memberof DrawLib
108
111
  **/
109
112
  line: (zA: Vertex, zB: Vertex, color: string, lineWidth?: number) => R;
110
113
  /**
@@ -117,7 +120,7 @@ export interface DrawLib<R> {
117
120
  * @param {number=} lineWidth - (optional) The line width to use; default is 1.
118
121
  * @return {void}
119
122
  * @instance
120
- * @memberof drawutils
123
+ * @memberof DrawLib
121
124
  **/
122
125
  arrow: (zA: Vertex, zB: Vertex, color: string, lineWidth?: number) => R;
123
126
  /**
@@ -131,9 +134,25 @@ export interface DrawLib<R> {
131
134
  * @param {Vertex} size - The x/y-size to draw the image with.
132
135
  * @return {void}
133
136
  * @instance
134
- * @memberof drawutils
137
+ * @memberof DrawLib
135
138
  **/
136
139
  image: (image: HTMLImageElement, position: Vertex, size: Vertex) => R;
140
+ /**
141
+ * Draw an image at the given position with the given size.<br>
142
+ * <br>
143
+ * Note: SVG images may have resizing issues at the moment.Draw a line and an arrow at the end (zB) of the given line with the specified (CSS-) color.
144
+ *
145
+ * @method texturedPoly
146
+ * @param {Image} textureImage - The image object to draw.
147
+ * @param {Bounds} textureSize - The texture size to use; these are the original bounds to map the polygon vertices to.
148
+ * @param {Polygon} polygon - The polygon to use as clip path.
149
+ * @param {Vertex} polygonPosition - The polygon's position (relative), measured at the bounding box's center.
150
+ * @param {number} rotation - The rotation to use for the polygon (and for the texture).
151
+ * @return {void}
152
+ * @instance
153
+ * @memberof DrawLib
154
+ **/
155
+ texturedPoly: (textureImage: HTMLImageElement, textureSize: Bounds, polygon: Polygon, polygonPosition: Vertex, rotation: number) => R;
137
156
  /**
138
157
  * Draw the given (cubic) bézier curve.
139
158
  *
@@ -146,7 +165,7 @@ export interface DrawLib<R> {
146
165
  * @param {number} lineWidth - (optional) The line width to use.
147
166
  * @return {void}
148
167
  * @instance
149
- * @memberof drawutils
168
+ * @memberof DrawLib
150
169
  */
151
170
  cubicBezier: (startPoint: Vertex, endPoint: Vertex, startControlPoint: Vertex, endControlPoint: Vertex, color: string, lineWidth?: number) => R;
152
171
  /**
@@ -162,7 +181,7 @@ export interface DrawLib<R> {
162
181
  * @param {number=1} lineWidth - (optional) The line width to use.
163
182
  * @return {void}
164
183
  * @instance
165
- * @memberof drawutils
184
+ * @memberof DrawLib
166
185
  */
167
186
  cubicBezierPath: (path: Array<Vertex>, color: string, lineWidth?: number) => R;
168
187
  /**
@@ -175,7 +194,7 @@ export interface DrawLib<R> {
175
194
  * @param {Vertex} endPoint - The end point of the handle.
176
195
  * @return {void}
177
196
  * @instance
178
- * @memberof drawutils
197
+ * @memberof DrawLib
179
198
  */
180
199
  handle: (startPoint: Vertex, endPoint: Vertex) => R;
181
200
  /**
@@ -186,7 +205,7 @@ export interface DrawLib<R> {
186
205
  * @param {Vertex} endPoint - The end point to draw the handle at.
187
206
  * @return {void}
188
207
  * @instance
189
- * @memberof drawutils
208
+ * @memberof DrawLib
190
209
  */
191
210
  handleLine: (startPoint: Vertex, endPoint: Vertex) => R;
192
211
  /**
@@ -197,7 +216,7 @@ export interface DrawLib<R> {
197
216
  * @param {string} color - The CSS color to draw the dot with.
198
217
  * @return {void}
199
218
  * @instance
200
- * @memberof drawutils
219
+ * @memberof DrawLib
201
220
  */
202
221
  dot: (p: Vertex, color: string) => R;
203
222
  /**
@@ -208,7 +227,7 @@ export interface DrawLib<R> {
208
227
  * @param {string} color - The CSS color to draw the point with.
209
228
  * @return {void}
210
229
  * @instance
211
- * @memberof drawutils
230
+ * @memberof DrawLib
212
231
  */
213
232
  point: (p: Vertex, color: string) => R;
214
233
  /**
@@ -223,7 +242,7 @@ export interface DrawLib<R> {
223
242
  * @param {number=} lineWidth - (optional) The line width to use; default is 1.
224
243
  * @return {void}
225
244
  * @instance
226
- * @memberof drawutils
245
+ * @memberof DrawLib
227
246
  */
228
247
  circle: (center: Vertex, radius: number, color: string, lineWidth?: number) => R;
229
248
  /**
@@ -238,7 +257,7 @@ export interface DrawLib<R> {
238
257
  * @param {number=} lineWidth - (optional) The line width to use; default is 1.
239
258
  * @return {void}
240
259
  * @instance
241
- * @memberof drawutils
260
+ * @memberof DrawLib
242
261
  */
243
262
  circleArc: (center: Vertex, radius: number, startAngle: number, endAngle: number, color: string, lineWidth?: number) => R;
244
263
  /**
@@ -253,7 +272,7 @@ export interface DrawLib<R> {
253
272
  * @param {number=} rotation - (optional, default=0) The rotation of the ellipse.
254
273
  * @return {void}
255
274
  * @instance
256
- * @memberof drawutils
275
+ * @memberof DrawLib
257
276
  */
258
277
  ellipse: (center: Vertex, radiusX: number, radiusY: number, color: string, lineWidth?: number, rotation?: number) => R;
259
278
  /**
@@ -268,7 +287,7 @@ export interface DrawLib<R> {
268
287
  * @param {number=} lineWidth - (optional) The line width to use; default is 1.
269
288
  * @return {void}
270
289
  * @instance
271
- * @memberof drawutils
290
+ * @memberof DrawLib
272
291
  */
273
292
  square: (center: XYCoords, size: number, color: string, lineWidth?: number) => R;
274
293
  /**
@@ -282,7 +301,7 @@ export interface DrawLib<R> {
282
301
  * @param {number=} lineWidth - (optional) The line width to use; default is 1.
283
302
  * @return {void}
284
303
  * @instance
285
- * @memberof drawutils
304
+ * @memberof DrawLib
286
305
  */
287
306
  rect: (upperLeft: XYCoords, width: number, height: number, color: string, lineWidth?: number) => R;
288
307
  /**
@@ -297,7 +316,7 @@ export interface DrawLib<R> {
297
316
  * @param {string} color - The CSS color to draw the grid with.
298
317
  * @return {void}
299
318
  * @instance
300
- * @memberof drawutils
319
+ * @memberof DrawLib
301
320
  */
302
321
  grid: (center: Vertex, width: number, height: number, sizeX: number, sizeY: number, color: string) => R;
303
322
  /**
@@ -314,7 +333,7 @@ export interface DrawLib<R> {
314
333
  * @param {string} color - The CSS color to draw the raster with.
315
334
  * @return {void}
316
335
  * @instance
317
- * @memberof drawutils
336
+ * @memberof DrawLib
318
337
  */
319
338
  raster: (center: Vertex, width: number, height: number, sizeX: number, sizeY: number, color: string) => R;
320
339
  /**
@@ -330,7 +349,7 @@ export interface DrawLib<R> {
330
349
  * @param {string} color - The CSS color to draw the diamond with.
331
350
  * @return {void}
332
351
  * @instance
333
- * @memberof drawutils
352
+ * @memberof DrawLib
334
353
  */
335
354
  diamondHandle: (center: Vertex, size: number, color: string) => R;
336
355
  /**
@@ -346,7 +365,7 @@ export interface DrawLib<R> {
346
365
  * @param {string} color - The CSS color to draw the square with.
347
366
  * @return {void}
348
367
  * @instance
349
- * @memberof drawutils
368
+ * @memberof DrawLib
350
369
  */
351
370
  squareHandle: (center: Vertex, size: number, color: string) => R;
352
371
  /**
@@ -362,7 +381,7 @@ export interface DrawLib<R> {
362
381
  * @param {string} color - The CSS color to draw the circle with.
363
382
  * @return {void}
364
383
  * @instance
365
- * @memberof drawutils
384
+ * @memberof DrawLib
366
385
  */
367
386
  circleHandle: (center: Vertex, size: number, color: string) => R;
368
387
  /**
@@ -374,11 +393,27 @@ export interface DrawLib<R> {
374
393
  * @param {XYCoords} center - The center of the crosshair.
375
394
  * @param {number} radius - The radius of the crosshair.
376
395
  * @param {string} color - The CSS color to draw the crosshair with.
396
+ * @param {number=0.5} lineWidth - (optional, default=0.5) The line width to use.
397
+ * @return {void}
398
+ * @instance
399
+ * @memberof DrawLib
400
+ */
401
+ crosshair: (center: XYCoords, radius: number, color: string, lineWidth?: number) => R;
402
+ /**
403
+ * Draw a cross with diagonal axes with given radius, color and lineWidth at the given position.<br>
404
+ * <br>
405
+ * Note that the x's radius will not be affected by scaling.
406
+ *
407
+ * @method crosshair
408
+ * @param {XYCoords} center - The center of the crosshair.
409
+ * @param {number} radius - The radius of the crosshair.
410
+ * @param {string} color - The CSS color to draw the crosshair with.
411
+ * @param {number=1} lineWidth - (optional, default=1.0) The line width to use.
377
412
  * @return {void}
378
413
  * @instance
379
- * @memberof drawutils
414
+ * @memberof DrawLib
380
415
  */
381
- crosshair: (center: XYCoords, radius: number, color: string) => R;
416
+ cross: (center: XYCoords, radius: number, color: string, lineWidth?: number) => R;
382
417
  /**
383
418
  * Draw a polygon.
384
419
  *
@@ -387,7 +422,7 @@ export interface DrawLib<R> {
387
422
  * @param {string} color - The CSS color to draw the polygon with.
388
423
  * @return {void}
389
424
  * @instance
390
- * @memberof drawutils
425
+ * @memberof DrawLib
391
426
  */
392
427
  polygon: (polygon: Polygon, color: string, lineWidth?: number) => R;
393
428
  /**
@@ -400,7 +435,7 @@ export interface DrawLib<R> {
400
435
  * @param {number=} lineWidth - (optional) The line width to use; default is 1.
401
436
  * @return {void}
402
437
  * @instance
403
- * @memberof drawutils
438
+ * @memberof DrawLib
404
439
  */
405
440
  polyline: (vertices: Array<Vertex>, isOpen: boolean, color: string, lineWidth?: number) => R;
406
441
  /**
@@ -420,7 +455,7 @@ export interface DrawLib<R> {
420
455
  * @param {string=} options.textAlign - The text align to use. According to the specifiactions (https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/textAlign) valid values are `"left" || "right" || "center" || "start" || "end"`.
421
456
  * @return {void}
422
457
  * @instance
423
- * @memberof drawutils
458
+ * @memberof DrawLib
424
459
  */
425
460
  text: (text: string, x: number, y: number, options?: FontOptions) => R;
426
461
  /**
@@ -434,7 +469,7 @@ export interface DrawLib<R> {
434
469
  * @param {string="black"} color - The color to use (default is black).
435
470
  * @return {void}
436
471
  * @instance
437
- * @memberof drawutils
472
+ * @memberof DrawLib
438
473
  */
439
474
  label: (text: string, x: number, y: number, rotation?: number, color?: string) => R;
440
475
  /**
@@ -446,7 +481,7 @@ export interface DrawLib<R> {
446
481
  * @param {number=1} lineWidth - (optional) the line width to use (default is 1).
447
482
  * @param {boolean=false} options.inplace - (optional) If set to true then path transforamtions (scale and translate) will be done in-place in the array. This can boost the performance.
448
483
  * @instance
449
- * @memberof drawutils
484
+ * @memberof DrawLib
450
485
  * @return {R} An instance representing the drawn path.
451
486
  */
452
487
  path: (pathData: SVGPathParams, color?: string, lineWidth?: number, options?: {
@@ -15,6 +15,8 @@
15
15
  * @modified 2021-11-12 Added `text()` params fontSize, fontFamily, rotation, textAlign.
16
16
  * @modified 2021-11-16 Added `text()` params fontWeight and fontStyle.
17
17
  * @modified 2021-11-19 Added the `color` param to the `label(...)` function.
18
+ * @modified 2022-02-03 Added the `lineWidth` param to the `crosshair` function.
19
+ * @modified 2022-02-03 Added the `cross(...)` function.
18
20
  **/
19
21
  export {};
20
22
  //# sourceMappingURL=DrawLib.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DrawLib.js","sourceRoot":"","sources":["../../ts/interfaces/DrawLib.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;IAiBI"}
1
+ {"version":3,"file":"DrawLib.js","sourceRoot":"","sources":["../../ts/interfaces/DrawLib.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;IAmBI"}
@@ -169,18 +169,6 @@ export interface SVGSerializable {
169
169
  * Required to generate proper CSS classes and other class related IDs.
170
170
  **/
171
171
  readonly className: string;
172
- /**
173
- * Convert this vertex to SVG code.
174
- *
175
- * @method toSVGString
176
- * @param {object=} options - An optional set of options, like 'className'.
177
- * @return {string} A string representing the SVG code for this vertex.
178
- * @instance
179
- * @memberof Vertex
180
- **/
181
- toSVGString: (options: {
182
- className?: string;
183
- }) => string;
184
172
  }
185
173
  /**
186
174
  * A type for SVG &lt;path d="..." /> params.
@@ -4,7 +4,6 @@ import { Circle } from "./Circle";
4
4
  import { CircleSector } from "./CircleSector";
5
5
  import { CubicBezierCurve } from "./CubicBezierCurve";
6
6
  import { drawutils } from "./draw";
7
- import { drawutilsgl } from "./drawgl";
8
7
  import { geomutils } from "./geomutils";
9
8
  import { Grid } from "./Grid";
10
9
  import { KeyHandler } from "./KeyHandler";
@@ -13,7 +12,6 @@ import { MouseHandler } from "./MouseHandler";
13
12
  import { PBImage } from "./PBImage";
14
13
  import { PlotBoilerplate } from "./PlotBoilerplate";
15
14
  import { Polygon } from "./Polygon";
16
- import { SVGBuilder } from "./SVGBuilder";
17
15
  import { Triangle } from "./Triangle";
18
16
  import { UIDGenerator } from "./UIDGenerator";
19
17
  import { Vector } from "./Vector";
@@ -24,5 +22,5 @@ import { VertexAttr } from "./VertexAttr";
24
22
  import { VertexListeners } from "./VertexListeners";
25
23
  import { VertTuple } from "./VertTuple";
26
24
  import { drawutilssvg } from "./drawutilssvg";
27
- export { BezierPath, Bounds, Circle, CircleSector, CubicBezierCurve, drawutils, drawutilsgl, geomutils, Grid, KeyHandler, Line, MouseHandler, PBImage, PlotBoilerplate, Polygon, SVGBuilder, Triangle, UIDGenerator, Vector, VEllipse, VEllipseSector, Vertex, VertexAttr, VertexListeners, VertTuple, drawutilssvg };
25
+ export { BezierPath, Bounds, Circle, CircleSector, CubicBezierCurve, drawutils, geomutils, Grid, KeyHandler, Line, MouseHandler, PBImage, PlotBoilerplate, Polygon, Triangle, UIDGenerator, Vector, VEllipse, VEllipseSector, Vertex, VertexAttr, VertexListeners, VertTuple, drawutilssvg };
28
26
  export default PlotBoilerplate;
package/src/esm/module.js CHANGED
@@ -10,7 +10,7 @@ import { Circle } from "./Circle";
10
10
  import { CircleSector } from "./CircleSector";
11
11
  import { CubicBezierCurve } from "./CubicBezierCurve";
12
12
  import { drawutils } from "./draw";
13
- import { drawutilsgl } from "./drawgl";
13
+ // import { drawutilsgl } from "./drawgl";
14
14
  import { geomutils } from "./geomutils";
15
15
  import { Grid } from "./Grid";
16
16
  import { KeyHandler } from "./KeyHandler";
@@ -19,7 +19,6 @@ import { MouseHandler } from "./MouseHandler";
19
19
  import { PBImage } from "./PBImage";
20
20
  import { PlotBoilerplate } from "./PlotBoilerplate";
21
21
  import { Polygon } from "./Polygon";
22
- import { SVGBuilder } from "./SVGBuilder";
23
22
  import { Triangle } from "./Triangle";
24
23
  import { UIDGenerator } from "./UIDGenerator";
25
24
  import { Vector } from "./Vector";
@@ -30,8 +29,10 @@ import { VertexAttr } from "./VertexAttr";
30
29
  import { VertexListeners } from "./VertexListeners";
31
30
  import { VertTuple } from "./VertTuple";
32
31
  import { drawutilssvg } from "./drawutilssvg";
33
- export { BezierPath, Bounds, Circle, CircleSector, CubicBezierCurve, drawutils, drawutilsgl, geomutils, Grid,
32
+ export { BezierPath, Bounds, Circle, CircleSector, CubicBezierCurve, drawutils,
33
+ // drawutilsgl,
34
+ geomutils, Grid,
34
35
  // ...interf,
35
- KeyHandler, Line, MouseHandler, PBImage, PlotBoilerplate, Polygon, SVGBuilder, Triangle, UIDGenerator, Vector, VEllipse, VEllipseSector, Vertex, VertexAttr, VertexListeners, VertTuple, drawutilssvg };
36
+ KeyHandler, Line, MouseHandler, PBImage, PlotBoilerplate, Polygon, Triangle, UIDGenerator, Vector, VEllipse, VEllipseSector, Vertex, VertexAttr, VertexListeners, VertTuple, drawutilssvg };
36
37
  export default PlotBoilerplate;
37
38
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sourceRoot":"","sources":["../ts/module.ts"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,uEAAuE;AACvE,MAAM;AACN,+EAA+E;AAC/E,EAAE;AACF,gBAAgB;AAEhB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;A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O,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EACL,UAAU,EACV,MAAM,EACN,MAAM,EACN,YAAY,EACZ,gBAAgB,EAChB,SAAS;AACT,eAAe;AACf,SAAS,EACT,IAAI;AACJ,aAAa;AACb,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,eAAe,EACf,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,cAAc,EACd,MAAM,EACN,UAAU,EACV,eAAe,EACf,SAAS,EACT,YAAY,EACb,CAAC;AACF,eAAe,eAAe,CAAC"}
@@ -86,6 +86,11 @@ export declare class Girih {
86
86
  * @return {void}
87
87
  */
88
88
  removeTileAt(index: number): void;
89
+ /**
90
+ *
91
+ * @param tiles
92
+ */
93
+ replaceTiles(tiles: GirihTile): void;
89
94
  /**
90
95
  * Find that tile (index) which contains the given position. First match will be returned.
91
96
  *
@@ -41,7 +41,6 @@ export class Girih {
41
41
  this.tiles = [];
42
42
  this.initTemplates(edgeLength);
43
43
  }
44
- ;
45
44
  /**
46
45
  * Initialize the TILE_TEMPLATES array.
47
46
  *
@@ -69,7 +68,6 @@ export class Girih {
69
68
  this.TILE_TEMPLATES.push(decagon.transformTilePositionToAdjacency(5, bowtie));
70
69
  this.TILE_TEMPLATES.push(pentagon.transformTilePositionToAdjacency(4, rhombus));
71
70
  }
72
- ;
73
71
  /**
74
72
  * Add a new tile to this Girih pattern.
75
73
  *
@@ -82,7 +80,6 @@ export class Girih {
82
80
  addTile(tile) {
83
81
  this.tiles.push(tile);
84
82
  }
85
- ;
86
83
  /**
87
84
  * Remove the tile at given array position. The index must be inside valid bounds.
88
85
  *
@@ -95,7 +92,16 @@ export class Girih {
95
92
  removeTileAt(index) {
96
93
  this.tiles.splice(index, 1);
97
94
  }
98
- ;
95
+ /**
96
+ *
97
+ * @param tiles
98
+ */
99
+ replaceTiles(tiles) {
100
+ this.tiles.splice(0, this.tiles.length);
101
+ for (var i in tiles) {
102
+ this.addTile(tiles[i]);
103
+ }
104
+ }
99
105
  /**
100
106
  * Find that tile (index) which contains the given position. First match will be returned.
101
107
  *
@@ -112,7 +118,6 @@ export class Girih {
112
118
  }
113
119
  return -1;
114
120
  }
115
- ;
116
121
  /**
117
122
  * Turn the tile the mouse is hovering over.
118
123
  * The turnCount is ab abstract number: -1 for one turn left, +1 for one turn right.
@@ -127,12 +132,12 @@ export class Girih {
127
132
  * @return {void}
128
133
  */
129
134
  turnTile(tileIndex, turnCount) {
130
- if (tileIndex == -1) // TODO: still required?
135
+ if (tileIndex == -1)
136
+ // TODO: still required?
131
137
  return;
132
138
  const tile = this.tiles[tileIndex];
133
- tile.rotate(turnCount * Math.PI * 2 / tile.symmetry);
139
+ tile.rotate((turnCount * Math.PI * 2) / tile.symmetry);
134
140
  }
135
- ;
136
141
  /**
137
142
  * Move that tile the mouse is hovering over.
138
143
  * The move amounts are abstract numbers, 1 indicating one unit along each axis.
@@ -146,12 +151,12 @@ export class Girih {
146
151
  * @return {void}
147
152
  */
148
153
  moveTile(tileIndex, moveXAmount, moveYAmount) {
149
- if (tileIndex == -1) // TODO: still required?
154
+ if (tileIndex == -1)
155
+ // TODO: still required?
150
156
  return;
151
157
  const tile = this.tiles[tileIndex];
152
158
  tile.move({ x: moveXAmount * 10, y: moveYAmount * 10 });
153
159
  }
154
- ;
155
160
  /**
156
161
  * Find all possible adjadent tiles and their locations (type, rotation and offset). The
157
162
  * function will return an array of all possible tiles matching at the given tile and edge.
@@ -165,7 +170,8 @@ export class Girih {
165
170
  */
166
171
  findPossibleAdjacentTiles(tileIndex, edgeIndex) {
167
172
  var adjTiles = [];
168
- if (tileIndex == -1 || edgeIndex == -1) // TODO: still required?
173
+ if (tileIndex == -1 || edgeIndex == -1)
174
+ // TODO: still required?
169
175
  return [];
170
176
  let template = null;
171
177
  for (var i in this.TILE_TEMPLATES) {
@@ -180,7 +186,5 @@ export class Girih {
180
186
  // previewTilePointer = Math.min( adjTiles.length-1, previewTiilePointer );
181
187
  return adjTiles;
182
188
  }
183
- ;
184
- }
185
- ; // END class Girih
189
+ } // END class Girih
186
190
  //# sourceMappingURL=Girih.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Girih.js","sourceRoot":"","sources":["../../../ts/utils/datastructures/Girih.ts"],"names":[],"mappings":"AAAA;;;;;;IAMI;AAEJ,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI9C;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,KAAK;IAkCd;;;;;;OAMG;IACH,YAAa,UAAiB;QACjC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAE7B,sDAAsD;QACtD,mEAAmE;QACnE,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QAEzB,sCAAsC;QACtC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAEhB,IAAI,CAAC,aAAa,CAAE,UAAU,CAAE,CAAC;IAC9B,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C,CAAC,KAAK,EAAE,CAAC;YAC1C,0DAA0D;YAC1D,MAAM,UAAU,GAAqB,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,0BAA0B,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YAC3G,IAAI,UAAU,CAAC,MAAM,IAAI,CAAC,EAAE;gBAC1B,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;aACxC;SACF;QACD,6BAA6B;QAC7B,2EAA2E;QAC3E,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAC,kBAAkB"}
@@ -38,19 +38,21 @@ export class GirihPenroseRhombus extends GirihTile {
38
38
  // Overwrite the default symmetries:
39
39
  // the penrose-rhombus tile has a 180° symmetry (5/10 * 360°)
40
40
  this.uniqueSymmetries = 5;
41
- if (typeof addCenterPolygon == "undefined")
41
+ if (typeof addCenterPolygon === "undefined") {
42
42
  addCenterPolygon = true; // Add by default
43
+ }
43
44
  // Init the actual decahedron shape with the passed size
44
45
  let pointA = new Vertex(0, 0);
45
46
  let pointB = pointA;
46
47
  this.addVertex(pointB);
47
- const angles = [0.0,
48
+ const angles = [
49
+ 0.0,
48
50
  36.0,
49
51
  144.0 // 108.0
50
52
  ];
51
53
  let theta = 0.0;
52
54
  for (var i = 0; i < angles.length; i++) {
53
- theta += (180.0 - angles[i]);
55
+ theta += 180.0 - angles[i];
54
56
  pointA = pointB; // center of rotation
55
57
  pointB = pointB.clone();
56
58
  pointB.x += this.edgeLength;
@@ -63,55 +65,67 @@ export class GirihPenroseRhombus extends GirihTile {
63
65
  for (var i = 0; i < this.vertices.length; i++) {
64
66
  this.vertices[i].add(move).add(position);
65
67
  }
66
- this.textureSource.min.x = 2 / 500.0,
67
- this.textureSource.min.y = 8 / 460.0;
68
+ this.textureSource.min.x = 2 / 500.0;
69
+ this.textureSource.min.y = 8 / 460.0;
68
70
  this.textureSource.max.x = this.textureSource.min.x + 173 / 500.0;
69
71
  this.textureSource.max.y = this.textureSource.min.y + 56 / 460.0;
70
- ;
71
72
  this.baseBounds = this.getBounds();
72
73
  this._buildInnerPolygons(this.edgeLength, addCenterPolygon);
73
74
  this._buildOuterPolygons(this.edgeLength, addCenterPolygon);
74
75
  }
75
- ;
76
76
  /**
77
77
  * @override
78
78
  */
79
79
  clone() {
80
80
  return new GirihPenroseRhombus(this.position.clone(), this.edgeLength, true).rotate(this.rotation);
81
81
  }
82
- ;
83
- _buildInnerPolygons(edgeLength, addCenterPolygon) {
82
+ _buildInnerPolygons(_edgeLength, addCenterPolygon) {
84
83
  const indices = [0, 2];
85
84
  const centerTile = new Polygon();
86
85
  for (var i = 0; i < indices.length; i++) {
87
86
  const innerTile = new Polygon();
88
87
  const index = indices[i];
89
- const left = this.getVertexAt(index).clone().scale(0.5, this.getVertexAt(index + 1));
90
- const right = this.getVertexAt(index + 1).clone().scale(0.5, this.getVertexAt(index + 2));
91
- const innerA = this.getVertexAt(index + 1).clone().scale(0.28, this.position);
92
- const innerB = this.getVertexAt(index + 1).clone().scale(0.55, this.position);
88
+ const left = this.getVertexAt(index)
89
+ .clone()
90
+ .scale(0.5, this.getVertexAt(index + 1));
91
+ const right = this.getVertexAt(index + 1)
92
+ .clone()
93
+ .scale(0.5, this.getVertexAt(index + 2));
94
+ const innerA = this.getVertexAt(index + 1)
95
+ .clone()
96
+ .scale(0.28, this.position);
97
+ const innerB = this.getVertexAt(index + 1)
98
+ .clone()
99
+ .scale(0.55, this.position);
93
100
  innerTile.addVertex(left);
94
101
  innerTile.addVertex(innerA);
95
102
  innerTile.addVertex(right);
96
103
  innerTile.addVertex(innerB);
97
- centerTile.addVertex(this.getVertexAt(index).clone().scale(0.1775, this.getVertexAt(index + 2)));
104
+ centerTile.addVertex(this.getVertexAt(index)
105
+ .clone()
106
+ .scale(0.1775, this.getVertexAt(index + 2)));
98
107
  centerTile.addVertex(innerA.clone());
99
108
  this.innerTilePolygons.push(innerTile);
100
109
  }
101
110
  if (addCenterPolygon)
102
111
  this.innerTilePolygons.push(centerTile);
103
112
  }
104
- ;
105
- _buildOuterPolygons(edgeLength, centerPolygonExists) {
113
+ _buildOuterPolygons(_edgeLength, centerPolygonExists) {
106
114
  // Add left and right 'spikes'.
107
115
  const indices = [0, 2];
108
116
  for (var i = 0; i < indices.length; i++) {
109
117
  const outerTile = new Polygon();
110
118
  const index = indices[i];
111
- const left = this.getVertexAt(index).clone().scale(0.5, this.getVertexAt(index + 1));
112
- const right = this.getVertexAt(index + 1).clone().scale(0.5, this.getVertexAt(index + 2));
119
+ const left = this.getVertexAt(index)
120
+ .clone()
121
+ .scale(0.5, this.getVertexAt(index + 1));
122
+ const right = this.getVertexAt(index + 1)
123
+ .clone()
124
+ .scale(0.5, this.getVertexAt(index + 2));
113
125
  // const innerA:Vertex = this.getVertexAt( index+1 ).clone().scale( 0.28, this.position );
114
- const innerB = this.getVertexAt(index + 1).clone().scale(0.55, this.position);
126
+ const innerB = this.getVertexAt(index + 1)
127
+ .clone()
128
+ .scale(0.55, this.position);
115
129
  outerTile.addVertex(left.clone());
116
130
  outerTile.addVertex(this.getVertexAt(index + 1).clone());
117
131
  outerTile.addVertex(right.clone());
@@ -126,16 +140,21 @@ export class GirihPenroseRhombus extends GirihTile {
126
140
  const outerTile = new Polygon();
127
141
  const index = indices[i];
128
142
  outerTile.addVertex(this.getVertexAt(index).clone());
129
- outerTile.addVertex(this.getVertexAt(index).clone().scale(0.5, this.getVertexAt(index + 1)));
143
+ outerTile.addVertex(this.getVertexAt(index)
144
+ .clone()
145
+ .scale(0.5, this.getVertexAt(index + 1)));
130
146
  outerTile.addVertex(this.innerTilePolygons[i].getVertexAt(1).clone());
131
- outerTile.addVertex(this.getVertexAt(index).clone().scale(0.1775, this.getVertexAt(index + 2)));
147
+ outerTile.addVertex(this.getVertexAt(index)
148
+ .clone()
149
+ .scale(0.1775, this.getVertexAt(index + 2)));
132
150
  outerTile.addVertex(this.innerTilePolygons[(i + 1) % 2].getVertexAt(1).clone());
133
- outerTile.addVertex(this.getVertexAt(index - 1).clone().scale(0.5, this.getVertexAt(index)));
151
+ outerTile.addVertex(this.getVertexAt(index - 1)
152
+ .clone()
153
+ .scale(0.5, this.getVertexAt(index)));
134
154
  this.outerTilePolygons.push(outerTile);
135
155
  }
136
156
  }
137
157
  }
138
- ;
139
158
  /**
140
159
  * If you want the center polygon not to be drawn the canvas handler needs to
141
160
  * know the respective polygon index (inside the this.innerTilePolygons array).
@@ -144,7 +163,5 @@ export class GirihPenroseRhombus extends GirihTile {
144
163
  getCenterPolygonIndex() {
145
164
  return 2;
146
165
  }
147
- ;
148
166
  }
149
- ;
150
167
  //# sourceMappingURL=GirihPenroseRhombus.js.map