Skip to content

Commit

Permalink
Release (#1416)
Browse files Browse the repository at this point in the history
* fix: combine multiple paths into a single drawcall (#1412)

* fix: merge simple path into a single draw call

* chore: commit changeset

* fix: return unprecise bounds before HTML appending to document #1414

* chore: commit changeset

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

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 Jul 18, 2023
1 parent 578a440 commit aad508e
Show file tree
Hide file tree
Showing 109 changed files with 917 additions and 110 deletions.
26 changes: 26 additions & 0 deletions __tests__/unit/display-objects/html.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,30 @@ describe('HTML', () => {
expect(html.getLocalBounds().center[0]).toBe(230);
expect(html.getLocalBounds().center[1]).toBe(230);
});

it('should return unprecise bounding box before appending to document.', () => {
const html = new HTML({
id: 'id',
name: 'name',
className: 'classname',
style: {
x: 100,
y: 100,
width: 100,
height: 100,
innerHTML: '<h1>This is Title</h1>',
},
});

// DOM element hasn't been created yet.
const $el = html.getDomElement();
expect($el).toBe(undefined);

// Use x/y/width/height defined by user.
const bounds = html.getBounds();
expect(bounds.halfExtents[0]).toBe(50);
expect(bounds.halfExtents[1]).toBe(50);
expect(bounds.center[0]).toBe(150);
expect(bounds.center[1]).toBe(150);
});
});
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.4

### Patch Changes

- Updated dependencies [6757ccbd]
- @antv/g-lite@1.2.4

## 1.2.3

### 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.3",
"version": "1.2.4",
"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.4

### Patch Changes

- Updated dependencies [6757ccbd]
- @antv/g-lite@1.2.4
- @antv/g-plugin-canvas-path-generator@1.3.4
- @antv/g-plugin-canvas-picker@1.10.4
- @antv/g-plugin-canvas-renderer@1.9.4
- @antv/g-plugin-dom-interaction@1.9.4
- @antv/g-plugin-html-renderer@1.9.4
- @antv/g-plugin-image-loader@1.3.4

## 1.11.3

### 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.3",
"version": "1.11.4",
"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.4

### Patch Changes

- Updated dependencies [6757ccbd]
- @antv/g-lite@1.2.4
- @antv/g-plugin-canvas-path-generator@1.3.4
- @antv/g-plugin-canvas-picker@1.10.4
- @antv/g-plugin-canvaskit-renderer@1.3.4
- @antv/g-plugin-dom-interaction@1.9.4
- @antv/g-plugin-html-renderer@1.9.4
- @antv/g-plugin-image-loader@1.3.4

## 0.10.3

### 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.3",
"version": "0.10.4",
"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.4

### Patch Changes

- Updated dependencies [6757ccbd]
- @antv/g-lite@1.2.4

## 1.9.3

### 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.3",
"version": "1.9.4",
"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.4

### Patch Changes

- Updated dependencies [6757ccbd]
- @antv/g-lite@1.2.4

## 1.2.3

### 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.3",
"version": "1.2.4",
"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.4

### Patch Changes

- Updated dependencies [6757ccbd]
- @antv/g-lite@1.2.4

## 2.2.3

### 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.3",
"version": "2.2.4",
"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.4

### Patch Changes

- Updated dependencies [6757ccbd]
- @antv/g-lite@1.2.4

## 0.7.3

### 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.3",
"version": "0.7.4",
"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.4

### Patch Changes

- 6757ccbd: Return an unprecise bound of HTML before it appending to document.

## 1.2.3

