Skip to content

Commit

Permalink
Release (#1878)
Browse files Browse the repository at this point in the history
* fix: the text wrapping position is not accurate (#1876)

* Version Packages (#1877)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 26, 2024
1 parent ae89121 commit 7ce64f1
Show file tree
Hide file tree
Showing 97 changed files with 570 additions and 94 deletions.
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');
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/g-lite@2.2.11

## 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/g-lite@2.2.11
- @antv/g-plugin-canvas-path-generator@2.1.11
- @antv/g-plugin-canvas-picker@2.1.13
- @antv/g-plugin-canvas-renderer@2.2.13
- @antv/g-plugin-dom-interaction@2.1.16
- @antv/g-plugin-html-renderer@2.1.16
- @antv/g-plugin-image-loader@2.1.13

## 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/g-lite@2.2.11
- @antv/g-plugin-canvas-path-generator@2.1.11
- @antv/g-plugin-canvas-picker@2.1.13
- @antv/g-plugin-canvaskit-renderer@2.1.13
- @antv/g-plugin-dom-interaction@2.1.16
- @antv/g-plugin-html-renderer@2.1.16
- @antv/g-plugin-image-loader@2.1.13

## 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/g-lite@2.2.11

## 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/g-lite@2.2.11

## 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/g-lite@2.2.11

## 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/g-lite@2.2.11

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

0 comments on commit 7ce64f1

Please sign in to comment.