plotboilerplate 1.20.2 → 1.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +2012 -1366
- 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 +1199 -541
- package/dist/plotboilerplate.min.js +1 -1
- package/package.json +3 -2
- 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 +47 -1
- package/src/cjs/Polygon.js +116 -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/Params.d.ts +15 -0
- package/src/cjs/utils/Params.js +49 -0
- package/src/cjs/utils/Params.js.map +1 -0
- package/src/cjs/utils/algorithms/ContourLineDetection.d.ts +150 -0
- package/src/cjs/utils/algorithms/ContourLineDetection.js +367 -0
- package/src/cjs/utils/algorithms/ContourLineDetection.js.map +1 -0
- package/src/cjs/utils/algorithms/clearDuplicateVertices.d.ts +21 -0
- package/src/cjs/utils/algorithms/clearDuplicateVertices.js +48 -0
- package/src/cjs/utils/algorithms/clearDuplicateVertices.js.map +1 -0
- package/src/cjs/utils/creategui.js +16 -10
- package/src/cjs/utils/datastructures/DataGrid2d.d.ts +47 -0
- package/src/cjs/utils/datastructures/DataGrid2d.js +20 -0
- package/src/cjs/utils/datastructures/DataGrid2d.js.map +1 -0
- package/src/cjs/utils/datastructures/DataGrid2dListAdapter.d.ts +65 -0
- package/src/cjs/utils/datastructures/DataGrid2dListAdapter.js +84 -0
- package/src/cjs/utils/datastructures/DataGrid2dListAdapter.js.map +1 -0
- package/src/cjs/utils/datastructures/GenericPath.d.ts +14 -3
- package/src/cjs/utils/datastructures/GenericPath.js +20 -3
- package/src/cjs/utils/datastructures/GenericPath.js.map +1 -1
- 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 +47 -1
- package/src/esm/Polygon.js +114 -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/Params.d.ts +15 -0
- package/src/esm/utils/Params.js +44 -0
- package/src/esm/utils/Params.js.map +1 -0
- package/src/esm/utils/algorithms/ContourLineDetection.d.ts +150 -0
- package/src/esm/utils/algorithms/ContourLineDetection.js +362 -0
- package/src/esm/utils/algorithms/ContourLineDetection.js.map +1 -0
- package/src/esm/utils/algorithms/clearDuplicateVertices.d.ts +21 -0
- package/src/esm/utils/algorithms/clearDuplicateVertices.js +44 -0
- package/src/esm/utils/algorithms/clearDuplicateVertices.js.map +1 -0
- package/src/esm/utils/datastructures/DataGrid2d.d.ts +47 -0
- package/src/esm/utils/datastructures/DataGrid2d.js +19 -0
- package/src/esm/utils/datastructures/DataGrid2d.js.map +1 -0
- package/src/esm/utils/datastructures/DataGrid2dListAdapter.d.ts +65 -0
- package/src/esm/utils/datastructures/DataGrid2dListAdapter.js +79 -0
- package/src/esm/utils/datastructures/DataGrid2dListAdapter.js.map +1 -0
- package/src/esm/utils/datastructures/GenericPath.d.ts +14 -3
- package/src/esm/utils/datastructures/GenericPath.js +20 -3
- package/src/esm/utils/datastructures/GenericPath.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 +121 -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/Params.ts +47 -0
- package/src/ts/utils/algorithms/ContourLineDetection.ts +485 -0
- package/src/ts/utils/algorithms/clearDuplicateVertices.ts +49 -0
- package/src/ts/utils/datastructures/DataGrid2d.ts +54 -0
- package/src/ts/utils/datastructures/DataGrid2dListAdapter.ts +121 -0
- package/src/ts/utils/datastructures/GenericPath.ts +21 -3
- package/src/ts/utils/detectDarkMode.ts +30 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A 2D datagrid interface for getting/storing data in some 2 dimensional array style types.
|
|
3
|
+
*
|
|
4
|
+
* _|---- xIndex --->
|
|
5
|
+
* | d[0][0], d[1][0], d[2][0], ..., d[xSegmentCount-1][0]
|
|
6
|
+
* yIndex
|
|
7
|
+
* | d[0][1], d[1][1], d[2][1], ..., d[xSegmentCount-1][1]
|
|
8
|
+
* |
|
|
9
|
+
* v ...
|
|
10
|
+
*
|
|
11
|
+
* d[0][ySegmentCount-1], ..., ..., d[xSegmentCount-1][ySegmentCount-1]
|
|
12
|
+
*
|
|
13
|
+
*
|
|
14
|
+
* @date 2023-11-04
|
|
15
|
+
* @author Ikaros Kappler
|
|
16
|
+
* @version 1.0.0
|
|
17
|
+
*/
|
|
18
|
+
export declare type DataGridFace4<T> = [[T | null, T | null], [T | null, T | null]];
|
|
19
|
+
export interface IDataGrid2d<T> {
|
|
20
|
+
readonly xSegmentCount: number;
|
|
21
|
+
readonly ySegmentCount: number;
|
|
22
|
+
getMinDataValue(): T;
|
|
23
|
+
getMaxDataValue(): T;
|
|
24
|
+
getDataValueAt(xIndex: number, yIndex: number): T | null;
|
|
25
|
+
/**
|
|
26
|
+
* Extract a 2x2 matrix (a "face4") from the underlyting data.
|
|
27
|
+
*
|
|
28
|
+
* Imagine a face4 element like this
|
|
29
|
+
* (x,y) (x+1,y)
|
|
30
|
+
* A-----B
|
|
31
|
+
* | |
|
|
32
|
+
* | |
|
|
33
|
+
* D-----C
|
|
34
|
+
* (x,y+1) (x+1,y+1)
|
|
35
|
+
*
|
|
36
|
+
* then result in the buffer will be
|
|
37
|
+
* [ [A,B],
|
|
38
|
+
* [D,C] ]
|
|
39
|
+
*
|
|
40
|
+
* If any index is invalid then the resulting buffer element will be null.
|
|
41
|
+
*
|
|
42
|
+
* @param {number} xIndex - The x index in `0 <= xIndex < xSegmentCount`.
|
|
43
|
+
* @param {number} yIndex - The y index in `0 <= yIndex < ySegmentCount`.
|
|
44
|
+
* @param {[[T,T],[T,T]]} buffer - The result buffer for four elements.
|
|
45
|
+
*/
|
|
46
|
+
getDataFace4At(xIndex: number, yIndex: number, buffer: DataGridFace4<T>): void;
|
|
47
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* A 2D datagrid interface for getting/storing data in some 2 dimensional array style types.
|
|
4
|
+
*
|
|
5
|
+
* _|---- xIndex --->
|
|
6
|
+
* | d[0][0], d[1][0], d[2][0], ..., d[xSegmentCount-1][0]
|
|
7
|
+
* yIndex
|
|
8
|
+
* | d[0][1], d[1][1], d[2][1], ..., d[xSegmentCount-1][1]
|
|
9
|
+
* |
|
|
10
|
+
* v ...
|
|
11
|
+
*
|
|
12
|
+
* d[0][ySegmentCount-1], ..., ..., d[xSegmentCount-1][ySegmentCount-1]
|
|
13
|
+
*
|
|
14
|
+
*
|
|
15
|
+
* @date 2023-11-04
|
|
16
|
+
* @author Ikaros Kappler
|
|
17
|
+
* @version 1.0.0
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
//# sourceMappingURL=DataGrid2d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataGrid2d.js","sourceRoot":"","sources":["../../../ts/utils/datastructures/DataGrid2d.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A DataGrid2d implementation on a linear array of triplets/Vector3.
|
|
3
|
+
*
|
|
4
|
+
* @author Ikaros Kappler
|
|
5
|
+
* @date 2023-10-28
|
|
6
|
+
* @modified 2023-11-04 Converted to a Typescript class.
|
|
7
|
+
* @version 1.0.0
|
|
8
|
+
**/
|
|
9
|
+
import { DataGridFace4, IDataGrid2d } from "./DataGrid2d";
|
|
10
|
+
declare type Triplet<T> = {
|
|
11
|
+
x: T;
|
|
12
|
+
y: T;
|
|
13
|
+
z: T;
|
|
14
|
+
};
|
|
15
|
+
declare type RasterPosition = {
|
|
16
|
+
xIndex: number;
|
|
17
|
+
yIndex: number;
|
|
18
|
+
xRel?: number;
|
|
19
|
+
yRel?: number;
|
|
20
|
+
};
|
|
21
|
+
export declare class DataGrid2dListAdapter<T> implements IDataGrid2d<T> {
|
|
22
|
+
/**
|
|
23
|
+
* @override
|
|
24
|
+
*/
|
|
25
|
+
readonly xSegmentCount: number;
|
|
26
|
+
/**
|
|
27
|
+
* @override
|
|
28
|
+
*/
|
|
29
|
+
readonly ySegmentCount: number;
|
|
30
|
+
minDataValue: T;
|
|
31
|
+
maxDataValue: T;
|
|
32
|
+
minXValue: T;
|
|
33
|
+
maxXValue: T;
|
|
34
|
+
minYValue: T;
|
|
35
|
+
maxYValue: T;
|
|
36
|
+
private _dataList;
|
|
37
|
+
/**
|
|
38
|
+
* Create a new DataGrid2d from the given
|
|
39
|
+
* @throws Error if xSegmentCount*ySegmentCount is larger than the capacity of the array/list.
|
|
40
|
+
* @param list
|
|
41
|
+
* @param xSegmentCount
|
|
42
|
+
* @param ySegmentCount
|
|
43
|
+
*/
|
|
44
|
+
constructor(list: Array<Triplet<T>>, xSegmentCount: number, ySegmentCount: number);
|
|
45
|
+
getIndicesFromBufferIndex(bufferIndex: number): RasterPosition;
|
|
46
|
+
getCoordsFromBufferIndex(bufferIndex: number): RasterPosition;
|
|
47
|
+
coordinateIndicesToBufferIndex(xIndex: number, yIndex: number): number;
|
|
48
|
+
/**
|
|
49
|
+
* @override
|
|
50
|
+
*/
|
|
51
|
+
getMinDataValue(): T;
|
|
52
|
+
/**
|
|
53
|
+
* @override
|
|
54
|
+
*/
|
|
55
|
+
getMaxDataValue(): T;
|
|
56
|
+
/**
|
|
57
|
+
* @override
|
|
58
|
+
*/
|
|
59
|
+
getDataValueAt(xIndex: number, yIndex: number, isDebug?: boolean): T | null;
|
|
60
|
+
/**
|
|
61
|
+
* @override
|
|
62
|
+
*/
|
|
63
|
+
getDataFace4At(xIndex: number, yIndex: number, buffer: DataGridFace4<T>): void;
|
|
64
|
+
}
|
|
65
|
+
export {};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* A DataGrid2d implementation on a linear array of triplets/Vector3.
|
|
4
|
+
*
|
|
5
|
+
* @author Ikaros Kappler
|
|
6
|
+
* @date 2023-10-28
|
|
7
|
+
* @modified 2023-11-04 Converted to a Typescript class.
|
|
8
|
+
* @version 1.0.0
|
|
9
|
+
**/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.DataGrid2dListAdapter = void 0;
|
|
12
|
+
var DataGrid2dListAdapter = /** @class */ (function () {
|
|
13
|
+
/**
|
|
14
|
+
* Create a new DataGrid2d from the given
|
|
15
|
+
* @throws Error if xSegmentCount*ySegmentCount is larger than the capacity of the array/list.
|
|
16
|
+
* @param list
|
|
17
|
+
* @param xSegmentCount
|
|
18
|
+
* @param ySegmentCount
|
|
19
|
+
*/
|
|
20
|
+
function DataGrid2dListAdapter(list, xSegmentCount, ySegmentCount) {
|
|
21
|
+
if (xSegmentCount * ySegmentCount > list.length) {
|
|
22
|
+
throw "Cannot create DataGrid2dListAdapter, the list (length " + list.length + ") does not provide enough items for " + xSegmentCount + "x" + ySegmentCount + " required entries.";
|
|
23
|
+
}
|
|
24
|
+
// this.canvas = document.getElementById(canvasId);
|
|
25
|
+
this.xSegmentCount = xSegmentCount;
|
|
26
|
+
this.ySegmentCount = ySegmentCount;
|
|
27
|
+
this._dataList = list;
|
|
28
|
+
}
|
|
29
|
+
DataGrid2dListAdapter.prototype.getIndicesFromBufferIndex = function (bufferIndex) {
|
|
30
|
+
return { xIndex: Math.floor(bufferIndex % this.xSegmentCount), yIndex: Math.floor(bufferIndex / this.xSegmentCount) };
|
|
31
|
+
};
|
|
32
|
+
DataGrid2dListAdapter.prototype.getCoordsFromBufferIndex = function (bufferIndex) {
|
|
33
|
+
var index = this.getIndicesFromBufferIndex(bufferIndex);
|
|
34
|
+
// Note that the xSegmentCount and ySegmentCount counts plane squares, each consisting of four vertices
|
|
35
|
+
index.xRel = index.xIndex / (this.xSegmentCount - 1);
|
|
36
|
+
index.yRel = index.yIndex / (this.ySegmentCount - 1);
|
|
37
|
+
return index;
|
|
38
|
+
};
|
|
39
|
+
DataGrid2dListAdapter.prototype.coordinateIndicesToBufferIndex = function (xIndex, yIndex) {
|
|
40
|
+
return yIndex * this.xSegmentCount + xIndex;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* @override
|
|
44
|
+
*/
|
|
45
|
+
DataGrid2dListAdapter.prototype.getMinDataValue = function () {
|
|
46
|
+
return this.minDataValue;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* @override
|
|
50
|
+
*/
|
|
51
|
+
DataGrid2dListAdapter.prototype.getMaxDataValue = function () {
|
|
52
|
+
return this.maxDataValue;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* @override
|
|
56
|
+
*/
|
|
57
|
+
DataGrid2dListAdapter.prototype.getDataValueAt = function (xIndex, yIndex, isDebug) {
|
|
58
|
+
// var bufferIndex = yIndex * this.xSegmentCount + xIndex;
|
|
59
|
+
var bufferIndex = this.coordinateIndicesToBufferIndex(xIndex, yIndex);
|
|
60
|
+
if (isDebug) {
|
|
61
|
+
console.log("xIndex", xIndex, "yIndex", yIndex, "bufferIndex", bufferIndex);
|
|
62
|
+
}
|
|
63
|
+
if (bufferIndex > this._dataList.length) {
|
|
64
|
+
console.error("ERR buffer index is out of bounds! xIndex", xIndex, "yIndex", yIndex, "bufferIndex", bufferIndex);
|
|
65
|
+
}
|
|
66
|
+
if (!this._dataList[bufferIndex]) {
|
|
67
|
+
console.error("ERR buffer element is null! xIndex", xIndex, "yIndex", yIndex, "bufferIndex", bufferIndex);
|
|
68
|
+
}
|
|
69
|
+
return this._dataList && bufferIndex < this._dataList.length ? this._dataList[bufferIndex].z : null;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* @override
|
|
73
|
+
*/
|
|
74
|
+
DataGrid2dListAdapter.prototype.getDataFace4At = function (xIndex, yIndex, buffer) {
|
|
75
|
+
// buffer: array[2][2]
|
|
76
|
+
buffer[0][0] = this.getDataValueAt(xIndex, yIndex);
|
|
77
|
+
buffer[1][0] = this.getDataValueAt(xIndex + 1, yIndex);
|
|
78
|
+
buffer[1][1] = this.getDataValueAt(xIndex + 1, yIndex + 1);
|
|
79
|
+
buffer[0][1] = this.getDataValueAt(xIndex, yIndex + 1);
|
|
80
|
+
};
|
|
81
|
+
return DataGrid2dListAdapter;
|
|
82
|
+
}());
|
|
83
|
+
exports.DataGrid2dListAdapter = DataGrid2dListAdapter;
|
|
84
|
+
//# sourceMappingURL=DataGrid2dListAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataGrid2dListAdapter.js","sourceRoot":"","sources":["../../../ts/utils/datastructures/DataGrid2dListAdapter.ts"],"names":[],"mappings":";AAAA;;;;;;;IAOI;;;AAiBJ;IAmBE;;;;;;OAMG;IACH,+BAAY,IAAuB,EAAE,aAAqB,EAAE,aAAqB;QAC/E,IAAI,aAAa,GAAG,aAAa,GAAG,IAAI,CAAC,MAAM,EAAE;YAC/C,MAAM,2DAAyD,IAAI,CAA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CAAC,CAAC,CAAC;IACzD,CAAC;IACH,4BAAC;AAAD,CAAC,AAhGD,IAgGC;AAhGY,sDAAqB"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @author
|
|
3
|
-
* @version
|
|
4
|
-
* @date
|
|
2
|
+
* @author Ikaros Kappler
|
|
3
|
+
* @version 1.1.0
|
|
4
|
+
* @date 2022-10-17
|
|
5
|
+
* @modified 2023-11-27 Added the `GenericPath.getAllStartEndPoints()` function.
|
|
5
6
|
*/
|
|
6
7
|
import { Path, PathSegment } from "../../interfaces/additionals";
|
|
7
8
|
import { Vertex } from "../../Vertex";
|
|
@@ -72,4 +73,14 @@ export declare class GenericPath implements Path {
|
|
|
72
73
|
* @return {Vertex} The end point of the ending point's tangent.
|
|
73
74
|
*/
|
|
74
75
|
getEndTangent(): Vertex;
|
|
76
|
+
/**
|
|
77
|
+
* Get the sequence of all start/end points of this path.
|
|
78
|
+
* Assumption is: each path segment's end point is located on the next segment's start point
|
|
79
|
+
* to shape a full connected path.
|
|
80
|
+
*
|
|
81
|
+
* No arcs are considered here, just plain linear segments.
|
|
82
|
+
*
|
|
83
|
+
* @returns {Array<Vertex>}
|
|
84
|
+
*/
|
|
85
|
+
getAllStartEndPoints(): Array<Vertex>;
|
|
75
86
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* @author
|
|
4
|
-
* @version
|
|
5
|
-
* @date
|
|
3
|
+
* @author Ikaros Kappler
|
|
4
|
+
* @version 1.1.0
|
|
5
|
+
* @date 2022-10-17
|
|
6
|
+
* @modified 2023-11-27 Added the `GenericPath.getAllStartEndPoints()` function.
|
|
6
7
|
*/
|
|
7
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
9
|
exports.GenericPath = void 0;
|
|
@@ -99,6 +100,22 @@ var GenericPath = /** @class */ (function () {
|
|
|
99
100
|
GenericPath.prototype.getEndTangent = function () {
|
|
100
101
|
return this.segments[this.segments.length - 1].getEndTangent();
|
|
101
102
|
};
|
|
103
|
+
/**
|
|
104
|
+
* Get the sequence of all start/end points of this path.
|
|
105
|
+
* Assumption is: each path segment's end point is located on the next segment's start point
|
|
106
|
+
* to shape a full connected path.
|
|
107
|
+
*
|
|
108
|
+
* No arcs are considered here, just plain linear segments.
|
|
109
|
+
*
|
|
110
|
+
* @returns {Array<Vertex>}
|
|
111
|
+
*/
|
|
112
|
+
GenericPath.prototype.getAllStartEndPoints = function () {
|
|
113
|
+
var verts = [this.segments[0].getStartPoint()];
|
|
114
|
+
this.segments.forEach(function (segment) {
|
|
115
|
+
verts.push(segment.getEndPoint());
|
|
116
|
+
});
|
|
117
|
+
return verts;
|
|
118
|
+
};
|
|
102
119
|
return GenericPath;
|
|
103
120
|
}());
|
|
104
121
|
exports.GenericPath = GenericPath;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericPath.js","sourceRoot":"","sources":["../../../ts/utils/datastructures/GenericPath.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"GenericPath.js","sourceRoot":"","sources":["../../../ts/utils/datastructures/GenericPath.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAKH;IAGE,qBAAY,YAAyB;QACnC,IAAI,CAAC,QAAQ,GAAG,CAAC,YAAY,CAAC,CAAC;IACjC,CAAC;IAED;;;;;;OAMG;IACH,qCAAe,GAAf;QACE,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;IAC9B,CAAC;IAED;;;;;;OAMG;IACH,kCAAY,GAAZ,UAAa,KAAa;QACxB,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;;OAMG;IACH,2BAAK,GAAL;QACE,IAAM,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK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aAAa,EAAE,CAAC;IACjE,CAAC;IAED;;;;;;;;OAQG;IACH,0CAAoB,GAApB;QACE,IAAM,KAAK,GAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC;QAChE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAC,OAAoB;YACzC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QACH,OAAO,KAAK,CAAC;IACf,CAAC;IACH,kBAAC;AAAD,CAAC,AAxHD,IAwHC;AAxHY,kCAAW"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Ikaros Kappler
|
|
3
|
+
* @date 2021-11-07
|
|
4
|
+
* @modified 2023-09-25 Ported to Typescript and added system darkmode detection.
|
|
5
|
+
* @version 1.1.0
|
|
6
|
+
*
|
|
7
|
+
* @param {Record<string,string>} GUP
|
|
8
|
+
* @returns {boolean}
|
|
9
|
+
*/
|
|
10
|
+
export declare const detectDarkMode: (GUP?: Record<string, string>) => boolean;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @author Ikaros Kappler
|
|
4
|
+
* @date 2021-11-07
|
|
5
|
+
* @modified 2023-09-25 Ported to Typescript and added system darkmode detection.
|
|
6
|
+
* @version 1.1.0
|
|
7
|
+
*
|
|
8
|
+
* @param {Record<string,string>} GUP
|
|
9
|
+
* @returns {boolean}
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.detectDarkMode = void 0;
|
|
13
|
+
var detectDarkMode = function (GUP) {
|
|
14
|
+
// Respect overrides
|
|
15
|
+
if (typeof GUP !== "undefined" && GUP.hasOwnProperty("darkmode") && GUP["darkmode"]) {
|
|
16
|
+
// const overrideValue = PlotBoilerplate.utils.fetch.bool(GUP, "darkmode", null);
|
|
17
|
+
var overrideValue = !!JSON.parse(GUP["darkmode"]);
|
|
18
|
+
if (overrideValue !== null) {
|
|
19
|
+
return overrideValue;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (globalThis.matchMedia && globalThis.matchMedia("(prefers-color-scheme: dark)").matches) {
|
|
23
|
+
// dark mode by system
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
// else: dark mode by daytime
|
|
27
|
+
var hours = new Date().getHours();
|
|
28
|
+
var isDayTime = hours > 6 && hours < 18;
|
|
29
|
+
return !isDayTime;
|
|
30
|
+
};
|
|
31
|
+
exports.detectDarkMode = detectDarkMode;
|
|
32
|
+
//# sourceMappingURL=detectDarkMode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detectDarkMode.js","sourceRoot":"","sources":["../../ts/utils/detectDarkMode.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAII,IAAM,cAAc,GAAG,UAAC,GAA4B;IACzD,oBAAoB;IACpB,IAAI,OAAO,GAAG,KAAK,WAAW,IAAI,GAAG,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,EAAE;QACnF,iFAAiF;QACjF,IAAM,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;QACpD,IAAI,aAAa,KAAK,IAAI,EAAE;YAC1B,OAAO,aAAa,CAAC;SACtB;KACF;IACD,IAAI,UAAU,CAAC,UAAU,IAAI,UAAU,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAC,OAAO,EAAE;QAC1F,sBAAsB;QACtB,OAAO,IAAI,CAAC;KACb;IACD,6BAA6B;IAC7B,IAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC;IACpC,IAAM,SAAS,GAAG,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;IAC1C,OAAO,CAAC,SAAS,CAAC;AACpB,CAAC,CAAC;AAjBW,QAAA,cAAc,kBAiBzB"}
|
package/src/esm/BezierPath.d.ts
CHANGED
|
@@ -23,7 +23,9 @@
|
|
|
23
23
|
* @modified 2022-01-31 Added `BezierPath.getEvenDistributionVertices(number)`.
|
|
24
24
|
* @modified 2022-02-02 Added the `destroy` method.
|
|
25
25
|
* @modified 2022-02-02 Cleared the `toSVGString` function (deprecated). Use `drawutilssvg` instead.
|
|
26
|
-
* @
|
|
26
|
+
* @modified 2023-10-06 Adding the `BezierPath.toPathPoints()` method.
|
|
27
|
+
* @modified 2023-10-07 Adding the `BezierPath.fromCurve(CubicBezierCurve)` static function.
|
|
28
|
+
* @version 2.6.0
|
|
27
29
|
*
|
|
28
30
|
* @file BezierPath
|
|
29
31
|
* @public
|
|
@@ -212,54 +214,6 @@ export declare class BezierPath implements SVGSerializable {
|
|
|
212
214
|
* @return {CubicBezierCurve} The curve at the specified index.
|
|
213
215
|
**/
|
|
214
216
|
getCurveAt(curveIndex: number): CubicBezierCurve;
|
|
215
|
-
/**
|
|
216
|
-
* Remove the end point of this path (which removes the last curve from this path).<br>
|
|
217
|
-
* <br>
|
|
218
|
-
* Please note that this function does never remove the first curve, thus the path
|
|
219
|
-
* cannot be empty after this call.
|
|
220
|
-
*
|
|
221
|
-
* @method removeEndPoint
|
|
222
|
-
* @instance
|
|
223
|
-
* @memberof BezierPath
|
|
224
|
-
* @return {boolean} Indicating if the last curve was removed.
|
|
225
|
-
**/
|
|
226
|
-
/**
|
|
227
|
-
* Remove the start point of this path (which removes the first curve from this path).<br>
|
|
228
|
-
* <br>
|
|
229
|
-
* Please note that this function does never remove the last curve, thus the path
|
|
230
|
-
* cannot be empty after this call.<br>
|
|
231
|
-
*
|
|
232
|
-
* @method removeStartPoint
|
|
233
|
-
* @instance
|
|
234
|
-
* @memberof BezierPath
|
|
235
|
-
* @return {boolean} Indicating if the first curve was removed.
|
|
236
|
-
**/
|
|
237
|
-
/**
|
|
238
|
-
* Removes a path point inside the path.
|
|
239
|
-
*
|
|
240
|
-
* This function joins the bezier curve at the given index with
|
|
241
|
-
* its predecessor, which means that the start point at the given
|
|
242
|
-
* curve index will be removed.
|
|
243
|
-
*
|
|
244
|
-
* @method joinAt
|
|
245
|
-
* @param {number} curveIndex - The index of the curve to be joined with its predecessor.
|
|
246
|
-
* @instance
|
|
247
|
-
* @memberof BezierPath
|
|
248
|
-
* @return {boolean} True if the passed index indicated an inner vertex and the two curves were joined.
|
|
249
|
-
**/
|
|
250
|
-
/**
|
|
251
|
-
* Add a new inner curve point to the path.<br>
|
|
252
|
-
* <br>
|
|
253
|
-
* This function splits the bezier curve at the given index and given
|
|
254
|
-
* curve segment index.
|
|
255
|
-
*
|
|
256
|
-
* @method splitAt
|
|
257
|
-
* @param {number} curveIndex - The index of the curve to split.
|
|
258
|
-
* @param {nunber} segmentIndex - The index of the curve segment where the split should be performed.
|
|
259
|
-
* @instance
|
|
260
|
-
* @memberof BezierPath
|
|
261
|
-
* @return {boolean} True if the passed indices were valid and the path was split.
|
|
262
|
-
**/
|
|
263
217
|
/**
|
|
264
218
|
* Move the whole bezier path by the given (x,y)-amount.
|
|
265
219
|
*
|
|
@@ -519,8 +473,22 @@ export declare class BezierPath implements SVGSerializable {
|
|
|
519
473
|
* This function should invalidate any installed listeners and invalidate this object.
|
|
520
474
|
* After calling this function the object might not hold valid data any more and
|
|
521
475
|
* should not be used.
|
|
476
|
+
*
|
|
477
|
+
* @method destroy
|
|
478
|
+
* @instance
|
|
479
|
+
* @memberof BezierPath
|
|
522
480
|
*/
|
|
523
481
|
destroy(): void;
|
|
482
|
+
/**
|
|
483
|
+
* Convert this path to an array of path points that can be drawn by the default DrawLib
|
|
484
|
+
* implementations.
|
|
485
|
+
*
|
|
486
|
+
* @method toPathPoints
|
|
487
|
+
* @instance
|
|
488
|
+
* @memberof BezierPath
|
|
489
|
+
* @return {Array<XYCoords>}
|
|
490
|
+
*/
|
|
491
|
+
toPathPoints(): Array<XYCoords>;
|
|
524
492
|
/**
|
|
525
493
|
* Create a JSON string representation of this bézier curve.
|
|
526
494
|
*
|
|
@@ -542,6 +510,16 @@ export declare class BezierPath implements SVGSerializable {
|
|
|
542
510
|
* @return {BezierPath} The parsed bezier path instance.
|
|
543
511
|
**/
|
|
544
512
|
static fromJSON(jsonString: string): BezierPath;
|
|
513
|
+
/**
|
|
514
|
+
* Construct a new path with a single curve. Adding more curves is always possible.
|
|
515
|
+
*
|
|
516
|
+
* @method fromCurve
|
|
517
|
+
* @param {CubicBezierCurve} curve - The curve to construct a new path from.
|
|
518
|
+
* @static
|
|
519
|
+
* @memberof BezierPath
|
|
520
|
+
* @return {BezierPath} The constructed bezier path instance.
|
|
521
|
+
*/
|
|
522
|
+
static fromCurve(curve: CubicBezierCurve): BezierPath;
|
|
545
523
|
/**
|
|
546
524
|
* Create a BezierPath instance from the given array.
|
|
547
525
|
*
|