plotboilerplate 1.20.2 → 1.22.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 (169) hide show
  1. package/dist/index.esm.js +2012 -1366
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/index.esm.min.js +1 -1
  4. package/dist/index.esm.min.js.map +1 -1
  5. package/dist/plotboilerplate.browser.min.js +1 -1
  6. package/dist/plotboilerplate.browser.min.js.map +1 -1
  7. package/dist/plotboilerplate.js +1199 -541
  8. package/dist/plotboilerplate.min.js +1 -1
  9. package/package.json +3 -2
  10. package/src/cjs/BezierPath.d.ts +27 -49
  11. package/src/cjs/BezierPath.js +67 -234
  12. package/src/cjs/BezierPath.js.map +1 -1
  13. package/src/cjs/Bounds.d.ts +14 -1
  14. package/src/cjs/Bounds.js +21 -1
  15. package/src/cjs/Bounds.js.map +1 -1
  16. package/src/cjs/CubicBezierCurve.d.ts +70 -1
  17. package/src/cjs/CubicBezierCurve.js +130 -12
  18. package/src/cjs/CubicBezierCurve.js.map +1 -1
  19. package/src/cjs/Line.d.ts +2 -1
  20. package/src/cjs/Line.js +1 -0
  21. package/src/cjs/Line.js.map +1 -1
  22. package/src/cjs/PBText.d.ts +2 -1
  23. package/src/cjs/PBText.js +10 -9
  24. package/src/cjs/PBText.js.map +1 -1
  25. package/src/cjs/PlotBoilerplate.d.ts +4 -13
  26. package/src/cjs/PlotBoilerplate.js +61 -15
  27. package/src/cjs/PlotBoilerplate.js.map +1 -1
  28. package/src/cjs/Polygon.d.ts +47 -1
  29. package/src/cjs/Polygon.js +116 -1
  30. package/src/cjs/Polygon.js.map +1 -1
  31. package/src/cjs/VEllipse.js +1 -1
  32. package/src/cjs/VEllipse.js.map +1 -1
  33. package/src/cjs/Vector.d.ts +4 -4
  34. package/src/cjs/Vector.js +2 -2
  35. package/src/cjs/Vector.js.map +1 -1
  36. package/src/cjs/VertTuple.d.ts +2 -1
  37. package/src/cjs/VertTuple.js +4 -3
  38. package/src/cjs/VertTuple.js.map +1 -1
  39. package/src/cjs/Vertex.d.ts +14 -3
  40. package/src/cjs/Vertex.js +18 -3
  41. package/src/cjs/Vertex.js.map +1 -1
  42. package/src/cjs/draw.d.ts +154 -75
  43. package/src/cjs/draw.js +308 -137
  44. package/src/cjs/draw.js.map +1 -1
  45. package/src/cjs/drawgl.d.ts +87 -50
  46. package/src/cjs/drawgl.js +86 -31
  47. package/src/cjs/drawgl.js.map +1 -1
  48. package/src/cjs/drawutilssvg.d.ts +226 -53
  49. package/src/cjs/drawutilssvg.js +374 -92
  50. package/src/cjs/drawutilssvg.js.map +1 -1
  51. package/src/cjs/interfaces/DrawLib.d.ts +157 -79
  52. package/src/cjs/interfaces/DrawLib.js +6 -0
  53. package/src/cjs/interfaces/DrawLib.js.map +1 -1
  54. package/src/cjs/interfaces/core.d.ts +13 -2
  55. package/src/cjs/interfaces/core.js +1 -0
  56. package/src/cjs/interfaces/core.js.map +1 -1
  57. package/src/cjs/utils/Params.d.ts +15 -0
  58. package/src/cjs/utils/Params.js +49 -0
  59. package/src/cjs/utils/Params.js.map +1 -0
  60. package/src/cjs/utils/algorithms/ContourLineDetection.d.ts +150 -0
  61. package/src/cjs/utils/algorithms/ContourLineDetection.js +367 -0
  62. package/src/cjs/utils/algorithms/ContourLineDetection.js.map +1 -0
  63. package/src/cjs/utils/algorithms/clearDuplicateVertices.d.ts +21 -0
  64. package/src/cjs/utils/algorithms/clearDuplicateVertices.js +48 -0
  65. package/src/cjs/utils/algorithms/clearDuplicateVertices.js.map +1 -0
  66. package/src/cjs/utils/creategui.js +16 -10
  67. package/src/cjs/utils/datastructures/DataGrid2d.d.ts +47 -0
  68. package/src/cjs/utils/datastructures/DataGrid2d.js +20 -0
  69. package/src/cjs/utils/datastructures/DataGrid2d.js.map +1 -0
  70. package/src/cjs/utils/datastructures/DataGrid2dListAdapter.d.ts +65 -0
  71. package/src/cjs/utils/datastructures/DataGrid2dListAdapter.js +84 -0
  72. package/src/cjs/utils/datastructures/DataGrid2dListAdapter.js.map +1 -0
  73. package/src/cjs/utils/datastructures/GenericPath.d.ts +14 -3
  74. package/src/cjs/utils/datastructures/GenericPath.js +20 -3
  75. package/src/cjs/utils/datastructures/GenericPath.js.map +1 -1
  76. package/src/cjs/utils/detectDarkMode.d.ts +10 -0
  77. package/src/cjs/utils/detectDarkMode.js +32 -0
  78. package/src/cjs/utils/detectDarkMode.js.map +1 -0
  79. package/src/esm/BezierPath.d.ts +27 -49
  80. package/src/esm/BezierPath.js +67 -234
  81. package/src/esm/BezierPath.js.map +1 -1
  82. package/src/esm/Bounds.d.ts +14 -1
  83. package/src/esm/Bounds.js +19 -1
  84. package/src/esm/Bounds.js.map +1 -1
  85. package/src/esm/CubicBezierCurve.d.ts +70 -1
  86. package/src/esm/CubicBezierCurve.js +130 -12
  87. package/src/esm/CubicBezierCurve.js.map +1 -1
  88. package/src/esm/Line.d.ts +2 -1
  89. package/src/esm/Line.js +1 -0
  90. package/src/esm/Line.js.map +1 -1
  91. package/src/esm/PBText.d.ts +2 -1
  92. package/src/esm/PBText.js +10 -9
  93. package/src/esm/PBText.js.map +1 -1
  94. package/src/esm/PlotBoilerplate.d.ts +4 -13
  95. package/src/esm/PlotBoilerplate.js +62 -16
  96. package/src/esm/PlotBoilerplate.js.map +1 -1
  97. package/src/esm/Polygon.d.ts +47 -1
  98. package/src/esm/Polygon.js +114 -1
  99. package/src/esm/Polygon.js.map +1 -1
  100. package/src/esm/VEllipse.js +1 -1
  101. package/src/esm/VEllipse.js.map +1 -1
  102. package/src/esm/Vector.d.ts +4 -4
  103. package/src/esm/Vector.js +2 -2
  104. package/src/esm/Vector.js.map +1 -1
  105. package/src/esm/VertTuple.d.ts +2 -1
  106. package/src/esm/VertTuple.js +4 -3
  107. package/src/esm/VertTuple.js.map +1 -1
  108. package/src/esm/Vertex.d.ts +14 -3
  109. package/src/esm/Vertex.js +18 -3
  110. package/src/esm/Vertex.js.map +1 -1
  111. package/src/esm/draw.d.ts +154 -75
  112. package/src/esm/draw.js +304 -135
  113. package/src/esm/draw.js.map +1 -1
  114. package/src/esm/drawgl.d.ts +87 -50
  115. package/src/esm/drawgl.js +86 -31
  116. package/src/esm/drawgl.js.map +1 -1
  117. package/src/esm/drawutilssvg.d.ts +226 -53
  118. package/src/esm/drawutilssvg.js +369 -92
  119. package/src/esm/drawutilssvg.js.map +1 -1
  120. package/src/esm/interfaces/DrawLib.d.ts +157 -79
  121. package/src/esm/interfaces/DrawLib.js +6 -0
  122. package/src/esm/interfaces/DrawLib.js.map +1 -1
  123. package/src/esm/interfaces/core.d.ts +13 -2
  124. package/src/esm/interfaces/core.js +1 -0
  125. package/src/esm/interfaces/core.js.map +1 -1
  126. package/src/esm/utils/Params.d.ts +15 -0
  127. package/src/esm/utils/Params.js +44 -0
  128. package/src/esm/utils/Params.js.map +1 -0
  129. package/src/esm/utils/algorithms/ContourLineDetection.d.ts +150 -0
  130. package/src/esm/utils/algorithms/ContourLineDetection.js +362 -0
  131. package/src/esm/utils/algorithms/ContourLineDetection.js.map +1 -0
  132. package/src/esm/utils/algorithms/clearDuplicateVertices.d.ts +21 -0
  133. package/src/esm/utils/algorithms/clearDuplicateVertices.js +44 -0
  134. package/src/esm/utils/algorithms/clearDuplicateVertices.js.map +1 -0
  135. package/src/esm/utils/datastructures/DataGrid2d.d.ts +47 -0
  136. package/src/esm/utils/datastructures/DataGrid2d.js +19 -0
  137. package/src/esm/utils/datastructures/DataGrid2d.js.map +1 -0
  138. package/src/esm/utils/datastructures/DataGrid2dListAdapter.d.ts +65 -0
  139. package/src/esm/utils/datastructures/DataGrid2dListAdapter.js +79 -0
  140. package/src/esm/utils/datastructures/DataGrid2dListAdapter.js.map +1 -0
  141. package/src/esm/utils/datastructures/GenericPath.d.ts +14 -3
  142. package/src/esm/utils/datastructures/GenericPath.js +20 -3
  143. package/src/esm/utils/datastructures/GenericPath.js.map +1 -1
  144. package/src/esm/utils/detectDarkMode.d.ts +10 -0
  145. package/src/esm/utils/detectDarkMode.js +28 -0
  146. package/src/esm/utils/detectDarkMode.js.map +1 -0
  147. package/src/ts/BezierPath.ts +72 -241
  148. package/src/ts/Bounds.ts +25 -1
  149. package/src/ts/CubicBezierCurve.ts +139 -12
  150. package/src/ts/Line.ts +2 -1
  151. package/src/ts/PBText.ts +10 -9
  152. package/src/ts/PlotBoilerplate.ts +56 -19
  153. package/src/ts/Polygon.ts +121 -1
  154. package/src/ts/VEllipse.ts +2 -2
  155. package/src/ts/Vector.ts +4 -4
  156. package/src/ts/VertTuple.ts +4 -3
  157. package/src/ts/Vertex.ts +20 -4
  158. package/src/ts/draw.ts +311 -115
  159. package/src/ts/drawgl.ts +133 -71
  160. package/src/ts/drawutilssvg.ts +543 -121
  161. package/src/ts/interfaces/DrawLib.ts +219 -83
  162. package/src/ts/interfaces/core.ts +14 -2
  163. package/src/ts/utils/Params.ts +47 -0
  164. package/src/ts/utils/algorithms/ContourLineDetection.ts +485 -0
  165. package/src/ts/utils/algorithms/clearDuplicateVertices.ts +49 -0
  166. package/src/ts/utils/datastructures/DataGrid2d.ts +54 -0
  167. package/src/ts/utils/datastructures/DataGrid2dListAdapter.ts +121 -0
  168. package/src/ts/utils/datastructures/GenericPath.ts +21 -3
  169. package/src/ts/utils/detectDarkMode.ts +30 -0
