plotboilerplate 1.17.0 → 1.17.1
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/changelog.md +16 -0
- package/dist/index.esm.js +42 -9
- 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 +45 -9
- package/dist/plotboilerplate.min.js +1 -1
- package/package.json +1 -1
- package/src/cjs/Bounds.d.ts +11 -0
- package/src/cjs/Bounds.js +14 -0
- package/src/cjs/Bounds.js.map +1 -1
- package/src/cjs/PlotBoilerplate.d.ts +3 -1
- package/src/cjs/PlotBoilerplate.js +8 -1
- package/src/cjs/PlotBoilerplate.js.map +1 -1
- package/src/cjs/draw.d.ts +5 -2
- package/src/cjs/draw.js +10 -4
- package/src/cjs/draw.js.map +1 -1
- package/src/cjs/drawgl.d.ts +4 -2
- package/src/cjs/drawgl.js +5 -2
- package/src/cjs/drawgl.js.map +1 -1
- package/src/cjs/drawutilssvg.d.ts +4 -2
- package/src/cjs/drawutilssvg.js +8 -2
- package/src/cjs/drawutilssvg.js.map +1 -1
- package/src/cjs/interfaces/DrawLib.d.ts +3 -1
- package/src/cjs/interfaces/DrawLib.js +1 -0
- package/src/cjs/interfaces/DrawLib.js.map +1 -1
- package/src/cjs/interfaces/core.d.ts +2 -0
- package/src/cjs/interfaces/core.js +1 -0
- package/src/cjs/interfaces/core.js.map +1 -1
- package/src/cjs/utils/datastructures/Color.d.ts +3 -1
- package/src/cjs/utils/datastructures/Color.js +17 -6
- package/src/cjs/utils/datastructures/Color.js.map +1 -1
- package/src/esm/Bounds.d.ts +11 -0
- package/src/esm/Bounds.js +14 -0
- package/src/esm/Bounds.js.map +1 -1
- package/src/esm/PlotBoilerplate.d.ts +3 -1
- package/src/esm/PlotBoilerplate.js +8 -1
- package/src/esm/PlotBoilerplate.js.map +1 -1
- package/src/esm/draw.d.ts +5 -2
- package/src/esm/draw.js +9 -4
- package/src/esm/draw.js.map +1 -1
- package/src/esm/drawgl.d.ts +4 -2
- package/src/esm/drawgl.js +4 -2
- package/src/esm/drawgl.js.map +1 -1
- package/src/esm/drawutilssvg.d.ts +4 -2
- package/src/esm/drawutilssvg.js +7 -2
- package/src/esm/drawutilssvg.js.map +1 -1
- package/src/esm/interfaces/DrawLib.d.ts +3 -1
- package/src/esm/interfaces/DrawLib.js +1 -0
- package/src/esm/interfaces/DrawLib.js.map +1 -1
- package/src/esm/interfaces/core.d.ts +2 -0
- package/src/esm/interfaces/core.js +1 -0
- package/src/esm/interfaces/core.js.map +1 -1
- package/src/esm/utils/datastructures/Color.d.ts +3 -1
- package/src/esm/utils/datastructures/Color.js +17 -6
- package/src/esm/utils/datastructures/Color.js.map +1 -1
- package/src/ts/Bounds.ts +15 -0
- package/src/ts/PlotBoilerplate.ts +8 -1
- package/src/ts/draw.ts +10 -4
- package/src/ts/drawgl.ts +4 -2
- package/src/ts/drawutilssvg.ts +7 -2
- package/src/ts/interfaces/DrawLib.ts +3 -1
- package/src/ts/interfaces/core.ts +3 -2
- package/src/ts/utils/datastructures/Color.ts +17 -6
package/dist/plotboilerplate.js
CHANGED
|
@@ -1746,6 +1746,20 @@ var Bounds = /** @class */ (function () {
|
|
|
1746
1746
|
Bounds.prototype.toString = function () {
|
|
1747
1747
|
return "{ min: " + this.min.toString() + ", max : " + this.max.toString() + ", width: " + this.width + ", height : " + this.height + " }";
|
|
1748
1748
|
};
|
|
1749
|
+
/**
|
|
1750
|
+
* Clone this bounds object (create a deep clone).
|
|
1751
|
+
*
|
|
1752
|
+
* Note: the returned format might change in the future, so please do not
|
|
1753
|
+
* rely on the returned string format.
|
|
1754
|
+
*
|
|
1755
|
+
* @method clone
|
|
1756
|
+
* @instance
|
|
1757
|
+
* @memberof Bounds
|
|
1758
|
+
* @returns {string} Creates a deep clone of this bounds object. The returned object's `min` and `max` instances are `Vertex` instances.
|
|
1759
|
+
*/
|
|
1760
|
+
// clone() {
|
|
1761
|
+
// return new Bounds(new Vertex(this.min.x, this.min.y), new Vertex(this.max.x, this.max.y));
|
|
1762
|
+
// }
|
|
1749
1763
|
/**
|
|
1750
1764
|
* Compute the minimal bounding box for a given set of vertices.
|
|
1751
1765
|
*
|
|
@@ -4041,7 +4055,8 @@ var __webpack_unused_export__;
|
|
|
4041
4055
|
* @modified 2021-03-29 Clearing `currentClassName` and `currentId` after drawing each drawable.
|
|
4042
4056
|
* @modified 2021-04-25 Extending `remove` to accept arrays of drawables.
|
|
4043
4057
|
* @modified 2021-11-16 Adding the `PBText` drawable.
|
|
4044
|
-
* @
|
|
4058
|
+
* @modified 2022-08-01 Added `title` to the params.
|
|
4059
|
+
* @version 1.15.1
|
|
4045
4060
|
*
|
|
4046
4061
|
* @file PlotBoilerplate
|
|
4047
4062
|
* @fileoverview The main class.
|
|
@@ -4156,6 +4171,7 @@ var PlotBoilerplate = /** @class */ (function () {
|
|
|
4156
4171
|
* @param {boolean=} [config.enableGL=false] - Indicates if the application should use the experimental WebGL features (not recommended).
|
|
4157
4172
|
* @param {boolean=} [config.enableSVGExport=true] - Indicates if the SVG export should be enabled (default is true).
|
|
4158
4173
|
* Note that changes from the postDraw hook might not be visible in the export.
|
|
4174
|
+
* @param {string=} [config.title=null] - Specify any hover tile here. It will be attached as a `title` attribute to the most elevated element.
|
|
4159
4175
|
*/
|
|
4160
4176
|
function PlotBoilerplate(config) {
|
|
4161
4177
|
/**
|
|
@@ -4371,6 +4387,11 @@ var PlotBoilerplate = /** @class */ (function () {
|
|
|
4371
4387
|
else {
|
|
4372
4388
|
throw "Element is neither a canvas nor an svg element.";
|
|
4373
4389
|
}
|
|
4390
|
+
// At this point the event cacher element is deinfed and located at highest elevation.
|
|
4391
|
+
// Set `title` attribut?
|
|
4392
|
+
if (config.title) {
|
|
4393
|
+
this.eventCatcher.setAttribute("title", config.title);
|
|
4394
|
+
}
|
|
4374
4395
|
this.draw.scale.set(this.config.scaleX, this.config.scaleY);
|
|
4375
4396
|
this.fill.scale.set(this.config.scaleX, this.config.scaleY);
|
|
4376
4397
|
this.vertices = [];
|
|
@@ -9179,7 +9200,9 @@ exports.VertexListeners = VertexListeners;
|
|
|
9179
9200
|
* @modified 2022-02-03 Added the `lineWidth` param to the `crosshair` function.
|
|
9180
9201
|
* @modified 2022-02-03 Added the `cross(...)` function.
|
|
9181
9202
|
* @modified 2022-03-27 Added the `texturedPoly` function.
|
|
9182
|
-
* @
|
|
9203
|
+
* @modified 2022-06-01 Tweaked the `polyline` function; lineWidth now scales with scale.x.
|
|
9204
|
+
* @modified 2022-07-26 Adding `alpha` to the `image(...)` function.
|
|
9205
|
+
* @version 1.12.2
|
|
9183
9206
|
**/
|
|
9184
9207
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
9185
9208
|
exports.drawutils = void 0;
|
|
@@ -9321,16 +9344,19 @@ var drawutils = /** @class */ (function () {
|
|
|
9321
9344
|
* @param {Image} image - The image object to draw.
|
|
9322
9345
|
* @param {Vertex} position - The position to draw the the upper left corner at.
|
|
9323
9346
|
* @param {Vertex} size - The x/y-size to draw the image with.
|
|
9347
|
+
* @param {number=0.0} alpha - (optional, default=0.0) The transparency (1.0=opaque, 0.0=transparent).
|
|
9324
9348
|
* @return {void}
|
|
9325
9349
|
* @instance
|
|
9326
9350
|
* @memberof drawutils
|
|
9327
9351
|
**/
|
|
9328
|
-
drawutils.prototype.image = function (image, position, size) {
|
|
9352
|
+
drawutils.prototype.image = function (image, position, size, alpha) {
|
|
9353
|
+
if (alpha === void 0) { alpha = 1.0; }
|
|
9329
9354
|
if (!image.complete || !image.naturalWidth) {
|
|
9330
9355
|
// Avoid drawing un-unloaded or broken images
|
|
9331
9356
|
return;
|
|
9332
9357
|
}
|
|
9333
9358
|
this.ctx.save();
|
|
9359
|
+
this.ctx.globalAlpha = alpha;
|
|
9334
9360
|
// Note that there is a Safari bug with the 3 or 5 params variant.
|
|
9335
9361
|
// Only the 9-param varaint works.
|
|
9336
9362
|
this.ctx.drawImage(image, 0, 0, image.naturalWidth - 1, // There is this horrible Safari bug (fixed in newer versions)
|
|
@@ -9941,11 +9967,12 @@ var drawutils = /** @class */ (function () {
|
|
|
9941
9967
|
* @memberof drawutils
|
|
9942
9968
|
*/
|
|
9943
9969
|
drawutils.prototype.polyline = function (vertices, isOpen, color, lineWidth) {
|
|
9944
|
-
if (vertices.length <= 1)
|
|
9970
|
+
if (vertices.length <= 1) {
|
|
9945
9971
|
return;
|
|
9972
|
+
}
|
|
9946
9973
|
this.ctx.save();
|
|
9947
9974
|
this.ctx.beginPath();
|
|
9948
|
-
this.ctx.lineWidth = lineWidth || 1.0;
|
|
9975
|
+
this.ctx.lineWidth = lineWidth * this.scale.x || 1.0;
|
|
9949
9976
|
this.ctx.moveTo(this.offset.x + vertices[0].x * this.scale.x, this.offset.y + vertices[0].y * this.scale.y);
|
|
9950
9977
|
for (var i = 0; i < vertices.length; i++) {
|
|
9951
9978
|
this.ctx.lineTo(this.offset.x + vertices[i].x * this.scale.x, this.offset.y + vertices[i].y * this.scale.y);
|
|
@@ -10123,7 +10150,8 @@ exports.drawutils = drawutils;
|
|
|
10123
10150
|
* @modified 2022-02-03 Added the `lineWidth` param to the `crosshair` function.
|
|
10124
10151
|
* @modified 2022-02-03 Added the `cross(...)` function.
|
|
10125
10152
|
* @modified 2022-03-27 Added the `texturedPoly` function.
|
|
10126
|
-
* @
|
|
10153
|
+
* @modified 2022-07-26 Adding `alpha` to the `image(...)` function.
|
|
10154
|
+
* @version 0.0.8
|
|
10127
10155
|
**/
|
|
10128
10156
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
10129
10157
|
exports.drawutilsgl = void 0;
|
|
@@ -10316,11 +10344,13 @@ var drawutilsgl = /** @class */ (function () {
|
|
|
10316
10344
|
* @param {Image} image - The image object to draw.
|
|
10317
10345
|
* @param {Vertex} position - The position to draw the the upper left corner at.
|
|
10318
10346
|
* @param {Vertex} size - The x/y-size to draw the image with.
|
|
10347
|
+
* @param {number=0.0} alpha - (optional, default=0.0) The transparency (0.0=opaque, 1.0=transparent).
|
|
10319
10348
|
* @return {void}
|
|
10320
10349
|
* @instance
|
|
10321
10350
|
* @memberof drawutils
|
|
10322
10351
|
**/
|
|
10323
|
-
drawutilsgl.prototype.image = function (image, position, size) {
|
|
10352
|
+
drawutilsgl.prototype.image = function (image, position, size, alpha) {
|
|
10353
|
+
if (alpha === void 0) { alpha = 0.0; }
|
|
10324
10354
|
// NOT YET IMPLEMENTED
|
|
10325
10355
|
};
|
|
10326
10356
|
/**
|
|
@@ -10887,7 +10917,8 @@ var GLU = /** @class */ (function () {
|
|
|
10887
10917
|
* @modified 2022-02-03 Added the `cross(...)` function.
|
|
10888
10918
|
* @modified 2022-03-26 Added the private `nodeDefs` and `bufferedNodeDefs` attributes.
|
|
10889
10919
|
* @modified 2022-03-26 Added the `texturedPoly` function to draw textures polygons.
|
|
10890
|
-
* @
|
|
10920
|
+
* @modified 2022-07-26 Adding `alpha` to the `image(...)` function.
|
|
10921
|
+
* @version 1.6.1
|
|
10891
10922
|
**/
|
|
10892
10923
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
10893
10924
|
exports.drawutilssvg = void 0;
|
|
@@ -11275,12 +11306,14 @@ var drawutilssvg = /** @class */ (function () {
|
|
|
11275
11306
|
* @param {Image} image - The image object to draw.
|
|
11276
11307
|
* @param {Vertex} position - The position to draw the the upper left corner at.
|
|
11277
11308
|
* @param {Vertex} size - The x/y-size to draw the image with.
|
|
11309
|
+
* @param {number=0.0} alpha - (optional, default=0.0) The transparency (1.0=opaque, 0.0=transparent).
|
|
11278
11310
|
* @return {void}
|
|
11279
11311
|
* @instance
|
|
11280
11312
|
* @memberof drawutilssvg
|
|
11281
11313
|
**/
|
|
11282
|
-
drawutilssvg.prototype.image = function (image, position, size) {
|
|
11314
|
+
drawutilssvg.prototype.image = function (image, position, size, alpha) {
|
|
11283
11315
|
var _this = this;
|
|
11316
|
+
if (alpha === void 0) { alpha = 1.0; }
|
|
11284
11317
|
var node = this.makeNode("image");
|
|
11285
11318
|
// We need to re-adjust the image if it was not yet fully loaded before.
|
|
11286
11319
|
var setImageSize = function (image) {
|
|
@@ -11290,6 +11323,9 @@ var drawutilssvg = /** @class */ (function () {
|
|
|
11290
11323
|
node.setAttribute("width", "" + image.naturalWidth * _this.scale.x);
|
|
11291
11324
|
node.setAttribute("height", "" + image.naturalHeight * _this.scale.y);
|
|
11292
11325
|
node.setAttribute("display", null); // Dislay when loaded
|
|
11326
|
+
// if (alpha) {
|
|
11327
|
+
node.setAttribute("opacity", "" + alpha);
|
|
11328
|
+
// }
|
|
11293
11329
|
node.setAttribute("transform", "translate(" + _this._x(position.x) + " " + _this._y(position.y) + ") scale(" + ratioX + " " + ratioY + ")");
|
|
11294
11330
|
}
|
|
11295
11331
|
};
|