diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml
index ad1c103e6..0b3223edf 100644
--- a/common/config/rush/pnpm-lock.yaml
+++ b/common/config/rush/pnpm-lock.yaml
@@ -14,7 +14,7 @@ importers:
'@types/react-dom': ^18.0.0
'@visactor/vchart': 1.3.0
'@visactor/vgrammar': ~0.5.7
- '@visactor/vrender': workspace:0.18.10
+ '@visactor/vrender': workspace:0.18.11
'@visactor/vutils': ~0.18.1
'@vitejs/plugin-react': 3.1.0
axios: ^1.4.0
@@ -71,7 +71,7 @@ importers:
'@types/react': ^18.0.0
'@types/react-dom': ^18.0.0
'@types/react-reconciler': ^0.28.2
- '@visactor/vrender': workspace:0.18.10
+ '@visactor/vrender': workspace:0.18.11
'@visactor/vutils': ~0.18.1
'@vitejs/plugin-react': 3.1.0
eslint: ~8.18.0
@@ -109,8 +109,8 @@ importers:
'@rushstack/eslint-patch': ~1.1.4
'@types/react': ^18.0.0
'@types/react-dom': ^18.0.0
- '@visactor/react-vrender': workspace:0.18.10
- '@visactor/vrender': workspace:0.18.10
+ '@visactor/react-vrender': workspace:0.18.11
+ '@visactor/vrender': workspace:0.18.11
'@visactor/vutils': ~0.18.1
'@vitejs/plugin-react': 3.1.0
eslint: ~8.18.0
@@ -149,8 +149,8 @@ importers:
'@types/jest': ^26.0.0
'@types/react': ^18.0.0
'@types/react-dom': ^18.0.0
- '@visactor/vrender-core': workspace:0.18.10
- '@visactor/vrender-kits': workspace:0.18.10
+ '@visactor/vrender-core': workspace:0.18.11
+ '@visactor/vrender-kits': workspace:0.18.11
'@visactor/vutils': ~0.18.1
'@vitejs/plugin-react': 3.1.0
canvas: 2.11.2
@@ -194,8 +194,8 @@ importers:
'@internal/ts-config': workspace:*
'@rushstack/eslint-patch': ~1.1.4
'@types/jest': ^26.0.0
- '@visactor/vrender-core': workspace:0.18.10
- '@visactor/vrender-kits': workspace:0.18.10
+ '@visactor/vrender-core': workspace:0.18.11
+ '@visactor/vrender-kits': workspace:0.18.11
'@visactor/vscale': ~0.17.3
'@visactor/vutils': ~0.18.1
eslint: ~8.18.0
@@ -277,7 +277,7 @@ importers:
'@types/node-fetch': 2.6.4
'@types/react': ^18.0.0
'@types/react-dom': ^18.0.0
- '@visactor/vrender-core': workspace:0.18.10
+ '@visactor/vrender-core': workspace:0.18.11
'@visactor/vutils': ~0.18.1
'@vitejs/plugin-react': 3.1.0
canvas: 2.11.2
@@ -357,10 +357,10 @@ importers:
'@rushstack/eslint-patch': ~1.1.4
'@types/node': '*'
'@types/node-fetch': 2.6.4
- '@visactor/vrender': workspace:0.18.10
- '@visactor/vrender-components': workspace:0.18.10
- '@visactor/vrender-core': workspace:0.18.10
- '@visactor/vrender-kits': workspace:0.18.10
+ '@visactor/vrender': workspace:0.18.11
+ '@visactor/vrender-components': workspace:0.18.11
+ '@visactor/vrender-core': workspace:0.18.11
+ '@visactor/vrender-kits': workspace:0.18.11
eslint: ~8.18.0
form-data: ~4.0.0
node-fetch: 2.6.6
diff --git a/common/config/rush/version-policies.json b/common/config/rush/version-policies.json
index 087382e55..254ff223c 100644
--- a/common/config/rush/version-policies.json
+++ b/common/config/rush/version-policies.json
@@ -1 +1 @@
-[{"definitionName":"lockStepVersion","policyName":"vrenderMain","version":"0.18.10","nextBump":"patch"}]
+[{"definitionName":"lockStepVersion","policyName":"vrenderMain","version":"0.18.11","nextBump":"patch"}]
diff --git a/docs/assets/api/en/common/graphic.md b/docs/assets/api/en/common/graphic.md
index 7d57a8fef..cc11b12dc 100644
--- a/docs/assets/api/en/common/graphic.md
+++ b/docs/assets/api/en/common/graphic.md
@@ -124,3 +124,7 @@
#${prefix} animate()()
添加动画
+
+#${prefix} stateProxy()()
+
+状态配置函数
diff --git a/docs/assets/api/zh/common/graphic.md b/docs/assets/api/zh/common/graphic.md
index 7d57a8fef..cc11b12dc 100644
--- a/docs/assets/api/zh/common/graphic.md
+++ b/docs/assets/api/zh/common/graphic.md
@@ -124,3 +124,7 @@
#${prefix} animate()()
添加动画
+
+#${prefix} stateProxy()()
+
+状态配置函数
diff --git a/docs/assets/changelog/en/changelog.md b/docs/assets/changelog/en/changelog.md
index a696194ad..748c786e8 100644
--- a/docs/assets/changelog/en/changelog.md
+++ b/docs/assets/changelog/en/changelog.md
@@ -1,3 +1,36 @@
+# v0.18.10
+
+2024-03-29
+
+
+**🐛 Bug fix**
+
+- **@visactor/vrender-components**: when user set `defaultSelected` value to be [], all legend's items should be unselected, fixed https://github.com/VisActor/VChart/issues/2445
+- **@visactor/vrender-components**: fix alignment calculation for line axis axis text, fixed https://github.com/VisActor/VChart/issues/2449
+
+
+
+[more detail about v0.18.10](https://github.com/VisActor/VRender/releases/tag/v0.18.10)
+
+# v0.18.8
+
+2024-03-29
+
+
+**🆕 New feature**
+
+- **@visactor/vrender-components**: support `inverse` in slider and size-lengend, color-legend
+
+**🐛 Bug fix**
+
+- **@visactor/vrender-kits**: fix issue with pointer tap event point map
+- **@visactor/vrender-core**: fix issue with pointer tap event point map
+- **@visactor/vrender-core**: fix issue for multi line text with underline, closed [#1100](https://github.com/VisActor/VRender/issues/1100)
+
+
+
+[more detail about v0.18.8](https://github.com/VisActor/VRender/releases/tag/v0.18.8)
+
# v0.18.7
2024-03-25
diff --git a/docs/assets/changelog/zh/changelog.md b/docs/assets/changelog/zh/changelog.md
index 58fa8cb32..bcabf3a9d 100644
--- a/docs/assets/changelog/zh/changelog.md
+++ b/docs/assets/changelog/zh/changelog.md
@@ -1,3 +1,36 @@
+# v0.18.10
+
+2024-03-29
+
+
+**🐛 功能修复**
+
+- **@visactor/vrender-components**: when user set `defaultSelected` value to be [], all legend's items should be unselected, fixed https://github.com/VisActor/VChart/issues/2445
+- **@visactor/vrender-components**: fix alignment calculation for line axis axis text, fixed https://github.com/VisActor/VChart/issues/2449
+
+
+
+[更多详情请查看 v0.18.10](https://github.com/VisActor/VRender/releases/tag/v0.18.10)
+
+# v0.18.8
+
+2024-03-29
+
+
+**🆕 新增功能**
+
+- **@visactor/vrender-components**: support `inverse` in slider and size-lengend, color-legend
+
+**🐛 功能修复**
+
+- **@visactor/vrender-kits**: fix issue with pointer tap event point map
+- **@visactor/vrender-core**: fix issue with pointer tap event point map
+- **@visactor/vrender-core**: fix issue for multi line text with underline, closed [#1100](https://github.com/VisActor/VRender/issues/1100)
+
+
+
+[更多详情请查看 v0.18.8](https://github.com/VisActor/VRender/releases/tag/v0.18.8)
+
# v0.18.7
2024-03-25
diff --git a/docs/assets/guide/en/asd/Basic_Tutorial/Jsx.md b/docs/assets/guide/en/asd/Basic_Tutorial/Jsx.md
new file mode 100644
index 000000000..f21d11d06
--- /dev/null
+++ b/docs/assets/guide/en/asd/Basic_Tutorial/Jsx.md
@@ -0,0 +1,104 @@
+# JSX Support
+
+VRender supports creating scene tree using JSX syntax. If you want to use this mode, please follow the steps below to check your environment:
+
+## Environment Configuration
+
+If you are using JSX syntax to describe scene tree nodes in a react project, you need to wrap VRender's jsx with a conversion function to convert react's virtual nodes into VRender's scene tree nodes.
+
+```ts
+const group = decodeReactDom(
+
+
+
+);
+```
+
+If your project is not a react project, you need to configure babel's jsx parsing to support jsx syntax:
+
+```ts
+plugins: [
+ react({
+ babel: {
+ parserOpts: {
+ plugins: ['decorators-legacy', 'classProperties']
+ },
+ plugins: [
+ [
+ '@babel/plugin-transform-react-jsx',
+ {
+ pragma: 'jsx',
+ pragmaFrag: 'Fragment'
+ }
+ ]
+ ]
+ }
+ })
+],
+```
+
+Then import jsx in the code:
+
+```ts
+import { jsx, VGroup, VRect } from '@visactor/vrender';
+
+const group = (
+
+
+
+);
+```
+
+## API Support
+
+The graphic elements using jsx syntax all start with V, and accept an attribute property. The parameters of this attribute property refer to the configuration document, supporting name, id, and stateProxy configurations, which will be set to the graphic element in the end. The event naming is different, and the event map is as follows:
+
+```ts
+{
+ onPointerDown: 'pointerdown',
+ onPointerUp: 'pointerup',
+ onPointerUpOutside: 'pointerupoutside',
+ onPointerTap: 'pointertap',
+ onPointerOver: 'pointerover',
+ onPointerMove: 'pointermove',
+ onPointerEnter: 'pointerenter',
+ onPointerLeave: 'pointerleave',
+ onPointerOut: 'pointerout',
+ onMouseDown: 'mousedown',
+ onMouseUp: 'mouseup',
+ onMouseUpOutside: 'mouseupoutside',
+ onMouseMove: 'mousemove',
+ onMouseOver: 'mouseover',
+ onMouseOut: 'mouseout',
+ onMouseEnter: 'mouseenter',
+ onMouseLeave: 'mouseleave',
+ onPinch: 'pinch',
+ onPinchStart: 'pinchstart',
+ onPinchEnd: 'pinchend',
+ onPan: 'pan',
+ onPanStart: 'panstart',
+ onPanEnd: 'panend',
+ onDrag: 'drag',
+ onDragStart: 'dragstart',
+ onDragEnter: 'dragenter',
+ onDragLeave: 'dragleave',
+ onDragOver: 'dragover',
+ onDragEnd: 'dragend',
+ onRightDown: 'rightdown',
+ onRightUp: 'rightup',
+ onRightUpOutside: 'rightupoutside',
+ onTouchStart: 'touchstart',
+ onTouchEnd: 'touchend',
+ onTouchEndOutside: 'touchendoutside',
+ onTouchMove: 'touchmove',
+ onTouchCancel: 'touchcancel',
+ onPress: 'press',
+ onPressUp: 'pressup',
+ onPressEnd: 'pressend',
+ onSwipe: 'swipe',
+ onDrop: 'drop',
+ onWeel: 'wheel',
+ onClick: 'click',
+ onDblClick: 'dblclick'
+}
+```
diff --git a/docs/assets/guide/menu.json b/docs/assets/guide/menu.json
index c45e29129..b3f3c8504 100644
--- a/docs/assets/guide/menu.json
+++ b/docs/assets/guide/menu.json
@@ -79,6 +79,13 @@
"zh": "扩展和插件",
"en": "Extensions and Plugins"
}
+ },
+ {
+ "path": "Jsx",
+ "title": {
+ "zh": "Jsx配置",
+ "en": "jsx config"
+ }
}
]
}
diff --git a/docs/assets/guide/zh/asd/Basic_Tutorial/Jsx.md b/docs/assets/guide/zh/asd/Basic_Tutorial/Jsx.md
new file mode 100644
index 000000000..182a209e2
--- /dev/null
+++ b/docs/assets/guide/zh/asd/Basic_Tutorial/Jsx.md
@@ -0,0 +1,105 @@
+# JSX 支持
+
+VRender 支持 JSX 形式的创建场景树,如果您需要使用这种模式,请按以下步骤检查环境:
+
+## 环境配置
+
+如果您是在 react 项目中使用 jsx 语法来描述场景树节点,那么您需要给 VRender 的 jsx 外层包裹一个转换函数,以便于将 react 的虚拟节点转换成 VRender 的场景树节点
+
+```ts
+const group = decodeReactDom(
+
+
+
+);
+```
+
+如果您的项目不是 react 项目,那么需要配置 babel 的 jsx 解析以便于支持 jsx 语法:
+
+```ts
+plugins: [
+ react({
+ babel: {
+ parserOpts: {
+ plugins: ['decorators-legacy', 'classProperties']
+ },
+ plugins: [
+ [
+ '@babel/plugin-transform-react-jsx',
+ {
+ pragma: 'jsx',
+ pragmaFrag: 'Fragment'
+ }
+ ]
+ ]
+ }
+ })
+],
+```
+
+然后在代码中 import jsx 即可
+
+```ts
+import { jsx, VGroup, VRect } from '@visactor/vrender';
+
+const group = (
+
+
+
+);
+```
+
+## API 支持
+
+使用 jsx 语法的图元都以`V`开头,接受一个 attribute 属性,这个 attribute 属性的参数具体参考配置文档,支持 name、id、stateProxy 配置,最终都会被设置到图元上
+事件命名有所不同,事件的 Map 如下所示:
+
+```ts
+{
+ onPointerDown: 'pointerdown',
+ onPointerUp: 'pointerup',
+ onPointerUpOutside: 'pointerupoutside',
+ onPointerTap: 'pointertap',
+ onPointerOver: 'pointerover',
+ onPointerMove: 'pointermove',
+ onPointerEnter: 'pointerenter',
+ onPointerLeave: 'pointerleave',
+ onPointerOut: 'pointerout',
+ onMouseDown: 'mousedown',
+ onMouseUp: 'mouseup',
+ onMouseUpOutside: 'mouseupoutside',
+ onMouseMove: 'mousemove',
+ onMouseOver: 'mouseover',
+ onMouseOut: 'mouseout',
+ onMouseEnter: 'mouseenter',
+ onMouseLeave: 'mouseleave',
+ onPinch: 'pinch',
+ onPinchStart: 'pinchstart',
+ onPinchEnd: 'pinchend',
+ onPan: 'pan',
+ onPanStart: 'panstart',
+ onPanEnd: 'panend',
+ onDrag: 'drag',
+ onDragStart: 'dragstart',
+ onDragEnter: 'dragenter',
+ onDragLeave: 'dragleave',
+ onDragOver: 'dragover',
+ onDragEnd: 'dragend',
+ onRightDown: 'rightdown',
+ onRightUp: 'rightup',
+ onRightUpOutside: 'rightupoutside',
+ onTouchStart: 'touchstart',
+ onTouchEnd: 'touchend',
+ onTouchEndOutside: 'touchendoutside',
+ onTouchMove: 'touchmove',
+ onTouchCancel: 'touchcancel',
+ onPress: 'press',
+ onPressUp: 'pressup',
+ onPressEnd: 'pressend',
+ onSwipe: 'swipe',
+ onDrop: 'drop',
+ onWeel: 'wheel',
+ onClick: 'click',
+ onDblClick: 'dblclick'
+}
+```
diff --git a/docs/package.json b/docs/package.json
index 748c2b150..15e892934 100644
--- a/docs/package.json
+++ b/docs/package.json
@@ -13,7 +13,7 @@
"@visactor/vchart": "1.3.0",
"@visactor/vutils": "~0.18.1",
"@visactor/vgrammar": "~0.5.7",
- "@visactor/vrender": "workspace:0.18.10",
+ "@visactor/vrender": "workspace:0.18.11",
"markdown-it": "^13.0.0",
"highlight.js": "^11.8.0",
"axios": "^1.4.0",
diff --git a/packages/react-vrender-utils/CHANGELOG.json b/packages/react-vrender-utils/CHANGELOG.json
index a756c600b..8772e0985 100644
--- a/packages/react-vrender-utils/CHANGELOG.json
+++ b/packages/react-vrender-utils/CHANGELOG.json
@@ -1,6 +1,12 @@
{
"name": "@visactor/react-vrender-utils",
"entries": [
+ {
+ "version": "0.18.11",
+ "tag": "@visactor/react-vrender-utils_v0.18.11",
+ "date": "Wed, 17 Apr 2024 03:02:22 GMT",
+ "comments": {}
+ },
{
"version": "0.18.10",
"tag": "@visactor/react-vrender-utils_v0.18.10",
diff --git a/packages/react-vrender-utils/CHANGELOG.md b/packages/react-vrender-utils/CHANGELOG.md
index 2586a07c0..5400e510f 100644
--- a/packages/react-vrender-utils/CHANGELOG.md
+++ b/packages/react-vrender-utils/CHANGELOG.md
@@ -1,6 +1,11 @@
# Change Log - @visactor/react-vrender-utils
-This log was last generated on Fri, 29 Mar 2024 08:02:16 GMT and should not be manually modified.
+This log was last generated on Wed, 17 Apr 2024 03:02:22 GMT and should not be manually modified.
+
+## 0.18.11
+Wed, 17 Apr 2024 03:02:22 GMT
+
+_Version update only_
## 0.18.10
Fri, 29 Mar 2024 08:02:16 GMT
diff --git a/packages/react-vrender-utils/package.json b/packages/react-vrender-utils/package.json
index 120a607ea..e76c7e5c3 100644
--- a/packages/react-vrender-utils/package.json
+++ b/packages/react-vrender-utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@visactor/react-vrender-utils",
- "version": "0.18.10",
+ "version": "0.18.11",
"description": "",
"sideEffects": false,
"main": "cjs/index.js",
@@ -24,8 +24,8 @@
"react-dom": "^18.2.0"
},
"dependencies": {
- "@visactor/vrender": "workspace:0.18.10",
- "@visactor/react-vrender": "workspace:0.18.10",
+ "@visactor/vrender": "workspace:0.18.11",
+ "@visactor/react-vrender": "workspace:0.18.11",
"@visactor/vutils": "~0.18.1",
"react-reconciler": "^0.29.0",
"tslib": "^2.3.1"
diff --git a/packages/react-vrender/CHANGELOG.json b/packages/react-vrender/CHANGELOG.json
index c6d44da62..95a8ddcf6 100644
--- a/packages/react-vrender/CHANGELOG.json
+++ b/packages/react-vrender/CHANGELOG.json
@@ -1,6 +1,12 @@
{
"name": "@visactor/react-vrender",
"entries": [
+ {
+ "version": "0.18.11",
+ "tag": "@visactor/react-vrender_v0.18.11",
+ "date": "Wed, 17 Apr 2024 03:02:22 GMT",
+ "comments": {}
+ },
{
"version": "0.18.10",
"tag": "@visactor/react-vrender_v0.18.10",
diff --git a/packages/react-vrender/CHANGELOG.md b/packages/react-vrender/CHANGELOG.md
index 61a6aca87..1649c3df2 100644
--- a/packages/react-vrender/CHANGELOG.md
+++ b/packages/react-vrender/CHANGELOG.md
@@ -1,6 +1,11 @@
# Change Log - @visactor/react-vrender
-This log was last generated on Fri, 29 Mar 2024 08:02:16 GMT and should not be manually modified.
+This log was last generated on Wed, 17 Apr 2024 03:02:22 GMT and should not be manually modified.
+
+## 0.18.11
+Wed, 17 Apr 2024 03:02:22 GMT
+
+_Version update only_
## 0.18.10
Fri, 29 Mar 2024 08:02:16 GMT
diff --git a/packages/react-vrender/package.json b/packages/react-vrender/package.json
index 99a02dc31..50a51ba0b 100644
--- a/packages/react-vrender/package.json
+++ b/packages/react-vrender/package.json
@@ -1,6 +1,6 @@
{
"name": "@visactor/react-vrender",
- "version": "0.18.10",
+ "version": "0.18.11",
"description": "",
"sideEffects": false,
"main": "cjs/index.js",
@@ -23,7 +23,7 @@
"react": "^18.2.0"
},
"dependencies": {
- "@visactor/vrender": "workspace:0.18.10",
+ "@visactor/vrender": "workspace:0.18.11",
"@visactor/vutils": "~0.18.1",
"react-reconciler": "^0.29.0",
"tslib": "^2.3.1"
diff --git a/packages/vrender-components/CHANGELOG.json b/packages/vrender-components/CHANGELOG.json
index f3a1010a0..eb54f12a8 100644
--- a/packages/vrender-components/CHANGELOG.json
+++ b/packages/vrender-components/CHANGELOG.json
@@ -1,6 +1,24 @@
{
"name": "@visactor/vrender-components",
"entries": [
+ {
+ "version": "0.18.11",
+ "tag": "@visactor/vrender-components_v0.18.11",
+ "date": "Wed, 17 Apr 2024 03:02:22 GMT",
+ "comments": {
+ "none": [
+ {
+ "comment": "fix: change click into pointup in checkbox"
+ },
+ {
+ "comment": "fix: player click event not working"
+ },
+ {
+ "comment": "fix: player slider value error after resize"
+ }
+ ]
+ }
+ },
{
"version": "0.18.10",
"tag": "@visactor/vrender-components_v0.18.10",
diff --git a/packages/vrender-components/CHANGELOG.md b/packages/vrender-components/CHANGELOG.md
index 57198c9d3..d5306af4a 100644
--- a/packages/vrender-components/CHANGELOG.md
+++ b/packages/vrender-components/CHANGELOG.md
@@ -1,6 +1,15 @@
# Change Log - @visactor/vrender-components
-This log was last generated on Fri, 29 Mar 2024 08:02:16 GMT and should not be manually modified.
+This log was last generated on Wed, 17 Apr 2024 03:02:22 GMT and should not be manually modified.
+
+## 0.18.11
+Wed, 17 Apr 2024 03:02:22 GMT
+
+### Updates
+
+- fix: change click into pointup in checkbox
+- fix: player click event not working
+- fix: player slider value error after resize
## 0.18.10
Fri, 29 Mar 2024 08:02:16 GMT
diff --git a/packages/vrender-components/__tests__/browser/examples/radio.ts b/packages/vrender-components/__tests__/browser/examples/radio.ts
new file mode 100644
index 000000000..41900bb98
--- /dev/null
+++ b/packages/vrender-components/__tests__/browser/examples/radio.ts
@@ -0,0 +1,120 @@
+import '@visactor/vrender';
+import { IPointLike } from '@visactor/vutils';
+import render from '../../util/render';
+import { Radio } from '../../../src';
+import { createLine } from '@visactor/vrender-core';
+
+export function run() {
+ const radios: Radio[] = [];
+ radios.push(
+ new Radio({
+ id: 'radio-1',
+ x: 100,
+ y: 100,
+ text: {
+ text: 'radio-1'
+ },
+ checked: false,
+ disabled: true
+ })
+ );
+
+ radios.push(
+ new Radio({
+ id: 'radio-2',
+ x: 200,
+ y: 100,
+ text: {
+ text: 'radio-2'
+ },
+ checked: false,
+ disabled: false
+ })
+ );
+
+ radios.push(
+ new Radio({
+ id: 'radio-3',
+ x: 300,
+ y: 100,
+ text: {
+ text: 'radio-3'
+ },
+ checked: true,
+ disabled: false
+ })
+ );
+
+ radios.push(
+ new Radio({
+ id: 'radio-4',
+ x: 400,
+ y: 100,
+ text: {
+ text: 'radio-4'
+ },
+ checked: true,
+ disabled: true
+ })
+ );
+
+ radios.push(
+ new Radio({
+ id: 'radio-5',
+ x: 100,
+ y: 200,
+ text: {
+ text: 'radio-5'
+ },
+ disabled: true
+ })
+ );
+
+ radios.push(
+ new Radio({
+ id: 'radio-6',
+ x: 200,
+ y: 200,
+ text: {
+ text: 'radio-6'
+ },
+ disabled: false
+ })
+ );
+
+ radios.push(
+ new Radio({
+ id: 'radio-7',
+ x: 300,
+ y: 200,
+ text: {
+ text: 'radio-7'
+ },
+ disabled: false
+ })
+ );
+
+ radios.push(
+ new Radio({
+ id: 'radio-8',
+ x: 400,
+ y: 200,
+ text: {
+ text: 'radio-8'
+ },
+ disabled: true
+ })
+ );
+
+ const stage = render(radios, 'main');
+
+ stage.addEventListener('radio_checked', e => {
+ console.log('radio_checked', e);
+ const targetRadio = e.target as Radio;
+ radios.forEach(radio => {
+ if (radio !== targetRadio) {
+ radio.setAttribute('checked', false);
+ }
+ });
+ });
+}
diff --git a/packages/vrender-components/__tests__/browser/main.ts b/packages/vrender-components/__tests__/browser/main.ts
index 79388e0ee..bda817acc 100644
--- a/packages/vrender-components/__tests__/browser/main.ts
+++ b/packages/vrender-components/__tests__/browser/main.ts
@@ -241,6 +241,10 @@ const specs = [
{
path: 'checkbox',
name: 'checkbox'
+ },
+ {
+ path: 'radio',
+ name: 'radio'
}
];
diff --git a/packages/vrender-components/__tests__/unit/player/controller.test.ts b/packages/vrender-components/__tests__/unit/player/controller.test.ts
new file mode 100644
index 000000000..24eed11c1
--- /dev/null
+++ b/packages/vrender-components/__tests__/unit/player/controller.test.ts
@@ -0,0 +1,74 @@
+import type { IGraphic, Stage } from '@visactor/vrender-core';
+import { createCanvas } from '../../util/dom';
+import { createStage } from '../../util/vrender';
+import { initBrowserEnv } from '@visactor/vrender-kits';
+import { Controller } from '../../../src/player/controller';
+import { ControllerEventEnum, ControllerTypeEnum } from '../../../src/player/controller/constant';
+initBrowserEnv();
+
+describe('PlayerController', () => {
+ let stage: Stage;
+ beforeAll(() => {
+ createCanvas(document.body, 'main');
+ stage = createStage('main');
+ });
+
+ afterAll(() => {
+ stage.release();
+ });
+
+ it('basic play/pause/forward/backward event ', async () => {
+ const controller = new Controller({
+ [ControllerTypeEnum.Start]: {},
+ [ControllerTypeEnum.Pause]: {},
+ [ControllerTypeEnum.Backward]: {},
+ [ControllerTypeEnum.Forward]: {}
+ });
+
+ stage.defaultLayer.add(controller as unknown as IGraphic);
+ stage.render();
+
+ // @ts-ignore
+ const playPromise = new Promise((resolve, reject) => {
+ // @ts-ignore
+ controller.addEventListener(ControllerEventEnum.OnPlay, () => {
+ resolve(true);
+ });
+ // @ts-ignore
+ controller.play();
+ });
+
+ const pausePromise = new Promise((resolve, reject) => {
+ // @ts-ignore
+ controller.addEventListener(ControllerEventEnum.OnPause, () => {
+ resolve(true);
+ });
+ // @ts-ignore
+ controller.pause();
+ });
+
+ const forwardPromise = new Promise((resolve, reject) => {
+ // @ts-ignore
+ controller.addEventListener(ControllerEventEnum.OnForward, () => {
+ resolve(true);
+ });
+ // @ts-ignore
+ controller.forward();
+ });
+
+ const backwardPromise = new Promise((resolve, reject) => {
+ // @ts-ignore
+ controller.addEventListener(ControllerEventEnum.OnBackward, () => {
+ resolve(true);
+ });
+ // @ts-ignore
+ controller.backward();
+ });
+
+ const res = await Promise.all([playPromise, pausePromise, forwardPromise, backwardPromise]);
+ expect(res).toEqual([true, true, true, true]);
+
+ // @ts-ignore
+ controller._dispatchEvent(ControllerEventEnum.OnPlay);
+ });
+});
diff --git a/packages/vrender-components/package.json b/packages/vrender-components/package.json
index ec13534cf..41e31f892 100644
--- a/packages/vrender-components/package.json
+++ b/packages/vrender-components/package.json
@@ -1,6 +1,6 @@
{
"name": "@visactor/vrender-components",
- "version": "0.18.10",
+ "version": "0.18.11",
"description": "components library for dp visualization",
"sideEffects": false,
"main": "cjs/index.js",
@@ -24,8 +24,8 @@
"analysis-core": "bundle -f umd -a -i core.ts"
},
"dependencies": {
- "@visactor/vrender-core": "workspace:0.18.10",
- "@visactor/vrender-kits": "workspace:0.18.10",
+ "@visactor/vrender-core": "workspace:0.18.11",
+ "@visactor/vrender-kits": "workspace:0.18.11",
"@visactor/vutils": "~0.18.1",
"@visactor/vscale": "~0.17.3"
},
diff --git a/packages/vrender-components/src/checkbox/checkbox.ts b/packages/vrender-components/src/checkbox/checkbox.ts
index 5c1ebe58d..0748605c0 100644
--- a/packages/vrender-components/src/checkbox/checkbox.ts
+++ b/packages/vrender-components/src/checkbox/checkbox.ts
@@ -69,7 +69,7 @@ export class CheckBox extends AbstractComponent> {
return undefined;
};
- this.addEventListener('click', this.handleClick);
+ this.addEventListener('pointerup', this._handlePointerUp);
}
render() {
@@ -174,7 +174,7 @@ export class CheckBox extends AbstractComponent> {
});
}
- handleClick() {
+ private _handlePointerUp = () => {
if (this.attribute.disabled) {
return;
} else if (this.attribute.checked) {
@@ -189,5 +189,5 @@ export class CheckBox extends AbstractComponent> {
eventType: 'checkbox_state_change',
checked: this.attribute.checked
});
- }
+ };
}
diff --git a/packages/vrender-components/src/index.ts b/packages/vrender-components/src/index.ts
index eb47c90ea..992ba9374 100644
--- a/packages/vrender-components/src/index.ts
+++ b/packages/vrender-components/src/index.ts
@@ -25,4 +25,5 @@ export * from './tooltip';
export * from './interface';
export * from './jsx';
export * from './checkbox';
+export * from './radio';
export * from './util';
diff --git a/packages/vrender-components/src/player/base-player.ts b/packages/vrender-components/src/player/base-player.ts
index bd8ec5c30..cd30e75c5 100644
--- a/packages/vrender-components/src/player/base-player.ts
+++ b/packages/vrender-components/src/player/base-player.ts
@@ -79,6 +79,9 @@ export class BasePlayer extends AbstractComponent>
private _size: { width: number; height: number };
private _orient: OrientType;
+ // dataIndex, 代表slider的value
+ protected _dataIndex: number = 0;
+
private _layoutInfo: {
// 滚动条位置
slider?: { x: number; y: number; size: number };
@@ -94,6 +97,7 @@ export class BasePlayer extends AbstractComponent>
super(options?.skipDefault ? attributes : merge({}, BasePlayer.defaultAttributes, attributes));
// 先初始化属性, 再初始化Slider、Controller, 最后初始化事件.
this._initAttributes();
+ this._initDataIndex();
this._initLayoutInfo();
this._initController();
this._initSlider();
@@ -127,6 +131,13 @@ export class BasePlayer extends AbstractComponent>
this._backward = { ...controller.backward };
}
+ /**
+ * 初始化dataIndex
+ */
+ _initDataIndex() {
+ this._dataIndex = this.attribute.dataIndex ?? 0;
+ }
+
private _initLayoutInfo() {
// 控制器
const controllers = [this._start, this._backward, this._forward].sort((a, b) => a.order - b.order);
@@ -216,7 +227,7 @@ export class BasePlayer extends AbstractComponent>
// 重要参数
min: this._minIndex,
max: this._maxIndex,
- value: this.attribute.dataIndex ?? 0,
+ value: this._dataIndex,
railWidth: this._railStyle.width,
railHeight: this._railStyle.height,
railStyle: this._railStyle,
diff --git a/packages/vrender-components/src/player/continuous-player.ts b/packages/vrender-components/src/player/continuous-player.ts
index 07271e665..d96bae0b1 100644
--- a/packages/vrender-components/src/player/continuous-player.ts
+++ b/packages/vrender-components/src/player/continuous-player.ts
@@ -17,7 +17,6 @@ loadContinuousPlayerComponent();
export class ContinuousPlayer extends BasePlayer implements IContinuousPlayer {
declare attribute: ContinuousPlayerAttributes;
- private _dataIndex: number;
private _activeIndex: number;
protected _alternate: boolean;
@@ -33,6 +32,7 @@ export class ContinuousPlayer extends BasePlayer imp
super(attributes);
this._initAttributes();
+ this._initDataIndex();
this._initEvents();
}
@@ -48,7 +48,6 @@ export class ContinuousPlayer extends BasePlayer imp
this._isPlaying = false;
this._elapsed = 0;
this._interval = this.attribute.interval ?? 1000;
- this._dataIndex = this.attribute.dataIndex ?? this._minIndex;
// 播放帧数(10条数据, 需要10个播放帧)
const frames = this._data.length;
@@ -66,6 +65,13 @@ export class ContinuousPlayer extends BasePlayer imp
}
};
+ /**
+ * 初始化dataIndex
+ */
+ _initDataIndex = () => {
+ this._dataIndex = this.attribute.dataIndex ?? this._minIndex;
+ };
+
/**
* 初始化事件
*/
diff --git a/packages/vrender-components/src/player/controller/controller.ts b/packages/vrender-components/src/player/controller/controller.ts
index eef734bbd..c854fc885 100644
--- a/packages/vrender-components/src/player/controller/controller.ts
+++ b/packages/vrender-components/src/player/controller/controller.ts
@@ -5,7 +5,7 @@ import type { BaseGraphicAttributes } from '../../core/type';
import type { ControllerAttributes, LayoutType } from './type';
import { iconRight, iconPause, iconPlay, iconLeft, iconUp, iconDown } from './assets';
import { PlayerIcon } from './icon';
-import { ControllerTypeEnum } from './constant';
+import { ControllerEventEnum, ControllerTypeEnum } from './constant';
import type { ComponentOptions } from '../../interface';
export class Controller extends AbstractComponent> {
@@ -182,19 +182,19 @@ export class Controller extends AbstractComponent
};
play = () => {
- this._dispatchEvent('ControllerEventEnum.OnPlay');
+ this._dispatchEvent(ControllerEventEnum.OnPlay);
};
pause = () => {
- this._dispatchEvent('ControllerEventEnum.OnPause');
+ this._dispatchEvent(ControllerEventEnum.OnPause);
};
forward = () => {
- this._dispatchEvent('ControllerEventEnum.OnForward');
+ this._dispatchEvent(ControllerEventEnum.OnForward);
};
backward = () => {
- this._dispatchEvent('ControllerEventEnum.OnBackward');
+ this._dispatchEvent(ControllerEventEnum.OnBackward);
};
togglePlay = () => {
diff --git a/packages/vrender-components/src/player/discrete-player.ts b/packages/vrender-components/src/player/discrete-player.ts
index ebce0705b..ec9856e8a 100644
--- a/packages/vrender-components/src/player/discrete-player.ts
+++ b/packages/vrender-components/src/player/discrete-player.ts
@@ -20,7 +20,6 @@ loadDiscretePlayerComponent();
export class DiscretePlayer extends BasePlayer implements IDiscretePlayer {
declare attribute: DiscretePlayerAttributes;
- private _dataIndex: number;
private _activeIndex = -1;
protected _alternate: boolean;
@@ -36,12 +35,12 @@ export class DiscretePlayer extends BasePlayer impleme
super(options?.skipDefault ? attributes : merge({}, attributes));
this._initAttributes();
+ this._initDataIndex();
this._initEvents();
}
setAttributes(params: Partial>, forceUpdateTag?: boolean): void {
super.setAttributes(params, forceUpdateTag);
-
this._initAttributes();
}
@@ -53,7 +52,12 @@ export class DiscretePlayer extends BasePlayer impleme
this._alternate = this.attribute.alternate ?? false;
this._interval = this.attribute.interval ?? 1000;
this._direction = this.attribute.direction ?? DirectionEnum.Default;
+ };
+ /**
+ * 初始化dataIndex
+ */
+ _initDataIndex = () => {
this._dataIndex = isNil(this.attribute.dataIndex)
? this._direction === 'default'
? this._minIndex
diff --git a/packages/vrender-components/src/radio/index.ts b/packages/vrender-components/src/radio/index.ts
new file mode 100644
index 000000000..37982c98e
--- /dev/null
+++ b/packages/vrender-components/src/radio/index.ts
@@ -0,0 +1,2 @@
+export * from './radio';
+export * from './type';
diff --git a/packages/vrender-components/src/radio/radio.ts b/packages/vrender-components/src/radio/radio.ts
new file mode 100644
index 000000000..9f131582c
--- /dev/null
+++ b/packages/vrender-components/src/radio/radio.ts
@@ -0,0 +1,135 @@
+import { merge } from '@visactor/vutils';
+import { AbstractComponent } from '../core/base';
+import type { RadioAttributes } from './type';
+import { Arc, WrapText } from '@visactor/vrender-core';
+import type { ComponentOptions } from '../interface';
+import { loadRadioComponent } from './register';
+
+loadRadioComponent();
+export class Radio extends AbstractComponent> {
+ static defaultAttributes: Partial = {
+ interactive: true,
+ disabled: false,
+ checked: false,
+ cursor: 'pointer',
+ disableCursor: 'not-allowed',
+ spaceBetweenTextAndIcon: 8,
+ text: {
+ text: 'text',
+ fontSize: 14,
+ fill: '#000',
+ disableFill: 'rgb(201,205,212)',
+ textBaseline: 'top',
+ pickable: false
+ },
+ circle: {
+ outerRadius: 7,
+ innerRadius: 3,
+ startAngle: 0,
+ endAngle: 2 * Math.PI,
+ fill: '#fff',
+ stroke: 'rgb(229,230,235)',
+ disableFill: 'rgb(242,243,245)',
+ checkedFill: 'rgb(22, 93, 255)',
+ checkedStroke: 'rgb(22, 93, 255)',
+ disableCheckedFill: 'rgb(148, 191, 255)',
+ disableCheckedStroke: 'rgb(148, 191, 255)',
+ pickable: false
+ }
+ };
+ _circle: Arc;
+ _text: WrapText;
+
+ constructor(attributes: RadioAttributes, options?: ComponentOptions) {
+ super(options?.skipDefault ? attributes : merge({}, Radio.defaultAttributes, attributes));
+ this.renderGroup();
+
+ this.onBeforeAttributeUpdate = (val: any, attributes: any, key: null | string | string[]) => {
+ if ('interactive' in val) {
+ this.setAttribute('pickable', val.interactive);
+ }
+ if ('disabled' in val) {
+ this.setAttribute('cursor', val.disable ? this.attribute.disableCursor : this.attribute.cursor);
+ }
+ return undefined;
+ };
+
+ this.addEventListener('pointerup', this._handlePointerUp);
+ }
+
+ render() {
+ this.removeAllChild(true);
+
+ this.renderCircle();
+ this.renderText();
+ this.layout();
+ }
+
+ renderCircle() {
+ this._circle = new Arc(merge({}, this.attribute.circle));
+ const isChecked = this.attribute.checked;
+ if (isChecked && this.attribute.disabled) {
+ this._circle.setAttributes({
+ fill: this.attribute.circle.disableCheckedFill,
+ stroke: this.attribute.circle.disableCheckedStroke
+ });
+ } else if (isChecked) {
+ this._circle.setAttributes({
+ fill: this.attribute.circle.checkedFill,
+ stroke: this.attribute.circle.checkedStroke
+ });
+ }
+ this.appendChild(this._circle);
+ }
+
+ renderText() {
+ this._text = new WrapText(merge({}, this.attribute.text));
+ if (this.attribute.disabled) {
+ this._text.setAttribute('fill', this.attribute.text.disableFill);
+ }
+ this.appendChild(this._text);
+ }
+
+ renderGroup() {
+ if (!this.attribute.interactive) {
+ this.setAttribute('pickable', false);
+ }
+ if (this.attribute.disabled) {
+ this.setAttribute('cursor', this.attribute.disableCursor);
+ }
+ }
+
+ layout() {
+ const circleHeight = this.attribute.circle.outerRadius * 2;
+ const textHeight = this._text.AABBBounds.height();
+ const maxHeight = Math.max(circleHeight, textHeight);
+ const circleY = maxHeight / 2 - circleHeight / 2 + this.attribute.circle.outerRadius;
+ const textY = maxHeight / 2 - textHeight / 2;
+
+ const circleWidth = this.attribute.circle.outerRadius * 2;
+ const circleX = this.attribute.circle.outerRadius;
+ const textX = circleWidth + this.attribute.spaceBetweenTextAndIcon;
+
+ this._circle.setAttributes({
+ x: circleX,
+ y: circleY
+ });
+ this._text.setAttributes({
+ x: textX,
+ y: textY
+ });
+ }
+
+ private _handlePointerUp = () => {
+ if (this.attribute.disabled || this.attribute.checked) {
+ // checked do nothing
+ return;
+ }
+ this.setAttribute('checked', true);
+
+ this._dispatchEvent('radio_checked', {
+ eventType: 'radio_checked',
+ target: this
+ });
+ };
+}
diff --git a/packages/vrender-components/src/radio/register.ts b/packages/vrender-components/src/radio/register.ts
new file mode 100644
index 000000000..8ead5e220
--- /dev/null
+++ b/packages/vrender-components/src/radio/register.ts
@@ -0,0 +1,8 @@
+import { registerGroup, registerImage, registerRect, registerWrapText } from '@visactor/vrender-kits';
+
+export function loadRadioComponent() {
+ registerGroup();
+ registerRect();
+ registerWrapText();
+ registerImage();
+}
diff --git a/packages/vrender-components/src/radio/type.ts b/packages/vrender-components/src/radio/type.ts
new file mode 100644
index 000000000..6365c4b9b
--- /dev/null
+++ b/packages/vrender-components/src/radio/type.ts
@@ -0,0 +1,41 @@
+import type {
+ Cursor,
+ IArcGraphicAttribute,
+ IColor,
+ IGroupGraphicAttribute,
+ IWrapTextGraphicAttribute
+} from '@visactor/vrender-core';
+
+export type RadioText = {
+ disableFill?: IColor;
+} & IWrapTextGraphicAttribute;
+
+export type CircleStyle = {
+ disableFill?: IColor;
+ checkedFill?: IColor;
+ checkedStroke?: IColor;
+ disableCheckedFill?: IColor;
+ disableCheckedStroke?: IColor;
+} & IArcGraphicAttribute;
+
+export type RadioAttributes = IGroupGraphicAttribute & {
+ id?: string;
+
+ interactive?: boolean;
+ disabled?: boolean;
+ checked?: boolean;
+
+ /**
+ * 图例文字
+ */
+ text?: RadioText;
+ /**
+ * 图例选中图标
+ */
+ circle?: CircleStyle;
+ /**
+ * 图例选中图标
+ */
+ disableCursor?: Cursor;
+ spaceBetweenTextAndIcon?: number;
+};
diff --git a/packages/vrender-core/CHANGELOG.json b/packages/vrender-core/CHANGELOG.json
index 689200bf2..159814d10 100644
--- a/packages/vrender-core/CHANGELOG.json
+++ b/packages/vrender-core/CHANGELOG.json
@@ -1,6 +1,30 @@
{
"name": "@visactor/vrender-core",
"entries": [
+ {
+ "version": "0.18.11",
+ "tag": "@visactor/vrender-core_v0.18.11",
+ "date": "Wed, 17 Apr 2024 03:02:22 GMT",
+ "comments": {
+ "none": [
+ {
+ "comment": "feat: 支持background-opacity配置"
+ },
+ {
+ "comment": "fix: fix issue with wh changed by flex layout, closed #1088"
+ },
+ {
+ "comment": "fix: pointerenter and pointerleave do not bubble, fixed #1132"
+ },
+ {
+ "comment": "fix: fix for dragenter triggering error in drag event"
+ },
+ {
+ "comment": "fix: fix memory issue with stage timeline and DefaultRenderService"
+ }
+ ]
+ }
+ },
{
"version": "0.18.10",
"tag": "@visactor/vrender-core_v0.18.10",
diff --git a/packages/vrender-core/CHANGELOG.md b/packages/vrender-core/CHANGELOG.md
index 69ec67056..c7a492794 100644
--- a/packages/vrender-core/CHANGELOG.md
+++ b/packages/vrender-core/CHANGELOG.md
@@ -1,6 +1,17 @@
# Change Log - @visactor/vrender-core
-This log was last generated on Fri, 29 Mar 2024 08:02:16 GMT and should not be manually modified.
+This log was last generated on Wed, 17 Apr 2024 03:02:22 GMT and should not be manually modified.
+
+## 0.18.11
+Wed, 17 Apr 2024 03:02:22 GMT
+
+### Updates
+
+- feat: 支持background-opacity配置
+- fix: fix issue with wh changed by flex layout, closed #1088
+- fix: pointerenter and pointerleave do not bubble, fixed #1132
+- fix: fix for dragenter triggering error in drag event
+- fix: fix memory issue with stage timeline and DefaultRenderService
## 0.18.10
Fri, 29 Mar 2024 08:02:16 GMT
diff --git a/packages/vrender-core/package.json b/packages/vrender-core/package.json
index 0eb4a6375..357b42eba 100644
--- a/packages/vrender-core/package.json
+++ b/packages/vrender-core/package.json
@@ -1,6 +1,6 @@
{
"name": "@visactor/vrender-core",
- "version": "0.18.10",
+ "version": "0.18.11",
"description": "",
"sideEffects": [
"./src/modules.ts",
diff --git a/packages/vrender-core/src/core/stage.ts b/packages/vrender-core/src/core/stage.ts
index b3ef04c65..b8af44fc7 100644
--- a/packages/vrender-core/src/core/stage.ts
+++ b/packages/vrender-core/src/core/stage.ts
@@ -882,6 +882,7 @@ export class Stage extends Group implements IStage {
});
this.interactiveLayer && this.interactiveLayer.release();
this.window.release();
+ this.ticker.remTimeline(this.timeline);
}
setStage(stage?: IStage) {
diff --git a/packages/vrender-core/src/event/event-manager.ts b/packages/vrender-core/src/event/event-manager.ts
index 874dac534..d888e22e3 100644
--- a/packages/vrender-core/src/event/event-manager.ts
+++ b/packages/vrender-core/src/event/event-manager.ts
@@ -285,7 +285,7 @@ export class EventManager {
leaveEvent.eventPhase = leaveEvent.AT_TARGET;
- while (leaveEvent.target && !e.composedPath().includes(leaveEvent.target)) {
+ if (leaveEvent.target && !e.composedPath().includes(leaveEvent.target)) {
leaveEvent.currentTarget = leaveEvent.target;
this.notifyTarget(leaveEvent);
@@ -293,7 +293,7 @@ export class EventManager {
this.notifyTarget(leaveEvent, 'mouseleave');
}
- leaveEvent.target = leaveEvent.target.parent as IEventTarget;
+ // leaveEvent.target = leaveEvent.target.parent as IEventTarget;
}
this.freeEvent(leaveEvent);
@@ -327,8 +327,8 @@ export class EventManager {
const enterEvent = this.clonePointerEvent(e, 'pointerenter');
enterEvent.eventPhase = enterEvent.AT_TARGET;
-
- while (enterEvent.target && enterEvent.target !== outTarget && enterEvent.target !== this.rootTarget.parent) {
+ // 不冒泡
+ if (enterEvent.target && enterEvent.target !== outTarget && enterEvent.target !== this.rootTarget.parent) {
enterEvent.currentTarget = enterEvent.target;
this.notifyTarget(enterEvent);
@@ -336,7 +336,7 @@ export class EventManager {
this.notifyTarget(enterEvent, 'mouseenter');
}
- enterEvent.target = enterEvent.target.parent as IEventTarget;
+ // enterEvent.target = enterEvent.target.parent as IEventTarget;
}
this.freeEvent(enterEvent);
@@ -388,7 +388,7 @@ export class EventManager {
enterEvent.eventPhase = enterEvent.AT_TARGET;
- while (enterEvent.target && enterEvent.target !== this.rootTarget.parent) {
+ if (enterEvent.target && enterEvent.target !== this.rootTarget.parent) {
enterEvent.currentTarget = enterEvent.target;
this.notifyTarget(enterEvent);
@@ -396,7 +396,7 @@ export class EventManager {
this.notifyTarget(enterEvent, 'mouseenter');
}
- enterEvent.target = enterEvent.target.parent as IEventTarget;
+ // enterEvent.target = enterEvent.target.parent as IEventTarget;
}
trackingData.overTargets = e.composedPath();
@@ -429,7 +429,7 @@ export class EventManager {
leaveEvent.eventPhase = leaveEvent.AT_TARGET;
- while (leaveEvent.target && leaveEvent.target !== this.rootTarget.parent) {
+ if (leaveEvent.target && leaveEvent.target !== this.rootTarget.parent) {
leaveEvent.currentTarget = leaveEvent.target;
this.notifyTarget(leaveEvent);
@@ -437,7 +437,7 @@ export class EventManager {
this.notifyTarget(leaveEvent, 'mouseleave');
}
- leaveEvent.target = leaveEvent.target.parent as IEventTarget;
+ // leaveEvent.target = leaveEvent.target.parent as IEventTarget;
}
trackingData.overTargets = [];
diff --git a/packages/vrender-core/src/event/event-target.ts b/packages/vrender-core/src/event/event-target.ts
index 95a4a318c..a0bbf9dcb 100644
--- a/packages/vrender-core/src/event/event-target.ts
+++ b/packages/vrender-core/src/event/event-target.ts
@@ -30,8 +30,8 @@ import { FederatedEvent, CustomEvent } from './federated-event';
*/
export const EventTarget: Omit> = {
- pickable: true,
- visible: true,
+ // pickable: true,
+ // visible: true,
// attribute: {},
/**
diff --git a/packages/vrender-core/src/graphic/config.ts b/packages/vrender-core/src/graphic/config.ts
index c4655d793..e27efa28e 100644
--- a/packages/vrender-core/src/graphic/config.ts
+++ b/packages/vrender-core/src/graphic/config.ts
@@ -123,6 +123,7 @@ export const DefaultPickStyle: IPickStyle = {
export const DefaultStyle: IGraphicStyle = {
opacity: 1,
background: null,
+ backgroundOpacity: 1,
backgroundCornerRadius: 0,
texture: null,
textureColor: 'black',
diff --git a/packages/vrender-core/src/interface/animate.ts b/packages/vrender-core/src/interface/animate.ts
index b28892cc8..ff01ba159 100644
--- a/packages/vrender-core/src/interface/animate.ts
+++ b/packages/vrender-core/src/interface/animate.ts
@@ -342,4 +342,5 @@ export interface ITicker {
start: (force?: boolean) => boolean;
stop: () => void;
addTimeline: (timeline: ITimeline) => void;
+ remTimeline: (timeline: ITimeline) => void;
}
diff --git a/packages/vrender-core/src/interface/event.ts b/packages/vrender-core/src/interface/event.ts
index 71ea4f2bc..485c37c57 100644
--- a/packages/vrender-core/src/interface/event.ts
+++ b/packages/vrender-core/src/interface/event.ts
@@ -167,19 +167,12 @@ export interface IFederatedPointerEvent extends IFederatedMouseEvent {
*/
export interface IEventTarget extends INode {
- /** Whether this event target should fire UI events. */
- pickable: boolean;
/** The parent of this event target. */
parent: IEventTarget | null;
- /** Whether this event target should be visible. */
- visible: boolean;
/** The children of this event target. */
children?: IEventTarget[];
- /** Whether this event target has any children that need UI events. This can be used optimize event propagation. */
- childrenPickable?: boolean;
-
attribute?: Partial;
emit: (eventName: any, data: Dict) => boolean;
diff --git a/packages/vrender-core/src/interface/graphic.ts b/packages/vrender-core/src/interface/graphic.ts
index 415d7d3c6..30a0c5425 100644
--- a/packages/vrender-core/src/interface/graphic.ts
+++ b/packages/vrender-core/src/interface/graphic.ts
@@ -193,6 +193,7 @@ export type IGraphicStyle = ILayout &
backgroundMode: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat'; // 填充模式(与具体图元有关)
backgroundFit: boolean; // 是否正好填充,只在repeat-x或者repeat-y以及no-repeat的时候生效
backgroundCornerRadius: number | number[];
+ backgroundOpacity: number;
background:
| IBackgroundType
| {
diff --git a/packages/vrender-core/src/plugins/builtin-plugin/flex-layout-plugin.ts b/packages/vrender-core/src/plugins/builtin-plugin/flex-layout-plugin.ts
index f0918f060..40c192a82 100644
--- a/packages/vrender-core/src/plugins/builtin-plugin/flex-layout-plugin.ts
+++ b/packages/vrender-core/src/plugins/builtin-plugin/flex-layout-plugin.ts
@@ -94,8 +94,16 @@ export class FlexLayoutPlugin implements IPlugin {
height = childrenHeight;
}
- p.attribute.width = width;
- p.attribute.height = height;
+ if (p.attribute.width == null) {
+ p.attribute.width = width;
+ } else {
+ width = p.attribute.width;
+ }
+ if (p.attribute.height == null) {
+ p.attribute.height = height;
+ } else {
+ height = p.attribute.height;
+ }
// 这里使用p._AABBBounds可能会将非布局造成的bounds更新也会触发重新布局
// TODO: 增加layout前预处理,在非递归布局前将子节点及其全部父节点_AABBBounds更新
diff --git a/packages/vrender-core/src/render/contributions/render/contributions/base-contribution-render.ts b/packages/vrender-core/src/render/contributions/render/contributions/base-contribution-render.ts
index 0396d04a8..560f7de7d 100644
--- a/packages/vrender-core/src/render/contributions/render/contributions/base-contribution-render.ts
+++ b/packages/vrender-core/src/render/contributions/render/contributions/base-contribution-render.ts
@@ -38,6 +38,8 @@ export class DefaultBaseBackgroundRenderContribution implements IBaseRenderContr
) {
const {
background,
+ backgroundOpacity = graphic.attribute.fillOpacity ?? graphicAttribute.backgroundOpacity,
+ opacity = graphicAttribute.opacity,
backgroundMode = graphicAttribute.backgroundMode,
backgroundFit = graphicAttribute.backgroundFit
} = graphic.attribute;
@@ -62,6 +64,7 @@ export class DefaultBaseBackgroundRenderContribution implements IBaseRenderContr
context.clip();
const b = graphic.AABBBounds;
context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute);
+ context.globalAlpha = backgroundOpacity * opacity;
this.doDrawImage(context, res.data, b, backgroundMode, backgroundFit);
context.restore();
if (!graphic.transMatrix.onlyTranslate()) {
@@ -70,6 +73,7 @@ export class DefaultBaseBackgroundRenderContribution implements IBaseRenderContr
} else {
context.highPerformanceSave();
context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute);
+ context.globalAlpha = backgroundOpacity * opacity;
context.fillStyle = background as string;
context.fill();
context.highPerformanceRestore();
diff --git a/packages/vrender-core/src/render/render-service.ts b/packages/vrender-core/src/render/render-service.ts
index a533df861..604aab5c7 100644
--- a/packages/vrender-core/src/render/render-service.ts
+++ b/packages/vrender-core/src/render/render-service.ts
@@ -68,5 +68,7 @@ export class DefaultRenderService implements IRenderService {
this.beforeDraw(params);
this.draw(params);
this.afterDraw(params);
+ this.drawParams = null;
+ this.renderTreeRoots = [];
}
}
diff --git a/packages/vrender-kits/CHANGELOG.json b/packages/vrender-kits/CHANGELOG.json
index 70ca69cbd..12597e2fa 100644
--- a/packages/vrender-kits/CHANGELOG.json
+++ b/packages/vrender-kits/CHANGELOG.json
@@ -1,6 +1,18 @@
{
"name": "@visactor/vrender-kits",
"entries": [
+ {
+ "version": "0.18.11",
+ "tag": "@visactor/vrender-kits_v0.18.11",
+ "date": "Wed, 17 Apr 2024 03:02:22 GMT",
+ "comments": {
+ "none": [
+ {
+ "comment": "fix: fix for dragenter triggering error in drag event"
+ }
+ ]
+ }
+ },
{
"version": "0.18.10",
"tag": "@visactor/vrender-kits_v0.18.10",
diff --git a/packages/vrender-kits/CHANGELOG.md b/packages/vrender-kits/CHANGELOG.md
index 458f4061e..4d23f2802 100644
--- a/packages/vrender-kits/CHANGELOG.md
+++ b/packages/vrender-kits/CHANGELOG.md
@@ -1,6 +1,13 @@
# Change Log - @visactor/vrender-kits
-This log was last generated on Fri, 29 Mar 2024 08:02:16 GMT and should not be manually modified.
+This log was last generated on Wed, 17 Apr 2024 03:02:22 GMT and should not be manually modified.
+
+## 0.18.11
+Wed, 17 Apr 2024 03:02:22 GMT
+
+### Updates
+
+- fix: fix for dragenter triggering error in drag event
## 0.18.10
Fri, 29 Mar 2024 08:02:16 GMT
diff --git a/packages/vrender-kits/package.json b/packages/vrender-kits/package.json
index c0e99372a..f551c472f 100644
--- a/packages/vrender-kits/package.json
+++ b/packages/vrender-kits/package.json
@@ -1,6 +1,6 @@
{
"name": "@visactor/vrender-kits",
- "version": "0.18.10",
+ "version": "0.18.11",
"description": "",
"sideEffects": false,
"main": "cjs/index.js",
@@ -20,7 +20,7 @@
"test": ""
},
"dependencies": {
- "@visactor/vrender-core": "workspace:0.18.10",
+ "@visactor/vrender-core": "workspace:0.18.11",
"@visactor/vutils": "~0.18.1",
"@resvg/resvg-js": "2.4.1",
"roughjs": "4.5.2"
diff --git a/packages/vrender-kits/src/event/extension/drag.ts b/packages/vrender-kits/src/event/extension/drag.ts
index c8c9056a5..9d44787c9 100644
--- a/packages/vrender-kits/src/event/extension/drag.ts
+++ b/packages/vrender-kits/src/event/extension/drag.ts
@@ -49,11 +49,11 @@ export class DragNDrop implements IEventExtension {
if (!isRoot) {
// 获取当前坐标系的元素,目前认为所有的元素都是可以 dropable 的
- (target as IEventTarget).pickable = false;
+ (target as IEventTarget).attribute.pickable = false;
// @ts-ignore
const clickResult = rootNode?.pick(moveEvent.global.x, moveEvent.global.y);
const elemBelow = clickResult.graphic;
- (target as IEventTarget).pickable = true;
+ (target as IEventTarget).attribute.pickable = true;
if (currentDroppable !== elemBelow) {
if (currentDroppable) {
diff --git a/packages/vrender/CHANGELOG.json b/packages/vrender/CHANGELOG.json
index c2745dbc0..1f8231dca 100644
--- a/packages/vrender/CHANGELOG.json
+++ b/packages/vrender/CHANGELOG.json
@@ -1,6 +1,12 @@
{
"name": "@visactor/vrender",
"entries": [
+ {
+ "version": "0.18.11",
+ "tag": "@visactor/vrender_v0.18.11",
+ "date": "Wed, 17 Apr 2024 03:02:22 GMT",
+ "comments": {}
+ },
{
"version": "0.18.10",
"tag": "@visactor/vrender_v0.18.10",
diff --git a/packages/vrender/CHANGELOG.md b/packages/vrender/CHANGELOG.md
index 9978d6368..d768b4c17 100644
--- a/packages/vrender/CHANGELOG.md
+++ b/packages/vrender/CHANGELOG.md
@@ -1,6 +1,11 @@
# Change Log - @visactor/vrender
-This log was last generated on Fri, 29 Mar 2024 08:02:16 GMT and should not be manually modified.
+This log was last generated on Wed, 17 Apr 2024 03:02:22 GMT and should not be manually modified.
+
+## 0.18.11
+Wed, 17 Apr 2024 03:02:22 GMT
+
+_Version update only_
## 0.18.10
Fri, 29 Mar 2024 08:02:16 GMT
diff --git a/packages/vrender/package.json b/packages/vrender/package.json
index 38730b239..3236e44d0 100644
--- a/packages/vrender/package.json
+++ b/packages/vrender/package.json
@@ -1,6 +1,6 @@
{
"name": "@visactor/vrender",
- "version": "0.18.10",
+ "version": "0.18.11",
"description": "",
"sideEffects": true,
"main": "cjs/index.js",
@@ -24,8 +24,8 @@
"test-watch": "DEBUG_MODE=1 jest --watch"
},
"dependencies": {
- "@visactor/vrender-core": "workspace:0.18.10",
- "@visactor/vrender-kits": "workspace:0.18.10"
+ "@visactor/vrender-core": "workspace:0.18.11",
+ "@visactor/vrender-kits": "workspace:0.18.11"
},
"devDependencies": {
"@internal/bundler": "workspace:*",
diff --git a/tools/bugserver-trigger/package.json b/tools/bugserver-trigger/package.json
index 18095bb3f..051f4b464 100644
--- a/tools/bugserver-trigger/package.json
+++ b/tools/bugserver-trigger/package.json
@@ -8,10 +8,10 @@
"ci": "ts-node --transpileOnly --skipProject ./scripts/trigger-test.ts"
},
"dependencies": {
- "@visactor/vrender": "workspace:0.18.10",
- "@visactor/vrender-core": "workspace:0.18.10",
- "@visactor/vrender-kits": "workspace:0.18.10",
- "@visactor/vrender-components": "workspace:0.18.10"
+ "@visactor/vrender": "workspace:0.18.11",
+ "@visactor/vrender-core": "workspace:0.18.11",
+ "@visactor/vrender-kits": "workspace:0.18.11",
+ "@visactor/vrender-components": "workspace:0.18.11"
},
"devDependencies": {
"@rushstack/eslint-patch": "~1.1.4",