@@ -37,11 +37,19 @@
37
37
  * @modified 2022-11-10 Tweaking some type issues.
38
38
  * @modified 2023-02-04 Fixed a typo in the CSS classname for cubic Bézier paths: cubicBezier (was cubierBezier).
39
39
  * @modified 2023-02-10 The methods `setCurrentClassName` and `setCurrentId` also accept `null` now.
40
- * @version 1.6.4
40
+ * @modified 2023-09-29 Added initialization checks for null parameters.
41
+ * @modified 2023-09-29 Added a missing implementation to the `drawurilssvg.do(XYCoords,string)` function. Didn't draw anything.
42
+ * @modified 2023-09-29 Downgrading all `Vertex` param type to the more generic `XYCoords` type in these render functions: line, arrow, texturedPoly, cubicBezier, cubicBezierPath, handle, handleLine, dot, point, circle, circleArc, ellipse, grid, raster.
43
+ * @modified 2023-09-29 Added the `headLength` parameter to the 'DrawLib.arrow()` function.
44
+ * @modified 2023-09-29 Added the `arrowHead(...)` function to the 'DrawLib.arrow()` interface.
45
+ * @modified 2023-09-29 Added the `cubicBezierArrow(...)` function to the 'DrawLib.arrow()` interface.
46
+ * @modified 2023-10-04 Adding `strokeOptions` param to these draw function: line, arrow, cubicBezierArrow, cubicBezier, cubicBezierPath, circle, circleArc, ellipse, square, rect, polygon, polyline.
47
+ *
48
+ * @version 1.6.7
41
49
  **/
