plotboilerplate 1.20.1 → 1.21.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 (141) hide show
  1. package/README.md +17 -1
  2. package/dist/index.esm.js +2065 -1397
  3. package/dist/index.esm.js.map +1 -1
  4. package/dist/index.esm.min.js +1 -1
  5. package/dist/index.esm.min.js.map +1 -1
  6. package/dist/plotboilerplate.browser.min.js +1 -1
  7. package/dist/plotboilerplate.browser.min.js.map +1 -1
  8. package/dist/plotboilerplate.js +1265 -584
  9. package/dist/plotboilerplate.min.js +1 -1
  10. package/package.json +2 -1
  11. package/src/cjs/BezierPath.d.ts +27 -49
  12. package/src/cjs/BezierPath.js +69 -237
  13. package/src/cjs/BezierPath.js.map +1 -1
  14. package/src/cjs/Bounds.d.ts +14 -1
  15. package/src/cjs/Bounds.js +21 -1
  16. package/src/cjs/Bounds.js.map +1 -1
  17. package/src/cjs/CubicBezierCurve.d.ts +70 -1
  18. package/src/cjs/CubicBezierCurve.js +130 -12
  19. package/src/cjs/CubicBezierCurve.js.map +1 -1
  20. package/src/cjs/Line.d.ts +2 -1
  21. package/src/cjs/Line.js +1 -0
  22. package/src/cjs/Line.js.map +1 -1
  23. package/src/cjs/PBText.d.ts +2 -1
  24. package/src/cjs/PBText.js +10 -9
  25. package/src/cjs/PBText.js.map +1 -1
  26. package/src/cjs/PlotBoilerplate.d.ts +10 -13
  27. package/src/cjs/PlotBoilerplate.js +136 -47
  28. package/src/cjs/PlotBoilerplate.js.map +1 -1
  29. package/src/cjs/Polygon.d.ts +35 -1
  30. package/src/cjs/Polygon.js +87 -1
  31. package/src/cjs/Polygon.js.map +1 -1
  32. package/src/cjs/Triangle.js +1 -0
  33. package/src/cjs/Triangle.js.map +1 -1
  34. package/src/cjs/VEllipse.js +1 -1
  35. package/src/cjs/VEllipse.js.map +1 -1
  36. package/src/cjs/Vector.d.ts +4 -4
  37. package/src/cjs/Vector.js +2 -2
  38. package/src/cjs/Vector.js.map +1 -1
  39. package/src/cjs/VertTuple.d.ts +2 -1
  40. package/src/cjs/VertTuple.js +4 -3
  41. package/src/cjs/VertTuple.js.map +1 -1
  42. package/src/cjs/Vertex.d.ts +14 -3
  43. package/src/cjs/Vertex.js +18 -3
  44. package/src/cjs/Vertex.js.map +1 -1
  45. package/src/cjs/draw.d.ts +159 -79
  46. package/src/cjs/draw.js +311 -139
  47. package/src/cjs/draw.js.map +1 -1
  48. package/src/cjs/drawgl.d.ts +93 -55
  49. package/src/cjs/drawgl.js +90 -34
  50. package/src/cjs/drawgl.js.map +1 -1
  51. package/src/cjs/drawutilssvg.d.ts +233 -58
  52. package/src/cjs/drawutilssvg.js +384 -95
  53. package/src/cjs/drawutilssvg.js.map +1 -1
  54. package/src/cjs/interfaces/DrawLib.d.ts +161 -82
  55. package/src/cjs/interfaces/DrawLib.js +7 -0
  56. package/src/cjs/interfaces/DrawLib.js.map +1 -1
  57. package/src/cjs/interfaces/core.d.ts +46 -32
  58. package/src/cjs/interfaces/core.js +2 -0
  59. package/src/cjs/interfaces/core.js.map +1 -1
  60. package/src/cjs/utils/creategui.js +16 -10
  61. package/src/cjs/utils/datastructures/Color.d.ts +3 -1
  62. package/src/cjs/utils/datastructures/Color.js +12 -1
  63. package/src/cjs/utils/datastructures/Color.js.map +1 -1
  64. package/src/cjs/utils/detectDarkMode.d.ts +10 -0
  65. package/src/cjs/utils/detectDarkMode.js +32 -0
  66. package/src/cjs/utils/detectDarkMode.js.map +1 -0
  67. package/src/cjs/utils/module.js +4 -2
  68. package/src/esm/BezierPath.d.ts +27 -49
  69. package/src/esm/BezierPath.js +69 -237
  70. package/src/esm/BezierPath.js.map +1 -1
  71. package/src/esm/Bounds.d.ts +14 -1
  72. package/src/esm/Bounds.js +19 -1
  73. package/src/esm/Bounds.js.map +1 -1
  74. package/src/esm/CubicBezierCurve.d.ts +70 -1
  75. package/src/esm/CubicBezierCurve.js +130 -12
  76. package/src/esm/CubicBezierCurve.js.map +1 -1
  77. package/src/esm/Line.d.ts +2 -1
  78. package/src/esm/Line.js +1 -0
  79. package/src/esm/Line.js.map +1 -1
  80. package/src/esm/PBText.d.ts +2 -1
  81. package/src/esm/PBText.js +10 -9
  82. package/src/esm/PBText.js.map +1 -1
  83. package/src/esm/PlotBoilerplate.d.ts +10 -13
  84. package/src/esm/PlotBoilerplate.js +136 -48
  85. package/src/esm/PlotBoilerplate.js.map +1 -1
  86. package/src/esm/Polygon.d.ts +35 -1
  87. package/src/esm/Polygon.js +85 -1
  88. package/src/esm/Polygon.js.map +1 -1
  89. package/src/esm/Triangle.js +1 -0
  90. package/src/esm/Triangle.js.map +1 -1
  91. package/src/esm/VEllipse.js +1 -1
  92. package/src/esm/VEllipse.js.map +1 -1
  93. package/src/esm/Vector.d.ts +4 -4
  94. package/src/esm/Vector.js +2 -2
  95. package/src/esm/Vector.js.map +1 -1
  96. package/src/esm/VertTuple.d.ts +2 -1
  97. package/src/esm/VertTuple.js +4 -3
  98. package/src/esm/VertTuple.js.map +1 -1
  99. package/src/esm/Vertex.d.ts +14 -3
  100. package/src/esm/Vertex.js +18 -3
  101. package/src/esm/Vertex.js.map +1 -1
  102. package/src/esm/draw.d.ts +159 -79
  103. package/src/esm/draw.js +307 -137
  104. package/src/esm/draw.js.map +1 -1
  105. package/src/esm/drawgl.d.ts +93 -55
  106. package/src/esm/drawgl.js +90 -34
  107. package/src/esm/drawgl.js.map +1 -1
  108. package/src/esm/drawutilssvg.d.ts +233 -58
  109. package/src/esm/drawutilssvg.js +379 -95
  110. package/src/esm/drawutilssvg.js.map +1 -1
  111. package/src/esm/interfaces/DrawLib.d.ts +161 -82
  112. package/src/esm/interfaces/DrawLib.js +7 -0
  113. package/src/esm/interfaces/DrawLib.js.map +1 -1
  114. package/src/esm/interfaces/core.d.ts +46 -32
  115. package/src/esm/interfaces/core.js +2 -0
  116. package/src/esm/interfaces/core.js.map +1 -1
  117. package/src/esm/utils/datastructures/Color.d.ts +3 -1
  118. package/src/esm/utils/datastructures/Color.js +12 -1
  119. package/src/esm/utils/datastructures/Color.js.map +1 -1
  120. package/src/esm/utils/detectDarkMode.d.ts +10 -0
  121. package/src/esm/utils/detectDarkMode.js +28 -0
  122. package/src/esm/utils/detectDarkMode.js.map +1 -0
  123. package/src/ts/BezierPath.ts +74 -244
  124. package/src/ts/Bounds.ts +25 -1
  125. package/src/ts/CubicBezierCurve.ts +139 -12
  126. package/src/ts/Line.ts +2 -1
  127. package/src/ts/PBText.ts +10 -9
  128. package/src/ts/PlotBoilerplate.ts +130 -50
  129. package/src/ts/Polygon.ts +91 -1
  130. package/src/ts/Triangle.ts +2 -1
  131. package/src/ts/VEllipse.ts +2 -2
  132. package/src/ts/Vector.ts +4 -4
  133. package/src/ts/VertTuple.ts +4 -3
  134. package/src/ts/Vertex.ts +20 -4
  135. package/src/ts/draw.ts +316 -119
  136. package/src/ts/drawgl.ts +141 -78
  137. package/src/ts/drawutilssvg.ts +562 -133
  138. package/src/ts/interfaces/DrawLib.ts +223 -86
  139. package/src/ts/interfaces/core.ts +47 -32
  140. package/src/ts/utils/datastructures/Color.ts +13 -1
  141. package/src/ts/utils/detectDarkMode.ts +30 -0
