Skip to content

Commit

Permalink
Release (#1644)
Browse files Browse the repository at this point in the history
* Fix 1641 (#1642)

* fix: support shadowRoot #1641

* chore: commit changeset

* chore: remove gui from test cases for now

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

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 Mar 19, 2024
1 parent 0bb1bbe commit acd120e
Show file tree
Hide file tree
Showing 99 changed files with 478 additions and 82 deletions.
7 changes: 3 additions & 4 deletions __tests__/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as lil from 'lil-gui';
import { runtime, Canvas, CanvasEvent } from '../packages/g';
import { Renderer as CanvasRenderer } from '../packages/g-canvas';
import { Renderer as CanvaskitRenderer } from '../packages/g-canvaskit';
Expand Down Expand Up @@ -209,10 +208,10 @@ function createSpecRender(object) {
window.__g_instances__ = [canvas];

// GUI
const gui = new lil.GUI({ autoPlace: false });
$div.appendChild(gui.domElement);
// const gui = new lil.GUI({ autoPlace: false });
// $div.appendChild(gui.domElement);

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

if (
selectRenderer.value === 'canvas' &&
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'],
};
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.25

### Patch Changes

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

## 1.2.24

### 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.24",
"version": "1.2.25",
"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.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
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.28",
"version": "1.11.29",
"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.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
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.28",
"version": "0.10.29",
"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.24

### Patch Changes

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

## 1.9.23

### 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.23",
"version": "1.9.24",
"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.24

### Patch Changes

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

## 1.2.23

### 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.23",
"version": "1.2.24",
"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.27

### Patch Changes

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

## 2.2.26

### 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.26",
"version": "2.2.27",
"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.24

### Patch Changes

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

## 0.7.23

### 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.23",
"version": "0.7.24",
"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.24

### Patch Changes

- 10397c19: Support shadowRoot when picking.

## 1.2.23

### 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.23",
"version": "1.2.24",
"description": "A core module for rendering engine implements DOM API.",
"keywords": [
"antv",
Expand Down
20 changes: 6 additions & 14 deletions packages/g-lite/src/plugins/EventPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,12 @@ export class EventPlugin implements RenderingPlugin {
const $element =
this.context.contextService.getDomElement() as HTMLCanvasElement;

let outside = 'outside';
try {
outside =
$element &&
nativeEvent.target &&
nativeEvent.target !== $element &&
$element.contains &&
!$element.contains(nativeEvent.target as Node)
? 'outside'
: '';
} catch (e) {
// nativeEvent.target maybe not Node, such as Window
// @see https://github.com/antvis/G/issues/1235
}
const isNativeEventFromCanvas =
this.context.eventService.isNativeEventFromCanvas(
$element,
nativeEvent,
);
const outside = !isNativeEventFromCanvas ? 'outside' : '';
const normalizedEvents = this.normalizeToPointerEvent(
nativeEvent,
canvas,
Expand Down
31 changes: 22 additions & 9 deletions packages/g-lite/src/services/EventService.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import EventEmitter from 'eventemitter3';
import { mat4, vec3 } from 'gl-matrix';
import type { CanvasContext, GlobalRuntime } from '..';
import type { CanvasContext, GlobalRuntime, InteractivePointerEvent } from '..';
import type { HTML } from '../display-objects';
import type { FederatedEvent } from '../dom/FederatedEvent';
import { FederatedMouseEvent } from '../dom/FederatedMouseEvent';
Expand Down Expand Up @@ -709,10 +709,16 @@ export class EventService {
* whether the native event trigger came from Canvas,
* should account for HTML shape
*/
private isNativeEventFromCanvas(event: FederatedEvent) {
const $el = this.context.contextService.getDomElement();

const target = event.nativeEvent?.target;
isNativeEventFromCanvas(
$el: HTMLCanvasElement,
nativeEvent: InteractivePointerEvent,
) {
let target = nativeEvent?.target as Element;
// Get event target inside a web component.
// @see https://stackoverflow.com/questions/57963312/get-event-target-inside-a-web-component
if (target?.shadowRoot) {
target = nativeEvent.composedPath()[0] as Element;
}

if (target) {
// from <canvas>
Expand All @@ -726,8 +732,8 @@ export class EventService {
}
}

if (event.nativeEvent.composedPath) {
return event.nativeEvent.composedPath().indexOf($el as EventTarget) > -1;
if (nativeEvent?.composedPath) {
return nativeEvent.composedPath().indexOf($el as EventTarget) > -1;
}

// account for Touch
Expand Down Expand Up @@ -779,10 +785,13 @@ export class EventService {
event.originalEvent = from;

const existedHTML = this.getExistedHTML(event);
const $el =
this.context.contextService.getDomElement() as HTMLCanvasElement;
event.target =
target ??
(existedHTML ||
(this.isNativeEventFromCanvas(event) && this.pickTarget(event)) ||
(this.isNativeEventFromCanvas($el, event.nativeEvent) &&
this.pickTarget(event)) ||
fallbackTarget);

if (typeof type === 'string') {
Expand All @@ -802,9 +811,13 @@ export class EventService {
event.nativeEvent = from.nativeEvent;
event.originalEvent = from;
const existedHTML = this.getExistedHTML(event);

const $el =
this.context.contextService.getDomElement() as HTMLCanvasElement;
event.target =
existedHTML ||
(this.isNativeEventFromCanvas(event) && this.pickTarget(event));
(this.isNativeEventFromCanvas($el, event.nativeEvent) &&
this.pickTarget(event));
return event;
}

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.24

### Patch Changes

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

## 0.2.23

### 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.23",
"version": "0.2.24",
"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.24

### Patch Changes

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

## 0.8.23

### 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.23",
"version": "0.8.24",
"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.17

### 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-dragndrop@1.8.24
- @antv/g-plugin-gesture@1.2.12
- @antv/g-plugin-image-loader@1.3.24
- @antv/g-plugin-mobile-interaction@0.9.24

## 0.11.16

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

## 0.10.29

### Patch Changes

- Updated dependencies [10397c19]
- @antv/g-plugin-svg-picker@1.9.28
- @antv/g-lite@1.2.24
- @antv/g-plugin-dragndrop@1.8.24
- @antv/g-plugin-gesture@1.2.12
- @antv/g-plugin-mobile-interaction@0.9.24
- @antv/g-plugin-svg-renderer@1.10.28

## 0.10.28

### 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.28",
"version": "0.10.29",
"description": "A renderer implemented by SVG in mobile environment",
"keywords": [
"antv",
Expand Down
Loading

0 comments on commit acd120e

Please sign in to comment.