42
50
  import { Polygon } from "./Polygon";
43
51
  import { Vertex } from "./Vertex";
44
- import { DrawConfig, DrawLib, XYCoords, XYDimension, SVGPathParams, UID, DrawLibConfiguration, FontStyle, FontWeight } from "./interfaces";
52
+ import { DrawConfig, DrawLib, XYCoords, XYDimension, SVGPathParams, UID, DrawLibConfiguration, FontStyle, FontWeight, StrokeOptions } from "./interfaces";
45
53
  import { Bounds } from "./Bounds";
46
54
  /**
47
55
  * @classdesc A helper class for basic SVG drawing operations. This class should
@@ -242,6 +250,33 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
242
250
  * @return {SVGElement} The node itself (for chaining).
243
251
  */
244
252
  private _bindFillDraw;
253
+ /**
254
+ * Bind this given node to a parent. If no parent is passed then the global
255
+ * node buffer will be used.
256
+ *
257
+ * @method _bindNode
258
+ * @private
259
+ * @instance
260
+ * @memberof drawutilssvg
261
+ * @param {SVGElement} node - The SVG node to bind.
262
+ * @param {SVGElement=} bindingParent - (optional) You may pass node other than the glober buffer node.
263
+ * @returns {SVGElement} The passed node itself.
264
+ */
265
+ private _bindNode;
266
+ /**
267
+ * Add custom CSS class names and the globally defined CSS classname to the
268
+ * given node.
269
+ *
270
+ * @method addCSSClasses
271
+ * @private
272
+ * @instance
273
+ * @memberof drawutilssvg
274
+ * @param {SVGElement} node - The SVG node to bind.
275
+ * @param {string} className - The additional custom classname to add.
276
+ * @returns {void}
277
+ */
278
+ private _addCSSClasses;
279
+ private _configureNode;
245
280
  /**
246
281
  * Sets the size and view box of the document. Call this if canvas size changes.
247
282
  *
@@ -308,34 +343,79 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
308
343
  * @instance
309
344
  **/
310
345
  endDrawCycle(renderTime: number): void;
346
+ /**
347
+ * A private helper method to apply stroke options to the current
348
+ * context.
349
+ * @param {StrokeOptions=} strokeOptions -
350
+ */
351
+ private applyStrokeOpts;
311
352
  private _x;
312
353
  private _y;
