plotboilerplate 1.15.0 → 1.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/README.md +1 -0
  2. package/changelog.md +65 -0
  3. package/dist/index.esm.js +760 -667
  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 +765 -571
  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 +33 -1
  16. package/src/cjs/Bounds.js +38 -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.d.ts +3 -1
  42. package/src/cjs/PlotBoilerplate.js +9 -2
  43. package/src/cjs/PlotBoilerplate.js.map +1 -1
  44. package/src/cjs/Polygon.d.ts +23 -14
  45. package/src/cjs/Polygon.js +22 -35
  46. package/src/cjs/Polygon.js.map +1 -1
  47. package/src/cjs/Triangle.d.ts +15 -13
  48. package/src/cjs/Triangle.js +23 -64
  49. package/src/cjs/Triangle.js.map +1 -1
  50. package/src/cjs/VEllipse.d.ts +14 -9
  51. package/src/cjs/VEllipse.js +10 -18
  52. package/src/cjs/VEllipse.js.map +1 -1
  53. package/src/cjs/VEllipseSector.d.ts +15 -1
  54. package/src/cjs/VEllipseSector.js +11 -1
  55. package/src/cjs/VEllipseSector.js.map +1 -1
  56. package/src/cjs/Vector.d.ts +3 -15
  57. package/src/cjs/Vector.js +9 -49
  58. package/src/cjs/Vector.js.map +1 -1
  59. package/src/cjs/VertTuple.d.ts +15 -1
  60. package/src/cjs/VertTuple.js +14 -19
  61. package/src/cjs/VertTuple.js.map +1 -1
  62. package/src/cjs/Vertex.d.ts +23 -13
  63. package/src/cjs/Vertex.js +24 -22
  64. package/src/cjs/Vertex.js.map +1 -1
  65. package/src/cjs/VertexListeners.d.ts +12 -8
  66. package/src/cjs/VertexListeners.js +18 -25
  67. package/src/cjs/VertexListeners.js.map +1 -1
  68. package/src/cjs/draw.d.ts +45 -3
  69. package/src/cjs/draw.js +149 -6
  70. package/src/cjs/draw.js.map +1 -1
  71. package/src/cjs/drawgl.d.ts +41 -3
  72. package/src/cjs/drawgl.js +45 -3
  73. package/src/cjs/drawgl.js.map +1 -1
  74. package/src/cjs/drawutilssvg.d.ts +69 -4
  75. package/src/cjs/drawutilssvg.js +147 -16
  76. package/src/cjs/drawutilssvg.js.map +1 -1
  77. package/src/cjs/index.d.ts +0 -1
  78. package/src/cjs/index.js +0 -1
  79. package/src/cjs/index.js.map +1 -1
  80. package/src/cjs/interfaces/DrawLib.d.ts +64 -27
  81. package/src/cjs/interfaces/DrawLib.js +3 -0
  82. package/src/cjs/interfaces/DrawLib.js.map +1 -1
  83. package/src/cjs/interfaces/core.d.ts +2 -12
  84. package/src/cjs/interfaces/core.js +1 -0
  85. package/src/cjs/interfaces/core.js.map +1 -1
  86. package/src/cjs/module.d.ts +1 -3
  87. package/src/cjs/module.js +2 -5
  88. package/src/cjs/module.js.map +1 -1
  89. package/src/cjs/utils/creategui.js +16 -2
  90. package/src/cjs/utils/datastructures/Color.d.ts +3 -1
  91. package/src/cjs/utils/datastructures/Color.js +17 -6
  92. package/src/cjs/utils/datastructures/Color.js.map +1 -1
  93. package/src/cjs/utils/datastructures/Girih.d.ts +5 -0
  94. package/src/cjs/utils/datastructures/Girih.js +18 -14
  95. package/src/cjs/utils/datastructures/Girih.js.map +1 -1
  96. package/src/cjs/utils/datastructures/GirihPenroseRhombus.js +42 -25
  97. package/src/cjs/utils/datastructures/GirihPenroseRhombus.js.map +1 -1
  98. package/src/cjs/utils/datastructures/GirihTile.js +2 -13
  99. package/src/cjs/utils/datastructures/GirihTile.js.map +1 -1
  100. package/src/cjs/utils/helpers/BezierPathInteractionHelper.d.ts +17 -1
  101. package/src/cjs/utils/helpers/BezierPathInteractionHelper.js +50 -32
  102. package/src/cjs/utils/helpers/BezierPathInteractionHelper.js.map +1 -1
  103. package/src/cjs/utils/io/DndFileHandler.d.ts +63 -0
  104. package/src/cjs/utils/io/DndFileHandler.js +112 -0
  105. package/src/cjs/utils/io/DndFileHandler.js.map +1 -0
  106. package/src/cjs/utils/io/FileDrop.d.ts +98 -0
  107. package/src/cjs/utils/io/FileDrop.js +142 -0
  108. package/src/cjs/utils/io/FileDrop.js.map +1 -0
  109. package/src/esm/BezierPath.d.ts +32 -14
  110. package/src/esm/BezierPath.js +65 -24
  111. package/src/esm/BezierPath.js.map +1 -1
  112. package/src/esm/Bounds.d.ts +33 -1
  113. package/src/esm/Bounds.js +38 -1
  114. package/src/esm/Bounds.js.map +1 -1
  115. package/src/esm/Circle.d.ts +15 -13
  116. package/src/esm/Circle.js +16 -34
  117. package/src/esm/Circle.js.map +1 -1
  118. package/src/esm/CircleSector.d.ts +17 -16
  119. package/src/esm/CircleSector.js +12 -24
  120. package/src/esm/CircleSector.js.map +1 -1
  121. package/src/esm/CubicBezierCurve.d.ts +16 -15
  122. package/src/esm/CubicBezierCurve.js +57 -94
  123. package/src/esm/CubicBezierCurve.js.map +1 -1
  124. package/src/esm/KeyHandler.d.ts +10 -3
  125. package/src/esm/KeyHandler.js +28 -23
  126. package/src/esm/KeyHandler.js.map +1 -1
  127. package/src/esm/Line.d.ts +2 -15
  128. package/src/esm/Line.js +6 -31
  129. package/src/esm/Line.js.map +1 -1
  130. package/src/esm/MouseHandler.js +43 -53
  131. package/src/esm/MouseHandler.js.map +1 -1
  132. package/src/esm/PBImage.d.ts +15 -13
  133. package/src/esm/PBImage.js +11 -15
  134. package/src/esm/PBImage.js.map +1 -1
  135. package/src/esm/PBText.d.ts +13 -12
  136. package/src/esm/PBText.js +8 -12
  137. package/src/esm/PBText.js.map +1 -1
  138. package/src/esm/PlotBoilerplate.d.ts +3 -1
  139. package/src/esm/PlotBoilerplate.js +9 -2
  140. package/src/esm/PlotBoilerplate.js.map +1 -1
  141. package/src/esm/Polygon.d.ts +23 -14
  142. package/src/esm/Polygon.js +22 -35
  143. package/src/esm/Polygon.js.map +1 -1
  144. package/src/esm/Triangle.d.ts +15 -13
  145. package/src/esm/Triangle.js +23 -64
  146. package/src/esm/Triangle.js.map +1 -1
  147. package/src/esm/VEllipse.d.ts +14 -9
  148. package/src/esm/VEllipse.js +10 -18
  149. package/src/esm/VEllipse.js.map +1 -1
  150. package/src/esm/VEllipseSector.d.ts +15 -1
  151. package/src/esm/VEllipseSector.js +11 -1
  152. package/src/esm/VEllipseSector.js.map +1 -1
  153. package/src/esm/Vector.d.ts +3 -15
  154. package/src/esm/Vector.js +9 -49
  155. package/src/esm/Vector.js.map +1 -1
  156. package/src/esm/VertTuple.d.ts +15 -1
  157. package/src/esm/VertTuple.js +14 -19
  158. package/src/esm/VertTuple.js.map +1 -1
  159. package/src/esm/Vertex.d.ts +23 -13
  160. package/src/esm/Vertex.js +24 -22
  161. package/src/esm/Vertex.js.map +1 -1
  162. package/src/esm/VertexListeners.d.ts +12 -8
  163. package/src/esm/VertexListeners.js +18 -25
  164. package/src/esm/VertexListeners.js.map +1 -1
  165. package/src/esm/draw.d.ts +45 -3
  166. package/src/esm/draw.js +147 -6
  167. package/src/esm/draw.js.map +1 -1
  168. package/src/esm/drawgl.d.ts +41 -3
  169. package/src/esm/drawgl.js +44 -3
  170. package/src/esm/drawgl.js.map +1 -1
  171. package/src/esm/drawutilssvg.d.ts +69 -4
  172. package/src/esm/drawutilssvg.js +146 -16
  173. package/src/esm/drawutilssvg.js.map +1 -1
  174. package/src/esm/index.d.ts +0 -1
  175. package/src/esm/index.js +0 -1
  176. package/src/esm/index.js.map +1 -1
  177. package/src/esm/interfaces/DrawLib.d.ts +64 -27
  178. package/src/esm/interfaces/DrawLib.js +3 -0
  179. package/src/esm/interfaces/DrawLib.js.map +1 -1
  180. package/src/esm/interfaces/core.d.ts +2 -12
  181. package/src/esm/interfaces/core.js +1 -0
  182. package/src/esm/interfaces/core.js.map +1 -1
  183. package/src/esm/module.d.ts +1 -3
  184. package/src/esm/module.js +5 -4
  185. package/src/esm/module.js.map +1 -1
  186. package/src/esm/utils/datastructures/Color.d.ts +3 -1
  187. package/src/esm/utils/datastructures/Color.js +17 -6
  188. package/src/esm/utils/datastructures/Color.js.map +1 -1
  189. package/src/esm/utils/datastructures/Girih.d.ts +5 -0
  190. package/src/esm/utils/datastructures/Girih.js +18 -14
  191. package/src/esm/utils/datastructures/Girih.js.map +1 -1
  192. package/src/esm/utils/datastructures/GirihPenroseRhombus.js +42 -25
  193. package/src/esm/utils/datastructures/GirihPenroseRhombus.js.map +1 -1
  194. package/src/esm/utils/datastructures/GirihTile.js +2 -13
  195. package/src/esm/utils/datastructures/GirihTile.js.map +1 -1
  196. package/src/esm/utils/helpers/BezierPathInteractionHelper.d.ts +17 -1
  197. package/src/esm/utils/helpers/BezierPathInteractionHelper.js +49 -32
  198. package/src/esm/utils/helpers/BezierPathInteractionHelper.js.map +1 -1
  199. package/src/esm/utils/io/DndFileHandler.d.ts +63 -0
  200. package/src/esm/utils/io/DndFileHandler.js +106 -0
  201. package/src/esm/utils/io/DndFileHandler.js.map +1 -0
  202. package/src/esm/utils/io/FileDrop.d.ts +98 -0
  203. package/src/esm/utils/io/FileDrop.js +136 -0
  204. package/src/esm/utils/io/FileDrop.js.map +1 -0
  205. package/src/ts/BezierPath.ts +78 -22
  206. package/src/ts/Bounds.ts +40 -1
  207. package/src/ts/Circle.ts +187 -200
  208. package/src/ts/CircleSector.ts +141 -141
  209. package/src/ts/CubicBezierCurve.ts +738 -810
  210. package/src/ts/KeyHandler.ts +221 -212
  211. package/src/ts/Line.ts +48 -80
  212. package/src/ts/MouseHandler.ts +356 -368
  213. package/src/ts/PBImage.ts +67 -69
  214. package/src/ts/PBText.ts +16 -14
  215. package/src/ts/PlotBoilerplate.ts +9 -2
  216. package/src/ts/Polygon.ts +34 -34
  217. package/src/ts/Triangle.ts +444 -489
  218. package/src/ts/VEllipse.ts +18 -17
  219. package/src/ts/VEllipseSector.ts +20 -1
  220. package/src/ts/Vector.ts +124 -160
  221. package/src/ts/VertTuple.ts +333 -338
  222. package/src/ts/Vertex.ts +35 -21
  223. package/src/ts/VertexListeners.ts +248 -266
  224. package/src/ts/draw.ts +201 -6
  225. package/src/ts/drawgl.ts +47 -3
  226. package/src/ts/drawutilssvg.ts +187 -16
  227. package/src/ts/index.ts +0 -1
  228. package/src/ts/interfaces/DrawLib.ts +72 -27
  229. package/src/ts/interfaces/core.ts +3 -13
  230. package/src/ts/module.ts +2 -4
  231. package/src/ts/utils/datastructures/Color.ts +17 -6
  232. package/src/ts/utils/datastructures/Girih.ts +204 -209
  233. package/src/ts/utils/datastructures/GirihPenroseRhombus.ts +170 -152
  234. package/src/ts/utils/datastructures/GirihTile.ts +394 -419
  235. package/src/ts/utils/helpers/BezierPathInteractionHelper.ts +56 -34
  236. package/src/ts/utils/io/FileDrop.ts +178 -0
  237. package/src/ts/SVGBuilder.ts +0 -109
