Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release #1908

Merged
merged 2 commits into from
Feb 27, 2025
Merged

Release #1908

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ module.exports = {
'import/no-cycle': 'warn',
'import/no-duplicates': 'warn',
'class-methods-use-this': 'warn',
'no-console': ['warn', { allow: ['warn', 'error'] }],
'no-plusplus': [
'warn',
{
Expand Down
33 changes: 33 additions & 0 deletions __tests__/demos/bugfix/1906.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Canvas, Image as GImage } from '@antv/g';

/**
* @see https://github.com/antvis/G/pull/1906
*/
export async function issue_1906(context: { canvas: Canvas }) {
const { canvas } = context;
await canvas.ready;
canvas.context.config.enableLargeImageOptimization = true;

const img = new Image();
img.onload = () => {
console.log('onload', img.complete);

// remove && expect no error
requestAnimationFrame(() => {
image.remove();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable image is used before it is defined. This will lead to a runtime error. Consider defining image before using it in the requestAnimationFrame callback.

});
};

let image = new GImage({
style: {
x: 0,
y: 0,
src: img,
},
});

img.src =
'https://mdn.alipayobjects.com/huamei_fr7vu1/afts/img/A*SqloToP7R9QAAAAAAAAAAAAADkn0AQ/original';

canvas.appendChild(image);
}
1 change: 1 addition & 0 deletions __tests__/demos/bugfix/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export { test_pick } from './1747';
export { issue_1760 } from './1760';
export { issue_1176 } from './1176';
export { issue_1882 } from './1882';
export { issue_1906 } from './1906';
export { textWordWrap } from './textWordWrap';
export { group_with_stroke } from './group-with-stroke';
export { switchRenderer } from './switch-renderer';
9 changes: 9 additions & 0 deletions packages/g-canvas/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @antv/g-canvas

## 2.0.40

### Patch Changes

- Updated dependencies [cc62be4]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]

## 2.0.39

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-canvas/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-canvas",
"version": "2.0.39",
"version": "2.0.40",
"description": "A renderer implemented by Canvas 2D API",
"keywords": [
"antv",
Expand Down
9 changes: 9 additions & 0 deletions packages/g-canvaskit/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @antv/g-canvaskit

## 1.0.39

### Patch Changes

- Updated dependencies [cc62be4]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]

## 1.0.38

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-canvaskit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-canvaskit",
"version": "1.0.38",
"version": "1.0.39",
"description": "A renderer implemented by CanvasKit",
"keywords": [
"antv",
Expand Down
9 changes: 9 additions & 0 deletions packages/g-mobile-canvas/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @antv/g-mobile-canvas

## 1.0.37

### Patch Changes

- Updated dependencies [cc62be4]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]

## 1.0.36

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-mobile-canvas/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-mobile-canvas",
"version": "1.0.36",
"version": "1.0.37",
"description": "A renderer implemented with Canvas2D API in mobile environment",
"keywords": [
"antv",
Expand Down
8 changes: 8 additions & 0 deletions packages/g-mobile-webgl/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @antv/g-mobile-webgl

## 1.0.44

### Patch Changes

- Updated dependencies [cc62be4]
- @antv/[email protected]
- @antv/[email protected]

## 1.0.43

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-mobile-webgl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-mobile-webgl",
"version": "1.0.43",
"version": "1.0.44",
"description": "A renderer implemented by WebGL1/2 in mobile environment",
"keywords": [
"antv",
Expand Down
6 changes: 6 additions & 0 deletions packages/g-plugin-3d/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @antv/g-plugin-3d

## 2.0.42

### Patch Changes

- @antv/[email protected]

## 2.0.41

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-plugin-3d/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-plugin-3d",
"version": "2.0.41",
"version": "2.0.42",
"description": "Provide 3D extension for G",
"keywords": [
"antv",
Expand Down
7 changes: 7 additions & 0 deletions packages/g-plugin-canvas-picker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @antv/g-plugin-canvas-picker

## 2.1.19

### Patch Changes

- Updated dependencies [cc62be4]
- @antv/[email protected]

## 2.1.18

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-plugin-canvas-picker/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-plugin-canvas-picker",
"version": "2.1.18",
"version": "2.1.19",
"description": "A G plugin for picking in canvas",
"keywords": [
"antv",
Expand Down
8 changes: 8 additions & 0 deletions packages/g-plugin-canvas-renderer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @antv/g-plugin-canvas-renderer

## 2.2.19

### Patch Changes

- cc62be4: fix: image element rendering triggers an exception
- Updated dependencies [cc62be4]
- @antv/[email protected]

## 2.2.18

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-plugin-canvas-renderer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-plugin-canvas-renderer",
"version": "2.2.18",
"version": "2.2.19",
"description": "A G plugin of renderer implementation with Canvas2D API",
"keywords": [
"antv",
Expand Down
24 changes: 18 additions & 6 deletions packages/g-plugin-canvas-renderer/src/shapes/styles/Image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,19 @@ export class ImageRenderer extends DefaultRenderer {
if (!imageCache.downSampled) {
this.imagePool
.createDownSampledImage(src, object)
.then((res) => {
.then(() => {
// be removed from dom tree
if (!object.ownerDocument) {
return;
}

// rerender
// object.dirty();
object.renderable.dirty = true;
object.ownerDocument.defaultView.context.renderingService.dirtify();
})
.catch(() => {
//
.catch((reason) => {
console.error(reason);
});

return;
Expand Down Expand Up @@ -92,15 +97,20 @@ export class ImageRenderer extends DefaultRenderer {
src,
[],
() => {
// be removed from dom tree
if (!object.ownerDocument) {
return;
}

// rerender
// object.dirty();
object.renderable.dirty = true;
object.ownerDocument.defaultView.context.renderingService.dirtify();
},
object,
)
.catch(() => {
//
.catch((reason) => {
console.error(reason);
});

return;
Expand Down Expand Up @@ -244,7 +254,9 @@ export class ImageRenderer extends DefaultRenderer {
imageRect,
drawRect,
});
} catch {}
} catch {
// expected error

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Catching an empty block without handling or logging the error might lead to silent failures. Consider logging the error or handling it appropriately to avoid missing critical issues.

}
}

// ---
Expand Down
7 changes: 7 additions & 0 deletions packages/g-plugin-canvaskit-renderer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @antv/g-plugin-canvaskit-renderer

## 2.1.19

### Patch Changes

- Updated dependencies [cc62be4]
- @antv/[email protected]

## 2.1.18

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-plugin-canvaskit-renderer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-plugin-canvaskit-renderer",
"version": "2.1.18",
"version": "2.1.19",
"description": "A G plugin of renderer implementation with CanvasKit",
"keywords": [
"antv",
Expand Down
7 changes: 7 additions & 0 deletions packages/g-plugin-device-renderer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @antv/g-plugin-device-renderer

## 2.2.19

### Patch Changes

- Updated dependencies [cc62be4]
- @antv/[email protected]

## 2.2.18

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-plugin-device-renderer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-plugin-device-renderer",
"version": "2.2.18",
"version": "2.2.19",
"description": "A G plugin of renderer implementation with GPUDevice",
"keywords": [
"antv",
Expand Down
6 changes: 6 additions & 0 deletions packages/g-plugin-image-loader/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @antv/g-plugin-image-loader

## 2.1.19

### Patch Changes

- cc62be4: fix: image element rendering triggers an exception

## 2.1.18

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-plugin-image-loader/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-plugin-image-loader",
"version": "2.1.18",
"version": "2.1.19",
"description": "A G plugin for loading image",
"keywords": [
"antv",
Expand Down
4 changes: 2 additions & 2 deletions packages/g-plugin-image-loader/src/ImagePool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ export class ImagePool {
.then((cache) => {
callback?.(cache);
})
.catch(() => {
//
.catch((reason) => {
console.error(reason);
});

return null;
Expand Down
6 changes: 6 additions & 0 deletions packages/g-plugin-rough-canvas-renderer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @antv/g-plugin-rough-canvas-renderer

## 2.0.40

### Patch Changes

- @antv/[email protected]

## 2.0.39

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-plugin-rough-canvas-renderer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-plugin-rough-canvas-renderer",
"version": "2.0.39",
"version": "2.0.40",
"description": "A G plugin of renderer implementation with rough.js",
"keywords": [
"antv",
Expand Down
6 changes: 6 additions & 0 deletions packages/g-plugin-zdog-canvas-renderer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @antv/g-plugin-zdog-canvas-renderer

## 2.0.39

### Patch Changes

- @antv/[email protected]

## 2.0.38

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-plugin-zdog-canvas-renderer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-plugin-zdog-canvas-renderer",
"version": "2.0.38",
"version": "2.0.39",
"description": "A G plugin of renderer implementation with Zdog",
"keywords": [
"antv",
Expand Down
7 changes: 7 additions & 0 deletions packages/g-web-components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @antv/g-web-components

## 2.0.46

### Patch Changes

- @antv/[email protected]
- @antv/[email protected]

## 2.0.45

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-web-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-web-components",
"version": "2.0.45",
"version": "2.0.46",
"description": "A declarative usage for G implemented with WebComponents",
"keywords": [
"antv",
Expand Down
Loading
Loading