Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoiver committed Mar 21, 2024
2 parents e5ec1a1 + acd120e commit ee01333
Show file tree
Hide file tree
Showing 131 changed files with 1,503 additions and 181 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ jobs:
node-version: 16
cache: 'pnpm'

- name: Install Playwright browsers
run: npx playwright install --with-deps

- name: Install dependencies
run: pnpm install

- name: Install Playwright browsers
run: npx playwright install --with-deps

- name: Build
run: pnpm build

Expand Down
48 changes: 48 additions & 0 deletions __tests__/demos/bugfix/1636.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { Image, Group, Rect } from '../../../packages/g';

export async function image(context) {
const { canvas } = context;
await canvas.ready;

const rect = new Rect({
style: {
x: 0,
y: 0,
width: 600,
height: 600,
},
});
const group = new Group({
style: {
clipPath: rect,
},
});
canvas.appendChild(group);

const img = new window.Image();
img.onload = () => {
const image = new Image({
style: {
x: 0,
y: 0,
width: 100,
height: 100,
img,
},
});
const image2 = new Image({
style: {
x: 50,
y: 0,
width: 100,
height: 100,
img,
},
});
group.appendChild(image);
group.appendChild(image2);
};
img.src =
'https://gw.alipayobjects.com/mdn/rms_6ae20b/afts/img/A*_aqoS73Se3sAAAAAAAAAAAAAARQnAQ';
img.crossOrigin = 'anonymous';
}
1 change: 1 addition & 0 deletions __tests__/demos/bugfix/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export { html } from './1610';
export { transform_path } from './1624';
export { scale0 } from './scale0';
export { dirty } from './dirty';
export { image } from './1636';
9 changes: 9 additions & 0 deletions __tests__/demos/plugin/annotation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ import {
Line,
Polyline,
Polygon,
runtime,
} from '../../../packages/g';
import { Plugin as PluginAnnotation } from '../../../packages/g-plugin-annotation';

let annotationPlugin;

runtime.enableSizeAttenuation = true;
export async function annotation(context) {
const { canvas, gui } = context;

Expand Down Expand Up @@ -151,6 +154,7 @@ export async function annotation(context) {
style: {
...brush,
points: path.map(({ x, y }) => [x, y]),
isSizeAttenuation: true,
},
});
canvas.appendChild(polyline);
Expand All @@ -159,6 +163,7 @@ export async function annotation(context) {
style: {
...brush,
points: path.map(({ x, y }) => [x, y]),
isSizeAttenuation: true,
},
});
canvas.appendChild(polygon);
Expand All @@ -169,6 +174,7 @@ export async function annotation(context) {
// @ts-ignore
selectableUI: 'rect',
points: path.map(({ x, y }) => [x, y]),
isSizeAttenuation: true,
},
});
canvas.appendChild(rect);
Expand All @@ -179,6 +185,8 @@ export async function annotation(context) {
cx: path[0].x,
cy: path[0].y,
r: 20,
lineWidth: 5,
isSizeAttenuation: true,
},
});
canvas.appendChild(circle);
Expand Down Expand Up @@ -522,6 +530,7 @@ annotation.initRenderer = (renderer) => {
enableDeleteAnchorsWithShortcuts: true,
enableAutoSwitchDrawingMode: true,
enableDisplayMidAnchors: true,
enableSizeAttenuation: true,
enableRotateAnchor: true,
selectableStyle: {
selectionFill: 'rgba(24,144,255,0.15)',
Expand Down
27 changes: 27 additions & 0 deletions __tests__/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import * as perf from './demos/perf';
import * as bugfix from './demos/bugfix';
import * as event from './demos/event';

runtime.enableCSSParsing = false;

const tests = {
...createSpecRender(namespace(basic2d, '2d')),
...createSpecRender(namespace(basic3d, '3d')),
Expand Down Expand Up @@ -243,6 +245,31 @@ function createSpecRender(object) {
});
}

if (
selectRenderer.value === 'canvas' &&
renderer.getConfig().enableDirtyRectangleRendering &&
renderer.getConfig().enableDirtyRectangleRenderingDebug
) {
// display dirty rectangle
const $dirtyRectangle = document.createElement('div');
$dirtyRectangle.style.cssText = `
position: absolute;
pointer-events: none;
background: rgba(255, 0, 0, 0.5);
`;
$div.appendChild($dirtyRectangle);
canvas.addEventListener(CanvasEvent.DIRTY_RECTANGLE, (e) => {
const { dirtyRect } = e.detail;
const { x, y, width, height } = dirtyRect;
const dpr = window.devicePixelRatio;
// convert from canvas coords to viewport
$dirtyRectangle.style.left = `${x / dpr}px`;
$dirtyRectangle.style.top = `${y / dpr}px`;
$dirtyRectangle.style.width = `${width / dpr}px`;
$dirtyRectangle.style.height = `${height / dpr}px`;
});
}

container.append($div);
};
};
Expand Down
2 changes: 2 additions & 0 deletions __tests__/unit/abstract-renderer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ describe('Abstract renderer', () => {
enableCulling: false,
enableDirtyRectangleRendering: true,
enableDirtyRectangleRenderingDebug: false,
enableSizeAttenuation: true,
});

