plotboilerplate 1.20.2 → 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.
- package/dist/index.esm.js +1985 -1368
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/plotboilerplate.browser.min.js +1 -1
- package/dist/plotboilerplate.browser.min.js.map +1 -1
- package/dist/plotboilerplate.js +1170 -541
- package/dist/plotboilerplate.min.js +1 -1
- package/package.json +1 -1
- package/src/cjs/BezierPath.d.ts +27 -49
- package/src/cjs/BezierPath.js +67 -234
- package/src/cjs/BezierPath.js.map +1 -1
- package/src/cjs/Bounds.d.ts +14 -1
- package/src/cjs/Bounds.js +21 -1
- package/src/cjs/Bounds.js.map +1 -1
- package/src/cjs/CubicBezierCurve.d.ts +70 -1
- package/src/cjs/CubicBezierCurve.js +130 -12
- package/src/cjs/CubicBezierCurve.js.map +1 -1
- package/src/cjs/Line.d.ts +2 -1
- package/src/cjs/Line.js +1 -0
- package/src/cjs/Line.js.map +1 -1
- package/src/cjs/PBText.d.ts +2 -1
- package/src/cjs/PBText.js +10 -9
- package/src/cjs/PBText.js.map +1 -1
- package/src/cjs/PlotBoilerplate.d.ts +4 -13
- package/src/cjs/PlotBoilerplate.js +61 -15
- package/src/cjs/PlotBoilerplate.js.map +1 -1
- package/src/cjs/Polygon.d.ts +35 -1
- package/src/cjs/Polygon.js +87 -1
- package/src/cjs/Polygon.js.map +1 -1
- package/src/cjs/VEllipse.js +1 -1
- package/src/cjs/VEllipse.js.map +1 -1
- package/src/cjs/Vector.d.ts +4 -4
- package/src/cjs/Vector.js +2 -2
- package/src/cjs/Vector.js.map +1 -1
- package/src/cjs/VertTuple.d.ts +2 -1
- package/src/cjs/VertTuple.js +4 -3
- package/src/cjs/VertTuple.js.map +1 -1
- package/src/cjs/Vertex.d.ts +14 -3
- package/src/cjs/Vertex.js +18 -3
- package/src/cjs/Vertex.js.map +1 -1
- package/src/cjs/draw.d.ts +154 -75
- package/src/cjs/draw.js +308 -137
- package/src/cjs/draw.js.map +1 -1
- package/src/cjs/drawgl.d.ts +87 -50
- package/src/cjs/drawgl.js +86 -31
- package/src/cjs/drawgl.js.map +1 -1
- package/src/cjs/drawutilssvg.d.ts +226 -53
- package/src/cjs/drawutilssvg.js +374 -92
- package/src/cjs/drawutilssvg.js.map +1 -1
- package/src/cjs/interfaces/DrawLib.d.ts +157 -79
- package/src/cjs/interfaces/DrawLib.js +6 -0
- package/src/cjs/interfaces/DrawLib.js.map +1 -1
- package/src/cjs/interfaces/core.d.ts +13 -2
- package/src/cjs/interfaces/core.js +1 -0
- package/src/cjs/interfaces/core.js.map +1 -1
- package/src/cjs/utils/creategui.js +16 -10
- package/src/cjs/utils/detectDarkMode.d.ts +10 -0
- package/src/cjs/utils/detectDarkMode.js +32 -0
- package/src/cjs/utils/detectDarkMode.js.map +1 -0
- package/src/esm/BezierPath.d.ts +27 -49
- package/src/esm/BezierPath.js +67 -234
- package/src/esm/BezierPath.js.map +1 -1
- package/src/esm/Bounds.d.ts +14 -1
- package/src/esm/Bounds.js +19 -1
- package/src/esm/Bounds.js.map +1 -1
- package/src/esm/CubicBezierCurve.d.ts +70 -1
- package/src/esm/CubicBezierCurve.js +130 -12
- package/src/esm/CubicBezierCurve.js.map +1 -1
- package/src/esm/Line.d.ts +2 -1
- package/src/esm/Line.js +1 -0
- package/src/esm/Line.js.map +1 -1
- package/src/esm/PBText.d.ts +2 -1
- package/src/esm/PBText.js +10 -9
- package/src/esm/PBText.js.map +1 -1
- package/src/esm/PlotBoilerplate.d.ts +4 -13
- package/src/esm/PlotBoilerplate.js +62 -16
- package/src/esm/PlotBoilerplate.js.map +1 -1
- package/src/esm/Polygon.d.ts +35 -1
- package/src/esm/Polygon.js +85 -1
- package/src/esm/Polygon.js.map +1 -1
- package/src/esm/VEllipse.js +1 -1
- package/src/esm/VEllipse.js.map +1 -1
- package/src/esm/Vector.d.ts +4 -4
- package/src/esm/Vector.js +2 -2
- package/src/esm/Vector.js.map +1 -1
- package/src/esm/VertTuple.d.ts +2 -1
- package/src/esm/VertTuple.js +4 -3
- package/src/esm/VertTuple.js.map +1 -1
- package/src/esm/Vertex.d.ts +14 -3
- package/src/esm/Vertex.js +18 -3
- package/src/esm/Vertex.js.map +1 -1
- package/src/esm/draw.d.ts +154 -75
- package/src/esm/draw.js +304 -135
- package/src/esm/draw.js.map +1 -1
- package/src/esm/drawgl.d.ts +87 -50
- package/src/esm/drawgl.js +86 -31
- package/src/esm/drawgl.js.map +1 -1
- package/src/esm/drawutilssvg.d.ts +226 -53
- package/src/esm/drawutilssvg.js +369 -92
- package/src/esm/drawutilssvg.js.map +1 -1
- package/src/esm/interfaces/DrawLib.d.ts +157 -79
- package/src/esm/interfaces/DrawLib.js +6 -0
- package/src/esm/interfaces/DrawLib.js.map +1 -1
- package/src/esm/interfaces/core.d.ts +13 -2
- package/src/esm/interfaces/core.js +1 -0
- package/src/esm/interfaces/core.js.map +1 -1
- package/src/esm/utils/detectDarkMode.d.ts +10 -0
- package/src/esm/utils/detectDarkMode.js +28 -0
- package/src/esm/utils/detectDarkMode.js.map +1 -0
- package/src/ts/BezierPath.ts +72 -241
- package/src/ts/Bounds.ts +25 -1
- package/src/ts/CubicBezierCurve.ts +139 -12
- package/src/ts/Line.ts +2 -1
- package/src/ts/PBText.ts +10 -9
- package/src/ts/PlotBoilerplate.ts +56 -19
- package/src/ts/Polygon.ts +91 -1
- package/src/ts/VEllipse.ts +2 -2
- package/src/ts/Vector.ts +4 -4
- package/src/ts/VertTuple.ts +4 -3
- package/src/ts/Vertex.ts +20 -4
- package/src/ts/draw.ts +311 -115
- package/src/ts/drawgl.ts +133 -71
- package/src/ts/drawutilssvg.ts +543 -121
- package/src/ts/interfaces/DrawLib.ts +219 -83
- package/src/ts/interfaces/core.ts +14 -2
- 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
|
-
* @
|
|
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 {
|
|
318
|
-
* @param {
|
|
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:
|
|
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 {
|
|
331
|
-
* @param {
|
|
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:
|
|
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 {
|
|
347
|
-
* @param {
|
|
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:
|
|
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 {
|
|
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:
|
|
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 {
|
|
375
|
-
* @param {
|
|
376
|
-
* @param {
|
|
377
|
-
* @param {
|
|
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:
|
|
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 {
|
|
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<
|
|
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:
|
|
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 {
|
|
419
|
-
* @param {
|
|
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:
|
|
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 {
|
|
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:
|
|
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 {
|
|
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:
|
|
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 {
|
|
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:
|
|
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 {
|
|
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:
|
|
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 {
|
|
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:
|
|
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 {
|
|
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
|
-
* @
|
|
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 {
|
|
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:
|
|
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 {
|
|
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:
|
|
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 {
|
|
557
|
-
* @param {
|
|
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:
|
|
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 {
|
|
573
|
-
* @param {
|
|
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:
|
|
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 {
|
|
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:
|
|
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 {
|
|
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<
|
|
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
|
}
|