313
354
  /**
314
355
  * Draw the line between the given two points with the specified (CSS-) color.
315
356
  *
316
357
  * @method line
317
- * @param {Vertex} zA - The start point of the line.
318
- * @param {Vertex} zB - The end point of the line.
358
+ * @param {XYCoords} zA - The start point of the line.
359
+ * @param {XYCoords} zB - The end point of the line.
319
360
  * @param {string} color - Any valid CSS color string.
320
361
  * @param {number=1} lineWidth? - [optional] The line's width.
362
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
363
+ *
321
364
  * @return {void}
322
365
  * @instance
323
366
  * @memberof drawutilssvg
324
367
  **/
325
- line(zA: Vertex, zB: Vertex, color: string, lineWidth?: number): SVGElement;
368
+ line(zA: XYCoords, zB: XYCoords, color: string, lineWidth?: number, strokeOptions?: StrokeOptions): SVGElement;
326
369
  /**
327
370
  * Draw a line and an arrow at the end (zB) of the given line with the specified (CSS-) color.
328
371
  *
329
372
  * @method arrow
330
- * @param {Vertex} zA - The start point of the arrow-line.
331
- * @param {Vertex} zB - The end point of the arrow-line.
373
+ * @param {XYCoords} zA - The start point of the arrow-line.
374
+ * @param {XYCoords} zB - The end point of the arrow-line.
332
375
  * @param {string} color - Any valid CSS color string.
333
376
  * @param {number=} lineWidth - (optional) The line width to use; default is 1.
377
+ * @param {headLength=8} headLength - (optional) The length of the arrow head (default is 8 units).
378
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
379
+ *
334
380
  * @return {void}
335
381
  * @instance
336
382
  * @memberof drawutilssvg
337
383
  **/
338
- arrow(zA: Vertex, zB: Vertex, color: string, lineWidth?: number): SVGElement;
384
+ arrow(zA: XYCoords, zB: XYCoords, color: string, lineWidth?: number, headLength?: number, strokeOptions?: StrokeOptions): SVGElement;
385
+ /**
386
+ * Draw a cubic Bézier curve and and an arrow at the end (endControlPoint) of the given line width the specified (CSS-) color and arrow size.
387
+ *
388
+ * @method cubicBezierArrow
389
+ * @param {XYCoords} startPoint - The start point of the cubic Bézier curve
390
+ * @param {XYCoords} endPoint - The end point the cubic Bézier curve.
391
+ * @param {XYCoords} startControlPoint - The start control point the cubic Bézier curve.
392
+ * @param {XYCoords} endControlPoint - The end control point the cubic Bézier curve.
393
+ * @param {string} color - The CSS color to draw the curve with.
394
+ * @param {number} lineWidth - (optional) The line width to use.
395
+ * @param {headLength=8} headLength - (optional) The length of the arrow head (default is 8 units).
396
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
397
+ *
398
+ * @return {void}
399
+ * @instance
400
+ * @memberof DrawLib
401
+ */
402
+ cubicBezierArrow(startPoint: XYCoords, endPoint: XYCoords, startControlPoint: XYCoords, endControlPoint: XYCoords, color: string, lineWidth?: number, headLength?: number, strokeOptions?: StrokeOptions): SVGElement;
403
+ /**
404
+ * Draw just an arrow head a the end of an imaginary line (zB) of the given line width the specified (CSS-) color and size.
405
+ *
406
+ * @method arrow
407
+ * @param {XYCoords} zA - The start point of the arrow-line.
408
+ * @param {XYCoords} zB - The end point of the arrow-line.
409
+ * @param {string} color - Any valid CSS color string.
410
+ * @param {number=1} lineWidth - (optional) The line width to use; default is 1.
411
+ * @param {number=8} headLength - (optional) The length of the arrow head (default is 8 pixels).
412
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
413
+ *
414
+ * @return {void}
415
+ * @instance
416
+ * @memberof DrawLib
417
+ **/
418
+ arrowHead(zA: XYCoords, zB: XYCoords, color: string, lineWidth?: number, headLength?: number, strokeOptions?: StrokeOptions): SVGElement;
339
419
  /**
340
420
  * Draw an image at the given position with the given size.<br>
341
421
  * <br>
@@ -343,14 +423,14 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
343
423
  *
344
424
  * @method image
345
425
  * @param {Image} image - The image object to draw.
346
- * @param {Vertex} position - The position to draw the the upper left corner at.
347
- * @param {Vertex} size - The x/y-size to draw the image with.
426
+ * @param {XYCoords} position - The position to draw the the upper left corner at.
427
+ * @param {XYCoords} size - The x/y-size to draw the image with.
348
428
  * @param {number=0.0} alpha - (optional, default=0.0) The transparency (1.0=opaque, 0.0=transparent).
349
429
  * @return {void}
350
430
  * @instance
351
431
  * @memberof drawutilssvg
352
432
  **/
