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 #1759

Merged
merged 4 commits into from
Aug 22, 2024
Merged

Release #1759

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
7 changes: 7 additions & 0 deletions packages/g-mobile-webgl/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @antv/g-mobile-webgl

## 1.0.15

### Patch Changes

- Updated dependencies [3fb2553d]
- @antv/g-plugin-device-renderer@2.0.13

## 1.0.14

### 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.14",
"version": "1.0.15",
"description": "A renderer implemented by WebGL1/2 in mobile environment",
"keywords": [
"antv",
Expand Down
7 changes: 7 additions & 0 deletions packages/g-plugin-3d/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @antv/g-plugin-3d

## 2.0.13

### Patch Changes

- Updated dependencies [3fb2553d]
- @antv/g-plugin-device-renderer@2.0.13

## 2.0.12

### 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.12",
"version": "2.0.13",
"description": "Provide 3D extension for G",
"keywords": [
"antv",
Expand Down
6 changes: 6 additions & 0 deletions packages/g-plugin-device-renderer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @antv/g-plugin-device-renderer

## 2.0.13

### Patch Changes

- 3fb2553d: fix: the logic boundary condition judgment of text element attribute update is missing (#1755)

## 2.0.12

### 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.0.12",
"version": "2.0.13",
"description": "A G plugin of renderer implementation with GPUDevice",
"keywords": [
"antv",
Expand Down
5 changes: 5 additions & 0 deletions packages/g-plugin-device-renderer/src/drawcalls/Text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,11 @@ export class TextDrawcall extends Instanced {
name: string,
value: any,
): void {
// fix https://github.com/antvis/G/issues/1755
if (objects.length === 0) {
return;
}

if (
name === 'text' ||
name === 'fontFamily' ||
Expand Down
6 changes: 6 additions & 0 deletions packages/g-web-components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @antv/g-web-components

## 2.0.16

### Patch Changes

- @antv/g-webgl@2.0.15

## 2.0.15

### 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.15",
"version": "2.0.16",
"description": "A declarative usage for G implemented with WebComponents",
"keywords": [
"antv",
Expand Down
7 changes: 7 additions & 0 deletions packages/g-webgl/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @antv/g-webgl

## 2.0.15

### Patch Changes

- Updated dependencies [3fb2553d]
- @antv/g-plugin-device-renderer@2.0.13

## 2.0.14

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-webgl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-webgl",
"version": "2.0.14",
"version": "2.0.15",
"description": "A renderer implemented by WebGL1/2",
"keywords": [
"antv",
Expand Down
7 changes: 7 additions & 0 deletions packages/g-webgpu/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @antv/g-webgpu

## 2.0.15

### Patch Changes

- Updated dependencies [3fb2553d]
- @antv/g-plugin-device-renderer@2.0.13

## 2.0.14

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-webgpu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-webgpu",
"version": "2.0.14",
"version": "2.0.15",
"description": "A renderer implemented by WebGPU",
"keywords": [
"antv",
Expand Down
6 changes: 6 additions & 0 deletions packages/react-g/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @antv/react-g

## 2.0.13

### Patch Changes

- 950db94d: fix: react-g rerender (#1757)

## 2.0.12

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/react-g/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/react-g",
"version": "2.0.12",
"version": "2.0.13",
"description": "react render for @antv/g",
"keywords": [
"react",
Expand Down
8 changes: 4 additions & 4 deletions packages/react-g/src/canvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { CanvasConfig } from '@antv/g';
import { Canvas as GCanvas } from '@antv/g';
import React, { forwardRef, useLayoutEffect, useRef } from 'react';
import type { FiberRoot } from 'react-reconciler';
import { reconcilor } from './reconciler';
import { reconciler } from './reconciler';
import { assertRef } from './util';

export interface CanvasProps extends CanvasConfig {
Expand Down Expand Up @@ -52,7 +52,7 @@ export const Canvas = forwardRef<GCanvas, CanvasProps>(
canvasRef.current = canvas;

// @ts-ignore
container.current = reconcilor.createContainer(
container.current = reconciler.createContainer(
canvas as any,
1,
false,
Expand All @@ -61,14 +61,14 @@ export const Canvas = forwardRef<GCanvas, CanvasProps>(

return () => {
// @ts-ignore
reconcilor.updateContainer(null, container.current, null);
reconciler.updateContainer(null, container.current, null);
};
}, []);

useLayoutEffect(() => {
if (container.current) {
// @ts-ignore
reconcilor.updateContainer(children, container.current, null);
reconciler.updateContainer(children, container.current, null);
}
}, [children]);

Expand Down
16 changes: 10 additions & 6 deletions packages/react-g/src/reconciler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Canvas, Element } from '@antv/g';
import React from 'react';
import type { OpaqueHandle } from 'react-reconciler';
import type { OpaqueHandle, OpaqueRoot } from 'react-reconciler';
import ReactReconciler from 'react-reconciler';
import { unstable_now as now } from 'scheduler';
import { bindShapeEvent, updateProps } from './processProps';
Expand All @@ -20,7 +20,7 @@ import type {
UpdatePayload,
} from './types';

export const reconcilor = ReactReconciler<
export const reconciler = ReactReconciler<
Type,
Props,
Container,
Expand Down Expand Up @@ -346,7 +346,7 @@ export const reconcilor = ReactReconciler<
): void {},
});

reconcilor.injectIntoDevTools({
reconciler.injectIntoDevTools({
// findFiberByHostInstance: () => {},
// @ts-ignore
bundleType: process.env.NODE_ENV !== 'production' ? 1 : 0,
Expand All @@ -359,6 +359,8 @@ reconcilor.injectIntoDevTools({
},
});

const TargetContainerWeakMap = new WeakMap<Element | Canvas, OpaqueRoot>();

/**
* render react-g component to target g element
* 将react-g组件渲染到任意的g实例(Canvas/Group/Shape)中
Expand All @@ -372,7 +374,9 @@ export const render = (
target: Element | Canvas,
callback?: (() => void) | null,
) => {
// @ts-ignore
const container = reconcilor.createContainer(target as any, 1, false, null);
reconcilor.updateContainer(component, container, null, callback);
const container =
TargetContainerWeakMap.get(target) ||
reconciler.createContainer(target as any, 1, false, null);
TargetContainerWeakMap.set(target, container);
reconciler.updateContainer(component, container, null, callback);
};
2 changes: 1 addition & 1 deletion site/docs/guide/advanced-topics/use-react-g.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: 使用 React 定义图形
order: 5
---

react 通过 `react-reconcilor` 提供了自定义 render 的能力,`react-g` 便是一个 react 到 g 的 render。
react 通过 `react-reconciler` 提供了自定义 render 的能力,`react-g` 便是一个 react 到 g 的 render。

`react-g` 目前处于实验状态,欢迎试用和反馈。

Expand Down
Loading