renderer.setConfig({ enableAutoRendering: false });
Expand All @@ -19,6 +20,7 @@ describe('Abstract renderer', () => {
enableCulling: false,
enableDirtyRectangleRendering: true,
enableDirtyRectangleRenderingDebug: false,
enableSizeAttenuation: true,
});

expect(renderer.getPlugins().length).toBe(0);
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports = {
'<rootDir>/__tests__/unit/*.spec.+(ts|tsx|js)',
],
testPathIgnorePatterns: process.env.CI
? ['<rootDir>/__tests__/unit/g-gesture']
? ['<rootDir>/__tests__/unit/g-gesture', '<rootDir>/__tests__/main.ts']
: ['<rootDir>/__tests__/unit/g-gesture'],
preset: 'ts-jest',
transform: {
Expand Down
1 change: 1 addition & 0 deletions jest.node.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@ module.exports = {
globalSetup: './scripts/jest/setup.js',
globalTeardown: './scripts/jest/teardown.js',
testEnvironment: './scripts/jest/environment.js',
testPathIgnorePatterns: ['<rootDir>/__tests__/main.ts'],
};
20 changes: 20 additions & 0 deletions packages/g-camera-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,26 @@

- Updated dependencies
- @antv/g-lite@1.3.0-next.0
## 1.2.25

### Patch Changes

- Updated dependencies [10397c19]
- @antv/g-lite@1.2.24

## 1.2.24

### Patch Changes

- Updated dependencies [1d25bf84]
- @antv/g-lite@1.2.23

## 1.2.23

### Patch Changes

- Updated dependencies [11d23f39]
- @antv/g-lite@1.2.22

## 1.2.22

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": "1.2.23-next.20",
"version": "1.2.25",
"description": "A simple implementation of Camera API.",
"keywords": [
"antv",
Expand Down
38 changes: 38 additions & 0 deletions packages/g-canvas/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,44 @@
- @antv/g-plugin-canvas-path-generator@1.3.22-next.0
- @antv/g-plugin-dom-interaction@1.9.22-next.0
- @antv/g-plugin-html-renderer@1.9.25-next.0
## 1.11.29

### Patch Changes

- Updated dependencies [10397c19]
- @antv/g-lite@1.2.24
- @antv/g-plugin-canvas-path-generator@1.3.24
- @antv/g-plugin-canvas-picker@1.10.26
- @antv/g-plugin-canvas-renderer@1.9.26
- @antv/g-plugin-dom-interaction@1.9.24
- @antv/g-plugin-html-renderer@1.9.27
- @antv/g-plugin-image-loader@1.3.24

## 1.11.28

### Patch Changes

- Updated dependencies [1d25bf84]
- @antv/g-lite@1.2.23
- @antv/g-plugin-canvas-path-generator@1.3.23
- @antv/g-plugin-canvas-picker@1.10.25
- @antv/g-plugin-canvas-renderer@1.9.25
- @antv/g-plugin-dom-interaction@1.9.23
- @antv/g-plugin-html-renderer@1.9.26
- @antv/g-plugin-image-loader@1.3.23

## 1.11.27

### Patch Changes

- Updated dependencies [11d23f39]
- @antv/g-lite@1.2.22
- @antv/g-plugin-canvas-path-generator@1.3.22
- @antv/g-plugin-canvas-picker@1.10.24
- @antv/g-plugin-canvas-renderer@1.9.24
- @antv/g-plugin-dom-interaction@1.9.22
- @antv/g-plugin-html-renderer@1.9.25
- @antv/g-plugin-image-loader@1.3.22

## 1.11.26

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": "1.11.27-next.20",
"version": "1.11.29",
"description": "A renderer implemented by Canvas 2D API",
"keywords": [
"antv",
Expand Down
38 changes: 38 additions & 0 deletions packages/g-canvaskit/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,44 @@
- @antv/g-plugin-canvas-path-generator@1.3.22-next.0
- @antv/g-plugin-dom-interaction@1.9.22-next.0
- @antv/g-plugin-html-renderer@1.9.25-next.0
## 0.10.29

### Patch Changes

- Updated dependencies [10397c19]
- @antv/g-lite@1.2.24
- @antv/g-plugin-canvas-path-generator@1.3.24
- @antv/g-plugin-canvas-picker@1.10.26
- @antv/g-plugin-canvaskit-renderer@1.3.25
- @antv/g-plugin-dom-interaction@1.9.24
- @antv/g-plugin-html-renderer@1.9.27
- @antv/g-plugin-image-loader@1.3.24

## 0.10.28

### Patch Changes

- Updated dependencies [1d25bf84]
- @antv/g-lite@1.2.23
- @antv/g-plugin-canvas-path-generator@1.3.23
- @antv/g-plugin-canvas-picker@1.10.25
- @antv/g-plugin-canvaskit-renderer@1.3.24
- @antv/g-plugin-dom-interaction@1.9.23
- @antv/g-plugin-html-renderer@1.9.26
- @antv/g-plugin-image-loader@1.3.23

## 0.10.27

### Patch Changes

- Updated dependencies [11d23f39]
- @antv/g-lite@1.2.22
- @antv/g-plugin-canvas-path-generator@1.3.22
- @antv/g-plugin-canvas-picker@1.10.24
- @antv/g-plugin-canvaskit-renderer@1.3.23
- @antv/g-plugin-dom-interaction@1.9.22
- @antv/g-plugin-html-renderer@1.9.25
- @antv/g-plugin-image-loader@1.3.22

## 0.10.26

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": "0.10.27-next.20",
"version": "0.10.29",
"description": "A renderer implemented by CanvasKit",
"keywords": [
"antv",
Expand Down
20 changes: 20 additions & 0 deletions packages/g-components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,26 @@

- Updated dependencies
- @antv/g-lite@1.3.0-next.0
## 1.9.24

### Patch Changes

- Updated dependencies [10397c19]
- @antv/g-lite@1.2.24

## 1.9.23

### Patch Changes

- Updated dependencies [1d25bf84]
- @antv/g-lite@1.2.23

## 1.9.22

### Patch Changes

- Updated dependencies [11d23f39]
- @antv/g-lite@1.2.22

## 1.9.21

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": "1.9.22-next.20",
"version": "1.9.24",
"description": "Components for g",
"keywords": [
"antv",
Expand Down
20 changes: 20 additions & 0 deletions packages/g-dom-mutation-observer-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,26 @@

- Updated dependencies
- @antv/g-lite@1.3.0-next.0
## 1.2.24

### Patch Changes

- Updated dependencies [10397c19]
- @antv/g-lite@1.2.24

## 1.2.23

### Patch Changes

- Updated dependencies [1d25bf84]
- @antv/g-lite@1.2.23

## 1.2.22

### Patch Changes

- Updated dependencies [11d23f39]
- @antv/g-lite@1.2.22

## 1.2.21

Expand Down
Loading

0 comments on commit ee01333

Please sign in to comment.