353
- image(image: HTMLImageElement, position: Vertex, size: Vertex, alpha?: number): SVGElement;
433
+ image(image: HTMLImageElement, position: XYCoords, size: XYCoords, alpha?: number): SVGElement;
354
434
  /**
355
435
  * Draw an image at the given position with the given size.<br>
356
436
  * <br>
@@ -360,28 +440,30 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
360
440
  * @param {Image} textureImage - The image object to draw.
361
441
  * @param {Bounds} textureSize - The texture size to use; these are the original bounds to map the polygon vertices to.
362
442
  * @param {Polygon} polygon - The polygon to use as clip path.
363
- * @param {Vertex} polygonPosition - The polygon's position (relative), measured at the bounding box's center.
443
+ * @param {XYCoords} polygonPosition - The polygon's position (relative), measured at the bounding box's center.
364
444
  * @param {number} rotation - The rotation to use for the polygon (and for the texture).
365
445
  * @return {void}
366
446
  * @instance
367
447
  * @memberof drawutilssvg
368
448
  **/
369
- texturedPoly(textureImage: HTMLImageElement, textureSize: Bounds, polygon: Polygon, polygonPosition: Vertex, rotation: number): SVGElement;
449
+ texturedPoly(textureImage: HTMLImageElement, textureSize: Bounds, polygon: Polygon, polygonPosition: XYCoords, rotation: number): SVGElement;
370
450
  /**
371
451
  * Draw the given (cubic) bézier curve.
372
452
  *
373
453
  * @method cubicBezier
374
- * @param {Vertex} startPoint - The start point of the cubic Bézier curve
375
- * @param {Vertex} endPoint - The end point the cubic Bézier curve.
376
- * @param {Vertex} startControlPoint - The start control point the cubic Bézier curve.
377
- * @param {Vertex} endControlPoint - The end control point the cubic Bézier curve.
454
+ * @param {XYCoords} startPoint - The start point of the cubic Bézier curve
455
+ * @param {XYCoords} endPoint - The end point the cubic Bézier curve.
456
+ * @param {XYCoords} startControlPoint - The start control point the cubic Bézier curve.
457
+ * @param {XYCoords} endControlPoint - The end control point the cubic Bézier curve.
378
458
  * @param {string} color - The CSS color to draw the curve with.
379
459
  * @param {number} lineWidth - (optional) The line width to use.
460
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
461
+ *
380
462
  * @return {void}
381
463
  * @instance
382
464
  * @memberof drawutilssvg
383
465
  */
384
- cubicBezier(startPoint: Vertex, endPoint: Vertex, startControlPoint: Vertex, endControlPoint: Vertex, color: string, lineWidth?: number): SVGElement;
466
+ cubicBezier(startPoint: XYCoords, endPoint: XYCoords, startControlPoint: XYCoords, endControlPoint: XYCoords, color: string, lineWidth?: number, strokeOptions?: StrokeOptions): SVGElement;
385
467
  /**
386
468
  * Draw the given (cubic) Bézier path.
387
469
  *
@@ -390,14 +472,16 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
390
472
  * <pre> [ point1, point1_startControl, point2_endControl, point2, point2_startControl, point3_endControl, point3, ... pointN_endControl, pointN ]</pre>
391
473
  *
392
474
  * @method cubicBezierPath
393
- * @param {Vertex[]} path - The cubic bezier path as described above.
475
+ * @param {XYCoords[]} path - The cubic bezier path as described above.
394
476
  * @param {string} color - The CSS colot to draw the path with.
395
477
  * @param {number=1} lineWidth - (optional) The line width to use.
478
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
479
+ *
396
480
  * @return {void}
397
481
  * @instance
398
482
  * @memberof drawutilssvg
399
483
  */
400
- cubicBezierPath(path: Array<Vertex>, color: string, lineWidth?: number): SVGElement;
484
+ cubicBezierPath(path: Array<XYCoords>, color: string, lineWidth?: number, strokeOptions?: StrokeOptions): SVGElement;
401
485
  /**
402
486
  * Draw the given handle and handle point (used to draw interactive Bézier curves).
403
487
  *
@@ -410,84 +494,90 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
410
494
  * @instance
411
495
  * @memberof drawutilssvg
412
496
  */
413
- handle(startPoint: Vertex, endPoint: Vertex): void;
497
+ handle(startPoint: XYCoords, endPoint: XYCoords): void;
414
498
  /**
415
499
  * Draw a handle line (with a light grey).
416
500
  *
417
501
  * @method handleLine
418
- * @param {Vertex} startPoint - The start point to draw the handle at.
419
- * @param {Vertex} endPoint - The end point to draw the handle at.
502
+ * @param {XYCoords} startPoint - The start point to draw the handle at.
503
+ * @param {XYCoords} endPoint - The end point to draw the handle at.
420
504
  * @return {void}
421
505
  * @instance
422
506
  * @memberof drawutilssvg
423
507
  */
424
- handleLine(startPoint: Vertex, endPoint: Vertex): void;
508
+ handleLine(startPoint: XYCoords, endPoint: XYCoords): void;
425
509
  /**
426
510
  * Draw a 1x1 dot with the specified (CSS-) color.
427
511
  *
428
512
  * @method dot
429
- * @param {Vertex} p - The position to draw the dot at.
513
+ * @param {XYCoords} p - The position to draw the dot at.
430
514
  * @param {string} color - The CSS color to draw the dot with.
431
515
  * @return {void}
432
516
  * @instance
433
517
  * @memberof drawutilssvg
434
518
  */