@@ -35,11 +35,21 @@
35
35
  * @modified 2022-03-26 Added the `texturedPoly` function to draw textures polygons.
36
36
  * @modified 2022-07-26 Adding `alpha` to the `image(...)` function.
37
37
  * @modified 2022-11-10 Tweaking some type issues.
38
- * @version 1.6.2
38
+ * @modified 2023-02-04 Fixed a typo in the CSS classname for cubic Bézier paths: cubicBezier (was cubierBezier).
39
+ * @modified 2023-02-10 The methods `setCurrentClassName` and `setCurrentId` also accept `null` now.
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
39
49
  **/
40
50
  import { Polygon } from "./Polygon";
41
51
  import { Vertex } from "./Vertex";
42
- 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";
43
53
  import { Bounds } from "./Bounds";
44
54
  /**
45
55
  * @classdesc A helper class for basic SVG drawing operations. This class should
@@ -128,7 +138,7 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
128
138
  /**
129
139
  * The current drawable-ID. This can be any unique ID identifying the following drawn element.
130
140
  *
131
- * @member {UID|undefined}
141
+ * @member {UID|null}
132
142
  * @memberof drawutilssvg
133
143
  * @instance
134
144
  */
@@ -240,6 +250,33 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
240
250
  * @return {SVGElement} The node itself (for chaining).
