plotboilerplate 1.15.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/README.md +1 -0
- package/changelog.md +65 -0
- package/dist/index.esm.js +760 -667
- 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 +765 -571
- package/dist/plotboilerplate.min.js +1 -1
- package/package.json +1 -1
- package/src/cjs/BezierPath.d.ts +32 -14
- package/src/cjs/BezierPath.js +65 -24
- package/src/cjs/BezierPath.js.map +1 -1
- package/src/cjs/Bounds.d.ts +33 -1
- package/src/cjs/Bounds.js +38 -1
- package/src/cjs/Bounds.js.map +1 -1
- package/src/cjs/Circle.d.ts +15 -13
- package/src/cjs/Circle.js +16 -34
- package/src/cjs/Circle.js.map +1 -1
- package/src/cjs/CircleSector.d.ts +17 -16
- package/src/cjs/CircleSector.js +12 -24
- package/src/cjs/CircleSector.js.map +1 -1
- package/src/cjs/CubicBezierCurve.d.ts +16 -15
- package/src/cjs/CubicBezierCurve.js +57 -94
- package/src/cjs/CubicBezierCurve.js.map +1 -1
- package/src/cjs/KeyHandler.d.ts +10 -3
- package/src/cjs/KeyHandler.js +28 -23
- package/src/cjs/KeyHandler.js.map +1 -1
- package/src/cjs/Line.d.ts +2 -15
- package/src/cjs/Line.js +6 -31
- package/src/cjs/Line.js.map +1 -1
- package/src/cjs/MouseHandler.js +43 -53
- package/src/cjs/MouseHandler.js.map +1 -1
- package/src/cjs/PBImage.d.ts +15 -13
- package/src/cjs/PBImage.js +11 -15
- package/src/cjs/PBImage.js.map +1 -1
- package/src/cjs/PBText.d.ts +13 -12
- package/src/cjs/PBText.js +8 -12
- package/src/cjs/PBText.js.map +1 -1
- package/src/cjs/PlotBoilerplate.d.ts +3 -1
- package/src/cjs/PlotBoilerplate.js +9 -2
- package/src/cjs/PlotBoilerplate.js.map +1 -1
- package/src/cjs/Polygon.d.ts +23 -14
- package/src/cjs/Polygon.js +22 -35
- package/src/cjs/Polygon.js.map +1 -1
- package/src/cjs/Triangle.d.ts +15 -13
- package/src/cjs/Triangle.js +23 -64
- package/src/cjs/Triangle.js.map +1 -1
- package/src/cjs/VEllipse.d.ts +14 -9
- package/src/cjs/VEllipse.js +10 -18
- package/src/cjs/VEllipse.js.map +1 -1
- package/src/cjs/VEllipseSector.d.ts +15 -1
- package/src/cjs/VEllipseSector.js +11 -1
- package/src/cjs/VEllipseSector.js.map +1 -1
- package/src/cjs/Vector.d.ts +3 -15
- package/src/cjs/Vector.js +9 -49
- package/src/cjs/Vector.js.map +1 -1
- package/src/cjs/VertTuple.d.ts +15 -1
- package/src/cjs/VertTuple.js +14 -19
- package/src/cjs/VertTuple.js.map +1 -1
- package/src/cjs/Vertex.d.ts +23 -13
- package/src/cjs/Vertex.js +24 -22
- package/src/cjs/Vertex.js.map +1 -1
- package/src/cjs/VertexListeners.d.ts +12 -8
- package/src/cjs/VertexListeners.js +18 -25
- package/src/cjs/VertexListeners.js.map +1 -1
- package/src/cjs/draw.d.ts +45 -3
- package/src/cjs/draw.js +149 -6
- package/src/cjs/draw.js.map +1 -1
- package/src/cjs/drawgl.d.ts +41 -3
- package/src/cjs/drawgl.js +45 -3
- package/src/cjs/drawgl.js.map +1 -1
- package/src/cjs/drawutilssvg.d.ts +69 -4
- package/src/cjs/drawutilssvg.js +147 -16
- package/src/cjs/drawutilssvg.js.map +1 -1
- package/src/cjs/index.d.ts +0 -1
- package/src/cjs/index.js +0 -1
- package/src/cjs/index.js.map +1 -1
- package/src/cjs/interfaces/DrawLib.d.ts +64 -27
- package/src/cjs/interfaces/DrawLib.js +3 -0
- package/src/cjs/interfaces/DrawLib.js.map +1 -1
- package/src/cjs/interfaces/core.d.ts +2 -12
- package/src/cjs/interfaces/core.js +1 -0
- package/src/cjs/interfaces/core.js.map +1 -1
- package/src/cjs/module.d.ts +1 -3
- package/src/cjs/module.js +2 -5
- package/src/cjs/module.js.map +1 -1
- package/src/cjs/utils/creategui.js +16 -2
- 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/cjs/utils/datastructures/Girih.d.ts +5 -0
- package/src/cjs/utils/datastructures/Girih.js +18 -14
- package/src/cjs/utils/datastructures/Girih.js.map +1 -1
- package/src/cjs/utils/datastructures/GirihPenroseRhombus.js +42 -25
- package/src/cjs/utils/datastructures/GirihPenroseRhombus.js.map +1 -1
- package/src/cjs/utils/datastructures/GirihTile.js +2 -13
- package/src/cjs/utils/datastructures/GirihTile.js.map +1 -1
- package/src/cjs/utils/helpers/BezierPathInteractionHelper.d.ts +17 -1
- package/src/cjs/utils/helpers/BezierPathInteractionHelper.js +50 -32
- package/src/cjs/utils/helpers/BezierPathInteractionHelper.js.map +1 -1
- package/src/cjs/utils/io/DndFileHandler.d.ts +63 -0
- package/src/cjs/utils/io/DndFileHandler.js +112 -0
- package/src/cjs/utils/io/DndFileHandler.js.map +1 -0
- package/src/cjs/utils/io/FileDrop.d.ts +98 -0
- package/src/cjs/utils/io/FileDrop.js +142 -0
- package/src/cjs/utils/io/FileDrop.js.map +1 -0
- package/src/esm/BezierPath.d.ts +32 -14
- package/src/esm/BezierPath.js +65 -24
- package/src/esm/BezierPath.js.map +1 -1
- package/src/esm/Bounds.d.ts +33 -1
- package/src/esm/Bounds.js +38 -1
- package/src/esm/Bounds.js.map +1 -1
- package/src/esm/Circle.d.ts +15 -13
- package/src/esm/Circle.js +16 -34
- package/src/esm/Circle.js.map +1 -1
- package/src/esm/CircleSector.d.ts +17 -16
- package/src/esm/CircleSector.js +12 -24
- package/src/esm/CircleSector.js.map +1 -1
- package/src/esm/CubicBezierCurve.d.ts +16 -15
- package/src/esm/CubicBezierCurve.js +57 -94
- package/src/esm/CubicBezierCurve.js.map +1 -1
- package/src/esm/KeyHandler.d.ts +10 -3
- package/src/esm/KeyHandler.js +28 -23
- package/src/esm/KeyHandler.js.map +1 -1
- package/src/esm/Line.d.ts +2 -15
- package/src/esm/Line.js +6 -31
- package/src/esm/Line.js.map +1 -1
- package/src/esm/MouseHandler.js +43 -53
- package/src/esm/MouseHandler.js.map +1 -1
- package/src/esm/PBImage.d.ts +15 -13
- package/src/esm/PBImage.js +11 -15
- package/src/esm/PBImage.js.map +1 -1
- package/src/esm/PBText.d.ts +13 -12
- package/src/esm/PBText.js +8 -12
- package/src/esm/PBText.js.map +1 -1
- package/src/esm/PlotBoilerplate.d.ts +3 -1
- package/src/esm/PlotBoilerplate.js +9 -2
- package/src/esm/PlotBoilerplate.js.map +1 -1
- package/src/esm/Polygon.d.ts +23 -14
- package/src/esm/Polygon.js +22 -35
- package/src/esm/Polygon.js.map +1 -1
- package/src/esm/Triangle.d.ts +15 -13
- package/src/esm/Triangle.js +23 -64
- package/src/esm/Triangle.js.map +1 -1
- package/src/esm/VEllipse.d.ts +14 -9
- package/src/esm/VEllipse.js +10 -18
- package/src/esm/VEllipse.js.map +1 -1
- package/src/esm/VEllipseSector.d.ts +15 -1
- package/src/esm/VEllipseSector.js +11 -1
- package/src/esm/VEllipseSector.js.map +1 -1
- package/src/esm/Vector.d.ts +3 -15
- package/src/esm/Vector.js +9 -49
- package/src/esm/Vector.js.map +1 -1
- package/src/esm/VertTuple.d.ts +15 -1
- package/src/esm/VertTuple.js +14 -19
- package/src/esm/VertTuple.js.map +1 -1
- package/src/esm/Vertex.d.ts +23 -13
- package/src/esm/Vertex.js +24 -22
- package/src/esm/Vertex.js.map +1 -1
- package/src/esm/VertexListeners.d.ts +12 -8
- package/src/esm/VertexListeners.js +18 -25
- package/src/esm/VertexListeners.js.map +1 -1
- package/src/esm/draw.d.ts +45 -3
- package/src/esm/draw.js +147 -6
- package/src/esm/draw.js.map +1 -1
- package/src/esm/drawgl.d.ts +41 -3
- package/src/esm/drawgl.js +44 -3
- package/src/esm/drawgl.js.map +1 -1
- package/src/esm/drawutilssvg.d.ts +69 -4
- package/src/esm/drawutilssvg.js +146 -16
- package/src/esm/drawutilssvg.js.map +1 -1
- package/src/esm/index.d.ts +0 -1
- package/src/esm/index.js +0 -1
- package/src/esm/index.js.map +1 -1
- package/src/esm/interfaces/DrawLib.d.ts +64 -27
- package/src/esm/interfaces/DrawLib.js +3 -0
- package/src/esm/interfaces/DrawLib.js.map +1 -1
- package/src/esm/interfaces/core.d.ts +2 -12
- package/src/esm/interfaces/core.js +1 -0
- package/src/esm/interfaces/core.js.map +1 -1
- package/src/esm/module.d.ts +1 -3
- package/src/esm/module.js +5 -4
- package/src/esm/module.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/esm/utils/datastructures/Girih.d.ts +5 -0
- package/src/esm/utils/datastructures/Girih.js +18 -14
- package/src/esm/utils/datastructures/Girih.js.map +1 -1
- package/src/esm/utils/datastructures/GirihPenroseRhombus.js +42 -25
- package/src/esm/utils/datastructures/GirihPenroseRhombus.js.map +1 -1
- package/src/esm/utils/datastructures/GirihTile.js +2 -13
- package/src/esm/utils/datastructures/GirihTile.js.map +1 -1
- package/src/esm/utils/helpers/BezierPathInteractionHelper.d.ts +17 -1
- package/src/esm/utils/helpers/BezierPathInteractionHelper.js +49 -32
- package/src/esm/utils/helpers/BezierPathInteractionHelper.js.map +1 -1
- package/src/esm/utils/io/DndFileHandler.d.ts +63 -0
- package/src/esm/utils/io/DndFileHandler.js +106 -0
- package/src/esm/utils/io/DndFileHandler.js.map +1 -0
- package/src/esm/utils/io/FileDrop.d.ts +98 -0
- package/src/esm/utils/io/FileDrop.js +136 -0
- package/src/esm/utils/io/FileDrop.js.map +1 -0
- package/src/ts/BezierPath.ts +78 -22
- package/src/ts/Bounds.ts +40 -1
- package/src/ts/Circle.ts +187 -200
- package/src/ts/CircleSector.ts +141 -141
- package/src/ts/CubicBezierCurve.ts +738 -810
- package/src/ts/KeyHandler.ts +221 -212
- package/src/ts/Line.ts +48 -80
- package/src/ts/MouseHandler.ts +356 -368
- package/src/ts/PBImage.ts +67 -69
- package/src/ts/PBText.ts +16 -14
- package/src/ts/PlotBoilerplate.ts +9 -2
- package/src/ts/Polygon.ts +34 -34
- package/src/ts/Triangle.ts +444 -489
- package/src/ts/VEllipse.ts +18 -17
- package/src/ts/VEllipseSector.ts +20 -1
- package/src/ts/Vector.ts +124 -160
- package/src/ts/VertTuple.ts +333 -338
- package/src/ts/Vertex.ts +35 -21
- package/src/ts/VertexListeners.ts +248 -266
- package/src/ts/draw.ts +201 -6
- package/src/ts/drawgl.ts +47 -3
- package/src/ts/drawutilssvg.ts +187 -16
- package/src/ts/index.ts +0 -1
- package/src/ts/interfaces/DrawLib.ts +72 -27
- package/src/ts/interfaces/core.ts +3 -13
- package/src/ts/module.ts +2 -4
- package/src/ts/utils/datastructures/Color.ts +17 -6
- package/src/ts/utils/datastructures/Girih.ts +204 -209
- package/src/ts/utils/datastructures/GirihPenroseRhombus.ts +170 -152
- package/src/ts/utils/datastructures/GirihTile.ts +394 -419
- package/src/ts/utils/helpers/BezierPathInteractionHelper.ts +56 -34
- package/src/ts/utils/io/FileDrop.ts +178 -0
- package/src/ts/SVGBuilder.ts +0 -109
|
@@ -15,8 +15,12 @@
|
|
|
15
15
|
* @modified 2021-11-12 Added `text()` params fontSize, fontFamily, rotation, textAlign.
|
|
16
16
|
* @modified 2021-11-16 Added `text()` params fontWeight and fontStyle.
|
|
17
17
|
* @modified 2021-11-19 Added the `color` param to the `label(...)` function.
|
|
18
|
+
* @modified 2022-02-03 Added the `lineWidth` param to the `crosshair` function.
|
|
19
|
+
* @modified 2022-02-03 Added the `cross(...)` function.
|
|
20
|
+
* @modified 2022-07-26 Adding `alpha` to the `image(...)` function.
|
|
18
21
|
**/
|
|
19
22
|
|
|
23
|
+
import { Bounds } from "../Bounds";
|
|
20
24
|
import { Polygon } from "../Polygon";
|
|
21
25
|
import { Vertex } from "../Vertex";
|
|
22
26
|
import { SVGPathParams, UID, XYCoords } from "./core";
|
|
@@ -121,7 +125,7 @@ export interface DrawLib<R> {
|
|
|
121
125
|
* @param {number=1} lineWidth? - [optional] The line's width.
|
|
122
126
|
* @return {void}
|
|
123
127
|
* @instance
|
|
124
|
-
* @memberof
|
|
128
|
+
* @memberof DrawLib
|
|
125
129
|
**/
|
|
126
130
|
line: (zA: Vertex, zB: Vertex, color: string, lineWidth?: number) => R;
|
|
127
131
|
|
|
@@ -135,7 +139,7 @@ export interface DrawLib<R> {
|
|
|
135
139
|
* @param {number=} lineWidth - (optional) The line width to use; default is 1.
|
|
136
140
|
* @return {void}
|
|
137
141
|
* @instance
|
|
138
|
-
* @memberof
|
|
142
|
+
* @memberof DrawLib
|
|
139
143
|
**/
|
|
140
144
|
arrow: (zA: Vertex, zB: Vertex, color: string, lineWidth?: number) => R;
|
|
141
145
|
|
|
@@ -148,11 +152,35 @@ export interface DrawLib<R> {
|
|
|
148
152
|
* @param {Image} image - The image object to draw.
|
|
149
153
|
* @param {Vertex} position - The position to draw the the upper left corner at.
|
|
150
154
|
* @param {Vertex} size - The x/y-size to draw the image with.
|
|
155
|
+
* @param {number=1.0} alpha - (optional, default=0.0) The transparency (1.0=opaque, 0.0=transparent).
|
|
151
156
|
* @return {void}
|
|
152
157
|
* @instance
|
|
153
|
-
* @memberof
|
|
158
|
+
* @memberof DrawLib
|
|
154
159
|
**/
|
|
155
|
-
image: (image: HTMLImageElement, position: Vertex, size: Vertex) => R;
|
|
160
|
+
image: (image: HTMLImageElement, position: Vertex, size: Vertex, alpha?: number) => R;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Draw an image at the given position with the given size.<br>
|
|
164
|
+
* <br>
|
|
165
|
+
* Note: SVG images may have resizing issues at the moment.Draw a line and an arrow at the end (zB) of the given line with the specified (CSS-) color.
|
|
166
|
+
*
|
|
167
|
+
* @method texturedPoly
|
|
168
|
+
* @param {Image} textureImage - The image object to draw.
|
|
169
|
+
* @param {Bounds} textureSize - The texture size to use; these are the original bounds to map the polygon vertices to.
|
|
170
|
+
* @param {Polygon} polygon - The polygon to use as clip path.
|
|
171
|
+
* @param {Vertex} polygonPosition - The polygon's position (relative), measured at the bounding box's center.
|
|
172
|
+
* @param {number} rotation - The rotation to use for the polygon (and for the texture).
|
|
173
|
+
* @return {void}
|
|
174
|
+
* @instance
|
|
175
|
+
* @memberof DrawLib
|
|
176
|
+
**/
|
|
177
|
+
texturedPoly: (
|
|
178
|
+
textureImage: HTMLImageElement,
|
|
179
|
+
textureSize: Bounds,
|
|
180
|
+
polygon: Polygon,
|
|
181
|
+
polygonPosition: Vertex,
|
|
182
|
+
rotation: number
|
|
183
|
+
) => R;
|
|
156
184
|
|
|
157
185
|
/**
|
|
158
186
|
* Draw the given (cubic) bézier curve.
|
|
@@ -166,7 +194,7 @@ export interface DrawLib<R> {
|
|
|
166
194
|
* @param {number} lineWidth - (optional) The line width to use.
|
|
167
195
|
* @return {void}
|
|
168
196
|
* @instance
|
|
169
|
-
* @memberof
|
|
197
|
+
* @memberof DrawLib
|
|
170
198
|
*/
|
|
171
199
|
cubicBezier: (
|
|
172
200
|
startPoint: Vertex,
|
|
@@ -190,7 +218,7 @@ export interface DrawLib<R> {
|
|
|
190
218
|
* @param {number=1} lineWidth - (optional) The line width to use.
|
|
191
219
|
* @return {void}
|
|
192
220
|
* @instance
|
|
193
|
-
* @memberof
|
|
221
|
+
* @memberof DrawLib
|
|
194
222
|
*/
|
|
195
223
|
cubicBezierPath: (path: Array<Vertex>, color: string, lineWidth?: number) => R;
|
|
196
224
|
|
|
@@ -204,7 +232,7 @@ export interface DrawLib<R> {
|
|
|
204
232
|
* @param {Vertex} endPoint - The end point of the handle.
|
|
205
233
|
* @return {void}
|
|
206
234
|
* @instance
|
|
207
|
-
* @memberof
|
|
235
|
+
* @memberof DrawLib
|
|
208
236
|
*/
|
|
209
237
|
handle: (startPoint: Vertex, endPoint: Vertex) => R;
|
|
210
238
|
|
|
@@ -216,7 +244,7 @@ export interface DrawLib<R> {
|
|
|
216
244
|
* @param {Vertex} endPoint - The end point to draw the handle at.
|
|
217
245
|
* @return {void}
|
|
218
246
|
* @instance
|
|
219
|
-
* @memberof
|
|
247
|
+
* @memberof DrawLib
|
|
220
248
|
*/
|
|
221
249
|
handleLine: (startPoint: Vertex, endPoint: Vertex) => R;
|
|
222
250
|
|
|
@@ -228,7 +256,7 @@ export interface DrawLib<R> {
|
|
|
228
256
|
* @param {string} color - The CSS color to draw the dot with.
|
|
229
257
|
* @return {void}
|
|
230
258
|
* @instance
|
|
231
|
-
* @memberof
|
|
259
|
+
* @memberof DrawLib
|
|
232
260
|
*/
|
|
233
261
|
dot: (p: Vertex, color: string) => R;
|
|
234
262
|
|
|
@@ -240,7 +268,7 @@ export interface DrawLib<R> {
|
|
|
240
268
|
* @param {string} color - The CSS color to draw the point with.
|
|
241
269
|
* @return {void}
|
|
242
270
|
* @instance
|
|
243
|
-
* @memberof
|
|
271
|
+
* @memberof DrawLib
|
|
244
272
|
*/
|
|
245
273
|
point: (p: Vertex, color: string) => R;
|
|
246
274
|
|
|
@@ -256,7 +284,7 @@ export interface DrawLib<R> {
|
|
|
256
284
|
* @param {number=} lineWidth - (optional) The line width to use; default is 1.
|
|
257
285
|
* @return {void}
|
|
258
286
|
* @instance
|
|
259
|
-
* @memberof
|
|
287
|
+
* @memberof DrawLib
|
|
260
288
|
*/
|
|
261
289
|
circle: (center: Vertex, radius: number, color: string, lineWidth?: number) => R;
|
|
262
290
|
|
|
@@ -272,7 +300,7 @@ export interface DrawLib<R> {
|
|
|
272
300
|
* @param {number=} lineWidth - (optional) The line width to use; default is 1.
|
|
273
301
|
* @return {void}
|
|
274
302
|
* @instance
|
|
275
|
-
* @memberof
|
|
303
|
+
* @memberof DrawLib
|
|
276
304
|
*/
|
|
277
305
|
circleArc: (center: Vertex, radius: number, startAngle: number, endAngle: number, color: string, lineWidth?: number) => R;
|
|
278
306
|
|
|
@@ -288,7 +316,7 @@ export interface DrawLib<R> {
|
|
|
288
316
|
* @param {number=} rotation - (optional, default=0) The rotation of the ellipse.
|
|
289
317
|
* @return {void}
|
|
290
318
|
* @instance
|
|
291
|
-
* @memberof
|
|
319
|
+
* @memberof DrawLib
|
|
292
320
|
*/
|
|
293
321
|
ellipse: (center: Vertex, radiusX: number, radiusY: number, color: string, lineWidth?: number, rotation?: number) => R;
|
|
294
322
|
|
|
@@ -304,7 +332,7 @@ export interface DrawLib<R> {
|
|
|
304
332
|
* @param {number=} lineWidth - (optional) The line width to use; default is 1.
|
|
305
333
|
* @return {void}
|
|
306
334
|
* @instance
|
|
307
|
-
* @memberof
|
|
335
|
+
* @memberof DrawLib
|
|
308
336
|
*/
|
|
309
337
|
square: (center: XYCoords, size: number, color: string, lineWidth?: number) => R;
|
|
310
338
|
|
|
@@ -319,7 +347,7 @@ export interface DrawLib<R> {
|
|
|
319
347
|
* @param {number=} lineWidth - (optional) The line width to use; default is 1.
|
|
320
348
|
* @return {void}
|
|
321
349
|
* @instance
|
|
322
|
-
* @memberof
|
|
350
|
+
* @memberof DrawLib
|
|
323
351
|
*/
|
|
324
352
|
rect: (upperLeft: XYCoords, width: number, height: number, color: string, lineWidth?: number) => R;
|
|
325
353
|
|
|
@@ -335,7 +363,7 @@ export interface DrawLib<R> {
|
|
|
335
363
|
* @param {string} color - The CSS color to draw the grid with.
|
|
336
364
|
* @return {void}
|
|
337
365
|
* @instance
|
|
338
|
-
* @memberof
|
|
366
|
+
* @memberof DrawLib
|
|
339
367
|
*/
|
|
340
368
|
grid: (center: Vertex, width: number, height: number, sizeX: number, sizeY: number, color: string) => R;
|
|
341
369
|
|
|
@@ -353,7 +381,7 @@ export interface DrawLib<R> {
|
|
|
353
381
|
* @param {string} color - The CSS color to draw the raster with.
|
|
354
382
|
* @return {void}
|
|
355
383
|
* @instance
|
|
356
|
-
* @memberof
|
|
384
|
+
* @memberof DrawLib
|
|
357
385
|
*/
|
|
358
386
|
raster: (center: Vertex, width: number, height: number, sizeX: number, sizeY: number, color: string) => R;
|
|
359
387
|
|
|
@@ -370,7 +398,7 @@ export interface DrawLib<R> {
|
|
|
370
398
|
* @param {string} color - The CSS color to draw the diamond with.
|
|
371
399
|
* @return {void}
|
|
372
400
|
* @instance
|
|
373
|
-
* @memberof
|
|
401
|
+
* @memberof DrawLib
|
|
374
402
|
*/
|
|
375
403
|
diamondHandle: (center: Vertex, size: number, color: string) => R;
|
|
376
404
|
|
|
@@ -387,7 +415,7 @@ export interface DrawLib<R> {
|
|
|
387
415
|
* @param {string} color - The CSS color to draw the square with.
|
|
388
416
|
* @return {void}
|
|
389
417
|
* @instance
|
|
390
|
-
* @memberof
|
|
418
|
+
* @memberof DrawLib
|
|
391
419
|
*/
|
|
392
420
|
squareHandle: (center: Vertex, size: number, color: string) => R;
|
|
393
421
|
|
|
@@ -404,7 +432,7 @@ export interface DrawLib<R> {
|
|
|
404
432
|
* @param {string} color - The CSS color to draw the circle with.
|
|
405
433
|
* @return {void}
|
|
406
434
|
* @instance
|
|
407
|
-
* @memberof
|
|
435
|
+
* @memberof DrawLib
|
|
408
436
|
*/
|
|
409
437
|
circleHandle: (center: Vertex, size: number, color: string) => R;
|
|
410
438
|
|
|
@@ -417,11 +445,28 @@ export interface DrawLib<R> {
|
|
|
417
445
|
* @param {XYCoords} center - The center of the crosshair.
|
|
418
446
|
* @param {number} radius - The radius of the crosshair.
|
|
419
447
|
* @param {string} color - The CSS color to draw the crosshair with.
|
|
448
|
+
* @param {number=0.5} lineWidth - (optional, default=0.5) The line width to use.
|
|
449
|
+
* @return {void}
|
|
450
|
+
* @instance
|
|
451
|
+
* @memberof DrawLib
|
|
452
|
+
*/
|
|
453
|
+
crosshair: (center: XYCoords, radius: number, color: string, lineWidth?: number) => R;
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Draw a cross with diagonal axes with given radius, color and lineWidth at the given position.<br>
|
|
457
|
+
* <br>
|
|
458
|
+
* Note that the x's radius will not be affected by scaling.
|
|
459
|
+
*
|
|
460
|
+
* @method crosshair
|
|
461
|
+
* @param {XYCoords} center - The center of the crosshair.
|
|
462
|
+
* @param {number} radius - The radius of the crosshair.
|
|
463
|
+
* @param {string} color - The CSS color to draw the crosshair with.
|
|
464
|
+
* @param {number=1} lineWidth - (optional, default=1.0) The line width to use.
|
|
420
465
|
* @return {void}
|
|
421
466
|
* @instance
|
|
422
|
-
* @memberof
|
|
467
|
+
* @memberof DrawLib
|
|
423
468
|
*/
|
|
424
|
-
|
|
469
|
+
cross: (center: XYCoords, radius: number, color: string, lineWidth?: number) => R;
|
|
425
470
|
|
|
426
471
|
/**
|
|
427
472
|
* Draw a polygon.
|
|
@@ -431,7 +476,7 @@ export interface DrawLib<R> {
|
|
|
431
476
|
* @param {string} color - The CSS color to draw the polygon with.
|
|
432
477
|
* @return {void}
|
|
433
478
|
* @instance
|
|
434
|
-
* @memberof
|
|
479
|
+
* @memberof DrawLib
|
|
435
480
|
*/
|
|
436
481
|
polygon: (polygon: Polygon, color: string, lineWidth?: number) => R;
|
|
437
482
|
|
|
@@ -445,7 +490,7 @@ export interface DrawLib<R> {
|
|
|
445
490
|
* @param {number=} lineWidth - (optional) The line width to use; default is 1.
|
|
446
491
|
* @return {void}
|
|
447
492
|
* @instance
|
|
448
|
-
* @memberof
|
|
493
|
+
* @memberof DrawLib
|
|
449
494
|
*/
|
|
450
495
|
polyline: (vertices: Array<Vertex>, isOpen: boolean, color: string, lineWidth?: number) => R;
|
|
451
496
|
|
|
@@ -466,7 +511,7 @@ export interface DrawLib<R> {
|
|
|
466
511
|
* @param {string=} options.textAlign - The text align to use. According to the specifiactions (https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/textAlign) valid values are `"left" || "right" || "center" || "start" || "end"`.
|
|
467
512
|
* @return {void}
|
|
468
513
|
* @instance
|
|
469
|
-
* @memberof
|
|
514
|
+
* @memberof DrawLib
|
|
470
515
|
*/
|
|
471
516
|
text: (text: string, x: number, y: number, options?: FontOptions) => R;
|
|
472
517
|
|
|
@@ -481,7 +526,7 @@ export interface DrawLib<R> {
|
|
|
481
526
|
* @param {string="black"} color - The color to use (default is black).
|
|
482
527
|
* @return {void}
|
|
483
528
|
* @instance
|
|
484
|
-
* @memberof
|
|
529
|
+
* @memberof DrawLib
|
|
485
530
|
*/
|
|
486
531
|
label: (text: string, x: number, y: number, rotation?: number, color?: string) => R;
|
|
487
532
|
|
|
@@ -494,7 +539,7 @@ export interface DrawLib<R> {
|
|
|
494
539
|
* @param {number=1} lineWidth - (optional) the line width to use (default is 1).
|
|
495
540
|
* @param {boolean=false} options.inplace - (optional) If set to true then path transforamtions (scale and translate) will be done in-place in the array. This can boost the performance.
|
|
496
541
|
* @instance
|
|
497
|
-
* @memberof
|
|
542
|
+
* @memberof DrawLib
|
|
498
543
|
* @return {R} An instance representing the drawn path.
|
|
499
544
|
*/
|
|
500
545
|
path: (pathData: SVGPathParams, color?: string, lineWidth?: number, options?: { inplace?: boolean }) => R;
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* @modified 2021-05-31 Splitted the large interfaces.ts file into this one and others.
|
|
15
15
|
* @modified 2021-06-21 Added `IBounds.getCenter()`.
|
|
16
16
|
* @modified 2021-11-16 Added `text` options to the `DrawConfig`.
|
|
17
|
+
* @modified 2022-08-01 Added `title` param to the `PBParams` interface.
|
|
17
18
|
**/
|
|
18
19
|
|
|
19
20
|
import { Vertex } from "../Vertex";
|
|
@@ -156,8 +157,8 @@ export interface Config {
|
|
|
156
157
|
* For initialization the constructor needs a mix of config and draw-settings.
|
|
157
158
|
*/
|
|
158
159
|
export interface PBParams extends Config {
|
|
159
|
-
//
|
|
160
|
-
// No additional attributes, just merge two interfaces.
|
|
160
|
+
title?: string; // Specify any hover tile here. It will be attached as a `title` attribute to the most elevated element.
|
|
161
|
+
// No more additional attributes, just merge two interfaces.
|
|
161
162
|
}
|
|
162
163
|
|
|
163
164
|
export interface DrawSettings {
|
|
@@ -211,17 +212,6 @@ export interface SVGSerializable {
|
|
|
211
212
|
* Required to generate proper CSS classes and other class related IDs.
|
|
212
213
|
**/
|
|
213
214
|
readonly className: string;
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Convert this vertex to SVG code.
|
|
217
|
-
*
|
|
218
|
-
* @method toSVGString
|
|
219
|
-
* @param {object=} options - An optional set of options, like 'className'.
|
|
220
|
-
* @return {string} A string representing the SVG code for this vertex.
|
|
221
|
-
* @instance
|
|
222
|
-
* @memberof Vertex
|
|
223
|
-
**/
|
|
224
|
-
toSVGString: (options: { className?: string }) => string;
|
|
225
215
|
}
|
|
226
216
|
|
|
227
217
|
/**
|
package/src/ts/module.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { Circle } from "./Circle";
|
|
|
11
11
|
import { CircleSector } from "./CircleSector";
|
|
12
12
|
import { CubicBezierCurve } from "./CubicBezierCurve";
|
|
13
13
|
import { drawutils } from "./draw";
|
|
14
|
-
import { drawutilsgl } from "./drawgl";
|
|
14
|
+
// import { drawutilsgl } from "./drawgl";
|
|
15
15
|
import { geomutils } from "./geomutils";
|
|
16
16
|
import { Grid } from "./Grid";
|
|
17
17
|
import { KeyHandler } from "./KeyHandler";
|
|
@@ -20,7 +20,6 @@ import { MouseHandler } from "./MouseHandler";
|
|
|
20
20
|
import { PBImage } from "./PBImage";
|
|
21
21
|
import { PlotBoilerplate } from "./PlotBoilerplate";
|
|
22
22
|
import { Polygon } from "./Polygon";
|
|
23
|
-
import { SVGBuilder } from "./SVGBuilder";
|
|
24
23
|
import { Triangle } from "./Triangle";
|
|
25
24
|
import { UIDGenerator } from "./UIDGenerator";
|
|
26
25
|
import { Vector } from "./Vector";
|
|
@@ -39,7 +38,7 @@ export {
|
|
|
39
38
|
CircleSector,
|
|
40
39
|
CubicBezierCurve,
|
|
41
40
|
drawutils,
|
|
42
|
-
drawutilsgl,
|
|
41
|
+
// drawutilsgl,
|
|
43
42
|
geomutils,
|
|
44
43
|
Grid,
|
|
45
44
|
// ...interf,
|
|
@@ -49,7 +48,6 @@ export {
|
|
|
49
48
|
PBImage,
|
|
50
49
|
PlotBoilerplate,
|
|
51
50
|
Polygon,
|
|
52
|
-
SVGBuilder,
|
|
53
51
|
Triangle,
|
|
54
52
|
UIDGenerator,
|
|
55
53
|
Vector,
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
* @modified 2021-11-07 Did the same with `saturate` and `desaturate`.
|
|
15
15
|
* @modified 2021-11-07 Did the same with the `fadein` and `fadeout` functions.
|
|
16
16
|
* @modified 2021-11-07 Added setRed, setGreen, setBlue, setHue, setSaturation, setLiminance functions.
|
|
17
|
-
* @
|
|
17
|
+
* @modified 2022-05-11 Modified the `clone` function by just copying the numeric calues, not re-calculating the whole color.
|
|
18
|
+
* @modified 2022-05-11 Fixed the `interpolate` function.
|
|
19
|
+
* @version 0.0.11
|
|
18
20
|
**/
|
|
19
21
|
|
|
20
22
|
/**
|
|
@@ -698,7 +700,16 @@ export class Color {
|
|
|
698
700
|
* @return {Color} A clone of this color (in RGB mode).
|
|
699
701
|
*/
|
|
700
702
|
clone(): Color {
|
|
701
|
-
return Color.makeRGB(this.r, this.g, this.b, this.a);
|
|
703
|
+
// return Color.makeRGB(this.r, this.g, this.b, this.a);
|
|
704
|
+
const col = new Color();
|
|
705
|
+
col.r = this.r;
|
|
706
|
+
col.g = this.g;
|
|
707
|
+
col.b = this.b;
|
|
708
|
+
col.a = this.a;
|
|
709
|
+
col.h = this.h;
|
|
710
|
+
col.s = this.s;
|
|
711
|
+
col.l = this.l;
|
|
712
|
+
return col;
|
|
702
713
|
}
|
|
703
714
|
|
|
704
715
|
/**
|
|
@@ -712,10 +723,10 @@ export class Color {
|
|
|
712
723
|
* @return {Color} A clone of this color (in RGB mode).
|
|
713
724
|
*/
|
|
714
725
|
interpolate(c: Color, t: number): Color {
|
|
715
|
-
this.r += (c.r -
|
|
716
|
-
this.g += (c.g -
|
|
717
|
-
this.b += (c.b -
|
|
718
|
-
this.a += (c.a -
|
|
726
|
+
this.r += (c.r - this.r) * t;
|
|
727
|
+
this.g += (c.g - this.g) * t;
|
|
728
|
+
this.b += (c.b - this.b) * t;
|
|
729
|
+
this.a += (c.a - this.a) * t;
|
|
719
730
|
return this;
|
|
720
731
|
}
|
|
721
732
|
} // END class
|