@nmmty/lazycanvas 0.6.0-dev.f33019 → 0.6.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/helpers/Utlis.d.ts +28 -0
- package/dist/helpers/Utlis.js +78 -0
- package/dist/helpers/index.d.ts +3 -0
- package/dist/helpers/index.js +19 -0
- package/dist/index.d.ts +5 -10
- package/dist/index.js +5 -29
- package/dist/structures/LazyCanvas.d.ts +46 -13
- package/dist/structures/LazyCanvas.js +66 -22
- package/dist/structures/components/BaseLayer.d.ts +16 -16
- package/dist/structures/components/BaseLayer.js +17 -17
- package/dist/structures/components/BezierLayer.d.ts +21 -21
- package/dist/structures/components/BezierLayer.js +20 -20
- package/dist/structures/components/ClearLayer.d.ts +15 -15
- package/dist/structures/components/ClearLayer.js +14 -14
- package/dist/structures/components/Group.d.ts +10 -11
- package/dist/structures/components/Group.js +9 -10
- package/dist/structures/components/ImageLayer.d.ts +12 -14
- package/dist/structures/components/ImageLayer.js +11 -11
- package/dist/structures/components/LineLayer.d.ts +20 -20
- package/dist/structures/components/LineLayer.js +19 -19
- package/dist/structures/components/MorphLayer.d.ts +18 -24
- package/dist/structures/components/MorphLayer.js +18 -26
- package/dist/structures/components/Path2DLayer.d.ts +4 -78
- package/dist/structures/components/Path2DLayer.js +2 -116
- package/dist/structures/components/QuadraticLayer.d.ts +22 -22
- package/dist/structures/components/QuadraticLayer.js +21 -21
- package/dist/structures/components/TextLayer.d.ts +37 -43
- package/dist/structures/components/TextLayer.js +37 -45
- package/dist/structures/helpers/Exporter.d.ts +9 -11
- package/dist/structures/helpers/Exporter.js +49 -32
- package/dist/structures/helpers/Font.d.ts +4 -6
- package/dist/structures/helpers/Font.js +4 -4
- package/dist/structures/helpers/Gradient.d.ts +15 -10
- package/dist/structures/helpers/Gradient.js +14 -9
- package/dist/structures/helpers/Link.d.ts +5 -5
- package/dist/structures/helpers/Link.js +5 -5
- package/dist/structures/helpers/Pattern.d.ts +5 -5
- package/dist/structures/helpers/Pattern.js +5 -5
- package/dist/structures/helpers/index.d.ts +7 -7
- package/dist/structures/helpers/readers/JSONReader.d.ts +12 -12
- package/dist/structures/helpers/readers/JSONReader.js +29 -19
- package/dist/structures/helpers/readers/YAMLReader.d.ts +4 -4
- package/dist/structures/helpers/readers/YAMLReader.js +21 -11
- package/dist/structures/managers/AnimationManager.d.ts +11 -11
- package/dist/structures/managers/AnimationManager.js +11 -11
- package/dist/structures/managers/FontsManager.d.ts +14 -15
- package/dist/structures/managers/FontsManager.js +14 -15
- package/dist/structures/managers/LayersManager.d.ts +22 -12
- package/dist/structures/managers/LayersManager.js +27 -12
- package/dist/structures/managers/PluginManager.d.ts +230 -0
- package/dist/structures/managers/PluginManager.js +182 -0
- package/dist/structures/managers/RenderManager.d.ts +10 -12
- package/dist/structures/managers/RenderManager.js +31 -16
- package/dist/structures/managers/index.d.ts +5 -0
- package/dist/structures/managers/index.js +21 -0
- package/dist/utils/utils.d.ts +1 -1
- package/dist/utils/utils.js +15 -16
- package/package.json +59 -56
|
@@ -52,8 +52,8 @@ class BaseLayer {
|
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* Sets the position of the layer in the 2D plane.
|
|
55
|
-
* @param {ScaleType} x - The x-coordinate of the layer.
|
|
56
|
-
* @param {ScaleType} y - The y-coordinate of the layer.
|
|
55
|
+
* @param {ScaleType} [x] - The x-coordinate of the layer.
|
|
56
|
+
* @param {ScaleType} [y] - The y-coordinate of the layer.
|
|
57
57
|
* @returns {this} The current instance for chaining.
|
|
58
58
|
*/
|
|
59
59
|
setPosition(x, y) {
|
|
@@ -63,7 +63,7 @@ class BaseLayer {
|
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
65
|
* Sets the opacity of the layer.
|
|
66
|
-
* @param {number} opacity - The opacity value, between 0 and 1.
|
|
66
|
+
* @param {number} [opacity] - The opacity value, between 0 and 1.
|
|
67
67
|
* @returns {this} The current instance for chaining.
|
|
68
68
|
*/
|
|
69
69
|
setOpacity(opacity) {
|
|
@@ -73,7 +73,7 @@ class BaseLayer {
|
|
|
73
73
|
/**
|
|
74
74
|
* Sets the unique identifier of the layer.
|
|
75
75
|
*
|
|
76
|
-
* @param {string} id - The unique identifier.
|
|
76
|
+
* @param {string} [id] - The unique identifier.
|
|
77
77
|
* @returns {this} The current instance for chaining.
|
|
78
78
|
*/
|
|
79
79
|
setID(id) {
|
|
@@ -82,7 +82,7 @@ class BaseLayer {
|
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
84
|
* Sets the shadow properties of the layer.
|
|
85
|
-
* @param {string} color - The color of the shadow.
|
|
85
|
+
* @param {string} [color] - The color of the shadow.
|
|
86
86
|
* @param {number} [blur] - The blur radius of the shadow.
|
|
87
87
|
* @param {number} [offsetX] - The horizontal offset of the shadow.
|
|
88
88
|
* @param {number} [offsetY] - The vertical offset of the shadow.
|
|
@@ -104,7 +104,7 @@ class BaseLayer {
|
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
106
106
|
* Sets the transformation matrix of the layer.
|
|
107
|
-
* @param {DOMMatrix2DInit} matrix - The transformation matrix.
|
|
107
|
+
* @param {DOMMatrix2DInit} [matrix] - The transformation matrix.
|
|
108
108
|
* @returns {this} The current instance for chaining.
|
|
109
109
|
*/
|
|
110
110
|
setMatrix(matrix) {
|
|
@@ -113,8 +113,8 @@ class BaseLayer {
|
|
|
113
113
|
}
|
|
114
114
|
/**
|
|
115
115
|
* Sets the scale of the layer in the x and y directions.
|
|
116
|
-
* @param {number} x - The scale factor in the x direction.
|
|
117
|
-
* @param {number} y - The scale factor in the y direction.
|
|
116
|
+
* @param {number} [x] - The scale factor in the x direction.
|
|
117
|
+
* @param {number} [y] - The scale factor in the y direction.
|
|
118
118
|
* @returns {this} The current instance for chaining.
|
|
119
119
|
*/
|
|
120
120
|
setScale(x, y) {
|
|
@@ -123,7 +123,7 @@ class BaseLayer {
|
|
|
123
123
|
}
|
|
124
124
|
/**
|
|
125
125
|
* Sets the rotation of the layer.
|
|
126
|
-
* @param {number} rotate - The rotation angle in degrees.
|
|
126
|
+
* @param {number} [rotate] - The rotation angle in degrees.
|
|
127
127
|
* @returns {this} The current instance for chaining.
|
|
128
128
|
*/
|
|
129
129
|
setRotate(rotate) {
|
|
@@ -132,8 +132,8 @@ class BaseLayer {
|
|
|
132
132
|
}
|
|
133
133
|
/**
|
|
134
134
|
* Sets the translation of the layer in the x and y directions.
|
|
135
|
-
* @param {number} x - The translation in the x direction.
|
|
136
|
-
* @param {number} y - The translation in the y direction.
|
|
135
|
+
* @param {number} [x] - The translation in the x direction.
|
|
136
|
+
* @param {number} [y] - The translation in the y direction.
|
|
137
137
|
* @returns {this} The current instance for chaining.
|
|
138
138
|
*/
|
|
139
139
|
setTranslate(x, y) {
|
|
@@ -142,7 +142,7 @@ class BaseLayer {
|
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
144
144
|
* Sets the filter effects for the layer.
|
|
145
|
-
* @param {...AnyFilter} filter - The filter effects to apply.
|
|
145
|
+
* @param {...AnyFilter} [filter] - The filter effects to apply.
|
|
146
146
|
* @returns {this} The current instance for chaining.
|
|
147
147
|
*/
|
|
148
148
|
setFilters(...filter) {
|
|
@@ -151,7 +151,7 @@ class BaseLayer {
|
|
|
151
151
|
}
|
|
152
152
|
/**
|
|
153
153
|
* Sets the centring type of the layer. **Don't affect on Bezier, Line, Quadratic and Text layers**.
|
|
154
|
-
* @param {AnyCentring} centring - The centring type.
|
|
154
|
+
* @param {AnyCentring} [centring] - The centring type.
|
|
155
155
|
* @returns {this} The current instance for chaining.
|
|
156
156
|
*/
|
|
157
157
|
setCentring(centring) {
|
|
@@ -160,7 +160,7 @@ class BaseLayer {
|
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
162
162
|
* Sets the visibility of the layer.
|
|
163
|
-
* @param {boolean} visible - The visibility state.
|
|
163
|
+
* @param {boolean} [visible] - The visibility state.
|
|
164
164
|
* @returns {this} The current instance for chaining.
|
|
165
165
|
*/
|
|
166
166
|
setVisible(visible) {
|
|
@@ -169,7 +169,7 @@ class BaseLayer {
|
|
|
169
169
|
}
|
|
170
170
|
/**
|
|
171
171
|
* Sets the z-index of the layer.
|
|
172
|
-
* @param {number} zIndex - The z-index value.
|
|
172
|
+
* @param {number} [zIndex] - The z-index value.
|
|
173
173
|
* @returns {this} The current instance for chaining.
|
|
174
174
|
*/
|
|
175
175
|
setZIndex(zIndex) {
|
|
@@ -178,7 +178,7 @@ class BaseLayer {
|
|
|
178
178
|
}
|
|
179
179
|
/**
|
|
180
180
|
* Sets the global composite operation for the layer.
|
|
181
|
-
* @param {AnyGlobalCompositeOperation} operation - The composite operation.
|
|
181
|
+
* @param {AnyGlobalCompositeOperation} [operation] - The composite operation.
|
|
182
182
|
* @returns {this} The current instance for chaining.
|
|
183
183
|
*/
|
|
184
184
|
setGlobalCompositeOperation(operation) {
|
|
@@ -206,7 +206,7 @@ class BaseLayer {
|
|
|
206
206
|
centring: data.centring || types_1.Centring.Center,
|
|
207
207
|
filter: data.filter || '',
|
|
208
208
|
opacity: data.opacity || 1,
|
|
209
|
-
filled: data.filled ||
|
|
209
|
+
filled: data.filled || true,
|
|
210
210
|
fillStyle: data.fillStyle || '#000000',
|
|
211
211
|
transform: data.transform || {},
|
|
212
212
|
globalComposite: data.globalComposite || 'source-over',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseLayer, IBaseLayer, IBaseLayerMisc, IBaseLayerProps } from "./BaseLayer";
|
|
2
2
|
import { ColorType, Point, ScaleType, LayerType } from "../../types";
|
|
3
3
|
import { Canvas, SKRSContext2D, SvgCanvas } from "@napi-rs/canvas";
|
|
4
|
-
import { LayersManager } from "../managers
|
|
4
|
+
import { LayersManager } from "../managers";
|
|
5
5
|
/**
|
|
6
6
|
* Interface representing a Bezier layer.
|
|
7
7
|
*/
|
|
@@ -67,13 +67,13 @@ export declare class BezierLayer extends BaseLayer<IBezierLayerProps> {
|
|
|
67
67
|
props: IBezierLayerProps;
|
|
68
68
|
/**
|
|
69
69
|
* Constructs a new BezierLayer instance.
|
|
70
|
-
* @param
|
|
71
|
-
* @param
|
|
70
|
+
* @param {IBezierLayerProps} [props] - The properties of the Bezier layer.
|
|
71
|
+
* @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
|
|
72
72
|
*/
|
|
73
73
|
constructor(props?: IBezierLayerProps, misc?: IBaseLayerMisc);
|
|
74
74
|
/**
|
|
75
75
|
* Sets the control points of the Bezier layer.
|
|
76
|
-
* @param
|
|
76
|
+
* @param {Array<{ x: ScaleType, y: ScaleType }>} [controlPoints] - The control points of the Bezier layer.
|
|
77
77
|
* @returns {this} The current instance for chaining.
|
|
78
78
|
* @throws {LazyError} If the number of control points is not exactly 2.
|
|
79
79
|
*/
|
|
@@ -83,34 +83,34 @@ export declare class BezierLayer extends BaseLayer<IBezierLayerProps> {
|
|
|
83
83
|
}[]): this;
|
|
84
84
|
/**
|
|
85
85
|
* Sets the end position of the Bezier layer.
|
|
86
|
-
* @param
|
|
87
|
-
* @param
|
|
86
|
+
* @param {ScaleType} [x] - The x-coordinate of the end point.
|
|
87
|
+
* @param {ScaleType} [y] - The y-coordinate of the end point.
|
|
88
88
|
* @returns {this} The current instance for chaining.
|
|
89
89
|
*/
|
|
90
90
|
setEndPosition(x: ScaleType, y: ScaleType): this;
|
|
91
91
|
/**
|
|
92
92
|
* Sets the color of the Bezier layer.
|
|
93
|
-
* @param
|
|
93
|
+
* @param {ColorType} [color] - The color of the layer.
|
|
94
94
|
* @returns {this} The current instance for chaining.
|
|
95
95
|
* @throws {LazyError} If the color is not provided or invalid.
|
|
96
96
|
*/
|
|
97
97
|
setColor(color: ColorType): this;
|
|
98
98
|
/**
|
|
99
99
|
* Sets the stroke properties of the Bezier layer.
|
|
100
|
-
* @param
|
|
101
|
-
* @param
|
|
102
|
-
* @param
|
|
103
|
-
* @param
|
|
104
|
-
* @param
|
|
105
|
-
* @param
|
|
100
|
+
* @param {number} [width] - The width of the stroke.
|
|
101
|
+
* @param {string} [cap] - The cap style of the stroke.
|
|
102
|
+
* @param {string} [join] - The join style of the stroke.
|
|
103
|
+
* @param {number[]} [dash] - The dash pattern of the stroke.
|
|
104
|
+
* @param {number} [dashOffset] - The dash offset of the stroke.
|
|
105
|
+
* @param {number} [miterLimit] - The miter limit of the stroke.
|
|
106
106
|
* @returns {this} The current instance for chaining.
|
|
107
107
|
*/
|
|
108
108
|
setStroke(width: number, cap?: CanvasLineCap, join?: CanvasLineJoin, dash?: number[], dashOffset?: number, miterLimit?: number): this;
|
|
109
109
|
/**
|
|
110
110
|
* Calculates the bounding box of the Bezier layer.
|
|
111
|
-
* @param
|
|
112
|
-
* @param
|
|
113
|
-
* @param
|
|
111
|
+
* @param {SKRSContext2D} [ctx] - The canvas rendering context.
|
|
112
|
+
* @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
|
|
113
|
+
* @param {LayersManager} [manager] - The layers manager.
|
|
114
114
|
* @returns {Object} The bounding box details including max, min, center, width, and height.
|
|
115
115
|
*/
|
|
116
116
|
getBoundingBox(ctx: SKRSContext2D, canvas: Canvas | SvgCanvas, manager: LayersManager): {
|
|
@@ -122,10 +122,10 @@ export declare class BezierLayer extends BaseLayer<IBezierLayerProps> {
|
|
|
122
122
|
};
|
|
123
123
|
/**
|
|
124
124
|
* Draws the Bezier layer on the canvas.
|
|
125
|
-
* @param
|
|
126
|
-
* @param
|
|
127
|
-
* @param
|
|
128
|
-
* @param
|
|
125
|
+
* @param {SKRSContext2D} [ctx] - The canvas rendering context.
|
|
126
|
+
* @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
|
|
127
|
+
* @param {LayersManager} [manager] - The layers manager.
|
|
128
|
+
* @param {boolean} [debug] - Whether to enable debug logging.
|
|
129
129
|
*/
|
|
130
130
|
draw(ctx: SKRSContext2D, canvas: Canvas | SvgCanvas, manager: LayersManager, debug: boolean): Promise<void>;
|
|
131
131
|
/**
|
|
@@ -135,7 +135,7 @@ export declare class BezierLayer extends BaseLayer<IBezierLayerProps> {
|
|
|
135
135
|
toJSON(): IBezierLayer;
|
|
136
136
|
/**
|
|
137
137
|
* Validates the properties of the Bezier layer.
|
|
138
|
-
* @param
|
|
138
|
+
* @param {IBezierLayerProps} [data] - The properties to validate.
|
|
139
139
|
* @returns {IBezierLayerProps} The validated properties.
|
|
140
140
|
*/
|
|
141
141
|
protected validateProps(data: IBezierLayerProps): IBezierLayerProps;
|
|
@@ -15,8 +15,8 @@ class BezierLayer extends BaseLayer_1.BaseLayer {
|
|
|
15
15
|
props;
|
|
16
16
|
/**
|
|
17
17
|
* Constructs a new BezierLayer instance.
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
18
|
+
* @param {IBezierLayerProps} [props] - The properties of the Bezier layer.
|
|
19
|
+
* @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
|
|
20
20
|
*/
|
|
21
21
|
constructor(props, misc) {
|
|
22
22
|
super(types_1.LayerType.BezierCurve, props || {}, misc);
|
|
@@ -25,7 +25,7 @@ class BezierLayer extends BaseLayer_1.BaseLayer {
|
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* Sets the control points of the Bezier layer.
|
|
28
|
-
* @param
|
|
28
|
+
* @param {Array<{ x: ScaleType, y: ScaleType }>} [controlPoints] - The control points of the Bezier layer.
|
|
29
29
|
* @returns {this} The current instance for chaining.
|
|
30
30
|
* @throws {LazyError} If the number of control points is not exactly 2.
|
|
31
31
|
*/
|
|
@@ -37,8 +37,8 @@ class BezierLayer extends BaseLayer_1.BaseLayer {
|
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* Sets the end position of the Bezier layer.
|
|
40
|
-
* @param
|
|
41
|
-
* @param
|
|
40
|
+
* @param {ScaleType} [x] - The x-coordinate of the end point.
|
|
41
|
+
* @param {ScaleType} [y] - The y-coordinate of the end point.
|
|
42
42
|
* @returns {this} The current instance for chaining.
|
|
43
43
|
*/
|
|
44
44
|
setEndPosition(x, y) {
|
|
@@ -47,7 +47,7 @@ class BezierLayer extends BaseLayer_1.BaseLayer {
|
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Sets the color of the Bezier layer.
|
|
50
|
-
* @param
|
|
50
|
+
* @param {ColorType} [color] - The color of the layer.
|
|
51
51
|
* @returns {this} The current instance for chaining.
|
|
52
52
|
* @throws {LazyError} If the color is not provided or invalid.
|
|
53
53
|
*/
|
|
@@ -61,12 +61,12 @@ class BezierLayer extends BaseLayer_1.BaseLayer {
|
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* Sets the stroke properties of the Bezier layer.
|
|
64
|
-
* @param
|
|
65
|
-
* @param
|
|
66
|
-
* @param
|
|
67
|
-
* @param
|
|
68
|
-
* @param
|
|
69
|
-
* @param
|
|
64
|
+
* @param {number} [width] - The width of the stroke.
|
|
65
|
+
* @param {string} [cap] - The cap style of the stroke.
|
|
66
|
+
* @param {string} [join] - The join style of the stroke.
|
|
67
|
+
* @param {number[]} [dash] - The dash pattern of the stroke.
|
|
68
|
+
* @param {number} [dashOffset] - The dash offset of the stroke.
|
|
69
|
+
* @param {number} [miterLimit] - The miter limit of the stroke.
|
|
70
70
|
* @returns {this} The current instance for chaining.
|
|
71
71
|
*/
|
|
72
72
|
setStroke(width, cap, join, dash, dashOffset, miterLimit) {
|
|
@@ -82,9 +82,9 @@ class BezierLayer extends BaseLayer_1.BaseLayer {
|
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
84
|
* Calculates the bounding box of the Bezier layer.
|
|
85
|
-
* @param
|
|
86
|
-
* @param
|
|
87
|
-
* @param
|
|
85
|
+
* @param {SKRSContext2D} [ctx] - The canvas rendering context.
|
|
86
|
+
* @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
|
|
87
|
+
* @param {LayersManager} [manager] - The layers manager.
|
|
88
88
|
* @returns {Object} The bounding box details including max, min, center, width, and height.
|
|
89
89
|
*/
|
|
90
90
|
getBoundingBox(ctx, canvas, manager) {
|
|
@@ -104,10 +104,10 @@ class BezierLayer extends BaseLayer_1.BaseLayer {
|
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
106
106
|
* Draws the Bezier layer on the canvas.
|
|
107
|
-
* @param
|
|
108
|
-
* @param
|
|
109
|
-
* @param
|
|
110
|
-
* @param
|
|
107
|
+
* @param {SKRSContext2D} [ctx] - The canvas rendering context.
|
|
108
|
+
* @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
|
|
109
|
+
* @param {LayersManager} [manager] - The layers manager.
|
|
110
|
+
* @param {boolean} [debug] - Whether to enable debug logging.
|
|
111
111
|
*/
|
|
112
112
|
async draw(ctx, canvas, manager, debug) {
|
|
113
113
|
const parcer = (0, utils_1.parser)(ctx, canvas, manager);
|
|
@@ -173,7 +173,7 @@ class BezierLayer extends BaseLayer_1.BaseLayer {
|
|
|
173
173
|
}
|
|
174
174
|
/**
|
|
175
175
|
* Validates the properties of the Bezier layer.
|
|
176
|
-
* @param
|
|
176
|
+
* @param {IBezierLayerProps} [data] - The properties to validate.
|
|
177
177
|
* @returns {IBezierLayerProps} The validated properties.
|
|
178
178
|
*/
|
|
179
179
|
validateProps(data) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ScaleType, LayerType, AnyCentring, AnyGlobalCompositeOperation } from "../../types";
|
|
2
2
|
import { Canvas, SKRSContext2D, SvgCanvas } from "@napi-rs/canvas";
|
|
3
|
-
import { LayersManager } from "../managers
|
|
3
|
+
import { LayersManager } from "../managers";
|
|
4
4
|
import { IBaseLayerMisc } from "./BaseLayer";
|
|
5
5
|
/**
|
|
6
6
|
* Interface representing a Clear Layer.
|
|
@@ -87,55 +87,55 @@ export declare class ClearLayer implements IClearLayer {
|
|
|
87
87
|
props: IClearLayerProps;
|
|
88
88
|
/**
|
|
89
89
|
* Constructs a new ClearLayer instance.
|
|
90
|
-
* @param
|
|
91
|
-
* @param
|
|
90
|
+
* @param {IClearLayerProps} [props] - The properties of the Clear Layer.
|
|
91
|
+
* @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
|
|
92
92
|
*/
|
|
93
93
|
constructor(props?: IClearLayerProps, misc?: IBaseLayerMisc);
|
|
94
94
|
/**
|
|
95
95
|
* Sets the position of the layer in the 2D plane.
|
|
96
|
-
* @param
|
|
97
|
-
* @param
|
|
96
|
+
* @param {ScaleType} [x] - The x-coordinate of the layer.
|
|
97
|
+
* @param {ScaleType} [y] - The y-coordinate of the layer.
|
|
98
98
|
* @returns {this} The current instance for chaining.
|
|
99
99
|
*/
|
|
100
100
|
setPosition(x: ScaleType, y: ScaleType): this;
|
|
101
101
|
/**
|
|
102
102
|
* Sets the size of the layer.
|
|
103
|
-
* @param
|
|
104
|
-
* @param
|
|
103
|
+
* @param {ScaleType} [width] - The width of the layer.
|
|
104
|
+
* @param {ScaleType} [height] - The height of the layer.
|
|
105
105
|
* @returns {this} The current instance for chaining.
|
|
106
106
|
*/
|
|
107
107
|
setSize(width: ScaleType, height: ScaleType): this;
|
|
108
108
|
/**
|
|
109
109
|
* Sets the unique identifier of the layer.
|
|
110
110
|
*
|
|
111
|
-
* @param {string} id - The unique identifier.
|
|
111
|
+
* @param {string} [id] - The unique identifier.
|
|
112
112
|
* @returns {this} The current instance for chaining.
|
|
113
113
|
*/
|
|
114
114
|
setID(id: string): this;
|
|
115
115
|
/**
|
|
116
116
|
* Sets the centring type of the layer.
|
|
117
|
-
* @param
|
|
117
|
+
* @param {AnyCentring} [centring] - The centring type of the layer.
|
|
118
118
|
* @returns {this} The current instance for chaining.
|
|
119
119
|
*/
|
|
120
120
|
setCentring(centring: AnyCentring): this;
|
|
121
121
|
/**
|
|
122
122
|
* Sets the visibility of the layer.
|
|
123
|
-
* @param
|
|
123
|
+
* @param {boolean} [visible] - The visibility state of the layer.
|
|
124
124
|
* @returns {this} The current instance for chaining.
|
|
125
125
|
*/
|
|
126
126
|
setVisible(visible: boolean): this;
|
|
127
127
|
/**
|
|
128
128
|
* Sets the z-index of the layer.
|
|
129
|
-
* @param
|
|
129
|
+
* @param {number} [zIndex] - The z-index value of the layer.
|
|
130
130
|
* @returns {this} The current instance for chaining.
|
|
131
131
|
*/
|
|
132
132
|
setZIndex(zIndex: number): this;
|
|
133
133
|
/**
|
|
134
134
|
* Draws the Clear Layer on the canvas.
|
|
135
|
-
* @param
|
|
136
|
-
* @param
|
|
137
|
-
* @param
|
|
138
|
-
* @param
|
|
135
|
+
* @param {SKRSContext2D} [ctx] - The canvas rendering context.
|
|
136
|
+
* @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
|
|
137
|
+
* @param {LayersManager} [manager] - The layers manager.
|
|
138
|
+
* @param {boolean} [debug] - Whether to enable debug logging.
|
|
139
139
|
*/
|
|
140
140
|
draw(ctx: SKRSContext2D, canvas: Canvas | SvgCanvas, manager: LayersManager, debug: boolean): Promise<void>;
|
|
141
141
|
/**
|
|
@@ -31,8 +31,8 @@ class ClearLayer {
|
|
|
31
31
|
props;
|
|
32
32
|
/**
|
|
33
33
|
* Constructs a new ClearLayer instance.
|
|
34
|
-
* @param
|
|
35
|
-
* @param
|
|
34
|
+
* @param {IClearLayerProps} [props] - The properties of the Clear Layer.
|
|
35
|
+
* @param {IBaseLayerMisc} [misc] - Miscellaneous options for the layer.
|
|
36
36
|
*/
|
|
37
37
|
constructor(props, misc) {
|
|
38
38
|
this.id = misc?.id || (0, utils_2.generateID)(types_1.LayerType.Clear);
|
|
@@ -44,8 +44,8 @@ class ClearLayer {
|
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Sets the position of the layer in the 2D plane.
|
|
47
|
-
* @param
|
|
48
|
-
* @param
|
|
47
|
+
* @param {ScaleType} [x] - The x-coordinate of the layer.
|
|
48
|
+
* @param {ScaleType} [y] - The y-coordinate of the layer.
|
|
49
49
|
* @returns {this} The current instance for chaining.
|
|
50
50
|
*/
|
|
51
51
|
setPosition(x, y) {
|
|
@@ -55,8 +55,8 @@ class ClearLayer {
|
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
57
|
* Sets the size of the layer.
|
|
58
|
-
* @param
|
|
59
|
-
* @param
|
|
58
|
+
* @param {ScaleType} [width] - The width of the layer.
|
|
59
|
+
* @param {ScaleType} [height] - The height of the layer.
|
|
60
60
|
* @returns {this} The current instance for chaining.
|
|
61
61
|
*/
|
|
62
62
|
setSize(width, height) {
|
|
@@ -69,7 +69,7 @@ class ClearLayer {
|
|
|
69
69
|
/**
|
|
70
70
|
* Sets the unique identifier of the layer.
|
|
71
71
|
*
|
|
72
|
-
* @param {string} id - The unique identifier.
|
|
72
|
+
* @param {string} [id] - The unique identifier.
|
|
73
73
|
* @returns {this} The current instance for chaining.
|
|
74
74
|
*/
|
|
75
75
|
setID(id) {
|
|
@@ -78,7 +78,7 @@ class ClearLayer {
|
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
80
|
* Sets the centring type of the layer.
|
|
81
|
-
* @param
|
|
81
|
+
* @param {AnyCentring} [centring] - The centring type of the layer.
|
|
82
82
|
* @returns {this} The current instance for chaining.
|
|
83
83
|
*/
|
|
84
84
|
setCentring(centring) {
|
|
@@ -87,7 +87,7 @@ class ClearLayer {
|
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
89
|
* Sets the visibility of the layer.
|
|
90
|
-
* @param
|
|
90
|
+
* @param {boolean} [visible] - The visibility state of the layer.
|
|
91
91
|
* @returns {this} The current instance for chaining.
|
|
92
92
|
*/
|
|
93
93
|
setVisible(visible) {
|
|
@@ -96,7 +96,7 @@ class ClearLayer {
|
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
98
|
* Sets the z-index of the layer.
|
|
99
|
-
* @param
|
|
99
|
+
* @param {number} [zIndex] - The z-index value of the layer.
|
|
100
100
|
* @returns {this} The current instance for chaining.
|
|
101
101
|
*/
|
|
102
102
|
setZIndex(zIndex) {
|
|
@@ -105,10 +105,10 @@ class ClearLayer {
|
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
107
|
* Draws the Clear Layer on the canvas.
|
|
108
|
-
* @param
|
|
109
|
-
* @param
|
|
110
|
-
* @param
|
|
111
|
-
* @param
|
|
108
|
+
* @param {SKRSContext2D} [ctx] - The canvas rendering context.
|
|
109
|
+
* @param {Canvas | SvgCanvas} [canvas] - The canvas instance.
|
|
110
|
+
* @param {LayersManager} [manager] - The layers manager.
|
|
111
|
+
* @param {boolean} [debug] - Whether to enable debug logging.
|
|
112
112
|
*/
|
|
113
113
|
async draw(ctx, canvas, manager, debug) {
|
|
114
114
|
const parcer = (0, utils_1.parser)(ctx, canvas, manager);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnyGlobalCompositeOperation, AnyLayer, LayerType } from "../../types";
|
|
2
2
|
import { Canvas, SKRSContext2D, SvgCanvas } from "@napi-rs/canvas";
|
|
3
|
-
import { LayersManager } from "../managers
|
|
3
|
+
import { LayersManager } from "../managers";
|
|
4
4
|
/**
|
|
5
5
|
* Interface representing a group of layers.
|
|
6
6
|
*/
|
|
@@ -63,10 +63,9 @@ export declare class Group implements IGroup {
|
|
|
63
63
|
props?: IGroupProps;
|
|
64
64
|
/**
|
|
65
65
|
* Constructs a new Group instance.
|
|
66
|
-
* @param
|
|
67
|
-
* @param opts.
|
|
68
|
-
* @param opts.
|
|
69
|
-
* @param opts.zIndex {number} - The z-index of the group.
|
|
66
|
+
* @param {string} [opts.id] - The unique identifier of the group.
|
|
67
|
+
* @param {boolean} [opts.visible] - The visibility of the group.
|
|
68
|
+
* @param {number} [opts.zIndex] - The z-index of the group.
|
|
70
69
|
*/
|
|
71
70
|
constructor(opts?: {
|
|
72
71
|
id?: string;
|
|
@@ -75,31 +74,31 @@ export declare class Group implements IGroup {
|
|
|
75
74
|
});
|
|
76
75
|
/**
|
|
77
76
|
* Sets the ID of the group.
|
|
78
|
-
* @param
|
|
77
|
+
* @param {string} [id] - The unique identifier of the group.
|
|
79
78
|
* @returns {this} The current instance for chaining.
|
|
80
79
|
*/
|
|
81
80
|
setID(id: string): this;
|
|
82
81
|
/**
|
|
83
82
|
* Sets the visibility of the group.
|
|
84
|
-
* @param
|
|
83
|
+
* @param {boolean} [visible] - The visibility state of the group.
|
|
85
84
|
* @returns {this} The current instance for chaining.
|
|
86
85
|
*/
|
|
87
86
|
setVisible(visible: boolean): this;
|
|
88
87
|
/**
|
|
89
88
|
* Sets the z-index of the group.
|
|
90
|
-
* @param
|
|
89
|
+
* @param {number} [zIndex] - The z-index value of the group.
|
|
91
90
|
* @returns {this} The current instance for chaining.
|
|
92
91
|
*/
|
|
93
92
|
setZIndex(zIndex: number): this;
|
|
94
93
|
/**
|
|
95
94
|
* Adds components to the group.
|
|
96
|
-
* @param
|
|
95
|
+
* @param {AnyLayer[]} [components] - The components to add to the group.
|
|
97
96
|
* @returns {this} The current instance for chaining.
|
|
98
97
|
*/
|
|
99
98
|
add(...components: AnyLayer[]): this;
|
|
100
99
|
/**
|
|
101
100
|
* Removes a component from the group by its ID.
|
|
102
|
-
* @param
|
|
101
|
+
* @param {string} [id] - The unique identifier of the component to remove.
|
|
103
102
|
* @returns {this} The current instance for chaining.
|
|
104
103
|
*/
|
|
105
104
|
remove(id: string): this;
|
|
@@ -110,7 +109,7 @@ export declare class Group implements IGroup {
|
|
|
110
109
|
clear(): this;
|
|
111
110
|
/**
|
|
112
111
|
* Retrieves a component from the group by its ID.
|
|
113
|
-
* @param
|
|
112
|
+
* @param {string} [id] - The unique identifier of the component to retrieve.
|
|
114
113
|
* @returns {AnyLayer | undefined} The component with the specified ID, or undefined if not found.
|
|
115
114
|
*/
|
|
116
115
|
get(id: string): AnyLayer | undefined;
|
|
@@ -31,10 +31,9 @@ class Group {
|
|
|
31
31
|
props;
|
|
32
32
|
/**
|
|
33
33
|
* Constructs a new Group instance.
|
|
34
|
-
* @param
|
|
35
|
-
* @param opts.
|
|
36
|
-
* @param opts.
|
|
37
|
-
* @param opts.zIndex {number} - The z-index of the group.
|
|
34
|
+
* @param {string} [opts.id] - The unique identifier of the group.
|
|
35
|
+
* @param {boolean} [opts.visible] - The visibility of the group.
|
|
36
|
+
* @param {number} [opts.zIndex] - The z-index of the group.
|
|
38
37
|
*/
|
|
39
38
|
constructor(opts) {
|
|
40
39
|
this.id = opts?.id || (0, utils_1.generateID)(types_1.LayerType.Group);
|
|
@@ -45,7 +44,7 @@ class Group {
|
|
|
45
44
|
}
|
|
46
45
|
/**
|
|
47
46
|
* Sets the ID of the group.
|
|
48
|
-
* @param
|
|
47
|
+
* @param {string} [id] - The unique identifier of the group.
|
|
49
48
|
* @returns {this} The current instance for chaining.
|
|
50
49
|
*/
|
|
51
50
|
setID(id) {
|
|
@@ -54,7 +53,7 @@ class Group {
|
|
|
54
53
|
}
|
|
55
54
|
/**
|
|
56
55
|
* Sets the visibility of the group.
|
|
57
|
-
* @param
|
|
56
|
+
* @param {boolean} [visible] - The visibility state of the group.
|
|
58
57
|
* @returns {this} The current instance for chaining.
|
|
59
58
|
*/
|
|
60
59
|
setVisible(visible) {
|
|
@@ -63,7 +62,7 @@ class Group {
|
|
|
63
62
|
}
|
|
64
63
|
/**
|
|
65
64
|
* Sets the z-index of the group.
|
|
66
|
-
* @param
|
|
65
|
+
* @param {number} [zIndex] - The z-index value of the group.
|
|
67
66
|
* @returns {this} The current instance for chaining.
|
|
68
67
|
*/
|
|
69
68
|
setZIndex(zIndex) {
|
|
@@ -72,7 +71,7 @@ class Group {
|
|
|
72
71
|
}
|
|
73
72
|
/**
|
|
74
73
|
* Adds components to the group.
|
|
75
|
-
* @param
|
|
74
|
+
* @param {AnyLayer[]} [components] - The components to add to the group.
|
|
76
75
|
* @returns {this} The current instance for chaining.
|
|
77
76
|
*/
|
|
78
77
|
add(...components) {
|
|
@@ -84,7 +83,7 @@ class Group {
|
|
|
84
83
|
}
|
|
85
84
|
/**
|
|
86
85
|
* Removes a component from the group by its ID.
|
|
87
|
-
* @param
|
|
86
|
+
* @param {string} [id] - The unique identifier of the component to remove.
|
|
88
87
|
* @returns {this} The current instance for chaining.
|
|
89
88
|
*/
|
|
90
89
|
remove(id) {
|
|
@@ -101,7 +100,7 @@ class Group {
|
|
|
101
100
|
}
|
|
102
101
|
/**
|
|
103
102
|
* Retrieves a component from the group by its ID.
|
|
104
|
-
* @param
|
|
103
|
+
* @param {string} [id] - The unique identifier of the component to retrieve.
|
|
105
104
|
* @returns {AnyLayer | undefined} The component with the specified ID, or undefined if not found.
|
|
106
105
|
*/
|
|
107
106
|
get(id) {
|