plotboilerplate 1.25.0 → 1.27.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 +3 -0
- package/dist/index.esm.js +171 -43
- 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 +171 -43
- package/dist/plotboilerplate.min.js +1 -1
- package/package.json +6 -2
- package/src/cjs/Bounds.d.ts +79 -25
- package/src/cjs/Bounds.js +102 -29
- package/src/cjs/Bounds.js.map +1 -1
- package/src/cjs/CircleSector.d.ts +3 -0
- package/src/cjs/CircleSector.js +28 -1
- package/src/cjs/CircleSector.js.map +1 -1
- package/src/cjs/PlotBoilerplate.d.ts +4 -3
- package/src/cjs/PlotBoilerplate.js +2 -1
- package/src/cjs/PlotBoilerplate.js.map +1 -1
- package/src/cjs/draw.d.ts +4 -2
- package/src/cjs/draw.js +9 -4
- package/src/cjs/draw.js.map +1 -1
- package/src/cjs/drawgl.d.ts +3 -2
- package/src/cjs/drawgl.js +2 -1
- package/src/cjs/drawgl.js.map +1 -1
- package/src/cjs/drawutilssvg.d.ts +10 -4
- package/src/cjs/drawutilssvg.js +28 -7
- package/src/cjs/drawutilssvg.js.map +1 -1
- package/src/cjs/interfaces/DrawLib.d.ts +2 -0
- package/src/cjs/interfaces/DrawLib.js +1 -0
- package/src/cjs/interfaces/DrawLib.js.map +1 -1
- package/src/cjs/utils/LissajousFigure.d.ts +34 -0
- package/src/cjs/utils/LissajousFigure.js +100 -0
- package/src/cjs/utils/LissajousFigure.js.map +1 -0
- package/src/cjs/utils/PerlinNoise.d.ts +19 -0
- package/src/cjs/utils/PerlinNoise.js +352 -0
- package/src/cjs/utils/PerlinNoise.js.map +1 -0
- package/src/cjs/utils/SVGPathUtils.d.ts +22 -0
- package/src/cjs/utils/SVGPathUtils.js +45 -0
- package/src/cjs/utils/SVGPathUtils.js.map +1 -0
- package/src/cjs/utils/WebColors.d.ts +2 -1
- package/src/cjs/utils/WebColors.js +14 -25
- package/src/cjs/utils/WebColors.js.map +1 -1
- package/src/cjs/utils/algorithms/PolygonTesselationOutlines.d.ts +145 -0
- package/src/cjs/utils/algorithms/PolygonTesselationOutlines.js +269 -0
- package/src/cjs/utils/algorithms/PolygonTesselationOutlines.js.map +1 -0
- package/src/cjs/utils/algorithms/pixelCornersToRoundPaths.d.ts +23 -0
- package/src/cjs/utils/algorithms/pixelCornersToRoundPaths.js +270 -0
- package/src/cjs/utils/algorithms/pixelCornersToRoundPaths.js.map +1 -0
- package/src/cjs/utils/datastructures/Color.js +0 -19
- package/src/cjs/utils/datastructures/Color.js.map +1 -1
- package/src/cjs/utils/datastructures/ColorGradient.d.ts +2 -0
- package/src/cjs/utils/datastructures/ColorGradient.js +5 -0
- package/src/cjs/utils/datastructures/ColorGradient.js.map +1 -1
- package/src/cjs/utils/datastructures/DataGrid2d.d.ts +6 -0
- package/src/cjs/utils/datastructures/DataGrid2dArrayMatrix.d.ts +88 -0
- package/src/cjs/utils/datastructures/DataGrid2dArrayMatrix.js +155 -0
- package/src/cjs/utils/datastructures/DataGrid2dArrayMatrix.js.map +1 -0
- package/src/cjs/utils/datastructures/DataGrid2dListAdapter.d.ts +1 -7
- package/src/cjs/utils/datastructures/DataGrid2dListAdapter.js +3 -3
- package/src/cjs/utils/datastructures/DataGrid2dListAdapter.js.map +1 -1
- package/src/cjs/utils/datastructures/GeometryMesh.d.ts +49 -0
- package/src/cjs/utils/datastructures/GeometryMesh.js +58 -0
- package/src/cjs/utils/datastructures/GeometryMesh.js.map +1 -0
- package/src/cjs/utils/datastructures/Girih.d.ts +38 -1
- package/src/cjs/utils/datastructures/Girih.js +71 -1
- package/src/cjs/utils/datastructures/Girih.js.map +1 -1
- package/src/cjs/utils/detectDarkMode.js +16 -7
- package/src/cjs/utils/detectDarkMode.js.map +1 -1
- package/src/cjs/utils/dom/components/ColorGradientPicker.d.ts +4 -3
- package/src/cjs/utils/dom/components/ColorGradientPicker.js +8 -8
- package/src/cjs/utils/dom/components/ColorGradientPicker.js.map +1 -1
- package/src/cjs/utils/dom/components/ColorGradientSelector.d.ts +1 -0
- package/src/cjs/utils/dom/components/ColorGradientSelector.js +4 -2
- package/src/cjs/utils/dom/components/ColorGradientSelector.js.map +1 -1
- package/src/cjs/utils/io/FileDrop.d.ts +2 -0
- package/src/cjs/utils/io/FileDrop.js +4 -0
- package/src/cjs/utils/io/FileDrop.js.map +1 -1
- package/src/cjs/utils/parsers/svg/types.d.ts +8 -8
- package/src/esm/Bounds.d.ts +79 -25
- package/src/esm/Bounds.js +102 -29
- package/src/esm/Bounds.js.map +1 -1
- package/src/esm/CircleSector.d.ts +3 -0
- package/src/esm/CircleSector.js +28 -1
- package/src/esm/CircleSector.js.map +1 -1
- package/src/esm/PlotBoilerplate.d.ts +4 -3
- package/src/esm/PlotBoilerplate.js +2 -1
- package/src/esm/PlotBoilerplate.js.map +1 -1
- package/src/esm/draw.d.ts +4 -2
- package/src/esm/draw.js +9 -4
- package/src/esm/draw.js.map +1 -1
- package/src/esm/drawgl.d.ts +3 -2
- package/src/esm/drawgl.js +2 -1
- package/src/esm/drawgl.js.map +1 -1
- package/src/esm/drawutilssvg.d.ts +10 -4
- package/src/esm/drawutilssvg.js +28 -7
- package/src/esm/drawutilssvg.js.map +1 -1
- package/src/esm/interfaces/DrawLib.d.ts +2 -0
- package/src/esm/interfaces/DrawLib.js +1 -0
- package/src/esm/interfaces/DrawLib.js.map +1 -1
- package/src/esm/utils/LissajousFigure.d.ts +34 -0
- package/src/esm/utils/LissajousFigure.js +95 -0
- package/src/esm/utils/LissajousFigure.js.map +1 -0
- package/src/esm/utils/PerlinNoise.d.ts +19 -0
- package/src/esm/utils/PerlinNoise.js +346 -0
- package/src/esm/utils/PerlinNoise.js.map +1 -0
- package/src/esm/utils/SVGPathUtils.d.ts +22 -0
- package/src/esm/utils/SVGPathUtils.js +42 -0
- package/src/esm/utils/SVGPathUtils.js.map +1 -0
- package/src/esm/utils/WebColors.d.ts +2 -1
- package/src/esm/utils/WebColors.js +14 -25
- package/src/esm/utils/WebColors.js.map +1 -1
- package/src/esm/utils/algorithms/PolygonTesselationOutlines.d.ts +145 -0
- package/src/esm/utils/algorithms/PolygonTesselationOutlines.js +262 -0
- package/src/esm/utils/algorithms/PolygonTesselationOutlines.js.map +1 -0
- package/src/esm/utils/algorithms/pixelCornersToRoundPaths.d.ts +23 -0
- package/src/esm/utils/algorithms/pixelCornersToRoundPaths.js +266 -0
- package/src/esm/utils/algorithms/pixelCornersToRoundPaths.js.map +1 -0
- package/src/esm/utils/datastructures/Color.js +0 -19
- package/src/esm/utils/datastructures/Color.js.map +1 -1
- package/src/esm/utils/datastructures/ColorGradient.d.ts +2 -0
- package/src/esm/utils/datastructures/ColorGradient.js +5 -0
- package/src/esm/utils/datastructures/ColorGradient.js.map +1 -1
- package/src/esm/utils/datastructures/DataGrid2d.d.ts +6 -0
- package/src/esm/utils/datastructures/DataGrid2dArrayMatrix.d.ts +88 -0
- package/src/esm/utils/datastructures/DataGrid2dArrayMatrix.js +150 -0
- package/src/esm/utils/datastructures/DataGrid2dArrayMatrix.js.map +1 -0
- package/src/esm/utils/datastructures/DataGrid2dListAdapter.d.ts +1 -7
- package/src/esm/utils/datastructures/DataGrid2dListAdapter.js +3 -3
- package/src/esm/utils/datastructures/DataGrid2dListAdapter.js.map +1 -1
- package/src/esm/utils/datastructures/GeometryMesh.d.ts +49 -0
- package/src/esm/utils/datastructures/GeometryMesh.js +53 -0
- package/src/esm/utils/datastructures/GeometryMesh.js.map +1 -0
- package/src/esm/utils/datastructures/Girih.d.ts +38 -1
- package/src/esm/utils/datastructures/Girih.js +71 -1
- package/src/esm/utils/datastructures/Girih.js.map +1 -1
- package/src/esm/utils/detectDarkMode.js +16 -7
- package/src/esm/utils/detectDarkMode.js.map +1 -1
- package/src/esm/utils/dom/components/ColorGradientPicker.d.ts +4 -3
- package/src/esm/utils/dom/components/ColorGradientPicker.js +18 -7
- package/src/esm/utils/dom/components/ColorGradientPicker.js.map +1 -1
- package/src/esm/utils/dom/components/ColorGradientSelector.d.ts +1 -0
- package/src/esm/utils/dom/components/ColorGradientSelector.js +9 -2
- package/src/esm/utils/dom/components/ColorGradientSelector.js.map +1 -1
- package/src/esm/utils/io/FileDrop.d.ts +2 -0
- package/src/esm/utils/io/FileDrop.js +4 -0
- package/src/esm/utils/io/FileDrop.js.map +1 -1
- package/src/esm/utils/parsers/svg/types.d.ts +8 -8
- package/src/ts/Bounds.ts +107 -22
- package/src/ts/CircleSector.ts +39 -6
- package/src/ts/PlotBoilerplate.ts +4 -3
- package/src/ts/draw.ts +8 -3
- package/src/ts/drawgl.ts +3 -2
- package/src/ts/drawutilssvg.ts +34 -7
- package/src/ts/interfaces/DrawLib.ts +3 -0
- package/src/ts/utils/LissajousFigure.ts +110 -0
- package/src/ts/utils/PerlinNoise.ts +368 -0
- package/src/ts/utils/SVGPathUtils.ts +55 -0
- package/src/ts/utils/WebColors.ts +20 -33
- package/src/ts/utils/algorithms/PolygonTesselationOutlines.ts +296 -0
- package/src/ts/utils/algorithms/pixelCornersToRoundPaths.ts +379 -0
- package/src/ts/utils/datastructures/Color.ts +0 -19
- package/src/ts/utils/datastructures/ColorGradient.ts +6 -0
- package/src/ts/utils/datastructures/DataGrid2d.ts +7 -0
- package/src/ts/utils/datastructures/DataGrid2dArrayMatrix.ts +182 -0
- package/src/ts/utils/datastructures/DataGrid2dListAdapter.ts +4 -11
- package/src/ts/utils/datastructures/GeometryMesh.ts +79 -0
- package/src/ts/utils/datastructures/Girih.ts +78 -1
- package/src/ts/utils/datastructures/interfaces.ts +4 -4
- package/src/ts/utils/detectDarkMode.ts +17 -8
- package/src/ts/utils/dom/components/ColorGradientPicker.tsx +18 -6
- package/src/ts/utils/dom/components/ColorGradientSelector.tsx +9 -2
- package/src/ts/utils/io/FileDrop.ts +5 -0
- package/src/ts/utils/parsers/svg/types.ts +8 -8
package/dist/plotboilerplate.js
CHANGED
|
@@ -270,7 +270,9 @@ exports.Vector = Vector;
|
|
|
270
270
|
* @modified 2023-09-30 Adding `strokeOptions` param to these draw function: line, arrow, cubicBezierArrow, cubicBezier, cubicBezierPath, circle, circleArc, ellipse, square, rect, polygon, polyline.
|
|
271
271
|
* @modified 2023-10-07 Adding the optional `arrowHeadBasePositionBuffer` param to the arrowHead(...) method.
|
|
272
272
|
* @modified 2024-09-13 Remoed the scaling of `lineWidth` in the `polygon` and `polyline` methods. This makes no sense here and doesn't match up with the behavior of other line functions.
|
|
273
|
-
* @
|
|
273
|
+
* @modified 2026-01-04 Adding `lineJoin` attribute to the `StrokeOptions`.
|
|
274
|
+
* @modified 2026-03-18 Adding `isOpen` parameter to `cubicBezierPath` draw method.
|
|
275
|
+
* @version 1.14.0
|
|
274
276
|
**/
|
|
275
277
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
276
278
|
exports.drawutils = void 0;
|
|
@@ -310,13 +312,14 @@ var drawutils = /** @class */ (function () {
|
|
|
310
312
|
*/
|
|
311
313
|
drawutils.prototype.applyStrokeOpts = function (strokeOptions) {
|
|
312
314
|
var _this = this;
|
|
313
|
-
var _a, _b;
|
|
315
|
+
var _a, _b, _c;
|
|
314
316
|
this.ctx.setLineDash(((_a = strokeOptions === null || strokeOptions === void 0 ? void 0 : strokeOptions.dashArray) !== null && _a !== void 0 ? _a : []).map(function (dashArrayElem) {
|
|
315
317
|
// Note assume scale.x === scale.y
|
|
316
318
|
// Invariant scale makes funny stuff anyway.
|
|
317
319
|
return dashArrayElem * _this.scale.x;
|
|
318
320
|
}));
|
|
319
321
|
this.ctx.lineDashOffset = ((_b = strokeOptions === null || strokeOptions === void 0 ? void 0 : strokeOptions.dashOffset) !== null && _b !== void 0 ? _b : 0) * this.scale.x;
|
|
322
|
+
this.ctx.lineJoin = (_c = strokeOptions === null || strokeOptions === void 0 ? void 0 : strokeOptions.lineJoin) !== null && _c !== void 0 ? _c : null;
|
|
320
323
|
};
|
|
321
324
|
// +---------------------------------------------------------------------------------
|
|
322
325
|
// | This is the final helper function for drawing and filling stuff. It is not
|
|
@@ -765,7 +768,7 @@ var drawutils = /** @class */ (function () {
|
|
|
765
768
|
* @instance
|
|
766
769
|
* @memberof drawutils
|
|
767
770
|
*/
|
|
768
|
-
drawutils.prototype.cubicBezierPath = function (path, color, lineWidth, strokeOptions) {
|
|
771
|
+
drawutils.prototype.cubicBezierPath = function (path, color, lineWidth, strokeOptions, isOpen) {
|
|
769
772
|
if (!path || path.length == 0) {
|
|
770
773
|
return;
|
|
771
774
|
}
|
|
@@ -783,7 +786,9 @@ var drawutils = /** @class */ (function () {
|
|
|
783
786
|
endPoint = path[i + 2];
|
|
784
787
|
this.ctx.bezierCurveTo(this.offset.x + startControlPoint.x * this.scale.x, this.offset.y + startControlPoint.y * this.scale.y, this.offset.x + endControlPoint.x * this.scale.x, this.offset.y + endControlPoint.y * this.scale.y, this.offset.x + endPoint.x * this.scale.x, this.offset.y + endPoint.y * this.scale.y);
|
|
785
788
|
}
|
|
786
|
-
|
|
789
|
+
if (!isOpen) {
|
|
790
|
+
this.ctx.closePath();
|
|
791
|
+
}
|
|
787
792
|
this.ctx.lineWidth = lineWidth || 1;
|
|
788
793
|
this._fillOrDraw(color);
|
|
789
794
|
this.ctx.restore();
|
|
@@ -1391,7 +1396,11 @@ exports.drawutils = drawutils;
|
|
|
1391
1396
|
* @modified 2025-04-18 Change parameter type in `Bounds.computeFromVertices` from `Vertex` to more general `XYCoords`.
|
|
1392
1397
|
* @modified 2025-04-19 Added methods to `Bounds` class: `getNorthPoint`, `getSouthPoint`, `getEastPoint` and `getWestPoint`.
|
|
1393
1398
|
* @modified 2025-04-26 Added static method `Bounds.computeFromBoundsSet` to calculate containing bounds for a set of bounding boxes.
|
|
1394
|
-
* @
|
|
1399
|
+
* @modified 2025-10-17 Added the methods `Bounds.getSouthWestPoint`, `getNorthWestPoint`, `getNorthEastPoint` and `getSouthEastPoint`.
|
|
1400
|
+
* @modified 2025-10-18 Added method `Bounds.containsVert(XYCoords)`.
|
|
1401
|
+
* @modified 2025-10-28 Added the `Bounds.getWidth()` and `Bounds.getHeight()`.
|
|
1402
|
+
* @modified 2025-11-12 Added the `Bounds.getMoved()` method.
|
|
1403
|
+
* @version 1.11.0
|
|
1395
1404
|
**/
|
|
1396
1405
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1397
1406
|
exports.Bounds = void 0;
|
|
@@ -1419,6 +1428,35 @@ var Bounds = /** @class */ (function () {
|
|
|
1419
1428
|
this.width = max.x - min.x;
|
|
1420
1429
|
this.height = max.y - min.y;
|
|
1421
1430
|
}
|
|
1431
|
+
/**
|
|
1432
|
+
* Check if the given vertex is inside this bounds.
|
|
1433
|
+
*
|
|
1434
|
+
* @method containsVert
|
|
1435
|
+
* @param {XYCoords} vert - The vertex to check.
|
|
1436
|
+
* @return {boolean} True if the passed vertex is inside this bounds.
|
|
1437
|
+
* @instance
|
|
1438
|
+
* @memberof Bounds
|
|
1439
|
+
**/
|
|
1440
|
+
Bounds.prototype.containsVert = function (vert) {
|
|
1441
|
+
return this.min.x <= vert.x && vert.x < this.max.x && this.min.y <= vert.y && vert.y < this.max.y;
|
|
1442
|
+
};
|
|
1443
|
+
Bounds.prototype.getWidth = function () {
|
|
1444
|
+
return this.max.x - this.min.x;
|
|
1445
|
+
};
|
|
1446
|
+
Bounds.prototype.getHeight = function () {
|
|
1447
|
+
return this.max.y - this.min.y;
|
|
1448
|
+
};
|
|
1449
|
+
Bounds.prototype.getScaled = function (scaleFactor) {
|
|
1450
|
+
var center = this.getCenter();
|
|
1451
|
+
var newMin = new Vertex_1.Vertex(this.min).scale(scaleFactor, center);
|
|
1452
|
+
var newMax = new Vertex_1.Vertex(this.max).scale(scaleFactor, center);
|
|
1453
|
+
return new Bounds(newMin, newMax);
|
|
1454
|
+
};
|
|
1455
|
+
Bounds.prototype.getMoved = function (moveAmount) {
|
|
1456
|
+
var newMin = new Vertex_1.Vertex(this.min).move(moveAmount);
|
|
1457
|
+
var newMax = new Vertex_1.Vertex(this.max).move(moveAmount);
|
|
1458
|
+
return new Bounds(newMin, newMax);
|
|
1459
|
+
};
|
|
1422
1460
|
/**
|
|
1423
1461
|
* Get the center point of the north bound.
|
|
1424
1462
|
*
|
|
@@ -1430,7 +1468,6 @@ var Bounds = /** @class */ (function () {
|
|
|
1430
1468
|
Bounds.prototype.getNorthPoint = function () {
|
|
1431
1469
|
return new Vertex_1.Vertex(this.min.x + this.width / 2.0, this.min.y);
|
|
1432
1470
|
};
|
|
1433
|
-
;
|
|
1434
1471
|
/**
|
|
1435
1472
|
* Get the center point of the south bound.
|
|
1436
1473
|
*
|
|
@@ -1442,31 +1479,72 @@ var Bounds = /** @class */ (function () {
|
|
|
1442
1479
|
Bounds.prototype.getSouthPoint = function () {
|
|
1443
1480
|
return new Vertex_1.Vertex(this.min.x + this.width / 2.0, this.max.y);
|
|
1444
1481
|
};
|
|
1445
|
-
;
|
|
1446
1482
|
/**
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1483
|
+
* Get the center point of the west bound.
|
|
1484
|
+
*
|
|
1485
|
+
* @method getWestPoint
|
|
1486
|
+
* @instance
|
|
1487
|
+
* @memberof Bounds
|
|
1488
|
+
* @return {Vertex} The "westhmost" centered point of this bounding box.
|
|
1489
|
+
*/
|
|
1454
1490
|
Bounds.prototype.getWestPoint = function () {
|
|
1455
1491
|
return new Vertex_1.Vertex(this.min.x, this.min.y + this.height / 2.0);
|
|
1456
1492
|
};
|
|
1457
|
-
;
|
|
1458
1493
|
/**
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1494
|
+
* Get the center point of the east bound.
|
|
1495
|
+
*
|
|
1496
|
+
* @method getEastPoint
|
|
1497
|
+
* @instance
|
|
1498
|
+
* @memberof Bounds
|
|
1499
|
+
* @return {Vertex} The "easthmost" centered point of this bounding box.
|
|
1500
|
+
*/
|
|
1466
1501
|
Bounds.prototype.getEastPoint = function () {
|
|
1467
1502
|
return new Vertex_1.Vertex(this.max.x, this.min.y + this.height / 2.0);
|
|
1468
1503
|
};
|
|
1469
|
-
|
|
1504
|
+
/**
|
|
1505
|
+
* Get the upper left corner point these bounds box.
|
|
1506
|
+
*
|
|
1507
|
+
* @method getNorthWestPoint
|
|
1508
|
+
* @instance
|
|
1509
|
+
* @memberof Bounds
|
|
1510
|
+
* @return {Vertex} The "northwestmost" point of this bounding box.
|
|
1511
|
+
*/
|
|
1512
|
+
Bounds.prototype.getNorthWestPoint = function () {
|
|
1513
|
+
return new Vertex_1.Vertex(this.min.x, this.min.y);
|
|
1514
|
+
};
|
|
1515
|
+
/**
|
|
1516
|
+
* Get the upper right corner point these bounds box.
|
|
1517
|
+
*
|
|
1518
|
+
* @method getNorthEastPoint
|
|
1519
|
+
* @instance
|
|
1520
|
+
* @memberof Bounds
|
|
1521
|
+
* @return {Vertex} The "northeastmost" point of this bounding box.
|
|
1522
|
+
*/
|
|
1523
|
+
Bounds.prototype.getNorthEastPoint = function () {
|
|
1524
|
+
return new Vertex_1.Vertex(this.max.x, this.min.y);
|
|
1525
|
+
};
|
|
1526
|
+
/**
|
|
1527
|
+
* Get the lower right corner point these bounds box.
|
|
1528
|
+
*
|
|
1529
|
+
* @method getSouthEastPoint
|
|
1530
|
+
* @instance
|
|
1531
|
+
* @memberof Bounds
|
|
1532
|
+
* @return {Vertex} The "southeastmost" point of this bounding box.
|
|
1533
|
+
*/
|
|
1534
|
+
Bounds.prototype.getSouthEastPoint = function () {
|
|
1535
|
+
return new Vertex_1.Vertex(this.max.x, this.max.y);
|
|
1536
|
+
};
|
|
1537
|
+
/**
|
|
1538
|
+
* Get the lower left corner point these bounds box.
|
|
1539
|
+
*
|
|
1540
|
+
* @method getSouthWestPoint
|
|
1541
|
+
* @instance
|
|
1542
|
+
* @memberof Bounds
|
|
1543
|
+
* @return {Vertex} The "southwestmost" point of this bounding box.
|
|
1544
|
+
*/
|
|
1545
|
+
Bounds.prototype.getSouthWestPoint = function () {
|
|
1546
|
+
return new Vertex_1.Vertex(this.min.x, this.max.y);
|
|
1547
|
+
};
|
|
1470
1548
|
/**
|
|
1471
1549
|
* Convert this rectangular bounding box to a polygon with four vertices.
|
|
1472
1550
|
*
|
|
@@ -1579,16 +1657,16 @@ var Bounds = /** @class */ (function () {
|
|
|
1579
1657
|
return new Bounds(new Vertex_1.Vertex(xMin, yMin), new Vertex_1.Vertex(xMax, yMax));
|
|
1580
1658
|
};
|
|
1581
1659
|
/**
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1660
|
+
* Compute the minimal bounding box for a given set of existing bounding boxes.
|
|
1661
|
+
*
|
|
1662
|
+
* An empty vertex array will return an empty bounding box located at (0,0).
|
|
1663
|
+
*
|
|
1664
|
+
* @static
|
|
1665
|
+
* @method computeFromBoundsSet
|
|
1666
|
+
* @memberof Bounds
|
|
1667
|
+
* @param {Array<IBounds>} boundingBoxes - The set of existing bounding boxes to get the containing bounding box for.
|
|
1668
|
+
* @return The minimal Bounds for the given bounds instances.
|
|
1669
|
+
**/
|
|
1592
1670
|
Bounds.computeFromBoundsSet = function (boundingBoxes) {
|
|
1593
1671
|
if (boundingBoxes.length == 0) {
|
|
1594
1672
|
return new Bounds(new Vertex_1.Vertex(0, 0), new Vertex_1.Vertex(0, 0));
|
|
@@ -2237,6 +2315,32 @@ var CircleSector = /** @class */ (function () {
|
|
|
2237
2315
|
});
|
|
2238
2316
|
};
|
|
2239
2317
|
//--- END --- Implement interface `Intersectable`
|
|
2318
|
+
CircleSector.prototype.describeSVGPath = function (options) {
|
|
2319
|
+
// const buffer: SVGPathParams = [];
|
|
2320
|
+
// const start = this.getStartPoint();
|
|
2321
|
+
// const end = this.getEndPoint();
|
|
2322
|
+
// // describeSVGArc
|
|
2323
|
+
// // x: number,
|
|
2324
|
+
// // y: number,
|
|
2325
|
+
// // radius: number,
|
|
2326
|
+
// // startAngle: number,
|
|
2327
|
+
// // endAngle: number,
|
|
2328
|
+
// // options?: { moveToStart: boolean }
|
|
2329
|
+
// // ): SVGPathParams => {
|
|
2330
|
+
// var arcRotation = 0.0;
|
|
2331
|
+
// var largeArcFlag = 1;
|
|
2332
|
+
// var sweepFlag = 0;
|
|
2333
|
+
// if (options && options.moveToStart) {
|
|
2334
|
+
// buffer.push("M", start.x, start.y);
|
|
2335
|
+
// }
|
|
2336
|
+
// buffer.push("A", cSector.circle.radius, cSector.circle.radius, arcRotation, largeArcFlag, sweepFlag, end.x, end.y);
|
|
2337
|
+
// return buffer;
|
|
2338
|
+
var arc = CircleSector.circleSectorUtils.describeSVGArc(this.circle.center.x, // end.x,
|
|
2339
|
+
this.circle.center.y, // end.y,
|
|
2340
|
+
this.circle.radius, this.startAngle, this.endAngle, options // options?: { moveToStart: boolean }
|
|
2341
|
+
);
|
|
2342
|
+
return arc;
|
|
2343
|
+
};
|
|
2240
2344
|
/**
|
|
2241
2345
|
* This function should invalidate any installed listeners and invalidate this object.
|
|
2242
2346
|
* After calling this function the object might not hold valid data any more and
|
|
@@ -2275,8 +2379,9 @@ var CircleSector = /** @class */ (function () {
|
|
|
2275
2379
|
* @return [ 'A', radiusx, radiusy, rotation=0, largeArcFlag=1|0, sweepFlag=0, endx, endy ]
|
|
2276
2380
|
*/
|
|
2277
2381
|
describeSVGArc: function (x, y, radius, startAngle, endAngle, options) {
|
|
2278
|
-
if (typeof options === "undefined")
|
|
2382
|
+
if (typeof options === "undefined") {
|
|
2279
2383
|
options = { moveToStart: true };
|
|
2384
|
+
}
|
|
2280
2385
|
var end = CircleSector.circleSectorUtils.polarToCartesian(x, y, radius, endAngle);
|
|
2281
2386
|
var start = CircleSector.circleSectorUtils.polarToCartesian(x, y, radius, startAngle);
|
|
2282
2387
|
// Split full circles into two halves.
|
|
@@ -2335,6 +2440,7 @@ exports.CircleSector = CircleSector;
|
|
|
2335
2440
|
* @modified 2023-09-29 Added the `arrowHead(...)` function to the 'DrawLib.arrow()` interface.
|
|
2336
2441
|
* @modified 2023-09-29 Added the `cubicBezierArrow(...)` function to the 'DrawLib.arrow()` interface.
|
|
2337
2442
|
* @modified 2023-09-29 Added the `lineDashes` attribute.
|
|
2443
|
+
* @modified 2026-03-18 Adding `isOpen` parameter to `cubicBezierPath` draw method.
|
|
2338
2444
|
* @version 0.0.10
|
|
2339
2445
|
**/
|
|
2340
2446
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
@@ -2651,7 +2757,7 @@ var drawutilsgl = /** @class */ (function () {
|
|
|
2651
2757
|
* @instance
|
|
2652
2758
|
* @memberof drawutils
|
|
2653
2759
|
*/
|
|
2654
|
-
drawutilsgl.prototype.cubicBezierPath = function (path, color, lineWidth) {
|
|
2760
|
+
drawutilsgl.prototype.cubicBezierPath = function (path, color, lineWidth, strokeOptions, isOpen) {
|
|
2655
2761
|
// NOT YET IMPLEMENTED
|
|
2656
2762
|
};
|
|
2657
2763
|
/**
|
|
@@ -3393,7 +3499,11 @@ exports.geomutils = {
|
|
|
3393
3499
|
* @modified 2024-01-30 Fixing an issue with immutable style sets; changes to the global draw config did not reflect here (do now).
|
|
3394
3500
|
* @modified 2024-03-10 Fixing some types for Typescript 5 compatibility.
|
|
3395
3501
|
* @modified 2024-07-24 Caching custom style defs in a private buffer variable.
|
|
3396
|
-
* @
|
|
3502
|
+
* @modified 2025-11-14 Fixing a bug in the CSS `mix-blend-mode` property handling (caused a runtime error).
|
|
3503
|
+
* @modified 2026-01-04 Adding `lineJoin` attribute to the methods' `StrokeOptions` param.
|
|
3504
|
+
* @modified 2026-01-04 Fixing missing `strokeOptions` param in the `drawutilssvg.polygon` method.
|
|
3505
|
+
* @modified 2026-03-18 Adding `isOpen` parameter to `cubicBezierPath` draw method.
|
|
3506
|
+
* @version 1.7.0
|
|
3397
3507
|
**/
|
|
3398
3508
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3399
3509
|
exports.drawutilssvg = void 0;
|
|
@@ -3598,8 +3708,13 @@ var drawutilssvg = /** @class */ (function () {
|
|
|
3598
3708
|
node = this.createSVGNode(nodeName);
|
|
3599
3709
|
}
|
|
3600
3710
|
if (this.drawlibConfiguration.blendMode) {
|
|
3601
|
-
|
|
3602
|
-
|
|
3711
|
+
var blendMode = node.style["mix-blend-mode"];
|
|
3712
|
+
if (typeof blendMode === "function") {
|
|
3713
|
+
blendMode(this.drawlibConfiguration.blendMode);
|
|
3714
|
+
}
|
|
3715
|
+
else {
|
|
3716
|
+
node.style["mix-blend-mode"] = this.drawlibConfiguration.blendMode;
|
|
3717
|
+
}
|
|
3603
3718
|
}
|
|
3604
3719
|
// if (this.lineDashEnabled && this.lineDash && this.lineDash.length > 0 && drawutilssvg.nodeSupportsLineDash(nodeName)) {
|
|
3605
3720
|
// node.setAttribute("stroke-dasharray", this.lineDash.join(" "));
|
|
@@ -3796,6 +3911,7 @@ var drawutilssvg = /** @class */ (function () {
|
|
|
3796
3911
|
*/
|
|
3797
3912
|
drawutilssvg.prototype.applyStrokeOpts = function (node, strokeOptions) {
|
|
3798
3913
|
var _this = this;
|
|
3914
|
+
// Set line dash options?
|
|
3799
3915
|
if (strokeOptions &&
|
|
3800
3916
|
strokeOptions.dashArray &&
|
|
3801
3917
|
strokeOptions.dashArray.length > 0 &&
|
|
@@ -3809,6 +3925,10 @@ var drawutilssvg = /** @class */ (function () {
|
|
|
3809
3925
|
node.setAttribute("stroke-dashoffset", "".concat(strokeOptions.dashOffset * this.scale.x));
|
|
3810
3926
|
}
|
|
3811
3927
|
}
|
|
3928
|
+
// Set line join option?
|
|
3929
|
+
if (strokeOptions && strokeOptions.lineJoin && drawutilssvg.nodeSupportsLineJoin(node.tagName)) {
|
|
3930
|
+
node.setAttribute("stroke-linejoin", strokeOptions.lineJoin);
|
|
3931
|
+
}
|
|
3812
3932
|
};
|
|
3813
3933
|
drawutilssvg.prototype._x = function (x) {
|
|
3814
3934
|
return this.offset.x + this.scale.x * x;
|
|
@@ -4064,12 +4184,12 @@ var drawutilssvg = /** @class */ (function () {
|
|
|
4064
4184
|
* @param {string} color - The CSS colot to draw the path with.
|
|
4065
4185
|
* @param {number=1} lineWidth - (optional) The line width to use.
|
|
4066
4186
|
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
4067
|
-
*
|
|
4187
|
+
* @param {boolean} isOpen - (optional) Set to tur if the path should not be closed.
|
|
4068
4188
|
* @return {void}
|
|
4069
4189
|
* @instance
|
|
4070
4190
|
* @memberof drawutilssvg
|
|
4071
4191
|
*/
|
|
4072
|
-
drawutilssvg.prototype.cubicBezierPath = function (path, color, lineWidth, strokeOptions) {
|
|
4192
|
+
drawutilssvg.prototype.cubicBezierPath = function (path, color, lineWidth, strokeOptions, isOpen) {
|
|
4073
4193
|
var node = this.makeNode("path");
|
|
4074
4194
|
this.applyStrokeOpts(node, strokeOptions);
|
|
4075
4195
|
if (!path || path.length == 0) {
|
|
@@ -4087,6 +4207,9 @@ var drawutilssvg = /** @class */ (function () {
|
|
|
4087
4207
|
endPoint = path[i + 2];
|
|
4088
4208
|
d.push("C", this._x(startControlPoint.x), this._y(startControlPoint.y), this._x(endControlPoint.x), this._y(endControlPoint.y), this._x(endPoint.x), this._y(endPoint.y));
|
|
4089
4209
|
}
|
|
4210
|
+
if (!isOpen) {
|
|
4211
|
+
d.push("Z");
|
|
4212
|
+
}
|
|
4090
4213
|
node.setAttribute("d", d.join(" "));
|
|
4091
4214
|
return this._bindFillDraw(node, "cubicBezierPath", color, lineWidth || 1);
|
|
4092
4215
|
};
|
|
@@ -4523,12 +4646,13 @@ var drawutilssvg = /** @class */ (function () {
|
|
|
4523
4646
|
* @param {Polygon} polygon - The polygon to draw.
|
|
4524
4647
|
* @param {string} color - The CSS color to draw the polygon with.
|
|
4525
4648
|
* @param {number=} lineWidth - (optional) The line width to use; default is 1.
|
|
4649
|
+
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
4526
4650
|
* @return {void}
|
|
4527
4651
|
* @instance
|
|
4528
4652
|
* @memberof drawutilssvg
|
|
4529
4653
|
*/
|
|
4530
|
-
drawutilssvg.prototype.polygon = function (polygon, color, lineWidth) {
|
|
4531
|
-
return this.polyline(polygon.vertices, polygon.isOpen, color, lineWidth);
|
|
4654
|
+
drawutilssvg.prototype.polygon = function (polygon, color, lineWidth, strokeOptions) {
|
|
4655
|
+
return this.polyline(polygon.vertices, polygon.isOpen, color, lineWidth, strokeOptions);
|
|
4532
4656
|
};
|
|
4533
4657
|
/**
|
|
4534
4658
|
* Draw a polygon line (alternative function to the polygon).
|
|
@@ -4907,6 +5031,9 @@ var drawutilssvg = /** @class */ (function () {
|
|
|
4907
5031
|
drawutilssvg.nodeSupportsLineDash = function (nodeName) {
|
|
4908
5032
|
return ["line", "path", "circle", "ellipse", "rectangle", "rect"].includes(nodeName);
|
|
4909
5033
|
};
|
|
5034
|
+
drawutilssvg.nodeSupportsLineJoin = function (nodeName) {
|
|
5035
|
+
return ["line", "path", "circle", "ellipse", "rectangle", "rect"].includes(nodeName);
|
|
5036
|
+
};
|
|
4910
5037
|
/**
|
|
4911
5038
|
* Creates a basic <line> node with start and end coordinates. The created node will not
|
|
4912
5039
|
* be bound to any root node.
|
|
@@ -5641,8 +5768,9 @@ exports.KeyHandler = KeyHandler;
|
|
|
5641
5768
|
* @modified 2025-05-07 Added `PlogBoilerplate.addContentChangeListener` and `.removeContentChangeListener`.
|
|
5642
5769
|
* @modified 2025-05-07 Moving full vectors now by default when vector point a is moved.
|
|
5643
5770
|
* @modified 2025-05-20 Applying `lineWith` parameter in the draw routine for vectors (had been missing).
|
|
5771
|
+
* @modified 2026-03-13 Changed visibility of `setZoom` and `setOffset` to public. There was no good reason to have the private.
|
|
5644
5772
|
*
|
|
5645
|
-
* @version 1.21.
|
|
5773
|
+
* @version 1.21.2
|
|
5646
5774
|
*
|
|
5647
5775
|
* @file PlotBoilerplate
|
|
5648
5776
|
* @fileoverview The main class.
|