Skip to content

Commit

Permalink
Release (#1613)
Browse files Browse the repository at this point in the history
* Fix 1610 (#1611)

* fix: setup native html map per canvas instead of global singleton #1610

* chore: commit changeset

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

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 Dec 11, 2023
1 parent e193ff2 commit f9512fe
Show file tree
Hide file tree
Showing 101 changed files with 530 additions and 57 deletions.
53 changes: 53 additions & 0 deletions __tests__/demos/bugfix/1610.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { Canvas, Circle, HTML } from '../../../packages/g';
import { Renderer as CanvasRenderer } from '../../../packages/g-canvas';

export async function html(context) {
const { canvas, container } = context;
await canvas.ready;
canvas.resize(320, 320);

const $div2 = document.createElement('div');
$div2.id = 'div2';
container.appendChild($div2);
const canvasRenderer2 = new CanvasRenderer();
const canvas2 = new Canvas({
container: $div2,
width: 320,
height: 320,
renderer: canvasRenderer2,
});

const circle1 = new Circle({
style: {
cx: 100,
cy: 100,
r: 50,
fill: 'red',
cursor: 'pointer',
},
});
canvas.appendChild(circle1);
const circle2 = new Circle({
style: {
cx: 100,
cy: 100,
r: 50,
fill: 'green',
cursor: 'pointer',
},
});
canvas2.appendChild(circle2);

const html = new HTML({
id: 'html1',
style: {
x: 200,
y: 100,
width: 100,
height: 100,
innerHTML: 'canvas1',
// pointerEvents: 'none',
},
});
canvas.appendChild(html);
}
1 change: 1 addition & 0 deletions __tests__/demos/bugfix/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { html } from './1610';
6 changes: 4 additions & 2 deletions __tests__/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import * as animation from './demos/animation';
import * as d3 from './demos/d3';
import * as plugin from './demos/plugin';
import * as hammerjs from './demos/hammerjs';
import * as bugfix from './demos/bugfix';

const tests = {
...createSpecRender(namespace(basic2d, '2d')),
Expand All @@ -20,6 +21,7 @@ const tests = {
...createSpecRender(namespace(d3, 'd3')),
...createSpecRender(namespace(plugin, 'plugin')),
...createSpecRender(namespace(hammerjs, 'hammerjs')),
...createSpecRender(namespace(bugfix, 'bugfix')),
};

const renderers = {
Expand Down Expand Up @@ -130,7 +132,7 @@ function createOption(key) {
const option = document.createElement('option');
option.value = key;
option.textContent = key;
if (key === (window['DEFAULT_RENDERER'] || 'svg')) {
if (key === (window['DEFAULT_RENDERER'] || 'canvas')) {
option.selected = true;
}
return option;
Expand Down Expand Up @@ -180,7 +182,7 @@ function createSpecRender(object) {
// @ts-ignore
window.__g_instances__ = [canvas];

await generate({ canvas, renderer });
await generate({ canvas, renderer, container: $div });

container.append($div);
};
Expand Down
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.21

### Patch Changes

- Updated dependencies [ce11b242]
- @antv/g-lite@1.2.20

## 1.2.20

### 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.20",
"version": "1.2.21",
"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.25

### Patch Changes

- Updated dependencies [ce11b242]
- @antv/g-plugin-html-renderer@1.9.23
- @antv/g-lite@1.2.20
- @antv/g-plugin-canvas-path-generator@1.3.20
- @antv/g-plugin-canvas-picker@1.10.22
- @antv/g-plugin-canvas-renderer@1.9.22
- @antv/g-plugin-dom-interaction@1.9.20
- @antv/g-plugin-image-loader@1.3.20

## 1.11.24

### 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.24",
"version": "1.11.25",
"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.25

### Patch Changes

- Updated dependencies [ce11b242]
- @antv/g-plugin-html-renderer@1.9.23
- @antv/g-lite@1.2.20
- @antv/g-plugin-canvas-path-generator@1.3.20
- @antv/g-plugin-canvas-picker@1.10.22
- @antv/g-plugin-canvaskit-renderer@1.3.21
- @antv/g-plugin-dom-interaction@1.9.20
- @antv/g-plugin-image-loader@1.3.20

## 0.10.24

### 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.24",
"version": "0.10.25",
"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.20

### Patch Changes

- Updated dependencies [ce11b242]
- @antv/g-lite@1.2.20

## 1.9.19

### 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.19",
"version": "1.9.20",
"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.20

### Patch Changes

- Updated dependencies [ce11b242]
- @antv/g-lite@1.2.20

## 1.2.19

### 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.19",
"version": "1.2.20",
"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.23

### Patch Changes

- Updated dependencies [ce11b242]
- @antv/g-lite@1.2.20

## 2.2.22

### 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.22",
"version": "2.2.23",
"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.20

### Patch Changes

- Updated dependencies [ce11b242]
- @antv/g-lite@1.2.20

## 0.7.19

### 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.19",
"version": "0.7.20",
"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.20

### Patch Changes

- ce11b242: Setup native html map per canvas instead of global singleton.

## 1.2.19

### 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.19",
"version": "1.2.20",
"description": "A core module for rendering engine implements DOM API.",
"keywords": [
"antv",
Expand Down
4 changes: 0 additions & 4 deletions packages/g-lite/src/global-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
CSSPropertyTransformOrigin,
CSSPropertyZIndex,
} from './css/properties';
import type { HTML } from './display-objects';
import type {
GeometryAABBUpdater,
SceneGraphSelector,
Expand Down Expand Up @@ -67,7 +66,6 @@ export interface GlobalRuntime {
>;
globalThis: any;
enableCSSParsing: boolean;
nativeHTMLMap: WeakMap<HTMLElement, HTML>;

/**
* Enable using dataset property.
Expand Down Expand Up @@ -165,8 +163,6 @@ runtime.EasingFunction = null;

runtime.offscreenCanvasCreator = new OffscreenCanvasCreator();

runtime.nativeHTMLMap = new WeakMap();

runtime.sceneGraphSelector = new DefaultSceneGraphSelector();

runtime.sceneGraphService = new DefaultSceneGraphService(runtime);
Expand Down
7 changes: 6 additions & 1 deletion packages/g-lite/src/services/EventService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ export class EventService {

private emitter = new EventEmitter();

/**
* Store HTML elements in current canvas.
*/
nativeHTMLMap = new WeakMap<HTMLElement, HTML>();

cursor: Cursor | null = 'default';

private mappingTable: Record<
Expand Down Expand Up @@ -735,7 +740,7 @@ export class EventService {
private getExistedHTML(event: FederatedEvent): HTML {
if (event.nativeEvent.composedPath) {
for (const eventTarget of event.nativeEvent.composedPath() as HTMLElement[]) {
const existed = this.globalRuntime.nativeHTMLMap.get(eventTarget);
const existed = this.nativeHTMLMap.get(eventTarget);
if (existed) {
return existed;
}
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.20

### Patch Changes

- Updated dependencies [ce11b242]
- @antv/g-lite@1.2.20

## 0.2.19

### 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.19",
"version": "0.2.20",
"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.20

### Patch Changes

- Updated dependencies [ce11b242]
- @antv/g-lite@1.2.20

## 0.8.19

### 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.19",
"version": "0.8.20",
"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.13

### Patch Changes

- Updated dependencies [ce11b242]
- @antv/g-lite@1.2.20
- @antv/g-plugin-canvas-path-generator@1.3.20
- @antv/g-plugin-canvas-picker@1.10.22
- @antv/g-plugin-canvas-renderer@1.9.22
- @antv/g-plugin-dragndrop@1.8.20
- @antv/g-plugin-gesture@1.2.8
- @antv/g-plugin-image-loader@1.3.20
- @antv/g-plugin-mobile-interaction@0.9.20

## 0.11.12

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

0 comments on commit f9512fe

Please sign in to comment.