From 66f55339f729efb74c37141b9ae6602ae3fd274d Mon Sep 17 00:00:00 2001 From: skie1997 Date: Thu, 10 Aug 2023 18:04:34 +0800 Subject: [PATCH 01/35] feat(marker): add clipRange config --- .../__tests__/browser/examples/mark-line.ts | 6 ++++++ packages/vrender-components/src/marker/base.ts | 6 ++++-- packages/vrender-components/src/marker/type.ts | 9 +++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/packages/vrender-components/__tests__/browser/examples/mark-line.ts b/packages/vrender-components/__tests__/browser/examples/mark-line.ts index 124862812..80dcf50b0 100644 --- a/packages/vrender-components/__tests__/browser/examples/mark-line.ts +++ b/packages/vrender-components/__tests__/browser/examples/mark-line.ts @@ -30,6 +30,12 @@ export function run() { refX: guiObject.labelRefX, refY: guiObject.labelRefY, refAngle: degreeToRadian(guiObject.labelRefAngle) + }, + clipRange: { + x: 10, + y: 100, + width: 200, + height: 100 } }; const markLine = new MarkLine({ diff --git a/packages/vrender-components/src/marker/base.ts b/packages/vrender-components/src/marker/base.ts index 5f2af20e3..f7ef47ff1 100644 --- a/packages/vrender-components/src/marker/base.ts +++ b/packages/vrender-components/src/marker/base.ts @@ -14,7 +14,6 @@ export abstract class Marker extends AbstractComponent extends AbstractComponent Date: Thu, 10 Aug 2023 18:12:06 +0800 Subject: [PATCH 02/35] chore: eslint error --- .../feat-marker-clipRange_2023-08-10-10-07.json | 10 ++++++++++ .../feat-marker-clipRange_2023-08-10-10-07.json | 10 ++++++++++ .../__tests__/browser/examples/mark-line.ts | 2 +- packages/vrender-components/src/marker/base.ts | 3 ++- 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 common/changes/@visactor/vrender-components/feat-marker-clipRange_2023-08-10-10-07.json create mode 100644 common/changes/@visactor/vrender/feat-marker-clipRange_2023-08-10-10-07.json diff --git a/common/changes/@visactor/vrender-components/feat-marker-clipRange_2023-08-10-10-07.json b/common/changes/@visactor/vrender-components/feat-marker-clipRange_2023-08-10-10-07.json new file mode 100644 index 000000000..35192468b --- /dev/null +++ b/common/changes/@visactor/vrender-components/feat-marker-clipRange_2023-08-10-10-07.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender-components", + "comment": "feat(marker): add clipRange config. fixed VisActor/VChart#181", + "type": "patch" + } + ], + "packageName": "@visactor/vrender-components" +} \ No newline at end of file diff --git a/common/changes/@visactor/vrender/feat-marker-clipRange_2023-08-10-10-07.json b/common/changes/@visactor/vrender/feat-marker-clipRange_2023-08-10-10-07.json new file mode 100644 index 000000000..1f90297f1 --- /dev/null +++ b/common/changes/@visactor/vrender/feat-marker-clipRange_2023-08-10-10-07.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender", + "comment": "feat(marker): add clipRange config. fixed VisActor/VChart#181'", + "type": "patch" + } + ], + "packageName": "@visactor/vrender" +} \ No newline at end of file diff --git a/packages/vrender-components/__tests__/browser/examples/mark-line.ts b/packages/vrender-components/__tests__/browser/examples/mark-line.ts index 80dcf50b0..ebe9dba5e 100644 --- a/packages/vrender-components/__tests__/browser/examples/mark-line.ts +++ b/packages/vrender-components/__tests__/browser/examples/mark-line.ts @@ -34,7 +34,7 @@ export function run() { clipRange: { x: 10, y: 100, - width: 200, + width: 300, height: 100 } }; diff --git a/packages/vrender-components/src/marker/base.ts b/packages/vrender-components/src/marker/base.ts index f7ef47ff1..640d13638 100644 --- a/packages/vrender-components/src/marker/base.ts +++ b/packages/vrender-components/src/marker/base.ts @@ -1,5 +1,6 @@ import type { IGroup } from '@visactor/vrender'; import { createGroup } from '@visactor/vrender'; +import { isValid } from '@visactor/vutils'; import { AbstractComponent } from '../core/base'; import type { Tag } from '../tag'; import type { MarkerAttrs } from './type'; @@ -26,7 +27,7 @@ export abstract class Marker extends AbstractComponent Date: Thu, 10 Aug 2023 20:16:52 +0800 Subject: [PATCH 03/35] chore: rename global window name to test marker in VChart --- .../src/data-zoom/data-zoom.ts | 8 +++--- .../src/player/continuous-player.ts | 10 +++---- .../src/player/discrete-player.ts | 10 +++---- .../src/scrollbar/scrollbar.ts | 14 +++++----- .../vrender-components/src/slider/slider.ts | 26 +++++++++---------- 5 files changed, 34 insertions(+), 34 deletions(-) diff --git a/packages/vrender-components/src/data-zoom/data-zoom.ts b/packages/vrender-components/src/data-zoom/data-zoom.ts index d75a20f6b..e04465f0a 100644 --- a/packages/vrender-components/src/data-zoom/data-zoom.ts +++ b/packages/vrender-components/src/data-zoom/data-zoom.ts @@ -1,5 +1,5 @@ import type { FederatedPointerEvent, IArea, IGroup, ILine, IRect, ISymbol, INode } from '@visactor/vrender'; -import { vglobal } from '@visactor/vrender'; +import { global } from '@visactor/vrender'; import type { IPointLike } from '@visactor/vutils'; import { array, clamp, isFunction, isValid, merge } from '@visactor/vutils'; import { AbstractComponent } from '../core/base'; @@ -167,11 +167,11 @@ export class DataZoom extends AbstractComponent> { (e: FederatedPointerEvent) => this._onHandlerPointerDown(e, selectedTag) as unknown as EventListener ); } - if (vglobal.env === 'browser') { + if (global.env === 'browser') { // 拖拽时 - vglobal.addEventListener('pointermove', this._onHandlerPointerMove.bind(this) as EventListener); + global.addEventListener('pointermove', this._onHandlerPointerMove.bind(this) as EventListener); // 拖拽结束 - vglobal.addEventListener('pointerup', this._onHandlerPointerUp.bind(this) as EventListener); + global.addEventListener('pointerup', this._onHandlerPointerUp.bind(this) as EventListener); } // 拖拽时 (this as unknown as IGroup).addEventListener('pointermove', this._onHandlerPointerMove as EventListener); diff --git a/packages/vrender-components/src/player/continuous-player.ts b/packages/vrender-components/src/player/continuous-player.ts index 44785085a..424f4c405 100644 --- a/packages/vrender-components/src/player/continuous-player.ts +++ b/packages/vrender-components/src/player/continuous-player.ts @@ -1,5 +1,5 @@ import type { FederatedPointerEvent } from '@visactor/vrender'; -import { vglobal } from '@visactor/vrender'; +import { global } from '@visactor/vrender'; import { BasePlayer } from './base-player'; import type { ContinuousPlayerAttributes } from './type'; import { PlayerEventEnum } from './type'; @@ -163,7 +163,7 @@ export class ContinuousPlayer extends BasePlayer imp // 事件 this.dispatchCustomEvent(PlayerEventEnum.OnPlay); // 开始播放动画 - this._rafId = vglobal.getRequestAnimationFrame()(this._play.bind(this)); + this._rafId = global.getRequestAnimationFrame()(this._play.bind(this)); }; /** @@ -184,7 +184,7 @@ export class ContinuousPlayer extends BasePlayer imp } // 持续播放 - this._rafId = vglobal.getRequestAnimationFrame()(this._play.bind(this)); + this._rafId = global.getRequestAnimationFrame()(this._play.bind(this)); }; /** @@ -194,7 +194,7 @@ export class ContinuousPlayer extends BasePlayer imp // 播放状态更新 this._isPlaying = false; // 取消播放动画 - vglobal.getCancelAnimationFrame()(this._rafId); + global.getCancelAnimationFrame()(this._rafId); // 切换按钮 this._controller.togglePlay(); // 事件 @@ -211,7 +211,7 @@ export class ContinuousPlayer extends BasePlayer imp this._isPlaying = false; // 计算已流逝的时间, 需要记录下来 this._elapsed = Date.now() - this._startTime; - vglobal.getCancelAnimationFrame()(this._rafId); + global.getCancelAnimationFrame()(this._rafId); this._controller.togglePlay(); this.dispatchCustomEvent(PlayerEventEnum.OnPause); diff --git a/packages/vrender-components/src/player/discrete-player.ts b/packages/vrender-components/src/player/discrete-player.ts index f348811ab..ed68798e4 100644 --- a/packages/vrender-components/src/player/discrete-player.ts +++ b/packages/vrender-components/src/player/discrete-player.ts @@ -1,6 +1,6 @@ import { isNil, merge } from '@visactor/vutils'; import type { FederatedPointerEvent } from '@visactor/vrender'; -import { vglobal } from '@visactor/vrender'; +import { global } from '@visactor/vrender'; import { BasePlayer } from './base-player'; import type { DirectionType, DiscretePlayerAttributes, PlayerAttributes } from './type'; import { DirectionEnum, PlayerEventEnum } from './type'; @@ -140,7 +140,7 @@ export class DiscretePlayer extends BasePlayer impleme // 重置tick时间, 暂停后重新播放也会重新计时 this._tickTime = Date.now(); // 开启动画 - this._rafId = vglobal.getRequestAnimationFrame()(this._play.bind(this, true)); + this._rafId = global.getRequestAnimationFrame()(this._play.bind(this, true)); }; /** @@ -178,7 +178,7 @@ export class DiscretePlayer extends BasePlayer impleme this._isReachEnd = true; } - this._rafId = vglobal.getRequestAnimationFrame()(this._play.bind(this, false)); + this._rafId = global.getRequestAnimationFrame()(this._play.bind(this, false)); }; /** @@ -198,7 +198,7 @@ export class DiscretePlayer extends BasePlayer impleme // 图标切换 this._controller.togglePlay(); // 取消播放动画 - vglobal.getCancelAnimationFrame()(this._rafId); + global.getCancelAnimationFrame()(this._rafId); // 重置ActiveIndex this._activeIndex = -1; // 播放结束时并且到达终点 @@ -213,7 +213,7 @@ export class DiscretePlayer extends BasePlayer impleme return; } this._isPlaying = false; - vglobal.getCancelAnimationFrame()(this._rafId); + global.getCancelAnimationFrame()(this._rafId); this._controller.togglePlay(); this.dispatchCustomEvent(PlayerEventEnum.OnPause); diff --git a/packages/vrender-components/src/scrollbar/scrollbar.ts b/packages/vrender-components/src/scrollbar/scrollbar.ts index 0d8620bcc..ccb166ec3 100644 --- a/packages/vrender-components/src/scrollbar/scrollbar.ts +++ b/packages/vrender-components/src/scrollbar/scrollbar.ts @@ -2,7 +2,7 @@ * @description 滚动条组件 */ import type { IRectGraphicAttribute, FederatedPointerEvent, IGroup, IRect } from '@visactor/vrender'; -import { CustomEvent, vglobal } from '@visactor/vrender'; +import { CustomEvent, global } from '@visactor/vrender'; import { merge, normalizePadding, clamp, clampRange } from '@visactor/vutils'; import { AbstractComponent } from '../core/base'; @@ -266,9 +266,9 @@ export class ScrollBar extends AbstractComponent> e.stopPropagation(); const { direction } = this.attribute as ScrollBarAttributes; this._prePos = direction === 'horizontal' ? e.clientX : e.clientY; - if (vglobal.env === 'browser') { - vglobal.addEventListener('pointermove', this._onSliderPointerMove); - vglobal.addEventListener('pointerup', this._onSliderPointerUp); + if (global.env === 'browser') { + global.addEventListener('pointermove', this._onSliderPointerMove); + global.addEventListener('pointerup', this._onSliderPointerUp); } else { this._slider.addEventListener('pointermove', this._onSliderPointerMove); this._slider.addEventListener('pointerup', this._onSliderPointerUp); @@ -300,9 +300,9 @@ export class ScrollBar extends AbstractComponent> private _onSliderPointerUp = (e: any) => { e.preventDefault(); - if (vglobal.env === 'browser') { - vglobal.removeEventListener('pointermove', this._onSliderPointerMove); - vglobal.removeEventListener('pointerup', this._onSliderPointerUp); + if (global.env === 'browser') { + global.removeEventListener('pointermove', this._onSliderPointerMove); + global.removeEventListener('pointerup', this._onSliderPointerUp); } else { this._slider.removeEventListener('pointermove', this._onSliderPointerMove); this._slider.removeEventListener('pointerup', this._onSliderPointerUp); diff --git a/packages/vrender-components/src/slider/slider.ts b/packages/vrender-components/src/slider/slider.ts index 634d91f86..bdcd53ae8 100644 --- a/packages/vrender-components/src/slider/slider.ts +++ b/packages/vrender-components/src/slider/slider.ts @@ -15,7 +15,7 @@ import type { FederatedPointerEvent, Cursor } from '@visactor/vrender'; -import { createGroup, createText, vglobal, createRect, createSymbol, CustomEvent } from '@visactor/vrender'; +import { createGroup, createText, global, createRect, createSymbol, CustomEvent } from '@visactor/vrender'; import { AbstractComponent } from '../core/base'; import { SLIDER_ELEMENT_NAME } from './constant'; @@ -493,9 +493,9 @@ export class Slider extends AbstractComponent> { e.stopPropagation(); this._currentHandler = e.target as unknown as IGraphic; this._prePos = this._isHorizontal ? e.clientX : e.clientY; - if (vglobal.env === 'browser') { - vglobal.addEventListener('pointermove', this._onHandlerPointerMove as EventListenerOrEventListenerObject); - vglobal.addEventListener('pointerup', this._onHandlerPointerUp as EventListenerOrEventListenerObject); + if (global.env === 'browser') { + global.addEventListener('pointermove', this._onHandlerPointerMove as EventListenerOrEventListenerObject); + global.addEventListener('pointerup', this._onHandlerPointerUp as EventListenerOrEventListenerObject); } else { this._currentHandler.addEventListener( 'pointermove', @@ -550,9 +550,9 @@ export class Slider extends AbstractComponent> { private _onHandlerPointerUp = (e: FederatedPointerEvent) => { e.preventDefault(); this._currentHandler = null; - if (vglobal.env === 'browser') { - vglobal.removeEventListener('pointermove', this._onHandlerPointerMove as EventListenerOrEventListenerObject); - vglobal.removeEventListener('pointerup', this._onHandlerPointerUp as EventListenerOrEventListenerObject); + if (global.env === 'browser') { + global.removeEventListener('pointermove', this._onHandlerPointerMove as EventListenerOrEventListenerObject); + global.removeEventListener('pointerup', this._onHandlerPointerUp as EventListenerOrEventListenerObject); } else { const currentTarget = e.target; currentTarget.removeEventListener( @@ -570,9 +570,9 @@ export class Slider extends AbstractComponent> { private _onTrackPointerdown = (e: FederatedPointerEvent) => { e.stopPropagation(); this._prePos = this._isHorizontal ? e.clientX : e.clientY; - if (vglobal.env === 'browser') { - vglobal.addEventListener('pointermove', this._onTrackPointerMove as EventListenerOrEventListenerObject); - vglobal.addEventListener('pointerup', this._onTrackPointerUp as EventListenerOrEventListenerObject); + if (global.env === 'browser') { + global.addEventListener('pointermove', this._onTrackPointerMove as EventListenerOrEventListenerObject); + global.addEventListener('pointerup', this._onTrackPointerUp as EventListenerOrEventListenerObject); } else { this._track.addEventListener('pointermove', this._onTrackPointerMove as EventListenerOrEventListenerObject); this._track.addEventListener('pointerup', this._onTrackPointerUp as EventListenerOrEventListenerObject); @@ -633,9 +633,9 @@ export class Slider extends AbstractComponent> { private _onTrackPointerUp = (e: FederatedPointerEvent) => { e.preventDefault(); - if (vglobal.env === 'browser') { - vglobal.removeEventListener('pointermove', this._onTrackPointerMove as EventListenerOrEventListenerObject); - vglobal.removeEventListener('pointerup', this._onTrackPointerUp as EventListenerOrEventListenerObject); + if (global.env === 'browser') { + global.removeEventListener('pointermove', this._onTrackPointerMove as EventListenerOrEventListenerObject); + global.removeEventListener('pointerup', this._onTrackPointerUp as EventListenerOrEventListenerObject); } else { this._track.removeEventListener('pointermove', this._onTrackPointerMove as EventListenerOrEventListenerObject); this._track.removeEventListener('pointerup', this._onTrackPointerUp as EventListenerOrEventListenerObject); From ceb1e8c94dd59e8b26846b8b1d496a63b82fa4ee Mon Sep 17 00:00:00 2001 From: skie1997 Date: Thu, 10 Aug 2023 20:41:52 +0800 Subject: [PATCH 04/35] chore: rename global window name to test marker in VChart --- .../src/contribution/env-canvas/window-contribution.ts | 4 ++-- docs/demos/src/core/stage.ts | 2 +- packages/vrender/src/constants.ts | 2 +- .../layerHandler/canvas2d-contribution.ts | 4 ++-- .../layerHandler/offscreen2d-contribution.ts | 4 ++-- .../core/contributions/window/browser-contribution.ts | 4 ++-- .../core/contributions/window/feishu-contribution.ts | 4 ++-- .../src/core/contributions/window/lynx-contribution.ts | 4 ++-- .../core/contributions/window/native-contribution.ts | 4 ++-- .../src/core/contributions/window/node-contribution.ts | 4 ++-- .../src/core/contributions/window/taro-contribution.ts | 4 ++-- .../src/core/contributions/window/wx-contribution.ts | 4 ++-- packages/vrender/src/core/core-modules.ts | 10 +++++----- packages/vrender/src/core/graphic-utils.ts | 4 ++-- packages/vrender/src/core/layer-service.ts | 4 ++-- packages/vrender/src/core/stage.ts | 10 +++++----- packages/vrender/src/core/window.ts | 6 +++--- packages/vrender/src/graphic/text.ts | 4 ++-- packages/vrender/src/modules.ts | 6 +++--- packages/vrender/src/picker/canvas-picker-service.ts | 4 ++-- packages/vrender/src/picker/global-picker-service.ts | 4 ++-- packages/vrender/src/picker/math-picker-service.ts | 4 ++-- packages/vrender/src/picker/picker-service.ts | 4 ++-- .../render/incremental-draw-contribution.ts | 4 ++-- 24 files changed, 54 insertions(+), 54 deletions(-) diff --git a/docs/demos/src/contribution/env-canvas/window-contribution.ts b/docs/demos/src/contribution/env-canvas/window-contribution.ts index 995d9130d..c41f4c499 100644 --- a/docs/demos/src/contribution/env-canvas/window-contribution.ts +++ b/docs/demos/src/contribution/env-canvas/window-contribution.ts @@ -8,7 +8,7 @@ import type { ICanvas, IDomRectLike } from '@visactor/vrender'; -import { Generator, VGlobal, BaseWindowHandlerContribution } from '@visactor/vrender'; +import { Generator, Global, BaseWindowHandlerContribution } from '@visactor/vrender'; import { NodeCanvas } from './canvas'; import type { IBoundsLike } from '@visactor/vutils'; @@ -21,7 +21,7 @@ export class NodeWindowHandlerContribution extends BaseWindowHandlerContribution return null; } - constructor(@inject(VGlobal) private readonly global: IGlobal) { + constructor(@inject(Global) private readonly global: IGlobal) { super(); } diff --git a/docs/demos/src/core/stage.ts b/docs/demos/src/core/stage.ts index c084dc25c..0f47ca968 100644 --- a/docs/demos/src/core/stage.ts +++ b/docs/demos/src/core/stage.ts @@ -1,7 +1,7 @@ import { createStage, container } from '@visactor/vrender'; export function createAStage() { - console.log(container.get(Symbol.for('VGlobal'))); + console.log(container.get(Symbol.for('Global'))); const stage = createStage({}); console.log(stage); // const stage = new Stage({ diff --git a/packages/vrender/src/constants.ts b/packages/vrender/src/constants.ts index 888462379..87a8bdabb 100644 --- a/packages/vrender/src/constants.ts +++ b/packages/vrender/src/constants.ts @@ -1,2 +1,2 @@ export const EnvContribution = Symbol.for('EnvContribution'); -export const VGlobal = Symbol.for('VGlobal'); +export const Global = Symbol.for('Global'); diff --git a/packages/vrender/src/core/contributions/layerHandler/canvas2d-contribution.ts b/packages/vrender/src/core/contributions/layerHandler/canvas2d-contribution.ts index 6b0a11380..ce565fe17 100644 --- a/packages/vrender/src/core/contributions/layerHandler/canvas2d-contribution.ts +++ b/packages/vrender/src/core/contributions/layerHandler/canvas2d-contribution.ts @@ -14,7 +14,7 @@ import type { IDrawContext } from '../../../interface'; import type { IBounds } from '@visactor/vutils'; -import { VGlobal } from '../../../constants'; +import { Global } from '../../../constants'; @injectable() export class CanvasLayerHandlerContribution implements ILayerHandlerContribution { @@ -25,7 +25,7 @@ export class CanvasLayerHandlerContribution implements ILayerHandlerContribution main: boolean; window: IWindow; - constructor(@inject(VGlobal) public readonly global: IGlobal) { + constructor(@inject(Global) public readonly global: IGlobal) { this.offscreen = false; } diff --git a/packages/vrender/src/core/contributions/layerHandler/offscreen2d-contribution.ts b/packages/vrender/src/core/contributions/layerHandler/offscreen2d-contribution.ts index e0f751ed5..f97cfd8b4 100644 --- a/packages/vrender/src/core/contributions/layerHandler/offscreen2d-contribution.ts +++ b/packages/vrender/src/core/contributions/layerHandler/offscreen2d-contribution.ts @@ -13,7 +13,7 @@ import type { ILayerHandlerDrawParams } from '../../../interface'; import type { IBoundsLike } from '@visactor/vutils'; -import { VGlobal } from '../../../constants'; +import { Global } from '../../../constants'; @injectable() export class OffscreenLayerHandlerContribution implements ILayerHandlerContribution { @@ -22,7 +22,7 @@ export class OffscreenLayerHandlerContribution implements ILayerHandlerContribut context: IContext2d; offscreen: boolean; - constructor(@inject(VGlobal) public readonly global: IGlobal) { + constructor(@inject(Global) public readonly global: IGlobal) { this.offscreen = true; } diff --git a/packages/vrender/src/core/contributions/window/browser-contribution.ts b/packages/vrender/src/core/contributions/window/browser-contribution.ts index b5e7757ba..76d9aabcb 100644 --- a/packages/vrender/src/core/contributions/window/browser-contribution.ts +++ b/packages/vrender/src/core/contributions/window/browser-contribution.ts @@ -12,7 +12,7 @@ import type { IWindowParams } from '../../../interface'; import type { IBoundsLike } from '@visactor/vutils'; -import { VGlobal } from '../../../constants'; +import { Global } from '../../../constants'; @injectable() export class BrowserWindowHandlerContribution @@ -31,7 +31,7 @@ export class BrowserWindowHandlerContribution return this.canvas.nativeCanvas.parentElement; } - constructor(@inject(VGlobal) private readonly global: IGlobal) { + constructor(@inject(Global) private readonly global: IGlobal) { super(); } diff --git a/packages/vrender/src/core/contributions/window/feishu-contribution.ts b/packages/vrender/src/core/contributions/window/feishu-contribution.ts index e55325a00..e81a2dfd7 100644 --- a/packages/vrender/src/core/contributions/window/feishu-contribution.ts +++ b/packages/vrender/src/core/contributions/window/feishu-contribution.ts @@ -12,7 +12,7 @@ import type { IWindowParams } from '../../../interface'; import type { IBoundsLike } from '@visactor/vutils'; -import { VGlobal } from '../../../constants'; +import { Global } from '../../../constants'; class MiniAppEventManager { addEventListener(type: string, func: EventListenerOrEventListenerObject) { @@ -57,7 +57,7 @@ export class FeishuWindowHandlerContribution return null; } - constructor(@inject(VGlobal) private readonly global: IGlobal) { + constructor(@inject(Global) private readonly global: IGlobal) { super(); } diff --git a/packages/vrender/src/core/contributions/window/lynx-contribution.ts b/packages/vrender/src/core/contributions/window/lynx-contribution.ts index 3251d7c22..67a224294 100644 --- a/packages/vrender/src/core/contributions/window/lynx-contribution.ts +++ b/packages/vrender/src/core/contributions/window/lynx-contribution.ts @@ -12,7 +12,7 @@ import type { IWindowHandlerContribution } from '../../../interface'; import type { IBoundsLike } from '@visactor/vutils'; -import { VGlobal } from '../../../constants'; +import { Global } from '../../../constants'; class MiniAppEventManager { addEventListener(type: string, func: EventListenerOrEventListenerObject) { @@ -54,7 +54,7 @@ export class LynxWindowHandlerContribution extends BaseWindowHandlerContribution return null; } - constructor(@inject(VGlobal) private readonly global: IGlobal) { + constructor(@inject(Global) private readonly global: IGlobal) { super(); } diff --git a/packages/vrender/src/core/contributions/window/native-contribution.ts b/packages/vrender/src/core/contributions/window/native-contribution.ts index 873e3bca5..b4f33d37d 100644 --- a/packages/vrender/src/core/contributions/window/native-contribution.ts +++ b/packages/vrender/src/core/contributions/window/native-contribution.ts @@ -1,6 +1,6 @@ // import { createCanvas, createImageData, loadImage } from 'canvas'; // import { inject, injectable } from 'inversify'; -// import { VGlobal, IWindow, EnvType, IGlobal, IWindowHandlerContribution, IWindowParams } from '../..'; +// import { Global, IWindow, EnvType, IGlobal, IWindowHandlerContribution, IWindowParams } from '../..'; // import { BaseWindowHandlerContribution } from './base-contribution'; // type NodePkg = { @@ -27,7 +27,7 @@ // return null; // } -// constructor(@inject(VGlobal) private readonly global: IGlobal) { +// constructor(@inject(Global) private readonly global: IGlobal) { // super(); // } diff --git a/packages/vrender/src/core/contributions/window/node-contribution.ts b/packages/vrender/src/core/contributions/window/node-contribution.ts index fd69d2770..c660ed29f 100644 --- a/packages/vrender/src/core/contributions/window/node-contribution.ts +++ b/packages/vrender/src/core/contributions/window/node-contribution.ts @@ -12,7 +12,7 @@ import type { IWindowHandlerContribution, IWindowParams } from '../../../interface'; -import { VGlobal } from '../../../constants'; +import { Global } from '../../../constants'; @injectable() export class NodeWindowHandlerContribution extends BaseWindowHandlerContribution implements IWindowHandlerContribution { @@ -24,7 +24,7 @@ export class NodeWindowHandlerContribution extends BaseWindowHandlerContribution return null; } - constructor(@inject(VGlobal) private readonly global: IGlobal) { + constructor(@inject(Global) private readonly global: IGlobal) { super(); } diff --git a/packages/vrender/src/core/contributions/window/taro-contribution.ts b/packages/vrender/src/core/contributions/window/taro-contribution.ts index 5abde4a21..9bad8f9b1 100644 --- a/packages/vrender/src/core/contributions/window/taro-contribution.ts +++ b/packages/vrender/src/core/contributions/window/taro-contribution.ts @@ -12,7 +12,7 @@ import type { IWindowHandlerContribution } from '../../../interface'; import type { IBoundsLike } from '@visactor/vutils'; -import { VGlobal } from '../../../constants'; +import { Global } from '../../../constants'; class MiniAppEventManager { addEventListener(type: string, func: EventListenerOrEventListenerObject) { @@ -54,7 +54,7 @@ export class TaroWindowHandlerContribution extends BaseWindowHandlerContribution return null; } - constructor(@inject(VGlobal) private readonly global: IGlobal) { + constructor(@inject(Global) private readonly global: IGlobal) { super(); } diff --git a/packages/vrender/src/core/contributions/window/wx-contribution.ts b/packages/vrender/src/core/contributions/window/wx-contribution.ts index 095b9d026..2db87154f 100644 --- a/packages/vrender/src/core/contributions/window/wx-contribution.ts +++ b/packages/vrender/src/core/contributions/window/wx-contribution.ts @@ -12,7 +12,7 @@ import type { IWindowParams } from '../../../interface'; import type { IBoundsLike } from '@visactor/vutils'; -import { VGlobal } from '../../../constants'; +import { Global } from '../../../constants'; class MiniAppEventManager { addEventListener(type: string, func: EventListenerOrEventListenerObject) { @@ -54,7 +54,7 @@ export class WxWindowHandlerContribution extends BaseWindowHandlerContribution i return null; } - constructor(@inject(VGlobal) private readonly global: IGlobal) { + constructor(@inject(Global) private readonly global: IGlobal) { super(); } diff --git a/packages/vrender/src/core/core-modules.ts b/packages/vrender/src/core/core-modules.ts index 94501693f..4fc9fa4ff 100644 --- a/packages/vrender/src/core/core-modules.ts +++ b/packages/vrender/src/core/core-modules.ts @@ -2,17 +2,17 @@ import { ContainerModule } from 'inversify'; import { DefaultGlobal } from './global'; import { DefaultGraphicUtil, DefaultTransformUtil } from './graphic-utils'; import { DefaultLayerService } from './layer-service'; -import { DefaultWindow, VWindow } from './window'; +import { DefaultWindow, Window } from './window'; import { GraphicUtil, LayerService, TransformUtil } from './constants'; -import { VGlobal } from '../constants'; +import { Global } from '../constants'; export default new ContainerModule(bind => { // global对象,全局单例模式 bind(DefaultGlobal).toSelf().inSingletonScope(); - bind(VGlobal).toService(DefaultGlobal); + bind(Global).toService(DefaultGlobal); bind(DefaultWindow).to(DefaultWindow); - bind(VWindow).toService(DefaultWindow); + bind(Window).toService(DefaultWindow); bind(DefaultGraphicUtil).toSelf().inSingletonScope(); bind(GraphicUtil).toService(DefaultGraphicUtil); bind(DefaultTransformUtil).toSelf().inSingletonScope(); @@ -24,7 +24,7 @@ export default new ContainerModule(bind => { // bind<(params: Partial) => IStage>(StageFactory).toFactory((context: interface.Context) => { // return (params: Partial) => { // const g = context.container.get(Global); - // const ws = context.container.get(VWindow); + // const ws = context.container.get(Window); // const rs = context.container.get(RenderService); // const layer = context.container.get(Layer); // return new DefaultStage(params, g, ws, rs, layer); diff --git a/packages/vrender/src/core/graphic-utils.ts b/packages/vrender/src/core/graphic-utils.ts index d05da9dbd..5bb6c06fe 100644 --- a/packages/vrender/src/core/graphic-utils.ts +++ b/packages/vrender/src/core/graphic-utils.ts @@ -9,7 +9,7 @@ import { DefaultTextStyle } from '../graphic/config'; import type { IMatrix, IPointLike, ITextMeasureOption } from '@visactor/vutils'; import { Matrix, TextMeasure } from '@visactor/vutils'; import type { IGraphicUtil, ITransformUtil, TransformType } from '../interface/core'; -import { VGlobal } from '../constants'; +import { Global } from '../constants'; @injectable() export class DefaultGraphicUtil implements IGraphicUtil { @@ -22,7 +22,7 @@ export class DefaultGraphicUtil implements IGraphicUtil { @inject(ContributionProvider) @named(TextMeasureContribution) protected readonly contributions: IContributionProvider, - @inject(VGlobal) public readonly global: IGlobal + @inject(Global) public readonly global: IGlobal ) { this.configured = false; this.global.hooks.onSetEnv.tap('graphic-util', (lastEnv, env, global) => { diff --git a/packages/vrender/src/core/layer-service.ts b/packages/vrender/src/core/layer-service.ts index 4a979f2bc..6a689a408 100644 --- a/packages/vrender/src/core/layer-service.ts +++ b/packages/vrender/src/core/layer-service.ts @@ -2,7 +2,7 @@ import { inject, injectable } from 'inversify'; import type { ILayer, IStage, IGlobal, ILayerParams } from '../interface'; import { Layer } from './layer'; import type { ILayerService } from '../interface/core'; -import { VGlobal } from '../constants'; +import { Global } from '../constants'; @injectable() export class DefaultLayerService implements ILayerService { @@ -10,7 +10,7 @@ export class DefaultLayerService implements ILayerService { declare staticLayerCountInEnv: number; declare dynamicLayerCountInEnv: number; declare inited: boolean; - constructor(@inject(VGlobal) public readonly global: IGlobal) { + constructor(@inject(Global) public readonly global: IGlobal) { this.layerMap = new Map(); } diff --git a/packages/vrender/src/core/stage.ts b/packages/vrender/src/core/stage.ts index 6a9afa22d..fa1e34246 100644 --- a/packages/vrender/src/core/stage.ts +++ b/packages/vrender/src/core/stage.ts @@ -24,7 +24,7 @@ import type { IContributionProvider, ILayerService } from '../interface'; -import { VWindow } from './window'; +import { Window } from './window'; import type { Layer } from './layer'; import { EventSystem } from '../event'; import { container } from '../container'; @@ -41,7 +41,7 @@ import { defaultTicker } from '../animate/default-ticker'; import { SyncHook } from '../tapable'; import { DirectionalLight } from './light'; import { OrthoCamera } from './camera'; -import { VGlobal } from '../constants'; +import { Global } from '../constants'; import { LayerService } from './constants'; const DefaultConfig = { @@ -187,8 +187,8 @@ export class Stage extends Group implements IStage { beforeRender: new SyncHook(['stage']), afterRender: new SyncHook(['stage']) }; - this.global = container.get(VGlobal); - this.window = container.get(VWindow); + this.global = container.get(Global); + this.window = container.get(Window); this.renderService = container.get(RenderService); this.pickerService = container.get(PickerService); this.pluginService = container.get(PluginService); @@ -740,7 +740,7 @@ export class Stage extends Group implements IStage { * @returns */ renderToNewWindow(fullImage: boolean = true): IWindow { - const window = container.get(VWindow); + const window = container.get(Window); if (fullImage) { window.create({ width: this.viewWidth, diff --git a/packages/vrender/src/core/window.ts b/packages/vrender/src/core/window.ts index a7c3107d2..15413861e 100644 --- a/packages/vrender/src/core/window.ts +++ b/packages/vrender/src/core/window.ts @@ -12,9 +12,9 @@ import type { } from '../interface'; import { container } from '../container'; import { SyncHook } from '../tapable'; -import { VGlobal } from '../constants'; +import { Global } from '../constants'; -export const VWindow = Symbol.for('VWindow'); +export const Window = Symbol.for('Window'); export const WindowHandlerContribution = Symbol.for('WindowHandlerContribution'); @@ -74,7 +74,7 @@ export class DefaultWindow implements IWindow { } constructor( - @inject(VGlobal) public readonly global: IGlobal // @inject(ContributionProvider) // @named(WindowHandlerContribution) // protected readonly contributions: ContributionProvider + @inject(Global) public readonly global: IGlobal // @inject(ContributionProvider) // @named(WindowHandlerContribution) // protected readonly contributions: ContributionProvider ) { this._uid = Generator.GenAutoIncrementId(); } diff --git a/packages/vrender/src/graphic/text.ts b/packages/vrender/src/graphic/text.ts index c0961eba7..25a8fee7b 100644 --- a/packages/vrender/src/graphic/text.ts +++ b/packages/vrender/src/graphic/text.ts @@ -8,7 +8,7 @@ import { getTheme } from './theme'; import { parsePadding } from '../common/utils'; import { TEXT_NUMBER_TYPE } from './constants'; import { TextDirection, verticalLayout } from './tools'; -import { vglobal } from '../modules'; +import { global } from '../modules'; const TEXT_UPDATE_TAG_KEY = [ 'text', @@ -207,7 +207,7 @@ export class Text extends Graphic implements IText { const dx = textDrawOffsetX(textAlign, width); let lh = lineHeight; - if (vglobal.isSafari()) { + if (global.isSafari()) { // 如果是safari,那么需要额外增加高度 lh += fontSize * 0.2; } diff --git a/packages/vrender/src/modules.ts b/packages/vrender/src/modules.ts index d00cd7148..b6031ecb0 100644 --- a/packages/vrender/src/modules.ts +++ b/packages/vrender/src/modules.ts @@ -18,7 +18,7 @@ import type { IGraphicUtil, ILayerService, ITransformUtil } from './interface/co import { GraphicService } from './graphic/constants'; import { GraphicUtil, TransformUtil } from './core/constants'; import { container } from './container'; -import { VGlobal } from './constants'; +import { Global } from './constants'; container.load(coreModule); container.load(graphicModule); @@ -32,8 +32,8 @@ loadPickContributions(container); loadCanvasContributions(container); // 全局变量 -export const vglobal = container.get(VGlobal); -application.global = vglobal; +export const global = container.get(Global); +application.global = global; export const graphicUtil = container.get(GraphicUtil); application.graphicUtil = graphicUtil; export const transformUtil = container.get(TransformUtil); diff --git a/packages/vrender/src/picker/canvas-picker-service.ts b/packages/vrender/src/picker/canvas-picker-service.ts index 91c3ff1c8..cbcdef712 100644 --- a/packages/vrender/src/picker/canvas-picker-service.ts +++ b/packages/vrender/src/picker/canvas-picker-service.ts @@ -33,7 +33,7 @@ import { import { DefaultPickService } from './picker-service'; import { DrawContribution } from '../render'; import { PickItemInterceptor } from './pick-interceptor'; -import { VGlobal } from '../constants'; +import { Global } from '../constants'; // 默认的pick-service,提供基本的最优选中策略,尽量不需要用户自己实现contribution // 用户可以写plugin @@ -63,7 +63,7 @@ export class DefaultCanvasPickerService extends DefaultPickService implements IP @inject(DrawContribution) public readonly drawContribution: IDrawContribution, - @inject(VGlobal) public readonly global: IGlobal, + @inject(Global) public readonly global: IGlobal, // 拦截器 @inject(ContributionProvider) @named(PickItemInterceptor) diff --git a/packages/vrender/src/picker/global-picker-service.ts b/packages/vrender/src/picker/global-picker-service.ts index 8c7b21802..6ac03754c 100644 --- a/packages/vrender/src/picker/global-picker-service.ts +++ b/packages/vrender/src/picker/global-picker-service.ts @@ -11,7 +11,7 @@ import type { IPickParams, PickResult } from '../interface'; -import { VGlobal } from '../constants'; +import { Global } from '../constants'; export const BoundsPicker = Symbol.for('BoundsPicker'); @@ -29,7 +29,7 @@ export class DefaultGlobalPickerService implements IPickerService { // @inject(ContributionProvider) // @named(PickerContribution) // protected readonly contributions: ContributionProvider, - @inject(VGlobal) public readonly global: IGlobal + @inject(Global) public readonly global: IGlobal ) { this.global.hooks.onSetEnv.tap('global-picker-service', (lastEnv, env, global) => { this.configure(global, env); diff --git a/packages/vrender/src/picker/math-picker-service.ts b/packages/vrender/src/picker/math-picker-service.ts index a7b07199a..8d4bc7ebc 100644 --- a/packages/vrender/src/picker/math-picker-service.ts +++ b/packages/vrender/src/picker/math-picker-service.ts @@ -17,7 +17,7 @@ import type { import { DefaultPickService } from './picker-service'; import { EmptyContext2d } from '../canvas'; import { MathPickerContribution } from './contributions/constants'; -import { VGlobal } from '../constants'; +import { Global } from '../constants'; import { PickItemInterceptor } from './pick-interceptor'; // 默认的pick-service,提供基本的最优选中策略,尽量不需要用户自己实现contribution @@ -34,7 +34,7 @@ export class DefaultMathPickerService extends DefaultPickService implements IPic @inject(ContributionProvider) @named(MathPickerContribution) protected readonly contributions: IContributionProvider, - @inject(VGlobal) public readonly global: IGlobal, + @inject(Global) public readonly global: IGlobal, // 拦截器 @inject(ContributionProvider) @named(PickItemInterceptor) diff --git a/packages/vrender/src/picker/picker-service.ts b/packages/vrender/src/picker/picker-service.ts index fdbd0470e..bcaa851ab 100644 --- a/packages/vrender/src/picker/picker-service.ts +++ b/packages/vrender/src/picker/picker-service.ts @@ -20,7 +20,7 @@ import type { import { DefaultAttribute, getTheme, mat3Tomat4, multiplyMat4Mat4 } from '../graphic'; import { mat4Allocate, matrixAllocate } from '../allocator/matrix-allocate'; import { PickItemInterceptor } from './pick-interceptor'; -import { VGlobal } from '../constants'; +import { Global } from '../constants'; export const GraphicPicker = Symbol.for('GraphicPicker'); @@ -34,7 +34,7 @@ export abstract class DefaultPickService implements IPickerService { declare InterceptorContributions: IPickItemInterceptorContribution[]; constructor( - @inject(VGlobal) public readonly global: IGlobal, + @inject(Global) public readonly global: IGlobal, // 拦截器 @inject(ContributionProvider) @named(PickItemInterceptor) diff --git a/packages/vrender/src/render/contributions/render/incremental-draw-contribution.ts b/packages/vrender/src/render/contributions/render/incremental-draw-contribution.ts index f01391ddc..294f83e68 100644 --- a/packages/vrender/src/render/contributions/render/incremental-draw-contribution.ts +++ b/packages/vrender/src/render/contributions/render/incremental-draw-contribution.ts @@ -23,7 +23,7 @@ import { DrawItemInterceptor } from './draw-interceptor'; import { ContributionProvider } from '../../../common/contribution-provider'; import { foreachAsync } from '../../../common/sort'; import type { ILayerService } from '../../../interface/core'; -import { VGlobal } from '../../../constants'; +import { Global } from '../../../constants'; enum STATUS { NORMAL = 0, @@ -47,7 +47,7 @@ export class DefaultIncrementalDrawContribution extends DefaultDrawContribution protected lastRenderService: IRenderService; protected lastDrawContext: IDrawContext; protected count: number; - @inject(VGlobal) global: IGlobal; + @inject(Global) global: IGlobal; constructor( // @inject(ContributionProvider) From 67d079791c6ed50ea71fa760539b33ffe0286578 Mon Sep 17 00:00:00 2001 From: skie1997 Date: Thu, 10 Aug 2023 21:26:38 +0800 Subject: [PATCH 05/35] fix(marker): clipRange update when attribute has changed --- .../__tests__/browser/examples/mark-line.ts | 4 ++-- packages/vrender-components/src/marker/base.ts | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/vrender-components/__tests__/browser/examples/mark-line.ts b/packages/vrender-components/__tests__/browser/examples/mark-line.ts index ebe9dba5e..85bfbae2f 100644 --- a/packages/vrender-components/__tests__/browser/examples/mark-line.ts +++ b/packages/vrender-components/__tests__/browser/examples/mark-line.ts @@ -32,8 +32,8 @@ export function run() { refAngle: degreeToRadian(guiObject.labelRefAngle) }, clipRange: { - x: 10, - y: 100, + x: 20, + y: 20, width: 300, height: 100 } diff --git a/packages/vrender-components/src/marker/base.ts b/packages/vrender-components/src/marker/base.ts index 640d13638..686f65c7e 100644 --- a/packages/vrender-components/src/marker/base.ts +++ b/packages/vrender-components/src/marker/base.ts @@ -34,6 +34,10 @@ export abstract class Marker extends AbstractComponent Date: Thu, 10 Aug 2023 21:55:19 +0800 Subject: [PATCH 06/35] fix(marker): add offset to marker container --- .../__tests__/browser/examples/mark-area.ts | 6 +++ .../__tests__/browser/examples/mark-line.ts | 8 ++-- .../__tests__/browser/examples/mark-point.ts | 6 +++ .../__tests__/unit/marker/area.test.ts | 7 +-- .../__tests__/unit/marker/line.test.ts | 6 +-- .../__tests__/unit/marker/point.test.ts | 2 +- .../vrender-components/src/marker/base.ts | 45 +++++++++++++------ 7 files changed, 56 insertions(+), 24 deletions(-) diff --git a/packages/vrender-components/__tests__/browser/examples/mark-area.ts b/packages/vrender-components/__tests__/browser/examples/mark-area.ts index ea9b57e7a..07dcab9d3 100644 --- a/packages/vrender-components/__tests__/browser/examples/mark-area.ts +++ b/packages/vrender-components/__tests__/browser/examples/mark-area.ts @@ -22,6 +22,12 @@ export function run() { areaStyle: { cornerRadius: guiObject.cornerRadius } + }, + clipRange: { + x: 50, + y: 50, + width: 200, + height: 200 } }; diff --git a/packages/vrender-components/__tests__/browser/examples/mark-line.ts b/packages/vrender-components/__tests__/browser/examples/mark-line.ts index 85bfbae2f..09d0b5687 100644 --- a/packages/vrender-components/__tests__/browser/examples/mark-line.ts +++ b/packages/vrender-components/__tests__/browser/examples/mark-line.ts @@ -32,10 +32,10 @@ export function run() { refAngle: degreeToRadian(guiObject.labelRefAngle) }, clipRange: { - x: 20, - y: 20, - width: 300, - height: 100 + x: 50, + y: 50, + width: 200, + height: 200 } }; const markLine = new MarkLine({ diff --git a/packages/vrender-components/__tests__/browser/examples/mark-point.ts b/packages/vrender-components/__tests__/browser/examples/mark-point.ts index 0922e75ef..6f11bf529 100644 --- a/packages/vrender-components/__tests__/browser/examples/mark-point.ts +++ b/packages/vrender-components/__tests__/browser/examples/mark-point.ts @@ -89,6 +89,12 @@ export function run() { imageStyle: { image: `${window.location.origin}/__tests__/browser/sources/shape_logo.png` } + }, + clipRange: { + x: 50, + y: 50, + width: 200, + height: 200 } }; diff --git a/packages/vrender-components/__tests__/unit/marker/area.test.ts b/packages/vrender-components/__tests__/unit/marker/area.test.ts index 68a39538e..f1ce47b47 100644 --- a/packages/vrender-components/__tests__/unit/marker/area.test.ts +++ b/packages/vrender-components/__tests__/unit/marker/area.test.ts @@ -1,5 +1,6 @@ -import { IGraphic, Stage, Polygon, Group } from '@visactor/vrender'; -import { Tag, MarkArea } from '../../../src'; +import type { IGraphic, Stage, Polygon, Group } from '@visactor/vrender'; +import type { Tag } from '../../../src'; +import { MarkArea } from '../../../src'; import { createCanvas } from '../../util/dom'; import { createStage } from '../../util/vrender'; @@ -42,7 +43,7 @@ describe('Marker', () => { stage.defaultLayer.add(markArea as unknown as IGraphic); stage.render(); - const markAreaContainer = markArea.children[0] as unknown as Group; + const markAreaContainer = (markArea.children[0] as unknown as Group).children[0] as unknown as Group; expect(markAreaContainer.childrenCount).toBe(2); // ploygon图元构造的area expect((markAreaContainer.children[0] as Polygon).attribute.points).toEqual([ diff --git a/packages/vrender-components/__tests__/unit/marker/line.test.ts b/packages/vrender-components/__tests__/unit/marker/line.test.ts index 9c85baf59..9758156fc 100644 --- a/packages/vrender-components/__tests__/unit/marker/line.test.ts +++ b/packages/vrender-components/__tests__/unit/marker/line.test.ts @@ -1,6 +1,6 @@ import { degreeToRadian } from '@visactor/vutils'; -import { Group, IGraphic, Stage } from '@visactor/vrender'; -import { Tag, Segment } from '../../../src'; +import type { Group, IGraphic, Stage } from '@visactor/vrender'; +import type { Tag, Segment } from '../../../src'; import { createCanvas } from '../../util/dom'; import { createStage } from '../../util/vrender'; import { MarkLine } from '../../../src/marker/line'; @@ -39,7 +39,7 @@ describe('Marker', () => { }); stage.defaultLayer.add(markLine as unknown as IGraphic); stage.render(); - const markLineContainer = markLine.children[0] as unknown as Group; + const markLineContainer = (markLine.children[0] as unknown as Group).children[0] as unknown as Group; expect(markLineContainer.childrenCount).toBe(2); // segement构造的line diff --git a/packages/vrender-components/__tests__/unit/marker/point.test.ts b/packages/vrender-components/__tests__/unit/marker/point.test.ts index 6aefa0a90..1b6a81e28 100644 --- a/packages/vrender-components/__tests__/unit/marker/point.test.ts +++ b/packages/vrender-components/__tests__/unit/marker/point.test.ts @@ -39,7 +39,7 @@ describe('Marker', () => { stage.defaultLayer.add(markPoint as unknown as IGraphic); stage.render(); - const markPointContainer = markPoint.children[0] as unknown as Group; + const markPointContainer = (markPoint.children[0] as unknown as Group).children[0] as unknown as Group; expect(markPointContainer.children[0].childrenCount).toBe(2); // segement构造的line expect((markPointContainer.children[0] as unknown as Segment).attribute.points).toEqual([ diff --git a/packages/vrender-components/src/marker/base.ts b/packages/vrender-components/src/marker/base.ts index 686f65c7e..fe30a9bdd 100644 --- a/packages/vrender-components/src/marker/base.ts +++ b/packages/vrender-components/src/marker/base.ts @@ -6,6 +6,7 @@ import type { Tag } from '../tag'; import type { MarkerAttrs } from './type'; export abstract class Marker extends AbstractComponent> { + private _containerClip!: IGroup; private _container!: IGroup; protected _label!: Tag; @@ -14,6 +15,33 @@ export abstract class Marker extends AbstractComponent extends AbstractComponent Date: Thu, 10 Aug 2023 22:59:08 +0800 Subject: [PATCH 07/35] fix(marker): add offset to marker container --- packages/vrender-components/src/marker/base.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/vrender-components/src/marker/base.ts b/packages/vrender-components/src/marker/base.ts index fe30a9bdd..befc882b4 100644 --- a/packages/vrender-components/src/marker/base.ts +++ b/packages/vrender-components/src/marker/base.ts @@ -22,8 +22,8 @@ export abstract class Marker extends AbstractComponent extends AbstractComponent Date: Thu, 10 Aug 2023 23:35:30 +0800 Subject: [PATCH 08/35] Revert "chore: rename global window name to test marker in VChart" This reverts commit ceb1e8c94dd59e8b26846b8b1d496a63b82fa4ee. --- .../src/contribution/env-canvas/window-contribution.ts | 4 ++-- docs/demos/src/core/stage.ts | 2 +- packages/vrender/src/constants.ts | 2 +- .../layerHandler/canvas2d-contribution.ts | 4 ++-- .../layerHandler/offscreen2d-contribution.ts | 4 ++-- .../core/contributions/window/browser-contribution.ts | 4 ++-- .../core/contributions/window/feishu-contribution.ts | 4 ++-- .../src/core/contributions/window/lynx-contribution.ts | 4 ++-- .../core/contributions/window/native-contribution.ts | 4 ++-- .../src/core/contributions/window/node-contribution.ts | 4 ++-- .../src/core/contributions/window/taro-contribution.ts | 4 ++-- .../src/core/contributions/window/wx-contribution.ts | 4 ++-- packages/vrender/src/core/core-modules.ts | 10 +++++----- packages/vrender/src/core/graphic-utils.ts | 4 ++-- packages/vrender/src/core/layer-service.ts | 4 ++-- packages/vrender/src/core/stage.ts | 10 +++++----- packages/vrender/src/core/window.ts | 6 +++--- packages/vrender/src/graphic/text.ts | 4 ++-- packages/vrender/src/modules.ts | 6 +++--- packages/vrender/src/picker/canvas-picker-service.ts | 4 ++-- packages/vrender/src/picker/global-picker-service.ts | 4 ++-- packages/vrender/src/picker/math-picker-service.ts | 4 ++-- packages/vrender/src/picker/picker-service.ts | 4 ++-- .../render/incremental-draw-contribution.ts | 4 ++-- 24 files changed, 54 insertions(+), 54 deletions(-) diff --git a/docs/demos/src/contribution/env-canvas/window-contribution.ts b/docs/demos/src/contribution/env-canvas/window-contribution.ts index c41f4c499..995d9130d 100644 --- a/docs/demos/src/contribution/env-canvas/window-contribution.ts +++ b/docs/demos/src/contribution/env-canvas/window-contribution.ts @@ -8,7 +8,7 @@ import type { ICanvas, IDomRectLike } from '@visactor/vrender'; -import { Generator, Global, BaseWindowHandlerContribution } from '@visactor/vrender'; +import { Generator, VGlobal, BaseWindowHandlerContribution } from '@visactor/vrender'; import { NodeCanvas } from './canvas'; import type { IBoundsLike } from '@visactor/vutils'; @@ -21,7 +21,7 @@ export class NodeWindowHandlerContribution extends BaseWindowHandlerContribution return null; } - constructor(@inject(Global) private readonly global: IGlobal) { + constructor(@inject(VGlobal) private readonly global: IGlobal) { super(); } diff --git a/docs/demos/src/core/stage.ts b/docs/demos/src/core/stage.ts index 0f47ca968..c084dc25c 100644 --- a/docs/demos/src/core/stage.ts +++ b/docs/demos/src/core/stage.ts @@ -1,7 +1,7 @@ import { createStage, container } from '@visactor/vrender'; export function createAStage() { - console.log(container.get(Symbol.for('Global'))); + console.log(container.get(Symbol.for('VGlobal'))); const stage = createStage({}); console.log(stage); // const stage = new Stage({ diff --git a/packages/vrender/src/constants.ts b/packages/vrender/src/constants.ts index 87a8bdabb..888462379 100644 --- a/packages/vrender/src/constants.ts +++ b/packages/vrender/src/constants.ts @@ -1,2 +1,2 @@ export const EnvContribution = Symbol.for('EnvContribution'); -export const Global = Symbol.for('Global'); +export const VGlobal = Symbol.for('VGlobal'); diff --git a/packages/vrender/src/core/contributions/layerHandler/canvas2d-contribution.ts b/packages/vrender/src/core/contributions/layerHandler/canvas2d-contribution.ts index ce565fe17..6b0a11380 100644 --- a/packages/vrender/src/core/contributions/layerHandler/canvas2d-contribution.ts +++ b/packages/vrender/src/core/contributions/layerHandler/canvas2d-contribution.ts @@ -14,7 +14,7 @@ import type { IDrawContext } from '../../../interface'; import type { IBounds } from '@visactor/vutils'; -import { Global } from '../../../constants'; +import { VGlobal } from '../../../constants'; @injectable() export class CanvasLayerHandlerContribution implements ILayerHandlerContribution { @@ -25,7 +25,7 @@ export class CanvasLayerHandlerContribution implements ILayerHandlerContribution main: boolean; window: IWindow; - constructor(@inject(Global) public readonly global: IGlobal) { + constructor(@inject(VGlobal) public readonly global: IGlobal) { this.offscreen = false; } diff --git a/packages/vrender/src/core/contributions/layerHandler/offscreen2d-contribution.ts b/packages/vrender/src/core/contributions/layerHandler/offscreen2d-contribution.ts index f97cfd8b4..e0f751ed5 100644 --- a/packages/vrender/src/core/contributions/layerHandler/offscreen2d-contribution.ts +++ b/packages/vrender/src/core/contributions/layerHandler/offscreen2d-contribution.ts @@ -13,7 +13,7 @@ import type { ILayerHandlerDrawParams } from '../../../interface'; import type { IBoundsLike } from '@visactor/vutils'; -import { Global } from '../../../constants'; +import { VGlobal } from '../../../constants'; @injectable() export class OffscreenLayerHandlerContribution implements ILayerHandlerContribution { @@ -22,7 +22,7 @@ export class OffscreenLayerHandlerContribution implements ILayerHandlerContribut context: IContext2d; offscreen: boolean; - constructor(@inject(Global) public readonly global: IGlobal) { + constructor(@inject(VGlobal) public readonly global: IGlobal) { this.offscreen = true; } diff --git a/packages/vrender/src/core/contributions/window/browser-contribution.ts b/packages/vrender/src/core/contributions/window/browser-contribution.ts index 76d9aabcb..b5e7757ba 100644 --- a/packages/vrender/src/core/contributions/window/browser-contribution.ts +++ b/packages/vrender/src/core/contributions/window/browser-contribution.ts @@ -12,7 +12,7 @@ import type { IWindowParams } from '../../../interface'; import type { IBoundsLike } from '@visactor/vutils'; -import { Global } from '../../../constants'; +import { VGlobal } from '../../../constants'; @injectable() export class BrowserWindowHandlerContribution @@ -31,7 +31,7 @@ export class BrowserWindowHandlerContribution return this.canvas.nativeCanvas.parentElement; } - constructor(@inject(Global) private readonly global: IGlobal) { + constructor(@inject(VGlobal) private readonly global: IGlobal) { super(); } diff --git a/packages/vrender/src/core/contributions/window/feishu-contribution.ts b/packages/vrender/src/core/contributions/window/feishu-contribution.ts index e81a2dfd7..e55325a00 100644 --- a/packages/vrender/src/core/contributions/window/feishu-contribution.ts +++ b/packages/vrender/src/core/contributions/window/feishu-contribution.ts @@ -12,7 +12,7 @@ import type { IWindowParams } from '../../../interface'; import type { IBoundsLike } from '@visactor/vutils'; -import { Global } from '../../../constants'; +import { VGlobal } from '../../../constants'; class MiniAppEventManager { addEventListener(type: string, func: EventListenerOrEventListenerObject) { @@ -57,7 +57,7 @@ export class FeishuWindowHandlerContribution return null; } - constructor(@inject(Global) private readonly global: IGlobal) { + constructor(@inject(VGlobal) private readonly global: IGlobal) { super(); } diff --git a/packages/vrender/src/core/contributions/window/lynx-contribution.ts b/packages/vrender/src/core/contributions/window/lynx-contribution.ts index 67a224294..3251d7c22 100644 --- a/packages/vrender/src/core/contributions/window/lynx-contribution.ts +++ b/packages/vrender/src/core/contributions/window/lynx-contribution.ts @@ -12,7 +12,7 @@ import type { IWindowHandlerContribution } from '../../../interface'; import type { IBoundsLike } from '@visactor/vutils'; -import { Global } from '../../../constants'; +import { VGlobal } from '../../../constants'; class MiniAppEventManager { addEventListener(type: string, func: EventListenerOrEventListenerObject) { @@ -54,7 +54,7 @@ export class LynxWindowHandlerContribution extends BaseWindowHandlerContribution return null; } - constructor(@inject(Global) private readonly global: IGlobal) { + constructor(@inject(VGlobal) private readonly global: IGlobal) { super(); } diff --git a/packages/vrender/src/core/contributions/window/native-contribution.ts b/packages/vrender/src/core/contributions/window/native-contribution.ts index b4f33d37d..873e3bca5 100644 --- a/packages/vrender/src/core/contributions/window/native-contribution.ts +++ b/packages/vrender/src/core/contributions/window/native-contribution.ts @@ -1,6 +1,6 @@ // import { createCanvas, createImageData, loadImage } from 'canvas'; // import { inject, injectable } from 'inversify'; -// import { Global, IWindow, EnvType, IGlobal, IWindowHandlerContribution, IWindowParams } from '../..'; +// import { VGlobal, IWindow, EnvType, IGlobal, IWindowHandlerContribution, IWindowParams } from '../..'; // import { BaseWindowHandlerContribution } from './base-contribution'; // type NodePkg = { @@ -27,7 +27,7 @@ // return null; // } -// constructor(@inject(Global) private readonly global: IGlobal) { +// constructor(@inject(VGlobal) private readonly global: IGlobal) { // super(); // } diff --git a/packages/vrender/src/core/contributions/window/node-contribution.ts b/packages/vrender/src/core/contributions/window/node-contribution.ts index c660ed29f..fd69d2770 100644 --- a/packages/vrender/src/core/contributions/window/node-contribution.ts +++ b/packages/vrender/src/core/contributions/window/node-contribution.ts @@ -12,7 +12,7 @@ import type { IWindowHandlerContribution, IWindowParams } from '../../../interface'; -import { Global } from '../../../constants'; +import { VGlobal } from '../../../constants'; @injectable() export class NodeWindowHandlerContribution extends BaseWindowHandlerContribution implements IWindowHandlerContribution { @@ -24,7 +24,7 @@ export class NodeWindowHandlerContribution extends BaseWindowHandlerContribution return null; } - constructor(@inject(Global) private readonly global: IGlobal) { + constructor(@inject(VGlobal) private readonly global: IGlobal) { super(); } diff --git a/packages/vrender/src/core/contributions/window/taro-contribution.ts b/packages/vrender/src/core/contributions/window/taro-contribution.ts index 9bad8f9b1..5abde4a21 100644 --- a/packages/vrender/src/core/contributions/window/taro-contribution.ts +++ b/packages/vrender/src/core/contributions/window/taro-contribution.ts @@ -12,7 +12,7 @@ import type { IWindowHandlerContribution } from '../../../interface'; import type { IBoundsLike } from '@visactor/vutils'; -import { Global } from '../../../constants'; +import { VGlobal } from '../../../constants'; class MiniAppEventManager { addEventListener(type: string, func: EventListenerOrEventListenerObject) { @@ -54,7 +54,7 @@ export class TaroWindowHandlerContribution extends BaseWindowHandlerContribution return null; } - constructor(@inject(Global) private readonly global: IGlobal) { + constructor(@inject(VGlobal) private readonly global: IGlobal) { super(); } diff --git a/packages/vrender/src/core/contributions/window/wx-contribution.ts b/packages/vrender/src/core/contributions/window/wx-contribution.ts index 2db87154f..095b9d026 100644 --- a/packages/vrender/src/core/contributions/window/wx-contribution.ts +++ b/packages/vrender/src/core/contributions/window/wx-contribution.ts @@ -12,7 +12,7 @@ import type { IWindowParams } from '../../../interface'; import type { IBoundsLike } from '@visactor/vutils'; -import { Global } from '../../../constants'; +import { VGlobal } from '../../../constants'; class MiniAppEventManager { addEventListener(type: string, func: EventListenerOrEventListenerObject) { @@ -54,7 +54,7 @@ export class WxWindowHandlerContribution extends BaseWindowHandlerContribution i return null; } - constructor(@inject(Global) private readonly global: IGlobal) { + constructor(@inject(VGlobal) private readonly global: IGlobal) { super(); } diff --git a/packages/vrender/src/core/core-modules.ts b/packages/vrender/src/core/core-modules.ts index 4fc9fa4ff..94501693f 100644 --- a/packages/vrender/src/core/core-modules.ts +++ b/packages/vrender/src/core/core-modules.ts @@ -2,17 +2,17 @@ import { ContainerModule } from 'inversify'; import { DefaultGlobal } from './global'; import { DefaultGraphicUtil, DefaultTransformUtil } from './graphic-utils'; import { DefaultLayerService } from './layer-service'; -import { DefaultWindow, Window } from './window'; +import { DefaultWindow, VWindow } from './window'; import { GraphicUtil, LayerService, TransformUtil } from './constants'; -import { Global } from '../constants'; +import { VGlobal } from '../constants'; export default new ContainerModule(bind => { // global对象,全局单例模式 bind(DefaultGlobal).toSelf().inSingletonScope(); - bind(Global).toService(DefaultGlobal); + bind(VGlobal).toService(DefaultGlobal); bind(DefaultWindow).to(DefaultWindow); - bind(Window).toService(DefaultWindow); + bind(VWindow).toService(DefaultWindow); bind(DefaultGraphicUtil).toSelf().inSingletonScope(); bind(GraphicUtil).toService(DefaultGraphicUtil); bind(DefaultTransformUtil).toSelf().inSingletonScope(); @@ -24,7 +24,7 @@ export default new ContainerModule(bind => { // bind<(params: Partial) => IStage>(StageFactory).toFactory((context: interface.Context) => { // return (params: Partial) => { // const g = context.container.get(Global); - // const ws = context.container.get(Window); + // const ws = context.container.get(VWindow); // const rs = context.container.get(RenderService); // const layer = context.container.get(Layer); // return new DefaultStage(params, g, ws, rs, layer); diff --git a/packages/vrender/src/core/graphic-utils.ts b/packages/vrender/src/core/graphic-utils.ts index 5bb6c06fe..d05da9dbd 100644 --- a/packages/vrender/src/core/graphic-utils.ts +++ b/packages/vrender/src/core/graphic-utils.ts @@ -9,7 +9,7 @@ import { DefaultTextStyle } from '../graphic/config'; import type { IMatrix, IPointLike, ITextMeasureOption } from '@visactor/vutils'; import { Matrix, TextMeasure } from '@visactor/vutils'; import type { IGraphicUtil, ITransformUtil, TransformType } from '../interface/core'; -import { Global } from '../constants'; +import { VGlobal } from '../constants'; @injectable() export class DefaultGraphicUtil implements IGraphicUtil { @@ -22,7 +22,7 @@ export class DefaultGraphicUtil implements IGraphicUtil { @inject(ContributionProvider) @named(TextMeasureContribution) protected readonly contributions: IContributionProvider, - @inject(Global) public readonly global: IGlobal + @inject(VGlobal) public readonly global: IGlobal ) { this.configured = false; this.global.hooks.onSetEnv.tap('graphic-util', (lastEnv, env, global) => { diff --git a/packages/vrender/src/core/layer-service.ts b/packages/vrender/src/core/layer-service.ts index 6a689a408..4a979f2bc 100644 --- a/packages/vrender/src/core/layer-service.ts +++ b/packages/vrender/src/core/layer-service.ts @@ -2,7 +2,7 @@ import { inject, injectable } from 'inversify'; import type { ILayer, IStage, IGlobal, ILayerParams } from '../interface'; import { Layer } from './layer'; import type { ILayerService } from '../interface/core'; -import { Global } from '../constants'; +import { VGlobal } from '../constants'; @injectable() export class DefaultLayerService implements ILayerService { @@ -10,7 +10,7 @@ export class DefaultLayerService implements ILayerService { declare staticLayerCountInEnv: number; declare dynamicLayerCountInEnv: number; declare inited: boolean; - constructor(@inject(Global) public readonly global: IGlobal) { + constructor(@inject(VGlobal) public readonly global: IGlobal) { this.layerMap = new Map(); } diff --git a/packages/vrender/src/core/stage.ts b/packages/vrender/src/core/stage.ts index fa1e34246..6a9afa22d 100644 --- a/packages/vrender/src/core/stage.ts +++ b/packages/vrender/src/core/stage.ts @@ -24,7 +24,7 @@ import type { IContributionProvider, ILayerService } from '../interface'; -import { Window } from './window'; +import { VWindow } from './window'; import type { Layer } from './layer'; import { EventSystem } from '../event'; import { container } from '../container'; @@ -41,7 +41,7 @@ import { defaultTicker } from '../animate/default-ticker'; import { SyncHook } from '../tapable'; import { DirectionalLight } from './light'; import { OrthoCamera } from './camera'; -import { Global } from '../constants'; +import { VGlobal } from '../constants'; import { LayerService } from './constants'; const DefaultConfig = { @@ -187,8 +187,8 @@ export class Stage extends Group implements IStage { beforeRender: new SyncHook(['stage']), afterRender: new SyncHook(['stage']) }; - this.global = container.get(Global); - this.window = container.get(Window); + this.global = container.get(VGlobal); + this.window = container.get(VWindow); this.renderService = container.get(RenderService); this.pickerService = container.get(PickerService); this.pluginService = container.get(PluginService); @@ -740,7 +740,7 @@ export class Stage extends Group implements IStage { * @returns */ renderToNewWindow(fullImage: boolean = true): IWindow { - const window = container.get(Window); + const window = container.get(VWindow); if (fullImage) { window.create({ width: this.viewWidth, diff --git a/packages/vrender/src/core/window.ts b/packages/vrender/src/core/window.ts index 15413861e..a7c3107d2 100644 --- a/packages/vrender/src/core/window.ts +++ b/packages/vrender/src/core/window.ts @@ -12,9 +12,9 @@ import type { } from '../interface'; import { container } from '../container'; import { SyncHook } from '../tapable'; -import { Global } from '../constants'; +import { VGlobal } from '../constants'; -export const Window = Symbol.for('Window'); +export const VWindow = Symbol.for('VWindow'); export const WindowHandlerContribution = Symbol.for('WindowHandlerContribution'); @@ -74,7 +74,7 @@ export class DefaultWindow implements IWindow { } constructor( - @inject(Global) public readonly global: IGlobal // @inject(ContributionProvider) // @named(WindowHandlerContribution) // protected readonly contributions: ContributionProvider + @inject(VGlobal) public readonly global: IGlobal // @inject(ContributionProvider) // @named(WindowHandlerContribution) // protected readonly contributions: ContributionProvider ) { this._uid = Generator.GenAutoIncrementId(); } diff --git a/packages/vrender/src/graphic/text.ts b/packages/vrender/src/graphic/text.ts index 25a8fee7b..c0961eba7 100644 --- a/packages/vrender/src/graphic/text.ts +++ b/packages/vrender/src/graphic/text.ts @@ -8,7 +8,7 @@ import { getTheme } from './theme'; import { parsePadding } from '../common/utils'; import { TEXT_NUMBER_TYPE } from './constants'; import { TextDirection, verticalLayout } from './tools'; -import { global } from '../modules'; +import { vglobal } from '../modules'; const TEXT_UPDATE_TAG_KEY = [ 'text', @@ -207,7 +207,7 @@ export class Text extends Graphic implements IText { const dx = textDrawOffsetX(textAlign, width); let lh = lineHeight; - if (global.isSafari()) { + if (vglobal.isSafari()) { // 如果是safari,那么需要额外增加高度 lh += fontSize * 0.2; } diff --git a/packages/vrender/src/modules.ts b/packages/vrender/src/modules.ts index b6031ecb0..d00cd7148 100644 --- a/packages/vrender/src/modules.ts +++ b/packages/vrender/src/modules.ts @@ -18,7 +18,7 @@ import type { IGraphicUtil, ILayerService, ITransformUtil } from './interface/co import { GraphicService } from './graphic/constants'; import { GraphicUtil, TransformUtil } from './core/constants'; import { container } from './container'; -import { Global } from './constants'; +import { VGlobal } from './constants'; container.load(coreModule); container.load(graphicModule); @@ -32,8 +32,8 @@ loadPickContributions(container); loadCanvasContributions(container); // 全局变量 -export const global = container.get(Global); -application.global = global; +export const vglobal = container.get(VGlobal); +application.global = vglobal; export const graphicUtil = container.get(GraphicUtil); application.graphicUtil = graphicUtil; export const transformUtil = container.get(TransformUtil); diff --git a/packages/vrender/src/picker/canvas-picker-service.ts b/packages/vrender/src/picker/canvas-picker-service.ts index cbcdef712..91c3ff1c8 100644 --- a/packages/vrender/src/picker/canvas-picker-service.ts +++ b/packages/vrender/src/picker/canvas-picker-service.ts @@ -33,7 +33,7 @@ import { import { DefaultPickService } from './picker-service'; import { DrawContribution } from '../render'; import { PickItemInterceptor } from './pick-interceptor'; -import { Global } from '../constants'; +import { VGlobal } from '../constants'; // 默认的pick-service,提供基本的最优选中策略,尽量不需要用户自己实现contribution // 用户可以写plugin @@ -63,7 +63,7 @@ export class DefaultCanvasPickerService extends DefaultPickService implements IP @inject(DrawContribution) public readonly drawContribution: IDrawContribution, - @inject(Global) public readonly global: IGlobal, + @inject(VGlobal) public readonly global: IGlobal, // 拦截器 @inject(ContributionProvider) @named(PickItemInterceptor) diff --git a/packages/vrender/src/picker/global-picker-service.ts b/packages/vrender/src/picker/global-picker-service.ts index 6ac03754c..8c7b21802 100644 --- a/packages/vrender/src/picker/global-picker-service.ts +++ b/packages/vrender/src/picker/global-picker-service.ts @@ -11,7 +11,7 @@ import type { IPickParams, PickResult } from '../interface'; -import { Global } from '../constants'; +import { VGlobal } from '../constants'; export const BoundsPicker = Symbol.for('BoundsPicker'); @@ -29,7 +29,7 @@ export class DefaultGlobalPickerService implements IPickerService { // @inject(ContributionProvider) // @named(PickerContribution) // protected readonly contributions: ContributionProvider, - @inject(Global) public readonly global: IGlobal + @inject(VGlobal) public readonly global: IGlobal ) { this.global.hooks.onSetEnv.tap('global-picker-service', (lastEnv, env, global) => { this.configure(global, env); diff --git a/packages/vrender/src/picker/math-picker-service.ts b/packages/vrender/src/picker/math-picker-service.ts index 8d4bc7ebc..a7b07199a 100644 --- a/packages/vrender/src/picker/math-picker-service.ts +++ b/packages/vrender/src/picker/math-picker-service.ts @@ -17,7 +17,7 @@ import type { import { DefaultPickService } from './picker-service'; import { EmptyContext2d } from '../canvas'; import { MathPickerContribution } from './contributions/constants'; -import { Global } from '../constants'; +import { VGlobal } from '../constants'; import { PickItemInterceptor } from './pick-interceptor'; // 默认的pick-service,提供基本的最优选中策略,尽量不需要用户自己实现contribution @@ -34,7 +34,7 @@ export class DefaultMathPickerService extends DefaultPickService implements IPic @inject(ContributionProvider) @named(MathPickerContribution) protected readonly contributions: IContributionProvider, - @inject(Global) public readonly global: IGlobal, + @inject(VGlobal) public readonly global: IGlobal, // 拦截器 @inject(ContributionProvider) @named(PickItemInterceptor) diff --git a/packages/vrender/src/picker/picker-service.ts b/packages/vrender/src/picker/picker-service.ts index bcaa851ab..fdbd0470e 100644 --- a/packages/vrender/src/picker/picker-service.ts +++ b/packages/vrender/src/picker/picker-service.ts @@ -20,7 +20,7 @@ import type { import { DefaultAttribute, getTheme, mat3Tomat4, multiplyMat4Mat4 } from '../graphic'; import { mat4Allocate, matrixAllocate } from '../allocator/matrix-allocate'; import { PickItemInterceptor } from './pick-interceptor'; -import { Global } from '../constants'; +import { VGlobal } from '../constants'; export const GraphicPicker = Symbol.for('GraphicPicker'); @@ -34,7 +34,7 @@ export abstract class DefaultPickService implements IPickerService { declare InterceptorContributions: IPickItemInterceptorContribution[]; constructor( - @inject(Global) public readonly global: IGlobal, + @inject(VGlobal) public readonly global: IGlobal, // 拦截器 @inject(ContributionProvider) @named(PickItemInterceptor) diff --git a/packages/vrender/src/render/contributions/render/incremental-draw-contribution.ts b/packages/vrender/src/render/contributions/render/incremental-draw-contribution.ts index 294f83e68..f01391ddc 100644 --- a/packages/vrender/src/render/contributions/render/incremental-draw-contribution.ts +++ b/packages/vrender/src/render/contributions/render/incremental-draw-contribution.ts @@ -23,7 +23,7 @@ import { DrawItemInterceptor } from './draw-interceptor'; import { ContributionProvider } from '../../../common/contribution-provider'; import { foreachAsync } from '../../../common/sort'; import type { ILayerService } from '../../../interface/core'; -import { Global } from '../../../constants'; +import { VGlobal } from '../../../constants'; enum STATUS { NORMAL = 0, @@ -47,7 +47,7 @@ export class DefaultIncrementalDrawContribution extends DefaultDrawContribution protected lastRenderService: IRenderService; protected lastDrawContext: IDrawContext; protected count: number; - @inject(Global) global: IGlobal; + @inject(VGlobal) global: IGlobal; constructor( // @inject(ContributionProvider) From ad1b73b9f784ff23872f797de62caa3a165f85cd Mon Sep 17 00:00:00 2001 From: skie1997 Date: Thu, 10 Aug 2023 23:36:50 +0800 Subject: [PATCH 09/35] Revert "chore: rename global window name to test marker in VChart" This reverts commit 3a9ae66df9787fd05b62843587b080c9d18c1cab. --- .../src/data-zoom/data-zoom.ts | 8 +++--- .../src/player/continuous-player.ts | 10 +++---- .../src/player/discrete-player.ts | 10 +++---- .../src/scrollbar/scrollbar.ts | 14 +++++----- .../vrender-components/src/slider/slider.ts | 26 +++++++++---------- 5 files changed, 34 insertions(+), 34 deletions(-) diff --git a/packages/vrender-components/src/data-zoom/data-zoom.ts b/packages/vrender-components/src/data-zoom/data-zoom.ts index e04465f0a..d75a20f6b 100644 --- a/packages/vrender-components/src/data-zoom/data-zoom.ts +++ b/packages/vrender-components/src/data-zoom/data-zoom.ts @@ -1,5 +1,5 @@ import type { FederatedPointerEvent, IArea, IGroup, ILine, IRect, ISymbol, INode } from '@visactor/vrender'; -import { global } from '@visactor/vrender'; +import { vglobal } from '@visactor/vrender'; import type { IPointLike } from '@visactor/vutils'; import { array, clamp, isFunction, isValid, merge } from '@visactor/vutils'; import { AbstractComponent } from '../core/base'; @@ -167,11 +167,11 @@ export class DataZoom extends AbstractComponent> { (e: FederatedPointerEvent) => this._onHandlerPointerDown(e, selectedTag) as unknown as EventListener ); } - if (global.env === 'browser') { + if (vglobal.env === 'browser') { // 拖拽时 - global.addEventListener('pointermove', this._onHandlerPointerMove.bind(this) as EventListener); + vglobal.addEventListener('pointermove', this._onHandlerPointerMove.bind(this) as EventListener); // 拖拽结束 - global.addEventListener('pointerup', this._onHandlerPointerUp.bind(this) as EventListener); + vglobal.addEventListener('pointerup', this._onHandlerPointerUp.bind(this) as EventListener); } // 拖拽时 (this as unknown as IGroup).addEventListener('pointermove', this._onHandlerPointerMove as EventListener); diff --git a/packages/vrender-components/src/player/continuous-player.ts b/packages/vrender-components/src/player/continuous-player.ts index 424f4c405..44785085a 100644 --- a/packages/vrender-components/src/player/continuous-player.ts +++ b/packages/vrender-components/src/player/continuous-player.ts @@ -1,5 +1,5 @@ import type { FederatedPointerEvent } from '@visactor/vrender'; -import { global } from '@visactor/vrender'; +import { vglobal } from '@visactor/vrender'; import { BasePlayer } from './base-player'; import type { ContinuousPlayerAttributes } from './type'; import { PlayerEventEnum } from './type'; @@ -163,7 +163,7 @@ export class ContinuousPlayer extends BasePlayer imp // 事件 this.dispatchCustomEvent(PlayerEventEnum.OnPlay); // 开始播放动画 - this._rafId = global.getRequestAnimationFrame()(this._play.bind(this)); + this._rafId = vglobal.getRequestAnimationFrame()(this._play.bind(this)); }; /** @@ -184,7 +184,7 @@ export class ContinuousPlayer extends BasePlayer imp } // 持续播放 - this._rafId = global.getRequestAnimationFrame()(this._play.bind(this)); + this._rafId = vglobal.getRequestAnimationFrame()(this._play.bind(this)); }; /** @@ -194,7 +194,7 @@ export class ContinuousPlayer extends BasePlayer imp // 播放状态更新 this._isPlaying = false; // 取消播放动画 - global.getCancelAnimationFrame()(this._rafId); + vglobal.getCancelAnimationFrame()(this._rafId); // 切换按钮 this._controller.togglePlay(); // 事件 @@ -211,7 +211,7 @@ export class ContinuousPlayer extends BasePlayer imp this._isPlaying = false; // 计算已流逝的时间, 需要记录下来 this._elapsed = Date.now() - this._startTime; - global.getCancelAnimationFrame()(this._rafId); + vglobal.getCancelAnimationFrame()(this._rafId); this._controller.togglePlay(); this.dispatchCustomEvent(PlayerEventEnum.OnPause); diff --git a/packages/vrender-components/src/player/discrete-player.ts b/packages/vrender-components/src/player/discrete-player.ts index ed68798e4..f348811ab 100644 --- a/packages/vrender-components/src/player/discrete-player.ts +++ b/packages/vrender-components/src/player/discrete-player.ts @@ -1,6 +1,6 @@ import { isNil, merge } from '@visactor/vutils'; import type { FederatedPointerEvent } from '@visactor/vrender'; -import { global } from '@visactor/vrender'; +import { vglobal } from '@visactor/vrender'; import { BasePlayer } from './base-player'; import type { DirectionType, DiscretePlayerAttributes, PlayerAttributes } from './type'; import { DirectionEnum, PlayerEventEnum } from './type'; @@ -140,7 +140,7 @@ export class DiscretePlayer extends BasePlayer impleme // 重置tick时间, 暂停后重新播放也会重新计时 this._tickTime = Date.now(); // 开启动画 - this._rafId = global.getRequestAnimationFrame()(this._play.bind(this, true)); + this._rafId = vglobal.getRequestAnimationFrame()(this._play.bind(this, true)); }; /** @@ -178,7 +178,7 @@ export class DiscretePlayer extends BasePlayer impleme this._isReachEnd = true; } - this._rafId = global.getRequestAnimationFrame()(this._play.bind(this, false)); + this._rafId = vglobal.getRequestAnimationFrame()(this._play.bind(this, false)); }; /** @@ -198,7 +198,7 @@ export class DiscretePlayer extends BasePlayer impleme // 图标切换 this._controller.togglePlay(); // 取消播放动画 - global.getCancelAnimationFrame()(this._rafId); + vglobal.getCancelAnimationFrame()(this._rafId); // 重置ActiveIndex this._activeIndex = -1; // 播放结束时并且到达终点 @@ -213,7 +213,7 @@ export class DiscretePlayer extends BasePlayer impleme return; } this._isPlaying = false; - global.getCancelAnimationFrame()(this._rafId); + vglobal.getCancelAnimationFrame()(this._rafId); this._controller.togglePlay(); this.dispatchCustomEvent(PlayerEventEnum.OnPause); diff --git a/packages/vrender-components/src/scrollbar/scrollbar.ts b/packages/vrender-components/src/scrollbar/scrollbar.ts index ccb166ec3..0d8620bcc 100644 --- a/packages/vrender-components/src/scrollbar/scrollbar.ts +++ b/packages/vrender-components/src/scrollbar/scrollbar.ts @@ -2,7 +2,7 @@ * @description 滚动条组件 */ import type { IRectGraphicAttribute, FederatedPointerEvent, IGroup, IRect } from '@visactor/vrender'; -import { CustomEvent, global } from '@visactor/vrender'; +import { CustomEvent, vglobal } from '@visactor/vrender'; import { merge, normalizePadding, clamp, clampRange } from '@visactor/vutils'; import { AbstractComponent } from '../core/base'; @@ -266,9 +266,9 @@ export class ScrollBar extends AbstractComponent> e.stopPropagation(); const { direction } = this.attribute as ScrollBarAttributes; this._prePos = direction === 'horizontal' ? e.clientX : e.clientY; - if (global.env === 'browser') { - global.addEventListener('pointermove', this._onSliderPointerMove); - global.addEventListener('pointerup', this._onSliderPointerUp); + if (vglobal.env === 'browser') { + vglobal.addEventListener('pointermove', this._onSliderPointerMove); + vglobal.addEventListener('pointerup', this._onSliderPointerUp); } else { this._slider.addEventListener('pointermove', this._onSliderPointerMove); this._slider.addEventListener('pointerup', this._onSliderPointerUp); @@ -300,9 +300,9 @@ export class ScrollBar extends AbstractComponent> private _onSliderPointerUp = (e: any) => { e.preventDefault(); - if (global.env === 'browser') { - global.removeEventListener('pointermove', this._onSliderPointerMove); - global.removeEventListener('pointerup', this._onSliderPointerUp); + if (vglobal.env === 'browser') { + vglobal.removeEventListener('pointermove', this._onSliderPointerMove); + vglobal.removeEventListener('pointerup', this._onSliderPointerUp); } else { this._slider.removeEventListener('pointermove', this._onSliderPointerMove); this._slider.removeEventListener('pointerup', this._onSliderPointerUp); diff --git a/packages/vrender-components/src/slider/slider.ts b/packages/vrender-components/src/slider/slider.ts index bdcd53ae8..634d91f86 100644 --- a/packages/vrender-components/src/slider/slider.ts +++ b/packages/vrender-components/src/slider/slider.ts @@ -15,7 +15,7 @@ import type { FederatedPointerEvent, Cursor } from '@visactor/vrender'; -import { createGroup, createText, global, createRect, createSymbol, CustomEvent } from '@visactor/vrender'; +import { createGroup, createText, vglobal, createRect, createSymbol, CustomEvent } from '@visactor/vrender'; import { AbstractComponent } from '../core/base'; import { SLIDER_ELEMENT_NAME } from './constant'; @@ -493,9 +493,9 @@ export class Slider extends AbstractComponent> { e.stopPropagation(); this._currentHandler = e.target as unknown as IGraphic; this._prePos = this._isHorizontal ? e.clientX : e.clientY; - if (global.env === 'browser') { - global.addEventListener('pointermove', this._onHandlerPointerMove as EventListenerOrEventListenerObject); - global.addEventListener('pointerup', this._onHandlerPointerUp as EventListenerOrEventListenerObject); + if (vglobal.env === 'browser') { + vglobal.addEventListener('pointermove', this._onHandlerPointerMove as EventListenerOrEventListenerObject); + vglobal.addEventListener('pointerup', this._onHandlerPointerUp as EventListenerOrEventListenerObject); } else { this._currentHandler.addEventListener( 'pointermove', @@ -550,9 +550,9 @@ export class Slider extends AbstractComponent> { private _onHandlerPointerUp = (e: FederatedPointerEvent) => { e.preventDefault(); this._currentHandler = null; - if (global.env === 'browser') { - global.removeEventListener('pointermove', this._onHandlerPointerMove as EventListenerOrEventListenerObject); - global.removeEventListener('pointerup', this._onHandlerPointerUp as EventListenerOrEventListenerObject); + if (vglobal.env === 'browser') { + vglobal.removeEventListener('pointermove', this._onHandlerPointerMove as EventListenerOrEventListenerObject); + vglobal.removeEventListener('pointerup', this._onHandlerPointerUp as EventListenerOrEventListenerObject); } else { const currentTarget = e.target; currentTarget.removeEventListener( @@ -570,9 +570,9 @@ export class Slider extends AbstractComponent> { private _onTrackPointerdown = (e: FederatedPointerEvent) => { e.stopPropagation(); this._prePos = this._isHorizontal ? e.clientX : e.clientY; - if (global.env === 'browser') { - global.addEventListener('pointermove', this._onTrackPointerMove as EventListenerOrEventListenerObject); - global.addEventListener('pointerup', this._onTrackPointerUp as EventListenerOrEventListenerObject); + if (vglobal.env === 'browser') { + vglobal.addEventListener('pointermove', this._onTrackPointerMove as EventListenerOrEventListenerObject); + vglobal.addEventListener('pointerup', this._onTrackPointerUp as EventListenerOrEventListenerObject); } else { this._track.addEventListener('pointermove', this._onTrackPointerMove as EventListenerOrEventListenerObject); this._track.addEventListener('pointerup', this._onTrackPointerUp as EventListenerOrEventListenerObject); @@ -633,9 +633,9 @@ export class Slider extends AbstractComponent> { private _onTrackPointerUp = (e: FederatedPointerEvent) => { e.preventDefault(); - if (global.env === 'browser') { - global.removeEventListener('pointermove', this._onTrackPointerMove as EventListenerOrEventListenerObject); - global.removeEventListener('pointerup', this._onTrackPointerUp as EventListenerOrEventListenerObject); + if (vglobal.env === 'browser') { + vglobal.removeEventListener('pointermove', this._onTrackPointerMove as EventListenerOrEventListenerObject); + vglobal.removeEventListener('pointerup', this._onTrackPointerUp as EventListenerOrEventListenerObject); } else { this._track.removeEventListener('pointermove', this._onTrackPointerMove as EventListenerOrEventListenerObject); this._track.removeEventListener('pointerup', this._onTrackPointerUp as EventListenerOrEventListenerObject); From 7c61cabe9ce28a54c20114b97a84996d13a7cf0a Mon Sep 17 00:00:00 2001 From: pairone <1063258712@qq.com> Date: Sun, 13 Aug 2023 23:12:22 +0800 Subject: [PATCH 10/35] feat: change labelLine of arc label from path mark to line mark to adapt to animation --- packages/vrender-components/src/label/base.ts | 34 +++++++++---------- packages/vrender-components/src/label/type.ts | 2 ++ 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/packages/vrender-components/src/label/base.ts b/packages/vrender-components/src/label/base.ts index b9357d2cc..f9d99cceb 100644 --- a/packages/vrender-components/src/label/base.ts +++ b/packages/vrender-components/src/label/base.ts @@ -1,8 +1,8 @@ /** * @description Label 基类 */ -import type { IGroup, Text, IGraphic, IText, FederatedPointerEvent, IColor, IPath, Path } from '@visactor/vrender'; -import { createText, IncreaseCount, AttributeUpdateType, createPath } from '@visactor/vrender'; +import type { IGroup, Text, IGraphic, IText, FederatedPointerEvent, IColor, ILine, Line } from '@visactor/vrender'; +import { createText, IncreaseCount, AttributeUpdateType, createLine } from '@visactor/vrender'; import type { IBoundsLike } from '@visactor/vutils'; import { isFunction, isValidNumber, isEmpty, isValid, isString } from '@visactor/vutils'; import { AbstractComponent } from '../core/base'; @@ -33,7 +33,7 @@ export abstract class LabelBase extends AbstractCompon this._bmpTool = bmpTool; } - protected _graphicToText: Map; + protected _graphicToText: Map; protected _idToGraphic: Map; @@ -273,6 +273,7 @@ export abstract class LabelBase extends AbstractCompon x: basedArc.labelPosition.x, y: basedArc.labelPosition.y, angle: (this.attribute as ArcLabelAttrs).angle ?? basedArc.angle, + points: [basedArc.pointA, basedArc.pointB, basedArc.pointC], labelLinePath: basedArc.labelLinePath }; @@ -451,18 +452,18 @@ export abstract class LabelBase extends AbstractCompon const easing = animationConfig.easing ?? DefaultLabelAnimation.easing; const delay = animationConfig.delay ?? 0; - const currentTextMap: Map = new Map(); - const prevTextMap: Map = this._graphicToText || new Map(); + const currentTextMap: Map = new Map(); + const prevTextMap: Map = this._graphicToText || new Map(); const texts = [] as IText[]; labels.forEach((text, index) => { - const labelLine: IPath = (text.attribute as ArcLabelAttrs)?.labelLinePath - ? (createPath({ + const labelLine: ILine = (text.attribute as ArcLabelAttrs)?.points + ? (createLine({ visible: text.attribute?.visible ?? true, stroke: (text.attribute as ArcLabelAttrs)?.line?.stroke ?? text.attribute?.fill, lineWidth: 1, - path: (text.attribute as ArcLabelAttrs)?.labelLinePath - }) as Path) + points: (text.attribute as ArcLabelAttrs)?.points + }) as Line) : undefined; const relatedGraphic = this._idToGraphic.get((text.attribute as LabelItem).id); const state = prevTextMap?.get(relatedGraphic) ? 'update' : 'enter'; @@ -503,14 +504,13 @@ export abstract class LabelBase extends AbstractCompon const prevText = prevLabel.text; prevText.animate().to(text.attribute, duration, easing); if (prevLabel.labelLine) { - // prevLabel.labelLine.setAttributes({ path: (text.attribute as ArcLabelAttrs)?.labelLinePath }); - prevLabel.labelLine - .animate() - .to( - merge({}, prevLabel.labelLine.attribute, { path: (text.attribute as ArcLabelAttrs)?.labelLinePath }), - duration, - easing - ); + prevLabel.labelLine.animate().to( + merge({}, prevLabel.labelLine.attribute, { + points: (text.attribute as ArcLabelAttrs)?.points + }), + duration, + easing + ); } if ( animationConfig.increaseEffect !== false && diff --git a/packages/vrender-components/src/label/type.ts b/packages/vrender-components/src/label/type.ts index 15815066f..161c2400e 100644 --- a/packages/vrender-components/src/label/type.ts +++ b/packages/vrender-components/src/label/type.ts @@ -283,6 +283,8 @@ export interface ArcLabelAttrs extends BaseLabelAttrs { layout?: IArcLabelLayoutSpec; /** 标签引导线path */ labelLinePath?: string; + /** 标签引导线点集 */ + points?: IPoint[]; } export interface IArcLabelLineSpec { From 32eceeea9c8980f6f49c128bc4ba8c66a30a23b6 Mon Sep 17 00:00:00 2001 From: pairone <1063258712@qq.com> Date: Sun, 13 Aug 2023 23:15:21 +0800 Subject: [PATCH 11/35] feat: add rush change log --- .../feat-arc-label_2023-08-13-15-14.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 common/changes/@visactor/vrender-components/feat-arc-label_2023-08-13-15-14.json diff --git a/common/changes/@visactor/vrender-components/feat-arc-label_2023-08-13-15-14.json b/common/changes/@visactor/vrender-components/feat-arc-label_2023-08-13-15-14.json new file mode 100644 index 000000000..3e50df0d4 --- /dev/null +++ b/common/changes/@visactor/vrender-components/feat-arc-label_2023-08-13-15-14.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender-components", + "comment": "feat: change labelLine of arc label from path mark to line mark to adapt to animation'", + "type": "patch" + } + ], + "packageName": "@visactor/vrender-components" +} \ No newline at end of file From 8e5eb40cf44e287a7079bf6df23c86268e0c393e Mon Sep 17 00:00:00 2001 From: pairone <1063258712@qq.com> Date: Sun, 13 Aug 2023 23:23:45 +0800 Subject: [PATCH 12/35] feat: remove the logic related to labelLinePath --- packages/vrender-components/src/label/base.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/vrender-components/src/label/base.ts b/packages/vrender-components/src/label/base.ts index f9d99cceb..c1591d7ae 100644 --- a/packages/vrender-components/src/label/base.ts +++ b/packages/vrender-components/src/label/base.ts @@ -273,8 +273,7 @@ export abstract class LabelBase extends AbstractCompon x: basedArc.labelPosition.x, y: basedArc.labelPosition.y, angle: (this.attribute as ArcLabelAttrs).angle ?? basedArc.angle, - points: [basedArc.pointA, basedArc.pointB, basedArc.pointC], - labelLinePath: basedArc.labelLinePath + points: [basedArc.pointA, basedArc.pointB, basedArc.pointC] }; labels[i].setAttributes(labelAttribute); @@ -531,7 +530,7 @@ export abstract class LabelBase extends AbstractCompon } else { prevLabel.text.setAttributes(text.attribute); if (prevLabel?.labelLine) { - prevLabel.labelLine.setAttributes({ path: (text.attribute as ArcLabelAttrs)?.labelLinePath }); + prevLabel.labelLine.setAttributes({ points: (text.attribute as ArcLabelAttrs)?.points }); } } } From 6402caa0a042eefff6a7775935aecf68a48bbc65 Mon Sep 17 00:00:00 2001 From: pairone <1063258712@qq.com> Date: Mon, 14 Aug 2023 17:54:07 +0800 Subject: [PATCH 13/35] fix: pointB is undefined when position is inside --- .../__tests__/browser/examples/label-arc.ts | 6 +++--- packages/vrender-components/src/label/base.ts | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/vrender-components/__tests__/browser/examples/label-arc.ts b/packages/vrender-components/__tests__/browser/examples/label-arc.ts index 43366d9b9..36d7e6d74 100644 --- a/packages/vrender-components/__tests__/browser/examples/label-arc.ts +++ b/packages/vrender-components/__tests__/browser/examples/label-arc.ts @@ -417,16 +417,16 @@ function createContent(stage: Stage) { }, width: 800, height: 500, - position: 'outside', + // position: 'outside', - // position: 'inside', + position: 'inside', // coverEnable: false, // layout: { // strategy: 'none' // }, - // angle: 0, + angle: 0, zIndex: 302 }); diff --git a/packages/vrender-components/src/label/base.ts b/packages/vrender-components/src/label/base.ts index c1591d7ae..43ba72dd3 100644 --- a/packages/vrender-components/src/label/base.ts +++ b/packages/vrender-components/src/label/base.ts @@ -273,7 +273,10 @@ export abstract class LabelBase extends AbstractCompon x: basedArc.labelPosition.x, y: basedArc.labelPosition.y, angle: (this.attribute as ArcLabelAttrs).angle ?? basedArc.angle, - points: [basedArc.pointA, basedArc.pointB, basedArc.pointC] + points: + basedArc?.pointA && basedArc?.pointB && basedArc?.pointC + ? [basedArc.pointA, basedArc.pointB, basedArc.pointC] + : undefined }; labels[i].setAttributes(labelAttribute); From 987a049520395439f156e3e50037a6898349851c Mon Sep 17 00:00:00 2001 From: pairone <1063258712@qq.com> Date: Mon, 14 Aug 2023 20:21:52 +0800 Subject: [PATCH 14/35] feat: angle as an item of text Style --- .../__tests__/browser/examples/label-arc.ts | 5 ++++- packages/vrender-components/src/label/arc.ts | 6 ++---- packages/vrender-components/src/label/base.ts | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/vrender-components/__tests__/browser/examples/label-arc.ts b/packages/vrender-components/__tests__/browser/examples/label-arc.ts index 36d7e6d74..acd21c148 100644 --- a/packages/vrender-components/__tests__/browser/examples/label-arc.ts +++ b/packages/vrender-components/__tests__/browser/examples/label-arc.ts @@ -421,12 +421,15 @@ function createContent(stage: Stage) { position: 'inside', + textStyle: { + angle: 0 + }, + // coverEnable: false, // layout: { // strategy: 'none' // }, - angle: 0, zIndex: 302 }); diff --git a/packages/vrender-components/src/label/arc.ts b/packages/vrender-components/src/label/arc.ts index 6e495a787..17721178f 100644 --- a/packages/vrender-components/src/label/arc.ts +++ b/packages/vrender-components/src/label/arc.ts @@ -45,8 +45,6 @@ export class ArcInfo { radian: number; middleAngle: number; k: number; - textAlign: TextAlignType; - textBaseline: TextBaselineType; angle: number; constructor( @@ -269,7 +267,7 @@ export class ArcLabel extends LabelBase { // (arc.textAlign = 'center'), (arc.textBaseline = 'middle'); // arc.angle = degrees(arc.middleAngle); - arc.angle = arc.middleAngle; + arc.angle = attribute?.textStyle?.angle ?? arc.middleAngle; }); return arcs; } @@ -345,7 +343,7 @@ export class ArcLabel extends LabelBase { ) { arc.labelVisible = false; } - arc.angle = 0; + arc.angle = attribute?.textStyle?.angle ?? 0; arc.labelLinePath = `M${Math.round(arc.pointA.x)},${Math.round(arc.pointA.y)}` + diff --git a/packages/vrender-components/src/label/base.ts b/packages/vrender-components/src/label/base.ts index 43ba72dd3..4cd59d0fc 100644 --- a/packages/vrender-components/src/label/base.ts +++ b/packages/vrender-components/src/label/base.ts @@ -272,7 +272,7 @@ export abstract class LabelBase extends AbstractCompon const labelAttribute = { x: basedArc.labelPosition.x, y: basedArc.labelPosition.y, - angle: (this.attribute as ArcLabelAttrs).angle ?? basedArc.angle, + angle: basedArc.angle, points: basedArc?.pointA && basedArc?.pointB && basedArc?.pointC ? [basedArc.pointA, basedArc.pointB, basedArc.pointC] From a42655faa5500d00b1c12dfbcb49bac2bf7a2518 Mon Sep 17 00:00:00 2001 From: pairone <1063258712@qq.com> Date: Mon, 14 Aug 2023 21:13:30 +0800 Subject: [PATCH 15/35] feat: remove duplicate declarations and console --- .../__tests__/browser/examples/label-arc.ts | 2 ++ packages/vrender-components/src/label/arc.ts | 26 ++++++++----------- packages/vrender-components/src/label/base.ts | 5 ++-- packages/vrender-components/src/label/type.ts | 2 -- 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/packages/vrender-components/__tests__/browser/examples/label-arc.ts b/packages/vrender-components/__tests__/browser/examples/label-arc.ts index acd21c148..5f1efe364 100644 --- a/packages/vrender-components/__tests__/browser/examples/label-arc.ts +++ b/packages/vrender-components/__tests__/browser/examples/label-arc.ts @@ -425,6 +425,8 @@ function createContent(stage: Stage) { angle: 0 }, + // smartInvert: false, + // coverEnable: false, // layout: { // strategy: 'none' diff --git a/packages/vrender-components/src/label/arc.ts b/packages/vrender-components/src/label/arc.ts index 17721178f..ee3b548fd 100644 --- a/packages/vrender-components/src/label/arc.ts +++ b/packages/vrender-components/src/label/arc.ts @@ -1,10 +1,8 @@ import type { IBoundsLike } from '@visactor/vutils'; -import { merge } from '@visactor/vutils'; +import { merge, isValidNumber, isNil, isLess, isGreater, isNumberClose as isClose } from '@visactor/vutils'; import { LabelBase } from './base'; -import type { ArcLabelAttrs, IPoint, Quadrant, TextAlign } from './type'; -import type { BaseLabelAttrs } from './type'; -import type { TextAlignType, TextBaselineType, IText, IArcGraphicAttribute } from '@visactor/vrender'; -import { isValidNumber, isNil, isLess, isGreater, isNumberClose as isClose } from '@visactor/vutils'; +import type { ArcLabelAttrs, IPoint, Quadrant, TextAlign, BaseLabelAttrs } from './type'; +import type { IText, IArcGraphicAttribute, IGraphic } from '@visactor/vrender'; import { circlePoint, isQuadrantRight, @@ -14,7 +12,6 @@ import { checkBoundsOverlap, computeQuadrant } from './util'; -import type { IGraphic } from '@visactor/vrender'; export class ArcInfo { key!: string; @@ -34,10 +31,9 @@ export class ArcInfo { lastLabelY!: number; labelYRange!: [number, number]; labelText!: string | string[]; - pointA!: IPoint; - pointB!: IPoint; - pointC!: IPoint; - labelLinePath!: string; + pointA: IPoint; + pointB: IPoint; + pointC: IPoint; /** * 象限 */ @@ -345,10 +341,10 @@ export class ArcLabel extends LabelBase { } arc.angle = attribute?.textStyle?.angle ?? 0; - arc.labelLinePath = - `M${Math.round(arc.pointA.x)},${Math.round(arc.pointA.y)}` + - ` L${Math.round(arc.pointB.x)},${Math.round(arc.pointB.y)}` + - ` L${Math.round(arc.pointC.x)},${Math.round(arc.pointC.y)}`; + // arc.labelLinePath = + // `M${Math.round(arc.pointA.x)},${Math.round(arc.pointA.y)}` + + // ` L${Math.round(arc.pointB.x)},${Math.round(arc.pointB.y)}` + + // ` L${Math.round(arc.pointC.x)},${Math.round(arc.pointC.y)}`; }); return arcs; @@ -370,7 +366,7 @@ export class ArcLabel extends LabelBase { const line2MinLength = attribute.line.line2MinLength as number; const labelLayoutAlign = attribute.layout?.align; const spaceWidth = attribute.spaceWidth as number; - const align = this._computeAlign(arc, attribute) as TextAlign; + // const align = this._computeAlign(arc, attribute) as TextAlign; const { labelPosition, quadrant, pointB } = arc; if (!isValidNumber(pointB.x * pointB.y)) { diff --git a/packages/vrender-components/src/label/base.ts b/packages/vrender-components/src/label/base.ts index 4cd59d0fc..aaec0224b 100644 --- a/packages/vrender-components/src/label/base.ts +++ b/packages/vrender-components/src/label/base.ts @@ -4,7 +4,7 @@ import type { IGroup, Text, IGraphic, IText, FederatedPointerEvent, IColor, ILine, Line } from '@visactor/vrender'; import { createText, IncreaseCount, AttributeUpdateType, createLine } from '@visactor/vrender'; import type { IBoundsLike } from '@visactor/vutils'; -import { isFunction, isValidNumber, isEmpty, isValid, isString } from '@visactor/vutils'; +import { isFunction, isValidNumber, isEmpty, isValid, isString, merge } from '@visactor/vutils'; import { AbstractComponent } from '../core/base'; import type { PointLocationCfg } from '../core/type'; import { labelSmartInvert } from '../util/labelSmartInvert'; @@ -15,7 +15,6 @@ import { bitmapTool, boundToRange, canPlace, canPlaceInside, clampText, place } import type { BaseLabelAttrs, OverlapAttrs, ILabelAnimation, ArcLabelAttrs, LabelItem, SmartInvertAttrs } from './type'; import { DefaultLabelAnimation, getAnimationAttributes } from './animate/animate'; import type { ArcInfo } from './arc'; -import { merge } from '@visactor/vutils'; export abstract class LabelBase extends AbstractComponent { name = 'label'; @@ -268,8 +267,8 @@ export abstract class LabelBase extends AbstractCompon for (let i = 0; i < data.length; i++) { const textData = data[i]; const basedArc = arcs.find(arc => arc.labelText === textData.text); - const labelAttribute = { + visible: basedArc.labelVisible, x: basedArc.labelPosition.x, y: basedArc.labelPosition.y, angle: basedArc.angle, diff --git a/packages/vrender-components/src/label/type.ts b/packages/vrender-components/src/label/type.ts index 161c2400e..80d38f8af 100644 --- a/packages/vrender-components/src/label/type.ts +++ b/packages/vrender-components/src/label/type.ts @@ -281,8 +281,6 @@ export interface ArcLabelAttrs extends BaseLabelAttrs { line?: IArcLabelLineSpec; /** 标签布局配置 */ layout?: IArcLabelLayoutSpec; - /** 标签引导线path */ - labelLinePath?: string; /** 标签引导线点集 */ points?: IPoint[]; } From 5b62ab31136460639ac352a20c69a80493150455 Mon Sep 17 00:00:00 2001 From: pairone <1063258712@qq.com> Date: Tue, 15 Aug 2023 16:00:24 +0800 Subject: [PATCH 16/35] feat: delete console --- .../__tests__/browser/examples/label-arc.ts | 412 +++++++++--------- packages/vrender-components/src/label/arc.ts | 32 +- packages/vrender-components/src/label/type.ts | 2 + 3 files changed, 229 insertions(+), 217 deletions(-) diff --git a/packages/vrender-components/__tests__/browser/examples/label-arc.ts b/packages/vrender-components/__tests__/browser/examples/label-arc.ts index 5f1efe364..436e389a4 100644 --- a/packages/vrender-components/__tests__/browser/examples/label-arc.ts +++ b/packages/vrender-components/__tests__/browser/examples/label-arc.ts @@ -14,238 +14,238 @@ const pieGenerator = () => { _uid: 14, type: 'group', name: 'pie_9', - children: [ - { - attribute: { - fill: '#1f77b4', - x: 100, - y: 100, - startAngle: 0, - endAngle: 1.0927278795094932, - innerRadius: 0, - outerRadius: 80, - fillOpacity: 1 - }, - _uid: 52, - type: 'arc', - children: [] - }, - { - attribute: { - fill: '#aec7e8', - x: 100, - y: 100, - startAngle: 1.0927278795094932, - endAngle: 2.731819698773733, - innerRadius: 0, - outerRadius: 80, - fillOpacity: 1 - }, - _uid: 53, - type: 'arc', - children: [] - }, - { - attribute: { - fill: '#ff7f0e', - x: 100, - y: 100, - startAngle: 2.731819698773733, - endAngle: 5.463639397547466, - innerRadius: 0, - outerRadius: 80, - fillOpacity: 1 - }, - _uid: 54, - type: 'arc', - children: [] - }, - { - attribute: { - fill: '#ffbb78', - x: 100, - y: 100, - startAngle: 5.463639397547466, - endAngle: 6.283185307179586, - innerRadius: 0, - outerRadius: 80, - fillOpacity: 1 - }, - _uid: 55, - type: 'arc', - children: [] - } - ] // children: [ // { // attribute: { - // visible: true, - // lineWidth: 0, - // fillOpacity: 1, - // padAngle: 0, - // x: 388, - // y: 238, - // startAngle: -1.5707963267948966, - // endAngle: 1.357168026350791, - // outerRadius: 190.4, + // fill: '#1f77b4', + // x: 100, + // y: 100, + // startAngle: 0, + // endAngle: 1.0927278795094932, // innerRadius: 0, - // cornerRadius: 0, - // fill: '#1664FF', - // stroke: '#1664FF', - // pickable: true + // outerRadius: 80, + // fillOpacity: 1 // }, - // _uid: 15, + // _uid: 52, // type: 'arc', // children: [] // }, // { // attribute: { - // visible: true, - // lineWidth: 0, - // fillOpacity: 1, - // padAngle: 0, - // x: 388, - // y: 238, - // startAngle: 1.357168026350791, - // endAngle: 3.0988669935009723, - // outerRadius: 190.4, + // fill: '#aec7e8', + // x: 100, + // y: 100, + // startAngle: 1.0927278795094932, + // endAngle: 2.731819698773733, // innerRadius: 0, - // cornerRadius: 0, - // fill: '#1AC6FF', - // stroke: '#1AC6FF', - // pickable: true + // outerRadius: 80, + // fillOpacity: 1 // }, - // _uid: 16, + // _uid: 53, // type: 'arc', // children: [] // }, // { // attribute: { - // visible: true, - // lineWidth: 0, - // fillOpacity: 1, - // padAngle: 0, - // x: 388, - // y: 238, - // startAngle: 3.0988669935009723, - // endAngle: 3.609689958974673, - // outerRadius: 190.4, + // fill: '#ff7f0e', + // x: 100, + // y: 100, + // startAngle: 2.731819698773733, + // endAngle: 5.463639397547466, // innerRadius: 0, - // cornerRadius: 0, - // fill: '#FF8A00', - // stroke: '#FF8A00', - // pickable: true + // outerRadius: 80, + // fillOpacity: 1 // }, - // _uid: 17, + // _uid: 54, // type: 'arc', // children: [] // }, // { // attribute: { - // visible: true, - // lineWidth: 0, - // fillOpacity: 1, - // padAngle: 0, - // x: 388, - // y: 238, - // startAngle: 3.609689958974673, - // endAngle: 3.9238492243336522, - // outerRadius: 190.4, + // fill: '#ffbb78', + // x: 100, + // y: 100, + // startAngle: 5.463639397547466, + // endAngle: 6.283185307179586, // innerRadius: 0, - // cornerRadius: 0, - // fill: '#3CC780', - // stroke: '#3CC780', - // pickable: true + // outerRadius: 80, + // fillOpacity: 1 // }, - // _uid: 18, - // type: 'arc', - // children: [] - // }, - // { - // attribute: { - // visible: true, - // lineWidth: 0, - // fillOpacity: 1, - // padAngle: 0, - // x: 388, - // y: 238, - // startAngle: 3.9238492243336522, - // endAngle: 4.151928850984271, - // outerRadius: 190.4, - // innerRadius: 0, - // cornerRadius: 0, - // fill: '#7442D4', - // stroke: '#7442D4', - // pickable: true - // }, - // _uid: 19, - // type: 'arc', - // children: [] - // }, - // { - // attribute: { - // visible: true, - // lineWidth: 0, - // fillOpacity: 1, - // padAngle: 0, - // x: 388, - // y: 238, - // startAngle: 4.151928850984271, - // endAngle: 4.329742995177454, - // outerRadius: 190.4, - // innerRadius: 0, - // cornerRadius: 0, - // fill: '#FFC400', - // stroke: '#FFC400', - // pickable: true - // }, - // _uid: 20, - // type: 'arc', - // children: [] - // }, - // { - // attribute: { - // visible: true, - // lineWidth: 0, - // fillOpacity: 1, - // padAngle: 0, - // x: 388, - // y: 238, - // startAngle: 4.329742995177454, - // endAngle: 4.492477494633405, - // outerRadius: 190.4, - // innerRadius: 0, - // cornerRadius: 0, - // fill: '#304D77', - // stroke: '#304D77', - // pickable: true - // }, - // _uid: 21, - // type: 'arc', - // children: [] - // }, - // { - // attribute: { - // visible: true, - // lineWidth: 0, - // fillOpacity: 1, - // padAngle: 0, - // x: 388, - // y: 238, - // startAngle: 4.492477494633405, - // endAngle: 4.71238898038469, - // outerRadius: 190.4, - // innerRadius: 0, - // cornerRadius: 0, - // fill: '#B48DEB', - // stroke: '#B48DEB', - // pickable: true - // }, - // _uid: 22, + // _uid: 55, // type: 'arc', // children: [] // } // ] + children: [ + { + attribute: { + visible: true, + lineWidth: 0, + fillOpacity: 1, + padAngle: 0, + x: 388, + y: 238, + startAngle: -1.5707963267948966, + endAngle: 1.357168026350791, + outerRadius: 190.4, + innerRadius: 0, + cornerRadius: 0, + fill: '#1664FF', + stroke: '#1664FF', + pickable: true + }, + _uid: 15, + type: 'arc', + children: [] + }, + { + attribute: { + visible: true, + lineWidth: 0, + fillOpacity: 1, + padAngle: 0, + x: 388, + y: 238, + startAngle: 1.357168026350791, + endAngle: 3.0988669935009723, + outerRadius: 190.4, + innerRadius: 0, + cornerRadius: 0, + fill: '#1AC6FF', + stroke: '#1AC6FF', + pickable: true + }, + _uid: 16, + type: 'arc', + children: [] + }, + { + attribute: { + visible: true, + lineWidth: 0, + fillOpacity: 1, + padAngle: 0, + x: 388, + y: 238, + startAngle: 3.0988669935009723, + endAngle: 3.609689958974673, + outerRadius: 190.4, + innerRadius: 0, + cornerRadius: 0, + fill: '#FF8A00', + stroke: '#FF8A00', + pickable: true + }, + _uid: 17, + type: 'arc', + children: [] + }, + { + attribute: { + visible: true, + lineWidth: 0, + fillOpacity: 1, + padAngle: 0, + x: 388, + y: 238, + startAngle: 3.609689958974673, + endAngle: 3.9238492243336522, + outerRadius: 190.4, + innerRadius: 0, + cornerRadius: 0, + fill: '#3CC780', + stroke: '#3CC780', + pickable: true + }, + _uid: 18, + type: 'arc', + children: [] + }, + { + attribute: { + visible: true, + lineWidth: 0, + fillOpacity: 1, + padAngle: 0, + x: 388, + y: 238, + startAngle: 3.9238492243336522, + endAngle: 4.151928850984271, + outerRadius: 190.4, + innerRadius: 0, + cornerRadius: 0, + fill: '#7442D4', + stroke: '#7442D4', + pickable: true + }, + _uid: 19, + type: 'arc', + children: [] + }, + { + attribute: { + visible: true, + lineWidth: 0, + fillOpacity: 1, + padAngle: 0, + x: 388, + y: 238, + startAngle: 4.151928850984271, + endAngle: 4.329742995177454, + outerRadius: 190.4, + innerRadius: 0, + cornerRadius: 0, + fill: '#FFC400', + stroke: '#FFC400', + pickable: true + }, + _uid: 20, + type: 'arc', + children: [] + }, + { + attribute: { + visible: true, + lineWidth: 0, + fillOpacity: 1, + padAngle: 0, + x: 388, + y: 238, + startAngle: 4.329742995177454, + endAngle: 4.492477494633405, + outerRadius: 190.4, + innerRadius: 0, + cornerRadius: 0, + fill: '#304D77', + stroke: '#304D77', + pickable: true + }, + _uid: 21, + type: 'arc', + children: [] + }, + { + attribute: { + visible: true, + lineWidth: 0, + fillOpacity: 1, + padAngle: 0, + x: 388, + y: 238, + startAngle: 4.492477494633405, + endAngle: 4.71238898038469, + outerRadius: 190.4, + innerRadius: 0, + cornerRadius: 0, + fill: '#B48DEB', + stroke: '#B48DEB', + pickable: true + }, + _uid: 22, + type: 'arc', + children: [] + } + ] }; return spec; }; @@ -398,8 +398,8 @@ function createContent(stage: Stage) { baseMarkGroupName: pieSpec.name, data: pieSpec.children.map((c, index) => { return { - // text: latestData[index].type, - text: originData[index].id + text: latestData[index].type + // text: originData[index].id // fill: c.attribute.fill, // line: { // stroke: c.attribute.stroke @@ -419,12 +419,14 @@ function createContent(stage: Stage) { height: 500, // position: 'outside', - position: 'inside', + // position: 'inside', textStyle: { angle: 0 }, + centerOffset: 10, + // smartInvert: false, // coverEnable: false, diff --git a/packages/vrender-components/src/label/arc.ts b/packages/vrender-components/src/label/arc.ts index ee3b548fd..8ecdd8020 100644 --- a/packages/vrender-components/src/label/arc.ts +++ b/packages/vrender-components/src/label/arc.ts @@ -152,10 +152,11 @@ export class ArcLabel extends LabelBase { this._arcLeft.clear(); this._arcRight.clear(); const { width, height } = attribute as ArcLabelAttrs; + const centerOffset = (attribute as ArcLabelAttrs)?.centerOffset ?? 0; currentMarks.forEach((currentMark, index) => { const graphicAttribute = currentMark.attribute as IArcGraphicAttribute; const radiusRatio = this.computeLayoutOuterRadius(graphicAttribute.outerRadius, width, height); - const radius = this.computeRadius(radiusRatio, width, height); + const radius = this.computeRadius(radiusRatio, width, height, centerOffset); const center = { x: graphicAttribute?.x ?? 0, y: graphicAttribute?.y ?? 0 }; const item = data[index]; @@ -180,7 +181,7 @@ export class ArcLabel extends LabelBase { arc.pointA = circlePoint( (center as IPoint).x, (center as IPoint).y, - this.computeDatumRadius(center.x * 2, center.y * 2, graphicAttribute.outerRadius), + this.computeDatumRadius(center.x * 2, center.y * 2, graphicAttribute.outerRadius, centerOffset), arc.middleAngle ); @@ -215,6 +216,7 @@ export class ArcLabel extends LabelBase { */ private _layoutInsideLabels(arcs: ArcInfo[], attribute: any, currentMarks: any[]) { const center = { x: currentMarks[0].attribute?.x ?? 0, y: currentMarks[0].attribute?.y ?? 0 }; + const centerOffset = (attribute as ArcLabelAttrs)?.centerOffset ?? 0; const innerRadiusRatio = this.computeLayoutOuterRadius( currentMarks[0].attribute.innerRadius, attribute.width, @@ -230,8 +232,8 @@ export class ArcLabel extends LabelBase { arcs.forEach((arc: ArcInfo) => { const { labelSize, radian } = arc; - const innerRadius = this.computeRadius(innerRadiusRatio, attribute.width, attribute.height, 1); - const outerRadius = this.computeRadius(outerRadiusRatio, attribute.width, attribute.height, 1); + const innerRadius = this.computeRadius(innerRadiusRatio, attribute.width, attribute.height, centerOffset, 1); + const outerRadius = this.computeRadius(outerRadiusRatio, attribute.width, attribute.height, centerOffset, 1); const minRadian = connectLineRadian(outerRadius, labelSize.height); let limit; if (radian < minRadian) { @@ -355,6 +357,7 @@ export class ArcLabel extends LabelBase { */ private _computeX(arc: ArcInfo, attribute: any, currentMarks: any[]) { const center = { x: currentMarks[0].attribute?.x ?? 0, y: currentMarks[0].attribute?.y ?? 0 }; + const centerOffset = (attribute as ArcLabelAttrs)?.centerOffset ?? 0; const plotLayout = { width: center.x * 2, height: center.y * 2 }; const radiusRatio = this.computeLayoutOuterRadius( currentMarks[0].attribute.outerRadius, @@ -374,7 +377,7 @@ export class ArcLabel extends LabelBase { labelPosition.x = NaN; arc.labelLimit = 0; } - const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height); + const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height, centerOffset); const flag = isQuadrantLeft(quadrant) ? -1 : 1; let cx: number = 0; const restWidth = flag > 0 ? plotLayout.width - pointB.x : pointB.x; @@ -634,7 +637,8 @@ export class ArcLabel extends LabelBase { }; } else { const center = { x: currentMarks[0].attribute?.x ?? 0, y: currentMarks[0].attribute?.y ?? 0 }; - const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height); + const centerOffset = (attribute as ArcLabelAttrs)?.centerOffset ?? 0; + const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height, centerOffset); const { labelPosition, quadrant } = arc; const outerR = Math.max(radius + line1MinLength, currentMarks[0].attribute.outerRadius); const rd = r - outerR; @@ -677,8 +681,9 @@ export class ArcLabel extends LabelBase { const line1MinLength = attribute.line.line1MinLength as number; const { width, height } = plotRect; + const centerOffset = (attribute as ArcLabelAttrs)?.centerOffset ?? 0; - const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height); + const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height, centerOffset); // 出现 y 方向挤压过度必然是由于画布上下某一端被占满,此时半径是确定的 const r = this._computeLayoutRadius(height / 2, attribute, currentMarks); // 所有坐标转化到以圆心为原点的坐标系计算 @@ -748,7 +753,8 @@ export class ArcLabel extends LabelBase { attribute.width, attribute.height ); - const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height); + const centerOffset = (attribute as ArcLabelAttrs)?.centerOffset ?? 0; + const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height, centerOffset); const outerR = radius + line1MinLength; const a = outerR - layoutArcGap; @@ -838,8 +844,10 @@ export class ArcLabel extends LabelBase { } } - protected computeRadius(r: number, width?: number, height?: number, k?: number): number { - return this.computeLayoutRadius(width ? width : 0, height ? height : 0) * r * (isNil(k) ? 1 : k); + protected computeRadius(r: number, width?: number, height?: number, centerOffset?: number, k?: number): number { + return ( + this.computeLayoutRadius(width ? width : 0, height ? height : 0) * r * (isNil(k) ? 1 : k) + centerOffset ?? 0 + ); } protected computeLayoutRadius(width: number, height: number) { @@ -850,8 +858,8 @@ export class ArcLabel extends LabelBase { return r / (Math.min(width, height) / 2); } - private computeDatumRadius(width?: number, height?: number, outerRadius?: any): number { + private computeDatumRadius(width?: number, height?: number, outerRadius?: any, centerOffset?: number): number { const outerRadiusRatio = this.computeLayoutOuterRadius(outerRadius, width, height); //this.getRadius(state) - return this.computeLayoutRadius(width ? width : 0, height ? height : 0) * outerRadiusRatio; + return this.computeLayoutRadius(width ? width : 0, height ? height : 0) * outerRadiusRatio + centerOffset ?? 0; } } diff --git a/packages/vrender-components/src/label/type.ts b/packages/vrender-components/src/label/type.ts index 80d38f8af..354baea27 100644 --- a/packages/vrender-components/src/label/type.ts +++ b/packages/vrender-components/src/label/type.ts @@ -283,6 +283,8 @@ export interface ArcLabelAttrs extends BaseLabelAttrs { layout?: IArcLabelLayoutSpec; /** 标签引导线点集 */ points?: IPoint[]; + /** 饼图扇区中心偏移 */ + centerOffset?: number; } export interface IArcLabelLineSpec { From 44623c06a7bb43a4e088ebb8acc7ba08a018d819 Mon Sep 17 00:00:00 2001 From: pairone <1063258712@qq.com> Date: Tue, 15 Aug 2023 16:10:45 +0800 Subject: [PATCH 17/35] feat: support config labelLine lineWidth --- packages/vrender-components/src/label/base.ts | 2 +- packages/vrender-components/src/label/type.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/vrender-components/src/label/base.ts b/packages/vrender-components/src/label/base.ts index aaec0224b..c73543907 100644 --- a/packages/vrender-components/src/label/base.ts +++ b/packages/vrender-components/src/label/base.ts @@ -462,7 +462,7 @@ export abstract class LabelBase extends AbstractCompon ? (createLine({ visible: text.attribute?.visible ?? true, stroke: (text.attribute as ArcLabelAttrs)?.line?.stroke ?? text.attribute?.fill, - lineWidth: 1, + lineWidth: (text.attribute as ArcLabelAttrs)?.line?.lineWidth ?? 1, points: (text.attribute as ArcLabelAttrs)?.points }) as Line) : undefined; diff --git a/packages/vrender-components/src/label/type.ts b/packages/vrender-components/src/label/type.ts index 354baea27..60b5b9011 100644 --- a/packages/vrender-components/src/label/type.ts +++ b/packages/vrender-components/src/label/type.ts @@ -288,6 +288,9 @@ export interface ArcLabelAttrs extends BaseLabelAttrs { } export interface IArcLabelLineSpec { + /** 引导线线宽 */ + lineWidth?: number; + /** 引导线颜色 */ stroke?: string; /** * 是否显示引导线 From 1e28a16a15d0fb971c6b88f6c25442354d81357c Mon Sep 17 00:00:00 2001 From: pairone <1063258712@qq.com> Date: Tue, 15 Aug 2023 17:01:05 +0800 Subject: [PATCH 18/35] fix: the arc label with the same name is only rendered once --- .../__tests__/browser/examples/label-arc.ts | 5 +++-- packages/vrender-components/src/label/base.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/vrender-components/__tests__/browser/examples/label-arc.ts b/packages/vrender-components/__tests__/browser/examples/label-arc.ts index 436e389a4..12a0ddf62 100644 --- a/packages/vrender-components/__tests__/browser/examples/label-arc.ts +++ b/packages/vrender-components/__tests__/browser/examples/label-arc.ts @@ -398,7 +398,8 @@ function createContent(stage: Stage) { baseMarkGroupName: pieSpec.name, data: pieSpec.children.map((c, index) => { return { - text: latestData[index].type + text: 'test' + // text: latestData[index].type // text: originData[index].id // fill: c.attribute.fill, // line: { @@ -425,7 +426,7 @@ function createContent(stage: Stage) { angle: 0 }, - centerOffset: 10, + // centerOffset: 10, // smartInvert: false, diff --git a/packages/vrender-components/src/label/base.ts b/packages/vrender-components/src/label/base.ts index c73543907..93546bd55 100644 --- a/packages/vrender-components/src/label/base.ts +++ b/packages/vrender-components/src/label/base.ts @@ -266,7 +266,7 @@ export abstract class LabelBase extends AbstractCompon ); for (let i = 0; i < data.length; i++) { const textData = data[i]; - const basedArc = arcs.find(arc => arc.labelText === textData.text); + const basedArc = arcs.find(arc => arc.refDatum.id === textData.id); const labelAttribute = { visible: basedArc.labelVisible, x: basedArc.labelPosition.x, From 1aec786c9bfcc28d19fbed333ce2d052a4b4ead8 Mon Sep 17 00:00:00 2001 From: pairone <1063258712@qq.com> Date: Tue, 15 Aug 2023 17:36:45 +0800 Subject: [PATCH 19/35] feat: support edge layout --- .../__tests__/browser/examples/label-arc.ts | 13 ++++++++++--- packages/vrender-components/src/label/arc.ts | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/vrender-components/__tests__/browser/examples/label-arc.ts b/packages/vrender-components/__tests__/browser/examples/label-arc.ts index 12a0ddf62..dc4ccbdfd 100644 --- a/packages/vrender-components/__tests__/browser/examples/label-arc.ts +++ b/packages/vrender-components/__tests__/browser/examples/label-arc.ts @@ -398,8 +398,8 @@ function createContent(stage: Stage) { baseMarkGroupName: pieSpec.name, data: pieSpec.children.map((c, index) => { return { - text: 'test' - // text: latestData[index].type + // text: 'test' + text: latestData[index].type // text: originData[index].id // fill: c.attribute.fill, // line: { @@ -423,7 +423,14 @@ function createContent(stage: Stage) { // position: 'inside', textStyle: { - angle: 0 + // angle: 0 + fontSize: 16 + }, + line: { + line1MinLength: 30 + }, + layout: { + align: 'edge' }, // centerOffset: 10, diff --git a/packages/vrender-components/src/label/arc.ts b/packages/vrender-components/src/label/arc.ts index 8ecdd8020..9a264c93a 100644 --- a/packages/vrender-components/src/label/arc.ts +++ b/packages/vrender-components/src/label/arc.ts @@ -408,7 +408,7 @@ export class ArcLabel extends LabelBase { // const alignOffset = this._computeAlignOffset(align, labelWidth, -flag); const alignOffset = 0; // 贴近画布边缘的布局结果可能会由于 cx 的小数 pixel 导致被部分裁剪,因此额外做计算 - labelPosition.x = flag > 0 ? plotLayout.width + alignOffset : alignOffset; + labelPosition.x = (flag > 0 ? plotLayout.width + alignOffset : alignOffset) - flag * (0.5 * arc.labelSize.width); } else { // const alignOffset = this._computeAlignOffset(align, labelWidth, flag); const alignOffset = 0; From 197efaea0eb6be3c3f7c5701dc075af219ffc34b Mon Sep 17 00:00:00 2001 From: kkxxkk2019 Date: Tue, 15 Aug 2023 18:44:13 +0800 Subject: [PATCH 20/35] fix(vrender-components): label shoud omit automaticly when label's width exceeds item's width, relate https://github.com/VisActor/VChart/issues/505 --- .../__tests__/unit/legend/discrete.test.ts | 279 +++++++++++++++++- .../src/legend/discrete/discrete.ts | 35 ++- 2 files changed, 302 insertions(+), 12 deletions(-) diff --git a/packages/vrender-components/__tests__/unit/legend/discrete.test.ts b/packages/vrender-components/__tests__/unit/legend/discrete.test.ts index 0521f0e67..9e139357d 100644 --- a/packages/vrender-components/__tests__/unit/legend/discrete.test.ts +++ b/packages/vrender-components/__tests__/unit/legend/discrete.test.ts @@ -1,4 +1,5 @@ -import type { IGraphic, Stage } from '@visactor/vrender'; +import { expect } from 'vitest'; +import type { IGraphic, IGroup, IText, Stage } from '@visactor/vrender'; import { DiscreteLegend } from '../../../src'; import { createCanvas } from '../../util/dom'; import { createStage } from '../../util/vrender'; @@ -227,4 +228,280 @@ describe('DiscreteLegend', () => { expect(legend.AABBBounds.width()).toBe(76); }); + + it("should omit when label's width exceeds item's width", () => { + const legend = new DiscreteLegend({ + layout: 'vertical', + title: { + align: 'start', + space: 12, + textStyle: { + fontSize: 12, + fontWeight: 'bold', + fill: '#2C3542' + } + }, + item: { + spaceCol: 10, + spaceRow: 10, + shape: { + space: 4, + style: { + size: 10, + cursor: 'pointer' + }, + state: { + selectedHover: { + opacity: 0.85 + }, + unSelected: { + fill: '#D8D8D8', + fillOpacity: 0.5 + } + } + }, + label: { + space: 4, + style: { + fontSize: 12, + fill: '#89909D', + cursor: 'pointer' + }, + state: { + selectedHover: { + opacity: 0.85 + }, + unSelected: { + fill: '#D8D8D8', + fillOpacity: 0.5 + } + } + }, + value: { + alignRight: true, + style: { + fontSize: 10, + fill: '#333', + cursor: 'pointer', + fillOpacity: 0.8 + }, + state: { + selectedHover: { + opacity: 0.85 + }, + unSelected: { + fill: '#D8D8D8' + }, + unselected: { + fill: '#d8d8d8' + } + } + }, + background: { + style: { + cursor: 'pointer' + }, + state: { + selectedHover: { + fill: 'gray', + fillOpacity: 0.7 + }, + unSelectedHover: { + fill: 'gray', + fillOpacity: 0.2 + } + } + }, + focus: false, + focusIconStyle: { + size: 10, + symbolType: + 'M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z', + fill: '#333', + cursor: 'pointer' + }, + visible: true, + padding: 2, + width: 121.95 + }, + autoPage: true, + pager: { + space: 12, + handler: { + style: { + size: 10 + }, + space: 4 + } + }, + hover: true, + select: true, + selectMode: 'multiple', + allowAllCanceled: false, + items: [ + { + label: 'OneOneOneOneOne', + shape: { + fill: '#1664FF', + symbolType: 'square', + stroke: null, + fillOpacity: 1, + strokeOpacity: 1, + opacity: 1, + texture: null, + texturePadding: null, + textureSize: null, + textureColor: null, + innerBorder: null, + outerBorder: null + }, + value: '26.32%', + id: 'OneOneOneOneOne', + index: 0 + }, + { + label: 'Two', + shape: { + fill: '#1AC6FF', + symbolType: 'square', + stroke: null, + fillOpacity: 1, + strokeOpacity: 1, + opacity: 1, + texture: null, + texturePadding: null, + textureSize: null, + textureColor: null, + innerBorder: null, + outerBorder: null + }, + value: '23.68%', + id: 'Two', + index: 1 + }, + { + label: 'Three', + shape: { + fill: '#FF8A00', + symbolType: 'square', + stroke: null, + fillOpacity: 1, + strokeOpacity: 1, + opacity: 1, + texture: null, + texturePadding: null, + textureSize: null, + textureColor: null, + innerBorder: null, + outerBorder: null + }, + value: '15.79%', + id: 'Three', + index: 2 + }, + { + label: 'Four', + shape: { + fill: '#3CC780', + symbolType: 'square', + stroke: null, + fillOpacity: 1, + strokeOpacity: 1, + opacity: 1, + texture: null, + texturePadding: null, + textureSize: null, + textureColor: null, + innerBorder: null, + outerBorder: null + }, + value: '13.16%', + id: 'Four', + index: 3 + }, + { + label: 'Five', + shape: { + fill: '#7442D4', + symbolType: 'square', + stroke: null, + fillOpacity: 1, + strokeOpacity: 1, + opacity: 1, + texture: null, + texturePadding: null, + textureSize: null, + textureColor: null, + innerBorder: null, + outerBorder: null + }, + value: '10.53%', + id: 'Five', + index: 4 + }, + { + label: 'Six', + shape: { + fill: '#FFC400', + symbolType: 'square', + stroke: null, + fillOpacity: 1, + strokeOpacity: 1, + opacity: 1, + texture: null, + texturePadding: null, + textureSize: null, + textureColor: null, + innerBorder: null, + outerBorder: null + }, + value: '7.89%', + id: 'Six', + index: 5 + }, + { + label: 'Seven', + shape: { + fill: '#304D77', + symbolType: 'square', + stroke: null, + fillOpacity: 1, + strokeOpacity: 1, + opacity: 1, + texture: null, + texturePadding: null, + textureSize: null, + textureColor: null, + innerBorder: null, + outerBorder: null + }, + value: '2.63%', + id: 'Seven', + index: 6 + } + ], + zIndex: 500, + maxWidth: 813, + maxHeight: 416, + defaultSelected: ['OneOneOneOneOne', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven'], + width: 147.6698455810547, + height: 186, + dx: 0, + dy: 0, + x: 100, + y: 42 + }); + + stage.defaultLayer.add(legend as unknown as IGraphic); + stage.render(); + + expect((legend.getElementsByName('legendItem')[0] as IGroup).AABBBounds.width()).toBe(121.95); + expect( + (legend.getElementsByName('legendItem')[0].getElementsByName('legendItemLabel')[0] as IText)._AABBBounds.width() + ).toBeCloseTo(57.143951416015625); + expect( + (legend.getElementsByName('legendItem')[0].getElementsByName('legendItemValue')[0] as IText).attribute + .maxLineWidth + ).toBeUndefined(); + }); }); diff --git a/packages/vrender-components/src/legend/discrete/discrete.ts b/packages/vrender-components/src/legend/discrete/discrete.ts index 9cd001bc9..749bfe9df 100644 --- a/packages/vrender-components/src/legend/discrete/discrete.ts +++ b/packages/vrender-components/src/legend/discrete/discrete.ts @@ -435,18 +435,31 @@ export class DiscreteLegend extends LegendBase { valueShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected); if (this._itemWidthByUser) { - valueShape.setAttribute( - 'maxLineWidth', + // 计算用来防止文本的宽度 + const layoutWidth = this._itemWidthByUser - - parsedPadding[1] - - parsedPadding[3] - - shapeSize - - shapeSpace - - labelShape.AABBBounds.width() - - labelSpace - - focusSpace - - valueSpace - ); + parsedPadding[1] - + parsedPadding[3] - + shapeSize - + shapeSpace - + labelSpace - + focusSpace - + valueSpace; + const valueBounds = valueShape.AABBBounds; + const labelBounds = labelShape.AABBBounds; + const valueWidth = valueBounds.width(); + const labelWidth = labelBounds.width(); + if (valueWidth + labelWidth > layoutWidth) { + if ((layoutWidth - valueWidth) / labelWidth > 0.4) { + // 设置一个值,如果剩余的宽度和 label 自身的比例不低于 0.4 的话,优先展示全 label + labelShape.setAttribute('maxLineWidth', layoutWidth - valueWidth); + } else { + valueShape.setAttribute('maxLineWidth', layoutWidth * 0.5); + labelShape.setAttribute('maxLineWidth', layoutWidth * 0.5); + } + } else { + valueShape.setAttribute('maxLineWidth', layoutWidth - labelWidth); + } if (valueAttr.alignRight) { valueShape.setAttributes({ // @ts-ignore From eff0c871ded6204b942b458f6a00642d193f4294 Mon Sep 17 00:00:00 2001 From: kkxxkk2019 Date: Tue, 15 Aug 2023 18:44:43 +0800 Subject: [PATCH 21/35] chore: update rush change --- .../fix-components-bugs_2023-08-15-10-44.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 common/changes/@visactor/vrender-components/fix-components-bugs_2023-08-15-10-44.json diff --git a/common/changes/@visactor/vrender-components/fix-components-bugs_2023-08-15-10-44.json b/common/changes/@visactor/vrender-components/fix-components-bugs_2023-08-15-10-44.json new file mode 100644 index 000000000..a4dbfb891 --- /dev/null +++ b/common/changes/@visactor/vrender-components/fix-components-bugs_2023-08-15-10-44.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender-components", + "comment": "fix: label shoud omit automaticly when label's width exceeds item's width, relate https://github.com/VisActor/VChart/issues/505", + "type": "patch" + } + ], + "packageName": "@visactor/vrender-components" +} \ No newline at end of file From 525c6b056b8f9f09bbcdd03c6d526b262238e7ef Mon Sep 17 00:00:00 2001 From: kkxxkk2019 Date: Tue, 15 Aug 2023 18:47:33 +0800 Subject: [PATCH 22/35] test: fix the type error of test case --- .../__tests__/unit/legend/discrete.test.ts | 93 ++----------------- 1 file changed, 7 insertions(+), 86 deletions(-) diff --git a/packages/vrender-components/__tests__/unit/legend/discrete.test.ts b/packages/vrender-components/__tests__/unit/legend/discrete.test.ts index 9e139357d..b44f04fc9 100644 --- a/packages/vrender-components/__tests__/unit/legend/discrete.test.ts +++ b/packages/vrender-components/__tests__/unit/legend/discrete.test.ts @@ -1,4 +1,3 @@ -import { expect } from 'vitest'; import type { IGraphic, IGroup, IText, Stage } from '@visactor/vrender'; import { DiscreteLegend } from '../../../src'; import { createCanvas } from '../../util/dom'; @@ -312,14 +311,6 @@ describe('DiscreteLegend', () => { } } }, - focus: false, - focusIconStyle: { - size: 10, - symbolType: - 'M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z', - fill: '#333', - cursor: 'pointer' - }, visible: true, padding: 2, width: 121.95 @@ -343,17 +334,7 @@ describe('DiscreteLegend', () => { label: 'OneOneOneOneOne', shape: { fill: '#1664FF', - symbolType: 'square', - stroke: null, - fillOpacity: 1, - strokeOpacity: 1, - opacity: 1, - texture: null, - texturePadding: null, - textureSize: null, - textureColor: null, - innerBorder: null, - outerBorder: null + symbolType: 'square' }, value: '26.32%', id: 'OneOneOneOneOne', @@ -363,17 +344,7 @@ describe('DiscreteLegend', () => { label: 'Two', shape: { fill: '#1AC6FF', - symbolType: 'square', - stroke: null, - fillOpacity: 1, - strokeOpacity: 1, - opacity: 1, - texture: null, - texturePadding: null, - textureSize: null, - textureColor: null, - innerBorder: null, - outerBorder: null + symbolType: 'square' }, value: '23.68%', id: 'Two', @@ -383,17 +354,7 @@ describe('DiscreteLegend', () => { label: 'Three', shape: { fill: '#FF8A00', - symbolType: 'square', - stroke: null, - fillOpacity: 1, - strokeOpacity: 1, - opacity: 1, - texture: null, - texturePadding: null, - textureSize: null, - textureColor: null, - innerBorder: null, - outerBorder: null + symbolType: 'square' }, value: '15.79%', id: 'Three', @@ -403,17 +364,7 @@ describe('DiscreteLegend', () => { label: 'Four', shape: { fill: '#3CC780', - symbolType: 'square', - stroke: null, - fillOpacity: 1, - strokeOpacity: 1, - opacity: 1, - texture: null, - texturePadding: null, - textureSize: null, - textureColor: null, - innerBorder: null, - outerBorder: null + symbolType: 'square' }, value: '13.16%', id: 'Four', @@ -423,17 +374,7 @@ describe('DiscreteLegend', () => { label: 'Five', shape: { fill: '#7442D4', - symbolType: 'square', - stroke: null, - fillOpacity: 1, - strokeOpacity: 1, - opacity: 1, - texture: null, - texturePadding: null, - textureSize: null, - textureColor: null, - innerBorder: null, - outerBorder: null + symbolType: 'square' }, value: '10.53%', id: 'Five', @@ -443,17 +384,7 @@ describe('DiscreteLegend', () => { label: 'Six', shape: { fill: '#FFC400', - symbolType: 'square', - stroke: null, - fillOpacity: 1, - strokeOpacity: 1, - opacity: 1, - texture: null, - texturePadding: null, - textureSize: null, - textureColor: null, - innerBorder: null, - outerBorder: null + symbolType: 'square' }, value: '7.89%', id: 'Six', @@ -463,17 +394,7 @@ describe('DiscreteLegend', () => { label: 'Seven', shape: { fill: '#304D77', - symbolType: 'square', - stroke: null, - fillOpacity: 1, - strokeOpacity: 1, - opacity: 1, - texture: null, - texturePadding: null, - textureSize: null, - textureColor: null, - innerBorder: null, - outerBorder: null + symbolType: 'square' }, value: '2.63%', id: 'Seven', From 85b25319e70eeda5275ac58727d584ccaacb6946 Mon Sep 17 00:00:00 2001 From: zhouxinyu Date: Tue, 15 Aug 2023 19:23:54 +0800 Subject: [PATCH 23/35] fix: fix the issue with arc conical color after configuring cap, closed #455 --- .../fix-arc-conical-cap_2023-08-15-11-24.json | 10 ++++ docs/demos/src/pages/arc.ts | 58 ++++++++++--------- packages/vrender/src/graphic/arc.ts | 4 +- packages/vrender/src/interface/graphic/arc.ts | 2 +- .../render/contributions/render/arc-render.ts | 25 +++++++- 5 files changed, 66 insertions(+), 33 deletions(-) create mode 100644 common/changes/@visactor/vrender/fix-arc-conical-cap_2023-08-15-11-24.json diff --git a/common/changes/@visactor/vrender/fix-arc-conical-cap_2023-08-15-11-24.json b/common/changes/@visactor/vrender/fix-arc-conical-cap_2023-08-15-11-24.json new file mode 100644 index 000000000..573127d36 --- /dev/null +++ b/common/changes/@visactor/vrender/fix-arc-conical-cap_2023-08-15-11-24.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender", + "comment": "fix: fix the issue with arc conical color after configuring cap, closed #455", + "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 cf6a6e412..fcb88836a 100644 --- a/docs/demos/src/pages/arc.ts +++ b/docs/demos/src/pages/arc.ts @@ -140,34 +140,36 @@ export const page = () => { // cap: false // })); - // graphics.push(createArc({ - // innerRadius: 60, - // outerRadius: 137.8, - // startAngle: 0, - // endAngle: Math.PI * 2, - // x: 200, - // y: 500, - // stroke: 'green', - // lineWidth: 2, - // fill: { - // x: 0.5, - // y: 0.5, - // startAngle: 0, - // endAngle: 6.283185307179586, - // stops: [ - // { offset: 0, color: 'red' }, - // { offset: 0.2, color: 'blue' }, - // { offset: 0.4, color: 'orange' }, - // { offset: 0.6, color: 'pink' }, - // { offset: 0.8, color: 'green' }, - // { offset: 1, color: 'purple' } - // ], - // gradient: 'conical' - // }, - // cap: [false, true], - // cornerRadius: 26, - // forceShowCap: true - // })); + graphics.push( + createArc({ + innerRadius: 60, + outerRadius: 137.8, + startAngle: 0, + endAngle: Math.PI * 2, + x: 200, + y: 500, + stroke: 'green', + lineWidth: 2, + fill: { + x: 0.5, + y: 0.5, + startAngle: 0, + endAngle: 6.283185307179586, + stops: [ + { offset: 0, color: 'red' }, + { offset: 0.2, color: 'blue' }, + { offset: 0.4, color: 'orange' }, + { offset: 0.6, color: 'pink' }, + { offset: 0.8, color: 'green' }, + { offset: 1, color: 'purple' } + ], + gradient: 'conical' + }, + cap: [true, true], + cornerRadius: 26, + forceShowCap: true + }) + ); const stage = createStage({ canvas: 'main', diff --git a/packages/vrender/src/graphic/arc.ts b/packages/vrender/src/graphic/arc.ts index 4ccbe503c..7543ad0d2 100644 --- a/packages/vrender/src/graphic/arc.ts +++ b/packages/vrender/src/graphic/arc.ts @@ -146,7 +146,9 @@ export class Arc extends Graphic implements IArc { if (capWidth > epsilon && outerRadius > epsilon) { return { startAngle: startAngle - sign * capAngle * startCap, - endAngle: endAngle + sign * capAngle * endCap + endAngle: endAngle + sign * capAngle * endCap, + sc: sign * capAngle * startCap, + ec: sign * capAngle * endCap }; } } diff --git a/packages/vrender/src/interface/graphic/arc.ts b/packages/vrender/src/interface/graphic/arc.ts index 4988901de..367ac8175 100644 --- a/packages/vrender/src/interface/graphic/arc.ts +++ b/packages/vrender/src/interface/graphic/arc.ts @@ -71,7 +71,7 @@ export interface IArc extends IGraphic { cache?: ICustomPath2D; getParsedCornerRadius: () => number; - getParsedAngle: () => { startAngle: number; endAngle: number }; + getParsedAngle: () => { startAngle: number; endAngle: number; sc?: number; ec?: number }; getParsePadAngle: ( startAngle: number, endAngle: number diff --git a/packages/vrender/src/render/contributions/render/arc-render.ts b/packages/vrender/src/render/contributions/render/arc-render.ts index 0c5aa6574..d031673a6 100644 --- a/packages/vrender/src/render/contributions/render/arc-render.ts +++ b/packages/vrender/src/render/contributions/render/arc-render.ts @@ -1,4 +1,4 @@ -import { abs, acos, atan2, cos, epsilon, min, pi, sin, sqrt, pi2 } from '@visactor/vutils'; +import { abs, acos, atan2, cos, epsilon, min, pi, sin, sqrt, pi2, isBoolean } from '@visactor/vutils'; import { inject, injectable, named } from 'inversify'; import { getTheme } from '../../../graphic/theme'; import { parseStroke } from '../../../common/utils'; @@ -17,7 +17,8 @@ import type { IRenderService, IGraphicRender, IGraphicRenderDrawParams, - IContributionProvider + IContributionProvider, + IConicalGradient } from '../../../interface'; import { cornerTangents, @@ -271,6 +272,19 @@ export class DefaultCanvasArcRender implements IGraphicRender { cap = arcAttribute.cap, forceShowCap = arcAttribute.forceShowCap } = arc.attribute; + // 判断是否是环形渐变,且有头部cap,那就偏移渐变色角度 + let conicalOffset = 0; + const tempChangeConicalColor = + ((isBoolean(cap) && cap) || cap[0]) && (fill as IGradientColor).gradient === 'conical'; + if (tempChangeConicalColor) { + const { sc, startAngle, endAngle } = arc.getParsedAngle(); + if (abs(endAngle - startAngle) < pi2 - epsilon) { + conicalOffset = sc || 0; + (fill as IConicalGradient).startAngle -= conicalOffset; + (fill as IConicalGradient).endAngle -= conicalOffset; + } + } + let beforeRenderContribitionsRuned = false; const { isFullStroke, stroke: arrayStroke } = parseStroke(stroke); if (doFill || isFullStroke) { @@ -388,7 +402,7 @@ export class DefaultCanvasArcRender implements IGraphicRender { } // 绘制cap - if (cap && forceShowCap) { + if (((isBoolean(cap) && cap) || cap[1]) && forceShowCap) { const { startAngle: sa, endAngle: ea } = arc.getParsedAngle(); const deltaAngle = abs(ea - sa); if (deltaAngle >= pi2 - epsilon) { @@ -476,6 +490,11 @@ export class DefaultCanvasArcRender implements IGraphicRender { strokeCb ); }); + + if (tempChangeConicalColor) { + (fill as IConicalGradient).startAngle += conicalOffset; + (fill as IConicalGradient).endAngle += conicalOffset; + } } draw(arc: IArc, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) { From b0eb70903442480525c651c4222f8e526e024d84 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Tue, 15 Aug 2023 18:36:10 +0800 Subject: [PATCH 24/35] feat: add legendItemAttributeUpdate event in legend --- ...date-attribute-event_2023-08-15-10-36.json | 10 +++++ .../vrender-components/src/legend/constant.ts | 3 +- .../src/legend/discrete/discrete.ts | 38 ++++++++++++++++++- 3 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 common/changes/@visactor/vrender-components/feat-legend-update-attribute-event_2023-08-15-10-36.json diff --git a/common/changes/@visactor/vrender-components/feat-legend-update-attribute-event_2023-08-15-10-36.json b/common/changes/@visactor/vrender-components/feat-legend-update-attribute-event_2023-08-15-10-36.json new file mode 100644 index 000000000..a89c559ca --- /dev/null +++ b/common/changes/@visactor/vrender-components/feat-legend-update-attribute-event_2023-08-15-10-36.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender-components", + "comment": "feat: add legendItemAttributeUpdate event in legend", + "type": "patch" + } + ], + "packageName": "@visactor/vrender-components" +} \ No newline at end of file diff --git a/packages/vrender-components/src/legend/constant.ts b/packages/vrender-components/src/legend/constant.ts index 93f833421..72bafe6f8 100644 --- a/packages/vrender-components/src/legend/constant.ts +++ b/packages/vrender-components/src/legend/constant.ts @@ -18,7 +18,8 @@ export enum LegendStateValue { export enum LegendEvent { legendItemHover = 'legendItemHover', legendItemUnHover = 'legendItemUnHover', - legendItemClick = 'legendItemClick' + legendItemClick = 'legendItemClick', + legendItemAttributeUpdate = 'legendItemAttributeUpdate' } export enum LEGEND_ELEMENT_NAME { diff --git a/packages/vrender-components/src/legend/discrete/discrete.ts b/packages/vrender-components/src/legend/discrete/discrete.ts index 9cd001bc9..85f9c1ef9 100644 --- a/packages/vrender-components/src/legend/discrete/discrete.ts +++ b/packages/vrender-components/src/legend/discrete/discrete.ts @@ -678,12 +678,25 @@ export class DiscreteLegend extends LegendBase { // @ts-ignore const legendItem = target.delegate; + let attributeUpdate = false; + if ( + legendItem.hasState(LegendStateValue.unSelectedHover) || + legendItem.hasState(LegendStateValue.selectedHover) + ) { + attributeUpdate = true; + } legendItem.removeState(LegendStateValue.unSelectedHover); legendItem.removeState(LegendStateValue.selectedHover); legendItem .getChildren()[0] .getChildren() .forEach((child: any) => { + if ( + !attributeUpdate && + (child.hasState(LegendStateValue.unSelectedHover) || child.hasState(LegendStateValue.selectedHover)) + ) { + attributeUpdate = true; + } (child as unknown as IGraphic).removeState(LegendStateValue.unSelectedHover); (child as unknown as IGraphic).removeState(LegendStateValue.selectedHover); }); @@ -696,6 +709,9 @@ export class DiscreteLegend extends LegendBase { focusButton.setAttribute('visible', false); } + if (attributeUpdate) { + this._dispatchEvent(LegendEvent.legendItemAttributeUpdate, legendItem); + } this._dispatchEvent(LegendEvent.legendItemUnHover, legendItem); } }; @@ -781,20 +797,34 @@ export class DiscreteLegend extends LegendBase { }; private _setLegendItemState(legendItem: IGroup, stateName: string, keepCurrentStates = true) { + let attributeUpdate = false; + if (!legendItem.hasState(stateName)) { + attributeUpdate = true; + } legendItem.addState(stateName, keepCurrentStates); // TODO: 这个比较 hack legendItem .getChildren()[0] .getChildren() - .forEach(child => { + .forEach((child: IGraphic) => { if (child.name !== LEGEND_ELEMENT_NAME.focus) { + if (!attributeUpdate && !child.hasState(stateName)) { + attributeUpdate = true; + } (child as unknown as IGraphic).addState(stateName, keepCurrentStates); } }); + if (attributeUpdate) { + this._dispatchEvent(LegendEvent.legendItemAttributeUpdate, legendItem); + } } private _removeLegendItemState(legendItem: IGroup, stateNames: string[]) { + let attributeUpdate = false; stateNames.forEach(name => { + if (!attributeUpdate && legendItem.hasState(name)) { + attributeUpdate = true; + } legendItem.removeState(name); }); // TODO: 这个比较 hack @@ -804,10 +834,16 @@ export class DiscreteLegend extends LegendBase { .forEach(child => { if (child.name !== LEGEND_ELEMENT_NAME.focus) { stateNames.forEach(name => { + if (!attributeUpdate && (child as unknown as IGraphic).hasState(name)) { + attributeUpdate = true; + } (child as unknown as IGraphic).removeState(name); }); } }); + if (attributeUpdate) { + this._dispatchEvent(LegendEvent.legendItemAttributeUpdate, legendItem); + } } // 获取当前选中的图例项 From 715f5af8b4cbe26dfe291254a8b45d238ce88ce2 Mon Sep 17 00:00:00 2001 From: pairone <1063258712@qq.com> Date: Tue, 15 Aug 2023 21:19:36 +0800 Subject: [PATCH 25/35] feat: limit when the text exceeds the maximum width of the label --- .../__tests__/browser/examples/label-arc.ts | 4 ++-- packages/vrender-components/src/label/arc.ts | 12 +++++++----- packages/vrender-components/src/label/base.ts | 14 ++++++++++++-- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/packages/vrender-components/__tests__/browser/examples/label-arc.ts b/packages/vrender-components/__tests__/browser/examples/label-arc.ts index dc4ccbdfd..e26cf650b 100644 --- a/packages/vrender-components/__tests__/browser/examples/label-arc.ts +++ b/packages/vrender-components/__tests__/browser/examples/label-arc.ts @@ -398,8 +398,8 @@ function createContent(stage: Stage) { baseMarkGroupName: pieSpec.name, data: pieSpec.children.map((c, index) => { return { - // text: 'test' - text: latestData[index].type + text: 'test122344556778891234550987665544' + // text: latestData[index].type // text: originData[index].id // fill: c.attribute.fill, // line: { diff --git a/packages/vrender-components/src/label/arc.ts b/packages/vrender-components/src/label/arc.ts index 9a264c93a..2da89a990 100644 --- a/packages/vrender-components/src/label/arc.ts +++ b/packages/vrender-components/src/label/arc.ts @@ -146,11 +146,13 @@ export class ArcLabel extends LabelBase { attribute: any, currentMarks?: IGraphic[], data?: any, - textBoundsArray?: any + textBoundsArray?: any, + ellipsisWidth?: number ) { // setArcs : 根据 arc 设置 datum 中对应的标签数据 this._arcLeft.clear(); this._arcRight.clear(); + this._ellipsisWidth = ellipsisWidth; const { width, height } = attribute as ArcLabelAttrs; const centerOffset = (attribute as ArcLabelAttrs)?.centerOffset ?? 0; currentMarks.forEach((currentMark, index) => { @@ -401,21 +403,21 @@ export class ArcLabel extends LabelBase { break; } labelWidth = Math.max(this._ellipsisWidth, labelWidth); + arc.labelLimit = labelWidth; arc.pointC = { x: cx, y: labelPosition.y }; + const targetCenterOffset = 0.5 * (arc.labelLimit < arc.labelSize.width ? arc.labelLimit : arc.labelSize.width); if (labelLayoutAlign === 'edge') { // edge 模式下的多行文本对齐方向与其他模式相反 // const alignOffset = this._computeAlignOffset(align, labelWidth, -flag); const alignOffset = 0; // 贴近画布边缘的布局结果可能会由于 cx 的小数 pixel 导致被部分裁剪,因此额外做计算 - labelPosition.x = (flag > 0 ? plotLayout.width + alignOffset : alignOffset) - flag * (0.5 * arc.labelSize.width); + labelPosition.x = (flag > 0 ? plotLayout.width + alignOffset : alignOffset) - flag * targetCenterOffset; } else { // const alignOffset = this._computeAlignOffset(align, labelWidth, flag); const alignOffset = 0; - labelPosition.x = cx + alignOffset + flag * (spaceWidth + 0.5 * arc.labelSize.width); + labelPosition.x = cx + alignOffset + flag * (spaceWidth + 0.5 * targetCenterOffset); } - - arc.labelLimit = labelWidth; } private _computeAlignOffset(align: TextAlign, labelWidth: number, alignFlag: number): number { diff --git a/packages/vrender-components/src/label/base.ts b/packages/vrender-components/src/label/base.ts index 93546bd55..9955f6b75 100644 --- a/packages/vrender-components/src/label/base.ts +++ b/packages/vrender-components/src/label/base.ts @@ -55,7 +55,8 @@ export abstract class LabelBase extends AbstractCompon attribute?: any, currentMarks?: IGraphic[], data?: any[], - textBoundsArray?: any[] + textBoundsArray?: any[], + ellipsisWidth?: number ): any { const arcs: ArcInfo[] = []; return arcs; @@ -257,12 +258,20 @@ export abstract class LabelBase extends AbstractCompon } if (this.attribute.type === 'arc') { + const ellipsisLabelAttribute = { + ...this.attribute.textStyle, + text: '...' + }; + const ellipsisText = this._createLabelText(ellipsisLabelAttribute); + const ellipsisTextBounds = this.getGraphicBounds(ellipsisText); + const ellipsisWidth = ellipsisTextBounds.x2 - ellipsisTextBounds.x1; const arcs: ArcInfo[] = this.layoutArcLabels( position, this.attribute, Array.from(this._idToGraphic.values()), data, - textBoundsArray + textBoundsArray, + ellipsisWidth ); for (let i = 0; i < data.length; i++) { const textData = data[i]; @@ -272,6 +281,7 @@ export abstract class LabelBase extends AbstractCompon x: basedArc.labelPosition.x, y: basedArc.labelPosition.y, angle: basedArc.angle, + maxLineWidth: basedArc.labelLimit, points: basedArc?.pointA && basedArc?.pointB && basedArc?.pointC ? [basedArc.pointA, basedArc.pointB, basedArc.pointC] From dc50f6df40a2281b8e3fcf725b99ebe6cd4241a0 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Wed, 16 Aug 2023 10:59:54 +0800 Subject: [PATCH 26/35] fix: fix wrapText line cut error --- .../fix-wrap-text-line-cut_2023-08-16-02-59.json | 10 ++++++++++ docs/demos/src/pages/wrap-text.ts | 6 +++--- packages/vrender/src/graphic/wrap-text.ts | 4 +++- 3 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 common/changes/@visactor/vrender-components/fix-wrap-text-line-cut_2023-08-16-02-59.json diff --git a/common/changes/@visactor/vrender-components/fix-wrap-text-line-cut_2023-08-16-02-59.json b/common/changes/@visactor/vrender-components/fix-wrap-text-line-cut_2023-08-16-02-59.json new file mode 100644 index 000000000..ee18e8c8c --- /dev/null +++ b/common/changes/@visactor/vrender-components/fix-wrap-text-line-cut_2023-08-16-02-59.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender-components", + "comment": "fix: fix wrapText line cut error", + "type": "patch" + } + ], + "packageName": "@visactor/vrender-components" +} \ No newline at end of file diff --git a/docs/demos/src/pages/wrap-text.ts b/docs/demos/src/pages/wrap-text.ts index 94c45a3fe..faa5eca38 100644 --- a/docs/demos/src/pages/wrap-text.ts +++ b/docs/demos/src/pages/wrap-text.ts @@ -1,7 +1,7 @@ -import { createGroup, createStage, createWrapText, global } from '@visactor/vrender'; +import { createGroup, createStage, createWrapText, vglobal } from '@visactor/vrender'; import { addShapesToStage, colorPools } from '../utils'; -global.setEnv('browser'); +vglobal.setEnv('browser'); export const page = () => { const shapes: any = []; @@ -50,7 +50,7 @@ export const page = () => { "textBaseline": "top", // "width": 12, // "fontColor": "#333", - "maxLineWidth": 12, + "maxLineWidth": 6, "x": 200, "y": 200 }, diff --git a/packages/vrender/src/graphic/wrap-text.ts b/packages/vrender/src/graphic/wrap-text.ts index 319cd078f..4f5f49647 100644 --- a/packages/vrender/src/graphic/wrap-text.ts +++ b/packages/vrender/src/graphic/wrap-text.ts @@ -76,6 +76,7 @@ export class WrapText extends Text { if (maxLineWidth > 0) { for (let i = 0; i < lines.length; i++) { const str = lines[i] as string; + let needCut = true; // // 测量当前行宽度 // width = Math.min( // layoutObj.textMeasure.measureTextWidth(str, layoutObj.textOptions), @@ -110,6 +111,7 @@ export class WrapText extends Text { clip.str = ''; clip.width = 0; } + needCut = false; } linesLayout.push({ @@ -118,7 +120,7 @@ export class WrapText extends Text { }); if (clip.str.length === str.length) { // 不需要截断 - } else { + } else if (needCut) { const newStr = str.substring(clip.str.length); lines.splice(i + 1, 0, newStr); } From 3fb00cf3f16afc3029f19714fed269a52f4b1828 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Wed, 16 Aug 2023 14:58:20 +0800 Subject: [PATCH 27/35] chore: change rush change file --- .../fix-wrap-text-line-cut_2023-08-16-02-59.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename common/changes/@visactor/{vrender-components => vrender}/fix-wrap-text-line-cut_2023-08-16-02-59.json (52%) diff --git a/common/changes/@visactor/vrender-components/fix-wrap-text-line-cut_2023-08-16-02-59.json b/common/changes/@visactor/vrender/fix-wrap-text-line-cut_2023-08-16-02-59.json similarity index 52% rename from common/changes/@visactor/vrender-components/fix-wrap-text-line-cut_2023-08-16-02-59.json rename to common/changes/@visactor/vrender/fix-wrap-text-line-cut_2023-08-16-02-59.json index ee18e8c8c..2a6a75a3b 100644 --- a/common/changes/@visactor/vrender-components/fix-wrap-text-line-cut_2023-08-16-02-59.json +++ b/common/changes/@visactor/vrender/fix-wrap-text-line-cut_2023-08-16-02-59.json @@ -1,10 +1,10 @@ { "changes": [ { - "packageName": "@visactor/vrender-components", + "packageName": "@visactor/vrender", "comment": "fix: fix wrapText line cut error", "type": "patch" } ], - "packageName": "@visactor/vrender-components" + "packageName": "@visactor/vrender" } \ No newline at end of file From 57f356a436c400581f4dff8637a74cc4d8580196 Mon Sep 17 00:00:00 2001 From: pairone <1063258712@qq.com> Date: Wed, 16 Aug 2023 16:39:10 +0800 Subject: [PATCH 28/35] feat: remove duplicate code when deconflicting --- packages/vrender-components/src/label/base.ts | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/packages/vrender-components/src/label/base.ts b/packages/vrender-components/src/label/base.ts index 9955f6b75..d99148646 100644 --- a/packages/vrender-components/src/label/base.ts +++ b/packages/vrender-components/src/label/base.ts @@ -362,24 +362,6 @@ export abstract class LabelBase extends AbstractCompon } } - // 尝试向内挤压 - if (clampForce) { - const { dx = 0, dy = 0 } = clampText(text, bmpTool.width, bmpTool.height); - if ( - !(dx === 0 && dy === 0) && - canPlace(bmpTool, bitmap, { - x1: text.AABBBounds.x1 + dx, - x2: text.AABBBounds.x2 + dx, - y1: text.AABBBounds.y1 + dy, - y2: text.AABBBounds.y2 + dy - }) - ) { - text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy }); - result.push(text); - continue; - } - } - let hasPlace: ReturnType = false; // 发生碰撞,根据策略寻找可放置的位置 for (let j = 0; j < strategy.length; j++) { From 754e4999359985f0a69b55f74b8da88a9e583b45 Mon Sep 17 00:00:00 2001 From: pairone <1063258712@qq.com> Date: Wed, 16 Aug 2023 19:55:38 +0800 Subject: [PATCH 29/35] feat: delete console --- .../browser/examples/label-smart-inverse.ts | 5 + packages/vrender-components/src/label/base.ts | 179 ++++++++++++------ packages/vrender-components/src/label/type.ts | 28 +++ .../src/util/labelSmartInvert.ts | 4 +- 4 files changed, 161 insertions(+), 55 deletions(-) diff --git a/packages/vrender-components/__tests__/browser/examples/label-smart-inverse.ts b/packages/vrender-components/__tests__/browser/examples/label-smart-inverse.ts index 211e49a57..8782073d5 100644 --- a/packages/vrender-components/__tests__/browser/examples/label-smart-inverse.ts +++ b/packages/vrender-components/__tests__/browser/examples/label-smart-inverse.ts @@ -607,6 +607,11 @@ function createContent(stage: Stage) { } ] }, + smartInvert: { + // strokeStrategy: 'similarSeries' + // brightColor: '#fff000', + // darkColor: '#dd0000' + }, zIndex: 302 }); diff --git a/packages/vrender-components/src/label/base.ts b/packages/vrender-components/src/label/base.ts index 9955f6b75..815da9a39 100644 --- a/packages/vrender-components/src/label/base.ts +++ b/packages/vrender-components/src/label/base.ts @@ -7,7 +7,7 @@ import type { IBoundsLike } from '@visactor/vutils'; import { isFunction, isValidNumber, isEmpty, isValid, isString, merge } from '@visactor/vutils'; import { AbstractComponent } from '../core/base'; import type { PointLocationCfg } from '../core/type'; -import { labelSmartInvert } from '../util/labelSmartInvert'; +import { labelSmartInvert, contrastAccessibilityChecker } from '../util/labelSmartInvert'; import { getMarksByName, getNoneGroupMarksByName, traverseGroup } from '../util'; import { StateValue } from '../constant'; import type { Bitmap } from './overlap'; @@ -636,6 +636,14 @@ export abstract class LabelBase extends AbstractCompon protected _smartInvert(labels: IText[]) { const option = (this.attribute.smartInvert || {}) as SmartInvertAttrs; const { textType, contrastRatiosThreshold, alternativeColors } = option; + const fillStrategy = option.fillStrategy ?? 'invertSeries'; + const strokeStrategy = option.strokeStrategy ?? 'series'; + const brightColor = option.brightColor ?? '#ffffff'; + const darkColor = option.darkColor ?? '#000000'; + + if (fillStrategy === 'null' && strokeStrategy === 'null') { + return; + } for (let i = 0; i < labels.length; i++) { const label = labels[i]; @@ -644,62 +652,127 @@ export abstract class LabelBase extends AbstractCompon } const baseMark = this._idToGraphic.get((label.attribute as LabelItem).id); - let isInside = canPlaceInside(label.AABBBounds, baseMark?.AABBBounds); + // let isInside = canPlaceInside(label.AABBBounds, baseMark?.AABBBounds); - if (this.attribute.type === 'arc') { - if (this.attribute.position === 'inside') { - isInside = true; - } else { - isInside = false; - } - } + // if (this.attribute.type === 'arc') { + // if (this.attribute.position === 'inside') { + // isInside = true; + // } else { + // isInside = false; + // } + // } + + // if (!isInside) { + // continue; + // } /** - * stroke 的处理逻辑 - * 1. 当文本在图元内部时,有两种情况: - * - a. 未设置stroke:labelFill为前景色,baseMark填充色为背景色 - * - b. 设置了stroke:labelFill为前景色,labelStroke填充色为背景色 - * 2. 当文本在图元外部时,有两种情况: - * - a. 未设置stroke:此时设置strokeColor为backgroundColor。labelFill为前景色,labelStroke填充色为背景色。避免文字一半在图元内部,一半在图元外部时,在图元外部文字不可见。 - * - b. 设置了stroke:保持strokeColor。labelFill为前景色,labelStroke填充色为背景色。 - */ - if (label.attribute.stroke && label.attribute.lineWidth > 0) { - /** - * 1-b, 2-b - * 若label存在stroke,label填充色为前景色,label描边色为背景色 - * WCAG 2 字母周围的文本发光/光晕可用作背景颜色 - */ - label.setAttributes({ - fill: labelSmartInvert( - label.attribute.fill as IColor, - label.attribute.stroke as IColor, - textType, - contrastRatiosThreshold, - alternativeColors - ) - }); - } else if (isInside) { - /** - * 1-a - * label在图元内部时,label填充色为前景色,baseMark填充色为背景色 - */ - const backgroundColor = baseMark.attribute.fill as IColor; - const foregroundColor = label.attribute.fill as IColor; - label.setAttributes({ - fill: labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors) - }); - } else if (label.attribute.lineWidth > 0) { - /** - * 2-a - * 当文本在图元外部时,设置strokeColor为backgroundColor。labelFill为前景色,labelStroke填充色为背景色。 - */ - const backgroundColor = label.attribute.stroke as IColor; - const foregroundColor = label.attribute.fill as IColor; - label.setAttributes({ - stroke: baseMark.attribute.fill, - fill: labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors) - }); + * 增加smartInvert时fillStrategy和 strokeStrategy的四种策略: + * series(baseMark色), + * invertSeries(执行智能反色), + * similarSeries(智能反色的补色), + * null(不执行智能反色,保持fill设置的颜色) */ + + const backgroundColor = baseMark.attribute.fill as IColor; + const foregroundColor = label.attribute.fill as IColor; + const seriesColor = backgroundColor; + const invertColor = labelSmartInvert( + foregroundColor, + backgroundColor, + textType, + contrastRatiosThreshold, + alternativeColors + ); + const simialrColor = contrastAccessibilityChecker(invertColor, brightColor) ? brightColor : darkColor; + + switch (fillStrategy) { + case 'null': + break; + case 'series': + label.setAttributes({ + fill: seriesColor + }); + break; + case 'invertSeries': + label.setAttributes({ + fill: invertColor + }); + break; + case 'similarSeries': + label.setAttributes({ + fill: simialrColor + }); + break; + } + + if (label.attribute.lineWidth === 0) { + continue; + } + switch (strokeStrategy) { + case 'null': + break; + case 'series': + label.setAttributes({ + stroke: seriesColor + }); + break; + case 'invertSeries': + label.setAttributes({ + stroke: invertColor + }); + break; + case 'similarSeries': + label.setAttributes({ + stroke: simialrColor + }); + break; } + // /** + // * stroke 的处理逻辑 + // * 1. 当文本在图元内部时,有两种情况: + // * - a. 未设置stroke:labelFill为前景色,baseMark填充色为背景色 + // * - b. 设置了stroke:labelFill为前景色,labelStroke填充色为背景色 + // * 2. 当文本在图元外部时,有两种情况: + // * - a. 未设置stroke:此时设置strokeColor为backgroundColor。labelFill为前景色,labelStroke填充色为背景色。避免文字一半在图元内部,一半在图元外部时,在图元外部文字不可见。 + // * - b. 设置了stroke:保持strokeColor。labelFill为前景色,labelStroke填充色为背景色。 + // */ + // if (label.attribute.stroke && label.attribute.lineWidth > 0) { + // /** + // * 1-b, 2-b + // * 若label存在stroke,label填充色为前景色,label描边色为背景色 + // * WCAG 2 字母周围的文本发光/光晕可用作背景颜色 + // */ + // label.setAttributes({ + // fill: labelSmartInvert( + // label.attribute.fill as IColor, + // label.attribute.stroke as IColor, + // textType, + // contrastRatiosThreshold, + // alternativeColors + // ) + // }); + // } else if (isInside) { + // /** + // * 1-a + // * label在图元内部时,label填充色为前景色,baseMark填充色为背景色 + // */ + // const backgroundColor = baseMark.attribute.fill as IColor; + // const foregroundColor = label.attribute.fill as IColor; + // label.setAttributes({ + // fill: labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors) + // }); + // } else if (label.attribute.lineWidth > 0) { + // /** + // * 2-a + // * 当文本在图元外部时,设置strokeColor为backgroundColor。labelFill为前景色,labelStroke填充色为背景色。 + // */ + // const backgroundColor = label.attribute.stroke as IColor; + // const foregroundColor = label.attribute.fill as IColor; + // label.setAttributes({ + // stroke: baseMark.attribute.fill, + // fill: labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors) + // }); + // } } } diff --git a/packages/vrender-components/src/label/type.ts b/packages/vrender-components/src/label/type.ts index 60b5b9011..5d000f248 100644 --- a/packages/vrender-components/src/label/type.ts +++ b/packages/vrender-components/src/label/type.ts @@ -133,6 +133,34 @@ export interface SmartInvertAttrs { * 自定义备选label颜色 */ alternativeColors?: string | string[]; + /** + * fillStrategy四种策略: + * - series(baseMark色), + * - invertSeries(执行智能反色), + * - similarSeries(智能反色的补色), + * - null(不执行智能反色,保持fill设置的颜色) + * @default 'invertSeries' + */ + fillStrategy?: 'series' | 'invertSeries' | 'similarSeries' | 'null'; + /** + * strokeStrategy的四种策略: + * - series(baseMark色), + * - invertSeries(执行智能反色), + * - similarSeries(智能反色的补色), + * - null(不执行智能反色,保持fill设置的颜色) + * @default 'series' + */ + strokeStrategy?: 'series' | 'invertSeries' | 'similarSeries' | 'null'; + /** + * 前景色与亮色具有对比度时,similarSeries使用该色 + * @default '#ffffff' + */ + brightColor?: string; + /** + * 前景色与暗色具有对比度时,similarSeries使用该色 + * @default '#000000' + */ + darkColor?: string; } export type PositionStrategy = { diff --git a/packages/vrender-components/src/util/labelSmartInvert.ts b/packages/vrender-components/src/util/labelSmartInvert.ts index b16735048..2514e6ead 100644 --- a/packages/vrender-components/src/util/labelSmartInvert.ts +++ b/packages/vrender-components/src/util/labelSmartInvert.ts @@ -1,4 +1,4 @@ -import { IColor } from '@visactor/vrender'; +import type { IColor } from '@visactor/vrender'; import { ColorUtil } from '@visactor/vutils'; const defaultAlternativeColors: string[] = ['#ffffff', '#000000']; @@ -73,7 +73,7 @@ function improveContrastReverse( * @param backgroundColor * @returns */ -function contrastAccessibilityChecker( +export function contrastAccessibilityChecker( foregroundColor: IColor | undefined, backgroundColor: IColor | undefined, textType?: IColor | undefined, From 02f6ac4fad065b7a284ab07d3a13967bc44906bb Mon Sep 17 00:00:00 2001 From: pairone <1063258712@qq.com> Date: Wed, 16 Aug 2023 19:58:10 +0800 Subject: [PATCH 30/35] feat: add rush change log --- ...rtInvert-fill-stroke-strategy_2023-08-16-11-57.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 common/changes/@visactor/vrender-components/feat-smartInvert-fill-stroke-strategy_2023-08-16-11-57.json diff --git a/common/changes/@visactor/vrender-components/feat-smartInvert-fill-stroke-strategy_2023-08-16-11-57.json b/common/changes/@visactor/vrender-components/feat-smartInvert-fill-stroke-strategy_2023-08-16-11-57.json new file mode 100644 index 000000000..4a46e4bf6 --- /dev/null +++ b/common/changes/@visactor/vrender-components/feat-smartInvert-fill-stroke-strategy_2023-08-16-11-57.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender-components", + "comment": "feat: smartInvert support fillStrategy strokeStrategy", + "type": "patch" + } + ], + "packageName": "@visactor/vrender-components" +} \ No newline at end of file From 6c293c5ee560226efb99eb2c2b3b3716013aaf15 Mon Sep 17 00:00:00 2001 From: kkxxkk2019 Date: Thu, 17 Aug 2023 14:47:13 +0800 Subject: [PATCH 31/35] fix(vrender-components): user's align config should be first --- common/config/rush/pnpm-lock.yaml | 239 +++++++++--------- packages/vrender-components/src/axis/base.ts | 17 +- .../vrender-components/src/axis/circle.ts | 13 +- packages/vrender-components/src/axis/line.ts | 32 ++- .../src/axis/overlap/auto-rotate.ts | 121 +++++---- 5 files changed, 236 insertions(+), 186 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 395b6e346..9d9834bd7 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -28,13 +28,13 @@ importers: dependencies: '@visactor/vrender': link:../../packages/vrender devDependencies: - '@antv/g': 5.18.12 + '@antv/g': 5.18.13 '@esbuild-plugins/node-globals-polyfill': 0.1.1 '@esbuild-plugins/node-modules-polyfill': 0.1.4 '@internal/eslint-config': link:../../share/eslint-config '@internal/ts-config': link:../../share/ts-config '@visactor/vrender-kits': link:../../packages/vrender-kits - '@visactor/vutils': 0.15.5 + '@visactor/vutils': 0.15.7 canvas: 2.11.2 d3-scale-chromatic: 3.0.0 dat.gui: 0.7.9 @@ -67,7 +67,7 @@ importers: vite: 3.2.6 dependencies: '@visactor/vrender': link:../vrender - '@visactor/vutils': 0.15.5 + '@visactor/vutils': 0.15.7 react-reconciler: 0.29.0_react@16.13.0 tslib: 2.6.1 devDependencies: @@ -107,7 +107,7 @@ importers: dependencies: '@visactor/react-vrender': link:../react-vrender '@visactor/vrender': link:../vrender - '@visactor/vutils': 0.15.5 + '@visactor/vutils': 0.15.7 react-reconciler: 0.29.0_react@16.13.0 tslib: 2.6.1 devDependencies: @@ -151,7 +151,7 @@ importers: typescript: 4.9.5 vite: 3.2.6 dependencies: - '@visactor/vutils': 0.15.5 + '@visactor/vutils': 0.15.7 color-convert: 2.0.1 core-js: 3.31.1 inversify: 6.0.1 @@ -197,8 +197,8 @@ importers: vite: 3.2.6 dependencies: '@visactor/vrender': link:../vrender - '@visactor/vscale': 0.15.5 - '@visactor/vutils': 0.15.5 + '@visactor/vscale': 0.15.7 + '@visactor/vutils': 0.15.7 inversify: 6.0.1 devDependencies: '@internal/bundler': link:../../tools/bundler @@ -240,7 +240,7 @@ importers: dependencies: '@resvg/resvg-js': 2.4.1 '@visactor/vrender': link:../vrender - '@visactor/vutils': 0.15.5 + '@visactor/vutils': 0.15.7 canvas: 2.11.2 core-js: 3.31.1 inversify: 6.0.1 @@ -433,7 +433,7 @@ importers: '@types/merge2': 1.4.0 '@types/minimist': 1.2.2 '@types/ms': 0.7.31 - '@types/node': 20.4.9 + '@types/node': 20.5.0 '@types/semver': 7.3.12 '@types/terser': 3.12.0 '@types/through2': 2.0.38 @@ -441,7 +441,7 @@ importers: '@types/vinyl': 2.0.7 '@types/yargs-parser': 21.0.0 eslint: 8.18.0 - ts-node: 10.9.0_kl3m3ivcdd7ltqtdoai45npyxa + ts-node: 10.9.0_cexlby4oa6uys4e6r2ufkcpuca typescript: 4.9.5 vitest: 0.30.1_less@4.1.3+terser@5.17.1 @@ -458,23 +458,23 @@ packages: '@jridgewell/gen-mapping': 0.3.3 '@jridgewell/trace-mapping': 0.3.19 - /@antv/g-camera-api/1.2.11: - resolution: {integrity: sha512-4mq+xu01Jh6Pz9ItqCE4SOMWDpp9rP70fKAgVxDdHUOll8JbcRfux23csgAlIb4s5sKSmvdRMAwCNbutiSIZfw==} + /@antv/g-camera-api/1.2.12: + resolution: {integrity: sha512-l52JpU6GCrQ2nWZg5ub7OSDSDs3OsE6Xf1XGgfjRygp2cm0HSJ+iAeSw1tcPYAqz6fDSBHe+FRTvOPIaflQ/Sg==} dependencies: - '@antv/g-lite': 1.2.11 + '@antv/g-lite': 1.2.12 '@antv/util': 3.3.4 gl-matrix: 3.4.3 tslib: 2.6.1 dev: true - /@antv/g-dom-mutation-observer-api/1.2.11: - resolution: {integrity: sha512-mrGdB4MMgtca1opSo7fbX5s2vDR5KGZjcaW/sA6CITzriIiX+WN9YSHkDTYf6oPyMsHyM+lqN26nqhm5DBc1oQ==} + /@antv/g-dom-mutation-observer-api/1.2.12: + resolution: {integrity: sha512-d7cJyVK3Qx86wIOaC63k9iPWnFH5Gp/geivicyieI7NjoEVE74KloTSFurJT5ZCrCVprzKAhwbLb/nGb+1D/jA==} dependencies: - '@antv/g-lite': 1.2.11 + '@antv/g-lite': 1.2.12 dev: true - /@antv/g-lite/1.2.11: - resolution: {integrity: sha512-kfvuHvSr/KF2fluBSp7Tv/aN0FTlhn985YkbiBS+p4Ps1kn6s+VGpkbkUnhgwBPgwRUqdE8Qp9CKRpVY9HEGpw==} + /@antv/g-lite/1.2.12: + resolution: {integrity: sha512-YHuOUyGZvWF8fj7c43MvWUigT++QuB+72tmTQckYzycS3PzN9FJMYEeI6jMuyC/HBgCSadizShpD2OVHHJ8suA==} dependencies: '@antv/g-math': 2.0.2 '@antv/util': 3.3.4 @@ -493,21 +493,21 @@ packages: tslib: 2.6.1 dev: true - /@antv/g-web-animations-api/1.2.11: - resolution: {integrity: sha512-gnHTnOxFNqLnFBPjbu3CZ4ZaDBIYx++6deEwaElhnuK9DL76eMmI2G8Xtvwxmbs6zquNHVRWTjHBVMojX6mDDA==} + /@antv/g-web-animations-api/1.2.12: + resolution: {integrity: sha512-skzBPmvHDMLJTepLYpR62hydAU36cx8gi0U/SG6AcqKr7ShAzlRKgFZ4w6bjiPBZjOJN/dKH5miTPy6BjzsLBA==} dependencies: - '@antv/g-lite': 1.2.11 + '@antv/g-lite': 1.2.12 '@antv/util': 3.3.4 tslib: 2.6.1 dev: true - /@antv/g/5.18.12: - resolution: {integrity: sha512-NuFP+D9bx73+KlZKJDRrPM8rR1Ocy4fK4Pbq4okRZBzYoZLn4IM2yNQFU3nnUBhjh5ONTaEHFl2pUvDxOBuXlA==} + /@antv/g/5.18.13: + resolution: {integrity: sha512-2HvwwLFuczyR5WImSEUNC8T+cKwsl21H3ymxdCnv1Vrgb3EDsgaN0Al0331V+FhfIHcMQiKb15v7z8cfzNGVkw==} dependencies: - '@antv/g-camera-api': 1.2.11 - '@antv/g-dom-mutation-observer-api': 1.2.11 - '@antv/g-lite': 1.2.11 - '@antv/g-web-animations-api': 1.2.11 + '@antv/g-camera-api': 1.2.12 + '@antv/g-dom-mutation-observer-api': 1.2.12 + '@antv/g-lite': 1.2.12 + '@antv/g-web-animations-api': 1.2.12 dev: true /@antv/util/3.3.4: @@ -1785,6 +1785,7 @@ packages: engines: {node: '>=12'} dependencies: '@jridgewell/trace-mapping': 0.3.9 + dev: true /@electron/get/1.14.1: resolution: {integrity: sha512-BrZYyL/6m0ZXz/lDxy/nlVhQz+WF+iPS6qXolEU8atw7h6v1aYkjwJZ63m+bJMBTxDE66X+r2tPS4a/8C82sZw==} @@ -1844,7 +1845,7 @@ packages: ajv: 6.12.6 debug: 4.3.4 espree: 9.6.1 - globals: 13.20.0 + globals: 13.21.0 ignore: 5.2.4 import-fresh: 3.3.0 js-yaml: 4.1.0 @@ -1913,7 +1914,7 @@ packages: engines: {node: '>= 10.14.2'} dependencies: '@jest/types': 26.6.2 - '@types/node': 20.4.9 + '@types/node': 20.5.0 chalk: 4.1.2 jest-message-util: 26.6.2 jest-util: 26.6.2 @@ -1928,7 +1929,7 @@ packages: '@jest/test-result': 26.6.2 '@jest/transform': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.4.9 + '@types/node': 20.5.0 ansi-escapes: 4.3.2 chalk: 4.1.2 exit: 0.1.2 @@ -1957,7 +1958,6 @@ packages: - supports-color - ts-node - utf-8-validate - dev: true /@jest/core/26.6.3_ts-node@10.9.0: resolution: {integrity: sha512-xvV1kKbhfUqFVuZ8Cyo+JPpipAHHAV3kcDBftiduK8EICXmTFddryy3P7NfZt8Pv37rA9nEJBKCCkglCPt/Xjw==} @@ -1968,7 +1968,7 @@ packages: '@jest/test-result': 26.6.2 '@jest/transform': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.4.9 + '@types/node': 20.5.0 ansi-escapes: 4.3.2 chalk: 4.1.2 exit: 0.1.2 @@ -1997,6 +1997,7 @@ packages: - supports-color - ts-node - utf-8-validate + dev: true /@jest/environment/24.9.0: resolution: {integrity: sha512-5A1QluTPhvdIPFYnO3sZC3smkNeXPVELz7ikPbhUj0bQjB07EoE9qtLrem14ZUYWdVayYbsjVwIiL4WBIMV4aQ==} @@ -2016,7 +2017,7 @@ packages: dependencies: '@jest/fake-timers': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.4.9 + '@types/node': 20.5.0 jest-mock: 26.6.2 /@jest/fake-timers/24.9.0: @@ -2034,7 +2035,7 @@ packages: dependencies: '@jest/types': 26.6.2 '@sinonjs/fake-timers': 6.0.1 - '@types/node': 20.4.9 + '@types/node': 20.5.0 jest-message-util: 26.6.2 jest-mock: 26.6.2 jest-util: 26.6.2 @@ -2142,7 +2143,6 @@ packages: - supports-color - ts-node - utf-8-validate - dev: true /@jest/test-sequencer/26.6.3_ts-node@10.9.0: resolution: {integrity: sha512-YHlVIjP5nfEyjlrSr8t/YdNfU/1XEt7c5b4OxcXCjyRhjzLYu/rO69/WHPuYcbCWkz8kAeZVZp2N2+IOLLEPGw==} @@ -2159,6 +2159,7 @@ packages: - supports-color - ts-node - utf-8-validate + dev: true /@jest/transform/24.9.0: resolution: {integrity: sha512-TcQUmyNRxV94S0QpMOnZl0++6RMiqpbH/ZMccFB/amku6Uwvyb1cjYX7xkp5nGNkbX4QPH/FcB6q1HBTHynLmQ==} @@ -2221,7 +2222,7 @@ packages: dependencies: '@types/istanbul-lib-coverage': 2.0.4 '@types/istanbul-reports': 3.0.1 - '@types/node': 20.4.9 + '@types/node': 20.5.0 '@types/yargs': 15.0.15 chalk: 4.1.2 @@ -2261,6 +2262,7 @@ packages: dependencies: '@jridgewell/resolve-uri': 3.1.1 '@jridgewell/sourcemap-codec': 1.4.15 + dev: true /@mapbox/node-pre-gyp/1.0.11: resolution: {integrity: sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==} @@ -2454,7 +2456,7 @@ packages: dependencies: '@babel/core': 7.20.12 '@babel/helper-module-imports': 7.22.5 - '@rollup/pluginutils': 5.0.2_rollup@3.20.5 + '@rollup/pluginutils': 5.0.3_rollup@3.20.5 '@types/babel__core': 7.20.0 rollup: 3.20.5 dev: false @@ -2468,7 +2470,7 @@ packages: rollup: optional: true dependencies: - '@rollup/pluginutils': 5.0.2_rollup@3.20.5 + '@rollup/pluginutils': 5.0.3_rollup@3.20.5 commondir: 1.0.1 estree-walker: 2.0.2 glob: 8.1.0 @@ -2486,7 +2488,7 @@ packages: rollup: optional: true dependencies: - '@rollup/pluginutils': 5.0.2_rollup@3.20.5 + '@rollup/pluginutils': 5.0.3_rollup@3.20.5 '@types/resolve': 1.20.2 deepmerge: 4.3.1 is-builtin-module: 3.2.1 @@ -2504,7 +2506,7 @@ packages: rollup: optional: true dependencies: - '@rollup/pluginutils': 5.0.2_rollup@3.20.5 + '@rollup/pluginutils': 5.0.3_rollup@3.20.5 magic-string: 0.27.0 rollup: 3.20.5 dev: false @@ -2537,7 +2539,7 @@ packages: tslib: optional: true dependencies: - '@rollup/pluginutils': 5.0.2_rollup@3.20.5 + '@rollup/pluginutils': 5.0.3_rollup@3.20.5 resolve: 1.22.4 rollup: 3.20.5 typescript: 4.9.5 @@ -2552,7 +2554,7 @@ packages: rollup: optional: true dependencies: - '@rollup/pluginutils': 5.0.2_rollup@3.20.5 + '@rollup/pluginutils': 5.0.3_rollup@3.20.5 make-dir: 3.1.0 mime: 3.0.0 rollup: 3.20.5 @@ -2566,8 +2568,8 @@ packages: picomatch: 2.3.1 dev: true - /@rollup/pluginutils/5.0.2_rollup@3.20.5: - resolution: {integrity: sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==} + /@rollup/pluginutils/5.0.3_rollup@3.20.5: + resolution: {integrity: sha512-hfllNN4a80rwNQ9QCxhxuHCGHMAvabXqxNdaChUSSadMre7t4iEUI6fFAhBOn/eIYTgYVhBv7vCLsAJ4u3lf3g==} engines: {node: '>=14.0.0'} peerDependencies: rollup: ^1.20.0||^2.0.0||^3.0.0 @@ -2621,15 +2623,19 @@ packages: /@tsconfig/node10/1.0.9: resolution: {integrity: sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==} + dev: true /@tsconfig/node12/1.0.11: resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==} + dev: true /@tsconfig/node14/1.0.3: resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==} + dev: true /@tsconfig/node16/1.0.4: resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} + dev: true /@turf/helpers/6.5.0: resolution: {integrity: sha512-VbI1dV5bLFzohYYdgqwikdMVpe7pJ9X3E+dlr425wa2/sMJqYDhTO++ec38/pcPvPE6oD9WEEeU3Xu3gza+VPw==} @@ -2677,7 +2683,7 @@ packages: /@types/clean-css/4.2.6: resolution: {integrity: sha512-Ze1tf+LnGPmG6hBFMi0B4TEB0mhF7EiMM5oyjLDNPE9hxrPU0W+5+bHvO+eFPA+bt0iC1zkQMoU/iGdRVjcRbw==} dependencies: - '@types/node': 20.4.9 + '@types/node': 20.5.0 source-map: 0.6.1 dev: true @@ -2697,13 +2703,13 @@ packages: /@types/fs-extra/9.0.13: resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==} dependencies: - '@types/node': 20.4.9 + '@types/node': 20.5.0 dev: true /@types/glob-stream/8.0.0: resolution: {integrity: sha512-fxTWwdQmX9LWSHD7ZLlv3BHR992mKcVcDnT/2v+l/QZZo7TfDdyasqlSYVzOnMGWhRbrWeWkbj/mgezFjKynhw==} dependencies: - '@types/node': 20.4.9 + '@types/node': 20.5.0 '@types/picomatch': 2.3.0 '@types/streamx': 2.9.1 dev: true @@ -2711,18 +2717,18 @@ packages: /@types/glob-watcher/5.0.2: resolution: {integrity: sha512-MZeh2nIzibl/euv5UV0femkGzcKTSE4G2+zv48d6ymeitWwCx52+4X+FqzML9oH2mQnPs+N/JHp3CsBPj1x1Ug==} dependencies: - '@types/node': 20.4.9 + '@types/node': 20.5.0 dev: true /@types/graceful-fs/4.1.6: resolution: {integrity: sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==} dependencies: - '@types/node': 20.4.9 + '@types/node': 20.5.0 /@types/gulp-if/0.0.34: resolution: {integrity: sha512-r2A04hHDC+ZWMRAm+3q6/UeC3ggvl+TZm9P1+2umnp4q9bOlBmUQnR178Io3c0DkZPQAwup8VNtOvmvaWCpP5w==} dependencies: - '@types/node': 20.4.9 + '@types/node': 20.5.0 '@types/vinyl': 2.0.7 dev: true @@ -2736,7 +2742,7 @@ packages: /@types/gulp-sourcemaps/0.0.35: resolution: {integrity: sha512-vUBuizwA4CAV3Mke0DJYHQxyN4YOB1aAql284qAO7Et7fe0hmnPi/R9Fhu2UhxMuSxAwFktsJUOQk5dJHOU1eA==} dependencies: - '@types/node': 20.4.9 + '@types/node': 20.5.0 '@types/vinyl': 2.0.7 dev: true @@ -2790,7 +2796,7 @@ packages: /@types/merge2/1.4.0: resolution: {integrity: sha512-MRHDvln2ldZELrUC8n1PGaQzZ33aNh8uDcsGehREW0zR1Fr818a4/JTZjO9eloHPPxnpUp8fz/YFTRc5CWm7Xw==} dependencies: - '@types/node': 20.4.9 + '@types/node': 20.5.0 dev: true /@types/minimatch/5.1.2: @@ -2808,7 +2814,7 @@ packages: /@types/node-fetch/2.6.4: resolution: {integrity: sha512-1ZX9fcN4Rvkvgv4E6PAY5WXUFWFcRWxZa3EW83UjycOB9ljJCedb2CupIP4RZMEwF/M3eTcCihbBRgwtGbg5Rg==} dependencies: - '@types/node': 20.4.9 + '@types/node': 20.5.0 form-data: 3.0.1 dev: true @@ -2816,8 +2822,8 @@ packages: resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} dev: true - /@types/node/20.4.9: - resolution: {integrity: sha512-8e2HYcg7ohnTUbHk8focoklEQYvemQmu9M/f43DZVx43kHn0tE3BY/6gSDxS7k0SprtS0NHvj+L80cGLnoOUcQ==} + /@types/node/20.5.0: + resolution: {integrity: sha512-Mgq7eCtoTjT89FqNoTzzXg2XvCi5VMhRV6+I2aYanc6kQCBImeNaAYRs/DyoVqk1YEUJK5gN9VO7HRIdz4Wo3Q==} /@types/normalize-package-data/2.4.1: resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==} @@ -2870,7 +2876,7 @@ packages: /@types/streamx/2.9.1: resolution: {integrity: sha512-9bywzhouyedmci7WCIPFwJ8zASDnxt2gaVUy52X0p0Tt085IJSAEP0L6j4SSNeDMSLzpYu6cPz0GrJZ7kPJ6Bg==} dependencies: - '@types/node': 20.4.9 + '@types/node': 20.5.0 dev: true /@types/terser/3.12.0: @@ -2883,7 +2889,7 @@ packages: /@types/through2/2.0.38: resolution: {integrity: sha512-YFu+nHmjxMurkH1BSzA0Z1WrKDAY8jUKPZctNQn7mc+/KKtp2XxnclHFXxdB1m7Iqnzb5aywgP8TMK283LezGQ==} dependencies: - '@types/node': 20.4.9 + '@types/node': 20.5.0 dev: true /@types/undertaker-registry/1.0.1: @@ -2893,7 +2899,7 @@ packages: /@types/undertaker/1.2.8: resolution: {integrity: sha512-gW3PRqCHYpo45XFQHJBhch7L6hytPsIe0QeLujlnFsjHPnXLhJcPdN6a9368d7aIQgH2I/dUTPFBlGeSNA3qOg==} dependencies: - '@types/node': 20.4.9 + '@types/node': 20.5.0 '@types/undertaker-registry': 1.0.1 async-done: 1.3.2 dev: true @@ -2902,7 +2908,7 @@ packages: resolution: {integrity: sha512-ctNcmmzbMIKooXjRkyyUCOu2Z4AyqibL+RhXoF3pb7K7j+ezItnakmpm31LymkYHSIM5ey0tjIFzTvFOTSBCGw==} dependencies: '@types/glob-stream': 8.0.0 - '@types/node': 20.4.9 + '@types/node': 20.5.0 '@types/vinyl': 2.0.7 dev: true @@ -2910,7 +2916,7 @@ packages: resolution: {integrity: sha512-4UqPv+2567NhMQuMLdKAyK4yzrfCqwaTt6bLhHEs8PFcxbHILsrxaY63n4wgE/BRLDWDQeI+WcTmkXKExh9hQg==} dependencies: '@types/expect': 1.20.4 - '@types/node': 20.4.9 + '@types/node': 20.5.0 /@types/yargs-parser/21.0.0: resolution: {integrity: sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==} @@ -3049,17 +3055,17 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: '@typescript-eslint/types': 5.30.0 - eslint-visitor-keys: 3.4.2 + eslint-visitor-keys: 3.4.3 dev: false - /@visactor/vscale/0.15.5: - resolution: {integrity: sha512-D+xkZxvskGPS/4gte4Yuc0FozQJ4/ProFXyC8SC9KCBcaNRTp0FUc9mU7fX+q0swEbyrT15fXP2ay0kAH+38Lg==} + /@visactor/vscale/0.15.7: + resolution: {integrity: sha512-Jj3J4B6FT4sbWgUR+eoF1Qu+PPukwiVcSEix1rbNcCkLPXQzKkRXVXojDwscNSALdmSpnrHjw8VNIQpnHP/uyw==} dependencies: - '@visactor/vutils': 0.15.5 + '@visactor/vutils': 0.15.7 dev: false - /@visactor/vutils/0.15.5: - resolution: {integrity: sha512-hw65mJCt1aRfrRuGFlW4QPXCi9cHiRvV3iioWLVw19VQg/B8lZVud3+Rwo/W/z88PMqiNUN5BPwGkBmHK0IwYg==} + /@visactor/vutils/0.15.7: + resolution: {integrity: sha512-f+IoDJpOys6TVFR6HoVsCTb0hI3GnEIsECzrNDFMmca/POP4oZ24rC/bCkyNGF/FUqAckynvQLv6q9IdMuyzVQ==} dependencies: '@turf/helpers': 6.5.0 '@turf/invariant': 6.5.0 @@ -3158,6 +3164,7 @@ packages: /acorn-walk/8.2.0: resolution: {integrity: sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==} engines: {node: '>=0.4.0'} + dev: true /acorn/5.7.4: resolution: {integrity: sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==} @@ -3307,6 +3314,7 @@ packages: /arg/4.1.3: resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} + dev: true /argparse/1.0.10: resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} @@ -3525,7 +3533,7 @@ packages: postcss: ^8.1.0 dependencies: browserslist: 4.21.10 - caniuse-lite: 1.0.30001519 + caniuse-lite: 1.0.30001521 fraction.js: 4.2.0 normalize-range: 0.1.2 picocolors: 1.0.0 @@ -3816,8 +3824,8 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001519 - electron-to-chromium: 1.4.490 + caniuse-lite: 1.0.30001521 + electron-to-chromium: 1.4.494 node-releases: 2.0.13 update-browserslist-db: 1.0.11_browserslist@4.21.10 @@ -3904,8 +3912,8 @@ packages: resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} engines: {node: '>=10'} - /caniuse-lite/1.0.30001519: - resolution: {integrity: sha512-0QHgqR+Jv4bxHMp8kZ1Kn8CH55OikjKJ6JmKkZYP1F3D7w+lnFXF70nG5eNfsZS89jadi5Ywy5UCSKLAglIRkg==} + /caniuse-lite/1.0.30001521: + resolution: {integrity: sha512-fnx1grfpEOvDGH+V17eccmNjucGUnCbP6KL+l5KqBIerp26WK/+RQ7CIDE37KGJjaPyqWXXlFUyKiWmvdNNKmQ==} /canvas/2.11.2: resolution: {integrity: sha512-ItanGBMrmRV7Py2Z+Xhs7cT+FNt5K0vPL4p9EZ/UX/Mu7hFbkxSjKF2KVtPwX7UYWp7dRKnrTvReflgrItJbdw==} @@ -4223,6 +4231,7 @@ packages: /create-require/1.1.1: resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} + dev: true /cross-spawn/6.0.5: resolution: {integrity: sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==} @@ -4492,6 +4501,7 @@ packages: /diff/4.0.2: resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} engines: {node: '>=0.3.1'} + dev: true /dir-glob/3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} @@ -4561,8 +4571,8 @@ packages: safer-buffer: 2.1.2 dev: true - /electron-to-chromium/1.4.490: - resolution: {integrity: sha512-6s7NVJz+sATdYnIwhdshx/N/9O6rvMxmhVoDSDFdj6iA45gHR8EQje70+RYsF4GeB+k0IeNSBnP7yG9ZXJFr7A==} + /electron-to-chromium/1.4.494: + resolution: {integrity: sha512-KF7wtsFFDu4ws1ZsSOt4pdmO1yWVNWCFtijVYZPUeW4SV7/hy/AESjLn/+qIWgq7mHscNOKAwN5AIM1+YAy+Ww==} /electron/11.5.0: resolution: {integrity: sha512-WjNDd6lGpxyiNjE3LhnFCAk/D9GIj1rU3GSDealVShhkkkPR3Vh4q8ErXGDl1OAO/faomVa10KoFPUN/pLbNxg==} @@ -5054,8 +5064,8 @@ packages: resolution: {integrity: sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==} engines: {node: '>=10'} - /eslint-visitor-keys/3.4.2: - resolution: {integrity: sha512-8drBzUEyZ2llkpCA67iYrgEssKDUu68V8ChqqOfFupIaG/LCVPUT+CoGJpT77zJprs4T/W7p07LP7zAIMuweVw==} + /eslint-visitor-keys/3.4.3: + resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} /eslint/8.18.0: @@ -5073,7 +5083,7 @@ packages: escape-string-regexp: 4.0.0 eslint-scope: 7.2.2 eslint-utils: 3.0.0_eslint@8.18.0 - eslint-visitor-keys: 3.4.2 + eslint-visitor-keys: 3.4.3 espree: 9.6.1 esquery: 1.5.0 esutils: 2.0.3 @@ -5081,7 +5091,7 @@ packages: file-entry-cache: 6.0.1 functional-red-black-tree: 1.0.1 glob-parent: 6.0.2 - globals: 13.20.0 + globals: 13.21.0 ignore: 5.2.4 import-fresh: 3.3.0 imurmurhash: 0.1.4 @@ -5097,7 +5107,7 @@ packages: strip-ansi: 6.0.1 strip-json-comments: 3.1.1 text-table: 0.2.0 - v8-compile-cache: 2.3.0 + v8-compile-cache: 2.4.0 transitivePeerDependencies: - supports-color @@ -5107,7 +5117,7 @@ packages: dependencies: acorn: 8.10.0 acorn-jsx: 5.3.2_acorn@8.10.0 - eslint-visitor-keys: 3.4.2 + eslint-visitor-keys: 3.4.3 /esprima/4.0.1: resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} @@ -5779,8 +5789,8 @@ packages: resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} engines: {node: '>=4'} - /globals/13.20.0: - resolution: {integrity: sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==} + /globals/13.21.0: + resolution: {integrity: sha512-ybyme3s4yy/t/3s35bewwXKOf7cvzfreG2lH0lZl0JB7I4GxRP2ghxOK/Nb9EkRXdbBXZLfq/p/0W2JUONB/Gg==} engines: {node: '>=8'} dependencies: type-fest: 0.20.2 @@ -5893,7 +5903,7 @@ packages: resolution: {integrity: sha512-SVSF7ikuWKhpAW4l4wapAqPPSToJoiNKsbDoUnRrSgwZHH7lH8pbPeQj1aOVYQrbZKhfSVBxVW+Py7vtulRktw==} engines: {node: '>=10'} dependencies: - '@types/node': 20.4.9 + '@types/node': 20.5.0 '@types/vinyl': 2.0.7 istextorbinary: 3.3.0 replacestream: 4.0.3 @@ -6618,7 +6628,6 @@ packages: - supports-color - ts-node - utf-8-validate - dev: true /jest-cli/26.6.3_ts-node@10.9.0: resolution: {integrity: sha512-GF9noBSa9t08pSyl3CY4frMrqp+aQXFGFkf5hEPbh/pIUFYWMK6ZLTfbmadxJVcJrdRoChlWQsA2VkJcDFK8hg==} @@ -6644,6 +6653,7 @@ packages: - supports-color - ts-node - utf-8-validate + dev: true /jest-config/24.9.0: resolution: {integrity: sha512-RATtQJtVYQrp7fvWg6f5y3pEFj9I+H8sWw4aKxnDZ96mob5i5SD6ZEGWgMLXQ4LE8UurrjbdlLWdUeo+28QpfQ==} @@ -6702,7 +6712,6 @@ packages: - canvas - supports-color - utf-8-validate - dev: true /jest-config/26.6.3_ts-node@10.9.0: resolution: {integrity: sha512-t5qdIj/bCj2j7NFVHb2nFB4aUdfucDn3JRKgrZnplb8nieAirAzRSHP8uDEd+qV6ygzg9Pz4YG7UTJf94LPSyg==} @@ -6737,6 +6746,7 @@ packages: - canvas - supports-color - utf-8-validate + dev: true /jest-diff/24.9.0: resolution: {integrity: sha512-qMfrTs8AdJE2iqrTp0hzh7kTd2PQWrsFyj9tORoKmu32xjPjeE4NyjVRDz8ybYwqS2ik8N4hsIpiVTyFeo2lBQ==} @@ -6807,7 +6817,7 @@ packages: jest: ^24.0.0 dependencies: electron: 11.5.0 - jest: 26.6.3_ts-node@10.9.0 + jest: 26.6.3 jest-haste-map: 24.9.0 jest-message-util: 24.9.0 jest-mock: 24.9.0 @@ -6842,7 +6852,7 @@ packages: '@jest/environment': 26.6.2 '@jest/fake-timers': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.4.9 + '@types/node': 20.5.0 jest-mock: 26.6.2 jest-util: 26.6.2 jsdom: 16.7.0 @@ -6872,7 +6882,7 @@ packages: '@jest/environment': 26.6.2 '@jest/fake-timers': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.4.9 + '@types/node': 20.5.0 jest-mock: 26.6.2 jest-util: 26.6.2 @@ -6925,7 +6935,7 @@ packages: dependencies: '@jest/types': 26.6.2 '@types/graceful-fs': 4.1.6 - '@types/node': 20.4.9 + '@types/node': 20.5.0 anymatch: 3.1.3 fb-watchman: 2.0.2 graceful-fs: 4.2.11 @@ -6972,7 +6982,7 @@ packages: '@jest/source-map': 26.6.2 '@jest/test-result': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.4.9 + '@types/node': 20.5.0 chalk: 4.1.2 co: 4.6.0 expect: 26.6.2 @@ -6991,7 +7001,6 @@ packages: - supports-color - ts-node - utf-8-validate - dev: true /jest-jasmine2/26.6.3_ts-node@10.9.0: resolution: {integrity: sha512-kPKUrQtc8aYwBV7CqBg5pu+tmYXlvFlSFYn18ev4gPFtrRzB15N2gW/Roew3187q2w2eHuu0MU9TJz6w0/nPEg==} @@ -7002,7 +7011,7 @@ packages: '@jest/source-map': 26.6.2 '@jest/test-result': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.4.9 + '@types/node': 20.5.0 chalk: 4.1.2 co: 4.6.0 expect: 26.6.2 @@ -7021,6 +7030,7 @@ packages: - supports-color - ts-node - utf-8-validate + dev: true /jest-leak-detector/24.9.0: resolution: {integrity: sha512-tYkFIDsiKTGwb2FG1w8hX9V0aUb2ot8zY/2nFg087dUageonw1zrLMP4W6zsRO59dPkTSKie+D4rhMuP9nRmrA==} @@ -7106,7 +7116,7 @@ packages: engines: {node: '>= 10.14.2'} dependencies: '@jest/types': 26.6.2 - '@types/node': 20.4.9 + '@types/node': 20.5.0 /jest-pnp-resolver/1.2.3_jest-resolve@24.9.0: resolution: {integrity: sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==} @@ -7207,7 +7217,7 @@ packages: '@jest/environment': 26.6.2 '@jest/test-result': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.4.9 + '@types/node': 20.5.0 chalk: 4.1.2 emittery: 0.7.2 exit: 0.1.2 @@ -7229,7 +7239,6 @@ packages: - supports-color - ts-node - utf-8-validate - dev: true /jest-runner/26.6.3_ts-node@10.9.0: resolution: {integrity: sha512-atgKpRHnaA2OvByG/HpGA4g6CSPS/1LK0jK3gATJAoptC1ojltpmVlYC3TYgdmGp+GLuhzpH30Gvs36szSL2JQ==} @@ -7239,7 +7248,7 @@ packages: '@jest/environment': 26.6.2 '@jest/test-result': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.4.9 + '@types/node': 20.5.0 chalk: 4.1.2 emittery: 0.7.2 exit: 0.1.2 @@ -7261,6 +7270,7 @@ packages: - supports-color - ts-node - utf-8-validate + dev: true /jest-runtime/24.9.0: resolution: {integrity: sha512-8oNqgnmF3v2J6PVRM2Jfuj8oX3syKmaynlDMMKQ4iyzbQzIG6th5ub/lM2bCMTmoTKM3ykcUYI2Pw9xwNtjMnw==} @@ -7332,7 +7342,6 @@ packages: - supports-color - ts-node - utf-8-validate - dev: true /jest-runtime/26.6.3_ts-node@10.9.0: resolution: {integrity: sha512-lrzyR3N8sacTAMeonbqpnSka1dHNux2uk0qqDXVkMv2c/A3wYnvQ4EXuI013Y6+gSKSCxdaczvf4HF0mVXHRdw==} @@ -7372,6 +7381,7 @@ packages: - supports-color - ts-node - utf-8-validate + dev: true /jest-serializer/24.9.0: resolution: {integrity: sha512-DxYipDr8OvfrKH3Kel6NdED3OXxjvxXZ1uIY2I9OFbGg+vUkkg7AGvi65qbhbWNPvDckXmzMPbK3u3HaDO49bQ==} @@ -7382,7 +7392,7 @@ packages: resolution: {integrity: sha512-S5wqyz0DXnNJPd/xfIzZ5Xnp1HrJWBczg8mMfMpN78OJ5eDxXyf+Ygld9wX1DnUWbIbhM1YDY95NjR4CBXkb2g==} engines: {node: '>= 10.14.2'} dependencies: - '@types/node': 20.4.9 + '@types/node': 20.5.0 graceful-fs: 4.2.11 /jest-snapshot/24.9.0: @@ -7448,7 +7458,7 @@ packages: engines: {node: '>= 10.14.2'} dependencies: '@jest/types': 26.6.2 - '@types/node': 20.4.9 + '@types/node': 20.5.0 chalk: 4.1.2 graceful-fs: 4.2.11 is-ci: 2.0.0 @@ -7483,7 +7493,7 @@ packages: dependencies: '@jest/test-result': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.4.9 + '@types/node': 20.5.0 ansi-escapes: 4.3.2 chalk: 4.1.2 jest-util: 26.6.2 @@ -7501,7 +7511,7 @@ packages: resolution: {integrity: sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==} engines: {node: '>= 10.13.0'} dependencies: - '@types/node': 20.4.9 + '@types/node': 20.5.0 merge-stream: 2.0.0 supports-color: 7.2.0 @@ -7519,7 +7529,6 @@ packages: - supports-color - ts-node - utf-8-validate - dev: true /jest/26.6.3_ts-node@10.9.0: resolution: {integrity: sha512-lGS5PXGAzR4RF7V5+XObhqz2KZIDUA1yD0DG6pBVmy10eh0ZIXQImRuzocsI/N2XZ1GrLFwTS27In2i2jlpq1Q==} @@ -7535,6 +7544,7 @@ packages: - supports-color - ts-node - utf-8-validate + dev: true /js-string-escape/1.0.1: resolution: {integrity: sha512-Smw4xcfIQ5LVjAOuJCvN/zIodzA/BBSsluuoSykP+lUvScIi4U6RJLfwHet5cxFnCswUjISV8oAXaqaJDY3chg==} @@ -10212,7 +10222,7 @@ packages: bs-logger: 0.2.6 buffer-from: 1.1.2 fast-json-stable-stringify: 2.1.0 - jest: 26.6.3_ts-node@10.9.0 + jest: 26.6.3 jest-util: 26.6.2 json5: 2.2.3 lodash: 4.17.21 @@ -10222,7 +10232,7 @@ packages: typescript: 4.9.5 yargs-parser: 20.2.9 - /ts-node/10.9.0_kl3m3ivcdd7ltqtdoai45npyxa: + /ts-node/10.9.0_cexlby4oa6uys4e6r2ufkcpuca: resolution: {integrity: sha512-bunW18GUyaCSYRev4DPf4SQpom3pWH29wKl0sDk5zE7ze19RImEVhCW7K4v3hHKkUyfWotU08ToE2RS+Y49aug==} hasBin: true peerDependencies: @@ -10241,7 +10251,7 @@ packages: '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.4 - '@types/node': 20.4.9 + '@types/node': 20.5.0 acorn: 8.10.0 acorn-walk: 8.2.0 arg: 4.1.3 @@ -10281,6 +10291,7 @@ packages: typescript: 4.9.5 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 + dev: true /tslib/1.14.1: resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} @@ -10578,9 +10589,10 @@ packages: /v8-compile-cache-lib/3.0.1: resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} + dev: true - /v8-compile-cache/2.3.0: - resolution: {integrity: sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==} + /v8-compile-cache/2.4.0: + resolution: {integrity: sha512-ocyWc3bAHBB/guyqJQVI5o4BZkPhznPYUG2ea80Gond/BgNWpap8TOmLSeeQG7bnh2KMISxskdADG59j7zruhw==} /v8-to-istanbul/7.1.2: resolution: {integrity: sha512-TxNb7YEUwkLXCQYeudi6lgQ/SZrzNO4kMdlqVxaZPUIUjCv6iSSypUQX70kNBSERpQ8fk48+d61FXk+tgqcWow==} @@ -10665,7 +10677,7 @@ packages: replace-ext: 1.0.1 dev: false - /vite-node/0.30.1_vyxotnqk6wev2645yt47o5pehq: + /vite-node/0.30.1_mvbvskp7gdyw7a32mvd4mncqbi: resolution: {integrity: sha512-vTikpU/J7e6LU/8iM3dzBo8ZhEiKZEKRznEMm+mJh95XhWaPrJQraT/QsT2NWmuEf+zgAoMe64PKT7hfZ1Njmg==} engines: {node: '>=v14.18.0'} hasBin: true @@ -10675,7 +10687,7 @@ packages: mlly: 1.4.0 pathe: 1.1.1 picocolors: 1.0.0 - vite: 3.2.6_vyxotnqk6wev2645yt47o5pehq + vite: 3.2.6_mvbvskp7gdyw7a32mvd4mncqbi transitivePeerDependencies: - '@types/node' - less @@ -10719,7 +10731,7 @@ packages: fsevents: 2.3.2 dev: true - /vite/3.2.6_vyxotnqk6wev2645yt47o5pehq: + /vite/3.2.6_mvbvskp7gdyw7a32mvd4mncqbi: resolution: {integrity: sha512-nTXTxYVvaQNLoW5BQ8PNNQ3lPia57gzsQU/Khv+JvzKPku8kNZL6NMUR/qwXhMG6E+g1idqEPanomJ+VZgixEg==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true @@ -10744,7 +10756,7 @@ packages: terser: optional: true dependencies: - '@types/node': 20.4.9 + '@types/node': 20.5.0 esbuild: 0.15.18 less: 4.1.3 postcss: 8.4.21 @@ -10788,7 +10800,7 @@ packages: dependencies: '@types/chai': 4.3.5 '@types/chai-subset': 1.3.3 - '@types/node': 20.4.9 + '@types/node': 20.5.0 '@vitest/expect': 0.30.1 '@vitest/runner': 0.30.1 '@vitest/snapshot': 0.30.1 @@ -10809,8 +10821,8 @@ packages: strip-literal: 1.3.0 tinybench: 2.5.0 tinypool: 0.4.0 - vite: 3.2.6_vyxotnqk6wev2645yt47o5pehq - vite-node: 0.30.1_vyxotnqk6wev2645yt47o5pehq + vite: 3.2.6_mvbvskp7gdyw7a32mvd4mncqbi + vite-node: 0.30.1_mvbvskp7gdyw7a32mvd4mncqbi why-is-node-running: 2.2.2 transitivePeerDependencies: - less @@ -11129,6 +11141,7 @@ packages: /yn/3.1.1: resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} engines: {node: '>=6'} + dev: true /yocto-queue/1.0.0: resolution: {integrity: sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==} diff --git a/packages/vrender-components/src/axis/base.ts b/packages/vrender-components/src/axis/base.ts index 427bb7ad2..5deab9182 100644 --- a/packages/vrender-components/src/axis/base.ts +++ b/packages/vrender-components/src/axis/base.ts @@ -14,7 +14,7 @@ import type { IText } from '@visactor/vrender'; // eslint-disable-next-line no-duplicate-imports -import { createLine, createText, createGroup, createRect } from '@visactor/vrender'; +import { createLine, createText, createGroup } from '@visactor/vrender'; import type { Dict } from '@visactor/vutils'; // eslint-disable-next-line no-duplicate-imports import { abs, cloneDeep, get, isEmpty, isFunction, isNumberClose, merge, pi } from '@visactor/vutils'; @@ -96,6 +96,11 @@ export abstract class AxisBase extends AbstractCom layer: number, layerCount: number ): void; + protected abstract getLabelAlign( + vector: [number, number], + inside?: boolean, + angle?: number + ): { textAlign: TextAlignType; textBaseline: TextBaselineType }; /** * 坐标轴的一个特殊的方法,用于不更新场景树来获取更新属性后的包围盒 @@ -557,13 +562,9 @@ export abstract class AxisBase extends AbstractCom textStyle = isFunction(textStyle) ? merge({}, DEFAULT_AXIS_THEME.label.style, textStyle(tickDatum, index, tickData, layer)) : textStyle; - textStyle = merge( - { - textAlign: this.getTextAlign(vector), - textBaseline: this.getTextBaseline(vector, inside) - }, - textStyle - ) as Partial; + + const labelAlign = this.getLabelAlign(vector, inside, (textStyle as ITextGraphicAttribute).angle); + textStyle = merge(labelAlign, textStyle) as Partial; // 兼容原先 style.text 回调的方式 if (isFunction(textStyle.text)) { // @ts-ignore diff --git a/packages/vrender-components/src/axis/circle.ts b/packages/vrender-components/src/axis/circle.ts index 8b0c86529..7f4de8207 100644 --- a/packages/vrender-components/src/axis/circle.ts +++ b/packages/vrender-components/src/axis/circle.ts @@ -1,7 +1,7 @@ /** * @description 圆弧型坐标轴 */ -import type { IGroup, IText, TextBaselineType } from '@visactor/vrender'; +import type { IGroup, IText, TextAlignType, TextBaselineType } from '@visactor/vrender'; // eslint-disable-next-line no-duplicate-imports import { createCircle } from '@visactor/vrender'; import { isNil, get, merge, polarToCartesian, isNumberClose, isEmpty } from '@visactor/vutils'; @@ -361,4 +361,15 @@ export class CircleAxis extends AxisBase { ): void { return; } + + protected getLabelAlign( + vector: [number, number], + inside?: boolean, + angle?: number + ): { textAlign: TextAlignType; textBaseline: TextBaselineType } { + return { + textAlign: this.getTextAlign(vector), + textBaseline: this.getTextBaseline(vector) + }; + } } diff --git a/packages/vrender-components/src/axis/line.ts b/packages/vrender-components/src/axis/line.ts index 0b371cc23..c1247ee5c 100644 --- a/packages/vrender-components/src/axis/line.ts +++ b/packages/vrender-components/src/axis/line.ts @@ -16,6 +16,7 @@ import { isValid, normalizePadding } from '@visactor/vutils'; +import type { TextAlignType } from '@visactor/vrender'; import { createRect, type IGroup, type INode, type IText, type TextBaselineType } from '@visactor/vrender'; import type { SegmentAttributes } from '../segment'; // eslint-disable-next-line no-duplicate-imports @@ -40,7 +41,7 @@ import { DEFAULT_AXIS_THEME } from './config'; import { AXIS_ELEMENT_NAME, DEFAULT_STATES } from './constant'; import { measureTextSize } from '../util'; import { autoHide as autoHideFunc } from './overlap/auto-hide'; -import { autoRotate as autoRotateFunc, rotateXAxis, rotateYAxis } from './overlap/auto-rotate'; +import { autoRotate as autoRotateFunc, getXAxisLabelAlign, getYAxisLabelAlign } from './overlap/auto-rotate'; import { autoLimit as autoLimitFunc } from './overlap/auto-limit'; import { alignAxisLabels } from '../util/align'; @@ -438,6 +439,27 @@ export class LineAxis extends AxisBase { return base; } + protected getLabelAlign( + vector: [number, number], + inside?: boolean, + angle?: number + ): { textAlign: TextAlignType; textBaseline: TextBaselineType } { + const orient = this.attribute.orient; + if (isValidNumber(angle)) { + if (orient === 'top' || orient === 'bottom') { + return getXAxisLabelAlign(orient, angle); + } + if (orient === 'left' || orient === 'right') { + return getYAxisLabelAlign(orient, angle); + } + } + + return { + textAlign: this.getTextAlign(vector), + textBaseline: this.getTextBaseline(vector, inside) + }; + } + protected beforeLabelsOverlap( labelShapes: IText[], labelData: AxisItem[], @@ -445,13 +467,7 @@ export class LineAxis extends AxisBase { layer: number, layerCount: number ): void { - // 调整对齐方式 - const orient = this.attribute.orient; - if (orient === 'left' || orient === 'right') { - rotateYAxis(orient, labelShapes); - } else if (orient === 'bottom' || orient === 'top') { - rotateXAxis(orient, labelShapes); - } + return; } protected handleLabelsOverlap( labelShapes: IText[], diff --git a/packages/vrender-components/src/axis/overlap/auto-rotate.ts b/packages/vrender-components/src/axis/overlap/auto-rotate.ts index 1cd4215da..582b4b10c 100644 --- a/packages/vrender-components/src/axis/overlap/auto-rotate.ts +++ b/packages/vrender-components/src/axis/overlap/auto-rotate.ts @@ -109,45 +109,43 @@ function genRotateBounds(items: IText[]) { }); } -export function rotateYAxis(orient: string, items: IText[]) { - // 0, 0-90, 90, 90-180, 180, 180-270, 270, 270-360, 360 - let align = ['right', 'right', 'center', 'left', 'center', 'left', 'center', 'right', 'right']; - let baseline = ['middle', 'middle', 'top', 'top', 'middle', 'middle', 'bottom', 'bottom', 'middle']; - - if (orient === 'right') { - // 0, 0-90, 90, 90-180, 180, 180-270, 270, 270-360, 360 - align = ['left', 'right', 'right', 'right', 'left', 'left', 'left', 'left', 'right']; - baseline = ['middle', 'bottom', 'middle', 'top', 'top', 'top', 'middle', 'bottom', 'bottom']; +function clampAngle(angle = 0) { + if (angle < 0) { + while (angle < 0) { + angle += Math.PI * 2; + } } + if (angle > 0) { + while (angle >= Math.PI * 2) { + angle -= Math.PI * 2; + } + } + + return angle; +} + +export function rotateYAxis(orient: string, items: IText[]) { // 由于左右轴会裁切,所以上下两个label需要额外处理,做tighten处理 items.forEach((item, i) => { - let angle = item.attribute.angle || 0; - if (angle < 0) { - while (angle < 0) { - angle += Math.PI * 2; - } - } - if (angle > 0) { - while (angle >= Math.PI * 2) { - angle -= Math.PI * 2; - } - } - const step = angle / (Math.PI * 0.5); - let index; - if (step === Math.floor(step)) { - index = Math.floor(step) * 2; - } else { - index = Math.floor(step) * 2 + 1; - } + const angle = clampAngle(item.attribute.angle || 0); item.setAttributes({ - textAlign: align[index] as TextAlignType, - textBaseline: baseline[index] as TextBaselineType, + ...getYAxisLabelAlign(orient, angle), angle: angle }); }); } export function rotateXAxis(orient: string, items: IText[]) { + items.forEach(item => { + const angle = clampAngle(item.attribute.angle || 0); + item.setAttributes({ + ...getXAxisLabelAlign(orient, angle), + angle: angle + }); + }); +} + +export function getXAxisLabelAlign(orient: string, angle: number = 0) { // 0, 0-90, 90, 90-180, 180, 180-270, 270, 270-360, 360 let align = ['center', 'left', 'left', 'left', 'center', 'right', 'right', 'right', 'left']; let baseline = ['top', 'top', 'middle', 'bottom', 'bottom', 'bottom', 'middle', 'top', 'top']; @@ -156,31 +154,42 @@ export function rotateXAxis(orient: string, items: IText[]) { align = ['center', 'right', 'right', 'right', 'center', 'left', 'left', 'left', 'right']; baseline = ['bottom', 'bottom', 'middle', 'top', 'top', 'top', 'middle', 'bottom', 'bottom']; } - items.forEach(item => { - let angle = item.attribute.angle || 0; - // todo angle为0跳过会导致下轴高度有bug - // if (angle === 0) return; - if (angle < 0) { - while (angle < 0) { - angle += Math.PI * 2; - } - } - if (angle > 0) { - while (angle >= Math.PI * 2) { - angle -= Math.PI * 2; - } - } - const step = angle / (Math.PI * 0.5); - let index; - if (step === Math.floor(step)) { - index = Math.floor(step) * 2; - } else { - index = Math.floor(step) * 2 + 1; - } - item.setAttributes({ - textAlign: align[index] as TextAlignType, - textBaseline: baseline[index] as TextBaselineType, - angle - }); - }); + + const step = angle / (Math.PI * 0.5); + let index; + if (step === Math.floor(step)) { + index = Math.floor(step) * 2; + } else { + index = Math.floor(step) * 2 + 1; + } + + return { + textAlign: align[index] as TextAlignType, + textBaseline: baseline[index] as TextBaselineType + }; +} + +export function getYAxisLabelAlign(orient: string, angle: number = 0) { + // 0, 0-90, 90, 90-180, 180, 180-270, 270, 270-360, 360 + let align = ['right', 'right', 'center', 'left', 'center', 'left', 'center', 'right', 'right']; + let baseline = ['middle', 'middle', 'top', 'top', 'middle', 'middle', 'bottom', 'bottom', 'middle']; + + if (orient === 'right') { + // 0, 0-90, 90, 90-180, 180, 180-270, 270, 270-360, 360 + align = ['left', 'right', 'right', 'right', 'left', 'left', 'left', 'left', 'right']; + baseline = ['middle', 'bottom', 'middle', 'top', 'top', 'top', 'middle', 'bottom', 'bottom']; + } + + const step = angle / (Math.PI * 0.5); + let index; + if (step === Math.floor(step)) { + index = Math.floor(step) * 2; + } else { + index = Math.floor(step) * 2 + 1; + } + + return { + textAlign: align[index] as TextAlignType, + textBaseline: baseline[index] as TextBaselineType + }; } From 2edb247cbad80fefbad597bf8b4be3dd3a43c10b Mon Sep 17 00:00:00 2001 From: kkxxkk2019 Date: Thu, 17 Aug 2023 14:47:47 +0800 Subject: [PATCH 32/35] chore: update rush change --- .../fix-axis-label-align_2023-08-17-06-47.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 common/changes/@visactor/vrender-components/fix-axis-label-align_2023-08-17-06-47.json diff --git a/common/changes/@visactor/vrender-components/fix-axis-label-align_2023-08-17-06-47.json b/common/changes/@visactor/vrender-components/fix-axis-label-align_2023-08-17-06-47.json new file mode 100644 index 000000000..e8f2554e7 --- /dev/null +++ b/common/changes/@visactor/vrender-components/fix-axis-label-align_2023-08-17-06-47.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender-components", + "comment": "fix: user's align config should be first", + "type": "patch" + } + ], + "packageName": "@visactor/vrender-components" +} \ No newline at end of file From 216b99d7bc5176b4499bfd3bcebb02f55e24b04c Mon Sep 17 00:00:00 2001 From: kkxxkk2019 Date: Thu, 17 Aug 2023 15:11:45 +0800 Subject: [PATCH 33/35] fix(vrender-components): user's align config should be first --- .../src/axis/overlap/auto-rotate.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/vrender-components/src/axis/overlap/auto-rotate.ts b/packages/vrender-components/src/axis/overlap/auto-rotate.ts index 582b4b10c..b7636e25e 100644 --- a/packages/vrender-components/src/axis/overlap/auto-rotate.ts +++ b/packages/vrender-components/src/axis/overlap/auto-rotate.ts @@ -127,20 +127,18 @@ function clampAngle(angle = 0) { export function rotateYAxis(orient: string, items: IText[]) { // 由于左右轴会裁切,所以上下两个label需要额外处理,做tighten处理 items.forEach((item, i) => { - const angle = clampAngle(item.attribute.angle || 0); item.setAttributes({ - ...getYAxisLabelAlign(orient, angle), - angle: angle + ...getYAxisLabelAlign(orient, item.attribute.angle), + angle: clampAngle(item.attribute.angle) }); }); } export function rotateXAxis(orient: string, items: IText[]) { items.forEach(item => { - const angle = clampAngle(item.attribute.angle || 0); item.setAttributes({ - ...getXAxisLabelAlign(orient, angle), - angle: angle + ...getXAxisLabelAlign(orient, item.attribute.angle), + angle: clampAngle(item.attribute.angle) }); }); } @@ -155,6 +153,7 @@ export function getXAxisLabelAlign(orient: string, angle: number = 0) { baseline = ['bottom', 'bottom', 'middle', 'top', 'top', 'top', 'middle', 'bottom', 'bottom']; } + angle = clampAngle(angle); const step = angle / (Math.PI * 0.5); let index; if (step === Math.floor(step)) { @@ -180,6 +179,7 @@ export function getYAxisLabelAlign(orient: string, angle: number = 0) { baseline = ['middle', 'bottom', 'middle', 'top', 'top', 'top', 'middle', 'bottom', 'bottom']; } + angle = clampAngle(angle); const step = angle / (Math.PI * 0.5); let index; if (step === Math.floor(step)) { From af779e0fc9ad7edda9db44a6ed91557705fd0f81 Mon Sep 17 00:00:00 2001 From: kkxxkk2019 Date: Thu, 17 Aug 2023 17:54:23 +0800 Subject: [PATCH 34/35] fix: better legend ellipsis --- packages/vrender-components/src/legend/discrete/discrete.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vrender-components/src/legend/discrete/discrete.ts b/packages/vrender-components/src/legend/discrete/discrete.ts index 2f1f25ab3..f2d964e4c 100644 --- a/packages/vrender-components/src/legend/discrete/discrete.ts +++ b/packages/vrender-components/src/legend/discrete/discrete.ts @@ -449,7 +449,7 @@ export class DiscreteLegend extends LegendBase { const labelBounds = labelShape.AABBBounds; const valueWidth = valueBounds.width(); const labelWidth = labelBounds.width(); - if (valueWidth + labelWidth > layoutWidth) { + if (labelWidth > layoutWidth) { if ((layoutWidth - valueWidth) / labelWidth > 0.4) { // 设置一个值,如果剩余的宽度和 label 自身的比例不低于 0.4 的话,优先展示全 label labelShape.setAttribute('maxLineWidth', layoutWidth - valueWidth); From 0e8f8bc98a58aa700be5ff0a5b9ac043a56e9b84 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 18 Aug 2023 09:04:22 +0000 Subject: [PATCH 35/35] build: prelease version 0.14.3 --- .../feat-arc-label_2023-08-13-15-14.json | 10 ---- ...date-attribute-event_2023-08-15-10-36.json | 10 ---- ...eat-marker-clipRange_2023-08-10-10-07.json | 10 ---- ...fill-stroke-strategy_2023-08-16-11-57.json | 10 ---- ...fix-axis-label-align_2023-08-17-06-47.json | 10 ---- .../fix-components-bugs_2023-08-15-10-44.json | 10 ---- ...eat-marker-clipRange_2023-08-10-10-07.json | 10 ---- .../fix-arc-conical-cap_2023-08-15-11-24.json | 10 ---- ...x-wrap-text-line-cut_2023-08-16-02-59.json | 10 ---- common/config/rush/pnpm-lock.yaml | 47 +++++++------------ docs/demos/package.json | 4 +- packages/react-vrender-utils/CHANGELOG.json | 15 ++++++ packages/react-vrender-utils/CHANGELOG.md | 7 ++- packages/react-vrender-utils/package.json | 6 +-- packages/react-vrender/CHANGELOG.json | 12 +++++ packages/react-vrender/CHANGELOG.md | 7 ++- packages/react-vrender/package.json | 4 +- packages/vrender-components/CHANGELOG.json | 32 +++++++++++++ packages/vrender-components/CHANGELOG.md | 14 +++++- packages/vrender-components/package.json | 4 +- packages/vrender-kits/CHANGELOG.json | 12 +++++ packages/vrender-kits/CHANGELOG.md | 7 ++- packages/vrender-kits/package.json | 4 +- packages/vrender/CHANGELOG.json | 18 +++++++ packages/vrender/CHANGELOG.md | 11 ++++- packages/vrender/package.json | 2 +- 26 files changed, 159 insertions(+), 137 deletions(-) delete mode 100644 common/changes/@visactor/vrender-components/feat-arc-label_2023-08-13-15-14.json delete mode 100644 common/changes/@visactor/vrender-components/feat-legend-update-attribute-event_2023-08-15-10-36.json delete mode 100644 common/changes/@visactor/vrender-components/feat-marker-clipRange_2023-08-10-10-07.json delete mode 100644 common/changes/@visactor/vrender-components/feat-smartInvert-fill-stroke-strategy_2023-08-16-11-57.json delete mode 100644 common/changes/@visactor/vrender-components/fix-axis-label-align_2023-08-17-06-47.json delete mode 100644 common/changes/@visactor/vrender-components/fix-components-bugs_2023-08-15-10-44.json delete mode 100644 common/changes/@visactor/vrender/feat-marker-clipRange_2023-08-10-10-07.json delete mode 100644 common/changes/@visactor/vrender/fix-arc-conical-cap_2023-08-15-11-24.json delete mode 100644 common/changes/@visactor/vrender/fix-wrap-text-line-cut_2023-08-16-02-59.json diff --git a/common/changes/@visactor/vrender-components/feat-arc-label_2023-08-13-15-14.json b/common/changes/@visactor/vrender-components/feat-arc-label_2023-08-13-15-14.json deleted file mode 100644 index 3e50df0d4..000000000 --- a/common/changes/@visactor/vrender-components/feat-arc-label_2023-08-13-15-14.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vrender-components", - "comment": "feat: change labelLine of arc label from path mark to line mark to adapt to animation'", - "type": "patch" - } - ], - "packageName": "@visactor/vrender-components" -} \ No newline at end of file diff --git a/common/changes/@visactor/vrender-components/feat-legend-update-attribute-event_2023-08-15-10-36.json b/common/changes/@visactor/vrender-components/feat-legend-update-attribute-event_2023-08-15-10-36.json deleted file mode 100644 index a89c559ca..000000000 --- a/common/changes/@visactor/vrender-components/feat-legend-update-attribute-event_2023-08-15-10-36.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vrender-components", - "comment": "feat: add legendItemAttributeUpdate event in legend", - "type": "patch" - } - ], - "packageName": "@visactor/vrender-components" -} \ No newline at end of file diff --git a/common/changes/@visactor/vrender-components/feat-marker-clipRange_2023-08-10-10-07.json b/common/changes/@visactor/vrender-components/feat-marker-clipRange_2023-08-10-10-07.json deleted file mode 100644 index 35192468b..000000000 --- a/common/changes/@visactor/vrender-components/feat-marker-clipRange_2023-08-10-10-07.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vrender-components", - "comment": "feat(marker): add clipRange config. fixed VisActor/VChart#181", - "type": "patch" - } - ], - "packageName": "@visactor/vrender-components" -} \ No newline at end of file diff --git a/common/changes/@visactor/vrender-components/feat-smartInvert-fill-stroke-strategy_2023-08-16-11-57.json b/common/changes/@visactor/vrender-components/feat-smartInvert-fill-stroke-strategy_2023-08-16-11-57.json deleted file mode 100644 index 4a46e4bf6..000000000 --- a/common/changes/@visactor/vrender-components/feat-smartInvert-fill-stroke-strategy_2023-08-16-11-57.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vrender-components", - "comment": "feat: smartInvert support fillStrategy strokeStrategy", - "type": "patch" - } - ], - "packageName": "@visactor/vrender-components" -} \ No newline at end of file diff --git a/common/changes/@visactor/vrender-components/fix-axis-label-align_2023-08-17-06-47.json b/common/changes/@visactor/vrender-components/fix-axis-label-align_2023-08-17-06-47.json deleted file mode 100644 index e8f2554e7..000000000 --- a/common/changes/@visactor/vrender-components/fix-axis-label-align_2023-08-17-06-47.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vrender-components", - "comment": "fix: user's align config should be first", - "type": "patch" - } - ], - "packageName": "@visactor/vrender-components" -} \ No newline at end of file diff --git a/common/changes/@visactor/vrender-components/fix-components-bugs_2023-08-15-10-44.json b/common/changes/@visactor/vrender-components/fix-components-bugs_2023-08-15-10-44.json deleted file mode 100644 index a4dbfb891..000000000 --- a/common/changes/@visactor/vrender-components/fix-components-bugs_2023-08-15-10-44.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vrender-components", - "comment": "fix: label shoud omit automaticly when label's width exceeds item's width, relate https://github.com/VisActor/VChart/issues/505", - "type": "patch" - } - ], - "packageName": "@visactor/vrender-components" -} \ No newline at end of file diff --git a/common/changes/@visactor/vrender/feat-marker-clipRange_2023-08-10-10-07.json b/common/changes/@visactor/vrender/feat-marker-clipRange_2023-08-10-10-07.json deleted file mode 100644 index 1f90297f1..000000000 --- a/common/changes/@visactor/vrender/feat-marker-clipRange_2023-08-10-10-07.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vrender", - "comment": "feat(marker): add clipRange config. fixed VisActor/VChart#181'", - "type": "patch" - } - ], - "packageName": "@visactor/vrender" -} \ No newline at end of file diff --git a/common/changes/@visactor/vrender/fix-arc-conical-cap_2023-08-15-11-24.json b/common/changes/@visactor/vrender/fix-arc-conical-cap_2023-08-15-11-24.json deleted file mode 100644 index 573127d36..000000000 --- a/common/changes/@visactor/vrender/fix-arc-conical-cap_2023-08-15-11-24.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vrender", - "comment": "fix: fix the issue with arc conical color after configuring cap, closed #455", - "type": "patch" - } - ], - "packageName": "@visactor/vrender" -} \ No newline at end of file diff --git a/common/changes/@visactor/vrender/fix-wrap-text-line-cut_2023-08-16-02-59.json b/common/changes/@visactor/vrender/fix-wrap-text-line-cut_2023-08-16-02-59.json deleted file mode 100644 index 2a6a75a3b..000000000 --- a/common/changes/@visactor/vrender/fix-wrap-text-line-cut_2023-08-16-02-59.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vrender", - "comment": "fix: fix wrapText line cut error", - "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 9d9834bd7..8ede4d4b6 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.14.2 - '@visactor/vrender-kits': workspace:0.12.16 + '@visactor/vrender': workspace:0.14.3 + '@visactor/vrender-kits': workspace:0.12.17 '@visactor/vutils': ~0.15.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.14.2 + '@visactor/vrender': workspace:0.14.3 '@visactor/vutils': ~0.15.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.12.16 - '@visactor/vrender': workspace:0.14.2 + '@visactor/react-vrender': workspace:0.12.17 + '@visactor/vrender': workspace:0.14.3 '@visactor/vutils': ~0.15.5 '@vitejs/plugin-react': 3.1.0 eslint: ~8.18.0 @@ -184,7 +184,7 @@ importers: '@internal/ts-config': workspace:* '@rushstack/eslint-patch': ~1.1.4 '@types/jest': ^26.0.0 - '@visactor/vrender': workspace:0.14.2 + '@visactor/vrender': workspace:0.14.3 '@visactor/vscale': ~0.15.5 '@visactor/vutils': ~0.15.5 eslint: ~8.18.0 @@ -224,7 +224,7 @@ importers: '@types/node-fetch': 2.6.4 '@types/react': 16.9.49 '@types/react-dom': 16.9.8 - '@visactor/vrender': workspace:0.14.2 + '@visactor/vrender': workspace:0.14.3 '@visactor/vutils': ~0.15.5 '@vitejs/plugin-react': 3.1.0 canvas: 2.11.2 @@ -1785,7 +1785,6 @@ packages: engines: {node: '>=12'} dependencies: '@jridgewell/trace-mapping': 0.3.9 - dev: true /@electron/get/1.14.1: resolution: {integrity: sha512-BrZYyL/6m0ZXz/lDxy/nlVhQz+WF+iPS6qXolEU8atw7h6v1aYkjwJZ63m+bJMBTxDE66X+r2tPS4a/8C82sZw==} @@ -1958,6 +1957,7 @@ packages: - supports-color - ts-node - utf-8-validate + dev: true /@jest/core/26.6.3_ts-node@10.9.0: resolution: {integrity: sha512-xvV1kKbhfUqFVuZ8Cyo+JPpipAHHAV3kcDBftiduK8EICXmTFddryy3P7NfZt8Pv37rA9nEJBKCCkglCPt/Xjw==} @@ -1997,7 +1997,6 @@ packages: - supports-color - ts-node - utf-8-validate - dev: true /@jest/environment/24.9.0: resolution: {integrity: sha512-5A1QluTPhvdIPFYnO3sZC3smkNeXPVELz7ikPbhUj0bQjB07EoE9qtLrem14ZUYWdVayYbsjVwIiL4WBIMV4aQ==} @@ -2143,6 +2142,7 @@ packages: - supports-color - ts-node - utf-8-validate + dev: true /@jest/test-sequencer/26.6.3_ts-node@10.9.0: resolution: {integrity: sha512-YHlVIjP5nfEyjlrSr8t/YdNfU/1XEt7c5b4OxcXCjyRhjzLYu/rO69/WHPuYcbCWkz8kAeZVZp2N2+IOLLEPGw==} @@ -2159,7 +2159,6 @@ packages: - supports-color - ts-node - utf-8-validate - dev: true /@jest/transform/24.9.0: resolution: {integrity: sha512-TcQUmyNRxV94S0QpMOnZl0++6RMiqpbH/ZMccFB/amku6Uwvyb1cjYX7xkp5nGNkbX4QPH/FcB6q1HBTHynLmQ==} @@ -2262,7 +2261,6 @@ packages: dependencies: '@jridgewell/resolve-uri': 3.1.1 '@jridgewell/sourcemap-codec': 1.4.15 - dev: true /@mapbox/node-pre-gyp/1.0.11: resolution: {integrity: sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==} @@ -2623,19 +2621,15 @@ packages: /@tsconfig/node10/1.0.9: resolution: {integrity: sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==} - dev: true /@tsconfig/node12/1.0.11: resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==} - dev: true /@tsconfig/node14/1.0.3: resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==} - dev: true /@tsconfig/node16/1.0.4: resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} - dev: true /@turf/helpers/6.5.0: resolution: {integrity: sha512-VbI1dV5bLFzohYYdgqwikdMVpe7pJ9X3E+dlr425wa2/sMJqYDhTO++ec38/pcPvPE6oD9WEEeU3Xu3gza+VPw==} @@ -3164,7 +3158,6 @@ packages: /acorn-walk/8.2.0: resolution: {integrity: sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==} engines: {node: '>=0.4.0'} - dev: true /acorn/5.7.4: resolution: {integrity: sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==} @@ -3314,7 +3307,6 @@ packages: /arg/4.1.3: resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} - dev: true /argparse/1.0.10: resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} @@ -4231,7 +4223,6 @@ packages: /create-require/1.1.1: resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} - dev: true /cross-spawn/6.0.5: resolution: {integrity: sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==} @@ -4501,7 +4492,6 @@ packages: /diff/4.0.2: resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} engines: {node: '>=0.3.1'} - dev: true /dir-glob/3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} @@ -6628,6 +6618,7 @@ packages: - supports-color - ts-node - utf-8-validate + dev: true /jest-cli/26.6.3_ts-node@10.9.0: resolution: {integrity: sha512-GF9noBSa9t08pSyl3CY4frMrqp+aQXFGFkf5hEPbh/pIUFYWMK6ZLTfbmadxJVcJrdRoChlWQsA2VkJcDFK8hg==} @@ -6653,7 +6644,6 @@ packages: - supports-color - ts-node - utf-8-validate - dev: true /jest-config/24.9.0: resolution: {integrity: sha512-RATtQJtVYQrp7fvWg6f5y3pEFj9I+H8sWw4aKxnDZ96mob5i5SD6ZEGWgMLXQ4LE8UurrjbdlLWdUeo+28QpfQ==} @@ -6712,6 +6702,7 @@ packages: - canvas - supports-color - utf-8-validate + dev: true /jest-config/26.6.3_ts-node@10.9.0: resolution: {integrity: sha512-t5qdIj/bCj2j7NFVHb2nFB4aUdfucDn3JRKgrZnplb8nieAirAzRSHP8uDEd+qV6ygzg9Pz4YG7UTJf94LPSyg==} @@ -6746,7 +6737,6 @@ packages: - canvas - supports-color - utf-8-validate - dev: true /jest-diff/24.9.0: resolution: {integrity: sha512-qMfrTs8AdJE2iqrTp0hzh7kTd2PQWrsFyj9tORoKmu32xjPjeE4NyjVRDz8ybYwqS2ik8N4hsIpiVTyFeo2lBQ==} @@ -6817,7 +6807,7 @@ packages: jest: ^24.0.0 dependencies: electron: 11.5.0 - jest: 26.6.3 + jest: 26.6.3_ts-node@10.9.0 jest-haste-map: 24.9.0 jest-message-util: 24.9.0 jest-mock: 24.9.0 @@ -7001,6 +6991,7 @@ packages: - supports-color - ts-node - utf-8-validate + dev: true /jest-jasmine2/26.6.3_ts-node@10.9.0: resolution: {integrity: sha512-kPKUrQtc8aYwBV7CqBg5pu+tmYXlvFlSFYn18ev4gPFtrRzB15N2gW/Roew3187q2w2eHuu0MU9TJz6w0/nPEg==} @@ -7030,7 +7021,6 @@ packages: - supports-color - ts-node - utf-8-validate - dev: true /jest-leak-detector/24.9.0: resolution: {integrity: sha512-tYkFIDsiKTGwb2FG1w8hX9V0aUb2ot8zY/2nFg087dUageonw1zrLMP4W6zsRO59dPkTSKie+D4rhMuP9nRmrA==} @@ -7239,6 +7229,7 @@ packages: - supports-color - ts-node - utf-8-validate + dev: true /jest-runner/26.6.3_ts-node@10.9.0: resolution: {integrity: sha512-atgKpRHnaA2OvByG/HpGA4g6CSPS/1LK0jK3gATJAoptC1ojltpmVlYC3TYgdmGp+GLuhzpH30Gvs36szSL2JQ==} @@ -7270,7 +7261,6 @@ packages: - supports-color - ts-node - utf-8-validate - dev: true /jest-runtime/24.9.0: resolution: {integrity: sha512-8oNqgnmF3v2J6PVRM2Jfuj8oX3syKmaynlDMMKQ4iyzbQzIG6th5ub/lM2bCMTmoTKM3ykcUYI2Pw9xwNtjMnw==} @@ -7342,6 +7332,7 @@ packages: - supports-color - ts-node - utf-8-validate + dev: true /jest-runtime/26.6.3_ts-node@10.9.0: resolution: {integrity: sha512-lrzyR3N8sacTAMeonbqpnSka1dHNux2uk0qqDXVkMv2c/A3wYnvQ4EXuI013Y6+gSKSCxdaczvf4HF0mVXHRdw==} @@ -7381,7 +7372,6 @@ packages: - supports-color - ts-node - utf-8-validate - dev: true /jest-serializer/24.9.0: resolution: {integrity: sha512-DxYipDr8OvfrKH3Kel6NdED3OXxjvxXZ1uIY2I9OFbGg+vUkkg7AGvi65qbhbWNPvDckXmzMPbK3u3HaDO49bQ==} @@ -7529,6 +7519,7 @@ packages: - supports-color - ts-node - utf-8-validate + dev: true /jest/26.6.3_ts-node@10.9.0: resolution: {integrity: sha512-lGS5PXGAzR4RF7V5+XObhqz2KZIDUA1yD0DG6pBVmy10eh0ZIXQImRuzocsI/N2XZ1GrLFwTS27In2i2jlpq1Q==} @@ -7544,7 +7535,6 @@ packages: - supports-color - ts-node - utf-8-validate - dev: true /js-string-escape/1.0.1: resolution: {integrity: sha512-Smw4xcfIQ5LVjAOuJCvN/zIodzA/BBSsluuoSykP+lUvScIi4U6RJLfwHet5cxFnCswUjISV8oAXaqaJDY3chg==} @@ -10222,7 +10212,7 @@ packages: bs-logger: 0.2.6 buffer-from: 1.1.2 fast-json-stable-stringify: 2.1.0 - jest: 26.6.3 + jest: 26.6.3_ts-node@10.9.0 jest-util: 26.6.2 json5: 2.2.3 lodash: 4.17.21 @@ -10291,7 +10281,6 @@ packages: typescript: 4.9.5 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 - dev: true /tslib/1.14.1: resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} @@ -10589,7 +10578,6 @@ packages: /v8-compile-cache-lib/3.0.1: resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} - dev: true /v8-compile-cache/2.4.0: resolution: {integrity: sha512-ocyWc3bAHBB/guyqJQVI5o4BZkPhznPYUG2ea80Gond/BgNWpap8TOmLSeeQG7bnh2KMISxskdADG59j7zruhw==} @@ -11141,7 +11129,6 @@ packages: /yn/3.1.1: resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} engines: {node: '>=6'} - dev: true /yocto-queue/1.0.0: resolution: {integrity: sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==} diff --git a/docs/demos/package.json b/docs/demos/package.json index 20f9690d5..aff61db4b 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/vrender-kits": "workspace:0.12.16", + "@visactor/vrender-kits": "workspace:0.12.17", "@visactor/vutils": "~0.15.5", "d3-scale-chromatic": "^3.0.0", "lodash": "4.17.21", @@ -28,6 +28,6 @@ "@antv/g": "^5.7.4" }, "dependencies": { - "@visactor/vrender": "workspace:0.14.2" + "@visactor/vrender": "workspace:0.14.3" } } diff --git a/packages/react-vrender-utils/CHANGELOG.json b/packages/react-vrender-utils/CHANGELOG.json index 176e676ad..a94831395 100644 --- a/packages/react-vrender-utils/CHANGELOG.json +++ b/packages/react-vrender-utils/CHANGELOG.json @@ -1,6 +1,21 @@ { "name": "@visactor/react-vrender-utils", "entries": [ + { + "version": "0.12.17", + "tag": "@visactor/react-vrender-utils_v0.12.17", + "date": "Fri, 18 Aug 2023 08:54:52 GMT", + "comments": { + "dependency": [ + { + "comment": "Updating dependency \"@visactor/vrender\" from `0.14.2` to `0.14.3`" + }, + { + "comment": "Updating dependency \"@visactor/react-vrender\" from `0.12.16` to `0.12.17`" + } + ] + } + }, { "version": "0.12.16", "tag": "@visactor/react-vrender-utils_v0.12.16", diff --git a/packages/react-vrender-utils/CHANGELOG.md b/packages/react-vrender-utils/CHANGELOG.md index 1e00d6ac5..f199acfb7 100644 --- a/packages/react-vrender-utils/CHANGELOG.md +++ b/packages/react-vrender-utils/CHANGELOG.md @@ -1,6 +1,11 @@ # Change Log - @visactor/react-vrender-utils -This log was last generated on Fri, 11 Aug 2023 10:05:27 GMT and should not be manually modified. +This log was last generated on Fri, 18 Aug 2023 08:54:52 GMT and should not be manually modified. + +## 0.12.17 +Fri, 18 Aug 2023 08:54:52 GMT + +_Version update only_ ## 0.12.16 Fri, 11 Aug 2023 10:05:27 GMT diff --git a/packages/react-vrender-utils/package.json b/packages/react-vrender-utils/package.json index bb441b2a2..6484eba74 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.12.16", + "version": "0.12.17", "description": "", "sideEffects": false, "main": "cjs/index.js", @@ -25,8 +25,8 @@ "react-dom": "^18.2.0" }, "dependencies": { - "@visactor/vrender": "workspace:0.14.2", - "@visactor/react-vrender": "workspace:0.12.16", + "@visactor/vrender": "workspace:0.14.3", + "@visactor/react-vrender": "workspace:0.12.17", "@visactor/vutils": "~0.15.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 6106b6d0b..7c7e41e13 100644 --- a/packages/react-vrender/CHANGELOG.json +++ b/packages/react-vrender/CHANGELOG.json @@ -1,6 +1,18 @@ { "name": "@visactor/react-vrender", "entries": [ + { + "version": "0.12.17", + "tag": "@visactor/react-vrender_v0.12.17", + "date": "Fri, 18 Aug 2023 08:54:52 GMT", + "comments": { + "dependency": [ + { + "comment": "Updating dependency \"@visactor/vrender\" from `0.14.2` to `0.14.3`" + } + ] + } + }, { "version": "0.12.16", "tag": "@visactor/react-vrender_v0.12.16", diff --git a/packages/react-vrender/CHANGELOG.md b/packages/react-vrender/CHANGELOG.md index a47a87ad4..63c04e9a9 100644 --- a/packages/react-vrender/CHANGELOG.md +++ b/packages/react-vrender/CHANGELOG.md @@ -1,6 +1,11 @@ # Change Log - @visactor/react-vrender -This log was last generated on Fri, 11 Aug 2023 10:05:27 GMT and should not be manually modified. +This log was last generated on Fri, 18 Aug 2023 08:54:52 GMT and should not be manually modified. + +## 0.12.17 +Fri, 18 Aug 2023 08:54:52 GMT + +_Version update only_ ## 0.12.16 Fri, 11 Aug 2023 10:05:27 GMT diff --git a/packages/react-vrender/package.json b/packages/react-vrender/package.json index 8e82682b0..17fe775b5 100644 --- a/packages/react-vrender/package.json +++ b/packages/react-vrender/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/react-vrender", - "version": "0.12.16", + "version": "0.12.17", "description": "", "sideEffects": false, "main": "cjs/index.js", @@ -24,7 +24,7 @@ "react": "^18.2.0" }, "dependencies": { - "@visactor/vrender": "workspace:0.14.2", + "@visactor/vrender": "workspace:0.14.3", "@visactor/vutils": "~0.15.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 d4a7af4ad..133860df6 100644 --- a/packages/vrender-components/CHANGELOG.json +++ b/packages/vrender-components/CHANGELOG.json @@ -1,6 +1,38 @@ { "name": "@visactor/vrender-components", "entries": [ + { + "version": "0.14.3", + "tag": "@visactor/vrender-components_v0.14.3", + "date": "Fri, 18 Aug 2023 08:54:52 GMT", + "comments": { + "patch": [ + { + "comment": "feat: change labelLine of arc label from path mark to line mark to adapt to animation'" + }, + { + "comment": "feat: add legendItemAttributeUpdate event in legend" + }, + { + "comment": "feat(marker): add clipRange config. fixed VisActor/VChart#181" + }, + { + "comment": "feat: smartInvert support fillStrategy strokeStrategy" + }, + { + "comment": "fix: user's align config should be first" + }, + { + "comment": "fix: label shoud omit automaticly when label's width exceeds item's width, relate https://github.com/VisActor/VChart/issues/505" + } + ], + "dependency": [ + { + "comment": "Updating dependency \"@visactor/vrender\" from `0.14.2` to `0.14.3`" + } + ] + } + }, { "version": "0.14.2", "tag": "@visactor/vrender-components_v0.14.2", diff --git a/packages/vrender-components/CHANGELOG.md b/packages/vrender-components/CHANGELOG.md index 8106e503b..98ab519f4 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 Fri, 11 Aug 2023 10:05:27 GMT and should not be manually modified. +This log was last generated on Fri, 18 Aug 2023 08:54:52 GMT and should not be manually modified. + +## 0.14.3 +Fri, 18 Aug 2023 08:54:52 GMT + +### Patches + +- feat: change labelLine of arc label from path mark to line mark to adapt to animation' +- feat: add legendItemAttributeUpdate event in legend +- feat(marker): add clipRange config. fixed VisActor/VChart#181 +- feat: smartInvert support fillStrategy strokeStrategy +- fix: user's align config should be first +- fix: label shoud omit automaticly when label's width exceeds item's width, relate https://github.com/VisActor/VChart/issues/505 ## 0.14.2 Fri, 11 Aug 2023 10:05:27 GMT diff --git a/packages/vrender-components/package.json b/packages/vrender-components/package.json index 94ae2cdf8..f94d844c0 100644 --- a/packages/vrender-components/package.json +++ b/packages/vrender-components/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vrender-components", - "version": "0.14.2", + "version": "0.14.3", "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.14.2", + "@visactor/vrender": "workspace:0.14.3", "@visactor/vutils": "~0.15.5", "@visactor/vscale": "~0.15.5", "inversify": "6.0.1" diff --git a/packages/vrender-kits/CHANGELOG.json b/packages/vrender-kits/CHANGELOG.json index 301509e9f..4be82d420 100644 --- a/packages/vrender-kits/CHANGELOG.json +++ b/packages/vrender-kits/CHANGELOG.json @@ -1,6 +1,18 @@ { "name": "@visactor/vrender-kits", "entries": [ + { + "version": "0.12.17", + "tag": "@visactor/vrender-kits_v0.12.17", + "date": "Fri, 18 Aug 2023 08:54:52 GMT", + "comments": { + "dependency": [ + { + "comment": "Updating dependency \"@visactor/vrender\" from `0.14.2` to `0.14.3`" + } + ] + } + }, { "version": "0.12.16", "tag": "@visactor/vrender-kits_v0.12.16", diff --git a/packages/vrender-kits/CHANGELOG.md b/packages/vrender-kits/CHANGELOG.md index 2b40b27a0..dbca0135b 100644 --- a/packages/vrender-kits/CHANGELOG.md +++ b/packages/vrender-kits/CHANGELOG.md @@ -1,6 +1,11 @@ # Change Log - @visactor/vrender-kits -This log was last generated on Fri, 11 Aug 2023 10:05:27 GMT and should not be manually modified. +This log was last generated on Fri, 18 Aug 2023 08:54:52 GMT and should not be manually modified. + +## 0.12.17 +Fri, 18 Aug 2023 08:54:52 GMT + +_Version update only_ ## 0.12.16 Fri, 11 Aug 2023 10:05:27 GMT diff --git a/packages/vrender-kits/package.json b/packages/vrender-kits/package.json index 448b6402e..b1247cfc7 100644 --- a/packages/vrender-kits/package.json +++ b/packages/vrender-kits/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vrender-kits", - "version": "0.12.16", + "version": "0.12.17", "description": "", "sideEffects": false, "main": "cjs/index.js", @@ -21,7 +21,7 @@ "prepublishOnly": "npm run build" }, "dependencies": { - "@visactor/vrender": "workspace:0.14.2", + "@visactor/vrender": "workspace:0.14.3", "@visactor/vutils": "~0.15.5", "@resvg/resvg-js": "2.4.1", "canvas": "2.11.2", diff --git a/packages/vrender/CHANGELOG.json b/packages/vrender/CHANGELOG.json index 5765f797e..46d8f8c73 100644 --- a/packages/vrender/CHANGELOG.json +++ b/packages/vrender/CHANGELOG.json @@ -1,6 +1,24 @@ { "name": "@visactor/vrender", "entries": [ + { + "version": "0.14.3", + "tag": "@visactor/vrender_v0.14.3", + "date": "Fri, 18 Aug 2023 08:54:52 GMT", + "comments": { + "patch": [ + { + "comment": "feat(marker): add clipRange config. fixed VisActor/VChart#181'" + }, + { + "comment": "fix: fix the issue with arc conical color after configuring cap, closed #455" + }, + { + "comment": "fix: fix wrapText line cut error" + } + ] + } + }, { "version": "0.14.2", "tag": "@visactor/vrender_v0.14.2", diff --git a/packages/vrender/CHANGELOG.md b/packages/vrender/CHANGELOG.md index 7b2906e55..2cbd78ca8 100644 --- a/packages/vrender/CHANGELOG.md +++ b/packages/vrender/CHANGELOG.md @@ -1,6 +1,15 @@ # Change Log - @visactor/vrender -This log was last generated on Fri, 11 Aug 2023 10:05:27 GMT and should not be manually modified. +This log was last generated on Fri, 18 Aug 2023 08:54:52 GMT and should not be manually modified. + +## 0.14.3 +Fri, 18 Aug 2023 08:54:52 GMT + +### Patches + +- feat(marker): add clipRange config. fixed VisActor/VChart#181' +- fix: fix the issue with arc conical color after configuring cap, closed #455 +- fix: fix wrapText line cut error ## 0.14.2 Fri, 11 Aug 2023 10:05:27 GMT diff --git a/packages/vrender/package.json b/packages/vrender/package.json index 826cfe458..bf9da9576 100644 --- a/packages/vrender/package.json +++ b/packages/vrender/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vrender", - "version": "0.14.2", + "version": "0.14.3", "description": "", "sideEffects": true, "main": "cjs/index.js",