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

Merged
merged 2 commits into from
Dec 26, 2024
Merged

Release #1878

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
44 changes: 44 additions & 0 deletions __tests__/demos/bugfix/textWordWrap.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { Canvas, Text, Rect } from '@antv/g';
import * as tinybench from 'tinybench';

/**
* @link https://github.com/antvis/G/issues/1833
*/
export async function textWordWrap(context: { canvas: Canvas }) {
const { canvas } = context;
await canvas.ready;
Expand Down Expand Up @@ -105,4 +109,44 @@ export async function textWordWrap(context: { canvas: Canvas }) {
canvas.appendChild(rect1);
canvas.appendChild(text2);
canvas.appendChild(rect2);

// benchmark
// ----------
const bench = new tinybench.Bench({
name: 'canvas text benchmark',
time: 100,
});

const canvasEl = document.createElement('canvas');
wang1212 marked this conversation as resolved.
Show resolved Hide resolved
const testText = 'Hello, World!';
bench.add('Measure the entire text at once', async () => {
canvasEl.getContext('2d').measureText(testText);
});
bench.add('Character-by-character measurement', async () => {
const ctx = canvasEl.getContext('2d');
Array.from(testText).forEach((char) => {
ctx.measureText(char);
});
});

const testText1 =
'In G, text line break detection is currently done by iteratively measuring the width of each character and then adding them up to determine whether a line break is needed. External users may configure wordWrapWidth by directly measuring the width of the entire text. The two different text measurement methods will lead to visual inconsistencies.';
bench.add('(long txt) Measure the entire text at once', async () => {
canvasEl.getContext('2d').measureText(testText1);
});
bench.add('(long txt) Character-by-character measurement', async () => {
const ctx = canvasEl.getContext('2d');
Array.from(testText1).forEach((char) => {
ctx.measureText(char);
});
});

await bench.run();

console.log(bench.name);
console.table(bench.table());
console.log(bench.results);
console.log(bench.tasks);

// ----------
}
4 changes: 2 additions & 2 deletions __tests__/demos/event/hierarchy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Circle, Path } from '@antv/g';
import { Canvas, Circle, Path } from '@antv/g';

export async function hierarchy(context) {
export async function hierarchy(context: { canvas: Canvas }) {
const { canvas } = context;
await canvas.ready;

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

## 2.0.30

### Patch Changes

- Updated dependencies [1d13497]
- @antv/[email protected]

## 2.0.29

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-camera-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-camera-api",
"version": "2.0.29",
"version": "2.0.30",
"description": "A simple implementation of Camera API.",
"keywords": [
"antv",
Expand Down
13 changes: 13 additions & 0 deletions packages/g-canvas/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# @antv/g-canvas

## 2.0.34

### Patch Changes

- Updated dependencies [1d13497]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]

## 2.0.33

### 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.33",
"version": "2.0.34",
"description": "A renderer implemented by Canvas 2D API",
"keywords": [
"antv",
Expand Down
13 changes: 13 additions & 0 deletions packages/g-canvaskit/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# @antv/g-canvaskit

## 1.0.33

### Patch Changes

- Updated dependencies [1d13497]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]

## 1.0.32

### 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.32",
"version": "1.0.33",
"description": "A renderer implemented by CanvasKit",
"keywords": [
"antv",
Expand Down
7 changes: 7 additions & 0 deletions packages/g-components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @antv/g-components

## 2.0.27

### Patch Changes

- Updated dependencies [1d13497]
- @antv/[email protected]

## 2.0.26

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-components",
"version": "2.0.26",
"version": "2.0.27",
"description": "Components for g",
"keywords": [
"antv",
Expand Down
7 changes: 7 additions & 0 deletions packages/g-dom-mutation-observer-api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @antv/g-dom-mutation-observer-api

## 2.0.27

### Patch Changes

- Updated dependencies [1d13497]
- @antv/[email protected]

## 2.0.26

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-dom-mutation-observer-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-dom-mutation-observer-api",
"version": "2.0.26",
"version": "2.0.27",
"description": "A simple implementation of DOM MutationObserver API.",
"keywords": [
"antv",
Expand Down
7 changes: 7 additions & 0 deletions packages/g-gesture/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @antv/g-gesture

## 3.0.27

### Patch Changes

- Updated dependencies [1d13497]
- @antv/[email protected]

## 3.0.26

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-gesture/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-gesture",
"version": "3.0.26",
"version": "3.0.27",
"description": "G Gesture",
"keywords": [
"antv",
Expand Down
7 changes: 7 additions & 0 deletions packages/g-image-exporter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @antv/g-image-exporter

## 1.0.27

### Patch Changes

- Updated dependencies [1d13497]
- @antv/[email protected]

## 1.0.26

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-image-exporter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-image-exporter",
"version": "1.0.26",
"version": "1.0.27",
"description": "A image exporter for G using DOM API",
"keywords": [
"antv",
Expand Down
6 changes: 6 additions & 0 deletions packages/g-lite/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @antv/g-lite

## 2.2.11

### Patch Changes

- 1d13497: fix: the text wrapping position is not accurate

## 2.2.10

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-lite/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-lite",
"version": "2.2.10",
"version": "2.2.11",
"description": "A core module for rendering engine implements DOM API.",
"keywords": [
"antv",
Expand Down
Loading
Loading