Skip to content

Commit d25b954

Browse files
authored
Merge branch 'release' into perf/pick
2 parents edad17f + 6a7c5bc commit d25b954

File tree

14 files changed

+783
-4
lines changed

14 files changed

+783
-4
lines changed

.changeset/public-shoes-bathe.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@antv/g-plugin-canvaskit-renderer': minor
3+
'@antv/g-plugin-canvas-renderer': minor
4+
'@antv/g-plugin-device-renderer': minor
5+
'@antv/g-plugin-html-renderer': minor
6+
'@antv/g-plugin-image-loader': minor
7+
'@antv/g-plugin-svg-renderer': minor
8+
'@antv/g-plugin-a11y': minor
9+
'@antv/g-plugin-yoga': minor
10+
'@antv/g-lite': minor
11+
---
12+
13+
perf: element event batch triggering

.changeset/slimy-sites-jam.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@antv/g-plugin-canvas-renderer': minor
3+
'@antv/g-plugin-svg-renderer': minor
4+
'@antv/g-lite': minor
5+
---
6+
7+
feat(text): add text-decoration support for text elements

__tests__/demos/2d/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export { polyline } from './polyline';
88
export { polygon } from './polygon';
99
export { path } from './path';
1010
export { text } from './text';
11+
export { textDecoration } from './text-decoration';
1112
export { gradient } from './gradient';
1213
export { transform } from './transform';
1314
export { transformText } from './transform-text';
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
import { Text } from '@antv/g';
2+
3+
export async function textDecoration(context) {
4+
const { canvas } = context;
5+
await canvas.ready;
6+
7+
// Test underline
8+
const text1 = new Text({
9+
style: {
10+
x: 50,
11+
y: 50,
12+
text: 'Underline Text',
13+
fontSize: 20,
14+
fill: 'black',
15+
textDecorationLine: 'underline',
16+
textDecorationColor: 'red',
17+
textDecorationStyle: 'solid',
18+
},
19+
});
20+
canvas.appendChild(text1);
21+
22+
// Test overline
23+
const text2 = new Text({
24+
style: {
25+
x: 50,
26+
y: 100,
27+
text: 'Overline Text',
28+
fontSize: 20,
29+
fill: 'black',
30+
textDecorationLine: 'overline',
31+
textDecorationColor: 'blue',
32+
textDecorationStyle: 'solid',
33+
},
34+
});
35+
canvas.appendChild(text2);
36+
37+
// Test line-through
38+
const text3 = new Text({
39+
style: {
40+
x: 50,
41+
y: 150,
42+
text: 'Line-through Text',
43+
fontSize: 20,
44+
fill: 'black',
45+
textDecorationLine: 'line-through',
46+
textDecorationColor: 'green',
47+
textDecorationStyle: 'solid',
48+
},
49+
});
50+
canvas.appendChild(text3);
51+
52+
// Test multiple decorations
53+
const text4 = new Text({
54+
style: {
55+
x: 50,
56+
y: 200,
57+
text: 'Underline and Overline',
58+
fontSize: 20,
59+
fill: 'black',
60+
textDecorationLine: 'underline overline',
61+
textDecorationColor: 'purple',
62+
textDecorationStyle: 'solid',
63+
},
64+
});
65+
canvas.appendChild(text4);
66+
67+
// Test dashed underline
68+
const text5 = new Text({
69+
style: {
70+
x: 50,
71+
y: 250,
72+
text: 'Dashed Underline',
73+
fontSize: 20,
74+
fill: 'black',
75+
textDecorationLine: 'underline',
76+
textDecorationColor: 'orange',
77+
textDecorationStyle: 'dashed',
78+
},
79+
});
80+
canvas.appendChild(text5);
81+
82+
// Test dotted underline
83+
const text6 = new Text({
84+
style: {
85+
x: 50,
86+
y: 300,
87+
text: 'Dotted Underline',
88+
fontSize: 20,
89+
fill: 'black',
90+
textDecorationLine: 'underline',
91+
textDecorationColor: 'brown',
92+
textDecorationStyle: 'dotted',
93+
},
94+
});
95+
canvas.appendChild(text6);
96+
97+
// Test wavy underline
98+
const text7 = new Text({
99+
style: {
100+
x: 50,
101+
y: 350,
102+
text: 'Wavy Underline',
103+
fontSize: 20,
104+
fill: 'black',
105+
textDecorationLine: 'underline',
106+
textDecorationColor: 'pink',
107+
textDecorationStyle: 'wavy',
108+
},
109+
});
110+
canvas.appendChild(text7);
111+
112+
// Test none (should remove any decoration)
113+
const text8 = new Text({
114+
style: {
115+
x: 50,
116+
y: 400,
117+
text: 'No Decoration',
118+
fontSize: 20,
119+
fill: 'black',
120+
textDecorationLine: 'none',
121+
},
122+
});
123+
canvas.appendChild(text8);
124+
125+
// Test textDecorationThickness
126+
const text9 = new Text({
127+
style: {
128+
x: 50,
129+
y: 450,
130+
text: 'Thick Underline',
131+
fontSize: 20,
132+
fill: 'black',
133+
textDecorationLine: 'underline',
134+
textDecorationColor: 'red',
135+
textDecorationStyle: 'solid',
136+
textDecorationThickness: 3,
137+
},
138+
});
139+
canvas.appendChild(text9);
140+
141+
// Test textDecorationThickness with dashed style
142+
const text10 = new Text({
143+
style: {
144+
x: 50,
145+
y: 500,
146+
text: 'Thick Dashed',
147+
fontSize: 20,
148+
fill: 'black',
149+
textDecorationLine: 'underline',
150+
textDecorationColor: 'blue',
151+
textDecorationStyle: 'dashed',
152+
textDecorationThickness: 4,
153+
},
154+
});
155+
canvas.appendChild(text10);
156+
}

__tests__/demos/perf/custom-event.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export async function customEvent(context: { canvas: Canvas; gui: lil.GUI }) {
1616
const { width, height } = canvas.getConfig();
1717
const root = new Group();
1818
let count = 1e4;
19-
let rects = [];
19+
let rects: { x: number; y: number; size: number; el: Rect }[] = [];
2020

2121
// Shared event instance
2222
const sharedEvent = new CustomEvent(ElementEvent.BOUNDS_CHANGED);
9 Bytes
Loading

0 commit comments

Comments
 (0)