435
- dot(p: Vertex, color: string): SVGElement;
519
+ dot(p: XYCoords, color: string): SVGElement;
436
520
  /**
437
521
  * Draw the given point with the specified (CSS-) color and radius 3.
438
522
  *
439
523
  * @method point
440
- * @param {Vertex} p - The position to draw the point at.
524
+ * @param {XYCoords} p - The position to draw the point at.
441
525
  * @param {string} color - The CSS color to draw the point with.
442
526
  * @return {void}
443
527
  * @instance
444
528
  * @memberof drawutilssvg
445
529
  */
446
- point(p: Vertex, color: string): SVGElement;
530
+ point(p: XYCoords, color: string): SVGElement;
447
531
  /**
448
532
  * Draw a circle with the specified (CSS-) color and radius.<br>
449
533
  * <br>
450
534
  * Note that if the x- and y- scales are different the result will be an ellipse rather than a circle.
451
535
  *
452
536
  * @method circle
453
- * @param {Vertex} center - The center of the circle.
537
+ * @param {XYCoords} center - The center of the circle.
454
538
  * @param {number} radius - The radius of the circle.
455
539
  * @param {string} color - The CSS color to draw the circle with.
456
540
  * @param {number=} lineWidth - (optional) The line width to use; default is 1.
541
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
542
+ *
457
543
  * @return {void}
458
544
  * @instance
459
545
  * @memberof drawutilssvg
460
546
  */
461
- circle(center: Vertex, radius: number, color: string, lineWidth?: number): SVGElement;
547
+ circle(center: XYCoords, radius: number, color: string, lineWidth?: number, strokeOptions?: StrokeOptions): SVGElement;
462
548
  /**
463
549
  * Draw a circular arc (section of a circle) with the given CSS color.
464
550
  *
465
551
  * @method circleArc
466
- * @param {Vertex} center - The center of the circle.
552
+ * @param {XYCoords} center - The center of the circle.
467
553
  * @param {number} radius - The radius of the circle.
468
554
  * @param {number} startAngle - The angle to start at.
469
555
  * @param {number} endAngle - The angle to end at.
470
556
  * @param {string} color - The CSS color to draw the circle with.
557
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
558
+ *
471
559
  * @return {void}
472
560
  * @instance
473
561
  * @memberof drawutilssvg
474
562
  */
475
- circleArc(center: Vertex, radius: number, startAngle: number, endAngle: number, color: string, lineWidth?: number): SVGElement;
563
+ circleArc(center: XYCoords, radius: number, startAngle: number, endAngle: number, color: string, lineWidth?: number, strokeOptions?: StrokeOptions): SVGElement;
476
564
  /**
477
565
  * Draw an ellipse with the specified (CSS-) color and thw two radii.
478
566
  *
479
567
  * @method ellipse
480
- * @param {Vertex} center - The center of the ellipse.
568
+ * @param {XYCoords} center - The center of the ellipse.
481
569
  * @param {number} radiusX - The radius of the ellipse.
482
570
  * @param {number} radiusY - The radius of the ellipse.
483
571
  * @param {string} color - The CSS color to draw the ellipse with.
484
572
  * @param {number=} lineWidth - (optional) The line width to use; default is 1.
485
573
  * @param {number=} rotation - (optional, default=0) The rotation of the ellipse.
574
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
575
+ *
486
576
  * @return {void}
487
577
  * @instance
488
578
  * @memberof drawutilssvg
489
579
  */
490
- ellipse(center: Vertex, radiusX: number, radiusY: number, color: string, lineWidth?: number, rotation?: number): SVGElement;
580
+ ellipse(center: XYCoords, radiusX: number, radiusY: number, color: string, lineWidth?: number, rotation?: number, strokeOptions?: StrokeOptions): SVGElement;
491
581
  /**
492
582
  * Draw square at the given center, size and with the specified (CSS-) color.<br>
493
583
  * <br>
@@ -495,14 +585,16 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
495
585
  *
496
586
  * @method square
497
587
  * @param {XYCoords} center - The center of the square.
498
- * @param {Vertex} size - The size of the square.
588
+ * @param {number} size - The size of the square.
499
589
  * @param {string} color - The CSS color to draw the square with.
500
590
  * @param {number=} lineWidth - (optional) The line width to use; default is 1.
501
- * @return {void}
591
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
592
+ *
593
+ * @return {SVGElement}
502
594
  * @instance
503
595
  * @memberof drawutilssvg
504
596
  */
505
- square(center: XYCoords, size: number, color: string, lineWidth?: number): SVGElement;
597
+ square(center: XYCoords, size: number, color: string, lineWidth?: number, strokeOptions?: StrokeOptions): SVGElement;
506
598
  /**
507
599
  * Draw a rectangle.
508
600
  *
@@ -511,13 +603,18 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
511
603
  * @param {number} height - The height of the rectangle.
512
604
  * @param {string} color - The color to use.
513
605
  * @param {number=1} lineWidth - (optional) The line with to use (default is 1).
606
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
607
+ *
608
+ * @return {SVGElement}
609
+ * @instance
610
+ * @memberof drawutilssvg
514
611
  **/
