Skip to content

Commit

Permalink
Release (#1567)
Browse files Browse the repository at this point in the history
* fix: use ownerDocument when finding document in element (#1564)

* fix: use ownerDocument when finding document in element #1299

* chore: commit changeset

* fix: remove points attribute from polygon & polyline (#1566)

* chore(release): bump version (#1565)

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 Oct 30, 2023
1 parent 6d82b64 commit a07758a
Show file tree
Hide file tree
Showing 102 changed files with 619 additions and 69 deletions.
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';

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

## 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/g-lite@1.2.16
- @antv/g-plugin-canvas-path-generator@1.3.16
- @antv/g-plugin-canvas-picker@1.10.18
- @antv/g-plugin-canvas-renderer@1.9.18
- @antv/g-plugin-dom-interaction@1.9.16
- @antv/g-plugin-html-renderer@1.9.19
- @antv/g-plugin-image-loader@1.3.16

## 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/g-lite@1.2.16
- @antv/g-plugin-canvas-path-generator@1.3.16
- @antv/g-plugin-canvas-picker@1.10.18
- @antv/g-plugin-canvaskit-renderer@1.3.17
- @antv/g-plugin-dom-interaction@1.9.16
- @antv/g-plugin-html-renderer@1.9.19
- @antv/g-plugin-image-loader@1.3.16

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

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

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

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

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

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

## 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/g-lite@1.2.16
- @antv/g-plugin-canvas-path-generator@1.3.16
- @antv/g-plugin-canvas-picker@1.10.18
- @antv/g-plugin-canvas-renderer@1.9.18
- @antv/g-plugin-dragndrop@1.8.16
- @antv/g-plugin-gesture@1.2.4
- @antv/g-plugin-image-loader@1.3.16
- @antv/g-plugin-mobile-interaction@0.9.16

## 0.11.8

### Patch Changes
Expand Down
Loading

0 comments on commit a07758a

Please sign in to comment.