241
251
  */
242
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;
243
280
  /**
244
281
  * Sets the size and view box of the document. Call this if canvas size changes.
245
282
  *
@@ -268,22 +305,22 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
268
305
  *
269
306
  * @name setCurrentId
270
307
  * @method
271
- * @param {UID} uid - A UID identifying the currently drawn element(s).
308
+ * @param {UID|null} uid - A UID identifying the currently drawn element(s).
272
309
  * @instance
273
310
  * @memberof drawutilssvg
274
311
  **/
275
- setCurrentId(uid: UID | undefined): void;
312
+ setCurrentId(uid: UID | null): void;
276
313
  /**
277
314
  * This method shouled be called each time the currently drawn `Drawable` changes.
278
315
  * Determine the class name for further usage here.
279
316
  *
280
317
  * @name setCurrentClassName
281
318
  * @method
282
- * @param {string} className - A class name for further custom use cases.
319
+ * @param {string|null} className - A class name for further custom use cases.
283
320
  * @instance
284
321
  * @memberof drawutilssvg
285
322
  **/
286
- setCurrentClassName(className: string | undefined): void;
323
+ setCurrentClassName(className: string | null): void;
287
324
  /**
288
325
  * Called before each draw cycle.
289
326
  * This is required for compatibility with other draw classes in the library.
@@ -306,34 +343,79 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
306
343
  * @instance
307
344
  **/