515
- rect(position: XYCoords, width: number, height: number, color: string, lineWidth?: number): SVGElement;
612
+ rect(position: XYCoords, width: number, height: number, color: string, lineWidth?: number, strokeOptions?: StrokeOptions): SVGElement;
516
613
  /**
517
614
  * Draw a grid of horizontal and vertical lines with the given (CSS-) color.
518
615
  *
519
616
  * @method grid
520
- * @param {Vertex} center - The center of the grid.
617
+ * @param {XYCoords} center - The center of the grid.
521
618
  * @param {number} width - The total width of the grid (width/2 each to the left and to the right).
522
619
  * @param {number} height - The total height of the grid (height/2 each to the top and to the bottom).
523
620
  * @param {number} sizeX - The horizontal grid size.
@@ -527,14 +624,14 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
527
624
  * @instance
528
625
  * @memberof drawutilssvg
529
626
  */
530
- grid(center: Vertex, width: number, height: number, sizeX: number, sizeY: number, color: string): SVGElement;
627
+ grid(center: XYCoords, width: number, height: number, sizeX: number, sizeY: number, color: string): SVGElement;
531
628
  /**
532
629
  * Draw a raster of crosshairs in the given grid.<br>
533
630
  *
534
631
  * This works analogue to the grid() function
535
632
  *
536
633
  * @method raster
537
- * @param {Vertex} center - The center of the raster.
634
+ * @param {XYCoords} center - The center of the raster.
538
635
  * @param {number} width - The total width of the raster (width/2 each to the left and to the right).
539
636
  * @param {number} height - The total height of the raster (height/2 each to the top and to the bottom).
540
637
  * @param {number} sizeX - The horizontal raster size.
@@ -544,7 +641,7 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
544
641
  * @instance
545
642
  * @memberof drawutilssvg
546
643
  */
547
- raster(center: Vertex, width: number, height: number, sizeX: number, sizeY: number, color: string): SVGElement;
644
+ raster(center: XYCoords, width: number, height: number, sizeX: number, sizeY: number, color: string): SVGElement;
548
645
  /**
549
646
  * Draw a diamond handle (square rotated by 45°) with the given CSS color.
550
647
  *
@@ -553,14 +650,14 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
553
650
  * as even shaped diamonds.
554
651
  *
555
652
  * @method diamondHandle
556
- * @param {Vertex} center - The center of the diamond.
557
- * @param {Vertex} size - The x/y-size of the diamond.
653
+ * @param {XYCoords} center - The center of the diamond.
654
+ * @param {number} size - The x/y-size of the diamond.
558
655
  * @param {string} color - The CSS color to draw the diamond with.
559
656
  * @return {void}
560
657
  * @instance
561
658
  * @memberof drawutilssvg
562
659
  */
563
- diamondHandle(center: Vertex, size: number, color: string): SVGElement;
660
+ diamondHandle(center: XYCoords, size: number, color: string): SVGElement;
564
661
  /**
565
662
  * Draw a square handle with the given CSS color.<br>
566
663
  * <br>
@@ -569,14 +666,14 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
569
666
  * as even shaped squares.
570
667
  *
571
668
  * @method squareHandle
572
- * @param {Vertex} center - The center of the square.
573
- * @param {Vertex} size - The x/y-size of the square.
669
+ * @param {XYCoords} center - The center of the square.
670
+ * @param {XYCoords} size - The x/y-size of the square.
574
671
  * @param {string} color - The CSS color to draw the square with.
575
672
  * @return {void}
576
673
  * @instance
577
674
  * @memberof drawutilssvg
578
675
  */
579
- squareHandle(center: Vertex, size: number, color: string): SVGElement;
676
+ squareHandle(center: XYCoords, size: number, color: string): SVGElement;
580
677
  /**
581
678
  * Draw a circle handle with the given CSS color.<br>
582
679
  * <br>
@@ -585,14 +682,14 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
585
682
  * as even shaped circles.
586
683
  *
587
684
  * @method circleHandle
588
- * @param {Vertex} center - The center of the circle.
685
+ * @param {XYCoords} center - The center of the circle.
589
686
  * @param {number} radius - The radius of the circle.
590
687
  * @param {string} color - The CSS color to draw the circle with.
591
688
  * @return {void}
592
689
  * @instance
593
690
  * @memberof drawutilssvg
594
691
  */
595
- circleHandle(center: Vertex, radius: number, color: string): SVGElement;
692
+ circleHandle(center: XYCoords, radius: number, color: string): SVGElement;
596
693
  /**
597
694
  * Draw a crosshair with given radius and color at the given position.<br>
598
695
  * <br>
@@ -639,15 +736,17 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
639
736
  * Draw a polygon line (alternative function to the polygon).
640
737
  *
641
738
  * @method polyline
642
- * @param {Vertex[]} vertices - The polygon vertices to draw.
739
+ * @param {XYCoords[]} vertices - The polygon vertices to draw.
643
740
  * @param {boolan} isOpen - If true the polyline will not be closed at its end.
644
741
  * @param {string} color - The CSS color to draw the polygon with.
645
742
  * @param {number=} lineWidth - (optional) The line width to use; default is 1.
743
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
744
+ *
646
745
  * @return {void}
647
746
  * @instance
648
747
  * @memberof drawutilssvg
649
748
  */