@@ -15,8 +15,12 @@
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.
20
+ * @modified 2022-07-26 Adding `alpha` to the `image(...)` function.
18
21
  **/
19
22
 
23
+ import { Bounds } from "../Bounds";
20
24
  import { Polygon } from "../Polygon";
21
25
  import { Vertex } from "../Vertex";
22
26
  import { SVGPathParams, UID, XYCoords } from "./core";
@@ -121,7 +125,7 @@ export interface DrawLib<R> {
121
125
  * @param {number=1} lineWidth? - [optional] The line's width.
122
126
  * @return {void}
123
127
  * @instance
124
- * @memberof drawutils
128
+ * @memberof DrawLib
125
129
  **/
126
130
  line: (zA: Vertex, zB: Vertex, color: string, lineWidth?: number) => R;
127
131
 
@@ -135,7 +139,7 @@ export interface DrawLib<R> {
135
139
  * @param {number=} lineWidth - (optional) The line width to use; default is 1.
136
140
  * @return {void}
137
141
  * @instance
138
- * @memberof drawutils
142
+ * @memberof DrawLib
139
143
  **/
140
144
  arrow: (zA: Vertex, zB: Vertex, color: string, lineWidth?: number) => R;
141
145
 
@@ -148,11 +152,35 @@ export interface DrawLib<R> {
148
152
  * @param {Image} image - The image object to draw.
149
153
  * @param {Vertex} position - The position to draw the the upper left corner at.
150
154
  * @param {Vertex} size - The x/y-size to draw the image with.
155
+ * @param {number=1.0} alpha - (optional, default=0.0) The transparency (1.0=opaque, 0.0=transparent).
151
156
  * @return {void}
152
157
  * @instance
153
- * @memberof drawutils
158
+ * @memberof DrawLib
154
159
  **/
155
- image: (image: HTMLImageElement, position: Vertex, size: Vertex) => R;
160
+ image: (image: HTMLImageElement, position: Vertex, size: Vertex, alpha?: number) => R;
161
+
162
+ /**
163
+ * Draw an image at the given position with the given size.<br>
164
+ * <br>
165
+ * 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.
166
+ *
167
+ * @method texturedPoly
168
+ * @param {Image} textureImage - The image object to draw.
169
+ * @param {Bounds} textureSize - The texture size to use; these are the original bounds to map the polygon vertices to.
170
+ * @param {Polygon} polygon - The polygon to use as clip path.
171
+ * @param {Vertex} polygonPosition - The polygon's position (relative), measured at the bounding box's center.
172
+ * @param {number} rotation - The rotation to use for the polygon (and for the texture).
173
+ * @return {void}
174
+ * @instance
175
+ * @memberof DrawLib
176
+ **/
177
+ texturedPoly: (
178
+ textureImage: HTMLImageElement,
179
+ textureSize: Bounds,
180
+ polygon: Polygon,
181
+ polygonPosition: Vertex,
182
+ rotation: number
183
+ ) => R;
156
184
 
157
185
  /**
158
186
  * Draw the given (cubic) bézier curve.
@@ -166,7 +194,7 @@ export interface DrawLib<R> {
166
194
  * @param {number} lineWidth - (optional) The line width to use.
167
195
  * @return {void}
168
196
  * @instance
169
- * @memberof drawutils
197
+ * @memberof DrawLib
170
198
  */
171
199
  cubicBezier: (
172
200
  startPoint: Vertex,
@@ -190,7 +218,7 @@ export interface DrawLib<R> {
190
218
  * @param {number=1} lineWidth - (optional) The line width to use.
191
219
  * @return {void}
192
220
  * @instance
193
- * @memberof drawutils
221
+ * @memberof DrawLib
194
222
  */
195
223
  cubicBezierPath: (path: Array<Vertex>, color: string, lineWidth?: number) => R;
196
224
 
@@ -204,7 +232,7 @@ export interface DrawLib<R> {
204
232
  * @param {Vertex} endPoint - The end point of the handle.
205
233
  * @return {void}
206
234
  * @instance
207
- * @memberof drawutils
235
+ * @memberof DrawLib
208
236
  */
209
237
  handle: (startPoint: Vertex, endPoint: Vertex) => R;
210
238
 
@@ -216,7 +244,7 @@ export interface DrawLib<R> {
216
244
  * @param {Vertex} endPoint - The end point to draw the handle at.
217
245
  * @return {void}
218
246
  * @instance
219
- * @memberof drawutils
247
+ * @memberof DrawLib
220
248
  */
221
249
  handleLine: (startPoint: Vertex, endPoint: Vertex) => R;
222
250
 
@@ -228,7 +256,7 @@ export interface DrawLib<R> {
228
256
  * @param {string} color - The CSS color to draw the dot with.
229
257
  * @return {void}
230
258
  * @instance
231
- * @memberof drawutils
259
+ * @memberof DrawLib
232
260
  */
233
261
  dot: (p: Vertex, color: string) => R;
234
262
 
@@ -240,7 +268,7 @@ export interface DrawLib<R> {
240
268
  * @param {string} color - The CSS color to draw the point with.
241
269
  * @return {void}
242
270
  * @instance
243
- * @memberof drawutils
271
+ * @memberof DrawLib
244
272
  */
245
273
  point: (p: Vertex, color: string) => R;
246
274
 
@@ -256,7 +284,7 @@ export interface DrawLib<R> {
256
284
  * @param {number=} lineWidth - (optional) The line width to use; default is 1.
257
285
  * @return {void}
258
286
  * @instance
259
- * @memberof drawutils
287
+ * @memberof DrawLib
260
288
  */
261
289
  circle: (center: Vertex, radius: number, color: string, lineWidth?: number) => R;
262
290
 
@@ -272,7 +300,7 @@ export interface DrawLib<R> {
272
300
  * @param {number=} lineWidth - (optional) The line width to use; default is 1.
273
301
  * @return {void}
274
302
  * @instance
275
- * @memberof drawutils
303
+ * @memberof DrawLib
276
304
  */
277
305
  circleArc: (center: Vertex, radius: number, startAngle: number, endAngle: number, color: string, lineWidth?: number) => R;
278
306
 
@@ -288,7 +316,7 @@ export interface DrawLib<R> {
288
316
  * @param {number=} rotation - (optional, default=0) The rotation of the ellipse.
289
317
  * @return {void}
290
318
  * @instance
291
- * @memberof drawutils
319
+ * @memberof DrawLib
292
320
  */
293
321
  ellipse: (center: Vertex, radiusX: number, radiusY: number, color: string, lineWidth?: number, rotation?: number) => R;
294
322
 
@@ -304,7 +332,7 @@ export interface DrawLib<R> {
304
332
  * @param {number=} lineWidth - (optional) The line width to use; default is 1.
305
333
  * @return {void}
306
334
  * @instance
307
- * @memberof drawutils
335
+ * @memberof DrawLib
308
336
  */
309
337
  square: (center: XYCoords, size: number, color: string, lineWidth?: number) => R;
310
338
 
@@ -319,7 +347,7 @@ export interface DrawLib<R> {
319
347
  * @param {number=} lineWidth - (optional) The line width to use; default is 1.
320
348
  * @return {void}
321
349
  * @instance
322
- * @memberof drawutils
350
+ * @memberof DrawLib
323
351
  */
324
352
  rect: (upperLeft: XYCoords, width: number, height: number, color: string, lineWidth?: number) => R;
325
353
 
@@ -335,7 +363,7 @@ export interface DrawLib<R> {
335
363
  * @param {string} color - The CSS color to draw the grid with.
336
364
  * @return {void}
337
365
  * @instance
338
- * @memberof drawutils
366
+ * @memberof DrawLib
339
367
  */
340
368
  grid: (center: Vertex, width: number, height: number, sizeX: number, sizeY: number, color: string) => R;
341
369
 
@@ -353,7 +381,7 @@ export interface DrawLib<R> {
353
381
  * @param {string} color - The CSS color to draw the raster with.
354
382
  * @return {void}
355
383
  * @instance
356
- * @memberof drawutils
384
+ * @memberof DrawLib
357
385
  */
358
386
  raster: (center: Vertex, width: number, height: number, sizeX: number, sizeY: number, color: string) => R;
359
387
 
@@ -370,7 +398,7 @@ export interface DrawLib<R> {
370
398
  * @param {string} color - The CSS color to draw the diamond with.
371
399
  * @return {void}
372
400
  * @instance
373
- * @memberof drawutils
401
+ * @memberof DrawLib
374
402
  */
375
403
  diamondHandle: (center: Vertex, size: number, color: string) => R;
376
404
 
@@ -387,7 +415,7 @@ export interface DrawLib<R> {
387
415
  * @param {string} color - The CSS color to draw the square with.
388
416
  * @return {void}
389
417
  * @instance
390
- * @memberof drawutils
418
+ * @memberof DrawLib
391
419
  */
392
420
  squareHandle: (center: Vertex, size: number, color: string) => R;
393
421
 
@@ -404,7 +432,7 @@ export interface DrawLib<R> {
404
432
  * @param {string} color - The CSS color to draw the circle with.
405
433
  * @return {void}
406
434
  * @instance
407
- * @memberof drawutils
435
+ * @memberof DrawLib
408
436
  */
409
437
  circleHandle: (center: Vertex, size: number, color: string) => R;
410
438
 
@@ -417,11 +445,28 @@ export interface DrawLib<R> {
417
445
  * @param {XYCoords} center - The center of the crosshair.
418
446
  * @param {number} radius - The radius of the crosshair.
419
447
  * @param {string} color - The CSS color to draw the crosshair with.
448
+ * @param {number=0.5} lineWidth - (optional, default=0.5) The line width to use.
449
+ * @return {void}
450
+ * @instance
451
+ * @memberof DrawLib
452
+ */
453
+ crosshair: (center: XYCoords, radius: number, color: string, lineWidth?: number) => R;
454
+
455
+ /**
456
+ * Draw a cross with diagonal axes with given radius, color and lineWidth at the given position.<br>
457
+ * <br>
458
+ * Note that the x's radius will not be affected by scaling.
459
+ *
460
+ * @method crosshair
461
+ * @param {XYCoords} center - The center of the crosshair.
462
+ * @param {number} radius - The radius of the crosshair.
463
+ * @param {string} color - The CSS color to draw the crosshair with.
464
+ * @param {number=1} lineWidth - (optional, default=1.0) The line width to use.
420
465
  * @return {void}
421
466
  * @instance
422
- * @memberof drawutils
467
+ * @memberof DrawLib
423
468
  */
424
- crosshair: (center: XYCoords, radius: number, color: string) => R;
469
+ cross: (center: XYCoords, radius: number, color: string, lineWidth?: number) => R;
425
470
 
426
471
  /**
427
472
  * Draw a polygon.
@@ -431,7 +476,7 @@ export interface DrawLib<R> {
431
476
  * @param {string} color - The CSS color to draw the polygon with.
432
477
  * @return {void}
433
478
  * @instance
434
- * @memberof drawutils
479
+ * @memberof DrawLib
435
480
  */
436
481
  polygon: (polygon: Polygon, color: string, lineWidth?: number) => R;
437
482
 
@@ -445,7 +490,7 @@ export interface DrawLib<R> {
445
490
  * @param {number=} lineWidth - (optional) The line width to use; default is 1.
446
491
  * @return {void}
447
492
  * @instance
448
- * @memberof drawutils
493
+ * @memberof DrawLib
449
494
  */
450
495
  polyline: (vertices: Array<Vertex>, isOpen: boolean, color: string, lineWidth?: number) => R;
451
496
 
@@ -466,7 +511,7 @@ export interface DrawLib<R> {
466
511
  * @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"`.
467
512
  * @return {void}
468
513
  * @instance
469
- * @memberof drawutils
514
+ * @memberof DrawLib
470
515
  */
471
516
  text: (text: string, x: number, y: number, options?: FontOptions) => R;
472
517
 
@@ -481,7 +526,7 @@ export interface DrawLib<R> {
481
526
  * @param {string="black"} color - The color to use (default is black).
482
527
  * @return {void}
483
528
  * @instance
484
- * @memberof drawutils
529
+ * @memberof DrawLib
485
530
  */
486
531
  label: (text: string, x: number, y: number, rotation?: number, color?: string) => R;
487
532
 
@@ -494,7 +539,7 @@ export interface DrawLib<R> {
494
539
  * @param {number=1} lineWidth - (optional) the line width to use (default is 1).
495
540
  * @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.
496
541
  * @instance
497
- * @memberof drawutils
542
+ * @memberof DrawLib
498
543
  * @return {R} An instance representing the drawn path.
499
544
  */
500
545
  path: (pathData: SVGPathParams, color?: string, lineWidth?: number, options?: { inplace?: boolean }) => R;
@@ -14,6 +14,7 @@
14
14
  * @modified 2021-05-31 Splitted the large interfaces.ts file into this one and others.
15
15
  * @modified 2021-06-21 Added `IBounds.getCenter()`.
16
16
  * @modified 2021-11-16 Added `text` options to the `DrawConfig`.
17
+ * @modified 2022-08-01 Added `title` param to the `PBParams` interface.
17
18
  **/
18
19
 
19
20
  import { Vertex } from "../Vertex";
@@ -156,8 +157,8 @@ export interface Config {
156
157
  * For initialization the constructor needs a mix of config and draw-settings.
157
158
  */
158
159
  export interface PBParams extends Config {
159
- // , DrawConfig {
160
- // No additional attributes, just merge two interfaces.
160
+ title?: string; // Specify any hover tile here. It will be attached as a `title` attribute to the most elevated element.
161
+ // No more additional attributes, just merge two interfaces.
161
162
  }
162
163
 
163
164
  export interface DrawSettings {
@@ -211,17 +212,6 @@ export interface SVGSerializable {
211
212
  * Required to generate proper CSS classes and other class related IDs.
212
213
  **/
213
214
  readonly className: string;
214
-
215
- /**
216
- * Convert this vertex to SVG code.
217
- *
218
- * @method toSVGString
219
- * @param {object=} options - An optional set of options, like 'className'.
220
- * @return {string} A string representing the SVG code for this vertex.
221
- * @instance
222
- * @memberof Vertex
223
- **/
224
- toSVGString: (options: { className?: string }) => string;
225
215
  }
226
216
 
227
217
  /**
package/src/ts/module.ts CHANGED
@@ -11,7 +11,7 @@ import { Circle } from "./Circle";
11
11
  import { CircleSector } from "./CircleSector";
12
12
  import { CubicBezierCurve } from "./CubicBezierCurve";
13
13
  import { drawutils } from "./draw";
14
- import { drawutilsgl } from "./drawgl";
14
+ // import { drawutilsgl } from "./drawgl";
15
15
  import { geomutils } from "./geomutils";
16
16
  import { Grid } from "./Grid";
17
17
  import { KeyHandler } from "./KeyHandler";
@@ -20,7 +20,6 @@ import { MouseHandler } from "./MouseHandler";
20
20
  import { PBImage } from "./PBImage";
21
21
  import { PlotBoilerplate } from "./PlotBoilerplate";
22
22
  import { Polygon } from "./Polygon";
23
- import { SVGBuilder } from "./SVGBuilder";
24
23
  import { Triangle } from "./Triangle";
25
24
  import { UIDGenerator } from "./UIDGenerator";
26
25
  import { Vector } from "./Vector";
@@ -39,7 +38,7 @@ export {
39
38
  CircleSector,
40
39
  CubicBezierCurve,
41
40
  drawutils,
42
- drawutilsgl,
41
+ // drawutilsgl,
43
42
  geomutils,
44
43
  Grid,
45
44
  // ...interf,
@@ -49,7 +48,6 @@ export {
49
48
  PBImage,
50
49
  PlotBoilerplate,
51
50
  Polygon,
52
- SVGBuilder,
53
51
  Triangle,
54
52
  UIDGenerator,
55
53
  Vector,
@@ -14,7 +14,9 @@
14
14
  * @modified 2021-11-07 Did the same with `saturate` and `desaturate`.
15
15
  * @modified 2021-11-07 Did the same with the `fadein` and `fadeout` functions.
16
16
  * @modified 2021-11-07 Added setRed, setGreen, setBlue, setHue, setSaturation, setLiminance functions.
17
- * @version 0.0.10
17
+ * @modified 2022-05-11 Modified the `clone` function by just copying the numeric calues, not re-calculating the whole color.
18
+ * @modified 2022-05-11 Fixed the `interpolate` function.
19
+ * @version 0.0.11
18
20
  **/
19
21
 
20
22
  /**
@@ -698,7 +700,16 @@ export class Color {
698
700
  * @return {Color} A clone of this color (in RGB mode).
699
701
  */
700
702
  clone(): Color {
701
- return Color.makeRGB(this.r, this.g, this.b, this.a);
703
+ // return Color.makeRGB(this.r, this.g, this.b, this.a);
704
+ const col = new Color();
705
+ col.r = this.r;
706
+ col.g = this.g;
707
+ col.b = this.b;
708
+ col.a = this.a;
709
+ col.h = this.h;
710
+ col.s = this.s;
711
+ col.l = this.l;
712
+ return col;
702
713
  }
703
714
 
704
715
  /**
@@ -712,10 +723,10 @@ export class Color {
712
723
  * @return {Color} A clone of this color (in RGB mode).
713
724
  */
714
725
  interpolate(c: Color, t: number): Color {
715
- this.r += (c.r - c.r) * t;
716
- this.g += (c.g - c.g) * t;
717
- this.b += (c.b - c.b) * t;
718
- this.a += (c.a - c.a) * t;
726
+ this.r += (c.r - this.r) * t;
727
+ this.g += (c.g - this.g) * t;
728
+ this.b += (c.b - this.b) * t;
729
+ this.a += (c.a - this.a) * t;
719
730
  return this;
720
731
  }
721
732
  } // END class