308
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;
309
352
  private _x;
310
353
  private _y;
311
354
  /**
312
355
  * Draw the line between the given two points with the specified (CSS-) color.
313
356
  *
314
357
  * @method line
315
- * @param {Vertex} zA - The start point of the line.
316
- * @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.
317
360
  * @param {string} color - Any valid CSS color string.
318
361
  * @param {number=1} lineWidth? - [optional] The line's width.
362
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
363
+ *
319
364
  * @return {void}
320
365
  * @instance
321
366
  * @memberof drawutilssvg
322
367
  **/
323
- line(zA: Vertex, zB: Vertex, color: string, lineWidth?: number): SVGElement;
368
+ line(zA: XYCoords, zB: XYCoords, color: string, lineWidth?: number, strokeOptions?: StrokeOptions): SVGElement;
324
369
  /**
325
370
  * Draw a line and an arrow at the end (zB) of the given line with the specified (CSS-) color.
326
371
  *
327
372
  * @method arrow
328
- * @param {Vertex} zA - The start point of the arrow-line.
329
- * @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.
330
375
  * @param {string} color - Any valid CSS color string.
331
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
+ *
332
380
  * @return {void}
333
381
  * @instance
334
382
  * @memberof drawutilssvg
335
383
  **/
336
- 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;
337
419
  /**
338
420
  * Draw an image at the given position with the given size.<br>
339
421
  * <br>
@@ -341,14 +423,14 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
341
423
  *
342
424
  * @method image
343
425
  * @param {Image} image - The image object to draw.
344
- * @param {Vertex} position - The position to draw the the upper left corner at.
345
- * @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.
346
428
  * @param {number=0.0} alpha - (optional, default=0.0) The transparency (1.0=opaque, 0.0=transparent).
347
429
  * @return {void}
348
430
  * @instance
349
431
  * @memberof drawutilssvg
350
432
  **/
351
- image(image: HTMLImageElement, position: Vertex, size: Vertex, alpha?: number): SVGElement;
433
+ image(image: HTMLImageElement, position: XYCoords, size: XYCoords, alpha?: number): SVGElement;
352
434
  /**
353
435
  * Draw an image at the given position with the given size.<br>
354
436
  * <br>
@@ -358,28 +440,30 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
358
440
  * @param {Image} textureImage - The image object to draw.
359
441
  * @param {Bounds} textureSize - The texture size to use; these are the original bounds to map the polygon vertices to.
360
442
  * @param {Polygon} polygon - The polygon to use as clip path.
361
- * @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.
362
444
  * @param {number} rotation - The rotation to use for the polygon (and for the texture).
363
445
  * @return {void}
364
446
  * @instance
365
447
  * @memberof drawutilssvg
366
448
  **/
367
- 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;
368
450
  /**
369
451
  * Draw the given (cubic) bézier curve.
370
452
  *
371
453
  * @method cubicBezier
372
- * @param {Vertex} startPoint - The start point of the cubic Bézier curve
373
- * @param {Vertex} endPoint - The end point the cubic Bézier curve.
374
- * @param {Vertex} startControlPoint - The start control point the cubic Bézier curve.
375
- * @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.
376
458
  * @param {string} color - The CSS color to draw the curve with.
377
459
  * @param {number} lineWidth - (optional) The line width to use.
460
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
461
+ *
378
462
  * @return {void}
379
463
  * @instance
380
464
  * @memberof drawutilssvg
381
465
  */
382
- 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;
383
467
  /**
384
468
  * Draw the given (cubic) Bézier path.
385
469
  *
@@ -388,14 +472,16 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
388
472
  * <pre> [ point1, point1_startControl, point2_endControl, point2, point2_startControl, point3_endControl, point3, ... pointN_endControl, pointN ]</pre>
389
473
  *
390
474
  * @method cubicBezierPath
391
- * @param {Vertex[]} path - The cubic bezier path as described above.
475
+ * @param {XYCoords[]} path - The cubic bezier path as described above.
392
476
  * @param {string} color - The CSS colot to draw the path with.
393
477
  * @param {number=1} lineWidth - (optional) The line width to use.
478
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
479
+ *
394
480
  * @return {void}
395
481
  * @instance
396
482
  * @memberof drawutilssvg
397
483
  */