650
- polyline(vertices: Array<Vertex>, isOpen: boolean, color: string, lineWidth?: number): SVGElement;
749
+ polyline(vertices: Array<XYCoords>, isOpen: boolean, color: string, lineWidth?: number, strokeOptions?: StrokeOptions): SVGElement;
651
750
  /**
652
751
  * Draw a text at the given relative position.
653
752
  *
@@ -699,13 +798,16 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
699
798
  * @param {string=null} color - (optional) The color to draw this path with (default is null).
700
799
  * @param {number=1} lineWidth - (optional) the line width to use (default is 1).
701
800
  * @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.
801
+ * @param {number=} options.dashOffset - (optional) `See StrokeOptions`.
802
+ * @param {number=[]} options.dashArray - (optional) `See StrokeOptions`.
803
+ *
702
804
  * @instance
703
805
  * @memberof drawutils
704
806
  * @return {R} An instance representing the drawn path.
705
807
  */
706
808
  path(pathData: SVGPathParams, color?: string, lineWidth?: number, options?: {
707
809
  inplace?: boolean;
708
- }): SVGElement;
810
+ } & StrokeOptions): SVGElement;
709
811
  /**
710
812
  * Due to gl compatibility there is a generic 'clear' function required
711
813
  * to avoid accessing the context object itself directly.
@@ -753,4 +855,75 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
753
855
  * @param {XYCoords} scale - The scale factors (neutral is x=1, y=1).
754
856
  */
755
857
  static transformPathData(data: SVGPathParams, offset: XYCoords, scale: XYCoords): void;
858
+ private static nodeSupportsLineDash;
859
+ /**
860
+ * Creates a basic <line> node with start and end coordinates. The created node will not
861
+ * be bound to any root node.
862
+ *
863
+ * @private
864
+ * @method makeLineNode
865
+ * @param {XYCoords} zA - The line's start position.
866
+ * @param {XYCoords} zB - The line's start position.
867
+ * @param {string} color - The CSS color to draw the point with.
868
+ * @param {number=1} lineWidth - (optional) The line width to use.
869
+ * @param {StrokeOptions=} strokeOptions - (optional) Additional stroke options to use.
870
+ * @param {string=} classNameOverride - (optional) If nothing is passed the default classname 'path' will be used.
871
+ * @return {SVGLineElement}
872
+ * @instance
873
+ * @memberof drawutilssvg
874
+ */
875
+ private makeLineNode;
876
+ /**
877
+ * Creates a basic <path> node with given path string data. The created node will not
878
+ * be bound to any root node.
879
+ *
880
+ * @private
881
+ * @method makePathNode
882
+ * @param {string} pathString - The path data (must be a valid path data string).
883
+ * @param {string} color - The CSS color to draw the point with.
884
+ * @param {number=1} lineWidth - (optional) The line width to use.
885
+ * @param {StrokeOptions=} strokeOptions - (optional) Additional stroke options to use.
886
+ * @param {string=} classNameOverride - (optional) If nothing is passed the default classname 'path' will be used.
887
+ * @return {SVGPathElement}
888
+ * @instance
889
+ * @memberof drawutilssvg
890
+ */
891
+ private makePathNode;
892
+ /**
893
+ * Creates a basic arrow head node (<path> node) at the end of the given line coordinates. The created node will not
894
+ * be bound to any root node.
895
+ *
896
+ * @private
897
+ * @method makeArrowHeadNode
898
+ * @param {string} pathString - The path data (must be a valid path data string).
899
+ * @param {string} color - The CSS color to draw the point with.
900
+ * @param {number=1} lineWidth - (optional) The line width to use.
901
+ * @param {number=8} headLength - (optional) The length of the arrow head; if none is specified then the head will be 8 absolute units long.
902
+ * @param {StrokeOptions=} strokeOptions - (optional) Additional stroke options to use.
903
+ * @param {XYCoords=} arrowHeadBasePositionBuffer - (optional) If not null, then this position will contain the arrow head's start point (after execution). Some sort of OUT variable.
904
+ * @return {SVGPathElement}
905
+ * @instance
906
+ * @memberof drawutilssvg
907
+ */
908
+ private makeArrowHeadNode;
909
+ /**
910
+ * Creates a basic cubic Bézier path node (<path> node) with the given cubic Bézier data. The created node will not
911
+ * be bound to any root node.
912
+ *
913
+ * @private
914
+ * @method makeCubicBezierNode
915
+ * @param {XYCoords} startPoint - The start point of the cubic Bézier curve
916
+ * @param {XYCoords} endPoint - The end point the cubic Bézier curve.
917
+ * @param {XYCoords} startControlPoint - The start control point the cubic Bézier curve.
918
+ * @param {XYCoords} endControlPoint - The end control point the cubic Bézier curve.
919
+ * @param {string} color - The CSS color to draw the point with.
920
+ * @param {number=1} lineWidth - (optional) The line width to use.
921
+ * @param {StrokeOptions=} strokeOptions - (optional) Additional stroke options to use.
922
+ * @param {string=} classNameOverride - (optional) If nothing is passed the default classname 'path' will be used.
923
+ * @param {XYCoords=} arrowHeadBasePositionBuffer - (optional) If not null, then this position will contain the arrow head's start point (after execution). Some sort of OUT variable.
924
+ * @return {SVGPathElement}
925
+ * @instance
926
+ * @memberof drawutilssvg
927
+ */
928
+ private makeCubicBezierNode;
756
929
  }