From 0dc10f61e020d6e65410cdbe48ce61148f37b8a7 Mon Sep 17 00:00:00 2001 From: zhouxinyu Date: Tue, 20 Jun 2023 14:49:48 +0800 Subject: [PATCH 01/24] fix: fix the error of options3d default value --- .../fix-options3d_2023-06-20-06-50.json | 10 +++++++ docs/demos/src/pages/chart.ts | 27 ++++++++----------- packages/vrender/src/core/stage.ts | 11 +++++++- 3 files changed, 31 insertions(+), 17 deletions(-) create mode 100644 common/changes/@visactor/vrender/fix-options3d_2023-06-20-06-50.json diff --git a/common/changes/@visactor/vrender/fix-options3d_2023-06-20-06-50.json b/common/changes/@visactor/vrender/fix-options3d_2023-06-20-06-50.json new file mode 100644 index 000000000..acfef67ef --- /dev/null +++ b/common/changes/@visactor/vrender/fix-options3d_2023-06-20-06-50.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender", + "comment": "fix the error of options3d default value", + "type": "patch" + } + ], + "packageName": "@visactor/vrender" +} \ No newline at end of file diff --git a/docs/demos/src/pages/chart.ts b/docs/demos/src/pages/chart.ts index 4d90faae7..8cec03f59 100644 --- a/docs/demos/src/pages/chart.ts +++ b/docs/demos/src/pages/chart.ts @@ -18,7 +18,7 @@ import { AnimateGroup, AttributeAnimate } from '@visactor/vrender'; -// import { json3 } from './json'; +import { json } from './json'; // import { json3 } from './xtable'; import { roughModule } from '@visactor/vrender-kits'; @@ -28,7 +28,6 @@ let arcList = []; function _add(group, json) { if (json.type === 'group') { const g = createGroup(json.attribute); - g.setMode('3d'); group.add(g); json.children && json.children.forEach(item => { @@ -44,7 +43,7 @@ function _add(group, json) { t.setAttribute('fill', 'red'); }); } else if (json.type === 'symbol') { - const s = createSymbol({ ...json.attribute, symbolType: 'square', keepDirIn3d: true }); + const s = createSymbol({ ...json.attribute, keepDirIn3d: true }); // s.animate().to({ scaleX: 0.5, scaleY: 0.5 }, 1000, 'linear'); s.addEventListener('mouseenter', () => { s.setAttribute('fill', 'red'); @@ -76,28 +75,24 @@ export const page = () => { canvas: c as HTMLCanvasElement, width: 802, height: 500, - disableDirtyBounds: false + disableDirtyBounds: true, canvasControled: true, autoRender: true }); const layer = stage.at(0); - // json3.children[0].children.forEach(item => { - // _add(layer, item); - // }); + json.children[0].children.forEach(item => { + _add(layer, item); + }); stage.set3dOptions({ alpha: 0, - beta: 0, - center: { x: 400, y: 250 }, - fieldRatio: 0.8, - light: { - dir: [1, -2, -1], - color: 'white', - ambient: 0.7 - } + // beta: 0, + enable: true }); + stage.children[0].children[0].setMode('3d'); + const group = stage.defaultLayer.getChildren()[0] as IGroup; // group.setAttribute('fill', 'green'); @@ -126,5 +121,5 @@ export const page = () => { stage.render(undefined, {}); }); - // stage.enableView3dTransform(); + stage.enableView3dTransform(); }; diff --git a/packages/vrender/src/core/stage.ts b/packages/vrender/src/core/stage.ts index 2b5188d1e..efe1cebe4 100644 --- a/packages/vrender/src/core/stage.ts +++ b/packages/vrender/src/core/stage.ts @@ -258,7 +258,6 @@ export class Stage extends Group implements IStage { } set3dOptions(options: IOption3D) { - this.option3d = options; const { center = { x: this.width / 2, y: this.height / 2 }, light = {}, @@ -268,6 +267,16 @@ export class Stage extends Group implements IStage { fieldRatio = 1, fieldDepth } = options; + this.option3d = { + ...options, + center, + light, + alpha, + beta, + camera, + fieldRatio, + fieldDepth + }; const { dir = [1, 1, -1], color = 'white', ambient } = light; const centerVec3: vec3 = [center.x, center.y, 0]; From e661a72197e2ec1ff977c94a4924ed3101463072 Mon Sep 17 00:00:00 2001 From: zhouxinyu Date: Tue, 20 Jun 2023 15:05:43 +0800 Subject: [PATCH 02/24] fix: fix the bug of gradient color while the x1 in color is zero caused by || --- ...radient-color-offset_2023-06-20-07-06.json | 10 ++++++++ packages/vrender/src/common/canvas-utils.ts | 24 +++++++++---------- 2 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 common/changes/@visactor/vrender/fix-gradient-color-offset_2023-06-20-07-06.json diff --git a/common/changes/@visactor/vrender/fix-gradient-color-offset_2023-06-20-07-06.json b/common/changes/@visactor/vrender/fix-gradient-color-offset_2023-06-20-07-06.json new file mode 100644 index 000000000..807305ee5 --- /dev/null +++ b/common/changes/@visactor/vrender/fix-gradient-color-offset_2023-06-20-07-06.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender", + "comment": "fix the bug of gradient color while the x1 in color is zero caused by ||", + "type": "patch" + } + ], + "packageName": "@visactor/vrender" +} \ No newline at end of file diff --git a/packages/vrender/src/common/canvas-utils.ts b/packages/vrender/src/common/canvas-utils.ts index f13837eee..cedf7f8a1 100644 --- a/packages/vrender/src/common/canvas-utils.ts +++ b/packages/vrender/src/common/canvas-utils.ts @@ -77,10 +77,10 @@ function createLinearGradient( } const canvasGradient = context.createLinearGradient( - x + (color.x0 || 0) * w, - y + (color.y0 || 0) * h, - x + (color.x1 || 1) * w, - y + (color.y1 || 0) * h + x + (color.x0 ?? 0) * w, + y + (color.y0 ?? 0) * h, + x + (color.x1 ?? 1) * w, + y + (color.y1 ?? 0) * h ); color.stops.forEach(stop => { canvasGradient.addColorStop(stop.offset, stop.color); @@ -114,12 +114,12 @@ function createRadialGradient( h /= scaleY; } const canvasGradient = context.createRadialGradient( - x + (color.x0 || 0.5) * w, - y + (color.y0 || 0.5) * h, - Math.max(w, h) * (color.r0 || 0), - x + (color.x1 || 0.5) * w, - y + (color.y1 || 0.5) * h, - Math.max(w, h) * (color.r1 || 0.5) + x + (color.x0 ?? 0.5) * w, + y + (color.y0 ?? 0.5) * h, + Math.max(w, h) * (color.r0 ?? 0), + x + (color.x1 ?? 0.5) * w, + y + (color.y1 ?? 0.5) * h, + Math.max(w, h) * (color.r1 ?? 0.5) ); color.stops.forEach(stop => { canvasGradient.addColorStop(stop.offset, stop.color); @@ -154,8 +154,8 @@ function createConicGradient( } const canvasGradient = context.createConicGradient( - x + (color.x || 0) * w, - y + (color.y || 0) * h, + x + (color.x ?? 0) * w, + y + (color.y ?? 0) * h, color.startAngle, color.endAngle ); From f5570b5ae59f80a8c522164b05a447546033ad42 Mon Sep 17 00:00:00 2001 From: zhouxinyu Date: Tue, 20 Jun 2023 15:26:15 +0800 Subject: [PATCH 03/24] feat: move enableView3dTransform into options3d --- .../@visactor/vrender/develop_2023-06-20-07-26.json | 10 ++++++++++ packages/vrender/src/core/stage.ts | 7 ++++--- packages/vrender/src/interface/stage.ts | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 common/changes/@visactor/vrender/develop_2023-06-20-07-26.json diff --git a/common/changes/@visactor/vrender/develop_2023-06-20-07-26.json b/common/changes/@visactor/vrender/develop_2023-06-20-07-26.json new file mode 100644 index 000000000..b59d745ac --- /dev/null +++ b/common/changes/@visactor/vrender/develop_2023-06-20-07-26.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender", + "comment": "move enableView3dTransform into options3d", + "type": "minor" + } + ], + "packageName": "@visactor/vrender" +} \ No newline at end of file diff --git a/packages/vrender/src/core/stage.ts b/packages/vrender/src/core/stage.ts index 2b5188d1e..190b34926 100644 --- a/packages/vrender/src/core/stage.ts +++ b/packages/vrender/src/core/stage.ts @@ -247,9 +247,6 @@ export class Stage extends Group implements IStage { if (params.disableDirtyBounds === false) { this.enableDirtyBounds(); } - if (params.enableView3dTransform) { - this.enableView3dTransform(); - } this.hooks.beforeRender.tap('constructor', this.beforeRender); this.hooks.afterRender.tap('constructor', this.afterRender); this._beforeRender = params.beforeRender; @@ -300,6 +297,10 @@ export class Stage extends Group implements IStage { } else { this.camera = new OrthoCamera(cameraParams); } + + if (options.enableView3dTransform) { + this.enableView3dTransform(); + } } protected beforeRender = (stage: IStage) => { diff --git a/packages/vrender/src/interface/stage.ts b/packages/vrender/src/interface/stage.ts index 05f4e14ae..94a6d0819 100644 --- a/packages/vrender/src/interface/stage.ts +++ b/packages/vrender/src/interface/stage.ts @@ -40,7 +40,6 @@ export interface IStageParams { title: string; autoRender: boolean; disableDirtyBounds: boolean; - enableView3dTransform: boolean; // 是否开启view3d自动旋转 // 绘制之前的钩子函数 beforeRender: (stage: IStage) => void; // 绘制之后的钩子函数 @@ -50,6 +49,7 @@ export interface IStageParams { } export interface IOption3D { + enableView3dTransform?: boolean; // 是否开启view3d自动旋转 alpha?: number; // x轴的转角 beta?: number; // y轴的转角 gama?: number; // z轴的转角 From 95751e99adddbb45ccadcbc79b069cc1d7b4a12f Mon Sep 17 00:00:00 2001 From: zhouxinyu Date: Tue, 20 Jun 2023 16:51:58 +0800 Subject: [PATCH 04/24] feat: update vUtils version --- ...chore-update-version_2023-06-20-08-54.json | 10 + ...chore-update-version_2023-06-20-08-54.json | 10 + ...chore-update-version_2023-06-20-08-54.json | 10 + ...chore-update-version_2023-06-20-08-54.json | 10 + ...chore-update-version_2023-06-20-08-54.json | 10 + docs/demos/package.json | 2 +- packages/react-vrender-utils/package.json | 2 +- packages/react-vrender/package.json | 2 +- packages/vrender-components/package.json | 2 +- packages/vrender-kits/package.json | 2 +- .../src/canvas/contributions/canvas-module.ts | 10 +- .../src/canvas/contributions/node/canvas.ts | 340 ++++++++-------- .../src/canvas/contributions/node/context.ts | 52 +-- .../src/canvas/contributions/node/index.ts | 6 +- .../src/canvas/contributions/node/modules.ts | 34 +- packages/vrender-kits/src/canvas/index.ts | 2 +- .../src/env/contributions/module.ts | 14 +- .../env/contributions/node-contribution.ts | 378 +++++++++--------- packages/vrender-kits/src/index-node.ts | 6 +- packages/vrender-kits/src/index.ts | 4 +- packages/vrender-kits/src/node-bind.ts | 20 +- .../src/window/contributions/modules.ts | 16 +- .../window/contributions/node-contribution.ts | 314 +++++++-------- packages/vrender/package.json | 2 +- 24 files changed, 654 insertions(+), 604 deletions(-) create mode 100644 common/changes/@visactor/react-vrender-utils/chore-update-version_2023-06-20-08-54.json create mode 100644 common/changes/@visactor/react-vrender/chore-update-version_2023-06-20-08-54.json create mode 100644 common/changes/@visactor/vrender-components/chore-update-version_2023-06-20-08-54.json create mode 100644 common/changes/@visactor/vrender-kits/chore-update-version_2023-06-20-08-54.json create mode 100644 common/changes/@visactor/vrender/chore-update-version_2023-06-20-08-54.json diff --git a/common/changes/@visactor/react-vrender-utils/chore-update-version_2023-06-20-08-54.json b/common/changes/@visactor/react-vrender-utils/chore-update-version_2023-06-20-08-54.json new file mode 100644 index 000000000..3c8b318bb --- /dev/null +++ b/common/changes/@visactor/react-vrender-utils/chore-update-version_2023-06-20-08-54.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/react-vrender-utils", + "comment": "update vUtils version", + "type": "minor" + } + ], + "packageName": "@visactor/react-vrender-utils" +} \ No newline at end of file diff --git a/common/changes/@visactor/react-vrender/chore-update-version_2023-06-20-08-54.json b/common/changes/@visactor/react-vrender/chore-update-version_2023-06-20-08-54.json new file mode 100644 index 000000000..652d80a1a --- /dev/null +++ b/common/changes/@visactor/react-vrender/chore-update-version_2023-06-20-08-54.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/react-vrender", + "comment": "update vUtils version", + "type": "minor" + } + ], + "packageName": "@visactor/react-vrender" +} \ No newline at end of file diff --git a/common/changes/@visactor/vrender-components/chore-update-version_2023-06-20-08-54.json b/common/changes/@visactor/vrender-components/chore-update-version_2023-06-20-08-54.json new file mode 100644 index 000000000..e2f33d6cd --- /dev/null +++ b/common/changes/@visactor/vrender-components/chore-update-version_2023-06-20-08-54.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender-components", + "comment": "update vUtils version", + "type": "minor" + } + ], + "packageName": "@visactor/vrender-components" +} \ No newline at end of file diff --git a/common/changes/@visactor/vrender-kits/chore-update-version_2023-06-20-08-54.json b/common/changes/@visactor/vrender-kits/chore-update-version_2023-06-20-08-54.json new file mode 100644 index 000000000..05d0eaa90 --- /dev/null +++ b/common/changes/@visactor/vrender-kits/chore-update-version_2023-06-20-08-54.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender-kits", + "comment": "update vUtils version", + "type": "minor" + } + ], + "packageName": "@visactor/vrender-kits" +} \ No newline at end of file diff --git a/common/changes/@visactor/vrender/chore-update-version_2023-06-20-08-54.json b/common/changes/@visactor/vrender/chore-update-version_2023-06-20-08-54.json new file mode 100644 index 000000000..e5a1c9452 --- /dev/null +++ b/common/changes/@visactor/vrender/chore-update-version_2023-06-20-08-54.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender", + "comment": "update vUtils version", + "type": "minor" + } + ], + "packageName": "@visactor/vrender" +} \ No newline at end of file diff --git a/docs/demos/package.json b/docs/demos/package.json index 68c99ebdd..ccb442bef 100644 --- a/docs/demos/package.json +++ b/docs/demos/package.json @@ -11,7 +11,7 @@ "devDependencies": { "@internal/eslint-config": "workspace:*", "@internal/ts-config": "workspace:*", - "@visactor/vutils": "0.9.0-alpha.2", + "@visactor/vutils": "~0.11.0", "@visactor/vrender-kits": "workspace:0.10.3", "d3-scale-chromatic": "^3.0.0", "lodash": "4.17.21", diff --git a/packages/react-vrender-utils/package.json b/packages/react-vrender-utils/package.json index ab8b69697..9d7fb6d45 100644 --- a/packages/react-vrender-utils/package.json +++ b/packages/react-vrender-utils/package.json @@ -27,7 +27,7 @@ "dependencies": { "@visactor/vrender": "workspace:0.10.3", "@visactor/react-vrender": "workspace:0.10.3", - "@visactor/vutils": "0.9.0-alpha.2", + "@visactor/vutils": "~0.11.0", "react-reconciler": "^0.29.0", "tslib": "^2.3.1" }, diff --git a/packages/react-vrender/package.json b/packages/react-vrender/package.json index 408ee8fc6..c68dfd9ef 100644 --- a/packages/react-vrender/package.json +++ b/packages/react-vrender/package.json @@ -25,7 +25,7 @@ }, "dependencies": { "@visactor/vrender": "workspace:0.10.3", - "@visactor/vutils": "0.9.0-alpha.2", + "@visactor/vutils": "~0.11.0", "react-reconciler": "^0.29.0", "tslib": "^2.3.1" }, diff --git a/packages/vrender-components/package.json b/packages/vrender-components/package.json index 1d0cd09f5..0f6004f9f 100644 --- a/packages/vrender-components/package.json +++ b/packages/vrender-components/package.json @@ -25,7 +25,7 @@ }, "dependencies": { "@visactor/vrender": "workspace:0.10.3", - "@visactor/vutils": "0.9.0-alpha.2", + "@visactor/vutils": "~0.11.0", "@visactor/vscale": "0.9.0-alpha.2", "gl-matrix": "^3.4.3" }, diff --git a/packages/vrender-kits/package.json b/packages/vrender-kits/package.json index 28fd65293..986160aa7 100644 --- a/packages/vrender-kits/package.json +++ b/packages/vrender-kits/package.json @@ -22,7 +22,7 @@ }, "dependencies": { "@visactor/vrender": "workspace:0.10.3", - "@visactor/vutils": "0.9.0-alpha.2", + "@visactor/vutils": "~0.11.0", "@resvg/resvg-js": "2.4.1", "canvas": "2.11.2", "inversify": "6.0.1", diff --git a/packages/vrender-kits/src/canvas/contributions/canvas-module.ts b/packages/vrender-kits/src/canvas/contributions/canvas-module.ts index 963f2e5f9..983bf41da 100644 --- a/packages/vrender-kits/src/canvas/contributions/canvas-module.ts +++ b/packages/vrender-kits/src/canvas/contributions/canvas-module.ts @@ -1,6 +1,6 @@ -import type { Container } from 'inversify'; -import nodeModule from './node/modules'; +// import type { Container } from 'inversify'; +// import nodeModule from './node/modules'; -export default function load(container: Container) { - container.load(nodeModule); -} +// export default function load(container: Container) { +// container.load(nodeModule); +// } diff --git a/packages/vrender-kits/src/canvas/contributions/node/canvas.ts b/packages/vrender-kits/src/canvas/contributions/node/canvas.ts index a621e3684..933133b46 100644 --- a/packages/vrender-kits/src/canvas/contributions/node/canvas.ts +++ b/packages/vrender-kits/src/canvas/contributions/node/canvas.ts @@ -1,170 +1,170 @@ -import { injectable } from 'inversify'; -import type { Canvas } from 'canvas'; -import type { EnvType, CanvasConfigType, ICanvas, IContext2d } from '@visactor/vrender'; -import { NodeContext2d } from './context'; - -const DefaultConfig = { - WIDTH: 500, - HEIGHT: 500, - DPR: 1 -}; - -@injectable() -export class NodeCanvas implements ICanvas { - static env: EnvType = 'node'; - // 显示的宽高,如果是离屏canvas,就是pixelWidth / pixelRatio - private _id: number | string; - - private _displayWidth: number; // 显示的宽度 - private _displayHeight: number; // 显示的高度 - // 像素宽高 - private _pixelWidth: number; // 像素宽度 - private _pixelHeight: number; // 像素高度 - - private _nativeCanvas: Canvas; - private _context: IContext2d; - private _visiable: boolean; - private controled: boolean; - private _dpr: number; - - get id(): number | string { - return this._id; - } - get x(): number { - return 0; - } - get y(): number { - return 0; - } - get nativeCanvas(): Canvas { - return this._nativeCanvas; - } - - get width(): number { - return this._pixelWidth; - } - set width(width: number) { - this._pixelWidth = width; - this._displayWidth = width / (this._dpr || 1); - } - get displayWidth(): number { - return this._pixelWidth / this._dpr; - } - - get displayHeight(): number { - return this._pixelHeight / this._dpr; - } - - get height(): number { - return this._pixelHeight; - } - set height(height: number) { - this._pixelHeight = height; - this._displayHeight = height / (this._dpr || 1); - } - getContext(str?: string): IContext2d { - return this._context; - } - - get visiable(): boolean { - return this._visiable; - } - set visiable(visiable: boolean) { - this._visiable = visiable; - visiable ? this.show() : this.hide(); - } - - get dpr(): number { - return this._dpr; - } - set dpr(dpr: number) { - this._dpr = dpr; - this.resize(this.width, this.height); - return; - } - - /** - * 通过canvas生成一个wrap对象,初始化时不会再设置canvas的属性 - * @param params - */ - constructor(params: CanvasConfigType) { - const { - nativeCanvas, - width = DefaultConfig.WIDTH, - height = DefaultConfig.HEIGHT, - canvasControled = true, - dpr = DefaultConfig.DPR - } = params; - this._visiable = params.visiable !== false; - this.controled = canvasControled; - - // 离屏canvas - this._pixelWidth = width * dpr; - this._pixelHeight = height * dpr; - this._displayWidth = width; - this._displayHeight = height; - this._nativeCanvas = nativeCanvas as unknown as Canvas; - this._context = new NodeContext2d(this, params.dpr); - this._id = nativeCanvas.id; - this._dpr = dpr; - } - - applyPosition() { - return; - } - - getNativeCanvas(): Canvas { - return this._nativeCanvas; - } - - resetStyle(params: Partial) { - return; - } - - hide() { - return; - } - show() { - return; - } - - /** - * 设置canvas的size大小,设置context的scale - * @param width - * @param height - */ - resize(width: number, height: number) { - this._pixelWidth = width * this._dpr; - this._pixelHeight = height * this._dpr; - this._displayWidth = width; - this._displayHeight = height; - if (this._nativeCanvas) { - this._nativeCanvas.width = this._pixelWidth; - this._nativeCanvas.height = this._pixelHeight; - } - return; - } - - toDataURL(): string; - toDataURL(mimeType: 'image/png'): string; - toDataURL(mimeType: 'image/jpeg', quality: number): string; - toDataURL(mimeType?: string, quality?: number) { - return ''; - } - - readPixels(x: number, y: number, w: number, h: number): ImageData | Promise { - return this._context.getImageData(x, y, w, h); - } - - convertToBlob(options?: { type?: string | undefined; quality?: number | undefined } | undefined): Promise { - throw new Error('暂未实现'); - } - - transferToImageBitmap(): ImageBitmap { - throw new Error('暂未实现'); - } - - release(...params: any): void { - throw new Error('暂不支持release'); - } -} +// import { injectable } from 'inversify'; +// import type { Canvas } from 'canvas'; +// import type { EnvType, CanvasConfigType, ICanvas, IContext2d } from '@visactor/vrender'; +// import { NodeContext2d } from './context'; + +// const DefaultConfig = { +// WIDTH: 500, +// HEIGHT: 500, +// DPR: 1 +// }; + +// @injectable() +// export class NodeCanvas implements ICanvas { +// static env: EnvType = 'node'; +// // 显示的宽高,如果是离屏canvas,就是pixelWidth / pixelRatio +// private _id: number | string; + +// private _displayWidth: number; // 显示的宽度 +// private _displayHeight: number; // 显示的高度 +// // 像素宽高 +// private _pixelWidth: number; // 像素宽度 +// private _pixelHeight: number; // 像素高度 + +// private _nativeCanvas: Canvas; +// private _context: IContext2d; +// private _visiable: boolean; +// private controled: boolean; +// private _dpr: number; + +// get id(): number | string { +// return this._id; +// } +// get x(): number { +// return 0; +// } +// get y(): number { +// return 0; +// } +// get nativeCanvas(): Canvas { +// return this._nativeCanvas; +// } + +// get width(): number { +// return this._pixelWidth; +// } +// set width(width: number) { +// this._pixelWidth = width; +// this._displayWidth = width / (this._dpr || 1); +// } +// get displayWidth(): number { +// return this._pixelWidth / this._dpr; +// } + +// get displayHeight(): number { +// return this._pixelHeight / this._dpr; +// } + +// get height(): number { +// return this._pixelHeight; +// } +// set height(height: number) { +// this._pixelHeight = height; +// this._displayHeight = height / (this._dpr || 1); +// } +// getContext(str?: string): IContext2d { +// return this._context; +// } + +// get visiable(): boolean { +// return this._visiable; +// } +// set visiable(visiable: boolean) { +// this._visiable = visiable; +// visiable ? this.show() : this.hide(); +// } + +// get dpr(): number { +// return this._dpr; +// } +// set dpr(dpr: number) { +// this._dpr = dpr; +// this.resize(this.width, this.height); +// return; +// } + +// /** +// * 通过canvas生成一个wrap对象,初始化时不会再设置canvas的属性 +// * @param params +// */ +// constructor(params: CanvasConfigType) { +// const { +// nativeCanvas, +// width = DefaultConfig.WIDTH, +// height = DefaultConfig.HEIGHT, +// canvasControled = true, +// dpr = DefaultConfig.DPR +// } = params; +// this._visiable = params.visiable !== false; +// this.controled = canvasControled; + +// // 离屏canvas +// this._pixelWidth = width * dpr; +// this._pixelHeight = height * dpr; +// this._displayWidth = width; +// this._displayHeight = height; +// this._nativeCanvas = nativeCanvas as unknown as Canvas; +// this._context = new NodeContext2d(this, params.dpr); +// this._id = nativeCanvas.id; +// this._dpr = dpr; +// } + +// applyPosition() { +// return; +// } + +// getNativeCanvas(): Canvas { +// return this._nativeCanvas; +// } + +// resetStyle(params: Partial) { +// return; +// } + +// hide() { +// return; +// } +// show() { +// return; +// } + +// /** +// * 设置canvas的size大小,设置context的scale +// * @param width +// * @param height +// */ +// resize(width: number, height: number) { +// this._pixelWidth = width * this._dpr; +// this._pixelHeight = height * this._dpr; +// this._displayWidth = width; +// this._displayHeight = height; +// if (this._nativeCanvas) { +// this._nativeCanvas.width = this._pixelWidth; +// this._nativeCanvas.height = this._pixelHeight; +// } +// return; +// } + +// toDataURL(): string; +// toDataURL(mimeType: 'image/png'): string; +// toDataURL(mimeType: 'image/jpeg', quality: number): string; +// toDataURL(mimeType?: string, quality?: number) { +// return ''; +// } + +// readPixels(x: number, y: number, w: number, h: number): ImageData | Promise { +// return this._context.getImageData(x, y, w, h); +// } + +// convertToBlob(options?: { type?: string | undefined; quality?: number | undefined } | undefined): Promise { +// throw new Error('暂未实现'); +// } + +// transferToImageBitmap(): ImageBitmap { +// throw new Error('暂未实现'); +// } + +// release(...params: any): void { +// throw new Error('暂不支持release'); +// } +// } diff --git a/packages/vrender-kits/src/canvas/contributions/node/context.ts b/packages/vrender-kits/src/canvas/contributions/node/context.ts index d97d8b2bf..ba99f36bd 100644 --- a/packages/vrender-kits/src/canvas/contributions/node/context.ts +++ b/packages/vrender-kits/src/canvas/contributions/node/context.ts @@ -1,30 +1,30 @@ -// 参考konva -import { Matrix } from '@visactor/vutils'; -import { injectable } from 'inversify'; -import type { EnvType, ICanvas, IContext2d } from '@visactor/vrender'; -import { BrowserContext2d } from '@visactor/vrender'; +// // 参考konva +// import { Matrix } from '@visactor/vutils'; +// import { injectable } from 'inversify'; +// import type { EnvType, ICanvas, IContext2d } from '@visactor/vrender'; +// import { BrowserContext2d } from '@visactor/vrender'; -// https://github.com/konvajs/konva/blob/master/src/Context.ts -const initMatrix = new Matrix(1, 0, 0, 1, 0, 0); +// // https://github.com/konvajs/konva/blob/master/src/Context.ts +// const initMatrix = new Matrix(1, 0, 0, 1, 0, 0); -@injectable() -export class NodeContext2d extends BrowserContext2d implements IContext2d { - static env: EnvType = 'node'; +// @injectable() +// export class NodeContext2d extends BrowserContext2d implements IContext2d { +// static env: EnvType = 'node'; - constructor(canvas: ICanvas, dpr: number) { - super(canvas, dpr); - const context = canvas.nativeCanvas.getContext('2d'); - if (!context) { - throw new Error('发生错误,获取2d上下文失败'); - } - this.nativeContext = context; - this.canvas = canvas; - this.matrix = new Matrix(1, 0, 0, 1, 0, 0); - this.stack = []; - this.dpr = dpr ?? 1; - } +// constructor(canvas: ICanvas, dpr: number) { +// super(canvas, dpr); +// const context = canvas.nativeCanvas.getContext('2d'); +// if (!context) { +// throw new Error('发生错误,获取2d上下文失败'); +// } +// this.nativeContext = context; +// this.canvas = canvas; +// this.matrix = new Matrix(1, 0, 0, 1, 0, 0); +// this.stack = []; +// this.dpr = dpr ?? 1; +// } - release(...params: any): void { - return; - } -} +// release(...params: any): void { +// return; +// } +// } diff --git a/packages/vrender-kits/src/canvas/contributions/node/index.ts b/packages/vrender-kits/src/canvas/contributions/node/index.ts index c50b6c64d..00c695274 100644 --- a/packages/vrender-kits/src/canvas/contributions/node/index.ts +++ b/packages/vrender-kits/src/canvas/contributions/node/index.ts @@ -1,3 +1,3 @@ -// 依然导出canvas和context,便于指定环境直接使用 -export * from './canvas'; -export * from './context'; +// // 依然导出canvas和context,便于指定环境直接使用 +// export * from './canvas'; +// export * from './context'; diff --git a/packages/vrender-kits/src/canvas/contributions/node/modules.ts b/packages/vrender-kits/src/canvas/contributions/node/modules.ts index 5a0f3ac2f..15ac31340 100644 --- a/packages/vrender-kits/src/canvas/contributions/node/modules.ts +++ b/packages/vrender-kits/src/canvas/contributions/node/modules.ts @@ -1,19 +1,19 @@ -import { ContainerModule } from 'inversify'; -import type { CanvasConfigType, ICanvas } from '@visactor/vrender'; -import { CanvasFactory, Context2dFactory } from '@visactor/vrender'; -import { NodeCanvas } from './canvas'; -import { NodeContext2d } from './context'; +// import { ContainerModule } from 'inversify'; +// import type { CanvasConfigType, ICanvas } from '@visactor/vrender'; +// import { CanvasFactory, Context2dFactory } from '@visactor/vrender'; +// import { NodeCanvas } from './canvas'; +// import { NodeContext2d } from './context'; -export default new ContainerModule(bind => { - bind(CanvasFactory) - .toDynamicValue(() => { - return (params: CanvasConfigType) => new NodeCanvas(params); - }) - .whenTargetNamed(NodeContext2d.env); +// export default new ContainerModule(bind => { +// bind(CanvasFactory) +// .toDynamicValue(() => { +// return (params: CanvasConfigType) => new NodeCanvas(params); +// }) +// .whenTargetNamed(NodeContext2d.env); - bind(Context2dFactory) - .toDynamicValue(() => { - return (params: ICanvas) => new NodeContext2d(params, params.dpr); - }) - .whenTargetNamed(NodeContext2d.env); -}); +// bind(Context2dFactory) +// .toDynamicValue(() => { +// return (params: ICanvas) => new NodeContext2d(params, params.dpr); +// }) +// .whenTargetNamed(NodeContext2d.env); +// }); diff --git a/packages/vrender-kits/src/canvas/index.ts b/packages/vrender-kits/src/canvas/index.ts index 4582f24dd..4f4577e6a 100644 --- a/packages/vrender-kits/src/canvas/index.ts +++ b/packages/vrender-kits/src/canvas/index.ts @@ -1 +1 @@ -import {} from '@visactor/vrender'; +// import {} from '@visactor/vrender'; diff --git a/packages/vrender-kits/src/env/contributions/module.ts b/packages/vrender-kits/src/env/contributions/module.ts index 487863f5c..081d0a687 100644 --- a/packages/vrender-kits/src/env/contributions/module.ts +++ b/packages/vrender-kits/src/env/contributions/module.ts @@ -1,8 +1,8 @@ -import { ContainerModule } from 'inversify'; -import { bindContributionProvider, EnvContribution } from '@visactor/vrender'; -import { NodeEnvContribution } from './node-contribution'; +// import { ContainerModule } from 'inversify'; +// import { bindContributionProvider, EnvContribution } from '@visactor/vrender'; +// import { NodeEnvContribution } from './node-contribution'; -export default new ContainerModule(bind => { - bind(NodeEnvContribution).toSelf().inSingletonScope(); - bind(EnvContribution).toService(NodeEnvContribution); -}); +// export default new ContainerModule(bind => { +// bind(NodeEnvContribution).toSelf().inSingletonScope(); +// bind(EnvContribution).toService(NodeEnvContribution); +// }); diff --git a/packages/vrender-kits/src/env/contributions/node-contribution.ts b/packages/vrender-kits/src/env/contributions/node-contribution.ts index 7b50ef5b3..a0674bf32 100644 --- a/packages/vrender-kits/src/env/contributions/node-contribution.ts +++ b/packages/vrender-kits/src/env/contributions/node-contribution.ts @@ -1,189 +1,189 @@ -import { injectable } from 'inversify'; -import type { createCanvas, createImageData, loadImage, Canvas } from 'canvas'; -import * as NodePkg from 'canvas'; -import { Resvg } from '@resvg/resvg-js'; -import type { EnvType, IEnvContribution, IGlobal, ICreateCanvasParams } from '@visactor/vrender'; -import { BaseEnvContribution } from '@visactor/vrender'; -import fetch from 'node-fetch'; - -type NodePkg = { - createCanvas: typeof createCanvas; - createImageData: typeof createImageData; - loadImage: typeof loadImage; -}; - -let last = 0; -function nodeRequestAnimationFrame(callback: FrameRequestCallback) { - const now = Date.now(); - const timeLeft = Math.max(0, 16 - (now - last)); - const id = setTimeout(function () { - callback(now + timeLeft); - }, timeLeft); - last = now + timeLeft; - return id; -} - -@injectable() -export class NodeEnvContribution extends BaseEnvContribution implements IEnvContribution { - type: EnvType = 'node'; - pkg: NodePkg; - _lastTime: number = 0; - supportEvent: boolean = false; - - configure(service: IGlobal, pkg: NodePkg = NodePkg) { - if (service.env === this.type) { - service.setActiveEnvContribution(this); - this.pkg = pkg; - } - } - - loadJson(url: string): Promise<{ - loadState: 'success' | 'fail'; - data: Record | null; - }> { - const jsonPromise = fetch(url).then(data => data.json()) as Promise; // ignore_security_alert - jsonPromise - .then(json => { - return { - data: json, - state: 'success' - }; - }) - .catch(() => { - return { - data: null, - state: 'fail' - }; - }); - return jsonPromise; - } - - loadArrayBuffer(url: string): Promise<{ - loadState: 'success' | 'fail'; - data: ArrayBuffer | null; - }> { - const arrayBufferPromise = fetch(url).then(data => data.arrayBuffer()); // ignore_security_alert - return arrayBufferPromise - .then((arrayBuffer: ArrayBuffer) => { - return { - data: arrayBuffer, - loadState: 'success' as const - }; - }) - .catch(() => { - return { - data: null, - loadState: 'fail' - }; - }); - } - - loadImage(url: string): Promise<{ - loadState: 'success' | 'fail'; - data: HTMLImageElement | null; - }> { - const { loadImage } = this.pkg; - if (loadImage) { - return loadImage(url) - .then((image: any) => { - const loadState: 'success' | 'fail' = image ? 'success' : 'fail'; - return { - loadState, - data: image as HTMLImageElement - }; - }) - .catch(() => { - return { - loadState: 'fail', - data: null - } as any; - }); - } - return Promise.reject(new Error('node-canvas loadImage could not be found!')); - } - - // 此处的 - loadSvg(svgStr: string): Promise<{ - loadState: 'success' | 'fail'; - data: HTMLImageElement | null; - }> { - // // eslint-disable-next-line @typescript-eslint/no-var-requires - // const { Resvg } = require('@resvg/resvg-js'); - if (!Resvg) { - return Promise.reject(new Error('@resvg/resvg-js svgParser could not be found!')); - } - const resvg = new Resvg(svgStr); - const pngData = resvg.render().asPng(); - return this.loadImage(pngData as unknown as string); - } - - createCanvas(params: any): Canvas { - const canvas = this.pkg.createCanvas(params.width, params.height); - return canvas; - } - - releaseCanvas(canvas: Canvas | any) { - return; - } - - getDevicePixelRatio(): number { - return 0; - } - - getRequestAnimationFrame(): (callback: FrameRequestCallback) => number { - // return requestAnimationFrame; - return nodeRequestAnimationFrame as any; - } - - addEventListener( - type: K, - listener: (this: Document, ev: DocumentEventMap[K]) => any, - options?: boolean | AddEventListenerOptions | undefined - ): void; - addEventListener( - type: string, - listener: EventListenerOrEventListenerObject, - options?: boolean | AddEventListenerOptions | undefined - ): void; - addEventListener(type: unknown, listener: unknown, options?: unknown): void { - return; - } - - removeEventListener( - type: K, - listener: (this: Document, ev: DocumentEventMap[K]) => any, - options?: boolean | EventListenerOptions | undefined - ): void; - removeEventListener( - type: string, - listener: EventListenerOrEventListenerObject, - options?: boolean | EventListenerOptions | undefined - ): void; - removeEventListener(type: unknown, listener: unknown, options?: unknown): void { - return; - } - - getElementById(str: string): HTMLElement | null { - return null; - } - - getRootElement(): HTMLElement | null { - return null; - } - - dispatchEvent(event: any): boolean { - return; - } - - getCancelAnimationFrame(): (h: number) => void { - return; - } - - release(...params: any): void { - return; - } - - createOffscreenCanvas(params: ICreateCanvasParams) { - return; - } -} +// import { injectable } from 'inversify'; +// import type { createCanvas, createImageData, loadImage, Canvas } from 'canvas'; +// import * as NodePkg from 'canvas'; +// import { Resvg } from '@resvg/resvg-js'; +// import type { EnvType, IEnvContribution, IGlobal, ICreateCanvasParams } from '@visactor/vrender'; +// import { BaseEnvContribution } from '@visactor/vrender'; +// import fetch from 'node-fetch'; + +// type NodePkg = { +// createCanvas: typeof createCanvas; +// createImageData: typeof createImageData; +// loadImage: typeof loadImage; +// }; + +// let last = 0; +// function nodeRequestAnimationFrame(callback: FrameRequestCallback) { +// const now = Date.now(); +// const timeLeft = Math.max(0, 16 - (now - last)); +// const id = setTimeout(function () { +// callback(now + timeLeft); +// }, timeLeft); +// last = now + timeLeft; +// return id; +// } + +// @injectable() +// export class NodeEnvContribution extends BaseEnvContribution implements IEnvContribution { +// type: EnvType = 'node'; +// pkg: NodePkg; +// _lastTime: number = 0; +// supportEvent: boolean = false; + +// configure(service: IGlobal, pkg: NodePkg = NodePkg) { +// if (service.env === this.type) { +// service.setActiveEnvContribution(this); +// this.pkg = pkg; +// } +// } + +// loadJson(url: string): Promise<{ +// loadState: 'success' | 'fail'; +// data: Record | null; +// }> { +// const jsonPromise = fetch(url).then(data => data.json()) as Promise; // ignore_security_alert +// jsonPromise +// .then(json => { +// return { +// data: json, +// state: 'success' +// }; +// }) +// .catch(() => { +// return { +// data: null, +// state: 'fail' +// }; +// }); +// return jsonPromise; +// } + +// loadArrayBuffer(url: string): Promise<{ +// loadState: 'success' | 'fail'; +// data: ArrayBuffer | null; +// }> { +// const arrayBufferPromise = fetch(url).then(data => data.arrayBuffer()); // ignore_security_alert +// return arrayBufferPromise +// .then((arrayBuffer: ArrayBuffer) => { +// return { +// data: arrayBuffer, +// loadState: 'success' as const +// }; +// }) +// .catch(() => { +// return { +// data: null, +// loadState: 'fail' +// }; +// }); +// } + +// loadImage(url: string): Promise<{ +// loadState: 'success' | 'fail'; +// data: HTMLImageElement | null; +// }> { +// const { loadImage } = this.pkg; +// if (loadImage) { +// return loadImage(url) +// .then((image: any) => { +// const loadState: 'success' | 'fail' = image ? 'success' : 'fail'; +// return { +// loadState, +// data: image as HTMLImageElement +// }; +// }) +// .catch(() => { +// return { +// loadState: 'fail', +// data: null +// } as any; +// }); +// } +// return Promise.reject(new Error('node-canvas loadImage could not be found!')); +// } + +// // 此处的 +// loadSvg(svgStr: string): Promise<{ +// loadState: 'success' | 'fail'; +// data: HTMLImageElement | null; +// }> { +// // // eslint-disable-next-line @typescript-eslint/no-var-requires +// // const { Resvg } = require('@resvg/resvg-js'); +// if (!Resvg) { +// return Promise.reject(new Error('@resvg/resvg-js svgParser could not be found!')); +// } +// const resvg = new Resvg(svgStr); +// const pngData = resvg.render().asPng(); +// return this.loadImage(pngData as unknown as string); +// } + +// createCanvas(params: any): Canvas { +// const canvas = this.pkg.createCanvas(params.width, params.height); +// return canvas; +// } + +// releaseCanvas(canvas: Canvas | any) { +// return; +// } + +// getDevicePixelRatio(): number { +// return 0; +// } + +// getRequestAnimationFrame(): (callback: FrameRequestCallback) => number { +// // return requestAnimationFrame; +// return nodeRequestAnimationFrame as any; +// } + +// addEventListener( +// type: K, +// listener: (this: Document, ev: DocumentEventMap[K]) => any, +// options?: boolean | AddEventListenerOptions | undefined +// ): void; +// addEventListener( +// type: string, +// listener: EventListenerOrEventListenerObject, +// options?: boolean | AddEventListenerOptions | undefined +// ): void; +// addEventListener(type: unknown, listener: unknown, options?: unknown): void { +// return; +// } + +// removeEventListener( +// type: K, +// listener: (this: Document, ev: DocumentEventMap[K]) => any, +// options?: boolean | EventListenerOptions | undefined +// ): void; +// removeEventListener( +// type: string, +// listener: EventListenerOrEventListenerObject, +// options?: boolean | EventListenerOptions | undefined +// ): void; +// removeEventListener(type: unknown, listener: unknown, options?: unknown): void { +// return; +// } + +// getElementById(str: string): HTMLElement | null { +// return null; +// } + +// getRootElement(): HTMLElement | null { +// return null; +// } + +// dispatchEvent(event: any): boolean { +// return; +// } + +// getCancelAnimationFrame(): (h: number) => void { +// return; +// } + +// release(...params: any): void { +// return; +// } + +// createOffscreenCanvas(params: ICreateCanvasParams) { +// return; +// } +// } diff --git a/packages/vrender-kits/src/index-node.ts b/packages/vrender-kits/src/index-node.ts index 60d78cacf..658c7cbbf 100644 --- a/packages/vrender-kits/src/index-node.ts +++ b/packages/vrender-kits/src/index-node.ts @@ -1,7 +1,7 @@ import 'reflect-metadata'; import _roughModule from './render/contributions/rough/module'; -import _canvasModuleLoader from './canvas/contributions/canvas-module'; +// import _canvasModuleLoader from './canvas/contributions/canvas-module'; export const roughModule = _roughModule; -export const canvasModuleLoader = _canvasModuleLoader; -export { nodeLoader } from './node-bind'; +// export const canvasModuleLoader = _canvasModuleLoader; +// export { nodeLoader } from './node-bind'; diff --git a/packages/vrender-kits/src/index.ts b/packages/vrender-kits/src/index.ts index a3cc8e7ba..3399a1eb5 100644 --- a/packages/vrender-kits/src/index.ts +++ b/packages/vrender-kits/src/index.ts @@ -1,7 +1,7 @@ import 'reflect-metadata'; import _roughModule from './render/contributions/rough/module'; -import _canvasModuleLoader from './canvas/contributions/canvas-module'; +// import _canvasModuleLoader from './canvas/contributions/canvas-module'; export const roughModule = _roughModule; -export const canvasModuleLoader = _canvasModuleLoader; +// export const canvasModuleLoader = _canvasModuleLoader; // export { nodeLoader } from './node-bind'; // nodeLoader只在node入口暴露 diff --git a/packages/vrender-kits/src/node-bind.ts b/packages/vrender-kits/src/node-bind.ts index bc16d2d90..4a8e98e51 100644 --- a/packages/vrender-kits/src/node-bind.ts +++ b/packages/vrender-kits/src/node-bind.ts @@ -1,11 +1,11 @@ -import type { Container } from 'inversify'; -import nodeEnv from './env/contributions/module'; -import nodeWindow from './window/contributions/modules'; -import nodeCanvas from './canvas/contributions/node/modules'; +// import type { Container } from 'inversify'; +// import nodeEnv from './env/contributions/module'; +// import nodeWindow from './window/contributions/modules'; +// import nodeCanvas from './canvas/contributions/node/modules'; -// 直接绑定node环境 -export function nodeLoader(container: Container) { - container.load(nodeEnv); - container.load(nodeWindow); - container.load(nodeCanvas); -} +// // 直接绑定node环境 +// export function nodeLoader(container: Container) { +// container.load(nodeEnv); +// container.load(nodeWindow); +// container.load(nodeCanvas); +// } diff --git a/packages/vrender-kits/src/window/contributions/modules.ts b/packages/vrender-kits/src/window/contributions/modules.ts index 31ae8d625..1294c7b7e 100644 --- a/packages/vrender-kits/src/window/contributions/modules.ts +++ b/packages/vrender-kits/src/window/contributions/modules.ts @@ -1,9 +1,9 @@ -import { ContainerModule } from 'inversify'; -import { bindContributionProvider, WindowHandlerContribution } from '@visactor/vrender'; -import { NodeWindowHandlerContribution } from './node-contribution'; +// import { ContainerModule } from 'inversify'; +// import { bindContributionProvider, WindowHandlerContribution } from '@visactor/vrender'; +// import { NodeWindowHandlerContribution } from './node-contribution'; -export default new ContainerModule(bind => { - bind(NodeWindowHandlerContribution).toSelf().inSingletonScope(); - bind(WindowHandlerContribution).toService(NodeWindowHandlerContribution); - // bindContributionProvider(bind, WindowHandlerContribution); -}); +// export default new ContainerModule(bind => { +// bind(NodeWindowHandlerContribution).toSelf().inSingletonScope(); +// bind(WindowHandlerContribution).toService(NodeWindowHandlerContribution); +// // bindContributionProvider(bind, WindowHandlerContribution); +// }); diff --git a/packages/vrender-kits/src/window/contributions/node-contribution.ts b/packages/vrender-kits/src/window/contributions/node-contribution.ts index 38cc3efac..116562cf4 100644 --- a/packages/vrender-kits/src/window/contributions/node-contribution.ts +++ b/packages/vrender-kits/src/window/contributions/node-contribution.ts @@ -1,157 +1,157 @@ -import { inject, injectable } from 'inversify'; -import type { - EnvType, - IGlobal, - IWindowHandlerContribution, - IWindowParams, - IContext2d, - ICanvas, - IDomRectLike -} from '@visactor/vrender'; -import { Generator, Global, BaseWindowHandlerContribution } from '@visactor/vrender'; -import { NodeCanvas } from '../../canvas/contributions/node/canvas'; -import type { IBoundsLike } from '@visactor/vutils'; - -@injectable() -export class NodeWindowHandlerContribution extends BaseWindowHandlerContribution implements IWindowHandlerContribution { - type: EnvType = 'node'; - - canvas: ICanvas; - get container(): HTMLElement | null { - return null; - } - - constructor(@inject(Global) private readonly global: IGlobal) { - super(); - } - - getTitle(): string { - return ''; - } - - getWH(): { width: number; height: number } { - return { - width: this.canvas.displayWidth, - height: this.canvas.displayHeight - }; - } - - getXY(): { x: number; y: number } { - return { x: 0, y: 0 }; - } - - createWindow(params: IWindowParams): void { - // 如果没有传入canvas,那么就创建一个canvas - if (!params.canvas) { - this.createWindowByConfig(params); - } else { - this.createWindowByCanvas(params); - } - } - private createWindowByConfig(params: IWindowParams) { - // 创建canvas - const nativeCanvas = this.global.createCanvas({ width: params.width, height: params.height }); - - // 绑定 - const options = { - width: params.width, - height: params.height, - dpr: params.dpr, - nativeCanvas, - id: Generator.GenAutoIncrementId().toString(), - canvasControled: true - }; - this.canvas = new NodeCanvas(options); - } - private createWindowByCanvas(params: IWindowParams) { - // 获取canvas - const canvas = params!.canvas as HTMLCanvasElement | null; - - // 如果没有传入wh,或者是不受控制的canvas,那就用canvas的原始wh - let width = params.width; - let height = params.height; - if (width == null || height == null || !params.canvasControled) { - width = canvas.width; - height = canvas.height; - } - - this.canvas = new NodeCanvas({ - width: width, - height: height, - dpr: 1, - nativeCanvas: canvas, - canvasControled: params.canvasControled - }); - } - releaseWindow(): void { - this.canvas.release(); - } - resizeWindow(width: number, height: number): void { - this.canvas.resize(width, height); - } - setDpr(dpr: number): void { - this.canvas.dpr = dpr; - } - - getContext(): IContext2d { - return this.canvas.getContext(); - } - getNativeHandler(): ICanvas { - return this.canvas; - } - getDpr(): number { - return this.canvas.dpr; - } - - getImageBuffer(type: string = 'image/png'): any { - const canvas = this.canvas.nativeCanvas; - return canvas.toBuffer(type); - } - - addEventListener( - type: K, - listener: (this: Document, ev: DocumentEventMap[K]) => any, - options?: boolean | AddEventListenerOptions - ): void; - addEventListener( - type: string, - listener: EventListenerOrEventListenerObject, - options?: boolean | AddEventListenerOptions - ): void; - addEventListener(type: unknown, listener: unknown, options?: unknown): void { - return; - } - - dispatchEvent(event: any): boolean { - return true; - } - - removeEventListener( - type: K, - listener: (this: Document, ev: DocumentEventMap[K]) => any, - options?: boolean | EventListenerOptions - ): void; - removeEventListener( - type: string, - listener: EventListenerOrEventListenerObject, - options?: boolean | EventListenerOptions - ): void; - removeEventListener(type: unknown, listener: unknown, options?: unknown): void { - return; - } - - getStyle(): CSSStyleDeclaration | Record { - return; - } - setStyle(style: CSSStyleDeclaration | Record): void { - return; - } - - getBoundingClientRect(): IDomRectLike { - return null; - } - - clearViewBox(vb: IBoundsLike, color?: string): void { - return; - } -} +// import { inject, injectable } from 'inversify'; +// import type { +// EnvType, +// IGlobal, +// IWindowHandlerContribution, +// IWindowParams, +// IContext2d, +// ICanvas, +// IDomRectLike +// } from '@visactor/vrender'; +// import { Generator, Global, BaseWindowHandlerContribution } from '@visactor/vrender'; +// import { NodeCanvas } from '../../canvas/contributions/node/canvas'; +// import type { IBoundsLike } from '@visactor/vutils'; + +// @injectable() +// export class NodeWindowHandlerContribution extends BaseWindowHandlerContribution implements IWindowHandlerContribution { +// type: EnvType = 'node'; + +// canvas: ICanvas; +// get container(): HTMLElement | null { +// return null; +// } + +// constructor(@inject(Global) private readonly global: IGlobal) { +// super(); +// } + +// getTitle(): string { +// return ''; +// } + +// getWH(): { width: number; height: number } { +// return { +// width: this.canvas.displayWidth, +// height: this.canvas.displayHeight +// }; +// } + +// getXY(): { x: number; y: number } { +// return { x: 0, y: 0 }; +// } + +// createWindow(params: IWindowParams): void { +// // 如果没有传入canvas,那么就创建一个canvas +// if (!params.canvas) { +// this.createWindowByConfig(params); +// } else { +// this.createWindowByCanvas(params); +// } +// } +// private createWindowByConfig(params: IWindowParams) { +// // 创建canvas +// const nativeCanvas = this.global.createCanvas({ width: params.width, height: params.height }); + +// // 绑定 +// const options = { +// width: params.width, +// height: params.height, +// dpr: params.dpr, +// nativeCanvas, +// id: Generator.GenAutoIncrementId().toString(), +// canvasControled: true +// }; +// this.canvas = new NodeCanvas(options); +// } +// private createWindowByCanvas(params: IWindowParams) { +// // 获取canvas +// const canvas = params!.canvas as HTMLCanvasElement | null; + +// // 如果没有传入wh,或者是不受控制的canvas,那就用canvas的原始wh +// let width = params.width; +// let height = params.height; +// if (width == null || height == null || !params.canvasControled) { +// width = canvas.width; +// height = canvas.height; +// } + +// this.canvas = new NodeCanvas({ +// width: width, +// height: height, +// dpr: 1, +// nativeCanvas: canvas, +// canvasControled: params.canvasControled +// }); +// } +// releaseWindow(): void { +// this.canvas.release(); +// } +// resizeWindow(width: number, height: number): void { +// this.canvas.resize(width, height); +// } +// setDpr(dpr: number): void { +// this.canvas.dpr = dpr; +// } + +// getContext(): IContext2d { +// return this.canvas.getContext(); +// } +// getNativeHandler(): ICanvas { +// return this.canvas; +// } +// getDpr(): number { +// return this.canvas.dpr; +// } + +// getImageBuffer(type: string = 'image/png'): any { +// const canvas = this.canvas.nativeCanvas; +// return canvas.toBuffer(type); +// } + +// addEventListener( +// type: K, +// listener: (this: Document, ev: DocumentEventMap[K]) => any, +// options?: boolean | AddEventListenerOptions +// ): void; +// addEventListener( +// type: string, +// listener: EventListenerOrEventListenerObject, +// options?: boolean | AddEventListenerOptions +// ): void; +// addEventListener(type: unknown, listener: unknown, options?: unknown): void { +// return; +// } + +// dispatchEvent(event: any): boolean { +// return true; +// } + +// removeEventListener( +// type: K, +// listener: (this: Document, ev: DocumentEventMap[K]) => any, +// options?: boolean | EventListenerOptions +// ): void; +// removeEventListener( +// type: string, +// listener: EventListenerOrEventListenerObject, +// options?: boolean | EventListenerOptions +// ): void; +// removeEventListener(type: unknown, listener: unknown, options?: unknown): void { +// return; +// } + +// getStyle(): CSSStyleDeclaration | Record { +// return; +// } +// setStyle(style: CSSStyleDeclaration | Record): void { +// return; +// } + +// getBoundingClientRect(): IDomRectLike { +// return null; +// } + +// clearViewBox(vb: IBoundsLike, color?: string): void { +// return; +// } +// } diff --git a/packages/vrender/package.json b/packages/vrender/package.json index bd4692b90..6025fd1a5 100644 --- a/packages/vrender/package.json +++ b/packages/vrender/package.json @@ -23,7 +23,7 @@ "ci": "node github-ci.js" }, "dependencies": { - "@visactor/vutils": "0.9.0-alpha.2", + "@visactor/vutils": "~0.11.0", "color-convert": "2.0.1", "inversify": "6.0.1", "reflect-metadata": "0.1.13" From 141b1a9253aeb7a13efda4f236ab6483c293903c Mon Sep 17 00:00:00 2001 From: Howard Zhang Date: Tue, 20 Jun 2023 17:29:15 +0800 Subject: [PATCH 05/24] fix: tooltip shape position --- packages/vrender-components/src/tooltip/tooltip.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vrender-components/src/tooltip/tooltip.ts b/packages/vrender-components/src/tooltip/tooltip.ts index 24a9f1c91..a619314e4 100644 --- a/packages/vrender-components/src/tooltip/tooltip.ts +++ b/packages/vrender-components/src/tooltip/tooltip.ts @@ -148,11 +148,11 @@ export class Tooltip extends AbstractComponent> { `${itemGroupName}-${TOOLTIP_SHAPE_NAME_SUFFIX}`, { visible: true, + x: itemAttr.shape.size / 2, ...itemAttr.shape }, 'symbol' ) as ISymbol; - // shape.setAttribute('x', itemAttr.shape.size / 2); element.setAttribute('y', itemAttr.height / 2); } if (hasContentShape) { From 3376debc56ccb77a9e2dea48947bc711b224e75c Mon Sep 17 00:00:00 2001 From: Howard Zhang Date: Tue, 20 Jun 2023 17:31:54 +0800 Subject: [PATCH 06/24] chore: update changes --- .../fix-tooltip-shape-position_2023-06-20-09-31.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 common/changes/@visactor/vrender-components/fix-tooltip-shape-position_2023-06-20-09-31.json diff --git a/common/changes/@visactor/vrender-components/fix-tooltip-shape-position_2023-06-20-09-31.json b/common/changes/@visactor/vrender-components/fix-tooltip-shape-position_2023-06-20-09-31.json new file mode 100644 index 000000000..1b90d1dce --- /dev/null +++ b/common/changes/@visactor/vrender-components/fix-tooltip-shape-position_2023-06-20-09-31.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender-components", + "comment": "fix the position offset of the tooltip content shape", + "type": "patch" + } + ], + "packageName": "@visactor/vrender-components" +} \ No newline at end of file From 6d01e843242bffc04190bb1fc3d9c9b9fea48ffc Mon Sep 17 00:00:00 2001 From: zhouxinyu Date: Tue, 20 Jun 2023 17:58:08 +0800 Subject: [PATCH 07/24] feat: rename all of the borderRadius to cornerRadius, closed #20 --- ...border-radius-rename_2023-06-20-09-59.json | 10 +++ ...border-radius-rename_2023-06-20-09-59.json | 10 +++ docs/demos/src/interactive/rect.ts | 2 +- docs/demos/src/pages/bar3d.ts | 2 +- docs/demos/src/pages/layer.ts | 12 +-- docs/demos/src/pages/morphing.ts | 2 +- docs/demos/src/pages/polygon.ts | 7 +- docs/demos/src/pages/rect.ts | 6 +- docs/demos/src/pages/scroll.ts | 16 ++-- docs/demos/src/pages/stage.ts | 12 +-- docs/demos/src/pages/test-arc-path.ts | 4 +- docs/demos/src/render/rect.ts | 2 +- .../browser/examples/color-legend.ts | 8 +- .../browser/examples/discrete-legend.ts | 2 +- .../__tests__/browser/examples/mark-area.ts | 10 +-- .../__tests__/browser/examples/player.ts | 6 +- .../__tests__/browser/examples/slider.ts | 12 +-- .../__tests__/browser/examples/tag.ts | 2 +- .../__tests__/unit/pager.test.ts | 2 +- .../__tests__/unit/slider.test.ts | 8 +- .../src/crosshair/circle.ts | 3 +- .../src/data-zoom/config.ts | 4 +- .../vrender-components/src/marker/config.ts | 4 +- .../src/player/base-player.ts | 2 +- .../src/scrollbar/scrollbar.ts | 4 +- .../vrender-components/src/slider/slider.ts | 2 +- .../vrender-components/src/tooltip/config.ts | 2 +- packages/vrender/src/common/polygon.ts | 4 +- packages/vrender/src/common/shape/rect.ts | 90 +++++++++---------- packages/vrender/src/graphic/config.ts | 10 +-- packages/vrender/src/graphic/polygon.ts | 2 +- packages/vrender/src/graphic/rect.ts | 2 +- .../vrender/src/interface/graphic/glyph.ts | 2 +- .../vrender/src/interface/graphic/group.ts | 2 +- .../vrender/src/interface/graphic/polygon.ts | 2 +- .../vrender/src/interface/graphic/rect.ts | 2 +- .../canvas-picker/rect-picker.ts | 6 +- .../contributions/math-picker/rect-picker.ts | 6 +- .../contributions/rect-contribution-render.ts | 10 +-- .../contributions/render/group-render.ts | 6 +- .../contributions/render/polygon-render.ts | 6 +- .../contributions/render/rect-render.ts | 6 +- 42 files changed, 166 insertions(+), 146 deletions(-) create mode 100644 common/changes/@visactor/vrender-components/feat-border-radius-rename_2023-06-20-09-59.json create mode 100644 common/changes/@visactor/vrender/feat-border-radius-rename_2023-06-20-09-59.json diff --git a/common/changes/@visactor/vrender-components/feat-border-radius-rename_2023-06-20-09-59.json b/common/changes/@visactor/vrender-components/feat-border-radius-rename_2023-06-20-09-59.json new file mode 100644 index 000000000..60335a6d9 --- /dev/null +++ b/common/changes/@visactor/vrender-components/feat-border-radius-rename_2023-06-20-09-59.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender-components", + "comment": "rename all of the borderRadius to cornerRadius", + "type": "minor" + } + ], + "packageName": "@visactor/vrender-components" +} \ No newline at end of file diff --git a/common/changes/@visactor/vrender/feat-border-radius-rename_2023-06-20-09-59.json b/common/changes/@visactor/vrender/feat-border-radius-rename_2023-06-20-09-59.json new file mode 100644 index 000000000..6c817fb90 --- /dev/null +++ b/common/changes/@visactor/vrender/feat-border-radius-rename_2023-06-20-09-59.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender", + "comment": "rename all of the borderRadius to cornerRadius", + "type": "minor" + } + ], + "packageName": "@visactor/vrender" +} \ No newline at end of file diff --git a/docs/demos/src/interactive/rect.ts b/docs/demos/src/interactive/rect.ts index df4164a65..dda8e01d6 100644 --- a/docs/demos/src/interactive/rect.ts +++ b/docs/demos/src/interactive/rect.ts @@ -11,7 +11,7 @@ export function renderRect(num: number) { height: 60, x: 800 * Math.random(), y: 800 * Math.random(), - borderRadius: 50, + cornerRadius: 50, // scaleX: 2, // scaleY: 2, // angle: Math.PI / 4, diff --git a/docs/demos/src/pages/bar3d.ts b/docs/demos/src/pages/bar3d.ts index 9f214d83f..1f9fb7bc9 100644 --- a/docs/demos/src/pages/bar3d.ts +++ b/docs/demos/src/pages/bar3d.ts @@ -205,7 +205,7 @@ function drawChartCanopus() { z: 0, width: 20, length: 20, - borderRadius: 10, + cornerRadius: 10, // length: 20, stroke: i === 3, lineWidth: 1, diff --git a/docs/demos/src/pages/layer.ts b/docs/demos/src/pages/layer.ts index 0b70ce67c..dcb13c1f0 100644 --- a/docs/demos/src/pages/layer.ts +++ b/docs/demos/src/pages/layer.ts @@ -117,7 +117,7 @@ export const page = () => { y: 100, width: 100, height: 50, - borderRadius: 20, + cornerRadius: 20, fill: colorPools[10], // stroke: 'red', lineWidth: 2 @@ -130,7 +130,7 @@ export const page = () => { y: 100, width: 100, height: 50, - borderRadius: 20, + cornerRadius: 20, scaleX: 2, scaleY: 2, fill: colorPools[10], @@ -145,7 +145,7 @@ export const page = () => { y: 100, width: 100, height: 50, - borderRadius: 20, + cornerRadius: 20, angle: Math.PI / 4, fill: colorPools[10], // stroke: 'red', @@ -172,7 +172,7 @@ export const page = () => { y: 400, width: 100, height: 50, - borderRadius: 20, + cornerRadius: 20, fill: colorPools[10], stroke: colorPools[5], @@ -186,7 +186,7 @@ export const page = () => { y: 400, width: 100, height: 50, - borderRadius: 20, + cornerRadius: 20, scaleX: 2, scaleY: 2, fill: colorPools[10], @@ -202,7 +202,7 @@ export const page = () => { y: 400, width: 100, height: 50, - borderRadius: 20, + cornerRadius: 20, angle: Math.PI / 4, fill: colorPools[10], stroke: colorPools[5], diff --git a/docs/demos/src/pages/morphing.ts b/docs/demos/src/pages/morphing.ts index 86deefc7c..a9d0212d5 100644 --- a/docs/demos/src/pages/morphing.ts +++ b/docs/demos/src/pages/morphing.ts @@ -109,7 +109,7 @@ export const page = () => { shadowColor: colorPools[2] // scaleX: 0.5, // scaleY: 0.5 - // borderRadius: 30 + // cornerRadius: 30 }); const area = createArea({ diff --git a/docs/demos/src/pages/polygon.ts b/docs/demos/src/pages/polygon.ts index c82d63f93..5c9cd58db 100644 --- a/docs/demos/src/pages/polygon.ts +++ b/docs/demos/src/pages/polygon.ts @@ -18,10 +18,9 @@ export const page = () => { ], fill: colorPools[10], stroke: colorPools[5], - stroke: false, lineJoin: 'bevel', lineWidth: 20 - // borderRadius: 10 + // cornerRadius: 10 }); shapes.push(square); @@ -42,7 +41,7 @@ export const page = () => { lineJoin: 'round', lineWidth: 1, // lineDash: [10, 10], - borderRadius: 10 + cornerRadius: 10 }) ); @@ -68,7 +67,7 @@ export const page = () => { shadowColor: colorPools[2], scaleX: 0.5, scaleY: 0.5 - // borderRadius: 30 + // cornerRadius: 30 }) ); diff --git a/docs/demos/src/pages/rect.ts b/docs/demos/src/pages/rect.ts index ae75a17d5..687bcc3b4 100644 --- a/docs/demos/src/pages/rect.ts +++ b/docs/demos/src/pages/rect.ts @@ -12,7 +12,7 @@ export const page = () => { height: 100, fill: colorPools[10], stroke: [colorPools[0], colorPools[0], colorPools[0], colorPools[0]], - borderRadius: 10, + cornerRadius: 10, lineWidth: 5 })); @@ -22,7 +22,7 @@ export const page = () => { width: 100, height: 100, fill: colorPools[10], - borderRadius: [5, 10, 15, 20], + cornerRadius: [5, 10, 15, 20], lineWidth: 5 })); @@ -33,7 +33,7 @@ export const page = () => { height: 100, background: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAklEQVR4AewaftIAAACiSURBVMXBsQmDUABF0evLrwISy2yQ1g3UzpHcyBXs9HeCE2SJgEhq0waxEBTeOckEK0bCTJgJM2EW2PGoa9Ki4EpLjMxdx1ZgR1oUPJuGq81dx5YwE2bCLHDSMgxs3fOcW5ZxROCkd1Wx9ep70rLkCGEmzISZMBNmwkyYCTNhJsyEmTATZsIssGOJkTM+bct3HPm3xMieZIIVI2EmzISZMPsBPLUeCZWhvyQAAAAASUVORK5CYII=', - borderRadius: 100, + cornerRadius: 100, lineWidth: 5 })); diff --git a/docs/demos/src/pages/scroll.ts b/docs/demos/src/pages/scroll.ts index cf1631ccc..c42e18bf8 100644 --- a/docs/demos/src/pages/scroll.ts +++ b/docs/demos/src/pages/scroll.ts @@ -38,7 +38,7 @@ export const page = () => { // y: 100, // width: 100, // height: 50, - // borderRadius: 20, + // cornerRadius: 20, // scaleX: 3, // scaleY: 2, // background: @@ -77,7 +77,7 @@ export const page = () => { // y: 100, // width: 100, // height: 50, - // borderRadius: 20, + // cornerRadius: 20, // angle: Math.PI / 4, // fill: colorPools[10], // // stroke: 'red', @@ -104,7 +104,7 @@ export const page = () => { // y: 400, // width: 100, // height: 50, - // borderRadius: 20, + // cornerRadius: 20, // fill: colorPools[10], // stroke: colorPools[5], // @@ -117,7 +117,7 @@ export const page = () => { y: 200, width: 100, height: 50, - borderRadius: 20, + cornerRadius: 20, scaleX: 2, scaleY: 2, fill: 'red', @@ -132,7 +132,7 @@ export const page = () => { y: 300, width: 100, height: 50, - borderRadius: 20, + cornerRadius: 20, scaleX: 2, scaleY: 2, fill: colorPools[1], @@ -147,7 +147,7 @@ export const page = () => { y: 400, width: 100, height: 50, - borderRadius: 20, + cornerRadius: 20, scaleX: 2, scaleY: 2, fill: colorPools[3], @@ -162,7 +162,7 @@ export const page = () => { y: 500, width: 100, height: 50, - borderRadius: 20, + cornerRadius: 20, scaleX: 2, scaleY: 2, fill: colorPools[4], @@ -189,7 +189,7 @@ export const page = () => { height: gh, background: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAE4AAABOCAYAAACOqiAdAAAAAXNSR0IArs4c6QAACbFJREFUeAHtXGlsVUUUPl1kbUsAUWRRrCAoSo0FBDSmqSQawV8gxF0Bo4kaXDCQ+MMY/7gUlKg/jKBGXILiD6MkQoD0hyBCa0BFgUBZhIpAQSlQwC5+3/Pel7vMzLuv7Zv7Xu1Jzrv3zsydOed7M3e2cyZPYqK2trYSFD0ePAY82uEhuBZ7GLfS6OF63O9yeCeuNXl5eadwtU55tkoEUAUoqwI8FVwJLgczrCPUgpdrwRvA68DVAJJhuU8ArAxcBf4DnGliGSyrLGeRg/DTwd+D4yKWPT1nAISwM8Db4kJLUS5lmZG1AEK4MeD1CsGzJWgdZewsADvcOUCYHhDmRfACMO8j059Nf8v2Ewdl/+ljcuB0g/x+pkFO/dMkZ5rPy9nmC4l8+hT2kL6FPaXkot4yvO9AuaJooIwoGiRlAy6XS3v3i1yWk5CZVoFfQifyXwHp5uCk7xBwAK0U+awEc1iRklrbWqW2Yb+sr98hNQ11AOpEyndMCYb3HSDjB5bKbUPGSvnAEZKfl29K7o2rwcMsgLfPG5jOfbuBA2j8biwHp/zbWbO+2L9F1hz+SY6ey8yw65JeJXL70HFy94iJUWvi35B9LsD7Mh3A3LTtAg6gLUQGr7iZ6K5seh/t+U5WH9omLahtNqgwr0DuHFYmD468JdG0I5S5EOC9FiGdL0lawAEwpl8MfsaXS+DhLL5R7+2ulpX7NlsDLCCCFKDZzr5ykjx6dYX0wTcyBb2B+OcAYFuKdMnoyMA5oH2ANx9Kvq24qT7ym1T9slqOneNMKX4a1KtYFlw3TSoGX5NKmA+RYE5U8NIBbgky1ta0Cy3NsvTXNbLqwJZUAsYSP/OKiTL/2tulR0Ghqfw3ANyzpgRuXCTgUn3T+PF/futnsuvUH26+WXkdXXKZvD7hnlSdxyKA92oqBVICB9DYe67SZVTXeFTm/7AiY72lrtz2hrP3XXrTA1JafIkpi5kAz9jbGoEDaByn/QhWDjl2nDwkT2/5ODFoNUmRbXEcTL858X4Z23+YTjQOVW4EeHW6BNoRI0DjLICDWyVorGm5CBqB4OyEslMHDVHnlQ4GyiRa4JD6RbByRsBvGpsnBchVouzUgbpoiLoTAyUpmyqQ5mR4Ozg092TvOW/jsqzvCJTaKgLZYSy7eZ6ut+V8tgxNlqvNPtLVuHeQKgQa3+SQI9t7T5+GKR6oC3XSEDF4WxUXAg61jb1opSoxB7fZOk5TyRs1jDpRNw3d5mDiiw41VSTahhRlvlR44DRqVvVbGZ0RjCi6WEYWDw4WnXje03gEy0/HlXGdEcgZxucVT+mmZ9vRXG/wluMbRgO06YgMgcYXOPfM9DRq8qBR8vTYO7zyJe/f3PFtRoGjbtSRswsFcd9kOsD7xo0LNtUX3AjvlascnLBnms626NcWmwxxnSUXdaSuGvJhkwQOiLKmTVK9xKUhG8tC/BzoyF0R1sV3Rjh1pK4amuRglIhOAoenB1UvcJzD9TQbZALHRo2jjtTVMLZ7wMUhARyQ5MbwvW6g98qVWxu1jWWawGly9iC8smXinrpSZw3d52Albo2rQMJQd8Y9Ai532yJjU7XwjXP1pM7UXUHEqILhLnBT+RAkbqxkao8gWBafjU3VUo2jHNSZumsogZULXKUqEXejbJIJOFNcJmQ06J7AKh9tllZD5arCuYVnk4zfOItNlTobdC8nZqxxE8AhqyH2LB3d96QA6ZCpAzCBmk4ZUdNSd03vSqwmEDjapoWIO+y2qVXa5JyiZjW3tsg/YNtkwGC0FjiaJcRBqm+Z7drm6m3AQA8cbTniIFVzVYFpQzYDBgnghqqEMMzZVMk7LeyMYtgRV40zYDCETbVIpXVcy+IqkFS1UCVzZ4cZMCgmcMWqAmlqFQepZg9xNVUDBnrg4hJWVa6qFtr4U1WyOOUmgLMhQ+QyVCCpwiJnmKGEbKpK6xhaQsZB2dRUDRg0aoGj+WgcpGoecXUOBgz0wNFMIA5SNUtVmA3ZDBg0crOmHnx9UBAaKsexf7r28M+y+9QRnzgHYxqMEwMN1RM4+kaFtnZo3R0H1Tf9JeRsIAMGu/iNI3Ahokn8/50MGOxya1wII/oRxEU0O2X552GnsuX4XvlRvxqbURENGOwkcFvBXLPxrcnR+YJ+BDbX5HrmXyRVsJicOOiqJCCPjLpVVmHz5HXYFdsk6q5xQCFWNfnYnabjQa1KKDpf2KTHx1T6QHPLngnfBfow2CSD7rXEjN840ob/Lv5feqzYpGnDfOYZvqLpu2CTDLonsHKBW6cSim4+tJm1QUWFvaRfjz7aoob26a+N6+wI6kzdNZTAygWuGon8gycE0DfKVhM53XxOGs6f1sgqGTW4CRZKnTV+YcSomukTwKHN8oP3CQOCRN8oeqnYoM8Nhj3sIGwQdaXOGvrEwSq5Ic10K1SJ2bOYvj2qd9obtmLvRvnqoL+f4kbNW7+ulc3H9rQ327Teo66a3pT5JDHyGRZiv/B7RIYslriEPLv6bWs2JKNKBsu4/sPlQmtzYgx3+OzJtJRvb2LWtpUVT+qc5zajtk128w4CR8PCr91I75V2sp/WbfIGdbn7e0un6AwLqetdAE5tWOhE0No8RPTCo7lnVyXqRh01RFPWJGhMo/rqv6x6ma6L9MLrqkTdDO6ZIUxCwAHZLwGOckDMOSS98LoaUSeDW+YGBxOf2iHgnNgncFUa5NK4mE4VXYWoi8ZgmioSA2IRIiVwQHgnUlaFUiOA/p50XbQ1o1DJ0Flh1IG6GHxYqxwsQkX6elVvLIYm3K3ZCB7vDXfv6UD22Kb3c9afi8vi706ZY3K/rIGuNwM4ZctT1jiC47wwG7dKLzH6e9J10bAuz2yykigzZTf4rFJnHq+hBI1KaYFjJF6sw2Uu71VEf0/+a7nUbCkrZTb4qlJVHquxT6WzG2YEjomQAXvZRe4LwSv/NXrf5UKH4XoKGmoa1eNxGtTZSNpvXPAtfPOWIOyZYLj73H2YgYtE4ArgCPL74IcDUb5HeuF1H5/hg0TEAW8xgrU1j6/QjKH7wJYAeHwEgFl7RBBXOLg0lFVHBHkxBHgz8Lwc3M8brrqn9Xb3oVQeZABeKR55UoRykOxJmrjNsmPQZjvDraCYkZ4j96q63AAeZxg8LWEBmPeRiTUxVw/ei6xkqoQAMNuPeuQxlGNS6RFbPITrPly0I+gDwO7jbDsIIA8CWAy2dYAyy8r4tn+HO4eooEKZAqStAE8FV4LLwQzrCHE/uBbMFWvusFs7stsacFDKRwCSthX0XKQTnstDcF/sYdxqD4mnXd9WDCloNGSd/gUj0iBbjpGP7QAAAABJRU5ErkJggg==', - borderRadius: 20, + cornerRadius: 20, clip: true }); diff --git a/docs/demos/src/pages/stage.ts b/docs/demos/src/pages/stage.ts index 22758880c..84f43a251 100644 --- a/docs/demos/src/pages/stage.ts +++ b/docs/demos/src/pages/stage.ts @@ -117,7 +117,7 @@ export const page = () => { y: 100, width: 100, height: 50, - borderRadius: 20, + cornerRadius: 20, fill: colorPools[10], // stroke: 'red', lineWidth: 2 @@ -130,7 +130,7 @@ export const page = () => { y: 100, width: 100, height: 50, - borderRadius: 20, + cornerRadius: 20, scaleX: 2, scaleY: 2, fill: colorPools[10], @@ -145,7 +145,7 @@ export const page = () => { y: 100, width: 100, height: 50, - borderRadius: 20, + cornerRadius: 20, angle: Math.PI / 4, fill: colorPools[10], // stroke: 'red', @@ -172,7 +172,7 @@ export const page = () => { y: 400, width: 100, height: 50, - borderRadius: 20, + cornerRadius: 20, fill: colorPools[10], stroke: colorPools[5], @@ -186,7 +186,7 @@ export const page = () => { y: 400, width: 100, height: 50, - borderRadius: 20, + cornerRadius: 20, scaleX: 2, scaleY: 2, fill: colorPools[10], @@ -202,7 +202,7 @@ export const page = () => { y: 400, width: 100, height: 50, - borderRadius: 20, + cornerRadius: 20, angle: Math.PI / 4, fill: colorPools[10], stroke: colorPools[5], diff --git a/docs/demos/src/pages/test-arc-path.ts b/docs/demos/src/pages/test-arc-path.ts index dfd3a00c8..f212db6f2 100644 --- a/docs/demos/src/pages/test-arc-path.ts +++ b/docs/demos/src/pages/test-arc-path.ts @@ -31,7 +31,7 @@ export const page = () => { stroke: 'red', lineWidth: 6, - borderRadius: 10 + cornerRadius: 10 }); (stage as any).defaultLayer.add(rect); } @@ -51,7 +51,7 @@ export const page = () => { stroke: 'red', lineWidth: 6, - borderRadius: 10 + cornerRadius: 10 }; const key = 'x'; (window as any).update = () => { diff --git a/docs/demos/src/render/rect.ts b/docs/demos/src/render/rect.ts index b2bd8c992..c95a660a4 100644 --- a/docs/demos/src/render/rect.ts +++ b/docs/demos/src/render/rect.ts @@ -36,7 +36,7 @@ export function renderRect(num: number) { y: 600 * Math.random(), width: 80, height: 50, - borderRadius: 10, + cornerRadius: 10, fill: colorPools[Math.floor(Math.random() * colorPools.length)] }); }, diff --git a/packages/vrender-components/__tests__/browser/examples/color-legend.ts b/packages/vrender-components/__tests__/browser/examples/color-legend.ts index 4c10f0c0e..e5a178f55 100644 --- a/packages/vrender-components/__tests__/browser/examples/color-legend.ts +++ b/packages/vrender-components/__tests__/browser/examples/color-legend.ts @@ -16,7 +16,7 @@ const hbLegend = new ColorContinuousLegend({ max: 100, value: [0, 100], railStyle: { - borderRadius: 5 + cornerRadius: 5 } }); @@ -37,7 +37,7 @@ const htLegend = new ColorContinuousLegend({ max: 100, value: [0, 100], railStyle: { - borderRadius: 5 + cornerRadius: 5 } }); @@ -57,7 +57,7 @@ const vlLegend = new ColorContinuousLegend({ max: 100, value: [10, 100], railStyle: { - borderRadius: 5 + cornerRadius: 5 } }); const vrLegend = new ColorContinuousLegend({ @@ -76,7 +76,7 @@ const vrLegend = new ColorContinuousLegend({ max: 100, value: [10, 100], railStyle: { - borderRadius: 5 + cornerRadius: 5 } }); const stage = render([hbLegend, htLegend, vlLegend, vrLegend], 'main'); diff --git a/packages/vrender-components/__tests__/browser/examples/discrete-legend.ts b/packages/vrender-components/__tests__/browser/examples/discrete-legend.ts index 5ae38f529..9637b4a21 100644 --- a/packages/vrender-components/__tests__/browser/examples/discrete-legend.ts +++ b/packages/vrender-components/__tests__/browser/examples/discrete-legend.ts @@ -130,7 +130,7 @@ const vLegend = new DiscreteLegend({ style: { stroke: '#000', lineWidth: 1 - // borderRadius: 5 + // cornerRadius: 5 }, state: { selectedHover: { diff --git a/packages/vrender-components/__tests__/browser/examples/mark-area.ts b/packages/vrender-components/__tests__/browser/examples/mark-area.ts index 1185bba8b..ea9b57e7a 100644 --- a/packages/vrender-components/__tests__/browser/examples/mark-area.ts +++ b/packages/vrender-components/__tests__/browser/examples/mark-area.ts @@ -8,7 +8,7 @@ export function run() { const guiObject = { name: 'MarkArea', labelPos: 'left', - borderRadius: 0, + cornerRadius: 0, labelDx: 0, labelDy: 0 }; @@ -20,7 +20,7 @@ export function run() { dx: guiObject.labelDx, dy: guiObject.labelDy, areaStyle: { - borderRadius: guiObject.borderRadius + cornerRadius: guiObject.cornerRadius } } }; @@ -68,7 +68,7 @@ export function run() { ], ...(styleAttr as any), areaStyle: { - borderRadius: guiObject.borderRadius + cornerRadius: guiObject.cornerRadius } }); @@ -114,10 +114,10 @@ export function run() { ); }); - gui.add(guiObject, 'borderRadius').onChange(value => { + gui.add(guiObject, 'cornerRadius').onChange(value => { markAreas.forEach(markArea => markArea.setAttribute('areaStyle', { - borderRadius: value + cornerRadius: value }) ); }); diff --git a/packages/vrender-components/__tests__/browser/examples/player.ts b/packages/vrender-components/__tests__/browser/examples/player.ts index f1597e615..ed7209b31 100644 --- a/packages/vrender-components/__tests__/browser/examples/player.ts +++ b/packages/vrender-components/__tests__/browser/examples/player.ts @@ -22,7 +22,7 @@ const layoutPlayer1 = new DiscretePlayer({ space: 10, trackStyle: { fillOpacity: 1, - borderRadius: 5, + cornerRadius: 5, stroke: 'black', fill: 'red' }, @@ -103,7 +103,7 @@ const layoutPlayer3 = new ContinuousPlayer({ orient: 'bottom', slider: { railStyle: { - borderRadius: 40, + cornerRadius: 40, stroke: 'blue', strokeOpacity: 0.1 @@ -209,7 +209,7 @@ setInterval(() => { orient: 'bottom', slider: { railStyle: { - borderRadius: 40, + cornerRadius: 40, stroke: 'blue', strokeOpacity: 0.1 diff --git a/packages/vrender-components/__tests__/browser/examples/slider.ts b/packages/vrender-components/__tests__/browser/examples/slider.ts index 04b5edf83..6aa3bc8c9 100644 --- a/packages/vrender-components/__tests__/browser/examples/slider.ts +++ b/packages/vrender-components/__tests__/browser/examples/slider.ts @@ -14,7 +14,7 @@ const doubleSlider1 = new Slider({ max: 100, value: [10, 78], railStyle: { - borderRadius: 5 + cornerRadius: 5 }, startText: { visible: true, @@ -41,7 +41,7 @@ const doubleSlider2 = new Slider({ max: 100, value: [10, 78], railStyle: { - borderRadius: 5 + cornerRadius: 5 }, startText: { visible: true, @@ -67,7 +67,7 @@ const doubleSlider3 = new Slider({ min: 0, max: 100, railStyle: { - borderRadius: 5 + cornerRadius: 5 }, startText: { visible: true, @@ -92,7 +92,7 @@ const singleSlider1 = new Slider({ max: 100, value: 80, railStyle: { - borderRadius: 5 + cornerRadius: 5 }, startText: { visible: true, @@ -117,7 +117,7 @@ const singleSlider2 = new Slider({ max: 100, value: 80, railStyle: { - borderRadius: 5 + cornerRadius: 5 }, startText: { visible: true, @@ -141,7 +141,7 @@ const singleSlider3 = new Slider({ min: 0, max: 100, railStyle: { - borderRadius: 5 + cornerRadius: 5 }, startText: { visible: true, diff --git a/packages/vrender-components/__tests__/browser/examples/tag.ts b/packages/vrender-components/__tests__/browser/examples/tag.ts index d56f0a991..0ab900f76 100644 --- a/packages/vrender-components/__tests__/browser/examples/tag.ts +++ b/packages/vrender-components/__tests__/browser/examples/tag.ts @@ -30,7 +30,7 @@ export function run() { stroke: '#87e8de', lineWidth: 1, - borderRadius: 4 + cornerRadius: 4 }, shape: { visible: guiObject.symbolVisible, diff --git a/packages/vrender-components/__tests__/unit/pager.test.ts b/packages/vrender-components/__tests__/unit/pager.test.ts index a501a4423..1216d9f40 100644 --- a/packages/vrender-components/__tests__/unit/pager.test.ts +++ b/packages/vrender-components/__tests__/unit/pager.test.ts @@ -18,7 +18,7 @@ describe('Pager', () => { x: 100, y: 100, fill: 'yellow', - borderRadius: 45, + cornerRadius: 45, total: 9, padding: 10 }); diff --git a/packages/vrender-components/__tests__/unit/slider.test.ts b/packages/vrender-components/__tests__/unit/slider.test.ts index 734d66caa..14c6c601d 100644 --- a/packages/vrender-components/__tests__/unit/slider.test.ts +++ b/packages/vrender-components/__tests__/unit/slider.test.ts @@ -31,7 +31,7 @@ describe('Slider', () => { max: 100, value: 34, railStyle: { - borderRadius: 5 + cornerRadius: 5 }, startText: { visible: true, @@ -97,7 +97,7 @@ describe('Slider', () => { max: 100, value: 34, railStyle: { - borderRadius: 5 + cornerRadius: 5 }, startText: { visible: true, @@ -167,7 +167,7 @@ describe('Slider', () => { max: 100, value: [10, 78], railStyle: { - borderRadius: 5, + cornerRadius: 5, fill: 'yellow' }, startText: { @@ -226,7 +226,7 @@ describe('Slider', () => { max: 100, value: [10, 78], railStyle: { - borderRadius: 5, + cornerRadius: 5, fill: 'yellow' }, startText: { diff --git a/packages/vrender-components/src/crosshair/circle.ts b/packages/vrender-components/src/crosshair/circle.ts index 41b9e404a..49eb14330 100644 --- a/packages/vrender-components/src/crosshair/circle.ts +++ b/packages/vrender-components/src/crosshair/circle.ts @@ -28,7 +28,8 @@ export class CircleCrosshair extends CrosshairBase { { ...center, outerRadius: radius, - ...this.attribute, + // TODO: group的cornerRadius支持数组,arc的不支持数组,此处会有类型转换问题 + ...(this.attribute as any), ...lineStyle }, 'arc' diff --git a/packages/vrender-components/src/data-zoom/config.ts b/packages/vrender-components/src/data-zoom/config.ts index 5f67dd6cd..401c39b2a 100644 --- a/packages/vrender-components/src/data-zoom/config.ts +++ b/packages/vrender-components/src/data-zoom/config.ts @@ -12,7 +12,7 @@ export const DEFAULT_DATA_ZOOM_ATTRIBUTES = { fill: 'white', stroke: '#D1DBEE', lineWidth: 1, - borderRadius: 2 + cornerRadius: 2 }, dragMaskStyle: { fill: '#B0C8F9', @@ -55,7 +55,7 @@ export const DEFAULT_DATA_ZOOM_ATTRIBUTES = { style: { fill: 'white', stroke: '#B0C8F9', - borderRadius: 2 + cornerRadius: 2 } }, icon: { diff --git a/packages/vrender-components/src/marker/config.ts b/packages/vrender-components/src/marker/config.ts index df45aad9c..9a64693dc 100644 --- a/packages/vrender-components/src/marker/config.ts +++ b/packages/vrender-components/src/marker/config.ts @@ -32,7 +32,7 @@ export const DEFAULT_MARK_LINE_THEME = { padding: [2, 2, 4, 4], panel: { visible: true, - borderRadius: 0, + cornerRadius: 0, fill: 'rgb(48, 115, 242)', fillOpacity: 0.8 } @@ -104,7 +104,7 @@ export const DEFAULT_MARK_AREA_THEME = { padding: [2, 2, 4, 4], panel: { visible: true, - borderRadius: 0, + cornerRadius: 0, fill: 'rgb(48, 115, 242)', fillOpacity: 0.8 } diff --git a/packages/vrender-components/src/player/base-player.ts b/packages/vrender-components/src/player/base-player.ts index 5368e9aa5..26252c11b 100644 --- a/packages/vrender-components/src/player/base-player.ts +++ b/packages/vrender-components/src/player/base-player.ts @@ -36,7 +36,7 @@ export class BasePlayer extends AbstractComponent> dx: 0, dy: 0, railStyle: { - borderRadius: 5 + cornerRadius: 5 }, trackStyle: {}, handlerStyle: {} diff --git a/packages/vrender-components/src/scrollbar/scrollbar.ts b/packages/vrender-components/src/scrollbar/scrollbar.ts index 6e5d17cfe..0383a81fd 100644 --- a/packages/vrender-components/src/scrollbar/scrollbar.ts +++ b/packages/vrender-components/src/scrollbar/scrollbar.ts @@ -158,7 +158,7 @@ export class ScrollBar extends AbstractComponent> 'slider', { ...sliderAttribute, - borderRadius: this._getDefaultSliderBorderRadius(), + cornerRadius: this._getDefaultSliderCornerRadius(), ...sliderStyle, boundsPadding: normalizePadding(padding), pickMode: 'imprecise' @@ -195,7 +195,7 @@ export class ScrollBar extends AbstractComponent> } // 获取默认的滑块圆角 - private _getDefaultSliderBorderRadius() { + private _getDefaultSliderCornerRadius() { const { direction, round } = this.attribute as ScrollBarAttributes; if (round) { diff --git a/packages/vrender-components/src/slider/slider.ts b/packages/vrender-components/src/slider/slider.ts index 8aac32eec..013bc8da8 100644 --- a/packages/vrender-components/src/slider/slider.ts +++ b/packages/vrender-components/src/slider/slider.ts @@ -358,7 +358,7 @@ export class Slider extends AbstractComponent> { y: 0, width: railWidth, height: railHeight, - borderRadius: railStyle?.borderRadius, + cornerRadius: railStyle?.cornerRadius, clip: true, pickable: false }); diff --git a/packages/vrender-components/src/tooltip/config.ts b/packages/vrender-components/src/tooltip/config.ts index 3c9945160..7b233afbb 100644 --- a/packages/vrender-components/src/tooltip/config.ts +++ b/packages/vrender-components/src/tooltip/config.ts @@ -5,7 +5,7 @@ import { TooltipAttributes } from './type'; export const defaultAttributes: Partial = { panel: { visible: true, - borderRadius: [3, 3, 3, 3], + cornerRadius: [3, 3, 3, 3], fill: 'white', shadow: true, shadowBlur: 12, diff --git a/packages/vrender/src/common/polygon.ts b/packages/vrender/src/common/polygon.ts index cd3b7a504..7ca327f8f 100644 --- a/packages/vrender/src/common/polygon.ts +++ b/packages/vrender/src/common/polygon.ts @@ -24,7 +24,7 @@ export function drawRoundedPolygon( points: IPointLike[], x: number, y: number, - borderRadius: number | number[] + cornerRadius: number | number[] ) { if (points.length < 3) { drawPolygon(path, points, x, y); @@ -52,7 +52,7 @@ export function drawRoundedPolygon( const tan = Math.abs(Math.tan(angle)); // get config radius - let radius = Array.isArray(borderRadius) ? borderRadius[(i + 1) % points.length] ?? 0 : borderRadius; + let radius = Array.isArray(cornerRadius) ? cornerRadius[(i + 1) % points.length] ?? 0 : cornerRadius; let segment = radius / tan; //Check the segment diff --git a/packages/vrender/src/common/shape/rect.ts b/packages/vrender/src/common/shape/rect.ts index 81ddf0547..6e740658c 100644 --- a/packages/vrender/src/common/shape/rect.ts +++ b/packages/vrender/src/common/shape/rect.ts @@ -7,42 +7,42 @@ export function createRectPath( y: number, width: number, height: number, - rectBorderRadius: number | number[] + rectCornerRadius: number | number[] ) { - // 匹配borderRadius - let borderRadius: vec4; - if (isNumber(rectBorderRadius, true)) { - borderRadius = [ - rectBorderRadius, - rectBorderRadius, - rectBorderRadius, - rectBorderRadius + // 匹配cornerRadius + let cornerRadius: vec4; + if (isNumber(rectCornerRadius, true)) { + cornerRadius = [ + rectCornerRadius, + rectCornerRadius, + rectCornerRadius, + rectCornerRadius ]; - } else if (Array.isArray(rectBorderRadius)) { - const borderRadiusArr: number[] = rectBorderRadius as number[]; - switch (borderRadiusArr.length) { + } else if (Array.isArray(rectCornerRadius)) { + const cornerRadiusArr: number[] = rectCornerRadius as number[]; + switch (cornerRadiusArr.length) { case 0: - borderRadius = [0, 0, 0, 0]; + cornerRadius = [0, 0, 0, 0]; break; case 1: - borderRadius = [borderRadiusArr[0], borderRadiusArr[0], borderRadiusArr[0], borderRadiusArr[0]]; + cornerRadius = [cornerRadiusArr[0], cornerRadiusArr[0], cornerRadiusArr[0], cornerRadiusArr[0]]; break; case 2: case 3: - borderRadius = [borderRadiusArr[0], borderRadiusArr[1], borderRadiusArr[0], borderRadiusArr[1]]; + cornerRadius = [cornerRadiusArr[0], cornerRadiusArr[1], cornerRadiusArr[0], cornerRadiusArr[1]]; break; default: - borderRadius = borderRadiusArr.slice(0, 5) as [number, number, number, number]; + cornerRadius = cornerRadiusArr.slice(0, 5) as [number, number, number, number]; break; } } else { - borderRadius = [0, 0, 0, 0]; + cornerRadius = [0, 0, 0, 0]; } - // 当宽度小于0 或者 borderRadius 极小时,不绘制 borderRadius + // 当宽度小于0 或者 cornerRadius 极小时,不绘制 cornerRadius if ( width < 0 || - Math.abs(borderRadius[0]) + Math.abs(borderRadius[1]) + Math.abs(borderRadius[2]) + Math.abs(borderRadius[3]) < + Math.abs(cornerRadius[0]) + Math.abs(cornerRadius[1]) + Math.abs(cornerRadius[2]) + Math.abs(cornerRadius[3]) < 1e-12 ) { return path.rect(x, y, width, height); @@ -62,81 +62,81 @@ export function createRectPath( // (leftBottomPoint2) (rightBottomPoint2) // *(leftBottomPoint1)***************(rightBottomPoint1) // - const maxBorderRadius = Math.min(width / 2, height / 2); - const _borderRadius: vec4 = [ - Math.min(maxBorderRadius, borderRadius[0]), - Math.min(maxBorderRadius, borderRadius[1]), - Math.min(maxBorderRadius, borderRadius[2]), - Math.min(maxBorderRadius, borderRadius[3]) + const maxCornerRadius = Math.min(width / 2, height / 2); + const _cornerRadius: vec4 = [ + Math.min(maxCornerRadius, cornerRadius[0]), + Math.min(maxCornerRadius, cornerRadius[1]), + Math.min(maxCornerRadius, cornerRadius[2]), + Math.min(maxCornerRadius, cornerRadius[3]) ]; - const leftTopPoint1: vec2 = [leftTop[0] + _borderRadius[0], leftTop[1]]; - const leftTopPoint2: vec2 = [leftTop[0], leftTop[1] + _borderRadius[0]]; - const rightTopPoint1: vec2 = [rightTop[0] - _borderRadius[1], rightTop[1]]; - const rightTopPoint2: vec2 = [rightTop[0], rightTop[1] + _borderRadius[1]]; - const rightBottomPoint1: vec2 = [rightBottom[0] - _borderRadius[2], rightBottom[1]]; - const rightBottomPoint2: vec2 = [rightBottom[0], rightBottom[1] - _borderRadius[2]]; - const leftBottomPoint1: vec2 = [leftBottom[0] + _borderRadius[3], leftBottom[1]]; - const leftBottomPoint2: vec2 = [leftBottom[0], leftBottom[1] - _borderRadius[3]]; + const leftTopPoint1: vec2 = [leftTop[0] + _cornerRadius[0], leftTop[1]]; + const leftTopPoint2: vec2 = [leftTop[0], leftTop[1] + _cornerRadius[0]]; + const rightTopPoint1: vec2 = [rightTop[0] - _cornerRadius[1], rightTop[1]]; + const rightTopPoint2: vec2 = [rightTop[0], rightTop[1] + _cornerRadius[1]]; + const rightBottomPoint1: vec2 = [rightBottom[0] - _cornerRadius[2], rightBottom[1]]; + const rightBottomPoint2: vec2 = [rightBottom[0], rightBottom[1] - _cornerRadius[2]]; + const leftBottomPoint1: vec2 = [leftBottom[0] + _cornerRadius[3], leftBottom[1]]; + const leftBottomPoint2: vec2 = [leftBottom[0], leftBottom[1] - _cornerRadius[3]]; path.moveTo(leftTopPoint1[0], leftTopPoint1[1]); path.lineTo(rightTopPoint1[0], rightTopPoint1[1]); if (!arrayEqual(rightTopPoint1, rightTopPoint2)) { const centerX = rightTopPoint1[0]; - const centerY = rightTopPoint1[1] + _borderRadius[1]; + const centerY = rightTopPoint1[1] + _cornerRadius[1]; path.arc( centerX, centerY, - _borderRadius[1], + _cornerRadius[1], Math.atan2(rightTopPoint1[1] - centerY, rightTopPoint1[0] - centerX), Math.atan2(rightTopPoint2[1] - centerY, rightTopPoint2[0] - centerX), false ); - // path.arcTo(rightTop[0], rightTop[1], rightTopPoint2[0], rightTopPoint2[1], _borderRadius[1]); + // path.arcTo(rightTop[0], rightTop[1], rightTopPoint2[0], rightTopPoint2[1], _cornerRadius[1]); } path.lineTo(rightBottomPoint2[0], rightBottomPoint2[1]); if (!arrayEqual(rightBottomPoint1, rightBottomPoint2)) { - const centerX = rightBottomPoint2[0] - _borderRadius[2]; + const centerX = rightBottomPoint2[0] - _cornerRadius[2]; const centerY = rightBottomPoint2[1]; path.arc( centerX, centerY, - _borderRadius[2], + _cornerRadius[2], Math.atan2(rightBottomPoint2[1] - centerY, rightBottomPoint2[0] - centerX), Math.atan2(rightBottomPoint1[1] - centerY, rightBottomPoint1[0] - centerX), false ); - // path.arcTo(rightBottom[0], rightBottom[1], rightBottomPoint1[0], rightBottomPoint1[1], _borderRadius[2]); + // path.arcTo(rightBottom[0], rightBottom[1], rightBottomPoint1[0], rightBottomPoint1[1], _cornerRadius[2]); } path.lineTo(leftBottomPoint1[0], leftBottomPoint1[1]); if (!arrayEqual(leftBottomPoint1, leftBottomPoint2)) { const centerX = leftBottomPoint1[0]; - const centerY = leftBottomPoint1[1] - _borderRadius[3]; + const centerY = leftBottomPoint1[1] - _cornerRadius[3]; path.arc( centerX, centerY, - _borderRadius[3], + _cornerRadius[3], Math.atan2(leftBottomPoint1[1] - centerY, leftBottomPoint1[0] - centerX), Math.atan2(leftBottomPoint2[1] - centerY, leftBottomPoint2[0] - centerX), false ); - // path.arcTo(leftBottom[0], leftBottom[1], leftBottomPoint2[0], leftBottomPoint2[1], _borderRadius[3]); + // path.arcTo(leftBottom[0], leftBottom[1], leftBottomPoint2[0], leftBottomPoint2[1], _cornerRadius[3]); } path.lineTo(leftTopPoint2[0], leftTopPoint2[1]); if (!arrayEqual(leftTopPoint1, leftTopPoint2)) { const centerX = leftTopPoint1[0]; - const centerY = leftTopPoint1[1] + _borderRadius[0]; + const centerY = leftTopPoint1[1] + _cornerRadius[0]; path.arc( centerX, centerY, - _borderRadius[0], + _cornerRadius[0], Math.atan2(leftTopPoint2[1] - centerY, leftTopPoint2[0] - centerX), Math.atan2(leftTopPoint1[1] - centerY, leftTopPoint1[0] - centerX), false ); - // path.arcTo(leftTop[0], leftTop[1], leftTopPoint1[0], leftTopPoint1[1], _borderRadius[0]); + // path.arcTo(leftTop[0], leftTop[1], leftTopPoint1[0], leftTopPoint1[1], _cornerRadius[0]); } path.closePath(); return path; diff --git a/packages/vrender/src/graphic/config.ts b/packages/vrender/src/graphic/config.ts index b7246de02..d2ded2479 100644 --- a/packages/vrender/src/graphic/config.ts +++ b/packages/vrender/src/graphic/config.ts @@ -165,7 +165,7 @@ export const DefaultGroupAttribute: Required = { ...DefaultAttribute, width: 0, height: 0, - borderRadius: 0, + cornerRadius: 0, path: [], clip: false, visibleAll: true @@ -176,7 +176,7 @@ export const DefaultGlyphAttribute: Required = { path: '', width: 0, height: 0, - borderRadius: 0, + cornerRadius: 0, clip: false }; @@ -200,21 +200,21 @@ export const DefaultPathAttribute: Required = { export const DefaultPolygonAttribute: Required = { ...DefaultAttribute, points: [], - borderRadius: 0 + cornerRadius: 0 }; export const DefaultRectAttribute: Required = { ...DefaultAttribute, width: 0, height: 0, - borderRadius: 0 + cornerRadius: 0 }; export const DefaultRect3dAttribute: Required = { ...DefaultAttribute, width: 0, height: 0, - borderRadius: 0, + cornerRadius: 0, length: 0 }; diff --git a/packages/vrender/src/graphic/polygon.ts b/packages/vrender/src/graphic/polygon.ts index 8db1e572e..79e38f54f 100644 --- a/packages/vrender/src/graphic/polygon.ts +++ b/packages/vrender/src/graphic/polygon.ts @@ -8,7 +8,7 @@ import { application } from '../application'; import { GraphicType } from '../interface'; import { POLYGON_NUMBER_TYPE } from './constants'; -const POLYGON_UPDATE_TAG_KEY = ['points', 'borderRadius', ...GRAPHIC_UPDATE_TAG_KEY]; +const POLYGON_UPDATE_TAG_KEY = ['points', 'cornerRadius', ...GRAPHIC_UPDATE_TAG_KEY]; export class Polygon extends Graphic implements IPolygon { type: GraphicType = 'polygon'; diff --git a/packages/vrender/src/graphic/rect.ts b/packages/vrender/src/graphic/rect.ts index cfa0cd5dd..48886a9dd 100644 --- a/packages/vrender/src/graphic/rect.ts +++ b/packages/vrender/src/graphic/rect.ts @@ -7,7 +7,7 @@ import { getTheme } from './theme'; import { application } from '../application'; import { RECT_NUMBER_TYPE } from './constants'; -const RECT_UPDATE_TAG_KEY = ['width', 'height', 'borderRadius', ...GRAPHIC_UPDATE_TAG_KEY]; +const RECT_UPDATE_TAG_KEY = ['width', 'height', 'cornerRadius', ...GRAPHIC_UPDATE_TAG_KEY]; export class Rect extends Graphic implements IRect { type: GraphicType = 'rect'; diff --git a/packages/vrender/src/interface/graphic/glyph.ts b/packages/vrender/src/interface/graphic/glyph.ts index f858386f2..d55f0b954 100644 --- a/packages/vrender/src/interface/graphic/glyph.ts +++ b/packages/vrender/src/interface/graphic/glyph.ts @@ -10,7 +10,7 @@ export type IGlyphAttribute = { path: string | ICustomPath2D; width: number; height: number; - borderRadius: number | number[]; + cornerRadius: number | number[]; clip: boolean; }; diff --git a/packages/vrender/src/interface/graphic/group.ts b/packages/vrender/src/interface/graphic/group.ts index 683261b73..1657a50d0 100644 --- a/packages/vrender/src/interface/graphic/group.ts +++ b/packages/vrender/src/interface/graphic/group.ts @@ -6,7 +6,7 @@ export type IGroupAttribute = { path: IGraphic[]; width: number; height: number; - borderRadius: number | number[]; + cornerRadius: number | number[]; clip: boolean; visibleAll: boolean; }; diff --git a/packages/vrender/src/interface/graphic/polygon.ts b/packages/vrender/src/interface/graphic/polygon.ts index 39d519fe1..0c4ba4210 100644 --- a/packages/vrender/src/interface/graphic/polygon.ts +++ b/packages/vrender/src/interface/graphic/polygon.ts @@ -4,7 +4,7 @@ import type { IGraphicAttribute, IGraphic } from '../graphic'; export type IPolygonAttribute = { // ? 不需要x2/y2 points: IPointLike[]; - borderRadius?: number | number[]; + cornerRadius?: number | number[]; }; export type IPolygonGraphicAttribute = Partial & Partial; diff --git a/packages/vrender/src/interface/graphic/rect.ts b/packages/vrender/src/interface/graphic/rect.ts index c473d38d2..d0e0df49c 100644 --- a/packages/vrender/src/interface/graphic/rect.ts +++ b/packages/vrender/src/interface/graphic/rect.ts @@ -4,7 +4,7 @@ import type { IGraphicAttribute, IGraphic } from '../graphic'; export type IRectAttribute = { width: number; height: number; - borderRadius: number | number[]; + cornerRadius: number | number[]; }; export type IRectGraphicAttribute = Partial & Partial; diff --git a/packages/vrender/src/picker/contributions/canvas-picker/rect-picker.ts b/packages/vrender/src/picker/contributions/canvas-picker/rect-picker.ts index b3dcfcbbb..accf86f83 100644 --- a/packages/vrender/src/picker/contributions/canvas-picker/rect-picker.ts +++ b/packages/vrender/src/picker/contributions/canvas-picker/rect-picker.ts @@ -31,7 +31,7 @@ export class DefaultCanvasRectPicker implements IGraphicPicker { // const { rectAttribute } = graphicService.themeService.getCurrentTheme(); const rectAttribute = getTheme(rect).rect; - const { borderRadius = rectAttribute.borderRadius } = rect.attribute; + const { cornerRadius = rectAttribute.cornerRadius } = rect.attribute; let { x = rectAttribute.x, y = rectAttribute.y } = rect.attribute; pickContext.highPerformanceSave(); @@ -54,8 +54,8 @@ export class DefaultCanvasRectPicker implements IGraphicPicker { // 处理圆角情况,无圆角直接使用bounds判断结果 if ( !onlyTranslate || - (isNumber(borderRadius, true) && borderRadius !== 0) || - (isArray(borderRadius) && (borderRadius).some(num => num !== 0)) + (isNumber(cornerRadius, true) && cornerRadius !== 0) || + (isArray(cornerRadius) && (cornerRadius).some(num => num !== 0)) ) { // 详细形状判断 picked = false; diff --git a/packages/vrender/src/picker/contributions/math-picker/rect-picker.ts b/packages/vrender/src/picker/contributions/math-picker/rect-picker.ts index bc1b394d2..d8209c8fb 100644 --- a/packages/vrender/src/picker/contributions/math-picker/rect-picker.ts +++ b/packages/vrender/src/picker/contributions/math-picker/rect-picker.ts @@ -30,7 +30,7 @@ export class DefaultMathRectPicker implements IGraphicPicker { // const { rectAttribute } = graphicService.themeService.getCurrentTheme(); const rectAttribute = getTheme(rect).rect; - const { borderRadius = rectAttribute.borderRadius } = rect.attribute; + const { cornerRadius = rectAttribute.cornerRadius } = rect.attribute; let { x = rectAttribute.x, y = rectAttribute.y } = rect.attribute; pickContext.highPerformanceSave(); @@ -53,8 +53,8 @@ export class DefaultMathRectPicker implements IGraphicPicker { // 处理圆角情况,无圆角直接使用bounds判断结果 if ( !onlyTranslate || - (isNumber(borderRadius, true) && borderRadius !== 0) || - (isArray(borderRadius) && (borderRadius).some(num => num !== 0)) + (isNumber(cornerRadius, true) && cornerRadius !== 0) || + (isArray(cornerRadius) && (cornerRadius).some(num => num !== 0)) ) { // 详细形状判断 picked = false; diff --git a/packages/vrender/src/render/contributions/render/contributions/rect-contribution-render.ts b/packages/vrender/src/render/contributions/render/contributions/rect-contribution-render.ts index 22a9a41aa..d5fd78806 100644 --- a/packages/vrender/src/render/contributions/render/contributions/rect-contribution-render.ts +++ b/packages/vrender/src/render/contributions/render/contributions/rect-contribution-render.ts @@ -73,7 +73,7 @@ export class DefaultRectRenderContribution implements IRectRenderContribution { const { width = rectAttribute.width, height = rectAttribute.height, - borderRadius = rectAttribute.borderRadius, + cornerRadius = rectAttribute.cornerRadius, opacity = rectAttribute.opacity, outerBorder, innerBorder @@ -85,7 +85,7 @@ export class DefaultRectRenderContribution implements IRectRenderContribution { const nextX = x - d; const nextY = y - d; const dw = d * 2; - if (borderRadius === 0 || (isArray(borderRadius) && (borderRadius).every(num => num === 0))) { + if (cornerRadius === 0 || (isArray(cornerRadius) && (cornerRadius).every(num => num === 0))) { // 不需要处理圆角 context.beginPath(); context.rect(nextX, nextY, width + dw, height + dw); @@ -93,7 +93,7 @@ export class DefaultRectRenderContribution implements IRectRenderContribution { context.beginPath(); // 测试后,cache对于重绘性能提升不大,但是在首屏有一定性能损耗,因此rect不再使用cache - createRectPath(context, nextX, nextY, width + dw, height + dw, borderRadius); + createRectPath(context, nextX, nextY, width + dw, height + dw, cornerRadius); } // shadow @@ -117,7 +117,7 @@ export class DefaultRectRenderContribution implements IRectRenderContribution { const nextX = x + d; const nextY = y + d; const dw = d * 2; - if (borderRadius === 0 || (isArray(borderRadius) && (borderRadius).every(num => num === 0))) { + if (cornerRadius === 0 || (isArray(cornerRadius) && (cornerRadius).every(num => num === 0))) { // 不需要处理圆角 context.beginPath(); context.rect(nextX, nextY, width - dw, height - dw); @@ -125,7 +125,7 @@ export class DefaultRectRenderContribution implements IRectRenderContribution { context.beginPath(); // 测试后,cache对于重绘性能提升不大,但是在首屏有一定性能损耗,因此rect不再使用cache - createRectPath(context, nextX, nextY, width - dw, height - dw, borderRadius); + createRectPath(context, nextX, nextY, width - dw, height - dw, cornerRadius); } // shadow diff --git a/packages/vrender/src/render/contributions/render/group-render.ts b/packages/vrender/src/render/contributions/render/group-render.ts index 7e5f16b34..b55c15475 100644 --- a/packages/vrender/src/render/contributions/render/group-render.ts +++ b/packages/vrender/src/render/contributions/render/group-render.ts @@ -55,7 +55,7 @@ export class DefaultCanvasGroupRender implements IGraphicRender { clip = groupAttribute.clip, fillOpacity = groupAttribute.fillOpacity, strokeOpacity = groupAttribute.strokeOpacity, - borderRadius = groupAttribute.borderRadius, + cornerRadius = groupAttribute.cornerRadius, path = groupAttribute.path, lineWidth = groupAttribute.lineWidth, visible = groupAttribute.visible @@ -97,14 +97,14 @@ export class DefaultCanvasGroupRender implements IGraphicRender { context.disableFill = disableFill; context.disableStroke = disableStroke; context.disableBeginPath = disableBeginPath; - } else if (borderRadius === 0 || (isArray(borderRadius) && (borderRadius).every(num => num === 0))) { + } else if (cornerRadius === 0 || (isArray(cornerRadius) && (cornerRadius).every(num => num === 0))) { // 不需要处理圆角 context.beginPath(); context.rect(x, y, width, height); } else { context.beginPath(); // 测试后,cache对于重绘性能提升不大,但是在首屏有一定性能损耗,因此rect不再使用cache - createRectPath(context, x, y, width, height, borderRadius); + createRectPath(context, x, y, width, height, cornerRadius); } if (!this._groupRenderContribitions) { diff --git a/packages/vrender/src/render/contributions/render/polygon-render.ts b/packages/vrender/src/render/contributions/render/polygon-render.ts index cd1a39d53..9a6454444 100644 --- a/packages/vrender/src/render/contributions/render/polygon-render.ts +++ b/packages/vrender/src/render/contributions/render/polygon-render.ts @@ -48,7 +48,7 @@ export class DefaultCanvasPolygonRender implements IGraphicRender { points = polygonAttribute.points, fill = polygonAttribute.fill, stroke = polygonAttribute.stroke, - borderRadius = polygonAttribute.borderRadius, + cornerRadius = polygonAttribute.cornerRadius, fillOpacity = polygonAttribute.fillOpacity, background, strokeOpacity = polygonAttribute.strokeOpacity, @@ -76,11 +76,11 @@ export class DefaultCanvasPolygonRender implements IGraphicRender { } context.beginPath(); - if ((borderRadius as number) <= 0 || (isArray(borderRadius) && (borderRadius).every(num => num === 0))) { + if ((cornerRadius as number) <= 0 || (isArray(cornerRadius) && (cornerRadius).every(num => num === 0))) { drawPolygon(context.camera ? context : context.nativeContext, points, x, y); } else { // FIXME: type - drawRoundedPolygon(context.camera ? context : context.nativeContext, points, x, y, borderRadius); + drawRoundedPolygon(context.camera ? context : context.nativeContext, points, x, y, cornerRadius); } // polygon 默认闭合 context.closePath(); diff --git a/packages/vrender/src/render/contributions/render/rect-render.ts b/packages/vrender/src/render/contributions/render/rect-render.ts index d51f4eed3..055fc90ed 100644 --- a/packages/vrender/src/render/contributions/render/rect-render.ts +++ b/packages/vrender/src/render/contributions/render/rect-render.ts @@ -50,7 +50,7 @@ export class DefaultCanvasRectRender implements IGraphicRender { stroke = rectAttribute.stroke, width = rectAttribute.width, height = rectAttribute.height, - borderRadius = rectAttribute.borderRadius, + cornerRadius = rectAttribute.cornerRadius, opacity = rectAttribute.opacity, fillOpacity = rectAttribute.fillOpacity, lineWidth = rectAttribute.lineWidth, @@ -77,7 +77,7 @@ export class DefaultCanvasRectRender implements IGraphicRender { return; } - if (borderRadius === 0 || (isArray(borderRadius) && (borderRadius).every(num => num === 0))) { + if (cornerRadius === 0 || (isArray(cornerRadius) && (cornerRadius).every(num => num === 0))) { // 不需要处理圆角 context.beginPath(); context.rect(x, y, width, height); @@ -85,7 +85,7 @@ export class DefaultCanvasRectRender implements IGraphicRender { context.beginPath(); // 测试后,cache对于重绘性能提升不大,但是在首屏有一定性能损耗,因此rect不再使用cache - createRectPath(context, x, y, width, height, borderRadius); + createRectPath(context, x, y, width, height, cornerRadius); } if (!this._rectRenderContribitions) { From 925dcae6724a1697d84cf99d14b35a4e21180bb1 Mon Sep 17 00:00:00 2001 From: Howard Zhang Date: Tue, 20 Jun 2023 21:16:06 +0800 Subject: [PATCH 08/24] fix: cr problems --- packages/vrender-components/src/tooltip/tooltip.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vrender-components/src/tooltip/tooltip.ts b/packages/vrender-components/src/tooltip/tooltip.ts index a619314e4..0d9b6f9fe 100644 --- a/packages/vrender-components/src/tooltip/tooltip.ts +++ b/packages/vrender-components/src/tooltip/tooltip.ts @@ -144,16 +144,16 @@ export class Tooltip extends AbstractComponent> { let x = 0; if (isVisible(itemAttr.shape)) { // 存在 symbol - const element = itemGroup.createOrUpdateChild( + itemGroup.createOrUpdateChild( `${itemGroupName}-${TOOLTIP_SHAPE_NAME_SUFFIX}`, { visible: true, x: itemAttr.shape.size / 2, + y: itemAttr.height / 2, ...itemAttr.shape }, 'symbol' ) as ISymbol; - element.setAttribute('y', itemAttr.height / 2); } if (hasContentShape) { x += itemAttr.shape.size + itemAttr.shape.spacing; From 6ec53bc5cb634551633c55233c10ba3788b7cfd5 Mon Sep 17 00:00:00 2001 From: zhouxinyu Date: Wed, 21 Jun 2023 08:34:08 +0800 Subject: [PATCH 09/24] perf: optimize the performance of setAttributes, closed #26 --- docs/demos/src/pages/chart.ts | 8 ++++---- packages/vrender/src/graphic/graphic.ts | 12 +++++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/docs/demos/src/pages/chart.ts b/docs/demos/src/pages/chart.ts index 8cec03f59..334c4cb09 100644 --- a/docs/demos/src/pages/chart.ts +++ b/docs/demos/src/pages/chart.ts @@ -18,7 +18,7 @@ import { AnimateGroup, AttributeAnimate } from '@visactor/vrender'; -import { json } from './json'; +// import { json } from './json'; // import { json3 } from './xtable'; import { roughModule } from '@visactor/vrender-kits'; @@ -82,9 +82,9 @@ export const page = () => { const layer = stage.at(0); - json.children[0].children.forEach(item => { - _add(layer, item); - }); + // json.children[0].children.forEach(item => { + // _add(layer, item); + // }); stage.set3dOptions({ alpha: 0, // beta: 0, diff --git a/packages/vrender/src/graphic/graphic.ts b/packages/vrender/src/graphic/graphic.ts index 81632a4cd..5036fad08 100644 --- a/packages/vrender/src/graphic/graphic.ts +++ b/packages/vrender/src/graphic/graphic.ts @@ -148,6 +148,9 @@ export abstract class Graphic = Partial, @@ -1275,10 +1278,13 @@ export abstract class Graphic = Partial; From 0938caf23408453e10e1d950bced0654b8752e2d Mon Sep 17 00:00:00 2001 From: zhouxinyu Date: Wed, 21 Jun 2023 13:37:49 +0800 Subject: [PATCH 10/24] chore: add release local script --- common/scripts/pre-release.js | 102 ++++++++++++++++++++++++++++++++++ common/scripts/release.js | 74 ++++++++++++++++++++++++ 2 files changed, 176 insertions(+) create mode 100644 common/scripts/pre-release.js create mode 100644 common/scripts/release.js diff --git a/common/scripts/pre-release.js b/common/scripts/pre-release.js new file mode 100644 index 000000000..a919dc60f --- /dev/null +++ b/common/scripts/pre-release.js @@ -0,0 +1,102 @@ +/** + * prelease + */ + +const { spawnSync } = require('child_process') +const fs = require('fs') +const path = require('path') + +function getPackageJson(pkgJsonPath) { + const pkgJson = fs.readFileSync(pkgJsonPath, { encoding: 'utf-8' }) + return JSON.parse(pkgJson); +} + +const semverRegex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-(alpha|beta|rc)(?:\.(?:(0|[1-9])))*)$/; + +const preReleaseNameReg = /^((alpha|beta|rc)(?:\.(?:0|[1-9]))*)$/; + +function run() { + let preReleaseName = process.argv.slice(2)[0]; + let preReleaseType = ''; + const cwd = process.cwd(); + const rushJson = getPackageJson(`${cwd}/rush.json`) + const package = rushJson.projects.find((project) => project.packageName === '@visactor/vrender'); + let regRes = null; + + if (typeof preReleaseName === 'string' && preReleaseName && (regRes = preReleaseNameReg.exec(preReleaseName))) { + preReleaseType = regRes[2]; + } else if (!preReleaseName) { + if (package) { + const pkgJsonPath = path.resolve(package.projectFolder, 'package.json') + const pkgJson = getPackageJson(pkgJsonPath) + const currentVersion = pkgJson.version; + + if ((regRes = semverRegex.exec(currentVersion))) { + preReleaseType = regRes[4]; + + if (regRes[5]) { + preReleaseName = `${preReleaseType}.${parseInt(regRes[5], 10) + 1}`; + } else { + preReleaseName = `${preReleaseType}.0`; + } + + console.log(`\x1b[31m[warning]\x1b[0m no prerelease-name supply, auto calculate prerelease-name \x1b[31m${preReleaseName}\x1b[0m`); + } else { + preReleaseName = `alpha.0`; + preReleaseType = 'alpha'; + + console.log('\x1b[31m[warning]\x1b[0m no prerelease-name supply, default to \x1b[31m alpha.0\x1b[0m') + } + } + } else { + console.log(`\x1b[31m[error]\x1b[0m preReleaseName: \x1b[31m ${preReleaseName} \x1b[0m 不符合规范,只允许 alpha.0 , beta.1, rc.3 类似的格式 `) + } + + if (preReleaseName && preReleaseType) { + // 1. apply version and update version of package.json + spawnSync('sh', ['-c', `rush publish --apply --prerelease-name ${preReleaseName} --partial-prerelease`], { + stdio: 'inherit', + shell: false, + }); + + + // 2. build all the packages + spawnSync('sh', ['-c', `rush build --only tag:package`], { + stdio: 'inherit', + shell: false, + }); + + + + // 3. publish to npm + spawnSync('sh', ['-c', `rush publish --publish --include-all --tag ${preReleaseType}`], { + stdio: 'inherit', + shell: false, + }); + + // 4. update version of local packages to shrinkwrap + spawnSync('sh', ['-c', `rush update`], { + stdio: 'inherit', + shell: false, + }); + + if (package) { + const pkgJsonPath = path.resolve(package.projectFolder, 'package.json') + const pkgJson = getPackageJson(pkgJsonPath) + + // 5. add the the changes + spawnSync('sh', ['-c', `git add --all`], { + stdio: 'inherit', + shell: false, + }); + + // 6. commit all the changes + spawnSync('sh', ['-c', `git commit -m "build: prerelease version ${pkgJson.version}"`], { + stdio: 'inherit', + shell: false, + }); + } + } +} + +run() diff --git a/common/scripts/release.js b/common/scripts/release.js new file mode 100644 index 000000000..e7ea515db --- /dev/null +++ b/common/scripts/release.js @@ -0,0 +1,74 @@ +/** + * release + */ + +const { spawnSync } = require('child_process') +const fs = require('fs') +const path = require('path') + +function getPackageJson(pkgJsonPath) { + const pkgJson = fs.readFileSync(pkgJsonPath, { encoding: 'utf-8' }) + return JSON.parse(pkgJson) +} + +function run() { + const cwd = process.cwd(); + + // 1. update version of package.json, this operation will remove the common/changes + spawnSync('sh', ['-c', `rush version --bump`], { + stdio: 'inherit', + shell: false, + }); + + // 2. build all the packages + spawnSync('sh', ['-c', `rush build --only tag:package`], { + stdio: 'inherit', + shell: false, + }); + + // 3. publish to npm + spawnSync('sh', ['-c', 'rush publish --publish --include-all'], { + stdio: 'inherit', + shell: false, + }); + + // 4. update version of local packages to shrinkwrap + spawnSync('sh', ['-c', `rush update`], { + stdio: 'inherit', + shell: false, + }); + + const rushJson = getPackageJson(`${cwd}/rush.json`); + const package = rushJson.projects.find((project) => project.name === '@visactor/vrender'); + + if (package) { + const pkgJsonPath = path.resolve(project.projectFolder, 'package.json') + const pkgJson = getPackageJson(pkgJsonPath) + + // 5. add tag + spawnSync('sh', ['-c', `git tag v${pkgJson.versopn}`], { + stdio: 'inherit', + shell: false, + }); + + // 6. add all the changes + spawnSync('sh', ['-c', `git add --all`], { + stdio: 'inherit', + shell: false, + }); + + // 7. commit all the changes + spawnSync('sh', ['-c', `git commit -m "build: publish version ${pkgJson.version}"`], { + stdio: 'inherit', + shell: false, + }); + + // 8. push tag to origin + spawnSync('sh', ['-c', `git push origin v${pkgJson.version}`], { + stdio: 'inherit', + shell: false, + }); + } +} + +run() From b78454af12416b2aa409220095a37bae89ab4653 Mon Sep 17 00:00:00 2001 From: zhouxinyu Date: Wed, 21 Jun 2023 13:56:14 +0800 Subject: [PATCH 11/24] chore: edit vutils version --- docs/demos/package.json | 2 +- packages/react-vrender-utils/package.json | 2 +- packages/react-vrender/package.json | 2 +- packages/vrender-components/package.json | 2 +- packages/vrender-kits/package.json | 2 +- packages/vrender/package.json | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/demos/package.json b/docs/demos/package.json index ccb442bef..713dd4ed4 100644 --- a/docs/demos/package.json +++ b/docs/demos/package.json @@ -11,7 +11,7 @@ "devDependencies": { "@internal/eslint-config": "workspace:*", "@internal/ts-config": "workspace:*", - "@visactor/vutils": "~0.11.0", + "@visactor/vutils": "~0.9.2-alpha.5", "@visactor/vrender-kits": "workspace:0.10.3", "d3-scale-chromatic": "^3.0.0", "lodash": "4.17.21", diff --git a/packages/react-vrender-utils/package.json b/packages/react-vrender-utils/package.json index 9d7fb6d45..17f78e5f9 100644 --- a/packages/react-vrender-utils/package.json +++ b/packages/react-vrender-utils/package.json @@ -27,7 +27,7 @@ "dependencies": { "@visactor/vrender": "workspace:0.10.3", "@visactor/react-vrender": "workspace:0.10.3", - "@visactor/vutils": "~0.11.0", + "@visactor/vutils": "~0.9.2-alpha.5", "react-reconciler": "^0.29.0", "tslib": "^2.3.1" }, diff --git a/packages/react-vrender/package.json b/packages/react-vrender/package.json index c68dfd9ef..91caae371 100644 --- a/packages/react-vrender/package.json +++ b/packages/react-vrender/package.json @@ -25,7 +25,7 @@ }, "dependencies": { "@visactor/vrender": "workspace:0.10.3", - "@visactor/vutils": "~0.11.0", + "@visactor/vutils": "~0.9.2-alpha.5", "react-reconciler": "^0.29.0", "tslib": "^2.3.1" }, diff --git a/packages/vrender-components/package.json b/packages/vrender-components/package.json index 0f6004f9f..4ff2e566c 100644 --- a/packages/vrender-components/package.json +++ b/packages/vrender-components/package.json @@ -25,7 +25,7 @@ }, "dependencies": { "@visactor/vrender": "workspace:0.10.3", - "@visactor/vutils": "~0.11.0", + "@visactor/vutils": "~0.9.2-alpha.5", "@visactor/vscale": "0.9.0-alpha.2", "gl-matrix": "^3.4.3" }, diff --git a/packages/vrender-kits/package.json b/packages/vrender-kits/package.json index 986160aa7..4267b9096 100644 --- a/packages/vrender-kits/package.json +++ b/packages/vrender-kits/package.json @@ -22,7 +22,7 @@ }, "dependencies": { "@visactor/vrender": "workspace:0.10.3", - "@visactor/vutils": "~0.11.0", + "@visactor/vutils": "~0.9.2-alpha.5", "@resvg/resvg-js": "2.4.1", "canvas": "2.11.2", "inversify": "6.0.1", diff --git a/packages/vrender/package.json b/packages/vrender/package.json index 6025fd1a5..58edfcfab 100644 --- a/packages/vrender/package.json +++ b/packages/vrender/package.json @@ -23,7 +23,7 @@ "ci": "node github-ci.js" }, "dependencies": { - "@visactor/vutils": "~0.11.0", + "@visactor/vutils": "~0.9.2-alpha.5", "color-convert": "2.0.1", "inversify": "6.0.1", "reflect-metadata": "0.1.13" From 76d366bcdd1b45db388dd42c2f2b61e4a94445a7 Mon Sep 17 00:00:00 2001 From: zhouxinyu Date: Wed, 21 Jun 2023 16:43:17 +0800 Subject: [PATCH 12/24] chore: run rush update --- common/config/rush/pnpm-lock.yaml | 32 +++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index a44729027..b1791008b 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -14,7 +14,7 @@ importers: '@internal/ts-config': workspace:* '@visactor/vrender': workspace:0.10.3 '@visactor/vrender-kits': workspace:0.10.3 - '@visactor/vutils': 0.9.0-alpha.2 + '@visactor/vutils': ~0.9.2-alpha.5 canvas: 2.11.2 d3-scale-chromatic: ^3.0.0 dat.gui: ^0.7.9 @@ -34,7 +34,7 @@ importers: '@internal/eslint-config': link:../../share/eslint-config '@internal/ts-config': link:../../share/ts-config '@visactor/vrender-kits': link:../../packages/vrender-kits - '@visactor/vutils': 0.9.0-alpha.2 + '@visactor/vutils': 0.9.2-alpha.5 canvas: 2.11.2 d3-scale-chromatic: 3.0.0 dat.gui: 0.7.9 @@ -56,7 +56,7 @@ importers: '@types/react-dom': 16.9.8 '@types/react-reconciler': ^0.28.2 '@visactor/vrender': workspace:0.10.3 - '@visactor/vutils': 0.9.0-alpha.2 + '@visactor/vutils': ~0.9.2-alpha.5 '@vitejs/plugin-react': 3.1.0 eslint: ~8.18.0 react: 16.13.0 @@ -67,7 +67,7 @@ importers: vite: 3.2.6 dependencies: '@visactor/vrender': link:../vrender - '@visactor/vutils': 0.9.0-alpha.2 + '@visactor/vutils': 0.9.2-alpha.5 react-reconciler: 0.29.0_react@16.13.0 tslib: 2.5.3 devDependencies: @@ -95,7 +95,7 @@ importers: '@types/react-dom': 16.9.8 '@visactor/react-vrender': workspace:0.10.3 '@visactor/vrender': workspace:0.10.3 - '@visactor/vutils': 0.9.0-alpha.2 + '@visactor/vutils': ~0.9.2-alpha.5 '@vitejs/plugin-react': 3.1.0 eslint: ~8.18.0 react: 16.13.0 @@ -107,7 +107,7 @@ importers: dependencies: '@visactor/react-vrender': link:../react-vrender '@visactor/vrender': link:../vrender - '@visactor/vutils': 0.9.0-alpha.2 + '@visactor/vutils': 0.9.2-alpha.5 react-reconciler: 0.29.0_react@16.13.0 tslib: 2.5.3 devDependencies: @@ -133,7 +133,7 @@ importers: '@types/jest': ^26.0.0 '@types/react': 16.9.49 '@types/react-dom': 16.9.8 - '@visactor/vutils': 0.9.0-alpha.2 + '@visactor/vutils': ~0.9.2-alpha.5 '@vitejs/plugin-react': 3.1.0 color-convert: 2.0.1 eslint: ~8.18.0 @@ -150,7 +150,7 @@ importers: typescript: 4.9.5 vite: 3.2.6 dependencies: - '@visactor/vutils': 0.9.0-alpha.2 + '@visactor/vutils': 0.9.2-alpha.5 color-convert: 2.0.1 inversify: 6.0.1 reflect-metadata: 0.1.13 @@ -184,7 +184,7 @@ importers: '@types/jest': ^26.0.0 '@visactor/vrender': workspace:0.10.3 '@visactor/vscale': 0.9.0-alpha.2 - '@visactor/vutils': 0.9.0-alpha.2 + '@visactor/vutils': ~0.9.2-alpha.5 eslint: ~8.18.0 gl-matrix: ^3.4.3 jest: ^26.0.0 @@ -196,7 +196,7 @@ importers: dependencies: '@visactor/vrender': link:../vrender '@visactor/vscale': 0.9.0-alpha.2 - '@visactor/vutils': 0.9.0-alpha.2 + '@visactor/vutils': 0.9.2-alpha.5 gl-matrix: 3.4.3 devDependencies: '@internal/bundler': link:../../tools/bundler @@ -223,7 +223,7 @@ importers: '@types/react': 16.9.49 '@types/react-dom': 16.9.8 '@visactor/vrender': workspace:0.10.3 - '@visactor/vutils': 0.9.0-alpha.2 + '@visactor/vutils': ~0.9.2-alpha.5 '@vitejs/plugin-react': 3.1.0 canvas: 2.11.2 eslint: ~8.18.0 @@ -238,7 +238,7 @@ importers: dependencies: '@resvg/resvg-js': 2.4.1 '@visactor/vrender': link:../vrender - '@visactor/vutils': 0.9.0-alpha.2 + '@visactor/vutils': 0.9.2-alpha.5 canvas: 2.11.2 inversify: 6.0.1 node-fetch: 2.6.6 @@ -3087,6 +3087,14 @@ packages: '@turf/helpers': 6.5.0 '@turf/invariant': 6.5.0 eventemitter3: 4.0.7 + dev: false + + /@visactor/vutils/0.9.2-alpha.5: + resolution: {integrity: sha512-EtgNA7eu7gFVTXk5f747uX/cpDPh0be56tk8gzbKsIaO6Jwld7UIe6IZ/ir/FXp+isvtStaQx1Y9QXRyWoRseQ==} + dependencies: + '@turf/helpers': 6.5.0 + '@turf/invariant': 6.5.0 + eventemitter3: 4.0.7 /@vitejs/plugin-react/3.1.0_vite@3.2.6: resolution: {integrity: sha512-AfgcRL8ZBhAlc3BFdigClmTUMISmmzHn7sB2h9U1odvc5U/MjWXsAaz18b/WoppUTDBzxOJwo2VdClfUcItu9g==} From 5b9fd3f772ba9eb8dda2903dddccc6760d1736c6 Mon Sep 17 00:00:00 2001 From: neuqzxy Date: Wed, 21 Jun 2023 08:54:04 +0000 Subject: [PATCH 13/24] build: prelease version 0.11.0-alpha.1 --- common/config/rush/pnpm-lock.yaml | 14 +++++++------- docs/demos/package.json | 4 ++-- packages/react-vrender-utils/package.json | 6 +++--- packages/react-vrender/package.json | 4 ++-- packages/vrender-components/package.json | 4 ++-- packages/vrender-kits/package.json | 4 ++-- packages/vrender/package.json | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index b1791008b..4f2807493 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: '@esbuild-plugins/node-modules-polyfill': 0.1.4 '@internal/eslint-config': workspace:* '@internal/ts-config': workspace:* - '@visactor/vrender': workspace:0.10.3 - '@visactor/vrender-kits': workspace:0.10.3 + '@visactor/vrender': workspace:0.11.0-alpha.1 + '@visactor/vrender-kits': workspace:0.11.0-alpha.1 '@visactor/vutils': ~0.9.2-alpha.5 canvas: 2.11.2 d3-scale-chromatic: ^3.0.0 @@ -55,7 +55,7 @@ importers: '@types/react': 16.9.49 '@types/react-dom': 16.9.8 '@types/react-reconciler': ^0.28.2 - '@visactor/vrender': workspace:0.10.3 + '@visactor/vrender': workspace:0.11.0-alpha.1 '@visactor/vutils': ~0.9.2-alpha.5 '@vitejs/plugin-react': 3.1.0 eslint: ~8.18.0 @@ -93,8 +93,8 @@ importers: '@rushstack/eslint-patch': ~1.1.4 '@types/react': 16.9.49 '@types/react-dom': 16.9.8 - '@visactor/react-vrender': workspace:0.10.3 - '@visactor/vrender': workspace:0.10.3 + '@visactor/react-vrender': workspace:0.11.0-alpha.1 + '@visactor/vrender': workspace:0.11.0-alpha.1 '@visactor/vutils': ~0.9.2-alpha.5 '@vitejs/plugin-react': 3.1.0 eslint: ~8.18.0 @@ -182,7 +182,7 @@ importers: '@internal/ts-config': workspace:* '@rushstack/eslint-patch': ~1.1.4 '@types/jest': ^26.0.0 - '@visactor/vrender': workspace:0.10.3 + '@visactor/vrender': workspace:0.11.0-alpha.1 '@visactor/vscale': 0.9.0-alpha.2 '@visactor/vutils': ~0.9.2-alpha.5 eslint: ~8.18.0 @@ -222,7 +222,7 @@ importers: '@types/node-fetch': 2.6.4 '@types/react': 16.9.49 '@types/react-dom': 16.9.8 - '@visactor/vrender': workspace:0.10.3 + '@visactor/vrender': workspace:0.11.0-alpha.1 '@visactor/vutils': ~0.9.2-alpha.5 '@vitejs/plugin-react': 3.1.0 canvas: 2.11.2 diff --git a/docs/demos/package.json b/docs/demos/package.json index 713dd4ed4..c4ee86003 100644 --- a/docs/demos/package.json +++ b/docs/demos/package.json @@ -12,7 +12,7 @@ "@internal/eslint-config": "workspace:*", "@internal/ts-config": "workspace:*", "@visactor/vutils": "~0.9.2-alpha.5", - "@visactor/vrender-kits": "workspace:0.10.3", + "@visactor/vrender-kits": "workspace:0.11.0-alpha.1", "d3-scale-chromatic": "^3.0.0", "lodash": "4.17.21", "dat.gui": "^0.7.9", @@ -28,6 +28,6 @@ "@antv/g": "^5.7.4" }, "dependencies": { - "@visactor/vrender": "workspace:0.10.3" + "@visactor/vrender": "workspace:0.11.0-alpha.1" } } diff --git a/packages/react-vrender-utils/package.json b/packages/react-vrender-utils/package.json index 17f78e5f9..cfedcd949 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.10.3", + "version": "0.11.0-alpha.1", "description": "", "sideEffects": false, "main": "cjs/index.js", @@ -25,8 +25,8 @@ "react-dom": "^18.2.0" }, "dependencies": { - "@visactor/vrender": "workspace:0.10.3", - "@visactor/react-vrender": "workspace:0.10.3", + "@visactor/vrender": "workspace:0.11.0-alpha.1", + "@visactor/react-vrender": "workspace:0.11.0-alpha.1", "@visactor/vutils": "~0.9.2-alpha.5", "react-reconciler": "^0.29.0", "tslib": "^2.3.1" diff --git a/packages/react-vrender/package.json b/packages/react-vrender/package.json index 91caae371..33cc6a1fe 100644 --- a/packages/react-vrender/package.json +++ b/packages/react-vrender/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/react-vrender", - "version": "0.10.3", + "version": "0.11.0-alpha.1", "description": "", "sideEffects": false, "main": "cjs/index.js", @@ -24,7 +24,7 @@ "react": "^18.2.0" }, "dependencies": { - "@visactor/vrender": "workspace:0.10.3", + "@visactor/vrender": "workspace:0.11.0-alpha.1", "@visactor/vutils": "~0.9.2-alpha.5", "react-reconciler": "^0.29.0", "tslib": "^2.3.1" diff --git a/packages/vrender-components/package.json b/packages/vrender-components/package.json index 4ff2e566c..4d37e26d0 100644 --- a/packages/vrender-components/package.json +++ b/packages/vrender-components/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vrender-components", - "version": "0.10.3", + "version": "0.11.0-alpha.1", "description": "components library for dp visualization", "sideEffects": false, "main": "cjs/index.js", @@ -24,7 +24,7 @@ "prepublishOnly": "npm run build" }, "dependencies": { - "@visactor/vrender": "workspace:0.10.3", + "@visactor/vrender": "workspace:0.11.0-alpha.1", "@visactor/vutils": "~0.9.2-alpha.5", "@visactor/vscale": "0.9.0-alpha.2", "gl-matrix": "^3.4.3" diff --git a/packages/vrender-kits/package.json b/packages/vrender-kits/package.json index 4267b9096..37818caa3 100644 --- a/packages/vrender-kits/package.json +++ b/packages/vrender-kits/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vrender-kits", - "version": "0.10.3", + "version": "0.11.0-alpha.1", "description": "", "sideEffects": false, "main": "cjs/index.js", @@ -21,7 +21,7 @@ "prepublishOnly": "npm run build" }, "dependencies": { - "@visactor/vrender": "workspace:0.10.3", + "@visactor/vrender": "workspace:0.11.0-alpha.1", "@visactor/vutils": "~0.9.2-alpha.5", "@resvg/resvg-js": "2.4.1", "canvas": "2.11.2", diff --git a/packages/vrender/package.json b/packages/vrender/package.json index 58edfcfab..d83189fec 100644 --- a/packages/vrender/package.json +++ b/packages/vrender/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vrender", - "version": "0.10.3", + "version": "0.11.0-alpha.1", "description": "", "sideEffects": true, "main": "cjs/index.js", From 5f6473f15680d8e4b85c336fb57432869f0f52af Mon Sep 17 00:00:00 2001 From: zhouxinyu Date: Sun, 25 Jun 2023 11:53:37 +0800 Subject: [PATCH 14/24] fix: fix the bug of gradient-color caused by bounds and offsetXY --- .../fix-gradient-color_2023-06-25-03-54.json | 10 ++++++++++ docs/demos/src/pages/arc.ts | 13 +++++++++++++ docs/demos/src/pages/area.ts | 17 ++++++++++++----- docs/demos/src/pages/circle.ts | 13 ++++++++++++- docs/demos/src/pages/line.ts | 13 ++++++++++++- docs/demos/src/pages/polygon.ts | 15 +++++++++++++-- docs/demos/src/pages/rect.ts | 13 ++++++++++++- docs/demos/src/pages/text.ts | 13 ++++++++++++- .../render/contributions/render/arc-render.ts | 8 +++++--- .../render/contributions/render/area-render.ts | 3 ++- .../contributions/render/circle-render.ts | 8 +++++--- .../render/contributions/render/line-render.ts | 5 +++-- .../contributions/render/polygon-render.ts | 8 +++++--- .../render/contributions/render/rect-render.ts | 8 +++++--- .../render/contributions/render/text-render.ts | 12 +++++++----- 15 files changed, 128 insertions(+), 31 deletions(-) create mode 100644 common/changes/@visactor/vrender/fix-gradient-color_2023-06-25-03-54.json diff --git a/common/changes/@visactor/vrender/fix-gradient-color_2023-06-25-03-54.json b/common/changes/@visactor/vrender/fix-gradient-color_2023-06-25-03-54.json new file mode 100644 index 000000000..413273279 --- /dev/null +++ b/common/changes/@visactor/vrender/fix-gradient-color_2023-06-25-03-54.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender", + "comment": "fix the bug of gradient-color caused by bounds and offsetXY", + "type": "patch" + } + ], + "packageName": "@visactor/vrender" +} \ No newline at end of file diff --git a/docs/demos/src/pages/arc.ts b/docs/demos/src/pages/arc.ts index 0be0750e9..0d33cfb18 100644 --- a/docs/demos/src/pages/arc.ts +++ b/docs/demos/src/pages/arc.ts @@ -23,6 +23,19 @@ export const page = () => { endAngle: Math.PI * 2, x: 500, y: 200, + fill: { + gradient: 'linear', + x0: 0, + y0: 0, + x1: 1, + y1: 0, + stops: [ + { offset: 0, color: 'green' }, + { offset: 0.5, color: 'orange' }, + { offset: 1, color: 'red' } + ] + }, + fillOpacity: 0.3, background: '', texture: 'circle', diff --git a/docs/demos/src/pages/area.ts b/docs/demos/src/pages/area.ts index d0acf2c6b..02b09c997 100644 --- a/docs/demos/src/pages/area.ts +++ b/docs/demos/src/pages/area.ts @@ -1,9 +1,5 @@ import { createStage, createArea, container, IGraphic, global } from '@visactor/vrender'; -import { roughModule } from '@visactor/vrender-kits'; import { addShapesToStage, colorPools } from '../utils'; -import '../contribution/env-canvas/module'; - -global.setEnv('node'); const subP1 = [ [0, 100], @@ -42,7 +38,18 @@ export const page = () => { curveType: type as any, x: (i * 300) % 900 + 100, y: (Math.floor(i * 300 / 900)) * 200, - fill: 'red' + fill: { + gradient: 'linear', + x0: 0, + y0: 0, + x1: 1, + y1: 0, + stops: [ + { offset: 0, color: 'green' }, + { offset: 0.5, color: 'orange' }, + { offset: 1, color: 'red' } + ] + }, })); }); diff --git a/docs/demos/src/pages/circle.ts b/docs/demos/src/pages/circle.ts index 31aa5a5cd..f8c2c69c3 100644 --- a/docs/demos/src/pages/circle.ts +++ b/docs/demos/src/pages/circle.ts @@ -28,7 +28,18 @@ export const page = () => { radius: 50, x: 500, y: 200, - fill: colorPools[10], + fill: { + gradient: 'linear', + x0: 0, + y0: 0, + x1: 1, + y1: 0, + stops: [ + { offset: 0, color: 'green' }, + { offset: 0.5, color: 'orange' }, + { offset: 1, color: 'red' } + ] + }, // lineWidth: 2, outerBorder: { distance: 10, diff --git a/docs/demos/src/pages/line.ts b/docs/demos/src/pages/line.ts index ec320718c..318460ed4 100644 --- a/docs/demos/src/pages/line.ts +++ b/docs/demos/src/pages/line.ts @@ -99,7 +99,18 @@ export const page = () => { "x": 100, "y": 100, "curveType": "basis", - "stroke": "#2E62F1", + stroke: { + gradient: 'linear', + x0: 0, + y0: 0, + x1: 1, + y1: 0, + stops: [ + { offset: 0, color: 'green' }, + { offset: 0.5, color: 'orange' }, + { offset: 1, color: 'red' } + ] + }, "lineWidth": 2, "points": p })); diff --git a/docs/demos/src/pages/polygon.ts b/docs/demos/src/pages/polygon.ts index 5c9cd58db..e1912ae2f 100644 --- a/docs/demos/src/pages/polygon.ts +++ b/docs/demos/src/pages/polygon.ts @@ -16,7 +16,18 @@ export const page = () => { { x: 100, y: 100 }, { x: 0, y: 100 } ], - fill: colorPools[10], + fill: { + gradient: 'linear', + x0: 0, + y0: 0, + x1: 1, + y1: 0, + stops: [ + { offset: 0, color: 'green' }, + { offset: 0.5, color: 'orange' }, + { offset: 1, color: 'red' } + ] + }, stroke: colorPools[5], lineJoin: 'bevel', lineWidth: 20 @@ -107,7 +118,7 @@ export const page = () => { .loop(0) .to( { - fill: () => colorPools[~~(Math.random() * 10)] + fill: colorPools[~~(Math.random() * 10)] }, 1000, 'quadIn' diff --git a/docs/demos/src/pages/rect.ts b/docs/demos/src/pages/rect.ts index 687bcc3b4..3707ab5f4 100644 --- a/docs/demos/src/pages/rect.ts +++ b/docs/demos/src/pages/rect.ts @@ -21,7 +21,18 @@ export const page = () => { y: 100, width: 100, height: 100, - fill: colorPools[10], + fill: { + gradient: 'linear', + x0: 0, + y0: 0, + x1: 1, + y1: 0, + stops: [ + { offset: 0, color: 'green' }, + { offset: 0.5, color: 'orange' }, + { offset: 1, color: 'red' } + ] + }, cornerRadius: [5, 10, 15, 20], lineWidth: 5 })); diff --git a/docs/demos/src/pages/text.ts b/docs/demos/src/pages/text.ts index 9354ee888..9572fe918 100644 --- a/docs/demos/src/pages/text.ts +++ b/docs/demos/src/pages/text.ts @@ -18,7 +18,18 @@ export const page = () => { graphics.push(createText({ x: 300, y: 200, - fill: colorPools[5], + fill: { + gradient: 'linear', + x0: 0, + y0: 0, + x1: 1, + y1: 0, + stops: [ + { offset: 0, color: 'green' }, + { offset: 0.5, color: 'orange' }, + { offset: 1, color: 'red' } + ] + }, text: ['Test', 'test'], fontSize: 20, textBaseline: 'top' diff --git a/packages/vrender/src/render/contributions/render/arc-render.ts b/packages/vrender/src/render/contributions/render/arc-render.ts index 9c7c63087..690668e53 100644 --- a/packages/vrender/src/render/contributions/render/arc-render.ts +++ b/packages/vrender/src/render/contributions/render/arc-render.ts @@ -489,7 +489,9 @@ export class DefaultCanvasArcRender implements IGraphicRender { fillOpacity = arcAttribute.fillOpacity, lineWidth = arcAttribute.lineWidth, strokeOpacity = arcAttribute.strokeOpacity, - visible = arcAttribute.visible + visible = arcAttribute.visible, + x: originX = arcAttribute.x, + y: originY = arcAttribute.y } = arc.attribute; // 不绘制或者透明 const fVisible = fillVisible(opacity, fillOpacity); @@ -551,7 +553,7 @@ export class DefaultCanvasArcRender implements IGraphicRender { if (fillCb) { fillCb(context, arc.attribute, arcAttribute); } else if (fVisible) { - context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute); + context.setCommonStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute); context.fill(); } } @@ -560,7 +562,7 @@ export class DefaultCanvasArcRender implements IGraphicRender { if (strokeCb) { strokeCb(context, arc.attribute, arcAttribute); } else if (sVisible) { - context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute); + context.setStrokeStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute); context.stroke(); } } diff --git a/packages/vrender/src/render/contributions/render/area-render.ts b/packages/vrender/src/render/contributions/render/area-render.ts index 589108a58..345041deb 100644 --- a/packages/vrender/src/render/contributions/render/area-render.ts +++ b/packages/vrender/src/render/contributions/render/area-render.ts @@ -369,11 +369,12 @@ export class DefaultCanvasAreaRender implements IGraphicRender { // shadow context.setShadowStyle && context.setShadowStyle(area, attribute, defaultAttribute); + const { x: originX = 0, x: originY = 0 } = attribute; if (fill !== false) { if (fillCb) { fillCb(context, attribute, defaultAttribute); } else if (fillOpacity) { - context.setCommonStyle(area, attribute, offsetX, offsetY, defaultAttribute); + context.setCommonStyle(area, attribute, originX - offsetX, originY - offsetY, defaultAttribute); context.fill(); } } diff --git a/packages/vrender/src/render/contributions/render/circle-render.ts b/packages/vrender/src/render/contributions/render/circle-render.ts index 2388b6830..3ba3e7e8e 100644 --- a/packages/vrender/src/render/contributions/render/circle-render.ts +++ b/packages/vrender/src/render/contributions/render/circle-render.ts @@ -53,7 +53,9 @@ export class DefaultCanvasCircleRender implements IGraphicRender { strokeOpacity = circleAttribute.strokeOpacity, opacity = circleAttribute.opacity, lineWidth = circleAttribute.lineWidth, - visible = circleAttribute.visible + visible = circleAttribute.visible, + x: originX = circleAttribute.x, + y: originY = circleAttribute.y } = circle.attribute; // 不绘制或者透明 @@ -98,7 +100,7 @@ export class DefaultCanvasCircleRender implements IGraphicRender { if (fillCb) { fillCb(context, circle.attribute, circleAttribute); } else if (fVisible) { - context.setCommonStyle(circle, circle.attribute, x, y, circleAttribute); + context.setCommonStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute); context.fill(); } } @@ -107,7 +109,7 @@ export class DefaultCanvasCircleRender implements IGraphicRender { if (strokeCb) { strokeCb(context, circle.attribute, circleAttribute); } else if (sVisible) { - context.setStrokeStyle(circle, circle.attribute, x, y, circleAttribute); + context.setStrokeStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute); context.stroke(); } } diff --git a/packages/vrender/src/render/contributions/render/line-render.ts b/packages/vrender/src/render/contributions/render/line-render.ts index bcaa9eafd..63feaa62e 100644 --- a/packages/vrender/src/render/contributions/render/line-render.ts +++ b/packages/vrender/src/render/contributions/render/line-render.ts @@ -116,12 +116,13 @@ export class DefaultCanvasLineRender extends BaseRender implements IGraph // shadow context.setShadowStyle && context.setShadowStyle(line, attribute, defaultAttribute); + const { x: originX = 0, x: originY = 0 } = attribute; const ret: boolean = false; if (fill !== false) { if (fillCb) { fillCb(context, attribute, defaultAttribute); } else if (fillOpacity) { - context.setCommonStyle(line, attribute, offsetX, offsetY, defaultAttribute); + context.setCommonStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute); context.fill(); } } @@ -129,7 +130,7 @@ export class DefaultCanvasLineRender extends BaseRender implements IGraph if (strokeCb) { strokeCb(context, attribute, defaultAttribute); } else if (strokeOpacity) { - context.setStrokeStyle(line, attribute, offsetX, offsetY, defaultAttribute); + context.setStrokeStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute); context.stroke(); } } diff --git a/packages/vrender/src/render/contributions/render/polygon-render.ts b/packages/vrender/src/render/contributions/render/polygon-render.ts index 9a6454444..c569e46cb 100644 --- a/packages/vrender/src/render/contributions/render/polygon-render.ts +++ b/packages/vrender/src/render/contributions/render/polygon-render.ts @@ -54,7 +54,9 @@ export class DefaultCanvasPolygonRender implements IGraphicRender { strokeOpacity = polygonAttribute.strokeOpacity, lineWidth = polygonAttribute.lineWidth, opacity = polygonAttribute.opacity, - visible = polygonAttribute.visible + visible = polygonAttribute.visible, + x: originX = polygonAttribute.x, + y: originY = polygonAttribute.y } = polygon.attribute; // 不绘制或者透明 @@ -104,7 +106,7 @@ export class DefaultCanvasPolygonRender implements IGraphicRender { fillCb(context, polygon.attribute, polygonAttribute); } else if (fillOpacity) { // 存在fill - context.setCommonStyle(polygon, polygon.attribute, x, y, polygonAttribute); + context.setCommonStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute); context.fill(); } } @@ -113,7 +115,7 @@ export class DefaultCanvasPolygonRender implements IGraphicRender { strokeCb(context, polygon.attribute, polygonAttribute); } else if (strokeOpacity) { // 存在stroke - context.setStrokeStyle(polygon, polygon.attribute, x, y, polygonAttribute); + context.setStrokeStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute); context.stroke(); } } diff --git a/packages/vrender/src/render/contributions/render/rect-render.ts b/packages/vrender/src/render/contributions/render/rect-render.ts index 055fc90ed..b08530a10 100644 --- a/packages/vrender/src/render/contributions/render/rect-render.ts +++ b/packages/vrender/src/render/contributions/render/rect-render.ts @@ -55,7 +55,9 @@ export class DefaultCanvasRectRender implements IGraphicRender { fillOpacity = rectAttribute.fillOpacity, lineWidth = rectAttribute.lineWidth, strokeOpacity = rectAttribute.strokeOpacity, - visible = rectAttribute.visible + visible = rectAttribute.visible, + x: originX = rectAttribute.x, + y: originY = rectAttribute.y } = rect.attribute; // 不绘制或者透明 @@ -126,7 +128,7 @@ export class DefaultCanvasRectRender implements IGraphicRender { fillCb(context, rect.attribute, rectAttribute); } else if (fVisible) { // 存在fill - context.setCommonStyle(rect, rect.attribute, x, y, rectAttribute); + context.setCommonStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute); context.fill(); } } @@ -135,7 +137,7 @@ export class DefaultCanvasRectRender implements IGraphicRender { strokeCb(context, rect.attribute, rectAttribute); } else if (sVisible) { // 存在stroke - context.setStrokeStyle(rect, rect.attribute, x, y, rectAttribute); + context.setStrokeStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute); context.stroke(); } } diff --git a/packages/vrender/src/render/contributions/render/text-render.ts b/packages/vrender/src/render/contributions/render/text-render.ts index 5274a77fe..26df397e2 100644 --- a/packages/vrender/src/render/contributions/render/text-render.ts +++ b/packages/vrender/src/render/contributions/render/text-render.ts @@ -45,7 +45,9 @@ export class DefaultCanvasTextRender extends BaseRender implements IGraph visible = textAttribute.visible, underline = textAttribute.underline, lineThrough = textAttribute.lineThrough, - keepDirIn3d = textAttribute.keepDirIn3d + keepDirIn3d = textAttribute.keepDirIn3d, + x: originX = textAttribute.x, + y: originY = textAttribute.y } = text.attribute; // 不绘制或者透明 @@ -83,7 +85,7 @@ export class DefaultCanvasTextRender extends BaseRender implements IGraph if (strokeCb) { strokeCb(context, text.attribute, textAttribute); } else if (sVisible) { - context.setStrokeStyle(text, text.attribute, x, y, textAttribute); + context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute); multilineLayout.lines.forEach(line => { context.strokeText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z); }); @@ -93,7 +95,7 @@ export class DefaultCanvasTextRender extends BaseRender implements IGraph if (fillCb) { fillCb(context, text.attribute, textAttribute); } else if (fVisible) { - context.setCommonStyle(text, text.attribute, x, y, textAttribute); + context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute); multilineLayout.lines.forEach(line => { context.fillText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z); this.drawMultiUnderLine( @@ -117,7 +119,7 @@ export class DefaultCanvasTextRender extends BaseRender implements IGraph if (strokeCb) { strokeCb(context, text.attribute, textAttribute); } else if (sVisible) { - context.setStrokeStyle(text, text.attribute, x, y, textAttribute); + context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute); context.strokeText(t, x, y, z); } } @@ -125,7 +127,7 @@ export class DefaultCanvasTextRender extends BaseRender implements IGraph if (fillCb) { fillCb(context, text.attribute, textAttribute); } else if (fVisible) { - context.setCommonStyle(text, text.attribute, x, y, textAttribute); + context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute); context.fillText(t, x, y, z); this.drawUnderLine(underline, lineThrough, text, x, y, z, textAttribute, context); } From f9418fac3f7c68e9c31628d3c12f81bd9460fa58 Mon Sep 17 00:00:00 2001 From: zhouxinyu Date: Sun, 25 Jun 2023 12:20:58 +0800 Subject: [PATCH 15/24] fix: fix the dpr in node env --- .../vrender/fix-node-dpr_2023-06-25-04-21.json | 10 ++++++++++ .../src/core/contributions/env/node-contribution.ts | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 common/changes/@visactor/vrender/fix-node-dpr_2023-06-25-04-21.json diff --git a/common/changes/@visactor/vrender/fix-node-dpr_2023-06-25-04-21.json b/common/changes/@visactor/vrender/fix-node-dpr_2023-06-25-04-21.json new file mode 100644 index 000000000..49aa81fce --- /dev/null +++ b/common/changes/@visactor/vrender/fix-node-dpr_2023-06-25-04-21.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender", + "comment": "fix the bug of dpr in node env", + "type": "patch" + } + ], + "packageName": "@visactor/vrender" +} \ No newline at end of file diff --git a/packages/vrender/src/core/contributions/env/node-contribution.ts b/packages/vrender/src/core/contributions/env/node-contribution.ts index eb7f63359..d4f31d54a 100644 --- a/packages/vrender/src/core/contributions/env/node-contribution.ts +++ b/packages/vrender/src/core/contributions/env/node-contribution.ts @@ -129,7 +129,7 @@ export class NodeEnvContribution extends BaseEnvContribution implements IEnvCont } getDevicePixelRatio(): number { - return 0; + return 1; } getRequestAnimationFrame(): (callback: FrameRequestCallback) => number { From 98fa6015f27bb92aff7682e68f5dc58c1944b7d4 Mon Sep 17 00:00:00 2001 From: zhouxinyu Date: Sun, 25 Jun 2023 12:35:59 +0800 Subject: [PATCH 16/24] chore: edit the exports config --- packages/react-vrender-utils/package.json | 2 +- packages/react-vrender/package.json | 2 +- packages/vrender-components/package.json | 2 +- packages/vrender-kits/package.json | 6 +----- packages/vrender/package.json | 2 +- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/react-vrender-utils/package.json b/packages/react-vrender-utils/package.json index cfedcd949..7d5417c57 100644 --- a/packages/react-vrender-utils/package.json +++ b/packages/react-vrender-utils/package.json @@ -70,7 +70,7 @@ "exports": { ".": { "import": "./es/index.js", - "require": "./dist/index.js" + "require": "./cjs/index.js" } }, "publishConfig": { diff --git a/packages/react-vrender/package.json b/packages/react-vrender/package.json index 33cc6a1fe..1d8fef162 100644 --- a/packages/react-vrender/package.json +++ b/packages/react-vrender/package.json @@ -67,7 +67,7 @@ "exports": { ".": { "import": "./es/index.js", - "require": "./dist/index.js" + "require": "./cjs/index.js" } }, "publishConfig": { diff --git a/packages/vrender-components/package.json b/packages/vrender-components/package.json index 4d37e26d0..50ed2291e 100644 --- a/packages/vrender-components/package.json +++ b/packages/vrender-components/package.json @@ -69,7 +69,7 @@ "exports": { ".": { "import": "./es/index.js", - "require": "./dist/index.js" + "require": "./cjs/index.js" } }, "publishConfig": { diff --git a/packages/vrender-kits/package.json b/packages/vrender-kits/package.json index 37818caa3..411a25fa3 100644 --- a/packages/vrender-kits/package.json +++ b/packages/vrender-kits/package.json @@ -68,11 +68,7 @@ "access": "public" }, "exports": { - "node": { - "import": "./es/index-node.js", - "require": "./cjs/index-node.js" - }, - "default": { + ".": { "import": "./es/index.js", "require": "./cjs/index.js" } diff --git a/packages/vrender/package.json b/packages/vrender/package.json index d83189fec..92384de47 100644 --- a/packages/vrender/package.json +++ b/packages/vrender/package.json @@ -70,7 +70,7 @@ "exports": { ".": { "import": "./es/index.js", - "require": "./dist/index.js" + "require": "./cjs/index.js" } }, "publishConfig": { From d742a2127a022276129a6dd48278c83e243129b1 Mon Sep 17 00:00:00 2001 From: zhouxinyu Date: Sun, 25 Jun 2023 17:25:06 +0800 Subject: [PATCH 17/24] ci: update ci config --- .github/workflows/bug-server.yml | 4 +- .github/workflows/pre-release.yml | 29 ++++---- .github/workflows/release.yml | 12 ++- .github/workflows/unit-test.yml | 4 +- README.md | 2 + README.zh-CN.md | 10 +-- common/autoinstallers/lint/change-all.ts | 67 +++++++++++++++++ common/autoinstallers/lint/package.json | 1 + common/autoinstallers/lint/pnpm-lock.yaml | 3 + common/config/rush/command-line.json | 73 ++++++++++++++----- packages/vrender-components/bundler.config.js | 2 +- tools/bundler/src/logic/config.ts | 9 ++- tools/bundler/src/logic/rollup.config.ts | 2 +- tools/bundler/src/tasks/umd.ts | 5 +- 14 files changed, 174 insertions(+), 49 deletions(-) create mode 100644 common/autoinstallers/lint/change-all.ts diff --git a/.github/workflows/bug-server.yml b/.github/workflows/bug-server.yml index 8e9663f18..ca739a9ef 100644 --- a/.github/workflows/bug-server.yml +++ b/.github/workflows/bug-server.yml @@ -2,8 +2,10 @@ name: Bug Server CI # 这里业务方根据需求设置 on: - pull_request: + push: branches: ['main'] + pull_request: + branches: ['main', 'develop'] jobs: build: diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 4bc79e231..879b4cd33 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -3,7 +3,9 @@ name: Pre-release CI on: push: branches: - - pre-release/* + - 'pre-release/[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+' + - 'pre-release/[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' + - 'pre-release/[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+' jobs: build: @@ -30,38 +32,39 @@ jobs: - name: Install rush run: node common/scripts/install-run-rush.js install --bypass-policy - - name: Build packages - run: node common/scripts/install-run-rush.js build --only tag:package - - name: Parse semver version from branch name id: semver_parser - uses: release-kit/semver@v2 + uses: xile611/read-package-version-action@v2.1 with: - string: ${{ github.ref_name }} - pattern: '^pre-release/(.*)$' # ^v?(.*)$ by default + path: packages/vrender + semver_string: ${{ github.ref_name }} + semver_pattern: '^pre-release/(.*)$' # ^v?(.*)$ by default - name: Apply prereleaseName - run: node common/scripts/install-run-rush.js publish --apply --prerelease-name ${{ steps.semver_parser.outputs.prerelease }} --partial-prerelease + run: node common/scripts/install-run-rush.js publish --apply --prerelease-name ${{ steps.semver_parser.outputs.pre_release_name }} --partial-prerelease + + - name: Build packages + run: node common/scripts/install-run-rush.js build --only tag:package - name: Publish to npm env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} NPM_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - run: node common/scripts/install-run-rush.js publish --publish --include-all --tag ${{ steps.semver_parser.outputs.prerelease }} + run: node common/scripts/install-run-rush.js publish --publish --include-all --tag ${{ steps.semver_parser.outputs.pre_release_type }} - name: Update shrinkwrap run: node common/scripts/install-run-rush.js update - - name: Get package version + - name: Get npm version id: package-version - uses: culshaw/read-package-node-version-actions@v1 + uses: xile611/read-package-version-action@v2.1 with: - path: './packages/vrender' # 各项目需要修改一下 + path: packages/vrender - name: Commit & Push changes uses: actions-js/push@master with: github_token: ${{ secrets.GITHUB_TOKEN }} - message: 'build: prelease version ${{ steps.package-version.outputs.version }}' + message: 'build: prelease version ${{ steps.package-version.outputs.current_version }}' branch: ${{ github.ref_name }} author_name: ${{ github.actor }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7bee6c042..ded62cb9c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,7 @@ name: Release CI on: push: branches: - - release/* + - 'release/[0-9]+.[0-9]+.[0-9]+' jobs: build: @@ -34,11 +34,17 @@ jobs: - name: Install rush run: node common/scripts/install-run-rush.js install --bypass-policy + - name: Update version + run: node common/scripts/install-run-rush.js version --bump + - name: Build packages run: node common/scripts/install-run-rush.js build --only tag:package - - name: Update version - run: node common/scripts/install-run-rush.js version --bump + - name: Run bug server + working-directory: ./packages/vrender + env: + BUG_SERVER_TOKEN: ${{ secrets.BUG_SERVER_TOKEN }} + run: node ../../common/scripts/install-run-rushx.js ci - name: Publish to npm env: diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index b5340e73e..966ca5899 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -4,10 +4,8 @@ name: Unit test CI on: - push: - branches: ['main'] pull_request: - branches: ['main'] + branches: ['main', 'develop'] jobs: build: diff --git a/README.md b/README.md index 3ea94f57f..0368c4176 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,8 @@ VRender, not just a feature-rich visual rendering engine, but also a skillful an Cross-Platform

+![image test](https://github.com/visactor/vchart/actions/workflows/bug-server.yml/badge.svg) +![unit test](https://github.com/visactor/vchart/actions/workflows/unit-test.yml/badge.svg) [![npm Version](https://img.shields.io/npm/v/@visactor/vrender.svg)](https://www.npmjs.com/package/@visactor/vrender) [![npm Download](https://img.shields.io/npm/dm/@visactor/vrender.svg)](https://www.npmjs.com/package/@visactor/vrender) [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/visactor/vrender/blob/main/LICENSE) diff --git a/README.zh-CN.md b/README.zh-CN.md index 368e61a12..a24abb6be 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -20,9 +20,9 @@ VRender,不只是一个功能丰富的可视化渲染引可视化渲染擎, 跨端

-[![npm Version](https://img.shields.io/npm/v/@visactor/vgrammar.svg)](https://www.npmjs.com/package/@visactor/vgrammar) -[![npm Download](https://img.shields.io/npm/dm/@visactor/vgrammar.svg)](https://www.npmjs.com/package/@visactor/vgrammar) -[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/visactor/vgrammar/blob/main/LICENSE) +[![npm Version](https://img.shields.io/npm/v/@visactor/vrender.svg)](https://www.npmjs.com/package/@visactor/vrender) +[![npm Download](https://img.shields.io/npm/dm/@visactor/vrender.svg)](https://www.npmjs.com/package/@visactor/vrender) +[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/visactor/vrender/blob/main/LICENSE) @@ -119,7 +119,7 @@ st.defaultLayer.add(sy); | ---- | ---- | | [VChart](https://visactor.io/vchart) | 基于 [VisActor/VRender](https://visactor.io/vrender) 封装的图表库。 | -| [VGrammar](https://visactor.io/vgrammar) | 基于 [VisActor/VRender](https://visactor.io/vgrammar) 封装的语法库。 | +| [VGrammar](https://visactor.io/vgrammar) | 基于 [VisActor/VRender](https://visactor.io/vrender) 封装的语法库。 | | [React 组件库](https://visactor.io/react-vrender) | 基于 [VisActor/VChart](https://visactor.io/vrender) 的 React 图表 组件库。 | | [智能生成组件](https://visactor.io/ai-vrender) | 基于 AI 的智能图表生成组件 | @@ -129,7 +129,7 @@ st.defaultLayer.add(sy); 细流成河,终成大海! - + # 许可证 diff --git a/common/autoinstallers/lint/change-all.ts b/common/autoinstallers/lint/change-all.ts new file mode 100644 index 000000000..0bfdd3cb8 --- /dev/null +++ b/common/autoinstallers/lint/change-all.ts @@ -0,0 +1,67 @@ +import path from 'path'; +import chalk from 'chalk'; +import minimist, { ParsedArgs } from 'minimist'; +import { spawnSync, execSync } from 'child_process'; + +interface RunScriptArgv extends ParsedArgs { + message?: string; + type?: string; + 'not-commit'?: boolean; +} + +function run() { + const commitLineConfigPath = path.resolve(__dirname, './commitlint.config.js'); + const commitLintBinPath = path.resolve(__dirname, './node_modules/.bin/commitlint'); + const argv: RunScriptArgv = minimist(process.argv.slice(2)); + let message = argv.message; + let bumpType = argv.type; + let notCommit = argv['not-commit'] + + if (!message) { + const lastCommitMessage = execSync('git log -1 --pretty=%B ').toString(); + + if (!lastCommitMessage) { + process.exit(1); + } + + console.log(chalk.green(`[Notice] no message is supplied, we'll use latest commit mesage: ${chalk.red.bold(lastCommitMessage)}`)); + message = lastCommitMessage; + } else { + const result = spawnSync( + 'sh', + ['-c', `echo ${message} | ${commitLintBinPath} --config ${commitLineConfigPath}`], + { + stdio: 'inherit' + } + ); + + if (result.status !== 0) { + process.exit(1); + } + } + + if (!bumpType) { + console.log(chalk.green(`[Notice] no bumpType is supplied, we'll use default bumpType: ${chalk.red.bold('patch')}`)); + bumpType = 'patch'; + } + + spawnSync('sh', ['-c', `rush change --bulk --bump-type '${bumpType}' --message '${message}'`], { + stdio: 'inherit', + shell: false, + }); + + if (!notCommit) { + spawnSync('sh', ['-c', 'git add --all'], { + stdio: 'inherit', + shell: false, + }); + + spawnSync('sh', ['-c', `git commit -m 'docs: update changlog of rush'`], { + stdio: 'inherit', + shell: false, + }); + } + +} + +run(); \ No newline at end of file diff --git a/common/autoinstallers/lint/package.json b/common/autoinstallers/lint/package.json index 56599ecf3..85605c2cb 100644 --- a/common/autoinstallers/lint/package.json +++ b/common/autoinstallers/lint/package.json @@ -6,6 +6,7 @@ "@commitlint/cli": "17.0.3", "@commitlint/config-conventional": "17.0.3", "@microsoft/rush-lib": "5.94.1", + "chalk": "4.1.2", "commitizen": "4.2.5", "eslint": "~8.18.0", "lint-staged": "13.0.3", diff --git a/common/autoinstallers/lint/pnpm-lock.yaml b/common/autoinstallers/lint/pnpm-lock.yaml index 32744437c..1d7ad7c30 100644 --- a/common/autoinstallers/lint/pnpm-lock.yaml +++ b/common/autoinstallers/lint/pnpm-lock.yaml @@ -10,6 +10,9 @@ dependencies: '@microsoft/rush-lib': specifier: 5.94.1 version: 5.94.1(@types/node@0.0.0) + chalk: + specifier: 4.1.2 + version: 4.1.2 commitizen: specifier: 4.2.5 version: 4.2.5 diff --git a/common/config/rush/command-line.json b/common/config/rush/command-line.json index 776139135..d771902d5 100644 --- a/common/config/rush/command-line.json +++ b/common/config/rush/command-line.json @@ -76,11 +76,20 @@ "shellCommand": "ts-node common/autoinstallers/create/src/cli.ts" }, { + "name": "start", "commandKind": "global", - "name": "components", - "summary": "Start the development server of VRender components", - "description": "Run this command to start VRender components development server", - "shellCommand": "rush run -p @visactor/vrender-components -s start" + "summary": "Start the development server", + "description": "Run this command to start VRender development server", + "shellCommand": "rush run -p @internal/dev-demos -s start" + }, + { + "name": "change-all", + "commandKind": "global", + "autoinstallerName": "run-script", + "summary": "Run rush change width lint", + "description": "Run this command to start VRender development server", + "safeForSimultaneousRushProcesses": true, + "shellCommand": "ts-node common/autoinstallers/lint/change-all.ts" } ], "parameters": [ @@ -88,9 +97,7 @@ "parameterKind": "string", "longName": "--dir", "description": "Specify which dir will handle", - "associatedCommands": [ - "prettier" - ], + "associatedCommands": ["prettier"], "argumentName": "DIR", "required": false }, @@ -98,9 +105,7 @@ "parameterKind": "string", "longName": "--ext", "description": "Specify which file type will handle, example `rush prettier --ext 'tsx,scss'`", - "associatedCommands": [ - "prettier" - ], + "associatedCommands": ["prettier"], "argumentName": "EXT", "required": false }, @@ -109,9 +114,7 @@ "longName": "--project", "shortName": "-p", "description": "Specify the name of the main Rush project to be run", - "associatedCommands": [ - "run" - ], + "associatedCommands": ["run"], "argumentName": "PROJECT_NAME", "required": true }, @@ -120,11 +123,47 @@ "longName": "--script", "shortName": "-s", "description": "Specify script name in project", - "associatedCommands": [ - "run" - ], + "associatedCommands": ["run"], "argumentName": "SCRIPT_NAME", "required": true + }, + { + "parameterKind": "string", + "longName": "--message", + "shortName": "-m", + "description": "Write a message for change", + "associatedCommands": ["change-all"], + "argumentName": "MESSAGE", + "required": false + }, + { + "parameterKind": "flag", + "longName": "--not-commit", + "shortName": "-n", + "description": "not commit after run rush change", + "associatedCommands": ["change-all"], + "required": false + }, + { + "parameterKind": "choice", + "longName": "--type", + "shortName": "-t", + "description": "The bump type of change: major, minor, patch, none", + "associatedCommands": ["change-all"], + "alternatives": [ + { + "name": "patch", + "description": "A patch change" + }, + { + "name": "minor", + "description": "A minor change" + }, + { + "name": "major", + "description": "A major change" + } + ] } ] -} +} \ No newline at end of file diff --git a/packages/vrender-components/bundler.config.js b/packages/vrender-components/bundler.config.js index f3d0f99a5..b2a8c1659 100644 --- a/packages/vrender-components/bundler.config.js +++ b/packages/vrender-components/bundler.config.js @@ -9,7 +9,7 @@ module.exports = { globals: { '@visactor/vrender': 'VRender', '@visactor/vutils': 'VUtils', - '@visactor/vscale': 'VGrammar.Scale' + '@visactor/vscale': 'VScale' }, external: [ "@visactor/vrender", diff --git a/tools/bundler/src/logic/config.ts b/tools/bundler/src/logic/config.ts index 1f8ef456b..4b19a3d29 100644 --- a/tools/bundler/src/logic/config.ts +++ b/tools/bundler/src/logic/config.ts @@ -1,4 +1,5 @@ -import ArgsParser, { Arguments } from 'yargs-parser'; +import type { Arguments } from 'yargs-parser'; +import ArgsParser from 'yargs-parser'; import type { RawPackageJson } from './package'; import type { RollupOptions } from 'rollup'; import type { Alias } from '@rollup/plugin-alias'; @@ -104,6 +105,7 @@ export interface Config { preTasks: Record Promise>; // 构建后执行的任务列表 postTasks: Record Promise>; + globals: Record; } export const DEFAULT_CONFIG_FILE = 'bundler.config.js'; @@ -139,7 +141,8 @@ export function getDefaultConfig(): Config { alias: [], rollupOptions: {}, preTasks: {}, - postTasks: {} + postTasks: {}, + globals: {} }; } @@ -185,7 +188,7 @@ export function getFinalConfig( defaultConfig: Config, packageVersion: string ): Config { - const parsedCLIEnvs = parserEnvsOfCLIArgs(cliArgs['envs'] || []); + const parsedCLIEnvs = parserEnvsOfCLIArgs(cliArgs.envs || []); const envs = { ...userConfig.envs, ...parsedCLIEnvs, diff --git a/tools/bundler/src/logic/rollup.config.ts b/tools/bundler/src/logic/rollup.config.ts index 3cef10421..7d84ca19e 100644 --- a/tools/bundler/src/logic/rollup.config.ts +++ b/tools/bundler/src/logic/rollup.config.ts @@ -57,7 +57,7 @@ export function getRollupOptions( destDir: path.resolve(projectRoot, config.outputDir.umd!) }), Alias({ entries: config.alias }), - config.minify && terser(), + ...(config.minify ? [terser()] : []), ...((config.rollupOptions.plugins as Plugin[]) || []) ] }; diff --git a/tools/bundler/src/tasks/umd.ts b/tools/bundler/src/tasks/umd.ts index 0688b68da..eebf4dcda 100644 --- a/tools/bundler/src/tasks/umd.ts +++ b/tools/bundler/src/tasks/umd.ts @@ -22,7 +22,8 @@ export async function buildUmd(config: Config, projectRoot: string, rawPackageJs config.sourceDir, typeof config.input === 'string' ? config.input : config.input.umd! ); - const rollupOptions = getRollupOptions(projectRoot, entry, rawPackageJson, babelPlugins, config); + const rollupOptions = getRollupOptions(projectRoot, entry, rawPackageJson, babelPlugins, { ...config, minify }); + DebugConfig('RollupOptions', JSON.stringify(rollupOptions)); const bundle = await rollup(rollupOptions); @@ -35,7 +36,7 @@ export async function buildUmd(config: Config, projectRoot: string, rawPackageJs ? `${dest}/${config.umdOutputFilename || packageNameToPath(rawPackageJson.name)}.min.js` : `${dest}/${config.umdOutputFilename || packageNameToPath(rawPackageJson.name)}.js`, exports: 'named', - globals: { react: 'React' } + globals: { react: 'React', ...config.globals } } ]); From 9a4a0af57dc30cef4035accf03919c1427580d27 Mon Sep 17 00:00:00 2001 From: zhouxinyu Date: Sun, 25 Jun 2023 18:26:02 +0800 Subject: [PATCH 18/24] fix: fix the bug of rect cornerRadius on left top --- ...ix-rect-cornerRadius_2023-06-25-10-25.json | 10 +++++++ docs/demos/src/pages/chart.ts | 8 ++++-- packages/vrender/src/common/shape/rect.ts | 28 +++++++++++++------ 3 files changed, 34 insertions(+), 12 deletions(-) create mode 100644 common/changes/@visactor/vrender/fix-rect-cornerRadius_2023-06-25-10-25.json diff --git a/common/changes/@visactor/vrender/fix-rect-cornerRadius_2023-06-25-10-25.json b/common/changes/@visactor/vrender/fix-rect-cornerRadius_2023-06-25-10-25.json new file mode 100644 index 000000000..4620bd185 --- /dev/null +++ b/common/changes/@visactor/vrender/fix-rect-cornerRadius_2023-06-25-10-25.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender", + "comment": "fix the bug of rect cornerRadius on left top", + "type": "patch" + } + ], + "packageName": "@visactor/vrender" +} \ No newline at end of file diff --git a/docs/demos/src/pages/chart.ts b/docs/demos/src/pages/chart.ts index 334c4cb09..3a48aa2ef 100644 --- a/docs/demos/src/pages/chart.ts +++ b/docs/demos/src/pages/chart.ts @@ -22,6 +22,8 @@ import { // import { json3 } from './xtable'; import { roughModule } from '@visactor/vrender-kits'; +const json = {"attribute":{},"_uid":83157,"type":"group","children":[{"attribute":{},"_uid":83161,"type":"group","children":[{"attribute":{"x":0,"y":0,"width":1043,"height":500,"sizeAttrs":{"x":0,"y":0,"width":1043,"height":500}},"_uid":83165,"type":"group","name":"root","children":[{"attribute":{"visible":true,"clip":false,"x":47,"y":12,"width":984,"height":460,"sizeAttrs":{"x":47,"y":12,"width":984,"height":460},"pickable":false,"zIndex":450},"_uid":83186,"type":"group","name":"regionGroup_15573","children":[{"attribute":{"visible":true,"x":0,"y":0,"clip":false,"sizeAttrs":{"x":0,"y":0},"pickable":false,"zIndex":0},"_uid":83187,"type":"group","name":"seriesGroup_bar_15574_15576","children":[{"attribute":{"pickable":false,"zIndex":300},"_uid":83230,"type":"group","name":"bar_15577","children":[{"attribute":{"visible":true,"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10,"stroke":"#fff","lineWidth":3,"x":0,"y":0,"fill":{"x0":0,"y0":0,"x1":1,"y1":1,"stops":[{"offset":1,"color":"#4CC9E4"},{"offset":0,"color":"rgba(76,201,228,0.6)"}],"gradient":"linear"},"y1":460,"width":25.23076923076923,"cornerAttrs":{"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10},"cornerRadius":[10,10,10,10],"strokeAttrs":{"stroke":"#fff"},"sizeAttrs":{"x":0,"y":0,"y1":460,"width":25.23076923076923},"height":460,"pickable":true},"_uid":83231,"type":"rect","children":[]},{"attribute":{"visible":true,"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10,"stroke":"#fff","lineWidth":3,"x":151.3846153846154,"y":156.39999999999998,"fill":{"x0":0,"y0":0,"x1":1,"y1":1,"stops":[{"offset":1,"color":"#4CC9E4"},{"offset":0,"color":"rgba(76,201,228,0.6)"}],"gradient":"linear"},"y1":460,"width":25.23076923076923,"cornerAttrs":{"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10},"cornerRadius":[10,10,10,10],"strokeAttrs":{"stroke":"#fff"},"sizeAttrs":{"x":151.3846153846154,"y":156.39999999999998,"y1":460,"width":25.23076923076923},"height":303.6,"pickable":true},"_uid":83232,"type":"rect","children":[]},{"attribute":{"visible":true,"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10,"stroke":"#fff","lineWidth":3,"x":302.7692307692308,"y":23.00000000000002,"fill":{"x0":0,"y0":0,"x1":1,"y1":1,"stops":[{"offset":1,"color":"#4CC9E4"},{"offset":0,"color":"rgba(76,201,228,0.6)"}],"gradient":"linear"},"y1":460,"width":25.23076923076923,"cornerAttrs":{"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10},"cornerRadius":[10,10,10,10],"strokeAttrs":{"stroke":"#fff"},"sizeAttrs":{"x":302.7692307692308,"y":23.00000000000002,"y1":460,"width":25.23076923076923},"height":437,"pickable":true},"_uid":83233,"type":"rect","children":[]},{"attribute":{"visible":true,"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10,"stroke":"#fff","lineWidth":3,"x":454.1538461538462,"y":220.79999999999998,"fill":{"x0":0,"y0":0,"x1":1,"y1":1,"stops":[{"offset":1,"color":"#4CC9E4"},{"offset":0,"color":"rgba(76,201,228,0.6)"}],"gradient":"linear"},"y1":460,"width":25.23076923076923,"cornerAttrs":{"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10},"cornerRadius":[10,10,10,10],"strokeAttrs":{"stroke":"#fff"},"sizeAttrs":{"x":454.1538461538462,"y":220.79999999999998,"y1":460,"width":25.23076923076923},"height":239.20000000000002,"pickable":true},"_uid":83234,"type":"rect","children":[]},{"attribute":{"visible":true,"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10,"stroke":"#fff","lineWidth":3,"x":605.5384615384615,"y":147.2,"fill":{"x0":0,"y0":0,"x1":1,"y1":1,"stops":[{"offset":1,"color":"#4CC9E4"},{"offset":0,"color":"rgba(76,201,228,0.6)"}],"gradient":"linear"},"y1":460,"width":25.23076923076923,"cornerAttrs":{"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10},"cornerRadius":[10,10,10,10],"strokeAttrs":{"stroke":"#fff"},"sizeAttrs":{"x":605.5384615384615,"y":147.2,"y1":460,"width":25.23076923076923},"height":312.8,"pickable":true},"_uid":83235,"type":"rect","children":[]},{"attribute":{"visible":true,"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10,"stroke":"#fff","lineWidth":3,"x":756.9230769230769,"y":220.79999999999998,"fill":{"x0":0,"y0":0,"x1":1,"y1":1,"stops":[{"offset":1,"color":"#4CC9E4"},{"offset":0,"color":"rgba(76,201,228,0.6)"}],"gradient":"linear"},"y1":460,"width":25.23076923076923,"cornerAttrs":{"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10},"cornerRadius":[10,10,10,10],"strokeAttrs":{"stroke":"#fff"},"sizeAttrs":{"x":756.9230769230769,"y":220.79999999999998,"y1":460,"width":25.23076923076923},"height":239.20000000000002,"pickable":true},"_uid":83236,"type":"rect","children":[]},{"attribute":{"visible":true,"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10,"stroke":"#fff","lineWidth":3,"x":908.3076923076924,"y":239.20000000000002,"fill":{"x0":0,"y0":0,"x1":1,"y1":1,"stops":[{"offset":1,"color":"#4CC9E4"},{"offset":0,"color":"rgba(76,201,228,0.6)"}],"gradient":"linear"},"y1":460,"width":25.23076923076923,"cornerAttrs":{"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10},"cornerRadius":[10,10,10,10],"strokeAttrs":{"stroke":"#fff"},"sizeAttrs":{"x":908.3076923076924,"y":239.20000000000002,"y1":460,"width":25.23076923076923},"height":220.79999999999998,"pickable":true},"_uid":83237,"type":"rect","children":[]},{"attribute":{"visible":true,"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10,"stroke":"#fff","lineWidth":3,"x":50.46153846153846,"y":262.20000000000005,"fill":{"x0":0,"y0":0,"x1":1,"y1":1,"stops":[{"offset":1,"color":"#4954E6"},{"offset":0,"color":"rgba(73,84,230,0.6)"}],"gradient":"linear"},"y1":460,"width":25.23076923076923,"cornerAttrs":{"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10},"cornerRadius":[10,10,10,10],"strokeAttrs":{"stroke":"#fff"},"sizeAttrs":{"x":50.46153846153846,"y":262.20000000000005,"y1":460,"width":25.23076923076923},"height":197.79999999999995,"pickable":true},"_uid":83238,"type":"rect","children":[]},{"attribute":{"visible":true,"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10,"stroke":"#fff","lineWidth":3,"x":201.84615384615384,"y":91.99999999999999,"fill":{"x0":0,"y0":0,"x1":1,"y1":1,"stops":[{"offset":1,"color":"#4954E6"},{"offset":0,"color":"rgba(73,84,230,0.6)"}],"gradient":"linear"},"y1":460,"width":25.23076923076923,"cornerAttrs":{"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10},"cornerRadius":[10,10,10,10],"strokeAttrs":{"stroke":"#fff"},"sizeAttrs":{"x":201.84615384615384,"y":91.99999999999999,"y1":460,"width":25.23076923076923},"height":368,"pickable":true},"_uid":83239,"type":"rect","children":[]},{"attribute":{"visible":true,"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10,"stroke":"#fff","lineWidth":3,"x":353.2307692307692,"y":147.2,"fill":{"x0":0,"y0":0,"x1":1,"y1":1,"stops":[{"offset":1,"color":"#4954E6"},{"offset":0,"color":"rgba(73,84,230,0.6)"}],"gradient":"linear"},"y1":460,"width":25.23076923076923,"cornerAttrs":{"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10},"cornerRadius":[10,10,10,10],"strokeAttrs":{"stroke":"#fff"},"sizeAttrs":{"x":353.2307692307692,"y":147.2,"y1":460,"width":25.23076923076923},"height":312.8,"pickable":true},"_uid":83240,"type":"rect","children":[]},{"attribute":{"visible":true,"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10,"stroke":"#fff","lineWidth":3,"x":504.61538461538464,"y":276,"fill":{"x0":0,"y0":0,"x1":1,"y1":1,"stops":[{"offset":1,"color":"#4954E6"},{"offset":0,"color":"rgba(73,84,230,0.6)"}],"gradient":"linear"},"y1":460,"width":25.23076923076923,"cornerAttrs":{"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10},"cornerRadius":[10,10,10,10],"strokeAttrs":{"stroke":"#fff"},"sizeAttrs":{"x":504.61538461538464,"y":276,"y1":460,"width":25.23076923076923},"height":184,"pickable":true},"_uid":83241,"type":"rect","children":[]},{"attribute":{"visible":true,"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10,"stroke":"#fff","lineWidth":3,"x":656,"y":216.2,"fill":{"x0":0,"y0":0,"x1":1,"y1":1,"stops":[{"offset":1,"color":"#4954E6"},{"offset":0,"color":"rgba(73,84,230,0.6)"}],"gradient":"linear"},"y1":460,"width":25.23076923076923,"cornerAttrs":{"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10},"cornerRadius":[10,10,10,10],"strokeAttrs":{"stroke":"#fff"},"sizeAttrs":{"x":656,"y":216.2,"y1":460,"width":25.23076923076923},"height":243.8,"pickable":true},"_uid":83242,"type":"rect","children":[]},{"attribute":{"visible":true,"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10,"stroke":"#fff","lineWidth":3,"x":807.3846153846154,"y":128.8,"fill":{"x0":0,"y0":0,"x1":1,"y1":1,"stops":[{"offset":1,"color":"#4954E6"},{"offset":0,"color":"rgba(73,84,230,0.6)"}],"gradient":"linear"},"y1":460,"width":25.23076923076923,"cornerAttrs":{"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10},"cornerRadius":[10,10,10,10],"strokeAttrs":{"stroke":"#fff"},"sizeAttrs":{"x":807.3846153846154,"y":128.8,"y1":460,"width":25.23076923076923},"height":331.2,"pickable":true},"_uid":83243,"type":"rect","children":[]},{"attribute":{"visible":true,"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10,"stroke":"#fff","lineWidth":3,"x":958.7692307692308,"y":133.4,"fill":{"x0":0,"y0":0,"x1":1,"y1":1,"stops":[{"offset":1,"color":"#4954E6"},{"offset":0,"color":"rgba(73,84,230,0.6)"}],"gradient":"linear"},"y1":460,"width":25.23076923076923,"cornerAttrs":{"cornerRadiusTopLeft":10,"cornerRadiusTopRight":10,"cornerRadiusBottomRight":10,"cornerRadiusBottomLeft":10},"cornerRadius":[10,10,10,10],"strokeAttrs":{"stroke":"#fff"},"sizeAttrs":{"x":958.7692307692308,"y":133.4,"y1":460,"width":25.23076923076923},"height":326.6,"pickable":true},"_uid":83244,"type":"rect","children":[]}]}]}]},{"attribute":{"pickable":false,"zIndex":100},"_uid":83166,"type":"group","name":"axis-bottom_15585","children":[{"attribute":{"title":{"space":4,"padding":0,"textStyle":{"fontSize":12,"fill":"#333333","fontWeight":"normal","fillOpacity":1},"autoRotate":false,"angle":null,"shape":{},"background":{},"state":{"text":null,"shape":null,"background":null},"text":"x","maxWidth":null},"label":{"visible":true,"inside":false,"space":4,"padding":0,"style":{"fontSize":12,"fill":"#6F6F6F","fontWeight":"normal","fillOpacity":1},"formatMethod":null,"state":null},"tick":{"visible":false,"inside":false,"alignWithLabel":true,"length":4,"style":{"lineWidth":1,"stroke":"#D8DCE3","strokeOpacity":1},"state":null},"subTick":{"visible":false,"inside":false,"count":4,"length":2,"style":{"lineWidth":1,"stroke":"#D8DCE3","strokeOpacity":1},"state":null},"line":{"visible":false,"style":{"lineWidth":1,"stroke":"#dfdfdf","strokeOpacity":1}},"grid":{"style":{"lineWidth":1,"stroke":"#dfdfdf","strokeOpacity":1,"lineDash":[4,4]},"visible":false,"length":460,"type":"line","depth":0},"subGrid":{"visible":false,"style":{"lineWidth":1,"stroke":"#dfdfdf","strokeOpacity":1,"lineDash":[4,4]},"type":"line"},"x":47,"y":472,"start":{"x":0,"y":0},"end":{"x":984,"y":0},"items":[[{"id":"Mon","label":"Mon","value":0.038461538461538464,"rawValue":"Mon"},{"id":"Tues","label":"Tues","value":0.1923076923076923,"rawValue":"Tues"},{"id":"Wed","label":"Wed","value":0.3461538461538462,"rawValue":"Wed"},{"id":"Thus","label":"Thus","value":0.5000000000000001,"rawValue":"Thus"},{"id":"Fri","label":"Fri","value":0.6538461538461539,"rawValue":"Fri"},{"id":"Sat","label":"Sat","value":0.8076923076923076,"rawValue":"Sat"},{"id":"sun","label":"sun","value":0.9615384615384616,"rawValue":"sun"}]],"visible":true,"pickable":true,"panel":{"state":null},"verticalFactor":1},"_uid":83167,"type":"group","name":"axis","children":[{"attribute":{"x":0,"y":0,"pickable":false},"_uid":83209,"type":"group","children":[{"attribute":{"x":0,"y":0,"zIndex":1},"_uid":83210,"type":"group","name":"axis-container","children":[{"attribute":{"x":0,"y":0,"pickable":false},"_uid":83211,"type":"group","name":"axis-label-container","children":[{"attribute":{"x":0,"y":0,"pickable":false},"_uid":83212,"type":"group","name":"axis-label-container-layer-0","children":[{"attribute":{"x":37.84615384615385,"y":4,"text":"Mon","lineHeight":12,"textAlign":"center","textBaseline":"top","fontSize":12,"fill":"#6F6F6F","fontWeight":"normal","fillOpacity":1},"_uid":83213,"type":"text","name":"axis-label","children":[]},{"attribute":{"x":189.23076923076923,"y":4,"text":"Tues","lineHeight":12,"textAlign":"center","textBaseline":"top","fontSize":12,"fill":"#6F6F6F","fontWeight":"normal","fillOpacity":1},"_uid":83214,"type":"text","name":"axis-label","children":[]},{"attribute":{"x":340.61538461538464,"y":4,"text":"Wed","lineHeight":12,"textAlign":"center","textBaseline":"top","fontSize":12,"fill":"#6F6F6F","fontWeight":"normal","fillOpacity":1},"_uid":83215,"type":"text","name":"axis-label","children":[]},{"attribute":{"x":492.0000000000001,"y":4,"text":"Thus","lineHeight":12,"textAlign":"center","textBaseline":"top","fontSize":12,"fill":"#6F6F6F","fontWeight":"normal","fillOpacity":1},"_uid":83216,"type":"text","name":"axis-label","children":[]},{"attribute":{"x":643.3846153846154,"y":4,"text":"Fri","lineHeight":12,"textAlign":"center","textBaseline":"top","fontSize":12,"fill":"#6F6F6F","fontWeight":"normal","fillOpacity":1},"_uid":83217,"type":"text","name":"axis-label","children":[]},{"attribute":{"x":794.7692307692307,"y":4,"text":"Sat","lineHeight":12,"textAlign":"center","textBaseline":"top","fontSize":12,"fill":"#6F6F6F","fontWeight":"normal","fillOpacity":1},"_uid":83218,"type":"text","name":"axis-label","children":[]},{"attribute":{"x":946.1538461538462,"y":4,"text":"sun","lineHeight":12,"textAlign":"center","textBaseline":"top","fontSize":12,"fill":"#6F6F6F","fontWeight":"normal","fillOpacity":1},"_uid":83219,"type":"text","name":"axis-label","children":[]}]}]}]}]}]}]},{"attribute":{"pickable":false,"zIndex":100},"_uid":83176,"type":"group","name":"axis-left_15588","children":[{"attribute":{"title":{"space":4,"padding":0,"textStyle":{"fontSize":12,"fill":"#333333","fontWeight":"normal","fillOpacity":1,"textAlign":"center","textBaseline":"bottom"},"autoRotate":false,"angle":-1.5707963267948966,"shape":{},"background":{},"state":{"text":null,"shape":null,"background":null},"text":"y","maxWidth":null},"label":{"visible":true,"inside":false,"space":4,"padding":0,"style":{"fontSize":12,"fill":"#6F6F6F","fontWeight":"normal","fillOpacity":1},"formatMethod":null,"state":null},"tick":{"visible":false,"inside":false,"alignWithLabel":true,"length":4,"style":{"lineWidth":1,"stroke":"#D8DCE3","strokeOpacity":1},"state":null},"subTick":{"visible":false,"inside":false,"count":4,"length":2,"style":{"lineWidth":1,"stroke":"#D8DCE3","strokeOpacity":1},"state":null},"line":{"visible":false,"style":{"lineWidth":1,"stroke":"#dfdfdf","strokeOpacity":1}},"grid":{"style":{"lineWidth":1,"stroke":"#dfdfdf","strokeOpacity":1,"lineDash":[4,4]},"visible":false,"length":984,"type":"line","depth":0},"subGrid":{"visible":false,"style":{"lineWidth":1,"stroke":"#dfdfdf","strokeOpacity":1,"lineDash":[4,4]},"type":"line"},"x":47,"y":12,"start":{"x":0,"y":0},"end":{"x":0,"y":460},"items":[[{"id":0,"label":0,"value":1,"rawValue":0},{"id":20,"label":20,"value":0.8,"rawValue":20},{"id":40,"label":40,"value":0.6,"rawValue":40},{"id":60,"label":60,"value":0.4,"rawValue":60},{"id":80,"label":80,"value":0.19999999999999996,"rawValue":80},{"id":100,"label":100,"value":0,"rawValue":100}]],"visible":true,"pickable":true,"panel":{"state":null},"verticalFactor":1},"_uid":83177,"type":"group","name":"axis","children":[{"attribute":{"x":0,"y":0,"pickable":false},"_uid":83220,"type":"group","children":[{"attribute":{"x":0,"y":0,"zIndex":1},"_uid":83221,"type":"group","name":"axis-container","children":[{"attribute":{"x":0,"y":0,"pickable":false},"_uid":83222,"type":"group","name":"axis-label-container","children":[{"attribute":{"x":0,"y":0,"pickable":false},"_uid":83223,"type":"group","name":"axis-label-container-layer-0","children":[{"attribute":{"x":-4,"y":460,"text":"0%","lineHeight":12,"textAlign":"end","textBaseline":"middle","fontSize":12,"fill":"#6F6F6F","fontWeight":"normal","fillOpacity":1},"_uid":83224,"type":"text","name":"axis-label","children":[]},{"attribute":{"x":-4,"y":368,"text":"20%","lineHeight":12,"textAlign":"end","textBaseline":"middle","fontSize":12,"fill":"#6F6F6F","fontWeight":"normal","fillOpacity":1},"_uid":83225,"type":"text","name":"axis-label","children":[]},{"attribute":{"x":-4,"y":276,"text":"40%","lineHeight":12,"textAlign":"end","textBaseline":"middle","fontSize":12,"fill":"#6F6F6F","fontWeight":"normal","fillOpacity":1},"_uid":83226,"type":"text","name":"axis-label","children":[]},{"attribute":{"x":-4,"y":184,"text":"60%","lineHeight":12,"textAlign":"end","textBaseline":"middle","fontSize":12,"fill":"#6F6F6F","fontWeight":"normal","fillOpacity":1},"_uid":83227,"type":"text","name":"axis-label","children":[]},{"attribute":{"x":-4,"y":91.99999999999999,"text":"80%","lineHeight":12,"textAlign":"end","textBaseline":"middle","fontSize":12,"fill":"#6F6F6F","fontWeight":"normal","fillOpacity":1},"_uid":83228,"type":"text","name":"axis-label","children":[]},{"attribute":{"x":-4,"y":0,"text":"100%","lineHeight":12,"textAlign":"end","textBaseline":"middle","fontSize":12,"fill":"#6F6F6F","fontWeight":"normal","fillOpacity":1},"_uid":83229,"type":"text","name":"axis-label","children":[]}]}]}]}]}]}]}]}]}]} + container.load(roughModule); let arcList = []; @@ -82,9 +84,9 @@ export const page = () => { const layer = stage.at(0); - // json.children[0].children.forEach(item => { - // _add(layer, item); - // }); + json.children[0].children.forEach(item => { + _add(layer, item); + }); stage.set3dOptions({ alpha: 0, // beta: 0, diff --git a/packages/vrender/src/common/shape/rect.ts b/packages/vrender/src/common/shape/rect.ts index 6e740658c..9871b9e72 100644 --- a/packages/vrender/src/common/shape/rect.ts +++ b/packages/vrender/src/common/shape/rect.ts @@ -1,6 +1,8 @@ -import { isNumber, vec2, vec4, arrayEqual } from '@visactor/vutils'; +import { isNumber, vec2, vec4, arrayEqual, pi } from '@visactor/vutils'; import { IContext2d, ICustomPath2D } from '../../interface'; +const halfPi = pi / 2; + export function createRectPath( path: ICustomPath2D | IContext2d, x: number, @@ -87,8 +89,10 @@ export function createRectPath( centerX, centerY, _cornerRadius[1], - Math.atan2(rightTopPoint1[1] - centerY, rightTopPoint1[0] - centerX), - Math.atan2(rightTopPoint2[1] - centerY, rightTopPoint2[0] - centerX), + -halfPi, + 0, + // Math.atan2(rightTopPoint1[1] - centerY, rightTopPoint1[0] - centerX), + // Math.atan2(rightTopPoint2[1] - centerY, rightTopPoint2[0] - centerX), false ); // path.arcTo(rightTop[0], rightTop[1], rightTopPoint2[0], rightTopPoint2[1], _cornerRadius[1]); @@ -102,8 +106,10 @@ export function createRectPath( centerX, centerY, _cornerRadius[2], - Math.atan2(rightBottomPoint2[1] - centerY, rightBottomPoint2[0] - centerX), - Math.atan2(rightBottomPoint1[1] - centerY, rightBottomPoint1[0] - centerX), + 0, + halfPi, + // Math.atan2(rightBottomPoint2[1] - centerY, rightBottomPoint2[0] - centerX), + // Math.atan2(rightBottomPoint1[1] - centerY, rightBottomPoint1[0] - centerX), false ); // path.arcTo(rightBottom[0], rightBottom[1], rightBottomPoint1[0], rightBottomPoint1[1], _cornerRadius[2]); @@ -117,8 +123,10 @@ export function createRectPath( centerX, centerY, _cornerRadius[3], - Math.atan2(leftBottomPoint1[1] - centerY, leftBottomPoint1[0] - centerX), - Math.atan2(leftBottomPoint2[1] - centerY, leftBottomPoint2[0] - centerX), + halfPi, + pi, + // Math.atan2(leftBottomPoint1[1] - centerY, leftBottomPoint1[0] - centerX), + // Math.atan2(leftBottomPoint2[1] - centerY, leftBottomPoint2[0] - centerX), false ); // path.arcTo(leftBottom[0], leftBottom[1], leftBottomPoint2[0], leftBottomPoint2[1], _cornerRadius[3]); @@ -132,8 +140,10 @@ export function createRectPath( centerX, centerY, _cornerRadius[0], - Math.atan2(leftTopPoint2[1] - centerY, leftTopPoint2[0] - centerX), - Math.atan2(leftTopPoint1[1] - centerY, leftTopPoint1[0] - centerX), + pi, + pi + halfPi, + // Math.atan2(leftTopPoint2[1] - centerY, leftTopPoint2[0] - centerX), + // Math.atan2(leftTopPoint1[1] - centerY, leftTopPoint1[0] - centerX) + Math.PI * 2, false ); // path.arcTo(leftTop[0], leftTop[1], leftTopPoint1[0], leftTopPoint1[1], _cornerRadius[0]); From d6feea4bc8942990d8e458bb9bba8e60e65b3af0 Mon Sep 17 00:00:00 2001 From: zhouxinyu Date: Sun, 25 Jun 2023 19:47:03 +0800 Subject: [PATCH 19/24] fix: fix the bug of arc in 3d mode --- .../vrender/fix-3d-arc_2023-06-25-11-46.json | 10 ++++++++++ .../src/canvas/contributions/browser/context.ts | 11 ++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 common/changes/@visactor/vrender/fix-3d-arc_2023-06-25-11-46.json diff --git a/common/changes/@visactor/vrender/fix-3d-arc_2023-06-25-11-46.json b/common/changes/@visactor/vrender/fix-3d-arc_2023-06-25-11-46.json new file mode 100644 index 000000000..841f579b7 --- /dev/null +++ b/common/changes/@visactor/vrender/fix-3d-arc_2023-06-25-11-46.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender", + "comment": "fix the bug of arc in 3d mode", + "type": "patch" + } + ], + "packageName": "@visactor/vrender" +} \ No newline at end of file diff --git a/packages/vrender/src/canvas/contributions/browser/context.ts b/packages/vrender/src/canvas/contributions/browser/context.ts index e46f331c1..245a9b0d0 100644 --- a/packages/vrender/src/canvas/contributions/browser/context.ts +++ b/packages/vrender/src/canvas/contributions/browser/context.ts @@ -23,7 +23,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import { IPointLike, Matrix, pi, TextMeasure, ITextMeasureSpec } from '@visactor/vutils'; +import { IPointLike, Matrix, pi, pi2, TextMeasure, ITextMeasureSpec } from '@visactor/vutils'; import { injectable } from 'inversify'; import { DefaultFillStyle, DefaultStrokeStyle, DefaultTextStyle } from '../../../graphic'; import { @@ -62,6 +62,15 @@ const addArcToBezierPath = ( ry: number, clockwise: boolean ) => { + if (clockwise) { + while (endAngle > startAngle) { + endAngle -= pi2; + } + } else { + while (endAngle < startAngle) { + endAngle += pi2; + } + } // https://stackoverflow.com/questions/1734745/how-to-create-circle-with-b%C3%A9zier-curves const step = (pi / 3) * (endAngle > startAngle ? 1 : -1); let sa = startAngle; From 0e25d02bd00d4a74b189d304df1d011b6ea071e8 Mon Sep 17 00:00:00 2001 From: neuqzxy Date: Sun, 25 Jun 2023 13:21:18 +0000 Subject: [PATCH 20/24] build: prelease version 0.11.0-alpha.2 --- common/config/rush/pnpm-lock.yaml | 14 +++++++------- docs/demos/package.json | 4 ++-- packages/react-vrender-utils/package.json | 6 +++--- packages/react-vrender/package.json | 4 ++-- packages/vrender-components/package.json | 4 ++-- packages/vrender-kits/package.json | 4 ++-- packages/vrender/package.json | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 4f2807493..cb3a71a90 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: '@esbuild-plugins/node-modules-polyfill': 0.1.4 '@internal/eslint-config': workspace:* '@internal/ts-config': workspace:* - '@visactor/vrender': workspace:0.11.0-alpha.1 - '@visactor/vrender-kits': workspace:0.11.0-alpha.1 + '@visactor/vrender': workspace:0.11.0-alpha.2 + '@visactor/vrender-kits': workspace:0.11.0-alpha.2 '@visactor/vutils': ~0.9.2-alpha.5 canvas: 2.11.2 d3-scale-chromatic: ^3.0.0 @@ -55,7 +55,7 @@ importers: '@types/react': 16.9.49 '@types/react-dom': 16.9.8 '@types/react-reconciler': ^0.28.2 - '@visactor/vrender': workspace:0.11.0-alpha.1 + '@visactor/vrender': workspace:0.11.0-alpha.2 '@visactor/vutils': ~0.9.2-alpha.5 '@vitejs/plugin-react': 3.1.0 eslint: ~8.18.0 @@ -93,8 +93,8 @@ importers: '@rushstack/eslint-patch': ~1.1.4 '@types/react': 16.9.49 '@types/react-dom': 16.9.8 - '@visactor/react-vrender': workspace:0.11.0-alpha.1 - '@visactor/vrender': workspace:0.11.0-alpha.1 + '@visactor/react-vrender': workspace:0.11.0-alpha.2 + '@visactor/vrender': workspace:0.11.0-alpha.2 '@visactor/vutils': ~0.9.2-alpha.5 '@vitejs/plugin-react': 3.1.0 eslint: ~8.18.0 @@ -182,7 +182,7 @@ importers: '@internal/ts-config': workspace:* '@rushstack/eslint-patch': ~1.1.4 '@types/jest': ^26.0.0 - '@visactor/vrender': workspace:0.11.0-alpha.1 + '@visactor/vrender': workspace:0.11.0-alpha.2 '@visactor/vscale': 0.9.0-alpha.2 '@visactor/vutils': ~0.9.2-alpha.5 eslint: ~8.18.0 @@ -222,7 +222,7 @@ importers: '@types/node-fetch': 2.6.4 '@types/react': 16.9.49 '@types/react-dom': 16.9.8 - '@visactor/vrender': workspace:0.11.0-alpha.1 + '@visactor/vrender': workspace:0.11.0-alpha.2 '@visactor/vutils': ~0.9.2-alpha.5 '@vitejs/plugin-react': 3.1.0 canvas: 2.11.2 diff --git a/docs/demos/package.json b/docs/demos/package.json index c4ee86003..3825ba7ac 100644 --- a/docs/demos/package.json +++ b/docs/demos/package.json @@ -12,7 +12,7 @@ "@internal/eslint-config": "workspace:*", "@internal/ts-config": "workspace:*", "@visactor/vutils": "~0.9.2-alpha.5", - "@visactor/vrender-kits": "workspace:0.11.0-alpha.1", + "@visactor/vrender-kits": "workspace:0.11.0-alpha.2", "d3-scale-chromatic": "^3.0.0", "lodash": "4.17.21", "dat.gui": "^0.7.9", @@ -28,6 +28,6 @@ "@antv/g": "^5.7.4" }, "dependencies": { - "@visactor/vrender": "workspace:0.11.0-alpha.1" + "@visactor/vrender": "workspace:0.11.0-alpha.2" } } diff --git a/packages/react-vrender-utils/package.json b/packages/react-vrender-utils/package.json index 7d5417c57..358b3c3da 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.11.0-alpha.1", + "version": "0.11.0-alpha.2", "description": "", "sideEffects": false, "main": "cjs/index.js", @@ -25,8 +25,8 @@ "react-dom": "^18.2.0" }, "dependencies": { - "@visactor/vrender": "workspace:0.11.0-alpha.1", - "@visactor/react-vrender": "workspace:0.11.0-alpha.1", + "@visactor/vrender": "workspace:0.11.0-alpha.2", + "@visactor/react-vrender": "workspace:0.11.0-alpha.2", "@visactor/vutils": "~0.9.2-alpha.5", "react-reconciler": "^0.29.0", "tslib": "^2.3.1" diff --git a/packages/react-vrender/package.json b/packages/react-vrender/package.json index 1d8fef162..baf5bf2e6 100644 --- a/packages/react-vrender/package.json +++ b/packages/react-vrender/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/react-vrender", - "version": "0.11.0-alpha.1", + "version": "0.11.0-alpha.2", "description": "", "sideEffects": false, "main": "cjs/index.js", @@ -24,7 +24,7 @@ "react": "^18.2.0" }, "dependencies": { - "@visactor/vrender": "workspace:0.11.0-alpha.1", + "@visactor/vrender": "workspace:0.11.0-alpha.2", "@visactor/vutils": "~0.9.2-alpha.5", "react-reconciler": "^0.29.0", "tslib": "^2.3.1" diff --git a/packages/vrender-components/package.json b/packages/vrender-components/package.json index 50ed2291e..a9d5eed95 100644 --- a/packages/vrender-components/package.json +++ b/packages/vrender-components/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vrender-components", - "version": "0.11.0-alpha.1", + "version": "0.11.0-alpha.2", "description": "components library for dp visualization", "sideEffects": false, "main": "cjs/index.js", @@ -24,7 +24,7 @@ "prepublishOnly": "npm run build" }, "dependencies": { - "@visactor/vrender": "workspace:0.11.0-alpha.1", + "@visactor/vrender": "workspace:0.11.0-alpha.2", "@visactor/vutils": "~0.9.2-alpha.5", "@visactor/vscale": "0.9.0-alpha.2", "gl-matrix": "^3.4.3" diff --git a/packages/vrender-kits/package.json b/packages/vrender-kits/package.json index 411a25fa3..31303a888 100644 --- a/packages/vrender-kits/package.json +++ b/packages/vrender-kits/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vrender-kits", - "version": "0.11.0-alpha.1", + "version": "0.11.0-alpha.2", "description": "", "sideEffects": false, "main": "cjs/index.js", @@ -21,7 +21,7 @@ "prepublishOnly": "npm run build" }, "dependencies": { - "@visactor/vrender": "workspace:0.11.0-alpha.1", + "@visactor/vrender": "workspace:0.11.0-alpha.2", "@visactor/vutils": "~0.9.2-alpha.5", "@resvg/resvg-js": "2.4.1", "canvas": "2.11.2", diff --git a/packages/vrender/package.json b/packages/vrender/package.json index 92384de47..9534783d8 100644 --- a/packages/vrender/package.json +++ b/packages/vrender/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vrender", - "version": "0.11.0-alpha.1", + "version": "0.11.0-alpha.2", "description": "", "sideEffects": true, "main": "cjs/index.js", From b18662a4e654e609d845945d098aab8433fb1bab Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Mon, 26 Jun 2023 11:44:58 +0800 Subject: [PATCH 21/24] fix: remove lineHeight theme in text mark --- packages/vrender/src/graphic/config.ts | 2 +- .../vrender/src/render/contributions/render/text-render.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/vrender/src/graphic/config.ts b/packages/vrender/src/graphic/config.ts index d2ded2479..dc231f067 100644 --- a/packages/vrender/src/graphic/config.ts +++ b/packages/vrender/src/graphic/config.ts @@ -89,7 +89,7 @@ export const DefaultTextStyle: Required = { ellipsis: '…', fontVariant: '', fontStyle: '', - lineHeight: 16, + lineHeight: undefined, underline: 0, lineThrough: 0 }; diff --git a/packages/vrender/src/render/contributions/render/text-render.ts b/packages/vrender/src/render/contributions/render/text-render.ts index 1f43f50bf..b269fcae3 100644 --- a/packages/vrender/src/render/contributions/render/text-render.ts +++ b/packages/vrender/src/render/contributions/render/text-render.ts @@ -46,13 +46,15 @@ export class DefaultCanvasTextRender extends BaseRender implements IGraph underline = textAttribute.underline, lineThrough = textAttribute.lineThrough, keepDirIn3d = textAttribute.keepDirIn3d, - lineHeight = textAttribute.lineHeight, + // lineHeight = textAttribute.lineHeight, fontSize = textAttribute.fontSize, - textBaseline = textAttribute.textBaseline + textBaseline = textAttribute.textBaseline, x: originX = textAttribute.x, y: originY = textAttribute.y } = text.attribute; + const lineHeight = text.attribute.lineHeight ?? fontSize; + // 不绘制或者透明 const fVisible = fillVisible(opacity, fillOpacity); const sVisible = strokeVisible(opacity, strokeOpacity); From e56519e309f54158b79e3bdb4a1695f3a65c0ede Mon Sep 17 00:00:00 2001 From: kkxxkk2019 Date: Mon, 26 Jun 2023 12:12:23 +0800 Subject: [PATCH 22/24] fix: fix the type error --- packages/vrender-components/src/marker/type.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vrender-components/src/marker/type.ts b/packages/vrender-components/src/marker/type.ts index 279146b5d..10869671b 100644 --- a/packages/vrender-components/src/marker/type.ts +++ b/packages/vrender-components/src/marker/type.ts @@ -116,7 +116,7 @@ export interface MarkLineAttrs extends MarkerAttrs, SegmentAttributes { /** * label 相对line的位置 */ - position?: IMarkLineLabelPosition; + position?: keyof typeof IMarkLineLabelPosition; } & IMarkRef & IMarkLabel; } From 8af4aa8d0aa35895a742ee756993d1095237cb1a Mon Sep 17 00:00:00 2001 From: zhouxinyu Date: Tue, 27 Jun 2023 10:23:59 +0800 Subject: [PATCH 23/24] test: add demo --- docs/demos/src/pages/animate-3d.ts | 652 +++++++++++++++++++ docs/demos/src/pages/animate.ts | 4 +- docs/demos/src/pages/index.ts | 4 + docs/demos/src/pages/line.ts | 127 +--- docs/demos/src/pages/symbol.ts | 44 +- docs/demos/src/pages/text.ts | 6 +- packages/vrender/src/common/segment/index.ts | 1 + 7 files changed, 698 insertions(+), 140 deletions(-) create mode 100644 docs/demos/src/pages/animate-3d.ts diff --git a/docs/demos/src/pages/animate-3d.ts b/docs/demos/src/pages/animate-3d.ts new file mode 100644 index 000000000..2c8f6d9ca --- /dev/null +++ b/docs/demos/src/pages/animate-3d.ts @@ -0,0 +1,652 @@ +import { createStage, createArc, container, newThemeObj, defaultTicker, IGraphic, createCircle, createGroup, createText } from '@visactor/vrender'; +import { addShapesToStage, colorPools } from '../utils'; + +export const page = () => { + const graphics: IGraphic[] = []; + const sun = createCircle({ + x: 500, + y: 500, + radius: 696340 / 5000, + fill: 'red' + }); + + const ship = createGroup({ + x: 800, + y: 450, + }); + ship.setMode('3d'); + + const t1 = createText({ + text: '♢', + x: 0, + y: -60, + z: 0, + beta: -Math.PI / 8, + fontSize: 60, + keepDirIn3d: false, + fill: 'blue' + }); + ship.add(t1); + + //机头 + const t2 = createText({ + text: '〔', + x: -60, + y: -60, + z: 30, + beta: -Math.PI / 8, + keepDirIn3d: false, + fontSize: 60, + fill: 'blue' + }); + ship.add(t2); + + const t3 = createText({ + text: '〕', + x: 60, + y: -60, + z: 30, + beta: -Math.PI / 8, + keepDirIn3d: false, + fontSize: 60, + fill: 'blue' + }); + ship.add(t3); + + const t4 = createText({ + text: '〔', + x: -80, + y: -60, + z: 60, + beta: -Math.PI / 8, + keepDirIn3d: false, + fontSize: 60, + fill: 'blue' + }); + ship.add(t4); + + const t5 = createText({ + text: '〕', + x: 80, + y: -60, + z: 60, + beta: -Math.PI / 8, + keepDirIn3d: false, + fontSize: 60, + fill: 'blue' + }); + ship.add(t5); + + // 机身 + const s1 = createText({ + text: '┠', + x: -30, + y: -30, + z: 100, + alpha: Math.PI / 2, + // anchor3d: [60, 0], + keepDirIn3d: false, + fontSize: 60, + fill: 'grey' + }); + ship.add(s1); + + ship.setTheme({ + text: { + textAlign: 'center', + fontWeight: 'lighter' + } + }) + + const s2 = createText({ + text: '┨', + x: 30, + y: -30, + z: 100, + alpha: -Math.PI / 2, + keepDirIn3d: false, + fontSize: 60, + fill: 'grey' + }); + ship.add(s2); + + const s3 = createText({ + text: '♢', + x: -30, + y: -30, + z: 130, + alpha: Math.PI / 2, + // anchor3d: [60, 0], + keepDirIn3d: false, + fontSize: 60, + fill: 'grey' + }); + ship.add(s3); + + const s4 = createText({ + text: '♢', + x: 30, + y: -30, + z: 130, + alpha: -Math.PI / 2, + keepDirIn3d: false, + fontSize: 60, + fill: 'grey' + }); + ship.add(s4); + + const s5 = createText({ + text: '@', + x: -30, + y: -30, + z: 180, + alpha: Math.PI / 2, + // anchor3d: [60, 0], + keepDirIn3d: false, + fontSize: 60, + fill: 'grey' + }); + ship.add(s5); + + const s6 = createText({ + text: '@', + x: 30, + y: -30, + z: 180, + alpha: -Math.PI / 2, + keepDirIn3d: false, + fontSize: 60, + fill: 'grey' + }); + ship.add(s6); + + const s7 = createText({ + text: '^', + x: -30, + y: -30, + z: 210, + alpha: Math.PI / 2, + // anchor3d: [60, 0], + keepDirIn3d: false, + fontSize: 60, + fill: 'grey' + }); + ship.add(s7); + + const s8 = createText({ + text: '^', + x: 30, + y: -30, + z: 210, + alpha: -Math.PI / 2, + keepDirIn3d: false, + fontSize: 60, + fill: 'grey' + }); + ship.add(s8); + + const s9 = createText({ + text: 'Ⅲ', + x: -30, + y: -30, + z: 240, + alpha: Math.PI / 2, + // anchor3d: [60, 0], + keepDirIn3d: false, + fontSize: 60, + fill: 'grey' + }); + ship.add(s9); + + const s10 = createText({ + text: 'Ⅲ', + x: 30, + y: -30, + z: 240, + alpha: -Math.PI / 2, + keepDirIn3d: false, + fontSize: 60, + fill: 'grey' + }); + ship.add(s10); + + + // 踏板 + const b1 = createText({ + text: '-', + x: 30, + y: 30, + z: 130, + alpha: -Math.PI / 2, + keepDirIn3d: false, + fontSize: 50, + fill: 'black' + }); + ship.add(b1); + const b2 = createText({ + text: '-', + x: 30, + y: 30, + z: 180, + alpha: -Math.PI / 2, + keepDirIn3d: false, + fontSize: 50, + fill: 'black' + }); + ship.add(b2); + + const b3 = createText({ + text: '-', + x: -30, + y: 30, + z: 130, + alpha: -Math.PI / 2, + keepDirIn3d: false, + fontSize: 50, + fill: 'black' + }); + ship.add(b3); + const b4 = createText({ + text: '-', + x: -30, + y: 30, + z: 180, + alpha: -Math.PI / 2, + keepDirIn3d: false, + fontSize: 50, + fill: 'black' + }); + ship.add(b4); + + // 子机身 + const s11 = createText({ + text: 'L', + x: 0, + y: -15, + z: 300, + alpha: -Math.PI / 2, + keepDirIn3d: false, + fontSize: 50, + fill: 'grey' + }); + ship.add(s11); + + const s12 = createText({ + text: '♢', + x: 0, + y: -15, + z: 330, + alpha: -Math.PI / 2, + keepDirIn3d: false, + fontSize: 50, + fill: 'grey' + }); + ship.add(s12); + const s13 = createText({ + text: '〔', + x: 0, + y: -15, + z: 340, + alpha: -Math.PI / 2, + keepDirIn3d: false, + fontSize: 50, + fill: 'grey' + }); + ship.add(s13); + + const s14 = createText({ + text: 'L', + x: 0, + y: -15, + z: 420, + alpha: -Math.PI / 2, + keepDirIn3d: false, + fontSize: 50, + fill: 'grey' + }); + ship.add(s14); + + const s15 = createText({ + text: '♢', + x: 0, + y: -15, + z: 450, + alpha: -Math.PI / 2, + keepDirIn3d: false, + fontSize: 50, + fill: 'grey' + }); + ship.add(s15); + const s16 = createText({ + text: '〔', + x: 0, + y: -15, + z: 460, + alpha: -Math.PI / 2, + keepDirIn3d: false, + fontSize: 50, + fill: 'grey' + }); + ship.add(s16); + + const s17 = createText({ + text: 'L', + x: 0, + y: -15, + z: 540, + alpha: -Math.PI / 2, + keepDirIn3d: false, + fontSize: 50, + fill: 'grey' + }); + ship.add(s17); + + const s18 = createText({ + text: '♢', + x: 0, + y: -15, + z: 570, + alpha: -Math.PI / 2, + keepDirIn3d: false, + fontSize: 50, + fill: 'grey' + }); + ship.add(s18); + const s19 = createText({ + text: '〔', + x: 0, + y: -15, + z: 580, + alpha: -Math.PI / 2, + keepDirIn3d: false, + fontSize: 50, + fill: 'grey' + }); + ship.add(s19); + + // 尾翼 + const w1 = createText({ + text: '-', + x: 0, + y: -40, + z: 630, + alpha: -Math.PI / 2, + angle: -Math.PI / 6, + keepDirIn3d: false, + fontSize: 50, + fill: 'grey' + }); + ship.add(w1); + + const w2 = createText({ + text: '♢', + x: 0, + y: -40, + z: 660, + alpha: -Math.PI / 2, + angle: -Math.PI / 6, + keepDirIn3d: false, + fontSize: 50, + fill: 'grey' + }); + ship.add(w2); + + const w3 = createText({ + text: '-', + x: 0, + y: -70, + z: 680, + alpha: -Math.PI / 2, + angle: -Math.PI / 6, + keepDirIn3d: false, + fontSize: 50, + fill: 'grey' + }); + ship.add(w3); + + const createWg = (x: number, y: number, z: number, beta: number, alpha: number) => { + const group = createGroup({ + x, y, z, + anchor3d: [-10, 0, 0], + beta, + }); + group.setTheme({ + text: { + textAlign: 'left', + textBaseline: 'bottom' + } + }) + + const t1 = createText({ + text: '_', + x: 0, + y: 0, + z: 0, + alpha, + keepDirIn3d: false, + fontSize: 30, + fill: 'black' + }); + + const t2 = createText({ + text: 'L', + x: 0, + y: 0, + z: 30, + alpha, + keepDirIn3d: false, + fontSize: 30, + fill: 'black' + }); + + const t3 = createText({ + text: '♢', + x: 0, + y: 0, + z: 50, + alpha, + keepDirIn3d: false, + fontSize: 30, + fill: 'black' + }); + + const t4 = createText({ + text: '♢', + x: 0, + y: 0, + z: 70, + alpha, + keepDirIn3d: false, + fontSize: 30, + fill: 'black' + }); + + const t5 = createText({ + text: 'L', + x: 0, + y: 0, + z: 90, + alpha, + keepDirIn3d: false, + fontSize: 30, + fill: 'black' + }); + + const t6 = createText({ + text: '※', + x: 0, + y: 0, + z: 100, + alpha, + keepDirIn3d: false, + fontSize: 30, + fill: 'red' + }); + + group.add(t1); + group.add(t2); + group.add(t3); + group.add(t4); + group.add(t5); + group.add(t6); + group.animate().to({ + beta: beta + Math.PI * 2 + }, 30000, 'linear').loop(Infinity).onFrame((_, ratio) => { + group.setTheme({ + text: { + fillOpacity: Math.random() > 0.5 ? 1 : 0 + } + }) + }); + return group; + } + + for (let i = 0; i < 8; i++) { + ship.add(createWg(0, -60, 650, Math.PI * 2 / 8 * i, -Math.PI / 2)); + } + + // 上身的风扇 + const tt1 = createText({ + text: '|', + x: 0, + y: -120, + z: 180, + textBaseline: 'top', + fontSize: 20, + keepDirIn3d: false, + fill: 'black' + }); + ship.add(tt1); + + // 上身的风扇 + const tt2 = createText({ + text: '|', + x: 0, + y: -150, + z: 180, + textBaseline: 'top', + fontSize: 20, + keepDirIn3d: false, + fill: 'black' + }); + ship.add(tt2); + + const createWg2 = (x: number, y: number, z: number, alpha: number) => { + const group = createGroup({ + x, y, z, + anchor3d: [0, 0, 0], + alpha: alpha, + }); + group.setTheme({ + text: { + textAlign: 'left', + textBaseline: 'bottom' + } + }) + + const t1 = createText({ + text: '_', + x: 0, + y: 0, + z: 0, + beta: Math.PI / 2 + Math.PI / 8, + keepDirIn3d: false, + fontSize: 30, + fill: 'black' + }); + + const t2 = createText({ + text: 'L', + x: 30, + y: 0, + z: 0, + beta: Math.PI / 2 + Math.PI / 8, + keepDirIn3d: false, + fontSize: 30, + fill: 'black' + }); + + const t3 = createText({ + text: '♢', + x: 50, + y: 0, + z: 0, + beta: Math.PI / 2 + Math.PI / 8, + keepDirIn3d: false, + fontSize: 30, + fill: 'black' + }); + + const t4 = createText({ + text: '♢', + x: 70, + y: 0, + z: 0, + beta: Math.PI / 2 + Math.PI / 8, + keepDirIn3d: false, + fontSize: 30, + fill: 'black' + }); + + const t5 = createText({ + text: 'L', + x: 90, + y: 0, + z: 0, + beta: Math.PI / 2 + Math.PI / 8, + keepDirIn3d: false, + fontSize: 30, + fill: 'black' + }); + + const t6 = createText({ + text: '※', + x: 100, + y: 0, + z: 0, + beta: Math.PI / 2 + Math.PI / 8, + keepDirIn3d: false, + fontSize: 30, + fill: 'red' + }); + + group.add(t1); + group.add(t2); + group.add(t3); + group.add(t4); + group.add(t5); + group.add(t6); + group.animate().to({ + alpha: alpha + Math.PI * 2 + }, 30000, 'linear').loop(Infinity).onFrame((_, ratio) => { + group.setTheme({ + text: { + fillOpacity: Math.random() > 0.5 ? 1 : 0 + } + }) + }); + return group; + } + for (let i = 0; i < 8; i++) { + ship.add(createWg2(0, -160, 180, Math.PI * 2 / 8 * i)); + } + + graphics.push(ship); + + const stage = createStage({ + canvas: 'main', + autoRender: true, + }); + stage.set3dOptions({ + alpha: 0, + beta: 0, + center: { x: 800, y: 450 }, + fieldRatio: 0.8, + fieldDepth: 900000, + enableView3dTransform: true + }); + + graphics.forEach(g => { + stage.defaultLayer.add(g); + }) +}; diff --git a/docs/demos/src/pages/animate.ts b/docs/demos/src/pages/animate.ts index 6df5a983a..bbaf4d744 100644 --- a/docs/demos/src/pages/animate.ts +++ b/docs/demos/src/pages/animate.ts @@ -155,14 +155,14 @@ export const page = () => { const text = createText({ text: '🚗', fontSize: 37, - + fill: true, textAlign: 'center', textBaseline: 'middle' }); const text2 = createText({ text: '🐶', fontSize: 37, - + fill: true, textAlign: 'center', textBaseline: 'middle' }); diff --git a/docs/demos/src/pages/index.ts b/docs/demos/src/pages/index.ts index c3fbcdab5..940631bd9 100644 --- a/docs/demos/src/pages/index.ts +++ b/docs/demos/src/pages/index.ts @@ -151,5 +151,9 @@ export const pages = [ { title: 'bin-tree', path: 'bin-tree' + }, + { + title: 'animate-3d', + path: 'animate-3d' } ]; diff --git a/docs/demos/src/pages/line.ts b/docs/demos/src/pages/line.ts index 318460ed4..280611144 100644 --- a/docs/demos/src/pages/line.ts +++ b/docs/demos/src/pages/line.ts @@ -1,4 +1,4 @@ -import { createStage, createLine, container, IGraphic, createSymbol } from '@visactor/vrender'; +import { createStage, createLine, container, IGraphic } from '@visactor/vrender'; import { roughModule } from '@visactor/vrender-kits'; import { addShapesToStage, colorPools } from '../utils'; @@ -35,109 +35,30 @@ const points = [ export const page = () => { const graphics: IGraphic[] = []; - // ['linear', 'step', 'stepBefore', 'stepAfter', 'basis', 'monotoneX', 'monotoneY'].forEach((type, i) => { - // graphics.push(createLine({ - // points, - // curveType: type as any, - // x: (i * 300) % 900 + 100, - // y: (Math.floor(i * 300 / 900)) * 200, - // stroke: 'red' - // })); - // // points.forEach(item => { - // // graphics.push(createSymbol({ - // // x: (i * 300) % 900 + 100 + item.x, - // // y: (Math.floor(i * 300 / 900)) * 200 + item.y, - // // size: 10, - // // symbolType: 'circle', - // // fill: 'green' - // // })) - // // }) - // }); - const p = [ - { - "x": 0, - "y": 17.142857142857142, - "defined": true, - }, - { - "x": 31.142857142857142, - "y": 8.571428571428573, - "defined": true - }, - { - "x": 62.285714285714285, - "y": 20, - "defined": false - }, - { - "x": 93.42857142857143, - "y": 7.428571428571429, - "defined": true - }, - { - "x": 124.57142857142857, - "y": 11.428571428571429, - "defined": true - }, - { - "x": 155.71428571428572, - "y": 14.285714285714286, - "defined": true - }, - { - "x": 186.85714285714286, - "y": 5.7142857142857135, - "defined": true - }, - { - "x": 218, - "y": 0, - "defined": true - } -]; - graphics.push(createLine({ - "x": 100, - "y": 100, - "curveType": "basis", - stroke: { - gradient: 'linear', - x0: 0, - y0: 0, - x1: 1, - y1: 0, - stops: [ - { offset: 0, color: 'green' }, - { offset: 0.5, color: 'orange' }, - { offset: 1, color: 'red' } - ] - }, - "lineWidth": 2, - "points": p -})); -p.forEach(item => { - graphics.push(createSymbol({ - x: item.x + 100, - y: item.y + 100, - fill: 'red', - symbolType: 'circle', - size: 10 - })) -}); + ['linear', 'step', 'stepBefore', 'stepAfter', 'basis', 'monotoneX', 'monotoneY'].forEach((type, i) => { + graphics.push(createLine({ + points, + curveType: type as any, + x: (i * 300) % 900 + 100, + y: (Math.floor(i * 300 / 900)) * 200, + stroke: 'red' + })); + }); - // ['linear', 'step', 'stepBefore', 'stepAfter', 'basis', 'monotoneX', 'monotoneY'].forEach((type, i) => { - // i += 7; - // graphics.push(createLine({ - // points, - // curveType: type as any, - // x: (i * 300) % 900 + 100, - // y: (Math.floor(i * 300 / 900)) * 200, - // segments: [ - // { points: subP1, stroke: colorPools[3], lineWidth: 6 }, - // { points: subP2, stroke: colorPools[2], lineWidth: 2, lineDash: [3, 3] } - // ], - // stroke: 'red' - // })); - // }); + ['linear', 'step', 'stepBefore', 'stepAfter', 'basis', 'monotoneX', 'monotoneY'].forEach((type, i) => { + i += 7; + graphics.push(createLine({ + points, + curveType: type as any, + x: (i * 300) % 900 + 100, + y: (Math.floor(i * 300 / 900)) * 200, + segments: [ + { points: subP1, stroke: colorPools[3], lineWidth: 6 }, + { points: subP2, stroke: colorPools[2], lineWidth: 2, lineDash: [3, 3] } + ], + stroke: 'red' + })); + }); const stage = createStage({ diff --git a/docs/demos/src/pages/symbol.ts b/docs/demos/src/pages/symbol.ts index a324bc2d7..afaba8111 100644 --- a/docs/demos/src/pages/symbol.ts +++ b/docs/demos/src/pages/symbol.ts @@ -12,39 +12,19 @@ export const page = () => { ] const graphics: IGraphic[] = []; - symbolList.slice(0, 1).forEach((st, i) => { + symbolList.forEach((st, i) => { const symbol = createSymbol({ - "shape": "circle", - "fillOpacity": 1, - "visible": true, - "x": 78.57, - "y": 78.76363636363637, - "size": 24.536082474226802, - "z": null, - "fill": { - "gradient": "radial", - "x0": 0.5, - "y0": 0, - "r0": 0, - "x1": 0.5, - "y1": 1, - "r1": 0.7, - "stops": [ - { - "offset": 0, - "color": "rgba(255,255,255,0.5)" - }, - { - "offset": 1, - "color": "#6690F2" - } - ] - }, - "symbolType": "circle", - "pickable": true, - "scaleX": 3, - "scaleY": 3 - }); + symbolType: st, + x: (i * 100) % 500 + 100, + y: (Math.floor(i * 100 / 500) + 1) * 100, + size: 60, + background: + '', + texture: 'diamond', + texturePadding: 0, + textureSize: 3, + textureColor: 'red', + }); symbol.addEventListener('mouseenter', () => { symbol.setAttribute('fill', 'blue'); }) diff --git a/docs/demos/src/pages/text.ts b/docs/demos/src/pages/text.ts index bd78ce740..fc9dde9b3 100644 --- a/docs/demos/src/pages/text.ts +++ b/docs/demos/src/pages/text.ts @@ -23,15 +23,15 @@ export const page = () => { x0: 0, y0: 0, x1: 1, - y1: 0, + y1: 1, stops: [ { offset: 0, color: 'green' }, { offset: 0.5, color: 'orange' }, { offset: 1, color: 'red' } ] }, - text: ['Test', 'test'], - fontSize: 20, + text: ['这'], + fontSize: 180, textBaseline: 'top' })); diff --git a/packages/vrender/src/common/segment/index.ts b/packages/vrender/src/common/segment/index.ts index 54cdbf445..847957e8a 100644 --- a/packages/vrender/src/common/segment/index.ts +++ b/packages/vrender/src/common/segment/index.ts @@ -11,6 +11,7 @@ export * from './linear-closed'; export * from './basis'; export * from './monotone'; export * from './step'; +export * from './curve/curve-context'; export function calcLineCache( points: IPointLike[], From 6218fb9a9855bda3e816577062499ab8a7b12f9b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 27 Jun 2023 03:30:39 +0000 Subject: [PATCH 24/24] build: prelease version 0.11.0 --- ...chore-update-version_2023-06-20-08-54.json | 10 ----- ...chore-update-version_2023-06-20-08-54.json | 10 ----- ...chore-update-version_2023-06-20-08-54.json | 10 ----- ...border-radius-rename_2023-06-20-09-59.json | 10 ----- ...oltip-shape-position_2023-06-20-09-31.json | 10 ----- ...chore-update-version_2023-06-20-08-54.json | 10 ----- ...chore-update-version_2023-06-20-08-54.json | 10 ----- .../vrender/develop_2023-06-20-07-26.json | 10 ----- ...border-radius-rename_2023-06-20-09-59.json | 10 ----- .../vrender/fix-3d-arc_2023-06-25-11-46.json | 10 ----- ...radient-color-offset_2023-06-20-07-06.json | 10 ----- .../fix-gradient-color_2023-06-25-03-54.json | 10 ----- .../fix-node-dpr_2023-06-25-04-21.json | 10 ----- .../fix-options3d_2023-06-20-06-50.json | 10 ----- ...ix-rect-cornerRadius_2023-06-25-10-25.json | 10 ----- common/config/rush/pnpm-lock.yaml | 14 +++---- docs/demos/package.json | 4 +- packages/react-vrender-utils/CHANGELOG.json | 20 ++++++++++ packages/react-vrender-utils/CHANGELOG.md | 9 ++++- packages/react-vrender-utils/package.json | 6 +-- packages/react-vrender/CHANGELOG.json | 17 +++++++++ packages/react-vrender/CHANGELOG.md | 9 ++++- packages/react-vrender/package.json | 4 +- packages/vrender-components/CHANGELOG.json | 25 ++++++++++++ packages/vrender-components/CHANGELOG.md | 14 ++++++- packages/vrender-components/package.json | 4 +- packages/vrender-kits/CHANGELOG.json | 17 +++++++++ packages/vrender-kits/CHANGELOG.md | 9 ++++- packages/vrender-kits/package.json | 4 +- packages/vrender/CHANGELOG.json | 38 +++++++++++++++++++ packages/vrender/CHANGELOG.md | 20 +++++++++- packages/vrender/package.json | 2 +- 32 files changed, 192 insertions(+), 174 deletions(-) delete mode 100644 common/changes/@visactor/react-vrender-utils/chore-update-version_2023-06-20-08-54.json delete mode 100644 common/changes/@visactor/react-vrender/chore-update-version_2023-06-20-08-54.json delete mode 100644 common/changes/@visactor/vrender-components/chore-update-version_2023-06-20-08-54.json delete mode 100644 common/changes/@visactor/vrender-components/feat-border-radius-rename_2023-06-20-09-59.json delete mode 100644 common/changes/@visactor/vrender-components/fix-tooltip-shape-position_2023-06-20-09-31.json delete mode 100644 common/changes/@visactor/vrender-kits/chore-update-version_2023-06-20-08-54.json delete mode 100644 common/changes/@visactor/vrender/chore-update-version_2023-06-20-08-54.json delete mode 100644 common/changes/@visactor/vrender/develop_2023-06-20-07-26.json delete mode 100644 common/changes/@visactor/vrender/feat-border-radius-rename_2023-06-20-09-59.json delete mode 100644 common/changes/@visactor/vrender/fix-3d-arc_2023-06-25-11-46.json delete mode 100644 common/changes/@visactor/vrender/fix-gradient-color-offset_2023-06-20-07-06.json delete mode 100644 common/changes/@visactor/vrender/fix-gradient-color_2023-06-25-03-54.json delete mode 100644 common/changes/@visactor/vrender/fix-node-dpr_2023-06-25-04-21.json delete mode 100644 common/changes/@visactor/vrender/fix-options3d_2023-06-20-06-50.json delete mode 100644 common/changes/@visactor/vrender/fix-rect-cornerRadius_2023-06-25-10-25.json diff --git a/common/changes/@visactor/react-vrender-utils/chore-update-version_2023-06-20-08-54.json b/common/changes/@visactor/react-vrender-utils/chore-update-version_2023-06-20-08-54.json deleted file mode 100644 index 3c8b318bb..000000000 --- a/common/changes/@visactor/react-vrender-utils/chore-update-version_2023-06-20-08-54.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/react-vrender-utils", - "comment": "update vUtils version", - "type": "minor" - } - ], - "packageName": "@visactor/react-vrender-utils" -} \ No newline at end of file diff --git a/common/changes/@visactor/react-vrender/chore-update-version_2023-06-20-08-54.json b/common/changes/@visactor/react-vrender/chore-update-version_2023-06-20-08-54.json deleted file mode 100644 index 652d80a1a..000000000 --- a/common/changes/@visactor/react-vrender/chore-update-version_2023-06-20-08-54.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/react-vrender", - "comment": "update vUtils version", - "type": "minor" - } - ], - "packageName": "@visactor/react-vrender" -} \ No newline at end of file diff --git a/common/changes/@visactor/vrender-components/chore-update-version_2023-06-20-08-54.json b/common/changes/@visactor/vrender-components/chore-update-version_2023-06-20-08-54.json deleted file mode 100644 index e2f33d6cd..000000000 --- a/common/changes/@visactor/vrender-components/chore-update-version_2023-06-20-08-54.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vrender-components", - "comment": "update vUtils version", - "type": "minor" - } - ], - "packageName": "@visactor/vrender-components" -} \ No newline at end of file diff --git a/common/changes/@visactor/vrender-components/feat-border-radius-rename_2023-06-20-09-59.json b/common/changes/@visactor/vrender-components/feat-border-radius-rename_2023-06-20-09-59.json deleted file mode 100644 index 60335a6d9..000000000 --- a/common/changes/@visactor/vrender-components/feat-border-radius-rename_2023-06-20-09-59.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vrender-components", - "comment": "rename all of the borderRadius to cornerRadius", - "type": "minor" - } - ], - "packageName": "@visactor/vrender-components" -} \ No newline at end of file diff --git a/common/changes/@visactor/vrender-components/fix-tooltip-shape-position_2023-06-20-09-31.json b/common/changes/@visactor/vrender-components/fix-tooltip-shape-position_2023-06-20-09-31.json deleted file mode 100644 index 1b90d1dce..000000000 --- a/common/changes/@visactor/vrender-components/fix-tooltip-shape-position_2023-06-20-09-31.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vrender-components", - "comment": "fix the position offset of the tooltip content shape", - "type": "patch" - } - ], - "packageName": "@visactor/vrender-components" -} \ No newline at end of file diff --git a/common/changes/@visactor/vrender-kits/chore-update-version_2023-06-20-08-54.json b/common/changes/@visactor/vrender-kits/chore-update-version_2023-06-20-08-54.json deleted file mode 100644 index 05d0eaa90..000000000 --- a/common/changes/@visactor/vrender-kits/chore-update-version_2023-06-20-08-54.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vrender-kits", - "comment": "update vUtils version", - "type": "minor" - } - ], - "packageName": "@visactor/vrender-kits" -} \ No newline at end of file diff --git a/common/changes/@visactor/vrender/chore-update-version_2023-06-20-08-54.json b/common/changes/@visactor/vrender/chore-update-version_2023-06-20-08-54.json deleted file mode 100644 index e5a1c9452..000000000 --- a/common/changes/@visactor/vrender/chore-update-version_2023-06-20-08-54.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vrender", - "comment": "update vUtils version", - "type": "minor" - } - ], - "packageName": "@visactor/vrender" -} \ No newline at end of file diff --git a/common/changes/@visactor/vrender/develop_2023-06-20-07-26.json b/common/changes/@visactor/vrender/develop_2023-06-20-07-26.json deleted file mode 100644 index b59d745ac..000000000 --- a/common/changes/@visactor/vrender/develop_2023-06-20-07-26.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vrender", - "comment": "move enableView3dTransform into options3d", - "type": "minor" - } - ], - "packageName": "@visactor/vrender" -} \ No newline at end of file diff --git a/common/changes/@visactor/vrender/feat-border-radius-rename_2023-06-20-09-59.json b/common/changes/@visactor/vrender/feat-border-radius-rename_2023-06-20-09-59.json deleted file mode 100644 index 6c817fb90..000000000 --- a/common/changes/@visactor/vrender/feat-border-radius-rename_2023-06-20-09-59.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vrender", - "comment": "rename all of the borderRadius to cornerRadius", - "type": "minor" - } - ], - "packageName": "@visactor/vrender" -} \ No newline at end of file diff --git a/common/changes/@visactor/vrender/fix-3d-arc_2023-06-25-11-46.json b/common/changes/@visactor/vrender/fix-3d-arc_2023-06-25-11-46.json deleted file mode 100644 index 841f579b7..000000000 --- a/common/changes/@visactor/vrender/fix-3d-arc_2023-06-25-11-46.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vrender", - "comment": "fix the bug of arc in 3d mode", - "type": "patch" - } - ], - "packageName": "@visactor/vrender" -} \ No newline at end of file diff --git a/common/changes/@visactor/vrender/fix-gradient-color-offset_2023-06-20-07-06.json b/common/changes/@visactor/vrender/fix-gradient-color-offset_2023-06-20-07-06.json deleted file mode 100644 index 807305ee5..000000000 --- a/common/changes/@visactor/vrender/fix-gradient-color-offset_2023-06-20-07-06.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vrender", - "comment": "fix the bug of gradient color while the x1 in color is zero caused by ||", - "type": "patch" - } - ], - "packageName": "@visactor/vrender" -} \ No newline at end of file diff --git a/common/changes/@visactor/vrender/fix-gradient-color_2023-06-25-03-54.json b/common/changes/@visactor/vrender/fix-gradient-color_2023-06-25-03-54.json deleted file mode 100644 index 413273279..000000000 --- a/common/changes/@visactor/vrender/fix-gradient-color_2023-06-25-03-54.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vrender", - "comment": "fix the bug of gradient-color caused by bounds and offsetXY", - "type": "patch" - } - ], - "packageName": "@visactor/vrender" -} \ No newline at end of file diff --git a/common/changes/@visactor/vrender/fix-node-dpr_2023-06-25-04-21.json b/common/changes/@visactor/vrender/fix-node-dpr_2023-06-25-04-21.json deleted file mode 100644 index 49aa81fce..000000000 --- a/common/changes/@visactor/vrender/fix-node-dpr_2023-06-25-04-21.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vrender", - "comment": "fix the bug of dpr in node env", - "type": "patch" - } - ], - "packageName": "@visactor/vrender" -} \ No newline at end of file diff --git a/common/changes/@visactor/vrender/fix-options3d_2023-06-20-06-50.json b/common/changes/@visactor/vrender/fix-options3d_2023-06-20-06-50.json deleted file mode 100644 index acfef67ef..000000000 --- a/common/changes/@visactor/vrender/fix-options3d_2023-06-20-06-50.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vrender", - "comment": "fix the error of options3d default value", - "type": "patch" - } - ], - "packageName": "@visactor/vrender" -} \ No newline at end of file diff --git a/common/changes/@visactor/vrender/fix-rect-cornerRadius_2023-06-25-10-25.json b/common/changes/@visactor/vrender/fix-rect-cornerRadius_2023-06-25-10-25.json deleted file mode 100644 index 4620bd185..000000000 --- a/common/changes/@visactor/vrender/fix-rect-cornerRadius_2023-06-25-10-25.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vrender", - "comment": "fix the bug of rect cornerRadius on left top", - "type": "patch" - } - ], - "packageName": "@visactor/vrender" -} \ No newline at end of file diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index cb3a71a90..c2c4b3153 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: '@esbuild-plugins/node-modules-polyfill': 0.1.4 '@internal/eslint-config': workspace:* '@internal/ts-config': workspace:* - '@visactor/vrender': workspace:0.11.0-alpha.2 - '@visactor/vrender-kits': workspace:0.11.0-alpha.2 + '@visactor/vrender': workspace:0.11.0 + '@visactor/vrender-kits': workspace:0.11.0 '@visactor/vutils': ~0.9.2-alpha.5 canvas: 2.11.2 d3-scale-chromatic: ^3.0.0 @@ -55,7 +55,7 @@ importers: '@types/react': 16.9.49 '@types/react-dom': 16.9.8 '@types/react-reconciler': ^0.28.2 - '@visactor/vrender': workspace:0.11.0-alpha.2 + '@visactor/vrender': workspace:0.11.0 '@visactor/vutils': ~0.9.2-alpha.5 '@vitejs/plugin-react': 3.1.0 eslint: ~8.18.0 @@ -93,8 +93,8 @@ importers: '@rushstack/eslint-patch': ~1.1.4 '@types/react': 16.9.49 '@types/react-dom': 16.9.8 - '@visactor/react-vrender': workspace:0.11.0-alpha.2 - '@visactor/vrender': workspace:0.11.0-alpha.2 + '@visactor/react-vrender': workspace:0.11.0 + '@visactor/vrender': workspace:0.11.0 '@visactor/vutils': ~0.9.2-alpha.5 '@vitejs/plugin-react': 3.1.0 eslint: ~8.18.0 @@ -182,7 +182,7 @@ importers: '@internal/ts-config': workspace:* '@rushstack/eslint-patch': ~1.1.4 '@types/jest': ^26.0.0 - '@visactor/vrender': workspace:0.11.0-alpha.2 + '@visactor/vrender': workspace:0.11.0 '@visactor/vscale': 0.9.0-alpha.2 '@visactor/vutils': ~0.9.2-alpha.5 eslint: ~8.18.0 @@ -222,7 +222,7 @@ importers: '@types/node-fetch': 2.6.4 '@types/react': 16.9.49 '@types/react-dom': 16.9.8 - '@visactor/vrender': workspace:0.11.0-alpha.2 + '@visactor/vrender': workspace:0.11.0 '@visactor/vutils': ~0.9.2-alpha.5 '@vitejs/plugin-react': 3.1.0 canvas: 2.11.2 diff --git a/docs/demos/package.json b/docs/demos/package.json index 3825ba7ac..88648e71f 100644 --- a/docs/demos/package.json +++ b/docs/demos/package.json @@ -12,7 +12,7 @@ "@internal/eslint-config": "workspace:*", "@internal/ts-config": "workspace:*", "@visactor/vutils": "~0.9.2-alpha.5", - "@visactor/vrender-kits": "workspace:0.11.0-alpha.2", + "@visactor/vrender-kits": "workspace:0.11.0", "d3-scale-chromatic": "^3.0.0", "lodash": "4.17.21", "dat.gui": "^0.7.9", @@ -28,6 +28,6 @@ "@antv/g": "^5.7.4" }, "dependencies": { - "@visactor/vrender": "workspace:0.11.0-alpha.2" + "@visactor/vrender": "workspace:0.11.0" } } diff --git a/packages/react-vrender-utils/CHANGELOG.json b/packages/react-vrender-utils/CHANGELOG.json index 189ac2478..2e1c12cd3 100644 --- a/packages/react-vrender-utils/CHANGELOG.json +++ b/packages/react-vrender-utils/CHANGELOG.json @@ -1,6 +1,26 @@ { "name": "@visactor/react-vrender-utils", "entries": [ + { + "version": "0.11.0", + "tag": "@visactor/react-vrender-utils_v0.11.0", + "date": "Tue, 27 Jun 2023 03:18:18 GMT", + "comments": { + "minor": [ + { + "comment": "update vUtils version" + } + ], + "dependency": [ + { + "comment": "Updating dependency \"@visactor/vrender\" from `0.11.0-alpha.2` to `0.11.0`" + }, + { + "comment": "Updating dependency \"@visactor/react-vrender\" from `0.11.0-alpha.2` to `0.11.0`" + } + ] + } + }, { "version": "0.10.3", "tag": "@visactor/react-vrender-utils_v0.10.3", diff --git a/packages/react-vrender-utils/CHANGELOG.md b/packages/react-vrender-utils/CHANGELOG.md index 534ed52fa..45f69b965 100644 --- a/packages/react-vrender-utils/CHANGELOG.md +++ b/packages/react-vrender-utils/CHANGELOG.md @@ -1,6 +1,13 @@ # Change Log - @visactor/react-vrender-utils -This log was last generated on Tue, 20 Jun 2023 06:23:42 GMT and should not be manually modified. +This log was last generated on Tue, 27 Jun 2023 03:18:18 GMT and should not be manually modified. + +## 0.11.0 +Tue, 27 Jun 2023 03:18:18 GMT + +### Minor changes + +- update vUtils version ## 0.10.3 Tue, 20 Jun 2023 06:23:42 GMT diff --git a/packages/react-vrender-utils/package.json b/packages/react-vrender-utils/package.json index 358b3c3da..c910c4d29 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.11.0-alpha.2", + "version": "0.11.0", "description": "", "sideEffects": false, "main": "cjs/index.js", @@ -25,8 +25,8 @@ "react-dom": "^18.2.0" }, "dependencies": { - "@visactor/vrender": "workspace:0.11.0-alpha.2", - "@visactor/react-vrender": "workspace:0.11.0-alpha.2", + "@visactor/vrender": "workspace:0.11.0", + "@visactor/react-vrender": "workspace:0.11.0", "@visactor/vutils": "~0.9.2-alpha.5", "react-reconciler": "^0.29.0", "tslib": "^2.3.1" diff --git a/packages/react-vrender/CHANGELOG.json b/packages/react-vrender/CHANGELOG.json index d86f2158f..ac918d0a8 100644 --- a/packages/react-vrender/CHANGELOG.json +++ b/packages/react-vrender/CHANGELOG.json @@ -1,6 +1,23 @@ { "name": "@visactor/react-vrender", "entries": [ + { + "version": "0.11.0", + "tag": "@visactor/react-vrender_v0.11.0", + "date": "Tue, 27 Jun 2023 03:18:18 GMT", + "comments": { + "minor": [ + { + "comment": "update vUtils version" + } + ], + "dependency": [ + { + "comment": "Updating dependency \"@visactor/vrender\" from `0.11.0-alpha.2` to `0.11.0`" + } + ] + } + }, { "version": "0.10.3", "tag": "@visactor/react-vrender_v0.10.3", diff --git a/packages/react-vrender/CHANGELOG.md b/packages/react-vrender/CHANGELOG.md index 1fb85bc61..d52d0761b 100644 --- a/packages/react-vrender/CHANGELOG.md +++ b/packages/react-vrender/CHANGELOG.md @@ -1,6 +1,13 @@ # Change Log - @visactor/react-vrender -This log was last generated on Tue, 20 Jun 2023 06:23:42 GMT and should not be manually modified. +This log was last generated on Tue, 27 Jun 2023 03:18:18 GMT and should not be manually modified. + +## 0.11.0 +Tue, 27 Jun 2023 03:18:18 GMT + +### Minor changes + +- update vUtils version ## 0.10.3 Tue, 20 Jun 2023 06:23:42 GMT diff --git a/packages/react-vrender/package.json b/packages/react-vrender/package.json index baf5bf2e6..78e043a21 100644 --- a/packages/react-vrender/package.json +++ b/packages/react-vrender/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/react-vrender", - "version": "0.11.0-alpha.2", + "version": "0.11.0", "description": "", "sideEffects": false, "main": "cjs/index.js", @@ -24,7 +24,7 @@ "react": "^18.2.0" }, "dependencies": { - "@visactor/vrender": "workspace:0.11.0-alpha.2", + "@visactor/vrender": "workspace:0.11.0", "@visactor/vutils": "~0.9.2-alpha.5", "react-reconciler": "^0.29.0", "tslib": "^2.3.1" diff --git a/packages/vrender-components/CHANGELOG.json b/packages/vrender-components/CHANGELOG.json index 8b4ea9890..f3e31bd9f 100644 --- a/packages/vrender-components/CHANGELOG.json +++ b/packages/vrender-components/CHANGELOG.json @@ -1,6 +1,31 @@ { "name": "@visactor/vrender-components", "entries": [ + { + "version": "0.11.0", + "tag": "@visactor/vrender-components_v0.11.0", + "date": "Tue, 27 Jun 2023 03:18:18 GMT", + "comments": { + "minor": [ + { + "comment": "update vUtils version" + }, + { + "comment": "rename all of the borderRadius to cornerRadius" + } + ], + "patch": [ + { + "comment": "fix the position offset of the tooltip content shape" + } + ], + "dependency": [ + { + "comment": "Updating dependency \"@visactor/vrender\" from `0.11.0-alpha.2` to `0.11.0`" + } + ] + } + }, { "version": "0.10.3", "tag": "@visactor/vrender-components_v0.10.3", diff --git a/packages/vrender-components/CHANGELOG.md b/packages/vrender-components/CHANGELOG.md index 2bdb7a85f..3692f7d3f 100644 --- a/packages/vrender-components/CHANGELOG.md +++ b/packages/vrender-components/CHANGELOG.md @@ -1,6 +1,18 @@ # Change Log - @visactor/vrender-components -This log was last generated on Tue, 20 Jun 2023 06:23:42 GMT and should not be manually modified. +This log was last generated on Tue, 27 Jun 2023 03:18:18 GMT and should not be manually modified. + +## 0.11.0 +Tue, 27 Jun 2023 03:18:18 GMT + +### Minor changes + +- update vUtils version +- rename all of the borderRadius to cornerRadius + +### Patches + +- fix the position offset of the tooltip content shape ## 0.10.3 Tue, 20 Jun 2023 06:23:42 GMT diff --git a/packages/vrender-components/package.json b/packages/vrender-components/package.json index a9d5eed95..2a19b5bcc 100644 --- a/packages/vrender-components/package.json +++ b/packages/vrender-components/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vrender-components", - "version": "0.11.0-alpha.2", + "version": "0.11.0", "description": "components library for dp visualization", "sideEffects": false, "main": "cjs/index.js", @@ -24,7 +24,7 @@ "prepublishOnly": "npm run build" }, "dependencies": { - "@visactor/vrender": "workspace:0.11.0-alpha.2", + "@visactor/vrender": "workspace:0.11.0", "@visactor/vutils": "~0.9.2-alpha.5", "@visactor/vscale": "0.9.0-alpha.2", "gl-matrix": "^3.4.3" diff --git a/packages/vrender-kits/CHANGELOG.json b/packages/vrender-kits/CHANGELOG.json index 63fd3e578..fd41d6503 100644 --- a/packages/vrender-kits/CHANGELOG.json +++ b/packages/vrender-kits/CHANGELOG.json @@ -1,6 +1,23 @@ { "name": "@visactor/vrender-kits", "entries": [ + { + "version": "0.11.0", + "tag": "@visactor/vrender-kits_v0.11.0", + "date": "Tue, 27 Jun 2023 03:18:18 GMT", + "comments": { + "minor": [ + { + "comment": "update vUtils version" + } + ], + "dependency": [ + { + "comment": "Updating dependency \"@visactor/vrender\" from `0.11.0-alpha.2` to `0.11.0`" + } + ] + } + }, { "version": "0.10.3", "tag": "@visactor/vrender-kits_v0.10.3", diff --git a/packages/vrender-kits/CHANGELOG.md b/packages/vrender-kits/CHANGELOG.md index 4a60ad2d5..bbe1e5b26 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 Tue, 20 Jun 2023 06:23:42 GMT and should not be manually modified. +This log was last generated on Tue, 27 Jun 2023 03:18:18 GMT and should not be manually modified. + +## 0.11.0 +Tue, 27 Jun 2023 03:18:18 GMT + +### Minor changes + +- update vUtils version ## 0.10.3 Tue, 20 Jun 2023 06:23:42 GMT diff --git a/packages/vrender-kits/package.json b/packages/vrender-kits/package.json index 31303a888..21dafc3db 100644 --- a/packages/vrender-kits/package.json +++ b/packages/vrender-kits/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vrender-kits", - "version": "0.11.0-alpha.2", + "version": "0.11.0", "description": "", "sideEffects": false, "main": "cjs/index.js", @@ -21,7 +21,7 @@ "prepublishOnly": "npm run build" }, "dependencies": { - "@visactor/vrender": "workspace:0.11.0-alpha.2", + "@visactor/vrender": "workspace:0.11.0", "@visactor/vutils": "~0.9.2-alpha.5", "@resvg/resvg-js": "2.4.1", "canvas": "2.11.2", diff --git a/packages/vrender/CHANGELOG.json b/packages/vrender/CHANGELOG.json index 6dc355ce6..93f8b1fb6 100644 --- a/packages/vrender/CHANGELOG.json +++ b/packages/vrender/CHANGELOG.json @@ -1,6 +1,44 @@ { "name": "@visactor/vrender", "entries": [ + { + "version": "0.11.0", + "tag": "@visactor/vrender_v0.11.0", + "date": "Tue, 27 Jun 2023 03:18:18 GMT", + "comments": { + "minor": [ + { + "comment": "update vUtils version" + }, + { + "comment": "move enableView3dTransform into options3d" + }, + { + "comment": "rename all of the borderRadius to cornerRadius" + } + ], + "patch": [ + { + "comment": "fix the bug of arc in 3d mode" + }, + { + "comment": "fix the bug of gradient-color caused by bounds and offsetXY" + }, + { + "comment": "fix the bug of gradient color while the x1 in color is zero caused by ||" + }, + { + "comment": "fix the bug of dpr in node env" + }, + { + "comment": "fix the error of options3d default value" + }, + { + "comment": "fix the bug of rect cornerRadius on left top" + } + ] + } + }, { "version": "0.10.3", "tag": "@visactor/vrender_v0.10.3", diff --git a/packages/vrender/CHANGELOG.md b/packages/vrender/CHANGELOG.md index 26ef67630..15ad52311 100644 --- a/packages/vrender/CHANGELOG.md +++ b/packages/vrender/CHANGELOG.md @@ -1,6 +1,24 @@ # Change Log - @visactor/vrender -This log was last generated on Tue, 20 Jun 2023 06:23:42 GMT and should not be manually modified. +This log was last generated on Tue, 27 Jun 2023 03:18:18 GMT and should not be manually modified. + +## 0.11.0 +Tue, 27 Jun 2023 03:18:18 GMT + +### Minor changes + +- update vUtils version +- move enableView3dTransform into options3d +- rename all of the borderRadius to cornerRadius + +### Patches + +- fix the bug of arc in 3d mode +- fix the bug of gradient-color caused by bounds and offsetXY +- fix the bug of gradient color while the x1 in color is zero caused by || +- fix the bug of dpr in node env +- fix the error of options3d default value +- fix the bug of rect cornerRadius on left top ## 0.10.3 Tue, 20 Jun 2023 06:23:42 GMT diff --git a/packages/vrender/package.json b/packages/vrender/package.json index 9534783d8..5ec947a1b 100644 --- a/packages/vrender/package.json +++ b/packages/vrender/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vrender", - "version": "0.11.0-alpha.2", + "version": "0.11.0", "description": "", "sideEffects": true, "main": "cjs/index.js",