plotboilerplate 1.17.1 → 1.18.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 +63 -6
- package/changelog.md +12 -3
- package/dist/index.esm.js +112 -21
- 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 +112 -21
- package/dist/plotboilerplate.min.js +1 -1
- package/package.json +1 -1
- package/src/cjs/Circle.d.ts +36 -2
- package/src/cjs/Circle.js +81 -1
- package/src/cjs/Circle.js.map +1 -1
- package/src/cjs/MouseHandler.d.ts +3 -2
- package/src/cjs/MouseHandler.js +16 -14
- package/src/cjs/MouseHandler.js.map +1 -1
- package/src/cjs/draw.d.ts +4 -1
- package/src/cjs/draw.js +15 -6
- package/src/cjs/draw.js.map +1 -1
- package/src/esm/Circle.d.ts +36 -2
- package/src/esm/Circle.js +81 -1
- package/src/esm/Circle.js.map +1 -1
- package/src/esm/MouseHandler.d.ts +3 -2
- package/src/esm/MouseHandler.js +16 -14
- package/src/esm/MouseHandler.js.map +1 -1
- package/src/esm/draw.d.ts +4 -1
- package/src/esm/draw.js +15 -6
- package/src/esm/draw.js.map +1 -1
- package/src/ts/Circle.ts +92 -2
- package/src/ts/MouseHandler.ts +16 -15
- package/src/ts/draw.ts +15 -6
package/src/ts/draw.ts
CHANGED
|
@@ -44,7 +44,10 @@
|
|
|
44
44
|
* @modified 2022-03-27 Added the `texturedPoly` function.
|
|
45
45
|
* @modified 2022-06-01 Tweaked the `polyline` function; lineWidth now scales with scale.x.
|
|
46
46
|
* @modified 2022-07-26 Adding `alpha` to the `image(...)` function.
|
|
47
|
-
* @
|
|
47
|
+
* @modified 2022-08-23 Fixed a type issue in the `polyline` function.
|
|
48
|
+
* @modified 2022-08-23 Fixed a type issue in the `setConfiguration` function.
|
|
49
|
+
* @modified 2022-08-23 Fixed a type issue in the `path` function.
|
|
50
|
+
* @version 1.12.3
|
|
48
51
|
**/
|
|
49
52
|
|
|
50
53
|
import { CubicBezierCurve } from "./CubicBezierCurve";
|
|
@@ -141,7 +144,7 @@ export class drawutils implements DrawLib<void> {
|
|
|
141
144
|
* @param {DrawLibConfiguration} configuration - The new configuration settings to use for the next render methods.
|
|
142
145
|
*/
|
|
143
146
|
setConfiguration(configuration: DrawLibConfiguration): void {
|
|
144
|
-
this.ctx.globalCompositeOperation = configuration.blendMode;
|
|
147
|
+
this.ctx.globalCompositeOperation = configuration.blendMode || "source-over";
|
|
145
148
|
}
|
|
146
149
|
|
|
147
150
|
/**
|
|
@@ -1012,7 +1015,7 @@ export class drawutils implements DrawLib<void> {
|
|
|
1012
1015
|
}
|
|
1013
1016
|
this.ctx.save();
|
|
1014
1017
|
this.ctx.beginPath();
|
|
1015
|
-
this.ctx.lineWidth = lineWidth * this.scale.x
|
|
1018
|
+
this.ctx.lineWidth = (lineWidth || 1.0) * this.scale.x;
|
|
1016
1019
|
this.ctx.moveTo(this.offset.x + vertices[0].x * this.scale.x, this.offset.y + vertices[0].y * this.scale.y);
|
|
1017
1020
|
for (var i = 0; i < vertices.length; i++) {
|
|
1018
1021
|
this.ctx.lineTo(this.offset.x + vertices[i].x * this.scale.x, this.offset.y + vertices[i].y * this.scale.y);
|
|
@@ -1147,13 +1150,19 @@ export class drawutils implements DrawLib<void> {
|
|
|
1147
1150
|
path(pathData: SVGPathParams, color?: string, lineWidth?: number, options?: { inplace?: boolean }) {
|
|
1148
1151
|
const d: SVGPathParams = options && options.inplace ? pathData : drawutilssvg.copyPathData(pathData);
|
|
1149
1152
|
drawutilssvg.transformPathData(d, this.offset, this.scale);
|
|
1150
|
-
|
|
1153
|
+
if (color) {
|
|
1154
|
+
this.ctx.strokeStyle = color;
|
|
1155
|
+
}
|
|
1151
1156
|
this.ctx.lineWidth = lineWidth || 1;
|
|
1152
1157
|
if (this.fillShapes) {
|
|
1153
|
-
|
|
1158
|
+
if (color) {
|
|
1159
|
+
this.ctx.fillStyle = color;
|
|
1160
|
+
}
|
|
1154
1161
|
this.ctx.fill(new Path2D(d.join(" ")));
|
|
1155
1162
|
} else {
|
|
1156
|
-
|
|
1163
|
+
if (color) {
|
|
1164
|
+
this.ctx.strokeStyle = color;
|
|
1165
|
+
}
|
|
1157
1166
|
this.ctx.stroke(new Path2D(d.join(" ")));
|
|
1158
1167
|
}
|
|
1159
1168
|
}
|