398
- cubicBezierPath(path: Array<Vertex>, color: string, lineWidth?: number): SVGElement;
484
+ cubicBezierPath(path: Array<XYCoords>, color: string, lineWidth?: number, strokeOptions?: StrokeOptions): SVGElement;
399
485
  /**
400
486
  * Draw the given handle and handle point (used to draw interactive Bézier curves).
401
487
  *
@@ -408,84 +494,90 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
408
494
  * @instance
409
495
  * @memberof drawutilssvg
410
496
  */
411
- handle(startPoint: Vertex, endPoint: Vertex): void;
497
+ handle(startPoint: XYCoords, endPoint: XYCoords): void;
412
498
  /**
413
499
  * Draw a handle line (with a light grey).
414
500
  *
415
501
  * @method handleLine
416
- * @param {Vertex} startPoint - The start point to draw the handle at.
417
- * @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.
418
504
  * @return {void}
419
505
  * @instance
420
506
  * @memberof drawutilssvg
421
507
  */
422
- handleLine(startPoint: Vertex, endPoint: Vertex): void;
508
+ handleLine(startPoint: XYCoords, endPoint: XYCoords): void;
423
509
  /**
424
510
  * Draw a 1x1 dot with the specified (CSS-) color.
425
511
  *
426
512
  * @method dot
427
- * @param {Vertex} p - The position to draw the dot at.
513
+ * @param {XYCoords} p - The position to draw the dot at.
428
514
  * @param {string} color - The CSS color to draw the dot with.
429
515
  * @return {void}
430
516
  * @instance
431
517
  * @memberof drawutilssvg
432
518
  */
433
- dot(p: Vertex, color: string): SVGElement;
519
+ dot(p: XYCoords, color: string): SVGElement;
434
520
  /**
435
521
  * Draw the given point with the specified (CSS-) color and radius 3.
436
522
  *
437
523
  * @method point
438
- * @param {Vertex} p - The position to draw the point at.
524
+ * @param {XYCoords} p - The position to draw the point at.
439
525
  * @param {string} color - The CSS color to draw the point with.
440
526
  * @return {void}
441
527
  * @instance
442
528
  * @memberof drawutilssvg
443
529
  */
444
- point(p: Vertex, color: string): SVGElement;
530
+ point(p: XYCoords, color: string): SVGElement;
445
531
  /**
446
532
  * Draw a circle with the specified (CSS-) color and radius.<br>
447
533
  * <br>
448
534
  * Note that if the x- and y- scales are different the result will be an ellipse rather than a circle.
449
535
  *
450
536
  * @method circle
451
- * @param {Vertex} center - The center of the circle.
537
+ * @param {XYCoords} center - The center of the circle.
452
538
  * @param {number} radius - The radius of the circle.
453
539
  * @param {string} color - The CSS color to draw the circle with.
454
540
  * @param {number=} lineWidth - (optional) The line width to use; default is 1.
541
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
542
+ *
455
543
  * @return {void}
456
544
  * @instance
457
545
  * @memberof drawutilssvg
458
546
  */
459
- circle(center: Vertex, radius: number, color: string, lineWidth?: number): SVGElement;
547
+ circle(center: XYCoords, radius: number, color: string, lineWidth?: number, strokeOptions?: StrokeOptions): SVGElement;
460
548
  /**
461
549
  * Draw a circular arc (section of a circle) with the given CSS color.
462
550
  *
463
551
  * @method circleArc
464
- * @param {Vertex} center - The center of the circle.
552
+ * @param {XYCoords} center - The center of the circle.
465
553
  * @param {number} radius - The radius of the circle.
466
554
  * @param {number} startAngle - The angle to start at.
467
555
  * @param {number} endAngle - The angle to end at.
468
556
  * @param {string} color - The CSS color to draw the circle with.
557
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
558
+ *
469
559
  * @return {void}
470
560
  * @instance
471
561
  * @memberof drawutilssvg
472
562
  */
