@nmmty/lazycanvas 0.2.0 → 0.3.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/dist/index.d.ts +4 -2
- package/dist/index.js +5 -1
- package/dist/structures/LazyCanvas.d.ts +2 -10
- package/dist/structures/LazyCanvas.js +4 -15
- package/dist/structures/components/BezierLayer.d.ts +42 -0
- package/dist/structures/components/BezierLayer.js +119 -0
- package/dist/structures/components/Group.d.ts +1 -0
- package/dist/structures/components/Group.js +8 -0
- package/dist/structures/components/ImageLayer.d.ts +2 -1
- package/dist/structures/components/ImageLayer.js +8 -6
- package/dist/structures/components/MorphLayer.d.ts +2 -1
- package/dist/structures/components/MorphLayer.js +9 -14
- package/dist/structures/components/QuadraticLayer.d.ts +40 -0
- package/dist/structures/components/QuadraticLayer.js +116 -0
- package/dist/structures/components/TextLayer.d.ts +6 -1
- package/dist/structures/components/TextLayer.js +19 -6
- package/dist/structures/helpers/Font.js +2 -1
- package/dist/structures/managers/FontsManager.d.ts +10 -1
- package/dist/structures/managers/FontsManager.js +19 -2
- package/dist/structures/managers/LayersManager.d.ts +2 -1
- package/dist/structures/managers/LayersManager.js +9 -2
- package/dist/structures/managers/RenderManager.d.ts +2 -1
- package/dist/structures/managers/RenderManager.js +8 -3
- package/dist/types/components/BaseLayer.d.ts +6 -6
- package/dist/types/components/BezierLayer.d.ts +11 -0
- package/dist/types/components/MorphLayer.d.ts +1 -1
- package/dist/types/components/QuadraticLayer.d.ts +11 -0
- package/dist/types/components/TextLayer.d.ts +0 -1
- package/dist/types/enum.d.ts +9 -1
- package/dist/types/enum.js +8 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/managers/FontsManager.d.ts +1 -0
- package/dist/types/managers/LayersManager.d.ts +1 -0
- package/dist/types/managers/RenderManager.d.ts +1 -0
- package/dist/types/types.d.ts +14 -2
- package/dist/utils/LazyUtil.d.ts +1 -1
- package/dist/utils/LazyUtil.js +4 -4
- package/dist/utils/utils.d.ts +20 -3
- package/dist/utils/utils.js +130 -15
- package/package.json +49 -51
package/dist/index.d.ts
CHANGED
|
@@ -2,13 +2,15 @@ import { LazyCanvas } from "./structures/LazyCanvas";
|
|
|
2
2
|
import { ImageLayer } from "./structures/components/ImageLayer";
|
|
3
3
|
import { MorphLayer } from "./structures/components/MorphLayer";
|
|
4
4
|
import { TextLayer } from "./structures/components/TextLayer";
|
|
5
|
+
import { BezierLayer } from "./structures/components/BezierLayer";
|
|
6
|
+
import { QuadraticLayer } from "./structures/components/QuadraticLayer";
|
|
5
7
|
import { BaseLayer } from "./structures/components/BaseLayer";
|
|
6
8
|
import { Group } from "./structures/components/Group";
|
|
7
9
|
import { LayerType, LayerScaleType, LineCap, LineJoin, TextAlign, TextDirection, TextBaseline, FontWeight, Export, Centring, PatternType, SaveFormat, GradientType } from "./types/enum";
|
|
8
|
-
import type { AnyLayer, ScaleType, ColorType, IFont, IFonts, IGradient, IPattern, IImageLayer, IImageLayerProps, IMorphLayer, IMorphLayerProps, ITextLayer, ITextLayerProps, IBaseLayer, IBaseLayerProps, IGroup } from "./types";
|
|
10
|
+
import type { AnyLayer, ScaleType, ColorType, IFont, IFonts, IGradient, IPattern, IImageLayer, IImageLayerProps, IMorphLayer, IMorphLayerProps, ITextLayer, ITextLayerProps, IBezierLayer, IBezierLayerProps, IQuadraticLayer, IQuadraticLayerProps, IBaseLayer, IBaseLayerProps, IGroup } from "./types";
|
|
9
11
|
import { Font } from "./structures/helpers/Font";
|
|
10
12
|
import { Gradient } from "./structures/helpers/Gradient";
|
|
11
13
|
import { Pattern } from "./structures/helpers/Pattern";
|
|
12
14
|
import { saveFile } from "./utils/utils";
|
|
13
15
|
import { Filters } from "./helpers/filters";
|
|
14
|
-
export { LazyCanvas, ImageLayer, MorphLayer, TextLayer, BaseLayer, Group, Font, Gradient, Pattern, LayerScaleType, LayerType, FontWeight, GradientType, Export, LineCap, LineJoin, TextAlign, TextDirection, TextBaseline, SaveFormat, Centring, PatternType, saveFile, Filters, IFont, IFonts, IGradient, IPattern, IImageLayer, IImageLayerProps, IMorphLayer, IMorphLayerProps, ITextLayer, ITextLayerProps, IBaseLayer, IBaseLayerProps, IGroup, AnyLayer, ScaleType, ColorType, };
|
|
16
|
+
export { LazyCanvas, ImageLayer, MorphLayer, TextLayer, BezierLayer, QuadraticLayer, BaseLayer, Group, Font, Gradient, Pattern, LayerScaleType, LayerType, FontWeight, GradientType, Export, LineCap, LineJoin, TextAlign, TextDirection, TextBaseline, SaveFormat, Centring, PatternType, saveFile, Filters, IFont, IFonts, IGradient, IPattern, IImageLayer, IImageLayerProps, IMorphLayer, IMorphLayerProps, ITextLayer, ITextLayerProps, IBaseLayer, IBaseLayerProps, IBezierLayer, IBezierLayerProps, IQuadraticLayer, IQuadraticLayerProps, IGroup, AnyLayer, ScaleType, ColorType, };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Filters = exports.saveFile = exports.PatternType = exports.Centring = exports.SaveFormat = exports.TextBaseline = exports.TextDirection = exports.TextAlign = exports.LineJoin = exports.LineCap = exports.Export = exports.GradientType = exports.FontWeight = exports.LayerType = exports.LayerScaleType = exports.Pattern = exports.Gradient = exports.Font = exports.Group = exports.BaseLayer = exports.TextLayer = exports.MorphLayer = exports.ImageLayer = exports.LazyCanvas = void 0;
|
|
3
|
+
exports.Filters = exports.saveFile = exports.PatternType = exports.Centring = exports.SaveFormat = exports.TextBaseline = exports.TextDirection = exports.TextAlign = exports.LineJoin = exports.LineCap = exports.Export = exports.GradientType = exports.FontWeight = exports.LayerType = exports.LayerScaleType = exports.Pattern = exports.Gradient = exports.Font = exports.Group = exports.BaseLayer = exports.QuadraticLayer = exports.BezierLayer = exports.TextLayer = exports.MorphLayer = exports.ImageLayer = exports.LazyCanvas = void 0;
|
|
4
4
|
const LazyCanvas_1 = require("./structures/LazyCanvas");
|
|
5
5
|
Object.defineProperty(exports, "LazyCanvas", { enumerable: true, get: function () { return LazyCanvas_1.LazyCanvas; } });
|
|
6
6
|
const ImageLayer_1 = require("./structures/components/ImageLayer");
|
|
@@ -9,6 +9,10 @@ const MorphLayer_1 = require("./structures/components/MorphLayer");
|
|
|
9
9
|
Object.defineProperty(exports, "MorphLayer", { enumerable: true, get: function () { return MorphLayer_1.MorphLayer; } });
|
|
10
10
|
const TextLayer_1 = require("./structures/components/TextLayer");
|
|
11
11
|
Object.defineProperty(exports, "TextLayer", { enumerable: true, get: function () { return TextLayer_1.TextLayer; } });
|
|
12
|
+
const BezierLayer_1 = require("./structures/components/BezierLayer");
|
|
13
|
+
Object.defineProperty(exports, "BezierLayer", { enumerable: true, get: function () { return BezierLayer_1.BezierLayer; } });
|
|
14
|
+
const QuadraticLayer_1 = require("./structures/components/QuadraticLayer");
|
|
15
|
+
Object.defineProperty(exports, "QuadraticLayer", { enumerable: true, get: function () { return QuadraticLayer_1.QuadraticLayer; } });
|
|
12
16
|
const BaseLayer_1 = require("./structures/components/BaseLayer");
|
|
13
17
|
Object.defineProperty(exports, "BaseLayer", { enumerable: true, get: function () { return BaseLayer_1.BaseLayer; } });
|
|
14
18
|
const Group_1 = require("./structures/components/Group");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Export } from "../types/enum";
|
|
2
|
-
import {
|
|
2
|
+
import { ILazyCanvas } from "../types";
|
|
3
3
|
import { Canvas, SKRSContext2D, SvgExportFlag } from "@napi-rs/canvas";
|
|
4
4
|
import { LayersManager } from "./managers/LayersManager";
|
|
5
5
|
import { RenderManager } from "./managers/RenderManager";
|
|
@@ -13,20 +13,12 @@ export declare class LazyCanvas implements ILazyCanvas {
|
|
|
13
13
|
render: RenderManager;
|
|
14
14
|
fonts: FontsManager;
|
|
15
15
|
exportType: Export;
|
|
16
|
-
constructor();
|
|
16
|
+
constructor(debug?: boolean);
|
|
17
17
|
/**
|
|
18
18
|
* Set the export type
|
|
19
19
|
* @param type {Export} - The `export` type
|
|
20
20
|
*/
|
|
21
21
|
setExportType(type: Export): this;
|
|
22
|
-
/**
|
|
23
|
-
* Replace base fonts with custom fonts by special file.
|
|
24
|
-
* Use this method before loading fonts by `FontManager`.
|
|
25
|
-
* The file should be generated by the following instructions:
|
|
26
|
-
* @see https://github.com/NMMTY/LazyCanvas/blob/main/scripts/FontsGenerate.md
|
|
27
|
-
* @param fonts {IFonts[]} - The `fonts` to set
|
|
28
|
-
*/
|
|
29
|
-
setFonts(fonts: IFonts): this;
|
|
30
22
|
/**
|
|
31
23
|
* Set the SVG export flag. This method should be called after `setExportType` method.
|
|
32
24
|
* @param flag {SvgExportFlag} - The `flag` of the SVG export
|
|
@@ -15,14 +15,14 @@ class LazyCanvas {
|
|
|
15
15
|
render;
|
|
16
16
|
fonts;
|
|
17
17
|
exportType;
|
|
18
|
-
constructor() {
|
|
18
|
+
constructor(debug = false) {
|
|
19
19
|
this.width = 0;
|
|
20
20
|
this.height = 0;
|
|
21
21
|
this.canvas = new canvas_1.Canvas(0, 0);
|
|
22
22
|
this.ctx = this.canvas.getContext('2d');
|
|
23
|
-
this.layers = new LayersManager_1.LayersManager();
|
|
24
|
-
this.render = new RenderManager_1.RenderManager(this);
|
|
25
|
-
this.fonts = new FontsManager_1.FontsManager();
|
|
23
|
+
this.layers = new LayersManager_1.LayersManager(debug);
|
|
24
|
+
this.render = new RenderManager_1.RenderManager(this, debug);
|
|
25
|
+
this.fonts = new FontsManager_1.FontsManager(debug);
|
|
26
26
|
this.exportType = enum_1.Export.Buffer;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
@@ -45,17 +45,6 @@ class LazyCanvas {
|
|
|
45
45
|
}
|
|
46
46
|
return this;
|
|
47
47
|
}
|
|
48
|
-
/**
|
|
49
|
-
* Replace base fonts with custom fonts by special file.
|
|
50
|
-
* Use this method before loading fonts by `FontManager`.
|
|
51
|
-
* The file should be generated by the following instructions:
|
|
52
|
-
* @see https://github.com/NMMTY/LazyCanvas/blob/main/scripts/FontsGenerate.md
|
|
53
|
-
* @param fonts {IFonts[]} - The `fonts` to set
|
|
54
|
-
*/
|
|
55
|
-
setFonts(fonts) {
|
|
56
|
-
this.fonts = new FontsManager_1.FontsManager(fonts);
|
|
57
|
-
return this;
|
|
58
|
-
}
|
|
59
48
|
/**
|
|
60
49
|
* Set the SVG export flag. This method should be called after `setExportType` method.
|
|
61
50
|
* @param flag {SvgExportFlag} - The `flag` of the SVG export
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BaseLayer } from "./BaseLayer";
|
|
2
|
+
import { ColorType, IBezierLayer, IBezierLayerProps, ScaleType } from "../../types";
|
|
3
|
+
import { Canvas, SKRSContext2D } from "@napi-rs/canvas";
|
|
4
|
+
import { LayersManager } from "../managers/LayersManager";
|
|
5
|
+
export declare class BezierLayer extends BaseLayer<IBezierLayerProps> {
|
|
6
|
+
props: IBezierLayerProps;
|
|
7
|
+
constructor(props?: IBezierLayerProps);
|
|
8
|
+
/**
|
|
9
|
+
* @description Sets the control points of the bezier layer. You can use `numbers`, `percentages`, `px`, `vw`, `vh`, `vmin`, `vmax`.
|
|
10
|
+
* @param controlPoints {Array<{ x: ScaleType, y: ScaleType }>} - The `controlPoints` of the bezier layer.
|
|
11
|
+
*/
|
|
12
|
+
setControlPoints(...controlPoints: {
|
|
13
|
+
x: ScaleType;
|
|
14
|
+
y: ScaleType;
|
|
15
|
+
}[]): this;
|
|
16
|
+
/**
|
|
17
|
+
* @description Sets the end point of the bezier layer. You can use `numbers`, `percentages`, `px`, `vw`, `vh`, `vmin`, `vmax`.
|
|
18
|
+
* @param x {ScaleType} - The end `x` of the bezier layer.
|
|
19
|
+
* @param y {ScaleType} - The end `y` of the bezier layer.
|
|
20
|
+
*/
|
|
21
|
+
setEndPoint(x: ScaleType, y: ScaleType): this;
|
|
22
|
+
/**
|
|
23
|
+
* @description Sets the color of the layer. You can use `hex`, `rgb`, `rgba`, `hsl`, `hsla`, and `Gradient`color.
|
|
24
|
+
* @param color {string} - The `color` of the layer.
|
|
25
|
+
*/
|
|
26
|
+
setColor(color: ColorType): this;
|
|
27
|
+
/**
|
|
28
|
+
* @description Sets the stroke of the layer.
|
|
29
|
+
* @param width {number} - The `width` of the stroke.
|
|
30
|
+
* @param cap {string} - The `cap` of the stroke.
|
|
31
|
+
* @param join {string} - The `join` of the stroke.
|
|
32
|
+
* @param dash {number[]} - The `dash` of the stroke.
|
|
33
|
+
* @param dashOffset {number} - The `dashOffset` of the stroke.
|
|
34
|
+
* @param miterLimit {number} - The `miterLimit` of the stroke.
|
|
35
|
+
*/
|
|
36
|
+
setStroke(width: number, cap?: CanvasLineCap, join?: CanvasLineJoin, dash?: number[], dashOffset?: number, miterLimit?: number): this;
|
|
37
|
+
draw(ctx: SKRSContext2D, canvas: Canvas, manager: LayersManager, debug: boolean): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* @returns {IBezierLayer}
|
|
40
|
+
*/
|
|
41
|
+
toJSON(): IBezierLayer;
|
|
42
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BezierLayer = void 0;
|
|
4
|
+
const BaseLayer_1 = require("./BaseLayer");
|
|
5
|
+
const enum_1 = require("../../types/enum");
|
|
6
|
+
const utils_1 = require("../../utils/utils");
|
|
7
|
+
const LazyUtil_1 = require("../../utils/LazyUtil");
|
|
8
|
+
const Gradient_1 = require("../helpers/Gradient");
|
|
9
|
+
const Pattern_1 = require("../helpers/Pattern");
|
|
10
|
+
class BezierLayer extends BaseLayer_1.BaseLayer {
|
|
11
|
+
props;
|
|
12
|
+
constructor(props) {
|
|
13
|
+
super(enum_1.LayerType.BezierCurve, props);
|
|
14
|
+
this.props = props ? props : {};
|
|
15
|
+
if (!this.props.fillStyle)
|
|
16
|
+
this.props.fillStyle = '#000000';
|
|
17
|
+
this.props.centring = enum_1.Centring.None;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @description Sets the control points of the bezier layer. You can use `numbers`, `percentages`, `px`, `vw`, `vh`, `vmin`, `vmax`.
|
|
21
|
+
* @param controlPoints {Array<{ x: ScaleType, y: ScaleType }>} - The `controlPoints` of the bezier layer.
|
|
22
|
+
*/
|
|
23
|
+
setControlPoints(...controlPoints) {
|
|
24
|
+
if (controlPoints.length !== 2)
|
|
25
|
+
throw new LazyUtil_1.LazyError('The control points of the layer must be provided');
|
|
26
|
+
this.props.controlPoints = controlPoints.flat();
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @description Sets the end point of the bezier layer. You can use `numbers`, `percentages`, `px`, `vw`, `vh`, `vmin`, `vmax`.
|
|
31
|
+
* @param x {ScaleType} - The end `x` of the bezier layer.
|
|
32
|
+
* @param y {ScaleType} - The end `y` of the bezier layer.
|
|
33
|
+
*/
|
|
34
|
+
setEndPoint(x, y) {
|
|
35
|
+
this.props.endPoint = { x, y };
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @description Sets the color of the layer. You can use `hex`, `rgb`, `rgba`, `hsl`, `hsla`, and `Gradient`color.
|
|
40
|
+
* @param color {string} - The `color` of the layer.
|
|
41
|
+
*/
|
|
42
|
+
setColor(color) {
|
|
43
|
+
if (!color)
|
|
44
|
+
throw new LazyUtil_1.LazyError('The color of the layer must be provided');
|
|
45
|
+
if (!(0, utils_1.isColor)(color))
|
|
46
|
+
throw new LazyUtil_1.LazyError('The color of the layer must be a valid color');
|
|
47
|
+
let fill = (0, utils_1.parseColor)(color);
|
|
48
|
+
if (fill instanceof Gradient_1.Gradient || fill instanceof Pattern_1.Pattern) {
|
|
49
|
+
this.props.fillStyle = fill;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
let arr = fill.split(':');
|
|
53
|
+
this.props.fillStyle = arr[0];
|
|
54
|
+
this.props.opacity = parseFloat(arr[1]) || 1;
|
|
55
|
+
}
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* @description Sets the stroke of the layer.
|
|
60
|
+
* @param width {number} - The `width` of the stroke.
|
|
61
|
+
* @param cap {string} - The `cap` of the stroke.
|
|
62
|
+
* @param join {string} - The `join` of the stroke.
|
|
63
|
+
* @param dash {number[]} - The `dash` of the stroke.
|
|
64
|
+
* @param dashOffset {number} - The `dashOffset` of the stroke.
|
|
65
|
+
* @param miterLimit {number} - The `miterLimit` of the stroke.
|
|
66
|
+
*/
|
|
67
|
+
setStroke(width, cap, join, dash, dashOffset, miterLimit) {
|
|
68
|
+
this.props.stroke = {
|
|
69
|
+
width,
|
|
70
|
+
cap: cap || 'butt',
|
|
71
|
+
join: join || 'miter',
|
|
72
|
+
dash: dash || [],
|
|
73
|
+
dashOffset: dashOffset || 0,
|
|
74
|
+
miterLimit: miterLimit || 10,
|
|
75
|
+
};
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
async draw(ctx, canvas, manager, debug) {
|
|
79
|
+
const xs = (0, utils_1.parseToNormal)(this.props.x, ctx, canvas);
|
|
80
|
+
const ys = (0, utils_1.parseToNormal)(this.props.y, ctx, canvas, { width: 0, height: 0 }, { vertical: true });
|
|
81
|
+
const cp1x = (0, utils_1.parseToNormal)(this.props.controlPoints[0].x, ctx, canvas);
|
|
82
|
+
const cp1y = (0, utils_1.parseToNormal)(this.props.controlPoints[0].y, ctx, canvas, { width: 0, height: 0 }, { vertical: true });
|
|
83
|
+
const cp2x = (0, utils_1.parseToNormal)(this.props.controlPoints[1].x, ctx, canvas);
|
|
84
|
+
const cp2y = (0, utils_1.parseToNormal)(this.props.controlPoints[1].y, ctx, canvas, { width: 0, height: 0 }, { vertical: true });
|
|
85
|
+
const xe = (0, utils_1.parseToNormal)(this.props.endPoint.x, ctx, canvas);
|
|
86
|
+
const ye = (0, utils_1.parseToNormal)(this.props.endPoint.y, ctx, canvas, { width: 0, height: 0 }, { vertical: true });
|
|
87
|
+
const { max, min, center, width, height } = (0, utils_1.getBoundingBoxBezier)([{ x: xs, y: ys }, { x: cp1x, y: cp1y }, { x: cp2x, y: cp2y }, { x: xe, y: ye }]);
|
|
88
|
+
let fillStyle = await (0, utils_1.parseFillStyle)(ctx, this.props.fillStyle);
|
|
89
|
+
if (debug)
|
|
90
|
+
LazyUtil_1.LazyLog.log('none', `BezierLayer:`, { xs, ys, cp1x, cp1y, cp2x, cp2y, xe, ye, max, min, center, width, height, fillStyle });
|
|
91
|
+
ctx.save();
|
|
92
|
+
(0, utils_1.transform)(ctx, this.props.transform, { x: center.x, y: center.y, width, height, type: this.type });
|
|
93
|
+
(0, utils_1.drawShadow)(ctx, this.props.shadow);
|
|
94
|
+
(0, utils_1.opacity)(ctx, this.props.opacity);
|
|
95
|
+
(0, utils_1.filters)(ctx, this.props.filter);
|
|
96
|
+
ctx.beginPath();
|
|
97
|
+
ctx.moveTo(xs, ys);
|
|
98
|
+
ctx.strokeStyle = fillStyle;
|
|
99
|
+
ctx.lineWidth = this.props.stroke?.width || 1;
|
|
100
|
+
ctx.lineCap = this.props.stroke?.cap || 'butt';
|
|
101
|
+
ctx.lineJoin = this.props.stroke?.join || 'miter';
|
|
102
|
+
ctx.miterLimit = this.props.stroke?.miterLimit || 10;
|
|
103
|
+
ctx.lineDashOffset = this.props.stroke?.dashOffset || 0;
|
|
104
|
+
ctx.setLineDash(this.props.stroke?.dash || []);
|
|
105
|
+
ctx.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, xe, ye);
|
|
106
|
+
ctx.stroke();
|
|
107
|
+
ctx.closePath();
|
|
108
|
+
ctx.restore();
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* @returns {IBezierLayer}
|
|
112
|
+
*/
|
|
113
|
+
toJSON() {
|
|
114
|
+
let data = super.toJSON();
|
|
115
|
+
data.props = this.props;
|
|
116
|
+
return { ...data };
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
exports.BezierLayer = BezierLayer;
|
|
@@ -83,5 +83,13 @@ class Group {
|
|
|
83
83
|
get length() {
|
|
84
84
|
return this.components.length;
|
|
85
85
|
}
|
|
86
|
+
toJSON() {
|
|
87
|
+
return {
|
|
88
|
+
id: this.id,
|
|
89
|
+
visible: this.visible,
|
|
90
|
+
zIndex: this.zIndex,
|
|
91
|
+
components: this.components.map(c => c.toJSON())
|
|
92
|
+
};
|
|
93
|
+
}
|
|
86
94
|
}
|
|
87
95
|
exports.Group = Group;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BaseLayer } from "./BaseLayer";
|
|
2
2
|
import { IImageLayer, IImageLayerProps, ScaleType } from "../../types";
|
|
3
3
|
import { Canvas, SKRSContext2D } from "@napi-rs/canvas";
|
|
4
|
+
import { LayersManager } from "../managers/LayersManager";
|
|
4
5
|
export declare class ImageLayer extends BaseLayer<IImageLayerProps> {
|
|
5
6
|
props: IImageLayerProps;
|
|
6
7
|
constructor(props?: IImageLayerProps);
|
|
@@ -16,7 +17,7 @@ export declare class ImageLayer extends BaseLayer<IImageLayerProps> {
|
|
|
16
17
|
* @param radius {ScaleType} - The `radius` of the image. (optional)
|
|
17
18
|
*/
|
|
18
19
|
setSize(width: ScaleType, height: ScaleType, radius?: ScaleType): this;
|
|
19
|
-
draw(ctx: SKRSContext2D, canvas: Canvas): Promise<void>;
|
|
20
|
+
draw(ctx: SKRSContext2D, canvas: Canvas, manager: LayersManager, debug: boolean): Promise<void>;
|
|
20
21
|
/**
|
|
21
22
|
* @returns {IImageLayer}
|
|
22
23
|
*/
|
|
@@ -61,13 +61,15 @@ class ImageLayer extends BaseLayer_1.BaseLayer {
|
|
|
61
61
|
};
|
|
62
62
|
return this;
|
|
63
63
|
}
|
|
64
|
-
async draw(ctx, canvas) {
|
|
65
|
-
let xs = (0, utils_1.parseToNormal)(this.props.x, canvas);
|
|
66
|
-
let ys = (0, utils_1.parseToNormal)(this.props.y, canvas, { width: 0, height: 0 }, { vertical: true });
|
|
67
|
-
let w = (0, utils_1.parseToNormal)(this.props.size.width, canvas);
|
|
68
|
-
let h = (0, utils_1.parseToNormal)(this.props.size.height, canvas, { width: w, height: 0 }, { vertical: true });
|
|
69
|
-
let r = (0, utils_1.parseToNormal)(this.props.size.radius, canvas, { width: w, height: h }, { layer: true });
|
|
64
|
+
async draw(ctx, canvas, manager, debug) {
|
|
65
|
+
let xs = (0, utils_1.parseToNormal)(this.props.x, ctx, canvas);
|
|
66
|
+
let ys = (0, utils_1.parseToNormal)(this.props.y, ctx, canvas, { width: 0, height: 0 }, { vertical: true });
|
|
67
|
+
let w = (0, utils_1.parseToNormal)(this.props.size.width, ctx, canvas);
|
|
68
|
+
let h = (0, utils_1.parseToNormal)(this.props.size.height, ctx, canvas, { width: w, height: 0 }, { vertical: true });
|
|
69
|
+
let r = (0, utils_1.parseToNormal)(this.props.size.radius, ctx, canvas, { width: w, height: h }, { layer: true });
|
|
70
70
|
let { x, y } = (0, utils_1.centring)(this.props.centring, this.type, w, h, xs, ys);
|
|
71
|
+
if (debug)
|
|
72
|
+
LazyUtil_1.LazyLog.log('none', `ImageLayer:`, { x, y, w, h, r });
|
|
71
73
|
ctx.save();
|
|
72
74
|
(0, utils_1.transform)(ctx, this.props.transform, { width: w, height: h, x, y, type: this.type });
|
|
73
75
|
(0, utils_1.drawShadow)(ctx, this.props.shadow);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BaseLayer } from "./BaseLayer";
|
|
2
2
|
import { IMorphLayer, IMorphLayerProps, ColorType, ScaleType } from "../../types";
|
|
3
3
|
import { Canvas, SKRSContext2D } from "@napi-rs/canvas";
|
|
4
|
+
import { LayersManager } from "../managers/LayersManager";
|
|
4
5
|
export declare class MorphLayer extends BaseLayer<IMorphLayerProps> {
|
|
5
6
|
props: IMorphLayerProps;
|
|
6
7
|
constructor(props?: IMorphLayerProps);
|
|
@@ -31,7 +32,7 @@ export declare class MorphLayer extends BaseLayer<IMorphLayerProps> {
|
|
|
31
32
|
* @param filled {boolean} - The `filled` of the layer.
|
|
32
33
|
*/
|
|
33
34
|
setFilled(filled: boolean): this;
|
|
34
|
-
draw(ctx: SKRSContext2D, canvas: Canvas): Promise<void>;
|
|
35
|
+
draw(ctx: SKRSContext2D, canvas: Canvas, manager: LayersManager, debug: boolean): Promise<void>;
|
|
35
36
|
/**
|
|
36
37
|
* @returns {IMorphLayer}
|
|
37
38
|
*/
|
|
@@ -80,13 +80,16 @@ class MorphLayer extends BaseLayer_1.BaseLayer {
|
|
|
80
80
|
this.props.filled = filled;
|
|
81
81
|
return this;
|
|
82
82
|
}
|
|
83
|
-
async draw(ctx, canvas) {
|
|
84
|
-
const xs = (0, utils_1.parseToNormal)(this.props.x, canvas);
|
|
85
|
-
const ys = (0, utils_1.parseToNormal)(this.props.y, canvas, { width: 0, height: 0 }, { vertical: true });
|
|
86
|
-
const w = (0, utils_1.parseToNormal)(this.props.size.width, canvas);
|
|
87
|
-
const h = (0, utils_1.parseToNormal)(this.props.size.height, canvas, { width: w, height: 0 }, { vertical: true });
|
|
88
|
-
const r = (0, utils_1.parseToNormal)(this.props.size.radius, canvas, { width: w, height: h }, { layer: true });
|
|
83
|
+
async draw(ctx, canvas, manager, debug) {
|
|
84
|
+
const xs = (0, utils_1.parseToNormal)(this.props.x, ctx, canvas);
|
|
85
|
+
const ys = (0, utils_1.parseToNormal)(this.props.y, ctx, canvas, { width: 0, height: 0 }, { vertical: true });
|
|
86
|
+
const w = (0, utils_1.parseToNormal)(this.props.size.width, ctx, canvas, { width: 0, height: 0 }, { vertical: false }, manager);
|
|
87
|
+
const h = (0, utils_1.parseToNormal)(this.props.size.height, ctx, canvas, { width: w, height: 0 }, { vertical: true }, manager);
|
|
88
|
+
const r = (0, utils_1.parseToNormal)(this.props.size.radius, ctx, canvas, { width: w / 2, height: h / 2 }, { layer: true });
|
|
89
89
|
let { x, y } = (0, utils_1.centring)(this.props.centring, this.type, w, h, xs, ys);
|
|
90
|
+
let fillStyle = await (0, utils_1.parseFillStyle)(ctx, this.props.fillStyle);
|
|
91
|
+
if (debug)
|
|
92
|
+
LazyUtil_1.LazyLog.log('none', `MorphLayer:`, { x, y, w, h, r });
|
|
90
93
|
ctx.save();
|
|
91
94
|
(0, utils_1.transform)(ctx, this.props.transform, { width: w, height: h, x, y, type: this.type });
|
|
92
95
|
ctx.beginPath();
|
|
@@ -104,14 +107,6 @@ class MorphLayer extends BaseLayer_1.BaseLayer {
|
|
|
104
107
|
(0, utils_1.drawShadow)(ctx, this.props.shadow);
|
|
105
108
|
(0, utils_1.opacity)(ctx, this.props.opacity);
|
|
106
109
|
(0, utils_1.filters)(ctx, this.props.filter);
|
|
107
|
-
let base = (0, utils_1.parseFillStyle)(ctx, this.props.fillStyle);
|
|
108
|
-
let fillStyle;
|
|
109
|
-
if (base instanceof Promise) {
|
|
110
|
-
fillStyle = await base;
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
fillStyle = base;
|
|
114
|
-
}
|
|
115
110
|
if (this.props.filled) {
|
|
116
111
|
ctx.fillStyle = fillStyle;
|
|
117
112
|
ctx.fill();
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { BaseLayer } from "./BaseLayer";
|
|
2
|
+
import { IQuadraticLayerProps, IQuadraticLayer, ColorType, ScaleType } from "../../types";
|
|
3
|
+
import { Canvas, SKRSContext2D } from "@napi-rs/canvas";
|
|
4
|
+
import { LayersManager } from "../managers/LayersManager";
|
|
5
|
+
export declare class QuadraticLayer extends BaseLayer<IQuadraticLayerProps> {
|
|
6
|
+
props: IQuadraticLayerProps;
|
|
7
|
+
constructor(props?: IQuadraticLayerProps);
|
|
8
|
+
/**
|
|
9
|
+
* @description Sets the control point of the quadratic layer. You can use `numbers`, `percentages`, `px`, `vw`, `vh`, `vmin`, `vmax`.
|
|
10
|
+
* @param x {ScaleType} - The control `x` of the quadratic layer.
|
|
11
|
+
* @param y {ScaleType} - The control `y` of the quadratic layer.
|
|
12
|
+
*/
|
|
13
|
+
setControlPoint(x: ScaleType, y: ScaleType): this;
|
|
14
|
+
/**
|
|
15
|
+
* @description Sets the end point of the quadratic layer. You can use `numbers`, `percentages`, `px`, `vw`, `vh`, `vmin`, `vmax`.
|
|
16
|
+
* @param x {ScaleType} - The end `x` of the quadratic layer.
|
|
17
|
+
* @param y {ScaleType} - The end `y` of the quadratic layer.
|
|
18
|
+
*/
|
|
19
|
+
setEndPoint(x: ScaleType, y: ScaleType): this;
|
|
20
|
+
/**
|
|
21
|
+
* @description Sets the color of the layer. You can use `hex`, `rgb`, `rgba`, `hsl`, `hsla`, and `Gradient`color.
|
|
22
|
+
* @param color {string} - The `color` of the layer.
|
|
23
|
+
*/
|
|
24
|
+
setColor(color: ColorType): this;
|
|
25
|
+
/**
|
|
26
|
+
* @description Sets the stroke of the layer.
|
|
27
|
+
* @param width {number} - The `width` of the stroke.
|
|
28
|
+
* @param cap {string} - The `cap` of the stroke.
|
|
29
|
+
* @param join {string} - The `join` of the stroke.
|
|
30
|
+
* @param dash {number[]} - The `dash` of the stroke.
|
|
31
|
+
* @param dashOffset {number} - The `dashOffset` of the stroke.
|
|
32
|
+
* @param miterLimit {number} - The `miterLimit` of the stroke.
|
|
33
|
+
*/
|
|
34
|
+
setStroke(width: number, cap?: CanvasLineCap, join?: CanvasLineJoin, dash?: number[], dashOffset?: number, miterLimit?: number): this;
|
|
35
|
+
draw(ctx: SKRSContext2D, canvas: Canvas, manager: LayersManager, debug: boolean): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* @returns {IQuadraticLayer}
|
|
38
|
+
*/
|
|
39
|
+
toJSON(): IQuadraticLayer;
|
|
40
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QuadraticLayer = void 0;
|
|
4
|
+
const BaseLayer_1 = require("./BaseLayer");
|
|
5
|
+
const enum_1 = require("../../types/enum");
|
|
6
|
+
const utils_1 = require("../../utils/utils");
|
|
7
|
+
const LazyUtil_1 = require("../../utils/LazyUtil");
|
|
8
|
+
const Gradient_1 = require("../helpers/Gradient");
|
|
9
|
+
const Pattern_1 = require("../helpers/Pattern");
|
|
10
|
+
class QuadraticLayer extends BaseLayer_1.BaseLayer {
|
|
11
|
+
props;
|
|
12
|
+
constructor(props) {
|
|
13
|
+
super(enum_1.LayerType.QuadraticCurve, props);
|
|
14
|
+
this.props = props ? props : {};
|
|
15
|
+
if (!this.props.fillStyle)
|
|
16
|
+
this.props.fillStyle = '#000000';
|
|
17
|
+
this.props.centring = enum_1.Centring.None;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @description Sets the control point of the quadratic layer. You can use `numbers`, `percentages`, `px`, `vw`, `vh`, `vmin`, `vmax`.
|
|
21
|
+
* @param x {ScaleType} - The control `x` of the quadratic layer.
|
|
22
|
+
* @param y {ScaleType} - The control `y` of the quadratic layer.
|
|
23
|
+
*/
|
|
24
|
+
setControlPoint(x, y) {
|
|
25
|
+
this.props.controlPoint = { x, y };
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @description Sets the end point of the quadratic layer. You can use `numbers`, `percentages`, `px`, `vw`, `vh`, `vmin`, `vmax`.
|
|
30
|
+
* @param x {ScaleType} - The end `x` of the quadratic layer.
|
|
31
|
+
* @param y {ScaleType} - The end `y` of the quadratic layer.
|
|
32
|
+
*/
|
|
33
|
+
setEndPoint(x, y) {
|
|
34
|
+
this.props.endPoint = { x, y };
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @description Sets the color of the layer. You can use `hex`, `rgb`, `rgba`, `hsl`, `hsla`, and `Gradient`color.
|
|
39
|
+
* @param color {string} - The `color` of the layer.
|
|
40
|
+
*/
|
|
41
|
+
setColor(color) {
|
|
42
|
+
if (!color)
|
|
43
|
+
throw new LazyUtil_1.LazyError('The color of the layer must be provided');
|
|
44
|
+
if (!(0, utils_1.isColor)(color))
|
|
45
|
+
throw new LazyUtil_1.LazyError('The color of the layer must be a valid color');
|
|
46
|
+
let fill = (0, utils_1.parseColor)(color);
|
|
47
|
+
if (fill instanceof Gradient_1.Gradient || fill instanceof Pattern_1.Pattern) {
|
|
48
|
+
this.props.fillStyle = fill;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
let arr = fill.split(':');
|
|
52
|
+
this.props.fillStyle = arr[0];
|
|
53
|
+
this.props.opacity = parseFloat(arr[1]) || 1;
|
|
54
|
+
}
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @description Sets the stroke of the layer.
|
|
59
|
+
* @param width {number} - The `width` of the stroke.
|
|
60
|
+
* @param cap {string} - The `cap` of the stroke.
|
|
61
|
+
* @param join {string} - The `join` of the stroke.
|
|
62
|
+
* @param dash {number[]} - The `dash` of the stroke.
|
|
63
|
+
* @param dashOffset {number} - The `dashOffset` of the stroke.
|
|
64
|
+
* @param miterLimit {number} - The `miterLimit` of the stroke.
|
|
65
|
+
*/
|
|
66
|
+
setStroke(width, cap, join, dash, dashOffset, miterLimit) {
|
|
67
|
+
this.props.stroke = {
|
|
68
|
+
width,
|
|
69
|
+
cap: cap || 'butt',
|
|
70
|
+
join: join || 'miter',
|
|
71
|
+
dash: dash || [],
|
|
72
|
+
dashOffset: dashOffset || 0,
|
|
73
|
+
miterLimit: miterLimit || 10,
|
|
74
|
+
};
|
|
75
|
+
return this;
|
|
76
|
+
}
|
|
77
|
+
async draw(ctx, canvas, manager, debug) {
|
|
78
|
+
const xs = (0, utils_1.parseToNormal)(this.props.x, ctx, canvas);
|
|
79
|
+
const ys = (0, utils_1.parseToNormal)(this.props.y, ctx, canvas, { width: 0, height: 0 }, { vertical: true });
|
|
80
|
+
const cx = (0, utils_1.parseToNormal)(this.props.controlPoint.x, ctx, canvas);
|
|
81
|
+
const cy = (0, utils_1.parseToNormal)(this.props.controlPoint.y, ctx, canvas, { width: 0, height: 0 }, { vertical: true });
|
|
82
|
+
const xe = (0, utils_1.parseToNormal)(this.props.endPoint.x, ctx, canvas);
|
|
83
|
+
const ye = (0, utils_1.parseToNormal)(this.props.endPoint.y, ctx, canvas, { width: 0, height: 0 }, { vertical: true });
|
|
84
|
+
const { max, min, center, width, height } = (0, utils_1.getBoundingBoxBezier)([{ x: xs, y: ys }, { x: cx, y: cy }, { x: xe, y: ye }]);
|
|
85
|
+
let fillStyle = await (0, utils_1.parseFillStyle)(ctx, this.props.fillStyle);
|
|
86
|
+
if (debug)
|
|
87
|
+
LazyUtil_1.LazyLog.log('none', `BezierLayer:`, { xs, ys, cx, cy, xe, ye, max, min, center, width, height, fillStyle });
|
|
88
|
+
ctx.save();
|
|
89
|
+
(0, utils_1.transform)(ctx, this.props.transform, { x: center.x, y: center.y, width, height, type: this.type });
|
|
90
|
+
(0, utils_1.drawShadow)(ctx, this.props.shadow);
|
|
91
|
+
(0, utils_1.opacity)(ctx, this.props.opacity);
|
|
92
|
+
(0, utils_1.filters)(ctx, this.props.filter);
|
|
93
|
+
ctx.beginPath();
|
|
94
|
+
ctx.moveTo(xs, ys);
|
|
95
|
+
ctx.strokeStyle = fillStyle;
|
|
96
|
+
ctx.lineWidth = this.props.stroke?.width || 1;
|
|
97
|
+
ctx.lineCap = this.props.stroke?.cap || 'butt';
|
|
98
|
+
ctx.lineJoin = this.props.stroke?.join || 'miter';
|
|
99
|
+
ctx.miterLimit = this.props.stroke?.miterLimit || 10;
|
|
100
|
+
ctx.lineDashOffset = this.props.stroke?.dashOffset || 0;
|
|
101
|
+
ctx.setLineDash(this.props.stroke?.dash || []);
|
|
102
|
+
ctx.quadraticCurveTo(cx, cy, xe, ye);
|
|
103
|
+
ctx.stroke();
|
|
104
|
+
ctx.closePath();
|
|
105
|
+
ctx.restore();
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* @returns {IQuadraticLayer}
|
|
109
|
+
*/
|
|
110
|
+
toJSON() {
|
|
111
|
+
let data = super.toJSON();
|
|
112
|
+
data.props = this.props;
|
|
113
|
+
return { ...data };
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.QuadraticLayer = QuadraticLayer;
|
|
@@ -2,6 +2,7 @@ import { BaseLayer } from "./BaseLayer";
|
|
|
2
2
|
import { FontWeight, LineCap, LineJoin, TextAlign, TextBaseline, TextDirection } from "../../types/enum";
|
|
3
3
|
import { ITextLayer, ITextLayerProps, ScaleType, ColorType } from "../../types";
|
|
4
4
|
import { Canvas, SKRSContext2D } from "@napi-rs/canvas";
|
|
5
|
+
import { LayersManager } from "../managers/LayersManager";
|
|
5
6
|
export declare class TextLayer extends BaseLayer<ITextLayerProps> {
|
|
6
7
|
props: ITextLayerProps;
|
|
7
8
|
constructor(props?: ITextLayerProps);
|
|
@@ -60,7 +61,11 @@ export declare class TextLayer extends BaseLayer<ITextLayerProps> {
|
|
|
60
61
|
* @param filled {boolean} - The `filled` of the layer.
|
|
61
62
|
*/
|
|
62
63
|
setFilled(filled: boolean): this;
|
|
63
|
-
|
|
64
|
+
measureText(ctx: SKRSContext2D, canvas: Canvas): {
|
|
65
|
+
width: number;
|
|
66
|
+
height: number;
|
|
67
|
+
};
|
|
68
|
+
draw(ctx: SKRSContext2D, canvas: Canvas, manager: LayersManager, debug: boolean): Promise<void>;
|
|
64
69
|
private drawText;
|
|
65
70
|
/**
|
|
66
71
|
* @returns {ITextLayer}
|
|
@@ -144,13 +144,26 @@ class TextLayer extends BaseLayer_1.BaseLayer {
|
|
|
144
144
|
this.props.filled = filled;
|
|
145
145
|
return this;
|
|
146
146
|
}
|
|
147
|
-
|
|
148
|
-
const
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
147
|
+
measureText(ctx, canvas) {
|
|
148
|
+
const w = (0, utils_1.parseToNormal)(this.props.multiline?.width, ctx, canvas);
|
|
149
|
+
const h = (0, utils_1.parseToNormal)(this.props.multiline?.height, ctx, canvas, { width: w, height: 0 }, { vertical: true });
|
|
150
|
+
if (this.props.multiline.enabled) {
|
|
151
|
+
return { width: w, height: h };
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
ctx.font = `${this.props.font.weight} ${this.props.font.size}px ${this.props.font.family}`;
|
|
155
|
+
let data = ctx.measureText(this.props.text);
|
|
156
|
+
return { width: data.width, height: this.props.font.size };
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
async draw(ctx, canvas, manager, debug) {
|
|
160
|
+
const x = (0, utils_1.parseToNormal)(this.props.x, ctx, canvas);
|
|
161
|
+
const y = (0, utils_1.parseToNormal)(this.props.y, ctx, canvas, { width: 0, height: 0 }, { vertical: true });
|
|
162
|
+
const w = (0, utils_1.parseToNormal)(this.props.multiline?.width, ctx, canvas);
|
|
163
|
+
const h = (0, utils_1.parseToNormal)(this.props.multiline?.height, ctx, canvas, { width: w, height: 0 }, { vertical: true });
|
|
164
|
+
if (debug)
|
|
165
|
+
LazyUtil_1.LazyLog.log('none', `TextLayer:`, { x, y, w, h });
|
|
152
166
|
ctx.save();
|
|
153
|
-
console.log(this.props);
|
|
154
167
|
(0, utils_1.transform)(ctx, this.props.transform, { width: w, height: h, x, y, type: this.type }, { text: this.props.text, textAlign: this.props.align, fontSize: this.props.font.size, multiline: this.props.multiline.enabled });
|
|
155
168
|
ctx.beginPath();
|
|
156
169
|
(0, utils_1.drawShadow)(ctx, this.props.shadow);
|
|
@@ -2,7 +2,16 @@ import { IFontsManager, IFonts } from "../../types";
|
|
|
2
2
|
import { Font } from "../helpers/Font";
|
|
3
3
|
export declare class FontsManager implements IFontsManager {
|
|
4
4
|
map: Map<string, Font>;
|
|
5
|
-
|
|
5
|
+
debug: boolean;
|
|
6
|
+
constructor(debug?: boolean);
|
|
7
|
+
/**
|
|
8
|
+
* Replace base fonts with custom fonts by special file.
|
|
9
|
+
* Use this method before loading fonts by `FontManager`.
|
|
10
|
+
* The file should be generated by the following instructions:
|
|
11
|
+
* @see https://github.com/NMMTY/LazyCanvas/blob/main/scripts/FontsGenerate.md
|
|
12
|
+
* @param fontList {IFonts[]} - The `fonts` to set
|
|
13
|
+
*/
|
|
14
|
+
loadFonts(fontList: IFonts): this;
|
|
6
15
|
/**
|
|
7
16
|
* Add a font to the map
|
|
8
17
|
* @param fonts {Font[]} - The `font` to add to the map
|