Skip to content

Commit 6369e6e

Browse files
wang1212Alexzjtgemini-code-assist[bot]github-actions[bot]
authored
Release (#1979)
* fix: prevent NaN in transform calculations when scale is 0 (#1971) * fix: prevent NaN in transform calculations when scale is 0 - Add MIN_SCALE constant to avoid zero scaling - Update scale transform functions to enforce minimum scale value - Add test case for scale(0) transform - Add demo example with scale(0) transform * chore: add changeset * refactor: extract scale clamping logic into reusable function - Add clampScale helper function to avoid code duplication - Replace repeated Math.max(item, MIN_SCALE) calls with clampScale - Maintain same behavior while improving code maintainability * chore: add changeset * perf: use charWidthCache to improve performance by 1.5% (#1978) * perf: 避免重复dirty父级元素提升2%性能 * perf: accept gemini review Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * refactor: 修复eslint * perf: use charWidthCache to improve performance by 1.5% * refactor: 修复评审意见 * refactor: 修复评审意见 * refactor: 使用LRU * refactor: 使用LRU * chore: add changeset --------- Co-authored-by: huiyu.zjt <huiyu.zjt@antgroup.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: wang1212 <mrwang1212@126.com> * revert: fix element attribute update exception #1968 * chore(release): bump version (#1977) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: huiyu.zjt <Alexzjt@users.noreply.github.com> Co-authored-by: huiyu.zjt <huiyu.zjt@antgroup.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 433cc43 commit 6369e6e

102 files changed

Lines changed: 744 additions & 91 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

__tests__/demos/2d/transform.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ export async function transform(context) {
44
const { canvas } = context;
55
await canvas.ready;
66

7+
const circle0 = new Circle({
8+
style: {
9+
cx: 50,
10+
cy: 50,
11+
r: 20,
12+
fill: 'blue',
13+
transform: 'scale(0)',
14+
},
15+
});
16+
canvas.appendChild(circle0);
17+
718
const circle1 = new Circle({
819
style: {
920
cx: 100,

__tests__/unit/css/properties/transform.spec.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,31 @@ describe('CSSPropertyTransform', () => {
233233
expect(circle.getLocalBounds().halfExtents).toStrictEqual([25, 25, 0]);
234234
});
235235

236+
it('should handle scale(0) transform correctly without returning NaN in bounds', async () => {
237+
const circle = new Circle({
238+
style: {
239+
cx: 10,
240+
cy: 10,
241+
r: 50,
242+
transform: 'scale(0)',
243+
},
244+
});
245+
246+
await canvas.ready;
247+
canvas.appendChild(circle);
248+
249+
const bounds = circle.getBounds();
250+
expect(bounds).toBeDefined();
251+
252+
expect(bounds.center.every(Number.isFinite)).toBeTruthy();
253+
expect(bounds.halfExtents.every(Number.isFinite)).toBeTruthy();
254+
expect(bounds.min.every(Number.isFinite)).toBeTruthy();
255+
expect(bounds.max.every(Number.isFinite)).toBeTruthy();
256+
257+
expect(bounds.center).toStrictEqual([10, 10, 0]);
258+
// expect(bounds.halfExtents).toStrictEqual([0, 0, 0]);
259+
});
260+
236261
it("should reset transform with 'none' keyword correctly.", async () => {
237262
const circle = new Circle({
238263
style: {

packages/g-camera-api/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# @antv/g-camera-api
22

3+
## 2.0.41
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [22e4e7b]
8+
- Updated dependencies [ffe2611]
9+
- Updated dependencies [4fb9eaa]
10+
- @antv/g-lite@2.3.2
11+
312
## 2.0.40
413

514
### Patch Changes

packages/g-camera-api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@antv/g-camera-api",
3-
"version": "2.0.40",
3+
"version": "2.0.41",
44
"description": "A simple implementation of Camera API.",
55
"keywords": [
66
"antv",

packages/g-canvas/CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# @antv/g-canvas
22

3+
## 2.0.48
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [22e4e7b]
8+
- Updated dependencies [ffe2611]
9+
- Updated dependencies [4fb9eaa]
10+
- @antv/g-lite@2.3.2
11+
- @antv/g-plugin-canvas-path-generator@2.1.22
12+
- @antv/g-plugin-canvas-picker@2.1.27
13+
- @antv/g-plugin-canvas-renderer@2.3.3
14+
- @antv/g-plugin-dom-interaction@2.1.27
15+
- @antv/g-plugin-html-renderer@2.1.27
16+
- @antv/g-plugin-image-loader@2.1.26
17+
318
## 2.0.47
419

520
### Patch Changes

packages/g-canvas/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@antv/g-canvas",
3-
"version": "2.0.47",
3+
"version": "2.0.48",
44
"description": "A renderer implemented by Canvas 2D API",
55
"keywords": [
66
"antv",

packages/g-canvaskit/CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# @antv/g-canvaskit
22

3+
## 1.0.47
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [22e4e7b]
8+
- Updated dependencies [ffe2611]
9+
- Updated dependencies [4fb9eaa]
10+
- @antv/g-lite@2.3.2
11+
- @antv/g-plugin-canvas-path-generator@2.1.22
12+
- @antv/g-plugin-canvas-picker@2.1.27
13+
- @antv/g-plugin-canvaskit-renderer@2.1.26
14+
- @antv/g-plugin-dom-interaction@2.1.27
15+
- @antv/g-plugin-html-renderer@2.1.27
16+
- @antv/g-plugin-image-loader@2.1.26
17+
318
## 1.0.46
419

520
### Patch Changes

packages/g-canvaskit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@antv/g-canvaskit",
3-
"version": "1.0.46",
3+
"version": "1.0.47",
44
"description": "A renderer implemented by CanvasKit",
55
"keywords": [
66
"antv",

packages/g-components/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# @antv/g-components
22

3+
## 2.0.38
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [22e4e7b]
8+
- Updated dependencies [ffe2611]
9+
- Updated dependencies [4fb9eaa]
10+
- @antv/g-lite@2.3.2
11+
312
## 2.0.37
413

514
### Patch Changes

packages/g-components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@antv/g-components",
3-
"version": "2.0.37",
3+
"version": "2.0.38",
44
"description": "Components for g",
55
"keywords": [
66
"antv",

0 commit comments

Comments
 (0)