Skip to content

Commit

Permalink
Release (#1774)
Browse files Browse the repository at this point in the history
* fix: `sourcemap.sources` path wrong (#1766)

* fix: webgl renderer has logical exception when updating attributes (#1768) (#1769)

* feat: added support for picking rotated text (#1749) (#1772)

* chore: updated benchmark screenshots (#1773)

* chore: updated benchmark screenshots

* fix: sourcemap generation exception

* chore: update test ci node version

* chore: update screenshots and ci config

* chore: delete redundant benchmark images

* Version Packages (#1770)

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 committed Sep 14, 2024
1 parent 910c58e commit 1443fed
Show file tree
Hide file tree
Showing 60 changed files with 6,148 additions and 4,577 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:

- uses: pnpm/action-setup@v2
with:
version: 7
version: 9

- name: Use Node.js 16
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 16 # semantic-release 需要 >= 16 的 Node.js 环境
node-version: 20 # semantic-release 需要 >= 16 的 Node.js 环境
cache: 'pnpm'

- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:

- uses: pnpm/action-setup@v2
with:
version: 7
version: 9

- name: Use Node.js 16
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
cache: 'pnpm'

# 发布开始通知
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:

- uses: pnpm/action-setup@v2
with:
version: 7
version: 9

- name: Use Node.js 16
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
cache: 'pnpm'

- name: Install dependencies
Expand All @@ -39,7 +39,7 @@ jobs:

- name: Upload snapshots to GitHub Actions Artifacts
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: snapshots
path: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:

- uses: pnpm/action-setup@v2
with:
version: 7
version: 9

- name: Use Node.js 16
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
cache: 'pnpm'

- name: Install dependencies
Expand Down
Binary file modified __tests__/integration/snapshots/2d/canvas/circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified __tests__/integration/snapshots/2d/canvas/customElement.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified __tests__/integration/snapshots/2d/canvas/ellipse.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified __tests__/integration/snapshots/2d/canvas/polygon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified __tests__/integration/snapshots/2d/canvas/text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified __tests__/integration/snapshots/2d/canvas/transform.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified __tests__/integration/snapshots/2d/svg/circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified __tests__/integration/snapshots/2d/svg/customElement.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified __tests__/integration/snapshots/2d/svg/path.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified __tests__/integration/snapshots/2d/svg/polygon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified __tests__/integration/snapshots/2d/svg/text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified __tests__/integration/snapshots/2d/svg/transform.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified __tests__/integration/snapshots/2d/webgl/text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion demo/issues/issue-1743.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
name="viewport"
content="width=device-width,user-scalable=no,initial-scale=1,shrink-to-fit=no"
/>
<title>Camera</title>
<title>issue-1743</title>
<style>
* {
box-sizing: border-box;
Expand Down
105 changes: 105 additions & 0 deletions demo/issues/issue-1749.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width,user-scalable=no,initial-scale=1,shrink-to-fit=no"
/>
<title>issue-1749</title>
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}

body {
height: 100vh;
padding: 100px;
}

#container {
/* border: 1px solid #ddd; */
background-color: #ddd;
width: 100%;
height: 100%;
}
</style>
</head>

<body>
<div id="container"></div>
<script
src="../../packages/g/dist/index.umd.min.js"
type="application/javascript"
></script>
<script
src="../../packages/g-canvas/dist/index.umd.min.js"
type="application/javascript"
></script>
<script>
const { Canvas, CanvasEvent, Rect, Text, Path, Canvas2D } = window.G;

const canvasRenderer = new Canvas2D.Renderer();

const canvas = new Canvas({
container: 'container',
width: 600,
height: 500,
renderer: canvasRenderer,
});

const test = (shape, property) => {
shape.addEventListener('pointerenter', () => {
shape.style[property] = 'red';
});
shape.addEventListener('pointerleave', () => {
shape.style[property] = 'black';
});
};

const text = new Text({
style: {
text: 'test123213',
fontSize: 20,
x: 300,
y: 100,
anchor: '0.5 0.5',
transform: 'rotate(45)',
},
});

const path = new Path({
style: {
d: 'M 100,100 L 150,100 L 150,150 Z',
fill: 'black',
transform: 'rotate(45)',
},
});

test(text, 'fill');
test(path, 'fill');

canvas.addEventListener(CanvasEvent.READY, () => {
canvas.appendChild(text);
canvas.appendChild(path);

const { x, y, width, height } = text.getBBox();
const rect = new Rect({
style: {
x,
y,
width,
height,
stroke: 'black',
// transform: 'rotate(45)',
},
});
test(rect, 'stroke');

canvas.appendChild(rect);
});
</script>
</body>
</html>
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.5",
"@types/fs-extra": "^11.0.4",
"@types/jest": "^29.5.10",
"@types/node": "^16.18.64",
"@types/pixelmatch": "^5.2.6",
Expand All @@ -68,9 +69,11 @@
"d3-force-3d": "^3.0.3",
"eslint": "^7.32.0",
"eslint-plugin-jest": "24.3.6",
"fs-extra": "^11.2.0",
"get-pixels": "3.3.3",
"git-contributor": "~1.0.11",
"hammerjs": "^2.0.8",
"http-server": "^14.1.1",
"husky": "^7.0.4",
"is-ci": "2.0.0",
"jest": "^29.7.0",
Expand All @@ -91,11 +94,12 @@
"rimraf": "^4.4.1",
"rollup": "^3.29.4",
"rollup-plugin-polyfill-node": "^0.8.0",
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-visualizer": "^5.9.2",
"simplex-noise": "^3.0.0",
"sinon": "^11.1.2",
"ts-jest": "^29.1.1",
"typescript": "^5.3.2",
"typescript": "^5.6.2",
"vite": "^3.2.7",
"webfontloader": "^1.6.28"
},
Expand Down
7 changes: 7 additions & 0 deletions packages/g-canvas/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @antv/g-canvas

## 2.0.13

### Patch Changes

- Updated dependencies [681327ee]
- @antv/g-plugin-canvas-picker@2.0.11

## 2.0.12

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

## 1.0.13

### Patch Changes

- Updated dependencies [681327ee]
- @antv/g-plugin-canvas-picker@2.0.11

## 1.0.12

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

## 1.0.11

### Patch Changes

- Updated dependencies [681327ee]
- @antv/g-plugin-canvas-picker@2.0.11

## 1.0.10

### 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.10",
"version": "1.0.11",
"description": "A renderer implemented with Canvas2D API in mobile environment",
"keywords": [
"antv",
Expand Down
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.17

### Patch Changes

- Updated dependencies [61ef85b2]
- @antv/g-plugin-device-renderer@2.0.15

## 1.0.16

### 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.16",
"version": "1.0.17",
"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.15

### Patch Changes

- Updated dependencies [61ef85b2]
- @antv/g-plugin-device-renderer@2.0.15

## 2.0.14

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

## 2.0.11

### Patch Changes

- 681327ee: feat: added support for picking rotated text (#1749)

## 2.0.10

### 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.0.10",
"version": "2.0.11",
"description": "A G plugin for picking in canvas",
"keywords": [
"antv",
Expand Down
21 changes: 21 additions & 0 deletions packages/g-plugin-canvas-picker/src/Text.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { DisplayObject, Point, TextStyleProps } from '@antv/g-lite';

export function isPointInPath(
displayObject: DisplayObject<TextStyleProps>,
position: Point,
isClipPath: boolean,
isPointInPath: (
displayObject: DisplayObject<TextStyleProps>,
position: Point,
) => boolean,
): boolean {
const bounds = displayObject.getGeometryBounds();

// @see https://stackoverflow.com/questions/28706989/how-do-i-check-if-a-mouse-click-is-inside-a-rotated-text-on-the-html5-canvas-in
return (
position.x >= bounds.min[0] &&
position.y >= bounds.min[1] &&
position.x <= bounds.max[0] &&
position.y <= bounds.max[1]
);
}
4 changes: 2 additions & 2 deletions packages/g-plugin-canvas-picker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { isPointInPath as PolygonPicker } from './Polygon';
import { isPointInPath as PolylinePicker } from './Polyline';
import { isPointInPath as RectPicker } from './Rect';
import { isPointInPath as ImagePicker } from './Image';
import { isPointInPath as TextPicker } from './Text';

export class Plugin extends AbstractRendererPlugin {
name = 'canvas-picker';
init(): void {
const trueFunc = () => true;
const pointInPathPickerFactory: Record<Shape, PointInPathPicker<any>> = {
[Shape.CIRCLE]: CirclePicker,
[Shape.ELLIPSE]: EllipsePicker,
Expand All @@ -22,7 +22,7 @@ export class Plugin extends AbstractRendererPlugin {
[Shape.POLYLINE]: PolylinePicker,
[Shape.POLYGON]: PolygonPicker,
[Shape.PATH]: PathPicker,
[Shape.TEXT]: trueFunc,
[Shape.TEXT]: TextPicker,
[Shape.GROUP]: null,
[Shape.IMAGE]: ImagePicker,
[Shape.HTML]: null,
Expand Down
Loading

0 comments on commit 1443fed

Please sign in to comment.