@galacean/effects-core 2.3.0-alpha.0 → 2.3.0-alpha.2
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/components/base-render-component.d.ts +2 -0
- package/dist/components/shape-component.d.ts +92 -5
- package/dist/fallback/migration.d.ts +1 -1
- package/dist/index.js +511 -413
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +511 -413
- package/dist/index.mjs.map +1 -1
- package/dist/plugins/shape/build-line.d.ts +6 -4
- package/dist/plugins/shape/graphics-path.d.ts +1 -1
- package/dist/plugins/shape/polygon.d.ts +4 -0
- package/dist/plugins/shape/rectangle.d.ts +21 -88
- package/dist/plugins/shape/shape-path.d.ts +1 -1
- package/dist/plugins/text/text-item.d.ts +15 -0
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { Color } from '@galacean/effects-math/es/core/color';
|
|
2
|
+
import * as spec from '@galacean/effects-specification';
|
|
3
3
|
export declare const closePointEps = 0.0001;
|
|
4
4
|
export declare const curveEps = 0.0001;
|
|
5
5
|
/**
|
|
@@ -11,11 +11,13 @@ export interface StrokeAttributes {
|
|
|
11
11
|
/** The alignment of the stroke. */
|
|
12
12
|
alignment: number;
|
|
13
13
|
/** The line cap style to use. */
|
|
14
|
-
cap: LineCap;
|
|
14
|
+
cap: spec.LineCap;
|
|
15
15
|
/** The line join style to use. */
|
|
16
|
-
join: LineJoin;
|
|
16
|
+
join: spec.LineJoin;
|
|
17
17
|
/** The miter limit to use. */
|
|
18
18
|
miterLimit: number;
|
|
19
|
+
/** Stroke color */
|
|
20
|
+
color: Color;
|
|
19
21
|
}
|
|
20
22
|
/**
|
|
21
23
|
* Builds a line to draw using the polygon method.
|
|
@@ -51,7 +51,7 @@ export declare class GraphicsPath {
|
|
|
51
51
|
* @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
|
|
52
52
|
* @returns The instance of the current object for chaining.
|
|
53
53
|
*/
|
|
54
|
-
rect(x: number, y: number, w: number, h: number, transform?: Matrix4): this;
|
|
54
|
+
rect(x: number, y: number, w: number, h: number, roundness: number, transform?: Matrix4): this;
|
|
55
55
|
polyStar(pointCount: number, outerRadius: number, innerRadius: number, outerRoundness: number, innerRoundness: number, starType: StarType, transform?: Matrix4): this;
|
|
56
56
|
clear(): GraphicsPath;
|
|
57
57
|
}
|
|
@@ -60,4 +60,8 @@ export declare class Polygon extends ShapePrimitive {
|
|
|
60
60
|
getY(): number;
|
|
61
61
|
build(points: number[]): void;
|
|
62
62
|
triangulate(points: number[], vertices: number[], verticesOffset: number, indices: number[], indicesOffset: number): void;
|
|
63
|
+
/**
|
|
64
|
+
* 获取直线上最远的两个端点坐标组成的三角形
|
|
65
|
+
*/
|
|
66
|
+
private getLineEndPointsTriangle;
|
|
63
67
|
}
|
|
@@ -1,129 +1,62 @@
|
|
|
1
1
|
import { ShapePrimitive } from './shape-primitive';
|
|
2
2
|
/**
|
|
3
|
-
* The `Rectangle` object is an area defined by its position, as indicated by its
|
|
4
|
-
* point (`x`, `y`) and by its `width` and its `height
|
|
3
|
+
* The `Rectangle` object is an area defined by its position, as indicated by its top-left corner
|
|
4
|
+
* point (`x`, `y`) and by its `width` and its `height`, including a `roundness` property that
|
|
5
|
+
* defines the roundness of the rounded corners.
|
|
6
|
+
* @memberof maths
|
|
5
7
|
*/
|
|
6
8
|
export declare class Rectangle extends ShapePrimitive {
|
|
7
9
|
/**
|
|
8
10
|
* The X coordinate of the upper-left corner of the rectangle
|
|
9
|
-
* @default 0
|
|
10
11
|
*/
|
|
11
12
|
x: number;
|
|
12
13
|
/**
|
|
13
14
|
* The Y coordinate of the upper-left corner of the rectangle
|
|
14
|
-
* @default 0
|
|
15
15
|
*/
|
|
16
16
|
y: number;
|
|
17
17
|
/**
|
|
18
18
|
* The overall width of this rectangle
|
|
19
|
-
* @default 0
|
|
20
19
|
*/
|
|
21
20
|
width: number;
|
|
22
21
|
/**
|
|
23
22
|
* The overall height of this rectangle
|
|
24
|
-
* @default 0
|
|
25
23
|
*/
|
|
26
24
|
height: number;
|
|
25
|
+
/**
|
|
26
|
+
* Controls the roundness of the rounded corners
|
|
27
|
+
*/
|
|
28
|
+
roundness: number;
|
|
27
29
|
/**
|
|
28
30
|
* @param x - The X coordinate of the upper-left corner of the rectangle
|
|
29
31
|
* @param y - The Y coordinate of the upper-left corner of the rectangle
|
|
30
|
-
* @param width - The overall width of
|
|
31
|
-
* @param height - The overall height of
|
|
32
|
+
* @param width - The overall width of this rectangle
|
|
33
|
+
* @param height - The overall height of this rectangle
|
|
34
|
+
* @param roundness - Controls the roundness of the rounded corners
|
|
32
35
|
*/
|
|
33
|
-
constructor(x?:
|
|
34
|
-
/** Returns the left edge of the rectangle. */
|
|
35
|
-
get left(): number;
|
|
36
|
-
/** Returns the right edge of the rectangle. */
|
|
37
|
-
get right(): number;
|
|
38
|
-
/** Returns the top edge of the rectangle. */
|
|
39
|
-
get top(): number;
|
|
40
|
-
/** Returns the bottom edge of the rectangle. */
|
|
41
|
-
get bottom(): number;
|
|
42
|
-
/** Determines whether the Rectangle is empty. */
|
|
43
|
-
isEmpty(): boolean;
|
|
44
|
-
/** A constant empty rectangle. This is a new object every time the property is accessed */
|
|
45
|
-
static get EMPTY(): Rectangle;
|
|
36
|
+
constructor(x?: number, y?: number, width?: number, height?: number, roundness?: number);
|
|
46
37
|
/**
|
|
47
|
-
*
|
|
48
|
-
* @
|
|
38
|
+
* Returns the framing rectangle of the rectangle as a Rectangle object
|
|
39
|
+
* @param out - optional rectangle to store the result
|
|
40
|
+
* @returns The framing rectangle
|
|
49
41
|
*/
|
|
50
|
-
|
|
42
|
+
getBounds(out?: Rectangle): Rectangle;
|
|
51
43
|
/**
|
|
52
|
-
*
|
|
53
|
-
* @
|
|
54
|
-
* @returns Returns itself.
|
|
44
|
+
* Creates a clone of this rectangle.
|
|
45
|
+
* @returns - A copy of the rectangle.
|
|
55
46
|
*/
|
|
47
|
+
clone(): Rectangle;
|
|
56
48
|
/**
|
|
57
49
|
* Copies another rectangle to this one.
|
|
58
50
|
* @param rectangle - The rectangle to copy from.
|
|
59
51
|
* @returns Returns itself.
|
|
60
52
|
*/
|
|
61
|
-
copyFrom(rectangle: Rectangle):
|
|
53
|
+
copyFrom(rectangle: Rectangle): this;
|
|
62
54
|
/**
|
|
63
55
|
* Copies this rectangle to another one.
|
|
64
56
|
* @param rectangle - The rectangle to copy to.
|
|
65
57
|
* @returns Returns given parameter.
|
|
66
58
|
*/
|
|
67
59
|
copyTo(rectangle: Rectangle): Rectangle;
|
|
68
|
-
|
|
69
|
-
* Checks whether the x and y coordinates given are contained within this Rectangle
|
|
70
|
-
* @param x - The X coordinate of the point to test
|
|
71
|
-
* @param y - The Y coordinate of the point to test
|
|
72
|
-
* @returns Whether the x/y coordinates are within this Rectangle
|
|
73
|
-
*/
|
|
74
|
-
contains(x: number, y: number): boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Checks whether the x and y coordinates given are contained within this rectangle including the stroke.
|
|
77
|
-
* @param x - The X coordinate of the point to test
|
|
78
|
-
* @param y - The Y coordinate of the point to test
|
|
79
|
-
* @param strokeWidth - The width of the line to check
|
|
80
|
-
* @returns Whether the x/y coordinates are within this rectangle
|
|
81
|
-
*/
|
|
82
|
-
strokeContains(x: number, y: number, strokeWidth: number): boolean;
|
|
83
|
-
/**
|
|
84
|
-
* Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.
|
|
85
|
-
* Returns true only if the area of the intersection is >0, this means that Rectangles
|
|
86
|
-
* sharing a side are not overlapping. Another side effect is that an arealess rectangle
|
|
87
|
-
* (width or height equal to zero) can't intersect any other rectangle.
|
|
88
|
-
* @param {Rectangle} other - The Rectangle to intersect with `this`.
|
|
89
|
-
* @param {Matrix} transform - The transformation matrix of `other`.
|
|
90
|
-
* @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.
|
|
91
|
-
*/
|
|
92
|
-
/**
|
|
93
|
-
* Pads the rectangle making it grow in all directions.
|
|
94
|
-
* If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
|
|
95
|
-
* @param paddingX - The horizontal padding amount.
|
|
96
|
-
* @param paddingY - The vertical padding amount.
|
|
97
|
-
* @returns Returns itself.
|
|
98
|
-
*/
|
|
99
|
-
pad(paddingX?: number, paddingY?: number): this;
|
|
100
|
-
/**
|
|
101
|
-
* Fits this rectangle around the passed one.
|
|
102
|
-
* @param rectangle - The rectangle to fit.
|
|
103
|
-
* @returns Returns itself.
|
|
104
|
-
*/
|
|
105
|
-
fit(rectangle: Rectangle): this;
|
|
106
|
-
/**
|
|
107
|
-
* Enlarges rectangle that way its corners lie on grid
|
|
108
|
-
* @param resolution - resolution
|
|
109
|
-
* @param eps - precision
|
|
110
|
-
* @returns Returns itself.
|
|
111
|
-
*/
|
|
112
|
-
ceil(resolution?: number, eps?: number): this;
|
|
113
|
-
/**
|
|
114
|
-
* Enlarges this rectangle to include the passed rectangle.
|
|
115
|
-
* @param rectangle - The rectangle to include.
|
|
116
|
-
* @returns Returns itself.
|
|
117
|
-
*/
|
|
118
|
-
enlarge(rectangle: Rectangle): this;
|
|
119
|
-
/**
|
|
120
|
-
* Returns the framing rectangle of the rectangle as a Rectangle object
|
|
121
|
-
* @param out - optional rectangle to store the result
|
|
122
|
-
* @returns The framing rectangle
|
|
123
|
-
*/
|
|
124
|
-
getBounds(out?: Rectangle): Rectangle;
|
|
125
|
-
getX(): number;
|
|
126
|
-
getY(): number;
|
|
127
|
-
build(points: number[]): number[];
|
|
60
|
+
build(points: number[]): void;
|
|
128
61
|
triangulate(points: number[], vertices: number[], verticesOffset: number, indices: number[], indicesOffset: number): void;
|
|
129
62
|
}
|
|
@@ -49,7 +49,7 @@ export declare class ShapePath {
|
|
|
49
49
|
* @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
|
|
50
50
|
* @returns The instance of the current object for chaining.
|
|
51
51
|
*/
|
|
52
|
-
rect(x: number, y: number, w: number, h: number, transform?: Matrix4): this;
|
|
52
|
+
rect(x: number, y: number, w: number, h: number, roundness: number, transform?: Matrix4): this;
|
|
53
53
|
/**
|
|
54
54
|
* Draws a given shape on the canvas.
|
|
55
55
|
* This is a generic method that can draw any type of shape specified by the `ShapePrimitive` parameter.
|
|
@@ -29,6 +29,10 @@ export declare class TextComponent extends BaseRenderComponent {
|
|
|
29
29
|
* 文本行数
|
|
30
30
|
*/
|
|
31
31
|
lineCount: number;
|
|
32
|
+
/**
|
|
33
|
+
* 每一行文本的最大宽度
|
|
34
|
+
*/
|
|
35
|
+
protected maxLineWidth: number;
|
|
32
36
|
protected readonly SCALE_FACTOR = 0.1;
|
|
33
37
|
protected readonly ALPHA_FIX_VALUE: number;
|
|
34
38
|
constructor(engine: Engine, props?: TextItemProps);
|
|
@@ -51,6 +55,7 @@ export declare class TextComponentBase {
|
|
|
51
55
|
item: VFXItem;
|
|
52
56
|
renderer: ItemRenderer;
|
|
53
57
|
/***** mix 类型兼容用 *****/
|
|
58
|
+
protected maxLineWidth: number;
|
|
54
59
|
private char;
|
|
55
60
|
updateWithOptions(options: spec.TextContentOptions): void;
|
|
56
61
|
private getLineCount;
|
|
@@ -120,6 +125,16 @@ export declare class TextComponentBase {
|
|
|
120
125
|
* @returns
|
|
121
126
|
*/
|
|
122
127
|
setShadowBlur(value: number): void;
|
|
128
|
+
/**
|
|
129
|
+
* 设置文本溢出模式
|
|
130
|
+
*
|
|
131
|
+
* - clip: 当文本内容超出边界框时,多余的会被截断。
|
|
132
|
+
* - display: 该模式下会显示所有文本,会自动调整文本字号以保证显示完整。
|
|
133
|
+
* > 当存在多行时,部分行内文本可能存在文本字号变小的情况,其他行为正常情况
|
|
134
|
+
*
|
|
135
|
+
* @param overflow - 文本溢出模式
|
|
136
|
+
*/
|
|
137
|
+
setOverflow(overflow: spec.TextOverflow): void;
|
|
123
138
|
/**
|
|
124
139
|
* 设置阴影颜色
|
|
125
140
|
* @param value - 阴影颜色
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/effects-core",
|
|
3
|
-
"version": "2.3.0-alpha.
|
|
3
|
+
"version": "2.3.0-alpha.2",
|
|
4
4
|
"description": "Galacean Effects runtime core for the web",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"registry": "https://registry.npmjs.org"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@galacean/effects-specification": "2.2.0-alpha.
|
|
45
|
+
"@galacean/effects-specification": "2.2.0-alpha.4",
|
|
46
46
|
"@galacean/effects-math": "1.1.0",
|
|
47
47
|
"flatbuffers": "24.3.25",
|
|
48
48
|
"uuid": "9.0.1",
|