473
- 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;
474
564
  /**
475
565
  * Draw an ellipse with the specified (CSS-) color and thw two radii.
476
566
  *
477
567
  * @method ellipse
478
- * @param {Vertex} center - The center of the ellipse.
568
+ * @param {XYCoords} center - The center of the ellipse.
479
569
  * @param {number} radiusX - The radius of the ellipse.
480
570
  * @param {number} radiusY - The radius of the ellipse.
481
571
  * @param {string} color - The CSS color to draw the ellipse with.
482
572
  * @param {number=} lineWidth - (optional) The line width to use; default is 1.
483
573
  * @param {number=} rotation - (optional, default=0) The rotation of the ellipse.
574
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
575
+ *
484
576
  * @return {void}
485
577
  * @instance
486
578
  * @memberof drawutilssvg
487
579
  */
488
- 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;
489
581
  /**
490
582
  * Draw square at the given center, size and with the specified (CSS-) color.<br>
491
583
  * <br>
@@ -493,14 +585,16 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
493
585
  *
494
586
  * @method square
495
587
  * @param {XYCoords} center - The center of the square.
496
- * @param {Vertex} size - The size of the square.
588
+ * @param {number} size - The size of the square.
497
589
  * @param {string} color - The CSS color to draw the square with.
498
590
  * @param {number=} lineWidth - (optional) The line width to use; default is 1.
499
- * @return {void}
591
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
592
+ *
593
+ * @return {SVGElement}
500
594
  * @instance
501
595
  * @memberof drawutilssvg
502
596
  */
503
- square(center: XYCoords, size: number, color: string, lineWidth?: number): SVGElement;
597
+ square(center: XYCoords, size: number, color: string, lineWidth?: number, strokeOptions?: StrokeOptions): SVGElement;
504
598
  /**
505
599
  * Draw a rectangle.
506
600
  *
@@ -509,13 +603,18 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
509
603
  * @param {number} height - The height of the rectangle.
510
604
  * @param {string} color - The color to use.
511
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
512
611
  **/
513
- 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;
514
613
  /**
515
614
  * Draw a grid of horizontal and vertical lines with the given (CSS-) color.
516
615
  *
517
616
  * @method grid
518
- * @param {Vertex} center - The center of the grid.
617
+ * @param {XYCoords} center - The center of the grid.
519
618
  * @param {number} width - The total width of the grid (width/2 each to the left and to the right).
520
619
  * @param {number} height - The total height of the grid (height/2 each to the top and to the bottom).
521
620
  * @param {number} sizeX - The horizontal grid size.
@@ -525,14 +624,14 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
525
624
  * @instance
526
625
  * @memberof drawutilssvg
527
626
  */
528
- 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;
529
628
  /**
530
629
  * Draw a raster of crosshairs in the given grid.<br>
531
630
  *
532
631
  * This works analogue to the grid() function
533
632
  *
534
633
  * @method raster
535
- * @param {Vertex} center - The center of the raster.
634
+ * @param {XYCoords} center - The center of the raster.
536
635
  * @param {number} width - The total width of the raster (width/2 each to the left and to the right).
537
636
  * @param {number} height - The total height of the raster (height/2 each to the top and to the bottom).
538
637
  * @param {number} sizeX - The horizontal raster size.
@@ -542,7 +641,7 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
542
641
  * @instance
543
642
  * @memberof drawutilssvg
544
643
  */