### 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.3",
"version": "1.2.4",
"description": "A core module for rendering engine implements DOM API.",
"keywords": [
"antv",
Expand Down
44 changes: 20 additions & 24 deletions packages/g-lite/src/display-objects/HTML.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { mat4 } from 'gl-matrix';
import type { CSSUnitValue } from '../css';
import type { DisplayObjectConfig } from '../dom';
import { runtime } from '../global-runtime';
import { AABB } from '../shapes';
import { AABB, Rectangle } from '../shapes';
import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
import { Shape } from '../types';
import { DisplayObject } from './DisplayObject';
Expand All @@ -16,12 +15,12 @@ export interface HTMLStyleProps extends BaseStyleProps {
}

export interface ParsedHTMLStyleProps extends ParsedBaseStyleProps {
x: CSSUnitValue;
y: CSSUnitValue;
x: number;
y: number;
$el: HTMLElement;
innerHTML: string | HTMLElement;
width: CSSUnitValue;
height: CSSUnitValue;
width: number;
height: number;
}

/**
Expand Down Expand Up @@ -63,8 +62,13 @@ export class HTML extends DisplayObject<HTMLStyleProps, ParsedHTMLStyleProps> {
* override with $el.getBoundingClientRect
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/getBoundingClientRect
*/
getBoundingClientRect() {
return this.parsedStyle.$el.getBoundingClientRect();
getBoundingClientRect(): Rectangle {
if (this.parsedStyle.$el) {
return this.parsedStyle.$el.getBoundingClientRect();
} else {
const { x, y, width, height } = this.parsedStyle;
return new Rectangle(x, y, width, height);
}
}

getClientRects() {
Expand All @@ -78,23 +82,15 @@ export class HTML extends DisplayObject<HTMLStyleProps, ParsedHTMLStyleProps> {
const canvasRect = this.ownerDocument?.defaultView
?.getContextService()
.getBoundingClientRect();
if (canvasRect) {
const minX = clientRect.left - canvasRect.left;
const minY = clientRect.top - canvasRect.top;

const aabb = new AABB();
// aabb.setMinMax(
// vec3.fromValues(minX, minY, 0),
// vec3.fromValues(minX + clientRect.width, minY + clientRect.height, 0),
// );
aabb.setMinMax(
[minX, minY, 0],
[minX + clientRect.width, minY + clientRect.height, 0],
);

return aabb;
}
return null;
const aabb = new AABB();
const minX = clientRect.left - (canvasRect?.left || 0);
const minY = clientRect.top - (canvasRect?.top || 0);
aabb.setMinMax(
[minX, minY, 0],
[minX + clientRect.width, minY + clientRect.height, 0],
);
return aabb;
}

getLocalBounds() {
Expand Down
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.4

### Patch Changes

- Updated dependencies [6757ccbd]
- @antv/g-lite@1.2.4

## 0.2.3

### 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.3",
"version": "0.2.4",
"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.4

### Patch Changes

- Updated dependencies [6757ccbd]
- @antv/g-lite@1.2.4

## 0.8.3

### 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.3",
"version": "0.8.4",
"description": "Create a CanvasLike element from existed context in mobile environment",
"keywords": [
"antv",
Expand Down
13 changes: 13 additions & 0 deletions packages/g-mobile-canvas/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# @antv/g-mobile-canvas

## 0.10.4

### Patch Changes

- Updated dependencies [6757ccbd]
- @antv/g-lite@1.2.4
- @antv/g-plugin-canvas-path-generator@1.3.4
- @antv/g-plugin-canvas-picker@1.10.4
- @antv/g-plugin-canvas-renderer@1.9.4
- @antv/g-plugin-dragndrop@1.8.4
- @antv/g-plugin-image-loader@1.3.4
- @antv/g-plugin-mobile-interaction@0.9.4

## 0.10.3

### 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": "0.10.3",
"version": "0.10.4",
"description": "A renderer implemented with Canvas2D API in mobile environment",
"keywords": [
"antv",
Expand Down
11 changes: 11 additions & 0 deletions packages/g-mobile-svg/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# @antv/g-mobile-svg

## 0.10.4

### Patch Changes

- Updated dependencies [6757ccbd]
- @antv/g-lite@1.2.4
- @antv/g-plugin-dragndrop@1.8.4
- @antv/g-plugin-mobile-interaction@0.9.4
- @antv/g-plugin-svg-picker@1.9.4
- @antv/g-plugin-svg-renderer@1.10.4

## 0.10.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/g-mobile-svg/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-mobile-svg",
"version": "0.10.3",
"version": "0.10.4",
"description": "A renderer implemented by SVG in mobile environment",
"keywords": [
"antv",
Expand Down
14 changes: 14 additions & 0 deletions packages/g-mobile-webgl/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# @antv/g-mobile-webgl

## 0.9.4

### Patch Changes

- Updated dependencies [6757ccbd]
- Updated dependencies [6757ccbd]
- @antv/g-plugin-device-renderer@1.9.4
- @antv/g-lite@1.2.4
- @antv/g-plugin-webgl-device@1.9.4
- @antv/g-plugin-dragndrop@1.8.4
- @antv/g-plugin-html-renderer@1.9.4
- @antv/g-plugin-image-loader@1.3.4
- @antv/g-plugin-mobile-interaction@0.9.4

## 0.9.3

### Patch Changes
Expand Down
Loading

0 comments on commit aad508e

Please sign in to comment.