plotboilerplate 1.23.3 → 1.25.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/README.md +19 -1
- package/dist/index.esm.js +1684 -394
- 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 +12450 -11120
- package/dist/plotboilerplate.min.js +1 -1
- package/package.json +9 -5
- package/src/cjs/BezierPath.d.ts +41 -5
- package/src/cjs/BezierPath.js +52 -2
- package/src/cjs/BezierPath.js.map +1 -1
- package/src/cjs/Bounds.d.ts +67 -3
- package/src/cjs/Bounds.js +101 -3
- package/src/cjs/Bounds.js.map +1 -1
- package/src/cjs/Circle.d.ts +46 -4
- package/src/cjs/Circle.js +82 -3
- package/src/cjs/Circle.js.map +1 -1
- package/src/cjs/CircleSector.d.ts +51 -2
- package/src/cjs/CircleSector.js +112 -3
- package/src/cjs/CircleSector.js.map +1 -1
- package/src/cjs/CubicBezierCurve.d.ts +113 -7
- package/src/cjs/CubicBezierCurve.js +281 -33
- package/src/cjs/CubicBezierCurve.js.map +1 -1
- package/src/cjs/Line.d.ts +38 -3
- package/src/cjs/Line.js +64 -1
- package/src/cjs/Line.js.map +1 -1
- package/src/cjs/PlotBoilerplate.d.ts +37 -6
- package/src/cjs/PlotBoilerplate.js +224 -125
- package/src/cjs/PlotBoilerplate.js.map +1 -1
- package/src/cjs/Polygon.d.ts +68 -5
- package/src/cjs/Polygon.js +143 -22
- package/src/cjs/Polygon.js.map +1 -1
- package/src/cjs/Triangle.d.ts +52 -3
- package/src/cjs/Triangle.js +80 -1
- package/src/cjs/Triangle.js.map +1 -1
- package/src/cjs/VEllipse.d.ts +62 -3
- package/src/cjs/VEllipse.js +181 -17
- package/src/cjs/VEllipse.js.map +1 -1
- package/src/cjs/VEllipseSector.d.ts +86 -2
- package/src/cjs/VEllipseSector.js +148 -4
- package/src/cjs/VEllipseSector.js.map +1 -1
- package/src/cjs/Vector.d.ts +12 -2
- package/src/cjs/Vector.js +15 -2
- package/src/cjs/Vector.js.map +1 -1
- package/src/cjs/VertTuple.d.ts +28 -4
- package/src/cjs/VertTuple.js +36 -3
- package/src/cjs/VertTuple.js.map +1 -1
- package/src/cjs/Vertex.d.ts +31 -4
- package/src/cjs/Vertex.js +35 -1
- package/src/cjs/Vertex.js.map +1 -1
- package/src/cjs/interfaces/core.d.ts +67 -0
- package/src/cjs/interfaces/core.js +4 -0
- package/src/cjs/interfaces/core.js.map +1 -1
- package/src/cjs/utils/algorithms/convexPolygonIncircle.d.ts +2 -1
- package/src/cjs/utils/algorithms/convexPolygonIncircle.js +14 -6
- package/src/cjs/utils/algorithms/convexPolygonIncircle.js.map +1 -1
- package/src/cjs/utils/createRandomizedPolygon.d.ts +14 -0
- package/src/cjs/utils/createRandomizedPolygon.js +32 -0
- package/src/cjs/utils/createRandomizedPolygon.js.map +1 -0
- package/src/cjs/utils/datastructures/Color.d.ts +147 -1
- package/src/cjs/utils/datastructures/Color.js +385 -41
- package/src/cjs/utils/datastructures/Color.js.map +1 -1
- package/src/cjs/utils/datastructures/ColorGradient.d.ts +79 -0
- package/src/cjs/utils/datastructures/ColorGradient.js +171 -0
- package/src/cjs/utils/datastructures/ColorGradient.js.map +1 -0
- package/src/cjs/utils/dom/components/ColorGradientPicker.d.ts +245 -0
- package/src/cjs/utils/dom/components/ColorGradientPicker.js +667 -0
- package/src/cjs/utils/dom/components/ColorGradientPicker.js.map +1 -0
- package/src/cjs/utils/dom/components/ColorGradientPickerJSX.d.ts +129 -0
- package/src/cjs/utils/dom/components/ColorGradientPickerJSX.js +520 -0
- package/src/cjs/utils/dom/components/ColorGradientPickerJSX.js.map +1 -0
- package/src/cjs/utils/dom/components/ColorGradientSelector.d.ts +117 -0
- package/src/cjs/utils/dom/components/ColorGradientSelector.js +325 -0
- package/src/cjs/utils/dom/components/ColorGradientSelector.js.map +1 -0
- package/src/cjs/utils/dom/components/Test.d.ts +7 -0
- package/src/cjs/utils/dom/components/Test.js +30 -0
- package/src/cjs/utils/dom/components/Test.js.map +1 -0
- package/src/cjs/utils/dom/guiSizeToggler.js +1 -1
- package/src/cjs/utils/dom/guiSizeToggler.js.map +1 -1
- package/src/cjs/utils/helpers/BezierPathInteractionHelper.d.ts +16 -8
- package/src/cjs/utils/helpers/BezierPathInteractionHelper.js +49 -28
- package/src/cjs/utils/helpers/BezierPathInteractionHelper.js.map +1 -1
- package/src/cjs/utils/helpers/CircleHelper.d.ts +10 -1
- package/src/cjs/utils/helpers/CircleHelper.js +13 -2
- package/src/cjs/utils/helpers/CircleHelper.js.map +1 -1
- package/src/cjs/utils/helpers/CircleSectorHelper.d.ts +11 -2
- package/src/cjs/utils/helpers/CircleSectorHelper.js +20 -20
- package/src/cjs/utils/helpers/CircleSectorHelper.js.map +1 -1
- package/src/cjs/utils/helpers/TriangleHelper.d.ts +57 -0
- package/src/cjs/utils/helpers/TriangleHelper.js +83 -0
- package/src/cjs/utils/helpers/TriangleHelper.js.map +1 -0
- package/src/cjs/utils/helpers/VEllipseHelper.d.ts +32 -0
- package/src/cjs/utils/helpers/VEllipseHelper.js +88 -0
- package/src/cjs/utils/helpers/VEllipseHelper.js.map +1 -0
- package/src/cjs/utils/helpers/VEllipseSectorHelper.d.ts +44 -4
- package/src/cjs/utils/helpers/VEllipseSectorHelper.js +108 -25
- package/src/cjs/utils/helpers/VEllipseSectorHelper.js.map +1 -1
- package/src/cjs/utils/parsers/LinearColorGradientParser.d.ts +78 -0
- package/src/cjs/utils/parsers/LinearColorGradientParser.js +224 -0
- package/src/cjs/utils/parsers/LinearColorGradientParser.js.map +1 -0
- package/src/createDemoDrawables.js +4 -1
- package/src/esm/BezierPath.d.ts +41 -5
- package/src/esm/BezierPath.js +50 -2
- package/src/esm/BezierPath.js.map +1 -1
- package/src/esm/Bounds.d.ts +67 -3
- package/src/esm/Bounds.js +101 -3
- package/src/esm/Bounds.js.map +1 -1
- package/src/esm/Circle.d.ts +46 -4
- package/src/esm/Circle.js +79 -3
- package/src/esm/Circle.js.map +1 -1
- package/src/esm/CircleSector.d.ts +51 -2
- package/src/esm/CircleSector.js +108 -3
- package/src/esm/CircleSector.js.map +1 -1
- package/src/esm/CubicBezierCurve.d.ts +113 -7
- package/src/esm/CubicBezierCurve.js +277 -33
- package/src/esm/CubicBezierCurve.js.map +1 -1
- package/src/esm/Line.d.ts +38 -3
- package/src/esm/Line.js +62 -1
- package/src/esm/Line.js.map +1 -1
- package/src/esm/PlotBoilerplate.d.ts +37 -6
- package/src/esm/PlotBoilerplate.js +224 -125
- package/src/esm/PlotBoilerplate.js.map +1 -1
- package/src/esm/Polygon.d.ts +68 -5
- package/src/esm/Polygon.js +138 -22
- package/src/esm/Polygon.js.map +1 -1
- package/src/esm/Triangle.d.ts +52 -3
- package/src/esm/Triangle.js +77 -1
- package/src/esm/Triangle.js.map +1 -1
- package/src/esm/VEllipse.d.ts +62 -3
- package/src/esm/VEllipse.js +178 -17
- package/src/esm/VEllipse.js.map +1 -1
- package/src/esm/VEllipseSector.d.ts +86 -2
- package/src/esm/VEllipseSector.js +146 -7
- package/src/esm/VEllipseSector.js.map +1 -1
- package/src/esm/Vector.d.ts +12 -2
- package/src/esm/Vector.js +15 -2
- package/src/esm/Vector.js.map +1 -1
- package/src/esm/VertTuple.d.ts +28 -4
- package/src/esm/VertTuple.js +36 -3
- package/src/esm/VertTuple.js.map +1 -1
- package/src/esm/Vertex.d.ts +31 -4
- package/src/esm/Vertex.js +35 -1
- package/src/esm/Vertex.js.map +1 -1
- package/src/esm/interfaces/core.d.ts +67 -0
- package/src/esm/interfaces/core.js +4 -0
- package/src/esm/interfaces/core.js.map +1 -1
- package/src/esm/utils/algorithms/convexPolygonIncircle.d.ts +2 -1
- package/src/esm/utils/algorithms/convexPolygonIncircle.js +15 -7
- package/src/esm/utils/algorithms/convexPolygonIncircle.js.map +1 -1
- package/src/esm/utils/algorithms/createRandomizedPolygon.d.ts +14 -0
- package/src/esm/utils/algorithms/createRandomizedPolygon.js +28 -0
- package/src/esm/utils/algorithms/createRandomizedPolygon.js.map +1 -0
- package/src/esm/utils/createRandomizedPolygon.d.ts +14 -0
- package/src/esm/utils/createRandomizedPolygon.js +28 -0
- package/src/esm/utils/createRandomizedPolygon.js.map +1 -0
- package/src/esm/utils/datastructures/Color.d.ts +147 -1
- package/src/esm/utils/datastructures/Color.js +386 -42
- package/src/esm/utils/datastructures/Color.js.map +1 -1
- package/src/esm/utils/datastructures/ColorGradient.d.ts +79 -0
- package/src/esm/utils/datastructures/ColorGradient.js +166 -0
- package/src/esm/utils/datastructures/ColorGradient.js.map +1 -0
- package/src/esm/utils/dom/components/ColorGradientPicker.d.ts +245 -0
- package/src/esm/utils/dom/components/ColorGradientPicker.js +732 -0
- package/src/esm/utils/dom/components/ColorGradientPicker.js.map +1 -0
- package/src/esm/utils/dom/components/ColorGradientPickerJSX.d.ts +129 -0
- package/src/esm/utils/dom/components/ColorGradientPickerJSX.js +582 -0
- package/src/esm/utils/dom/components/ColorGradientPickerJSX.js.map +1 -0
- package/src/esm/utils/dom/components/ColorGradientSelector.d.ts +117 -0
- package/src/esm/utils/dom/components/ColorGradientSelector.js +332 -0
- package/src/esm/utils/dom/components/ColorGradientSelector.js.map +1 -0
- package/src/esm/utils/dom/components/Test.d.ts +7 -0
- package/src/esm/utils/dom/components/Test.js +26 -0
- package/src/esm/utils/dom/components/Test.js.map +1 -0
- package/src/esm/utils/dom/guiSizeToggler.js +1 -1
- package/src/esm/utils/dom/guiSizeToggler.js.map +1 -1
- package/src/esm/utils/helpers/BezierPathInteractionHelper.d.ts +16 -8
- package/src/esm/utils/helpers/BezierPathInteractionHelper.js +47 -27
- package/src/esm/utils/helpers/BezierPathInteractionHelper.js.map +1 -1
- package/src/esm/utils/helpers/CircleHelper.d.ts +10 -1
- package/src/esm/utils/helpers/CircleHelper.js +13 -2
- package/src/esm/utils/helpers/CircleHelper.js.map +1 -1
- package/src/esm/utils/helpers/CircleSectorHelper.d.ts +11 -2
- package/src/esm/utils/helpers/CircleSectorHelper.js +20 -20
- package/src/esm/utils/helpers/CircleSectorHelper.js.map +1 -1
- package/src/esm/utils/helpers/TriangleHelper.d.ts +57 -0
- package/src/esm/utils/helpers/TriangleHelper.js +78 -0
- package/src/esm/utils/helpers/TriangleHelper.js.map +1 -0
- package/src/esm/utils/helpers/VEllipseHelper.d.ts +32 -0
- package/src/esm/utils/helpers/VEllipseHelper.js +83 -0
- package/src/esm/utils/helpers/VEllipseHelper.js.map +1 -0
- package/src/esm/utils/helpers/VEllipseSectorHelper.d.ts +44 -4
- package/src/esm/utils/helpers/VEllipseSectorHelper.js +107 -24
- package/src/esm/utils/helpers/VEllipseSectorHelper.js.map +1 -1
- package/src/esm/utils/parsers/LinearColorGradientParser.d.ts +78 -0
- package/src/esm/utils/parsers/LinearColorGradientParser.js +217 -0
- package/src/esm/utils/parsers/LinearColorGradientParser.js.map +1 -0
- package/src/external.d.ts +9 -0
- package/src/ts/BezierPath.ts +58 -5
- package/src/ts/Bounds.ts +110 -6
- package/src/ts/Circle.ts +87 -5
- package/src/ts/CircleSector.ts +115 -5
- package/src/ts/CubicBezierCurve.ts +332 -42
- package/src/ts/Line.ts +66 -3
- package/src/ts/PlotBoilerplate.ts +236 -114
- package/src/ts/Polygon.ts +164 -29
- package/src/ts/Triangle.ts +85 -3
- package/src/ts/VEllipse.ts +214 -19
- package/src/ts/VEllipseSector.ts +154 -8
- package/src/ts/Vector.ts +16 -2
- package/src/ts/VertTuple.ts +39 -4
- package/src/ts/Vertex.ts +40 -4
- package/src/ts/interfaces/core.ts +73 -0
- package/src/ts/utils/algorithms/convexPolygonIncircle.ts +82 -78
- package/src/ts/utils/createRandomizedPolygon.ts +31 -0
- package/src/ts/utils/datastructures/Color.ts +423 -44
- package/src/ts/utils/datastructures/ColorGradient.ts +196 -0
- package/src/ts/utils/dom/components/ColorGradientPicker.tsx +877 -0
- package/src/ts/utils/dom/components/ColorGradientSelector.tsx +445 -0
- package/src/ts/utils/dom/components/Test.tsx +44 -0
- package/src/ts/utils/dom/components/_ColorGradientPicker_raw.ts_ +392 -0
- package/src/ts/utils/dom/guiSizeToggler.ts +1 -1
- package/src/ts/utils/helpers/BezierPathInteractionHelper.ts +61 -35
- package/src/ts/utils/helpers/CircleHelper.ts +17 -3
- package/src/ts/utils/helpers/CircleSectorHelper.ts +118 -126
- package/src/ts/utils/helpers/TriangleHelper.ts +102 -0
- package/src/ts/utils/helpers/VEllipseHelper.ts +115 -0
- package/src/ts/utils/helpers/VEllipseSectorHelper.ts +144 -26
- package/src/ts/utils/parsers/LinearColorGradientParser.ts +297 -0
package/src/esm/Line.d.ts
CHANGED
|
@@ -16,14 +16,18 @@
|
|
|
16
16
|
* @modified 2022-10-09 Changed the actual return value of the `intersection` function to null (was undefined before).
|
|
17
17
|
* @modified 2022-10-17 Adding these methods from the `PathSegment` interface: getStartPoint, getEndPoint, revert.
|
|
18
18
|
* @modified 2023-09-25 Changed param type of `intersection()` from Line to VertTuple.
|
|
19
|
-
* @
|
|
19
|
+
* @modified 2025-04-15 Class `Line` now implements interface `Intersectable`.
|
|
20
|
+
* @modified 2025-04-16 Class `Line` now implements interface `IBounded`.
|
|
21
|
+
* @version 2.4.0
|
|
20
22
|
*
|
|
21
23
|
* @file Line
|
|
22
24
|
* @public
|
|
23
25
|
**/
|
|
26
|
+
import { Bounds } from "./Bounds";
|
|
27
|
+
import { Vector } from "./Vector";
|
|
24
28
|
import { VertTuple } from "./VertTuple";
|
|
25
29
|
import { Vertex } from "./Vertex";
|
|
26
|
-
import { PathSegment, SVGSerializable } from "./interfaces";
|
|
30
|
+
import { IBounded, Intersectable, PathSegment, SVGSerializable } from "./interfaces";
|
|
27
31
|
/**
|
|
28
32
|
* @classdesc A line consists of two vertices a and b.<br>
|
|
29
33
|
* <br>
|
|
@@ -32,7 +36,7 @@ import { PathSegment, SVGSerializable } from "./interfaces";
|
|
|
32
36
|
*
|
|
33
37
|
* @requires Vertex
|
|
34
38
|
*/
|
|
35
|
-
export declare class Line extends VertTuple<Line> implements
|
|
39
|
+
export declare class Line extends VertTuple<Line> implements IBounded, Intersectable, PathSegment, SVGSerializable {
|
|
36
40
|
/**
|
|
37
41
|
* Required to generate proper CSS classes and other class related IDs.
|
|
38
42
|
**/
|
|
@@ -56,6 +60,15 @@ export declare class Line extends VertTuple<Line> implements SVGSerializable, Pa
|
|
|
56
60
|
* @memberof Line
|
|
57
61
|
**/
|
|
58
62
|
intersection(line: VertTuple<any>): Vertex | null;
|
|
63
|
+
/**
|
|
64
|
+
* Get the bounding box (bounds) of this Line.
|
|
65
|
+
*
|
|
66
|
+
* @method getBounds
|
|
67
|
+
* @instance
|
|
68
|
+
* @memberof Line
|
|
69
|
+
* @return {Bounds} The rectangular bounds of this Line.
|
|
70
|
+
**/
|
|
71
|
+
getBounds(): Bounds;
|
|
59
72
|
/**
|
|
60
73
|
* Get the start point of this path segment.
|
|
61
74
|
*
|
|
@@ -96,4 +109,26 @@ export declare class Line extends VertTuple<Line> implements SVGSerializable, Pa
|
|
|
96
109
|
* @return {PathSegment} This path segment instance (for chaining).
|
|
97
110
|
*/
|
|
98
111
|
reverse(): Line;
|
|
112
|
+
/**
|
|
113
|
+
* Get all line intersections with this polygon.
|
|
114
|
+
*
|
|
115
|
+
* This method returns all intersections (as vertices) with this shape. The returned array of vertices is in no specific order.
|
|
116
|
+
*
|
|
117
|
+
* See demo `47-closest-vector-projection-on-polygon` for how it works.
|
|
118
|
+
*
|
|
119
|
+
* @param {VertTuple} line - The line to find intersections with.
|
|
120
|
+
* @param {boolean} inVectorBoundsOnly - If set to true only intersecion points on the passed vector are returned (located strictly between start and end vertex).
|
|
121
|
+
* @returns {Array<Vertex>} - An array of all intersections within the polygon bounds.
|
|
122
|
+
*/
|
|
123
|
+
lineIntersections(line: VertTuple<any>, inVectorBoundsOnly?: boolean): Array<Vertex>;
|
|
124
|
+
/**
|
|
125
|
+
* Get all line intersections of this polygon and their tangents along the shape.
|
|
126
|
+
*
|
|
127
|
+
* This method returns all intersection tangents (as vectors) with this shape. The returned array of vectors is in no specific order.
|
|
128
|
+
*
|
|
129
|
+
* @param line
|
|
130
|
+
* @param inVectorBoundsOnly
|
|
131
|
+
* @returns
|
|
132
|
+
*/
|
|
133
|
+
lineIntersectionTangents(line: VertTuple<any>, inVectorBoundsOnly?: boolean): Array<Vector>;
|
|
99
134
|
}
|
package/src/esm/Line.js
CHANGED
|
@@ -16,11 +16,15 @@
|
|
|
16
16
|
* @modified 2022-10-09 Changed the actual return value of the `intersection` function to null (was undefined before).
|
|
17
17
|
* @modified 2022-10-17 Adding these methods from the `PathSegment` interface: getStartPoint, getEndPoint, revert.
|
|
18
18
|
* @modified 2023-09-25 Changed param type of `intersection()` from Line to VertTuple.
|
|
19
|
-
* @
|
|
19
|
+
* @modified 2025-04-15 Class `Line` now implements interface `Intersectable`.
|
|
20
|
+
* @modified 2025-04-16 Class `Line` now implements interface `IBounded`.
|
|
21
|
+
* @version 2.4.0
|
|
20
22
|
*
|
|
21
23
|
* @file Line
|
|
22
24
|
* @public
|
|
23
25
|
**/
|
|
26
|
+
import { Bounds } from "./Bounds";
|
|
27
|
+
import { Vector } from "./Vector";
|
|
24
28
|
import { VertTuple } from "./VertTuple";
|
|
25
29
|
import { Vertex } from "./Vertex";
|
|
26
30
|
/**
|
|
@@ -77,6 +81,19 @@ export class Line extends VertTuple {
|
|
|
77
81
|
// if we cast these lines infinitely in both directions, they intersect here:
|
|
78
82
|
return new Vertex(x, y);
|
|
79
83
|
}
|
|
84
|
+
//--- BEGIN --- Implement interface `IBounded`
|
|
85
|
+
/**
|
|
86
|
+
* Get the bounding box (bounds) of this Line.
|
|
87
|
+
*
|
|
88
|
+
* @method getBounds
|
|
89
|
+
* @instance
|
|
90
|
+
* @memberof Line
|
|
91
|
+
* @return {Bounds} The rectangular bounds of this Line.
|
|
92
|
+
**/
|
|
93
|
+
getBounds() {
|
|
94
|
+
return Bounds.computeFromVertices([this.a, this.b]);
|
|
95
|
+
}
|
|
96
|
+
//--- END --- Implement interface `IBounded`
|
|
80
97
|
//--- Implement PathSegment ---
|
|
81
98
|
/**
|
|
82
99
|
* Get the start point of this path segment.
|
|
@@ -131,5 +148,49 @@ export class Line extends VertTuple {
|
|
|
131
148
|
this.b = tmp;
|
|
132
149
|
return this;
|
|
133
150
|
}
|
|
151
|
+
//--- END Implement PathSegment ---
|
|
152
|
+
//--- BEGIN --- Implement interface `Intersectable`
|
|
153
|
+
/**
|
|
154
|
+
* Get all line intersections with this polygon.
|
|
155
|
+
*
|
|
156
|
+
* This method returns all intersections (as vertices) with this shape. The returned array of vertices is in no specific order.
|
|
157
|
+
*
|
|
158
|
+
* See demo `47-closest-vector-projection-on-polygon` for how it works.
|
|
159
|
+
*
|
|
160
|
+
* @param {VertTuple} line - The line to find intersections with.
|
|
161
|
+
* @param {boolean} inVectorBoundsOnly - If set to true only intersecion points on the passed vector are returned (located strictly between start and end vertex).
|
|
162
|
+
* @returns {Array<Vertex>} - An array of all intersections within the polygon bounds.
|
|
163
|
+
*/
|
|
164
|
+
lineIntersections(line, inVectorBoundsOnly = false) {
|
|
165
|
+
// Find the intersections of all lines inside the edge bounds
|
|
166
|
+
const intersection = this.intersection(line);
|
|
167
|
+
if (!intersection) {
|
|
168
|
+
return []; // Both lines parallel
|
|
169
|
+
}
|
|
170
|
+
if (this.hasPoint(intersection, true) && (!inVectorBoundsOnly || line.hasPoint(intersection, inVectorBoundsOnly))) {
|
|
171
|
+
return [intersection];
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
return [];
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Get all line intersections of this polygon and their tangents along the shape.
|
|
179
|
+
*
|
|
180
|
+
* This method returns all intersection tangents (as vectors) with this shape. The returned array of vectors is in no specific order.
|
|
181
|
+
*
|
|
182
|
+
* @param line
|
|
183
|
+
* @param inVectorBoundsOnly
|
|
184
|
+
* @returns
|
|
185
|
+
*/
|
|
186
|
+
lineIntersectionTangents(line, inVectorBoundsOnly = false) {
|
|
187
|
+
// Find the intersection tangents of all lines inside the edge bounds
|
|
188
|
+
const intersections = this.lineIntersections(line, inVectorBoundsOnly);
|
|
189
|
+
if (intersections.length === 0) {
|
|
190
|
+
return [];
|
|
191
|
+
}
|
|
192
|
+
const intrsctn = intersections[0];
|
|
193
|
+
return [new Vector(this.a.clone(), this.b.clone()).moveTo(intrsctn)];
|
|
194
|
+
}
|
|
134
195
|
}
|
|
135
196
|
//# sourceMappingURL=Line.js.map
|
package/src/esm/Line.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Line.js","sourceRoot":"","sources":["../ts/Line.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"Line.js","sourceRoot":"","sources":["../ts/Line.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;IAwBI;AAEJ,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC;;;;;;;GAOG;AACH,MAAM,OAAO,IAAK,SAAQ,SAAe;IAMvC;;;;;;;QAOI;IACJ,YAAY,CAAS,EAAE,CAAS;QAC9B,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAdxD;;YAEI;QACK,cAAS,GAAW,MAAM,CAAC;IAYpC,CAAC;IAED;;;;;;;;QAQI;IACJ,+BAA+B;IAC/B,YAAY,CAAC,IAAoB;QAC/B,MAAM,WAAW,GAAW,IAAI,CAAC,WAAW,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YAAY,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC;YAClH,OAAO,CAAC,YAAY,CAAC,CAAC;QACxB,CAAC;aAAM,CAAC;YACN,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAED;;;;;;;;OAQG;IACH,wBAAwB,CAAC,IAAoB,EAAE,qBAA8B,KAAK;QAChF,qEAAqE;QACrE,MAAM,aAAa,GAAa,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;QACjF,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/B,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,MAAM,QAAQ,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;QAClC,OAAO,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAW,CAAC,CAAC;IACjF,CAAC;CAEF"}
|
|
@@ -86,8 +86,13 @@
|
|
|
86
86
|
* @modified 2024-07-08 Adding `PlotBoilerplate.getGUI()` to retrieve the GUI instance.
|
|
87
87
|
* @modified 2024-08-25 Extending main class `PlotBoilerplate` optional param `isBackdropFiltersEnabled`.
|
|
88
88
|
* @modified 2024-12-02 Adding the `triggerRedraw` to the `removeAll` method.
|
|
89
|
+
* @modified 2025-05-07 Changing the return type of `removeVertex` from `void` to `boolean`.
|
|
90
|
+
* @modified 2025-05-07 Handling content changes now with `contentChangeListeners`.
|
|
91
|
+
* @modified 2025-05-07 Added `PlogBoilerplate.addContentChangeListener` and `.removeContentChangeListener`.
|
|
92
|
+
* @modified 2025-05-07 Moving full vectors now by default when vector point a is moved.
|
|
93
|
+
* @modified 2025-05-20 Applying `lineWith` parameter in the draw routine for vectors (had been missing).
|
|
89
94
|
*
|
|
90
|
-
* @version 1.
|
|
95
|
+
* @version 1.21.1
|
|
91
96
|
*
|
|
92
97
|
* @file PlotBoilerplate
|
|
93
98
|
* @fileoverview The main class.
|
|
@@ -100,7 +105,7 @@ import { Grid } from "./Grid";
|
|
|
100
105
|
import { Polygon } from "./Polygon";
|
|
101
106
|
import { Vertex } from "./Vertex";
|
|
102
107
|
import { IDraggable, Config, DrawLib, Drawable, DrawConfig, IHooks, PBParams, XYCoords, XYDimension, DatGuiProps, // DEPRECATED. Please do not use any more.
|
|
103
|
-
LilGuiProps } from "./interfaces";
|
|
108
|
+
LilGuiProps, PBContentChangeListener } from "./interfaces";
|
|
104
109
|
/**
|
|
105
110
|
* @classdesc The main class of the PlotBoilerplate.
|
|
106
111
|
*
|
|
@@ -252,6 +257,10 @@ export declare class PlotBoilerplate {
|
|
|
252
257
|
* @instance
|
|
253
258
|
*/
|
|
254
259
|
hooks: IHooks;
|
|
260
|
+
/**
|
|
261
|
+
* A list of content change listeners.
|
|
262
|
+
*/
|
|
263
|
+
contentChangeListeners: Array<PBContentChangeListener>;
|
|
255
264
|
/**
|
|
256
265
|
* @member {KeyHandler|undefined}
|
|
257
266
|
* @memberof PlotBoilerplate
|
|
@@ -389,6 +398,27 @@ export declare class PlotBoilerplate {
|
|
|
389
398
|
* @private
|
|
390
399
|
**/
|
|
391
400
|
private updateCSSscale;
|
|
401
|
+
/**
|
|
402
|
+
* Adds a new content change listener to this instance. Adding duplicates is not possible.
|
|
403
|
+
*
|
|
404
|
+
* @param {PBContentChangeListener} listener - The listenre to add.
|
|
405
|
+
* @method addContentChangeListener
|
|
406
|
+
* @instance
|
|
407
|
+
* @memberof PlotBoilerplate
|
|
408
|
+
* @returns {void}
|
|
409
|
+
*/
|
|
410
|
+
addContentChangeListener(listener: PBContentChangeListener): void;
|
|
411
|
+
/**
|
|
412
|
+
* Removes an existing content change listener from this instance.
|
|
413
|
+
*
|
|
414
|
+
* @param {PBContentChangeListener} listener - The listenre to add.
|
|
415
|
+
* @method removeContentChangeListener
|
|
416
|
+
* @instance
|
|
417
|
+
* @memberof PlotBoilerplate
|
|
418
|
+
* @returns {void}
|
|
419
|
+
*/
|
|
420
|
+
removeContentChangeListener(listener: PBContentChangeListener): void;
|
|
421
|
+
private _fireContentChanged;
|
|
392
422
|
/**
|
|
393
423
|
* Add a drawable object.<br>
|
|
394
424
|
* <br>
|
|
@@ -413,7 +443,7 @@ export declare class PlotBoilerplate {
|
|
|
413
443
|
* @memberof PlotBoilerplate
|
|
414
444
|
* @return {void}
|
|
415
445
|
**/
|
|
416
|
-
add(drawable: Drawable | Array<Drawable>, redraw?: boolean): void;
|
|
446
|
+
add(drawable: Drawable | Array<Drawable>, redraw?: boolean, doNotFireEvent?: boolean): void;
|
|
417
447
|
/**
|
|
418
448
|
* Remove a drawable object.<br>
|
|
419
449
|
* <br>
|
|
@@ -432,12 +462,13 @@ export declare class PlotBoilerplate {
|
|
|
432
462
|
*
|
|
433
463
|
* @param {Drawable|Array<Drawable>} drawable - The drawable (of one of the allowed class instance) to remove.
|
|
434
464
|
* @param {boolean} [redraw=false]
|
|
465
|
+
* @param {removeWidth}
|
|
435
466
|
* @method remove
|
|
436
467
|
* @instance
|
|
437
468
|
* @memberof PlotBoilerplate
|
|
438
469
|
* @return {void}
|
|
439
470
|
**/
|
|
440
|
-
remove(drawable: Drawable | Array<Drawable>, redraw?: boolean, removeWithVertices?: boolean):
|
|
471
|
+
remove(drawable: Drawable | Array<Drawable>, redraw?: boolean, removeWithVertices?: boolean, doNotFireEvent?: boolean): boolean;
|
|
441
472
|
/**
|
|
442
473
|
* Remove a vertex from the vertex list.<br>
|
|
443
474
|
*
|
|
@@ -446,9 +477,9 @@ export declare class PlotBoilerplate {
|
|
|
446
477
|
* @method removeVertex
|
|
447
478
|
* @instance
|
|
448
479
|
* @memberof PlotBoilerplate
|
|
449
|
-
* @return {
|
|
480
|
+
* @return {boolean}
|
|
450
481
|
**/
|
|
451
|
-
removeVertex(vert: Vertex, redraw?: boolean):
|
|
482
|
+
removeVertex(vert: Vertex, redraw?: boolean, doNotFireEvent?: boolean): boolean;
|
|
452
483
|
/**
|
|
453
484
|
* Remove all elements.
|
|
454
485
|
*
|