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

Merged
merged 3 commits into from
Oct 30, 2023
Merged

Release #1567

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
Binary file modified __tests__/integration/__node__tests__/webgl/snapshots/marker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions __tests__/unit/display-objects/polyline.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,31 @@ describe('Polyline', () => {
expect(polyline.getTotalLength()).toBe(750);
});

it('should remove points attribute correctly', () => {
const polyline = new Polyline({
style: {
points: [
[50, 50],
[100, 50],
[100, 100],
],
lineWidth: 10,
},
});
let bounds = polyline.getBounds();
if (bounds) {
expect(bounds.center).toStrictEqual([75, 75, 0]);
expect(bounds.halfExtents).toStrictEqual([25, 25, 0]);
}

polyline.removeAttribute('points');
bounds = polyline.getBounds();
if (bounds) {
expect(bounds.center).toStrictEqual([0, 0, 0]);
expect(bounds.halfExtents).toStrictEqual([0, 0, 0]);
}
});

it('should getPoint at ratio correctly', () => {
const polyline = new Polyline({
style: {
Expand Down
31 changes: 30 additions & 1 deletion __tests__/unit/display-objects/text.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Renderer as CanvasRenderer } from '../../../packages/g-canvas/src';
import { Canvas, Group, Text } from '../../../packages/g/src';
import { Canvas, Group, Rect, Text } from '../../../packages/g/src';

Check notice

Code scanning / CodeQL

Unused variable, import, function or class

Unused import Rect.

const $container = document.createElement('div');
$container.id = 'container';
Expand Down Expand Up @@ -249,4 +249,33 @@ describe('Text', () => {
text.style.wordWrap = false;
expect(text.isOverflowing()).toBe(false);
});

// it.only('should calc global bounds correctly', async () => {
// await canvas.ready;

// const group = new Group();
// const rect = new Rect({
// style: {
// width: 50,
// height: 50,
// stroke: 'black',
// lineWidth: 2,
// fill: 'red',
// },
// });
// const text = new Text({
// style: {
// text: '这是测试文本This is text',
// fontSize: 60,
// fill: '#1890FF',
// },
// });

// rect.appendChild(text);

// group.appendChild(rect);
// canvas.appendChild(group);

// console.log(text);
// });
});
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

## 1.2.17

### Patch Changes

- Updated dependencies [7e3dbd76]
- @antv/[email protected]

## 1.2.16

### 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": "1.2.16",
"version": "1.2.17",
"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

## 1.11.21

### Patch Changes

- Updated dependencies [7e3dbd76]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]

## 1.11.20

### 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": "1.11.20",
"version": "1.11.21",
"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

## 0.10.21

### Patch Changes

- Updated dependencies [7e3dbd76]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]

## 0.10.20

### 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": "0.10.20",
"version": "0.10.21",
"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

## 1.9.16

### Patch Changes

- Updated dependencies [7e3dbd76]
- @antv/[email protected]

## 1.9.15

### 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": "1.9.15",
"version": "1.9.16",
"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

## 1.2.16

### Patch Changes

- Updated dependencies [7e3dbd76]
- @antv/[email protected]

## 1.2.15

### 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": "1.2.15",
"version": "1.2.16",
"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

## 2.2.19

### Patch Changes

- Updated dependencies [7e3dbd76]
- @antv/[email protected]

## 2.2.18

### 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": "2.2.18",
"version": "2.2.19",
"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

## 0.7.16

### Patch Changes

- Updated dependencies [7e3dbd76]
- @antv/[email protected]

## 0.7.15

### 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": "0.7.15",
"version": "0.7.16",
"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

## 1.2.16

### Patch Changes

- 7e3dbd76: Removing points attribute from polyline & polygon won't throw error now.

## 1.2.15

### 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": "1.2.15",
"version": "1.2.16",
"description": "A core module for rendering engine implements DOM API.",
"keywords": [
"antv",
Expand Down
14 changes: 6 additions & 8 deletions packages/g-lite/src/display-objects/Polygon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,14 @@ export class Polygon extends DisplayObject<
markerEnd,
markerStartOffset,
markerEndOffset,
points: { points },
points: P,
defX,
defY,
} = this.parsedStyle;
const { points } = P || {};
const marker = isStart ? markerStart : markerEnd;

if (!marker || !isDisplayObject(marker)) {
if (!marker || !isDisplayObject(marker) || !points) {
return;
}

Expand Down Expand Up @@ -208,19 +209,16 @@ export class Polygon extends DisplayObject<
}

private placeMarkerMid(marker: DisplayObject) {
const {
points: { points },
defX,
defY,
} = this.parsedStyle;
const { points: P, defX, defY } = this.parsedStyle;
const { points } = P || {};

// clear all existed markers
this.markerMidList.forEach((marker) => {
marker.remove();
});
this.markerMidList = [];

if (marker && isDisplayObject(marker)) {
if (marker && isDisplayObject(marker) && points) {
for (
let i = 1;
i < (this.parsedStyle.isClosed ? points.length : points.length - 1);
Expand Down
31 changes: 20 additions & 11 deletions packages/g-lite/src/services/aabb/PolylineUpdater.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
import { isArray } from '@antv/util';
import type { ParsedPolylineStyleProps } from '../../display-objects';
import type { GeometryAABBUpdater } from './interfaces';

export class PolylineUpdater implements GeometryAABBUpdater<ParsedPolylineStyleProps> {
export class PolylineUpdater
implements GeometryAABBUpdater<ParsedPolylineStyleProps>
{
update(parsedStyle: ParsedPolylineStyleProps) {
const { points } = parsedStyle.points;
if (parsedStyle.points && isArray(parsedStyle.points.points)) {
const { points } = parsedStyle.points;

// FIXME: account for miter lineJoin
const minX = Math.min(...points.map((point) => point[0]));
const maxX = Math.max(...points.map((point) => point[0]));
const minY = Math.min(...points.map((point) => point[1]));
const maxY = Math.max(...points.map((point) => point[1]));
// FIXME: account for miter lineJoin
const minX = Math.min(...points.map((point) => point[0]));
const maxX = Math.max(...points.map((point) => point[0]));
const minY = Math.min(...points.map((point) => point[1]));
const maxY = Math.max(...points.map((point) => point[1]));

const width = maxX - minX;
const height = maxY - minY;
const width = maxX - minX;
const height = maxY - minY;

return {
width,
height,
};
}
return {
width,
height,
width: 0,
height: 0,
};
}
}
7 changes: 7 additions & 0 deletions packages/g-lottie-player/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @antv/g-lottie-player

## 0.2.16

### Patch Changes

- Updated dependencies [7e3dbd76]
- @antv/[email protected]

## 0.2.15

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-lottie-player/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-lottie-player",
"version": "0.2.15",
"version": "0.2.16",
"description": "A lottie player for G",
"keywords": [
"antv",
Expand Down
7 changes: 7 additions & 0 deletions packages/g-mobile-canvas-element/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @antv/g-mobile-canvas-element

## 0.8.16

### Patch Changes

- Updated dependencies [7e3dbd76]
- @antv/[email protected]

## 0.8.15

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-mobile-canvas-element/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-mobile-canvas-element",
"version": "0.8.15",
"version": "0.8.16",
"description": "Create a CanvasLike element from existed context in mobile environment",
"keywords": [
"antv",
Expand Down
14 changes: 14 additions & 0 deletions packages/g-mobile-canvas/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# @antv/g-mobile-canvas

## 0.11.9

### Patch Changes

- Updated dependencies [7e3dbd76]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]

## 0.11.8

### Patch Changes
Expand Down
Loading