545
- 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;
546
645
  /**
547
646
  * Draw a diamond handle (square rotated by 45°) with the given CSS color.
548
647
  *
@@ -551,14 +650,14 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
551
650
  * as even shaped diamonds.
552
651
  *
553
652
  * @method diamondHandle
554
- * @param {Vertex} center - The center of the diamond.
555
- * @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.
556
655
  * @param {string} color - The CSS color to draw the diamond with.
557
656
  * @return {void}
558
657
  * @instance
559
658
  * @memberof drawutilssvg
560
659
  */
561
- diamondHandle(center: Vertex, size: number, color: string): SVGElement;
660
+ diamondHandle(center: XYCoords, size: number, color: string): SVGElement;
562
661
  /**
563
662
  * Draw a square handle with the given CSS color.<br>
564
663
  * <br>
@@ -567,14 +666,14 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
567
666
  * as even shaped squares.
568
667
  *
569
668
  * @method squareHandle
570
- * @param {Vertex} center - The center of the square.
571
- * @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.
572
671
  * @param {string} color - The CSS color to draw the square with.
573
672
  * @return {void}
574
673
  * @instance
575
674
  * @memberof drawutilssvg
576
675
  */
577
- squareHandle(center: Vertex, size: number, color: string): SVGElement;
676
+ squareHandle(center: XYCoords, size: number, color: string): SVGElement;
578
677
  /**
579
678
  * Draw a circle handle with the given CSS color.<br>
580
679
  * <br>
@@ -583,14 +682,14 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
583
682
  * as even shaped circles.
584
683
  *
585
684
  * @method circleHandle
586
- * @param {Vertex} center - The center of the circle.
685
+ * @param {XYCoords} center - The center of the circle.
587
686
  * @param {number} radius - The radius of the circle.
588
687
  * @param {string} color - The CSS color to draw the circle with.
589
688
  * @return {void}
590
689
  * @instance
591
690
  * @memberof drawutilssvg
592
691
  */
593
- circleHandle(center: Vertex, radius: number, color: string): SVGElement;
692
+ circleHandle(center: XYCoords, radius: number, color: string): SVGElement;
594
693
  /**
595
694
  * Draw a crosshair with given radius and color at the given position.<br>
596
695
  * <br>
@@ -637,15 +736,17 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
637
736
  * Draw a polygon line (alternative function to the polygon).
638
737
  *
639
738
  * @method polyline
640
- * @param {Vertex[]} vertices - The polygon vertices to draw.
739
+ * @param {XYCoords[]} vertices - The polygon vertices to draw.
641
740
  * @param {boolan} isOpen - If true the polyline will not be closed at its end.
642
741
  * @param {string} color - The CSS color to draw the polygon with.
643
742
  * @param {number=} lineWidth - (optional) The line width to use; default is 1.
743
+ * @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
744
+ *
644
745
  * @return {void}
645
746
  * @instance
646
747
  * @memberof drawutilssvg
647
748
  */
648
- 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;
649
750
  /**
650
751
  * Draw a text at the given relative position.
651
752
  *
@@ -697,13 +798,16 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
697
798
  * @param {string=null} color - (optional) The color to draw this path with (default is null).
698
799
  * @param {number=1} lineWidth - (optional) the line width to use (default is 1).
699
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
+ *
700
804
  * @instance
701
805
  * @memberof drawutils
702
806
  * @return {R} An instance representing the drawn path.
703
807
  */
704
808
  path(pathData: SVGPathParams, color?: string, lineWidth?: number, options?: {
705
809
  inplace?: boolean;
706
- }): SVGElement;
810
+ } & StrokeOptions): SVGElement;
707
811
  /**
708
812
  * Due to gl compatibility there is a generic 'clear' function required
709
813
  * to avoid accessing the context object itself directly.
@@ -751,4 +855,75 @@ export declare class drawutilssvg implements DrawLib<void | SVGElement> {
751
855
  * @param {XYCoords} scale - The scale factors (neutral is x=1, y=1).
752
856
  */
753
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;
754
929
  }