@visactor/vgrammar-core 0.15.0-beta.1 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/graph/canvas-renderer.js +2 -1
- package/cjs/graph/canvas-renderer.js.map +1 -1
- package/cjs/graph/glyph-element.js +2 -1
- package/cjs/graph/glyph-element.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/view/mark-animate-mixin.js +1 -1
- package/cjs/view/mark-animate-mixin.js.map +1 -1
- package/es/graph/canvas-renderer.js +2 -1
- package/es/graph/canvas-renderer.js.map +1 -1
- package/es/graph/glyph-element.js +2 -1
- package/es/graph/glyph-element.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/view/mark-animate-mixin.js +1 -1
- package/es/view/mark-animate-mixin.js.map +1 -1
- package/package.json +10 -10
|
@@ -104,7 +104,8 @@ class CanvasRenderer {
|
|
|
104
104
|
ticker: viewOptions.ticker,
|
|
105
105
|
supportsTouchEvents: viewOptions.supportsTouchEvents,
|
|
106
106
|
supportsPointerEvents: viewOptions.supportsPointerEvents,
|
|
107
|
-
ReactDOM: viewOptions.ReactDOM
|
|
107
|
+
ReactDOM: viewOptions.ReactDOM,
|
|
108
|
+
autoRefresh: viewOptions.autoRefresh
|
|
108
109
|
});
|
|
109
110
|
(null === (_b = viewOptions.options3d) || void 0 === _b ? void 0 : _b.enable) && stage.set3dOptions(viewOptions.options3d),
|
|
110
111
|
stage.enableIncrementalAutoRender(), this._viewBox = viewOptions.viewBox, this._view.emit(enums_1.HOOK_EVENT.AFTER_CREATE_VRENDER_STAGE),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/canvas-renderer.ts"],"names":[],"mappings":";;AAEA,6CAA4C;AAG5C,yDAA0E;AAG1E,mCAAqC;AAGrC,6CAA0C;AAE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,CAAC,IAAI,CAAC,kBAAU,CAAC,0BAA0B,CAAC,CAAC;QAEvD,IAAI,CAAA,MAAA,IAAI,CAAC,YAAY,0CAAE,IAAI,KAAI,iBAAO,CAAC,mBAAmB,CAAC,MAAM,CAAC,EAAE;YAElE,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,iBAAO,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,KAAgC,CAAc,CAAC;SACjH;QACD,IAAI,CAAA,MAAA,IAAI,CAAC,YAAY,0CAAE,OAAO,KAAI,iBAAO,CAAC,mBAAmB,CAAC,SAAS,CAAC,EAAE;YACxE,MAAM,aAAa,GAAG,IAAA,iBAAQ,EAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YAE3F,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,iBAAO,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CACpE,KAAgC,EAChC,aAAa,CACH,CAAC;SACd;QAED,OAAO;YACL,KAAK;YACL,KAAK;SACN,CAAC;IACJ,CAAC;IAEO,SAAS;QACf,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YAE5C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YACpB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YAEpB,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;YAC3C,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;SAC7B;IACH,CAAC;CAUF;AA1QD,iCA0QC","file":"canvas-renderer.js","sourcesContent":["import type { IBoundsLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { isObject } from '@visactor/vutils';\nimport type { IEventTarget, IColor, ILayer, Stage } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { createStage, waitForAllSubLayers } from '@visactor/vrender-core';\nimport type { IViewOptions, IView, IMark, IViewEventConfig } from '../types';\nimport type { IRenderer } from '../types/renderer';\nimport { HOOK_EVENT } from './enums';\nimport type { DragNDrop } from '@visactor/vrender-kits';\nimport type { Gesture } from '@visactor/vrender-kits';\nimport { Factory } from '../core/factory';\n\nexport default class CanvasRenderer implements IRenderer {\n private _width: number;\n private _height: number;\n\n private _view: IView;\n private _viewOptions: IViewOptions;\n private _eventConfig: IViewEventConfig;\n private _stage: Stage;\n private _layer: ILayer;\n private _dragController: DragNDrop;\n private _gestureController: Gesture;\n private _viewBox: IBoundsLike;\n\n constructor(view: IView) {\n this._view = view;\n }\n\n initialize(width: number, height: number, options: IViewOptions, eventConfig: IViewEventConfig) {\n this._width = width;\n this._height = height;\n this._viewOptions = options;\n this._eventConfig = eventConfig;\n\n this.initStage();\n\n // this method will invoke resize to size the canvas appropriately\n return this;\n }\n\n stage() {\n return this._stage ?? null;\n }\n\n gestureController() {\n return this._gestureController ?? null;\n }\n\n canvas() {\n if (this._stage) {\n return this._stage.window.getNativeHandler().nativeCanvas;\n }\n return null;\n }\n\n context() {\n if (this._stage) {\n return this._stage.window.getContext().nativeContext;\n }\n return null;\n }\n\n combineIncrementalLayers() {\n if (this._stage) {\n waitForAllSubLayers(this._stage as any).then(() => {\n // stage might be null in current tick\n if (this._stage) {\n this._stage.defaultLayer.combineSubLayer();\n }\n });\n }\n return this;\n }\n\n background(color: IColor) {\n if (this._stage) {\n this._stage.background = color;\n return this;\n }\n }\n\n setDpr(resolution: number, redraw: boolean) {\n this._stage?.setDpr?.(resolution);\n if (redraw) {\n this.renderNextFrame();\n }\n return this;\n }\n\n shouldResize(width: number, height: number) {\n return width !== this._width || height !== this._height;\n }\n\n resize(width: number, height: number) {\n this._view.emit(HOOK_EVENT.BEFORE_STAGE_RESIZE);\n if (this.shouldResize(width, height)) {\n this._width = width;\n this._height = height;\n this._stage && this._stage.resize(width, height);\n }\n\n this._view.emit(HOOK_EVENT.AFTER_STAGE_RESIZE);\n\n return this;\n }\n\n setViewBox(viewBox: IBoundsLike, rerender: boolean = true) {\n if (!this._stage) {\n return this;\n }\n if (\n viewBox &&\n (!this._viewBox ||\n viewBox.x1 !== this._viewBox.x1 ||\n viewBox.x2 !== this._viewBox.x2 ||\n viewBox.y1 !== this._viewBox.y1 ||\n viewBox.y2 !== this._viewBox.y2)\n ) {\n this._viewBox = viewBox;\n\n // FIXME: vRender\n this._stage.setViewBox(viewBox.x1, viewBox.y1, viewBox.x2 - viewBox.x1, viewBox.y2 - viewBox.y1, rerender);\n }\n return this;\n }\n\n render(immediately: boolean = false) {\n this._view.emit(HOOK_EVENT.BEFORE_VRENDER_DRAW);\n\n this.initStage();\n\n // disable dirty bounds when render is called\n this._stage.disableDirtyBounds();\n this._stage.afterNextRender(this.handleAfterNextRender);\n\n // render immediately and skip render in next frame\n if (immediately) {\n this._stage.render();\n\n this._view.emit(HOOK_EVENT.AFTER_VRENDER_DRAW);\n }\n return this;\n }\n\n renderNextFrame() {\n this.initStage();\n\n this._stage.renderNextFrame();\n\n return this;\n }\n\n toCanvas() {\n if (this._stage) {\n return this._stage.toCanvas();\n }\n return null;\n }\n\n preventRender(tag: boolean) {\n if (this._stage) {\n this._stage.preventRender(tag);\n }\n }\n\n // toImageData() {\n // if (this._stage) {\n // return this._stage.toImageData();\n // }\n // return null;\n // }\n\n release() {\n this._view.traverseMarkTree((mark: IMark) => {\n mark.release();\n });\n\n if (this._dragController) {\n this._dragController.release();\n }\n if (this._gestureController) {\n this._gestureController.release();\n }\n\n if (this._stage !== (this._viewOptions?.stage as unknown as Stage)) {\n // don't release the stage created by outside\n this._stage.release();\n }\n\n this._stage = null;\n this._layer = null;\n this._dragController = null;\n this._gestureController = null;\n }\n\n private createStage() {\n this._view.emit(HOOK_EVENT.BEFORE_CREATE_VRENDER_STAGE);\n\n const viewOptions = this._viewOptions;\n\n const stage =\n (viewOptions.stage as unknown as Stage) ??\n createStage({\n width: this._width,\n height: this._height,\n renderStyle: viewOptions.renderStyle,\n viewBox: viewOptions.viewBox,\n dpr: viewOptions.dpr,\n canvas: viewOptions.renderCanvas,\n canvasControled: viewOptions.canvasControled,\n container: viewOptions.container,\n title: viewOptions.rendererTitle,\n beforeRender: viewOptions.beforeRender,\n afterRender: viewOptions.afterRender,\n disableDirtyBounds: true,\n autoRender: true,\n pluginList: viewOptions.pluginList,\n enableHtmlAttribute: viewOptions.enableHtmlAttribute,\n optimize: viewOptions.optimize,\n ticker: viewOptions.ticker,\n supportsTouchEvents: viewOptions.supportsTouchEvents,\n supportsPointerEvents: viewOptions.supportsPointerEvents,\n ReactDOM: viewOptions.ReactDOM\n });\n\n if (viewOptions.options3d?.enable) {\n stage.set3dOptions(viewOptions.options3d);\n }\n\n stage.enableIncrementalAutoRender();\n\n this._viewBox = viewOptions.viewBox;\n this._view.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_STAGE);\n\n this._view.emit(HOOK_EVENT.BEFORE_CREATE_VRENDER_LAYER);\n const layer = viewOptions.layer ?? (stage.defaultLayer as ILayer);\n this._view.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_LAYER);\n\n if (this._eventConfig?.drag && Factory.getStageEventPlugin('drag')) {\n // 允许 drag 事件\n this._dragController = new (Factory.getStageEventPlugin('drag'))(stage as unknown as IEventTarget) as DragNDrop;\n }\n if (this._eventConfig?.gesture && Factory.getStageEventPlugin('gesture')) {\n const gestureConfig = isObject(this._eventConfig.gesture) ? this._eventConfig.gesture : {};\n // 允许手势\n this._gestureController = new (Factory.getStageEventPlugin('gesture'))(\n stage as unknown as IEventTarget,\n gestureConfig\n ) as Gesture;\n }\n\n return {\n stage,\n layer\n };\n }\n\n private initStage() {\n if (!this._stage) {\n const { stage, layer } = this.createStage();\n\n this._stage = stage;\n this._layer = layer;\n\n const background = this._view.background();\n this.background(background);\n }\n }\n\n private handleAfterNextRender = () => {\n if (this._stage && !this._viewOptions.disableDirtyBounds) {\n this._stage.enableDirtyBounds();\n }\n\n this._view.emit(HOOK_EVENT.AFTER_VRENDER_DRAW);\n this._view.emit(HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER);\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/graph/canvas-renderer.ts"],"names":[],"mappings":";;AAEA,6CAA4C;AAG5C,yDAA0E;AAG1E,mCAAqC;AAGrC,6CAA0C;AAE1C,MAAqB,cAAc;IAajC,YAAY,IAAW;QAsPf,0BAAqB,GAAG,GAAG,EAAE;YACnC,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE;gBACxD,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;aACjC;YAED,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAU,CAAC,kBAAkB,CAAC,CAAC;YAC/C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAU,CAAC,yBAAyB,CAAC,CAAC;QACxD,CAAC,CAAC;QA5PA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,UAAU,CAAC,KAAa,EAAE,MAAc,EAAE,OAAqB,EAAE,WAA6B;QAC5F,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;QAC5B,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAEhC,IAAI,CAAC,SAAS,EAAE,CAAC;QAGjB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK;;QACH,OAAO,MAAA,IAAI,CAAC,MAAM,mCAAI,IAAI,CAAC;IAC7B,CAAC;IAED,iBAAiB;;QACf,OAAO,MAAA,IAAI,CAAC,kBAAkB,mCAAI,IAAI,CAAC;IACzC,CAAC;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,MA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CAAC;YACpB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YAEpB,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;YAC3C,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;SAC7B;IACH,CAAC;CAUF;AA3QD,iCA2QC","file":"canvas-renderer.js","sourcesContent":["import type { IBoundsLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { isObject } from '@visactor/vutils';\nimport type { IEventTarget, IColor, ILayer, Stage } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { createStage, waitForAllSubLayers } from '@visactor/vrender-core';\nimport type { IViewOptions, IView, IMark, IViewEventConfig } from '../types';\nimport type { IRenderer } from '../types/renderer';\nimport { HOOK_EVENT } from './enums';\nimport type { DragNDrop } from '@visactor/vrender-kits';\nimport type { Gesture } from '@visactor/vrender-kits';\nimport { Factory } from '../core/factory';\n\nexport default class CanvasRenderer implements IRenderer {\n private _width: number;\n private _height: number;\n\n private _view: IView;\n private _viewOptions: IViewOptions;\n private _eventConfig: IViewEventConfig;\n private _stage: Stage;\n private _layer: ILayer;\n private _dragController: DragNDrop;\n private _gestureController: Gesture;\n private _viewBox: IBoundsLike;\n\n constructor(view: IView) {\n this._view = view;\n }\n\n initialize(width: number, height: number, options: IViewOptions, eventConfig: IViewEventConfig) {\n this._width = width;\n this._height = height;\n this._viewOptions = options;\n this._eventConfig = eventConfig;\n\n this.initStage();\n\n // this method will invoke resize to size the canvas appropriately\n return this;\n }\n\n stage() {\n return this._stage ?? null;\n }\n\n gestureController() {\n return this._gestureController ?? null;\n }\n\n canvas() {\n if (this._stage) {\n return this._stage.window.getNativeHandler().nativeCanvas;\n }\n return null;\n }\n\n context() {\n if (this._stage) {\n return this._stage.window.getContext().nativeContext;\n }\n return null;\n }\n\n combineIncrementalLayers() {\n if (this._stage) {\n waitForAllSubLayers(this._stage as any).then(() => {\n // stage might be null in current tick\n if (this._stage) {\n this._stage.defaultLayer.combineSubLayer();\n }\n });\n }\n return this;\n }\n\n background(color: IColor) {\n if (this._stage) {\n this._stage.background = color;\n return this;\n }\n }\n\n setDpr(resolution: number, redraw: boolean) {\n this._stage?.setDpr?.(resolution);\n if (redraw) {\n this.renderNextFrame();\n }\n return this;\n }\n\n shouldResize(width: number, height: number) {\n return width !== this._width || height !== this._height;\n }\n\n resize(width: number, height: number) {\n this._view.emit(HOOK_EVENT.BEFORE_STAGE_RESIZE);\n if (this.shouldResize(width, height)) {\n this._width = width;\n this._height = height;\n this._stage && this._stage.resize(width, height);\n }\n\n this._view.emit(HOOK_EVENT.AFTER_STAGE_RESIZE);\n\n return this;\n }\n\n setViewBox(viewBox: IBoundsLike, rerender: boolean = true) {\n if (!this._stage) {\n return this;\n }\n if (\n viewBox &&\n (!this._viewBox ||\n viewBox.x1 !== this._viewBox.x1 ||\n viewBox.x2 !== this._viewBox.x2 ||\n viewBox.y1 !== this._viewBox.y1 ||\n viewBox.y2 !== this._viewBox.y2)\n ) {\n this._viewBox = viewBox;\n\n // FIXME: vRender\n this._stage.setViewBox(viewBox.x1, viewBox.y1, viewBox.x2 - viewBox.x1, viewBox.y2 - viewBox.y1, rerender);\n }\n return this;\n }\n\n render(immediately: boolean = false) {\n this._view.emit(HOOK_EVENT.BEFORE_VRENDER_DRAW);\n\n this.initStage();\n\n // disable dirty bounds when render is called\n this._stage.disableDirtyBounds();\n this._stage.afterNextRender(this.handleAfterNextRender);\n\n // render immediately and skip render in next frame\n if (immediately) {\n this._stage.render();\n\n this._view.emit(HOOK_EVENT.AFTER_VRENDER_DRAW);\n }\n return this;\n }\n\n renderNextFrame() {\n this.initStage();\n\n this._stage.renderNextFrame();\n\n return this;\n }\n\n toCanvas() {\n if (this._stage) {\n return this._stage.toCanvas();\n }\n return null;\n }\n\n preventRender(tag: boolean) {\n if (this._stage) {\n this._stage.preventRender(tag);\n }\n }\n\n // toImageData() {\n // if (this._stage) {\n // return this._stage.toImageData();\n // }\n // return null;\n // }\n\n release() {\n this._view.traverseMarkTree((mark: IMark) => {\n mark.release();\n });\n\n if (this._dragController) {\n this._dragController.release();\n }\n if (this._gestureController) {\n this._gestureController.release();\n }\n\n if (this._stage !== (this._viewOptions?.stage as unknown as Stage)) {\n // don't release the stage created by outside\n this._stage.release();\n }\n\n this._stage = null;\n this._layer = null;\n this._dragController = null;\n this._gestureController = null;\n }\n\n private createStage() {\n this._view.emit(HOOK_EVENT.BEFORE_CREATE_VRENDER_STAGE);\n\n const viewOptions = this._viewOptions;\n\n const stage =\n (viewOptions.stage as unknown as Stage) ??\n createStage({\n width: this._width,\n height: this._height,\n renderStyle: viewOptions.renderStyle,\n viewBox: viewOptions.viewBox,\n dpr: viewOptions.dpr,\n canvas: viewOptions.renderCanvas,\n canvasControled: viewOptions.canvasControled,\n container: viewOptions.container,\n title: viewOptions.rendererTitle,\n beforeRender: viewOptions.beforeRender,\n afterRender: viewOptions.afterRender,\n disableDirtyBounds: true,\n autoRender: true,\n pluginList: viewOptions.pluginList,\n enableHtmlAttribute: viewOptions.enableHtmlAttribute,\n optimize: viewOptions.optimize,\n ticker: viewOptions.ticker,\n supportsTouchEvents: viewOptions.supportsTouchEvents,\n supportsPointerEvents: viewOptions.supportsPointerEvents,\n ReactDOM: viewOptions.ReactDOM,\n autoRefresh: viewOptions.autoRefresh\n });\n\n if (viewOptions.options3d?.enable) {\n stage.set3dOptions(viewOptions.options3d);\n }\n\n stage.enableIncrementalAutoRender();\n\n this._viewBox = viewOptions.viewBox;\n this._view.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_STAGE);\n\n this._view.emit(HOOK_EVENT.BEFORE_CREATE_VRENDER_LAYER);\n const layer = viewOptions.layer ?? (stage.defaultLayer as ILayer);\n this._view.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_LAYER);\n\n if (this._eventConfig?.drag && Factory.getStageEventPlugin('drag')) {\n // 允许 drag 事件\n this._dragController = new (Factory.getStageEventPlugin('drag'))(stage as unknown as IEventTarget) as DragNDrop;\n }\n if (this._eventConfig?.gesture && Factory.getStageEventPlugin('gesture')) {\n const gestureConfig = isObject(this._eventConfig.gesture) ? this._eventConfig.gesture : {};\n // 允许手势\n this._gestureController = new (Factory.getStageEventPlugin('gesture'))(\n stage as unknown as IEventTarget,\n gestureConfig\n ) as Gesture;\n }\n\n return {\n stage,\n layer\n };\n }\n\n private initStage() {\n if (!this._stage) {\n const { stage, layer } = this.createStage();\n\n this._stage = stage;\n this._layer = layer;\n\n const background = this._view.background();\n this.background(background);\n }\n }\n\n private handleAfterNextRender = () => {\n if (this._stage && !this._viewOptions.disableDirtyBounds) {\n this._stage.enableDirtyBounds();\n }\n\n this._view.emit(HOOK_EVENT.AFTER_VRENDER_DRAW);\n this._view.emit(HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER);\n };\n}\n"]}
|
|
@@ -58,7 +58,8 @@ class GlyphElement extends element_1.Element {
|
|
|
58
58
|
encodeGraphic() {
|
|
59
59
|
this.coordinateTransformEncode(this.items);
|
|
60
60
|
const graphicAttributes = this.transformElementItems(this.items, this.mark.markType), isGraphicInit = !this.graphicItem;
|
|
61
|
-
this.graphicItem
|
|
61
|
+
this.graphicItem ? (this.graphicItem.clearStates(), this.graphicItem.states = {},
|
|
62
|
+
this.graphicItem.stateProxy = null) : this.initGraphicItem(), this.diffState === enums_1.DiffState.enter || isGraphicInit ? (this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(!0),
|
|
62
63
|
this.applyGraphicAttributes(graphicAttributes), this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(!1)) : this.applyGraphicAttributes(graphicAttributes),
|
|
63
64
|
this.diffState !== enums_1.DiffState.enter && this.diffState !== enums_1.DiffState.update || !this.states.length || (Object.values(this.glyphGraphicItems).forEach((graphicItem => {
|
|
64
65
|
graphicItem.states = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/glyph-element.ts"],"names":[],"mappings":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C;IACL,CAAC;IAED,sBAAsB;QACpB,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;QACrC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YACrD,IAAI,CAAC,wBAAwB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YAC9C,IAAI,CAAC,wBAAwB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YAC9C,IAAI,CAAC,yBAAyB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;QAC9B,KAAK,CAAC,MAAM,EAAE,CAAC;IACjB,CAAC;IAED,OAAO;QACL,IAAI,IAAI,CAAC,iBAAiB,EAAE;YAC1B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;gBAC1D,WAAW,CAAC,4BAAgB,CAAC,GAAG,IAAI,CAAC;YACvC,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;SAC/B;QACD,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;CACF;AAjZD,oCAiZC","file":"glyph-element.js","sourcesContent":["import { has, isNil, isBoolean, isFunction, isEqual } from '@visactor/vutils';\nimport type {\n IGlyphElement,\n IGlyphMark,\n MarkElementItem,\n MarkSpec,\n IGlyphMeta,\n MarkType,\n StateProxyEncodeSpec\n} from '../types';\nimport { cloneTransformAttributes, transformAttributes } from './attributes/transform';\nimport { BridgeElementKey, CollectionMarkType } from './constants';\nimport { DiffState, HOOK_EVENT, GrammarMarkType } from './enums';\nimport { Element } from './element';\nimport { invokeEncoderToItems } from './mark/encode';\nimport type { IGraphicAttribute, IGlyph } from '@visactor/vrender-core';\n\nexport class GlyphElement extends Element implements IGlyphElement {\n declare graphicItem: IGlyph;\n\n declare mark: IGlyphMark;\n protected glyphGraphicItems: { [markName: string]: any };\n\n private glyphMeta: IGlyphMeta;\n\n constructor(mark: IGlyphMark) {\n super(mark);\n this.glyphMeta = this.mark.getGlyphMeta();\n }\n\n getGlyphGraphicItems() {\n return this.glyphGraphicItems;\n }\n\n initGraphicItem(attributes: any = {}) {\n if (this.graphicItem) {\n return;\n }\n\n this.graphicItem = this.mark.addGraphicItem(attributes, this.groupKey) as IGlyph;\n this.graphicItem[BridgeElementKey] = this;\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(false);\n\n const glyphMarks = this.glyphMeta.getMarks();\n this.glyphGraphicItems = {};\n this.graphicItem.getSubGraphic().forEach((graphic: any) => {\n const markType = glyphMarks[graphic.name];\n this.glyphGraphicItems[graphic.name] = graphic;\n graphic.onBeforeAttributeUpdate = (attributes: any) => {\n // mark might be released\n if (!this.mark) {\n return attributes;\n }\n const graphicAttributes = transformAttributes(markType, attributes, this, graphic.name);\n return graphicAttributes;\n };\n });\n\n this.clearGraphicAttributes();\n }\n\n useStates(states: string[], hasAnimation?: boolean) {\n if (!this.graphicItem) {\n return false;\n }\n this.mark.emit(HOOK_EVENT.BEFORE_ELEMENT_STATE, { states }, this);\n\n this.states = states.slice();\n\n const stateAnimationEnable = isBoolean(hasAnimation) ? hasAnimation : this.hasStateAnimation();\n\n this.graphicItem.glyphStateProxy = this.getStateAttrs;\n this.graphicItem.useStates(this.states, stateAnimationEnable);\n\n this.mark.emit(HOOK_EVENT.AFTER_ELEMENT_STATE, { states }, this);\n\n return true;\n }\n\n protected getStateAttrs = (stateName: string, nextStates: string[]) => {\n const isRuntimeState = !isNil(this.runtimeStatesEncoder?.[stateName]);\n const encoder = isRuntimeState\n ? {\n ...(this.mark.getSpec() as MarkSpec).encode?.[stateName],\n ...this.runtimeStatesEncoder[stateName]\n }\n : (this.mark.getSpec() as MarkSpec).encode?.[stateName];\n\n const glyphStateAttributes = {} as {\n attributes: Partial<IGraphicAttribute>;\n subAttributes: Partial<IGraphicAttribute>[];\n };\n\n if (!encoder) {\n return glyphStateAttributes;\n }\n\n if (isFunction(encoder)) {\n glyphStateAttributes.attributes = (encoder as StateProxyEncodeSpec)(this.getDatum(), this, stateName, nextStates);\n return glyphStateAttributes;\n }\n\n if (!isRuntimeState && this.graphicItem.glyphStates?.[stateName]) {\n return this.graphicItem.glyphStates[stateName];\n }\n\n if (encoder) {\n const item = this.items[0];\n const targetItems = [Object.assign({}, item, { nextAttrs: {} })];\n\n invokeEncoderToItems(this, targetItems, encoder, (this.mark as any).parameters());\n this.coordinateTransformEncode(targetItems);\n\n glyphStateAttributes.attributes = targetItems[0].nextAttrs;\n\n if (!this.graphicItem.glyphStates) {\n this.graphicItem.glyphStates = { [stateName]: glyphStateAttributes };\n } else if (!this.graphicItem.glyphStates[stateName]) {\n this.graphicItem.glyphStates[stateName] = glyphStateAttributes;\n }\n\n return glyphStateAttributes;\n }\n\n return glyphStateAttributes;\n };\n\n encodeGraphic() {\n this.coordinateTransformEncode(this.items);\n const graphicAttributes = this.transformElementItems(this.items, this.mark.markType);\n\n const isGraphicInit = !this.graphicItem;\n if (!this.graphicItem) {\n this.initGraphicItem();\n }\n\n if (this.diffState === DiffState.enter || isGraphicInit) {\n // apply default encoder when enter or graphic item is created\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(true);\n this.applyGraphicAttributes(graphicAttributes);\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(false);\n } else {\n this.applyGraphicAttributes(graphicAttributes);\n }\n\n if ((this.diffState === DiffState.enter || this.diffState === DiffState.update) && this.states.length) {\n Object.values(this.glyphGraphicItems).forEach(graphicItem => {\n // 更新数据流后,states计算不缓存\n graphicItem.states = {};\n });\n this.useStates(this.states);\n }\n\n // clear item attributes\n this.items.map(item => {\n item.nextAttrs = {};\n });\n }\n\n encodeCustom(nextAttrs?: any): { [markName: string]: any } {\n let customEncodeValues: { [markName: string]: any } = {};\n const channelEncoder = this.glyphMeta.getChannelEncoder();\n const functionEncoder = this.glyphMeta.getFunctionEncoder();\n\n if (functionEncoder) {\n customEncodeValues = functionEncoder.call(\n null,\n Object.assign({}, this.graphicItem?.attribute, nextAttrs),\n this.getDatum(),\n this,\n this.mark.getGlyphConfig()\n );\n }\n if (channelEncoder) {\n // TODO: maybe delete origin encode value?\n let allAttrs: any;\n Object.keys(channelEncoder).forEach(channel => {\n if (!isNil(nextAttrs[channel])) {\n if (!allAttrs) {\n allAttrs = Object.assign({}, this.graphicItem?.attribute, nextAttrs);\n }\n const encodeResult = channelEncoder[channel].call(\n null,\n channel,\n nextAttrs[channel],\n allAttrs,\n this.getDatum(),\n this,\n this.mark.getGlyphConfig()\n );\n Object.keys(encodeResult ?? {}).forEach(markName => {\n customEncodeValues[markName] = Object.assign(customEncodeValues[markName] ?? {}, encodeResult[markName]);\n });\n }\n });\n }\n return customEncodeValues;\n }\n\n private encodeDefault() {\n const defaultEncodeValues: { [markName: string]: any } = {};\n // apply default encode\n if (this.glyphMeta.getDefaultEncoder()) {\n const defaultEncodeResult = this.glyphMeta\n .getDefaultEncoder()\n .call(null, this.getDatum(), this, this.mark.getGlyphConfig());\n Object.assign(defaultEncodeValues, defaultEncodeResult);\n }\n return defaultEncodeValues;\n }\n\n private _onGlyphAttributeUpdate(first: boolean = false) {\n return (attributes: any) => {\n // mark might be released\n if (!this.mark) {\n return attributes;\n }\n const glyphMarks = this.glyphMeta.getMarks();\n\n const graphicAttributes = transformAttributes(this.mark.getAttributeTransforms(), attributes, this);\n\n // apply default encode\n const defaultEncodeValues = first ? this.encodeDefault() : null;\n // apply custom encode\n const customEncodeValues = this.encodeCustom(attributes);\n\n Object.keys(glyphMarks).forEach(markName => {\n const markType = glyphMarks[markName];\n const graphicItem = this.glyphGraphicItems[markName];\n const customAttributes = customEncodeValues?.[markName];\n const additionalAttributes = Object.assign({}, customAttributes);\n if (first) {\n // apply default attributes when visual channel is not set\n const defaultAttributes = defaultEncodeValues?.[markName];\n Object.keys(defaultAttributes ?? {}).forEach(key => {\n if (!has(this.items[0].nextAttrs, key) && !has(additionalAttributes, key)) {\n additionalAttributes[key] = defaultAttributes[key];\n }\n });\n }\n const glyphAttributes = Object.assign({}, cloneTransformAttributes(markType, attributes), additionalAttributes);\n const glyphItems = this._generateGlyphItems(markType, this.items, glyphAttributes);\n this.coordinateTransformEncode(glyphItems);\n const graphicAttributes = this.transformElementItems(glyphItems, markType);\n\n this.applyGlyphGraphicAttributes(graphicAttributes, markName, graphicItem);\n\n if (markType === GrammarMarkType.shape) {\n // FIXME: shape需要拿到原始数据进行编码,暂时把数据绑定到graphicItem上,看后续graphicItem是否需要支持数据绑定\n graphicItem.datum = glyphItems[0].datum;\n }\n });\n\n return graphicAttributes;\n };\n }\n\n private _generateGlyphItems(markType: MarkType, items: MarkElementItem[], additionalAttributes: any) {\n const glyphItems = items.map(item => Object.assign({}, item, { nextAttrs: additionalAttributes }));\n\n if ((CollectionMarkType as string[]).includes(markType) && this.mark.getSpec().enableSegments) {\n // segment mark require all items to apply additional attributes\n glyphItems.forEach((glyphItem, index) => {\n glyphItem.nextAttrs = Object.assign({}, items[index].nextAttrs, additionalAttributes);\n });\n }\n\n return glyphItems;\n }\n\n getGraphicAttribute(channel: string, prev: boolean = false, markName?: any) {\n if (!this.graphicItem) {\n return undefined;\n }\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n if (prev && has(prevGraphicAttributes, channel)) {\n return prevGraphicAttributes[channel];\n }\n\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.attribute[channel];\n }\n\n setGraphicAttribute(channel: string, value: any, final: boolean = true, markName?: any) {\n if (!this.graphicItem) {\n return;\n }\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n\n if (final) {\n finalGraphicAttributes[channel] = value;\n }\n if (!has(prevGraphicAttributes, channel)) {\n prevGraphicAttributes[channel] = graphicItem.attribute[channel];\n }\n\n graphicItem.setAttribute(channel, value);\n }\n\n setGraphicAttributes(attributes: { [channel: string]: any }, final: boolean = true, markName?: any) {\n if (!this.graphicItem) {\n return;\n }\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n\n Object.keys(attributes).forEach(key => {\n if (final) {\n finalGraphicAttributes[key] = attributes[key];\n }\n if (!has(prevGraphicAttributes, key)) {\n prevGraphicAttributes[key] = graphicItem.attribute[key];\n }\n });\n\n graphicItem.setAttributes(attributes);\n }\n\n protected diffAttributes(graphicAttributes: { [channel: string]: any }, markName?: string) {\n const diffResult = {};\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n for (const key in graphicAttributes) {\n if (!has(finalGraphicAttributes, key) || !isEqual(finalGraphicAttributes[key], graphicAttributes[key])) {\n diffResult[key] = graphicAttributes[key];\n }\n }\n return diffResult;\n }\n\n protected applyGlyphGraphicAttributes(graphicAttributes: any, markName: string, graphicItem: any): void {\n if (this.mark.needAnimate()) {\n // If mark need animate, diff attributes.\n const nextGraphicAttributes = this.diffAttributes(graphicAttributes, markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName) ?? {};\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName) ?? {};\n Object.keys(nextGraphicAttributes).forEach(channel => {\n prevGraphicAttributes[channel] = graphicItem.attribute[channel];\n finalGraphicAttributes[channel] = nextGraphicAttributes[channel];\n });\n this.setNextGraphicAttributes(nextGraphicAttributes, markName);\n this.setPrevGraphicAttributes(prevGraphicAttributes, markName);\n this.setFinalGraphicAttributes(finalGraphicAttributes, markName);\n\n // Apply next attributes to current graphic item immediately.\n // Scene graph tree should be handled like no animation exists in dataflow procedure.\n graphicItem.setAttributes(nextGraphicAttributes);\n } else {\n graphicItem.setAttributes(graphicAttributes);\n }\n }\n\n getFinalGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.finalAttrs;\n }\n\n protected setFinalGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.finalAttrs = attributes;\n }\n\n getPrevGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.prevAttrs;\n }\n\n protected setPrevGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.prevAttrs = attributes;\n }\n\n getNextGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.nextAttrs;\n }\n\n protected setNextGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.nextAttrs = attributes;\n }\n\n clearChangedGraphicAttributes() {\n this.setPrevGraphicAttributes(null);\n this.setNextGraphicAttributes(null);\n Object.keys(this.glyphGraphicItems).forEach(markName => {\n this.setPrevGraphicAttributes(null, markName);\n this.setNextGraphicAttributes(null, markName);\n });\n }\n\n clearGraphicAttributes() {\n this.setPrevGraphicAttributes(null);\n this.setNextGraphicAttributes(null);\n this.setFinalGraphicAttributes(null);\n Object.keys(this.glyphGraphicItems).forEach(markName => {\n this.setPrevGraphicAttributes(null, markName);\n this.setNextGraphicAttributes(null, markName);\n this.setFinalGraphicAttributes(null, markName);\n });\n }\n\n remove() {\n this.glyphGraphicItems = null;\n super.remove();\n }\n\n release() {\n if (this.glyphGraphicItems) {\n Object.values(this.glyphGraphicItems).forEach(graphicItem => {\n graphicItem[BridgeElementKey] = null;\n });\n this.glyphGraphicItems = null;\n }\n super.release();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/graph/glyph-element.ts"],"names":[],"mappings":";;;AAAA,6CAA8E;AAU9E,sDAAuF;AACvF,2CAAmE;AACnE,mCAAiE;AACjE,uCAAoC;AACpC,0CAAqD;AAGrD,MAAa,YAAa,SAAQ,iBAAO;IAQvC,YAAY,IAAgB;QAC1B,KAAK,CAAC,IAAI,CAAC,CAAC;QAqDJ,kBAAa,GAAG,CAAC,SAAiB,EAAE,UAAoB,EAAE,EAAE;;YACpE,MAAM,cAAc,GAAG,CAAC,IAAA,cAAK,EAAC,MAAA,IAAI,CAAC,oBAAoB,0CAAG,SAAS,CAAC,CAAC,CAAC;YAEtE,MAAM,OAAO,GAAG,cAAc;gBAC5B,CAAC,iCACM,MAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAe,CAAC,MAAM,0CAAG,SAAS,CAAC,GACrD,IAAI,CAAC,oBAAoB,CAAC,SAAS,CAAC,EAE3C,CAAC,CAAC,MAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAe,CAAC,MAAM,0CAAG,SAAS,CAAC,CAAC;YAE1D,MAAM,oBAAoB,GAAG,EAG5B,CAAC;YAEF,IAAI,CAAC,OAAO,EAAE;gBACZ,OAAO,oBAAoB,CAAC;aAC7B;YAED,IAAI,IAAA,mBAAU,EAAC,OAAO,CAAC,EAAE;gBACvB,oBAAoB,CAAC,UAAU,GAAI,OAAgC,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;gBAClH,OAAO,oBAAoB,CAAC;aAC7B;YAED,IAAI,CAAC,cAAc,KAAI,MAAA,IAAI,CAAC,WAAW,CAAC,WAAW,0CAAG,SAAS,CAAC,CAAA,EAAE;gBAChE,OAAO,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,SAA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AC;IAClB,CAAC;CACF;AAvZD,oCAuZC","file":"glyph-element.js","sourcesContent":["import { has, isNil, isBoolean, isFunction, isEqual } from '@visactor/vutils';\nimport type {\n IGlyphElement,\n IGlyphMark,\n MarkElementItem,\n MarkSpec,\n IGlyphMeta,\n MarkType,\n StateProxyEncodeSpec\n} from '../types';\nimport { cloneTransformAttributes, transformAttributes } from './attributes/transform';\nimport { BridgeElementKey, CollectionMarkType } from './constants';\nimport { DiffState, HOOK_EVENT, GrammarMarkType } from './enums';\nimport { Element } from './element';\nimport { invokeEncoderToItems } from './mark/encode';\nimport type { IGraphicAttribute, IGlyph } from '@visactor/vrender-core';\n\nexport class GlyphElement extends Element implements IGlyphElement {\n declare graphicItem: IGlyph;\n\n declare mark: IGlyphMark;\n protected glyphGraphicItems: { [markName: string]: any };\n\n private glyphMeta: IGlyphMeta;\n\n constructor(mark: IGlyphMark) {\n super(mark);\n this.glyphMeta = this.mark.getGlyphMeta();\n }\n\n getGlyphGraphicItems() {\n return this.glyphGraphicItems;\n }\n\n initGraphicItem(attributes: any = {}) {\n if (this.graphicItem) {\n return;\n }\n\n this.graphicItem = this.mark.addGraphicItem(attributes, this.groupKey) as IGlyph;\n this.graphicItem[BridgeElementKey] = this;\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(false);\n\n const glyphMarks = this.glyphMeta.getMarks();\n this.glyphGraphicItems = {};\n this.graphicItem.getSubGraphic().forEach((graphic: any) => {\n const markType = glyphMarks[graphic.name];\n this.glyphGraphicItems[graphic.name] = graphic;\n graphic.onBeforeAttributeUpdate = (attributes: any) => {\n // mark might be released\n if (!this.mark) {\n return attributes;\n }\n const graphicAttributes = transformAttributes(markType, attributes, this, graphic.name);\n return graphicAttributes;\n };\n });\n\n this.clearGraphicAttributes();\n }\n\n useStates(states: string[], hasAnimation?: boolean) {\n if (!this.graphicItem) {\n return false;\n }\n this.mark.emit(HOOK_EVENT.BEFORE_ELEMENT_STATE, { states }, this);\n\n this.states = states.slice();\n\n const stateAnimationEnable = isBoolean(hasAnimation) ? hasAnimation : this.hasStateAnimation();\n\n this.graphicItem.glyphStateProxy = this.getStateAttrs;\n this.graphicItem.useStates(this.states, stateAnimationEnable);\n\n this.mark.emit(HOOK_EVENT.AFTER_ELEMENT_STATE, { states }, this);\n\n return true;\n }\n\n protected getStateAttrs = (stateName: string, nextStates: string[]) => {\n const isRuntimeState = !isNil(this.runtimeStatesEncoder?.[stateName]);\n\n const encoder = isRuntimeState\n ? {\n ...(this.mark.getSpec() as MarkSpec).encode?.[stateName],\n ...this.runtimeStatesEncoder[stateName]\n }\n : (this.mark.getSpec() as MarkSpec).encode?.[stateName];\n\n const glyphStateAttributes = {} as {\n attributes: Partial<IGraphicAttribute>;\n subAttributes: Partial<IGraphicAttribute>[];\n };\n\n if (!encoder) {\n return glyphStateAttributes;\n }\n\n if (isFunction(encoder)) {\n glyphStateAttributes.attributes = (encoder as StateProxyEncodeSpec)(this.getDatum(), this, stateName, nextStates);\n return glyphStateAttributes;\n }\n\n if (!isRuntimeState && this.graphicItem.glyphStates?.[stateName]) {\n return this.graphicItem.glyphStates[stateName];\n }\n\n if (encoder) {\n const item = this.items[0];\n const targetItems = [Object.assign({}, item, { nextAttrs: {} })];\n\n invokeEncoderToItems(this, targetItems, encoder, (this.mark as any).parameters());\n this.coordinateTransformEncode(targetItems);\n\n glyphStateAttributes.attributes = targetItems[0].nextAttrs;\n\n if (!this.graphicItem.glyphStates) {\n this.graphicItem.glyphStates = { [stateName]: glyphStateAttributes };\n } else if (!this.graphicItem.glyphStates[stateName]) {\n this.graphicItem.glyphStates[stateName] = glyphStateAttributes;\n }\n\n return glyphStateAttributes;\n }\n\n return glyphStateAttributes;\n };\n\n encodeGraphic() {\n this.coordinateTransformEncode(this.items);\n const graphicAttributes = this.transformElementItems(this.items, this.mark.markType);\n\n const isGraphicInit = !this.graphicItem;\n if (!this.graphicItem) {\n this.initGraphicItem();\n } else {\n this.graphicItem.clearStates();\n // 更新数据流后,states计算不缓存\n this.graphicItem.states = {};\n this.graphicItem.stateProxy = null;\n }\n\n if (this.diffState === DiffState.enter || isGraphicInit) {\n // apply default encoder when enter or graphic item is created\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(true);\n this.applyGraphicAttributes(graphicAttributes);\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(false);\n } else {\n this.applyGraphicAttributes(graphicAttributes);\n }\n\n if ((this.diffState === DiffState.enter || this.diffState === DiffState.update) && this.states.length) {\n Object.values(this.glyphGraphicItems).forEach(graphicItem => {\n // 更新数据流后,states计算不缓存\n graphicItem.states = {};\n });\n this.useStates(this.states);\n }\n\n // clear item attributes\n this.items.map(item => {\n item.nextAttrs = {};\n });\n }\n\n encodeCustom(nextAttrs?: any): { [markName: string]: any } {\n let customEncodeValues: { [markName: string]: any } = {};\n const channelEncoder = this.glyphMeta.getChannelEncoder();\n const functionEncoder = this.glyphMeta.getFunctionEncoder();\n\n if (functionEncoder) {\n customEncodeValues = functionEncoder.call(\n null,\n Object.assign({}, this.graphicItem?.attribute, nextAttrs),\n this.getDatum(),\n this,\n this.mark.getGlyphConfig()\n );\n }\n if (channelEncoder) {\n // TODO: maybe delete origin encode value?\n let allAttrs: any;\n Object.keys(channelEncoder).forEach(channel => {\n if (!isNil(nextAttrs[channel])) {\n if (!allAttrs) {\n allAttrs = Object.assign({}, this.graphicItem?.attribute, nextAttrs);\n }\n const encodeResult = channelEncoder[channel].call(\n null,\n channel,\n nextAttrs[channel],\n allAttrs,\n this.getDatum(),\n this,\n this.mark.getGlyphConfig()\n );\n Object.keys(encodeResult ?? {}).forEach(markName => {\n customEncodeValues[markName] = Object.assign(customEncodeValues[markName] ?? {}, encodeResult[markName]);\n });\n }\n });\n }\n return customEncodeValues;\n }\n\n private encodeDefault() {\n const defaultEncodeValues: { [markName: string]: any } = {};\n // apply default encode\n if (this.glyphMeta.getDefaultEncoder()) {\n const defaultEncodeResult = this.glyphMeta\n .getDefaultEncoder()\n .call(null, this.getDatum(), this, this.mark.getGlyphConfig());\n Object.assign(defaultEncodeValues, defaultEncodeResult);\n }\n return defaultEncodeValues;\n }\n\n private _onGlyphAttributeUpdate(first: boolean = false) {\n return (attributes: any) => {\n // mark might be released\n if (!this.mark) {\n return attributes;\n }\n const glyphMarks = this.glyphMeta.getMarks();\n\n const graphicAttributes = transformAttributes(this.mark.getAttributeTransforms(), attributes, this);\n\n // apply default encode\n const defaultEncodeValues = first ? this.encodeDefault() : null;\n // apply custom encode\n const customEncodeValues = this.encodeCustom(attributes);\n\n Object.keys(glyphMarks).forEach(markName => {\n const markType = glyphMarks[markName];\n const graphicItem = this.glyphGraphicItems[markName];\n const customAttributes = customEncodeValues?.[markName];\n const additionalAttributes = Object.assign({}, customAttributes);\n if (first) {\n // apply default attributes when visual channel is not set\n const defaultAttributes = defaultEncodeValues?.[markName];\n Object.keys(defaultAttributes ?? {}).forEach(key => {\n if (!has(this.items[0].nextAttrs, key) && !has(additionalAttributes, key)) {\n additionalAttributes[key] = defaultAttributes[key];\n }\n });\n }\n const glyphAttributes = Object.assign({}, cloneTransformAttributes(markType, attributes), additionalAttributes);\n const glyphItems = this._generateGlyphItems(markType, this.items, glyphAttributes);\n this.coordinateTransformEncode(glyphItems);\n const graphicAttributes = this.transformElementItems(glyphItems, markType);\n\n this.applyGlyphGraphicAttributes(graphicAttributes, markName, graphicItem);\n\n if (markType === GrammarMarkType.shape) {\n // FIXME: shape需要拿到原始数据进行编码,暂时把数据绑定到graphicItem上,看后续graphicItem是否需要支持数据绑定\n graphicItem.datum = glyphItems[0].datum;\n }\n });\n\n return graphicAttributes;\n };\n }\n\n private _generateGlyphItems(markType: MarkType, items: MarkElementItem[], additionalAttributes: any) {\n const glyphItems = items.map(item => Object.assign({}, item, { nextAttrs: additionalAttributes }));\n\n if ((CollectionMarkType as string[]).includes(markType) && this.mark.getSpec().enableSegments) {\n // segment mark require all items to apply additional attributes\n glyphItems.forEach((glyphItem, index) => {\n glyphItem.nextAttrs = Object.assign({}, items[index].nextAttrs, additionalAttributes);\n });\n }\n\n return glyphItems;\n }\n\n getGraphicAttribute(channel: string, prev: boolean = false, markName?: any) {\n if (!this.graphicItem) {\n return undefined;\n }\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n if (prev && has(prevGraphicAttributes, channel)) {\n return prevGraphicAttributes[channel];\n }\n\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.attribute[channel];\n }\n\n setGraphicAttribute(channel: string, value: any, final: boolean = true, markName?: any) {\n if (!this.graphicItem) {\n return;\n }\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n\n if (final) {\n finalGraphicAttributes[channel] = value;\n }\n if (!has(prevGraphicAttributes, channel)) {\n prevGraphicAttributes[channel] = graphicItem.attribute[channel];\n }\n\n graphicItem.setAttribute(channel, value);\n }\n\n setGraphicAttributes(attributes: { [channel: string]: any }, final: boolean = true, markName?: any) {\n if (!this.graphicItem) {\n return;\n }\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n\n Object.keys(attributes).forEach(key => {\n if (final) {\n finalGraphicAttributes[key] = attributes[key];\n }\n if (!has(prevGraphicAttributes, key)) {\n prevGraphicAttributes[key] = graphicItem.attribute[key];\n }\n });\n\n graphicItem.setAttributes(attributes);\n }\n\n protected diffAttributes(graphicAttributes: { [channel: string]: any }, markName?: string) {\n const diffResult = {};\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n for (const key in graphicAttributes) {\n if (!has(finalGraphicAttributes, key) || !isEqual(finalGraphicAttributes[key], graphicAttributes[key])) {\n diffResult[key] = graphicAttributes[key];\n }\n }\n return diffResult;\n }\n\n protected applyGlyphGraphicAttributes(graphicAttributes: any, markName: string, graphicItem: any): void {\n if (this.mark.needAnimate()) {\n // If mark need animate, diff attributes.\n const nextGraphicAttributes = this.diffAttributes(graphicAttributes, markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName) ?? {};\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName) ?? {};\n Object.keys(nextGraphicAttributes).forEach(channel => {\n prevGraphicAttributes[channel] = graphicItem.attribute[channel];\n finalGraphicAttributes[channel] = nextGraphicAttributes[channel];\n });\n this.setNextGraphicAttributes(nextGraphicAttributes, markName);\n this.setPrevGraphicAttributes(prevGraphicAttributes, markName);\n this.setFinalGraphicAttributes(finalGraphicAttributes, markName);\n\n // Apply next attributes to current graphic item immediately.\n // Scene graph tree should be handled like no animation exists in dataflow procedure.\n graphicItem.setAttributes(nextGraphicAttributes);\n } else {\n graphicItem.setAttributes(graphicAttributes);\n }\n }\n\n getFinalGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.finalAttrs;\n }\n\n protected setFinalGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.finalAttrs = attributes;\n }\n\n getPrevGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.prevAttrs;\n }\n\n protected setPrevGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.prevAttrs = attributes;\n }\n\n getNextGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.nextAttrs;\n }\n\n protected setNextGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.nextAttrs = attributes;\n }\n\n clearChangedGraphicAttributes() {\n this.setPrevGraphicAttributes(null);\n this.setNextGraphicAttributes(null);\n Object.keys(this.glyphGraphicItems).forEach(markName => {\n this.setPrevGraphicAttributes(null, markName);\n this.setNextGraphicAttributes(null, markName);\n });\n }\n\n clearGraphicAttributes() {\n this.setPrevGraphicAttributes(null);\n this.setNextGraphicAttributes(null);\n this.setFinalGraphicAttributes(null);\n Object.keys(this.glyphGraphicItems).forEach(markName => {\n this.setPrevGraphicAttributes(null, markName);\n this.setNextGraphicAttributes(null, markName);\n this.setFinalGraphicAttributes(null, markName);\n });\n }\n\n remove() {\n this.glyphGraphicItems = null;\n super.remove();\n }\n\n release() {\n if (this.glyphGraphicItems) {\n Object.values(this.glyphGraphicItems).forEach(graphicItem => {\n graphicItem[BridgeElementKey] = null;\n });\n this.glyphGraphicItems = null;\n }\n super.release();\n }\n}\n"]}
|
package/cjs/index.d.ts
CHANGED
package/cjs/index.js
CHANGED
|
@@ -18,7 +18,7 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", {
|
|
19
19
|
value: !0
|
|
20
20
|
}), exports.registerAnimate = exports.registerGesturePlugin = exports.registerDragPlugin = exports.GlyphMark = exports.registerGlyphMark = exports.defaultDoLayout = exports.registerDefaultLayout = exports.vglobal = exports.ThemeManager = exports.registerViewMorphAPI = exports.registerViewEventsAPI = exports.SIGNAL_VIEW_BOX = exports.SIGNAL_WIDTH = exports.SIGNAL_VIEW_WIDTH = exports.SIGNAL_VIEW_HEIGHT = exports.SIGNAL_PADDING = exports.SIGNAL_HEIGHT = exports.SIGNAL_AUTOFIT = exports.Factory = exports.GrammarBase = exports.invokeFunctionType = exports.parseFunctionType = exports.registerCoordinate = exports.Coordinate = exports.registerScale = exports.Scale = exports.View = exports.version = void 0,
|
|
21
|
-
exports.version = "0.15.0
|
|
21
|
+
exports.version = "0.15.0", __exportStar(require("./graph"), exports), __exportStar(require("./interactions"), exports);
|
|
22
22
|
|
|
23
23
|
var view_1 = require("./view");
|
|
24
24
|
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,QAAQ,CAAC;AAEhC,0CAAwB;AAExB,iDAA+B;AAE/B,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,sCAAoD;AAA3C,8FAAA,KAAK,OAAA;AAAE,sGAAA,aAAa,OAAA;AAC7B,gDAAmE;AAA1D,wGAAA,UAAU,OAAA;AAAE,gHAAA,kBAAkB,OAAA;AACvC,qCAAqE;AAA5D,yGAAA,iBAAiB,OAAA;AAAE,0GAAA,kBAAkB,OAAA;AAC9C,oDAAkD;AAAzC,2GAAA,WAAW,OAAA;AACpB,8CAA4B;AAC5B,0CAAwB;AACxB,0CAAyC;AAAhC,kGAAA,OAAO,OAAA;AAChB,8CAQ0B;AAPxB,2GAAA,cAAc,OAAA;AACd,0GAAA,aAAa,OAAA;AACb,2GAAA,cAAc,OAAA;AACd,+GAAA,kBAAkB,OAAA;AAClB,8GAAA,iBAAiB,OAAA;AACjB,yGAAA,YAAY,OAAA;AACZ,4GAAA,eAAe,OAAA;AAEjB,4DAAgE;AAAvD,yHAAA,qBAAqB,OAAA;AAC9B,4DAA+D;AAAtD,wHAAA,oBAAoB,OAAA;AAE7B,uDAAqD;AAA5C,6GAAA,YAAY,OAAA;AAErB,0CAAwB;AACxB,8CAA4B;AAC5B,+CAA6B;AAC7B,8DAA4C;AAE5C,uDAAiD;AAAxC,uGAAA,OAAO,OAAA;AAChB,wCAAsB;AACtB,iDAA+B;AAC/B,wDAAsC;AACtC,4DAA0C;AAC1C,uDAAqC;AACrC,gDAA+E;AAAtE,+GAAA,qBAAqB,OAAA;AAAE,yGAAA,eAAe,OAAA;AAC/C,sCAA4D;AAAnD,0GAAA,iBAAiB,OAAA;AAAE,kGAAA,SAAS,OAAA;AAErC,yDAA4D;AAC5D,4CAAyC;AAElC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,iBAAO,CAAC,wBAAwB,CAAC,MAAM,EAAE,wBAAS,CAAC,CAAC;AACtD,CAAC,CAAC;AAFW,QAAA,kBAAkB,sBAE7B;AAEK,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,iBAAO,CAAC,wBAAwB,CAAC,SAAS,EAAE,sBAAO,CAAC,CAAC;AACvD,CAAC,CAAC;AAFW,QAAA,qBAAqB,yBAEhC;AAEF,kEAAmE;AACnE,kEAAmE;AAE5D,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,IAAA,2CAAsB,GAAE,CAAC;IACzB,IAAA,2CAAsB,GAAE,CAAC;AAC3B,CAAC,CAAC;AAHW,QAAA,eAAe,mBAG1B","file":"index.js","sourcesContent":["// -- Exports -----\nexport const version = \"0.15.0\";\n\nexport * from './graph';\n\nexport * from './interactions';\n\nexport { View } from './view';\nexport { Scale, registerScale } from './view/scale';\nexport { Coordinate, registerCoordinate } from './view/coordinate';\nexport { parseFunctionType, invokeFunctionType } from './parse/util';\nexport { GrammarBase } from './view/grammar-base';\nexport * from './util/text';\nexport * from './types';\nexport { Factory } from './core/factory';\nexport {\n SIGNAL_AUTOFIT,\n SIGNAL_HEIGHT,\n SIGNAL_PADDING,\n SIGNAL_VIEW_HEIGHT,\n SIGNAL_VIEW_WIDTH,\n SIGNAL_WIDTH,\n SIGNAL_VIEW_BOX\n} from './view/constants';\nexport { registerViewEventsAPI } from './view/view-event-mixin';\nexport { registerViewMorphAPI } from './view/view-morph-mixin';\n\nexport { ThemeManager } from './theme/theme-manager';\n\nexport * from './glyph';\nexport * from './component';\nexport * from './transforms';\nexport * from './graph/animation/animation';\n\nexport { vglobal } from '@visactor/vrender-core';\nexport * from './env';\nexport * from './interactions';\nexport * from './semantic-marks/cell';\nexport * from './semantic-marks/interval';\nexport * from './graph/mark/graphic';\nexport { registerDefaultLayout, defaultDoLayout } from './graph/layout/layout';\nexport { registerGlyphMark, GlyphMark } from './view/glyph';\n\nimport { DragNDrop, Gesture } from '@visactor/vrender-kits';\nimport { Factory } from './core/factory';\n\nexport const registerDragPlugin = () => {\n Factory.registerStageEventPlugin('drag', DragNDrop);\n};\n\nexport const registerGesturePlugin = () => {\n Factory.registerStageEventPlugin('gesture', Gesture);\n};\n\nimport { registerViewAnimateAPI } from './view/view-animate-mixin';\nimport { registerMarkAnimateAPI } from './view/mark-animate-mixin';\n\nexport const registerAnimate = () => {\n registerViewAnimateAPI();\n registerMarkAnimateAPI();\n};\n"]}
|
|
@@ -17,7 +17,7 @@ class MarkAnimateMixin {
|
|
|
17
17
|
this.animate = mark.animate, this.animate.mark = this;
|
|
18
18
|
}
|
|
19
19
|
updateAnimate(spec) {
|
|
20
|
-
|
|
20
|
+
this.animate.updateConfig(spec.animation), this.animate.updateState(spec.animationState);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/view/mark-animate-mixin.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,wDAAqD;AAGrD,iCAA8B;AAE9B,MAAM,gBAAgB;IAAtB;QACE,YAAO,GAAa,IAAI,iBAAO,CAAC,IAAwB,EAAE,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/view/mark-animate-mixin.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,wDAAqD;AAGrD,iCAA8B;AAE9B,MAAM,gBAAgB;IAAtB;QACE,YAAO,GAAa,IAAI,iBAAO,CAAC,IAAwB,EAAE,EAAE,CAAC,CAAC;IAoBhE,CAAC;IAlBC,WAAW,CAAC,IAAc;QACxB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,IAAI,CAAC,OAAO,GAAG,IAAI,iBAAO,CAAC,IAAwB,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YACrE,IAAK,IAAY,CAAC,WAAW,EAAE,EAAE;gBAC/B,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;aAC/C;SACF;IACH,CAAC;IAED,YAAY,CAAC,IAAW;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAwB,CAAC;IAC/C,CAAC;IAED,aAAa,CAAC,IAAc;QAC1B,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAChD,CAAC;CACF;AAEM,MAAM,sBAAsB,GAAG,GAAG,EAAE;IACzC,IAAA,cAAK,EAAC,WAAI,EAAE,gBAAgB,CAAC,CAAC;AAChC,CAAC,CAAC;AAFW,QAAA,sBAAsB,0BAEjC","file":"mark-animate-mixin.js","sourcesContent":["import { mixin } from '@visactor/vutils';\nimport { Animate } from '../graph/animation/animate';\nimport type { IMark, MarkSpec } from '../types';\nimport type { IAnimate } from '../types/animate';\nimport { Mark } from './mark';\n\nclass MarkAnimateMixin {\n animate: IAnimate = new Animate(this as unknown as IMark, {});\n\n initAnimate(spec: MarkSpec) {\n if (!this.animate) {\n this.animate = new Animate(this as unknown as IMark, spec.animation);\n if ((this as any).needAnimate()) {\n this.animate.updateState(spec.animationState);\n }\n }\n }\n\n reuseAnimate(mark: IMark) {\n this.animate = mark.animate;\n this.animate.mark = this as unknown as IMark;\n }\n\n updateAnimate(spec: MarkSpec) {\n this.animate.updateConfig(spec.animation);\n this.animate.updateState(spec.animationState);\n }\n}\n\nexport const registerMarkAnimateAPI = () => {\n mixin(Mark, MarkAnimateMixin);\n};\n"]}
|
|
@@ -102,7 +102,8 @@ export default class CanvasRenderer {
|
|
|
102
102
|
ticker: viewOptions.ticker,
|
|
103
103
|
supportsTouchEvents: viewOptions.supportsTouchEvents,
|
|
104
104
|
supportsPointerEvents: viewOptions.supportsPointerEvents,
|
|
105
|
-
ReactDOM: viewOptions.ReactDOM
|
|
105
|
+
ReactDOM: viewOptions.ReactDOM,
|
|
106
|
+
autoRefresh: viewOptions.autoRefresh
|
|
106
107
|
});
|
|
107
108
|
(null === (_b = viewOptions.options3d) || void 0 === _b ? void 0 : _b.enable) && stage.set3dOptions(viewOptions.options3d),
|
|
108
109
|
stage.enableIncrementalAutoRender(), this._viewBox = viewOptions.viewBox, this._view.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_STAGE),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/canvas-renderer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG1E,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,MAAM,CAAC,OAAO,OAAO,cAAc;IAajC,YAAY,IAAW;QAqPf,0BAAqB,GAAG,GAAG,EAAE;YACnC,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE;gBACxD,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;aACjC;YAED,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;YAC/C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,yBAAyB,CAAC,CAAC;QACxD,CAAC,CAAC;QA3PA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,UAAU,CAAC,KAAa,EAAE,MAAc,EAAE,OAAqB,EAAE,WAA6B;QAC5F,IAAI,CAAC,MA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3F,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CACpE,KAAgC,EAChC,aAAa,CACH,CAAC;SACd;QAED,OAAO;YACL,KAAK;YACL,KAAK;SACN,CAAC;IACJ,CAAC;IAEO,SAAS;QACf,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YAE5C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YACpB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YAEpB,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;YAC3C,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;SAC7B;IACH,CAAC;CAUF","file":"canvas-renderer.js","sourcesContent":["import type { IBoundsLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { isObject } from '@visactor/vutils';\nimport type { IEventTarget, IColor, ILayer, Stage } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { createStage, waitForAllSubLayers } from '@visactor/vrender-core';\nimport type { IViewOptions, IView, IMark, IViewEventConfig } from '../types';\nimport type { IRenderer } from '../types/renderer';\nimport { HOOK_EVENT } from './enums';\nimport type { DragNDrop } from '@visactor/vrender-kits';\nimport type { Gesture } from '@visactor/vrender-kits';\nimport { Factory } from '../core/factory';\n\nexport default class CanvasRenderer implements IRenderer {\n private _width: number;\n private _height: number;\n\n private _view: IView;\n private _viewOptions: IViewOptions;\n private _eventConfig: IViewEventConfig;\n private _stage: Stage;\n private _layer: ILayer;\n private _dragController: DragNDrop;\n private _gestureController: Gesture;\n private _viewBox: IBoundsLike;\n\n constructor(view: IView) {\n this._view = view;\n }\n\n initialize(width: number, height: number, options: IViewOptions, eventConfig: IViewEventConfig) {\n this._width = width;\n this._height = height;\n this._viewOptions = options;\n this._eventConfig = eventConfig;\n\n this.initStage();\n\n // this method will invoke resize to size the canvas appropriately\n return this;\n }\n\n stage() {\n return this._stage ?? null;\n }\n\n gestureController() {\n return this._gestureController ?? null;\n }\n\n canvas() {\n if (this._stage) {\n return this._stage.window.getNativeHandler().nativeCanvas;\n }\n return null;\n }\n\n context() {\n if (this._stage) {\n return this._stage.window.getContext().nativeContext;\n }\n return null;\n }\n\n combineIncrementalLayers() {\n if (this._stage) {\n waitForAllSubLayers(this._stage as any).then(() => {\n // stage might be null in current tick\n if (this._stage) {\n this._stage.defaultLayer.combineSubLayer();\n }\n });\n }\n return this;\n }\n\n background(color: IColor) {\n if (this._stage) {\n this._stage.background = color;\n return this;\n }\n }\n\n setDpr(resolution: number, redraw: boolean) {\n this._stage?.setDpr?.(resolution);\n if (redraw) {\n this.renderNextFrame();\n }\n return this;\n }\n\n shouldResize(width: number, height: number) {\n return width !== this._width || height !== this._height;\n }\n\n resize(width: number, height: number) {\n this._view.emit(HOOK_EVENT.BEFORE_STAGE_RESIZE);\n if (this.shouldResize(width, height)) {\n this._width = width;\n this._height = height;\n this._stage && this._stage.resize(width, height);\n }\n\n this._view.emit(HOOK_EVENT.AFTER_STAGE_RESIZE);\n\n return this;\n }\n\n setViewBox(viewBox: IBoundsLike, rerender: boolean = true) {\n if (!this._stage) {\n return this;\n }\n if (\n viewBox &&\n (!this._viewBox ||\n viewBox.x1 !== this._viewBox.x1 ||\n viewBox.x2 !== this._viewBox.x2 ||\n viewBox.y1 !== this._viewBox.y1 ||\n viewBox.y2 !== this._viewBox.y2)\n ) {\n this._viewBox = viewBox;\n\n // FIXME: vRender\n this._stage.setViewBox(viewBox.x1, viewBox.y1, viewBox.x2 - viewBox.x1, viewBox.y2 - viewBox.y1, rerender);\n }\n return this;\n }\n\n render(immediately: boolean = false) {\n this._view.emit(HOOK_EVENT.BEFORE_VRENDER_DRAW);\n\n this.initStage();\n\n // disable dirty bounds when render is called\n this._stage.disableDirtyBounds();\n this._stage.afterNextRender(this.handleAfterNextRender);\n\n // render immediately and skip render in next frame\n if (immediately) {\n this._stage.render();\n\n this._view.emit(HOOK_EVENT.AFTER_VRENDER_DRAW);\n }\n return this;\n }\n\n renderNextFrame() {\n this.initStage();\n\n this._stage.renderNextFrame();\n\n return this;\n }\n\n toCanvas() {\n if (this._stage) {\n return this._stage.toCanvas();\n }\n return null;\n }\n\n preventRender(tag: boolean) {\n if (this._stage) {\n this._stage.preventRender(tag);\n }\n }\n\n // toImageData() {\n // if (this._stage) {\n // return this._stage.toImageData();\n // }\n // return null;\n // }\n\n release() {\n this._view.traverseMarkTree((mark: IMark) => {\n mark.release();\n });\n\n if (this._dragController) {\n this._dragController.release();\n }\n if (this._gestureController) {\n this._gestureController.release();\n }\n\n if (this._stage !== (this._viewOptions?.stage as unknown as Stage)) {\n // don't release the stage created by outside\n this._stage.release();\n }\n\n this._stage = null;\n this._layer = null;\n this._dragController = null;\n this._gestureController = null;\n }\n\n private createStage() {\n this._view.emit(HOOK_EVENT.BEFORE_CREATE_VRENDER_STAGE);\n\n const viewOptions = this._viewOptions;\n\n const stage =\n (viewOptions.stage as unknown as Stage) ??\n createStage({\n width: this._width,\n height: this._height,\n renderStyle: viewOptions.renderStyle,\n viewBox: viewOptions.viewBox,\n dpr: viewOptions.dpr,\n canvas: viewOptions.renderCanvas,\n canvasControled: viewOptions.canvasControled,\n container: viewOptions.container,\n title: viewOptions.rendererTitle,\n beforeRender: viewOptions.beforeRender,\n afterRender: viewOptions.afterRender,\n disableDirtyBounds: true,\n autoRender: true,\n pluginList: viewOptions.pluginList,\n enableHtmlAttribute: viewOptions.enableHtmlAttribute,\n optimize: viewOptions.optimize,\n ticker: viewOptions.ticker,\n supportsTouchEvents: viewOptions.supportsTouchEvents,\n supportsPointerEvents: viewOptions.supportsPointerEvents,\n ReactDOM: viewOptions.ReactDOM\n });\n\n if (viewOptions.options3d?.enable) {\n stage.set3dOptions(viewOptions.options3d);\n }\n\n stage.enableIncrementalAutoRender();\n\n this._viewBox = viewOptions.viewBox;\n this._view.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_STAGE);\n\n this._view.emit(HOOK_EVENT.BEFORE_CREATE_VRENDER_LAYER);\n const layer = viewOptions.layer ?? (stage.defaultLayer as ILayer);\n this._view.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_LAYER);\n\n if (this._eventConfig?.drag && Factory.getStageEventPlugin('drag')) {\n // 允许 drag 事件\n this._dragController = new (Factory.getStageEventPlugin('drag'))(stage as unknown as IEventTarget) as DragNDrop;\n }\n if (this._eventConfig?.gesture && Factory.getStageEventPlugin('gesture')) {\n const gestureConfig = isObject(this._eventConfig.gesture) ? this._eventConfig.gesture : {};\n // 允许手势\n this._gestureController = new (Factory.getStageEventPlugin('gesture'))(\n stage as unknown as IEventTarget,\n gestureConfig\n ) as Gesture;\n }\n\n return {\n stage,\n layer\n };\n }\n\n private initStage() {\n if (!this._stage) {\n const { stage, layer } = this.createStage();\n\n this._stage = stage;\n this._layer = layer;\n\n const background = this._view.background();\n this.background(background);\n }\n }\n\n private handleAfterNextRender = () => {\n if (this._stage && !this._viewOptions.disableDirtyBounds) {\n this._stage.enableDirtyBounds();\n }\n\n this._view.emit(HOOK_EVENT.AFTER_VRENDER_DRAW);\n this._view.emit(HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER);\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/graph/canvas-renderer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG1E,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,MAAM,CAAC,OAAO,OAAO,cAAc;IAajC,YAAY,IAAW;QAsPf,0BAAqB,GAAG,GAAG,EAAE;YACnC,IAAI,IAAI,CAAC,MAAM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AC,YAAY,0CAAE,IAAI,KAAI,OAAO,CAAC,mBAAmB,CAAC,MAAM,CAAC,EAAE;YAElE,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,KAAgC,CAAc,CAAC;SACjH;QACD,IAAI,CAAA,MAAA,IAAI,CAAC,YAAY,0CAAE,OAAO,KAAI,OAAO,CAAC,mBAAmB,CAAC,SAAS,CAAC,EAAE;YACxE,MAAM,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YAE3F,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CACpE,KAAgC,EAChC,aAAa,CACH,CAAC;SACd;QAED,OAAO;YACL,KAAK;YACL,KAAK;SACN,CAAC;IACJ,CAAC;IAEO,SAAS;QACf,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YAE5C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YACpB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YAEpB,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;YAC3C,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;SAC7B;IACH,CAAC;CAUF","file":"canvas-renderer.js","sourcesContent":["import type { IBoundsLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { isObject } from '@visactor/vutils';\nimport type { IEventTarget, IColor, ILayer, Stage } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { createStage, waitForAllSubLayers } from '@visactor/vrender-core';\nimport type { IViewOptions, IView, IMark, IViewEventConfig } from '../types';\nimport type { IRenderer } from '../types/renderer';\nimport { HOOK_EVENT } from './enums';\nimport type { DragNDrop } from '@visactor/vrender-kits';\nimport type { Gesture } from '@visactor/vrender-kits';\nimport { Factory } from '../core/factory';\n\nexport default class CanvasRenderer implements IRenderer {\n private _width: number;\n private _height: number;\n\n private _view: IView;\n private _viewOptions: IViewOptions;\n private _eventConfig: IViewEventConfig;\n private _stage: Stage;\n private _layer: ILayer;\n private _dragController: DragNDrop;\n private _gestureController: Gesture;\n private _viewBox: IBoundsLike;\n\n constructor(view: IView) {\n this._view = view;\n }\n\n initialize(width: number, height: number, options: IViewOptions, eventConfig: IViewEventConfig) {\n this._width = width;\n this._height = height;\n this._viewOptions = options;\n this._eventConfig = eventConfig;\n\n this.initStage();\n\n // this method will invoke resize to size the canvas appropriately\n return this;\n }\n\n stage() {\n return this._stage ?? null;\n }\n\n gestureController() {\n return this._gestureController ?? null;\n }\n\n canvas() {\n if (this._stage) {\n return this._stage.window.getNativeHandler().nativeCanvas;\n }\n return null;\n }\n\n context() {\n if (this._stage) {\n return this._stage.window.getContext().nativeContext;\n }\n return null;\n }\n\n combineIncrementalLayers() {\n if (this._stage) {\n waitForAllSubLayers(this._stage as any).then(() => {\n // stage might be null in current tick\n if (this._stage) {\n this._stage.defaultLayer.combineSubLayer();\n }\n });\n }\n return this;\n }\n\n background(color: IColor) {\n if (this._stage) {\n this._stage.background = color;\n return this;\n }\n }\n\n setDpr(resolution: number, redraw: boolean) {\n this._stage?.setDpr?.(resolution);\n if (redraw) {\n this.renderNextFrame();\n }\n return this;\n }\n\n shouldResize(width: number, height: number) {\n return width !== this._width || height !== this._height;\n }\n\n resize(width: number, height: number) {\n this._view.emit(HOOK_EVENT.BEFORE_STAGE_RESIZE);\n if (this.shouldResize(width, height)) {\n this._width = width;\n this._height = height;\n this._stage && this._stage.resize(width, height);\n }\n\n this._view.emit(HOOK_EVENT.AFTER_STAGE_RESIZE);\n\n return this;\n }\n\n setViewBox(viewBox: IBoundsLike, rerender: boolean = true) {\n if (!this._stage) {\n return this;\n }\n if (\n viewBox &&\n (!this._viewBox ||\n viewBox.x1 !== this._viewBox.x1 ||\n viewBox.x2 !== this._viewBox.x2 ||\n viewBox.y1 !== this._viewBox.y1 ||\n viewBox.y2 !== this._viewBox.y2)\n ) {\n this._viewBox = viewBox;\n\n // FIXME: vRender\n this._stage.setViewBox(viewBox.x1, viewBox.y1, viewBox.x2 - viewBox.x1, viewBox.y2 - viewBox.y1, rerender);\n }\n return this;\n }\n\n render(immediately: boolean = false) {\n this._view.emit(HOOK_EVENT.BEFORE_VRENDER_DRAW);\n\n this.initStage();\n\n // disable dirty bounds when render is called\n this._stage.disableDirtyBounds();\n this._stage.afterNextRender(this.handleAfterNextRender);\n\n // render immediately and skip render in next frame\n if (immediately) {\n this._stage.render();\n\n this._view.emit(HOOK_EVENT.AFTER_VRENDER_DRAW);\n }\n return this;\n }\n\n renderNextFrame() {\n this.initStage();\n\n this._stage.renderNextFrame();\n\n return this;\n }\n\n toCanvas() {\n if (this._stage) {\n return this._stage.toCanvas();\n }\n return null;\n }\n\n preventRender(tag: boolean) {\n if (this._stage) {\n this._stage.preventRender(tag);\n }\n }\n\n // toImageData() {\n // if (this._stage) {\n // return this._stage.toImageData();\n // }\n // return null;\n // }\n\n release() {\n this._view.traverseMarkTree((mark: IMark) => {\n mark.release();\n });\n\n if (this._dragController) {\n this._dragController.release();\n }\n if (this._gestureController) {\n this._gestureController.release();\n }\n\n if (this._stage !== (this._viewOptions?.stage as unknown as Stage)) {\n // don't release the stage created by outside\n this._stage.release();\n }\n\n this._stage = null;\n this._layer = null;\n this._dragController = null;\n this._gestureController = null;\n }\n\n private createStage() {\n this._view.emit(HOOK_EVENT.BEFORE_CREATE_VRENDER_STAGE);\n\n const viewOptions = this._viewOptions;\n\n const stage =\n (viewOptions.stage as unknown as Stage) ??\n createStage({\n width: this._width,\n height: this._height,\n renderStyle: viewOptions.renderStyle,\n viewBox: viewOptions.viewBox,\n dpr: viewOptions.dpr,\n canvas: viewOptions.renderCanvas,\n canvasControled: viewOptions.canvasControled,\n container: viewOptions.container,\n title: viewOptions.rendererTitle,\n beforeRender: viewOptions.beforeRender,\n afterRender: viewOptions.afterRender,\n disableDirtyBounds: true,\n autoRender: true,\n pluginList: viewOptions.pluginList,\n enableHtmlAttribute: viewOptions.enableHtmlAttribute,\n optimize: viewOptions.optimize,\n ticker: viewOptions.ticker,\n supportsTouchEvents: viewOptions.supportsTouchEvents,\n supportsPointerEvents: viewOptions.supportsPointerEvents,\n ReactDOM: viewOptions.ReactDOM,\n autoRefresh: viewOptions.autoRefresh\n });\n\n if (viewOptions.options3d?.enable) {\n stage.set3dOptions(viewOptions.options3d);\n }\n\n stage.enableIncrementalAutoRender();\n\n this._viewBox = viewOptions.viewBox;\n this._view.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_STAGE);\n\n this._view.emit(HOOK_EVENT.BEFORE_CREATE_VRENDER_LAYER);\n const layer = viewOptions.layer ?? (stage.defaultLayer as ILayer);\n this._view.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_LAYER);\n\n if (this._eventConfig?.drag && Factory.getStageEventPlugin('drag')) {\n // 允许 drag 事件\n this._dragController = new (Factory.getStageEventPlugin('drag'))(stage as unknown as IEventTarget) as DragNDrop;\n }\n if (this._eventConfig?.gesture && Factory.getStageEventPlugin('gesture')) {\n const gestureConfig = isObject(this._eventConfig.gesture) ? this._eventConfig.gesture : {};\n // 允许手势\n this._gestureController = new (Factory.getStageEventPlugin('gesture'))(\n stage as unknown as IEventTarget,\n gestureConfig\n ) as Gesture;\n }\n\n return {\n stage,\n layer\n };\n }\n\n private initStage() {\n if (!this._stage) {\n const { stage, layer } = this.createStage();\n\n this._stage = stage;\n this._layer = layer;\n\n const background = this._view.background();\n this.background(background);\n }\n }\n\n private handleAfterNextRender = () => {\n if (this._stage && !this._viewOptions.disableDirtyBounds) {\n this._stage.enableDirtyBounds();\n }\n\n this._view.emit(HOOK_EVENT.AFTER_VRENDER_DRAW);\n this._view.emit(HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER);\n };\n}\n"]}
|
|
@@ -62,7 +62,8 @@ export class GlyphElement extends Element {
|
|
|
62
62
|
encodeGraphic() {
|
|
63
63
|
this.coordinateTransformEncode(this.items);
|
|
64
64
|
const graphicAttributes = this.transformElementItems(this.items, this.mark.markType), isGraphicInit = !this.graphicItem;
|
|
65
|
-
this.graphicItem
|
|
65
|
+
this.graphicItem ? (this.graphicItem.clearStates(), this.graphicItem.states = {},
|
|
66
|
+
this.graphicItem.stateProxy = null) : this.initGraphicItem(), this.diffState === DiffState.enter || isGraphicInit ? (this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(!0),
|
|
66
67
|
this.applyGraphicAttributes(graphicAttributes), this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(!1)) : this.applyGraphicAttributes(graphicAttributes),
|
|
67
68
|
this.diffState !== DiffState.enter && this.diffState !== DiffState.update || !this.states.length || (Object.values(this.glyphGraphicItems).forEach((graphicItem => {
|
|
68
69
|
graphicItem.states = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/glyph-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAU9E,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAGrD,MAAM,OAAO,YAAa,SAAQ,OAAO;IAQvC,YAAY,IAAgB;QAC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C,QAAQ,CAAC,EAAE;YACrD,IAAI,CAAC,wBAAwB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YAC9C,IAAI,CAAC,wBAAwB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YAC9C,IAAI,CAAC,yBAAyB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;QAC9B,KAAK,CAAC,MAAM,EAAE,CAAC;IACjB,CAAC;IAED,OAAO;QACL,IAAI,IAAI,CAAC,iBAAiB,EAAE;YAC1B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;gBAC1D,WAAW,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC;YACvC,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;SAC/B;QACD,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;CACF","file":"glyph-element.js","sourcesContent":["import { has, isNil, isBoolean, isFunction, isEqual } from '@visactor/vutils';\nimport type {\n IGlyphElement,\n IGlyphMark,\n MarkElementItem,\n MarkSpec,\n IGlyphMeta,\n MarkType,\n StateProxyEncodeSpec\n} from '../types';\nimport { cloneTransformAttributes, transformAttributes } from './attributes/transform';\nimport { BridgeElementKey, CollectionMarkType } from './constants';\nimport { DiffState, HOOK_EVENT, GrammarMarkType } from './enums';\nimport { Element } from './element';\nimport { invokeEncoderToItems } from './mark/encode';\nimport type { IGraphicAttribute, IGlyph } from '@visactor/vrender-core';\n\nexport class GlyphElement extends Element implements IGlyphElement {\n declare graphicItem: IGlyph;\n\n declare mark: IGlyphMark;\n protected glyphGraphicItems: { [markName: string]: any };\n\n private glyphMeta: IGlyphMeta;\n\n constructor(mark: IGlyphMark) {\n super(mark);\n this.glyphMeta = this.mark.getGlyphMeta();\n }\n\n getGlyphGraphicItems() {\n return this.glyphGraphicItems;\n }\n\n initGraphicItem(attributes: any = {}) {\n if (this.graphicItem) {\n return;\n }\n\n this.graphicItem = this.mark.addGraphicItem(attributes, this.groupKey) as IGlyph;\n this.graphicItem[BridgeElementKey] = this;\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(false);\n\n const glyphMarks = this.glyphMeta.getMarks();\n this.glyphGraphicItems = {};\n this.graphicItem.getSubGraphic().forEach((graphic: any) => {\n const markType = glyphMarks[graphic.name];\n this.glyphGraphicItems[graphic.name] = graphic;\n graphic.onBeforeAttributeUpdate = (attributes: any) => {\n // mark might be released\n if (!this.mark) {\n return attributes;\n }\n const graphicAttributes = transformAttributes(markType, attributes, this, graphic.name);\n return graphicAttributes;\n };\n });\n\n this.clearGraphicAttributes();\n }\n\n useStates(states: string[], hasAnimation?: boolean) {\n if (!this.graphicItem) {\n return false;\n }\n this.mark.emit(HOOK_EVENT.BEFORE_ELEMENT_STATE, { states }, this);\n\n this.states = states.slice();\n\n const stateAnimationEnable = isBoolean(hasAnimation) ? hasAnimation : this.hasStateAnimation();\n\n this.graphicItem.glyphStateProxy = this.getStateAttrs;\n this.graphicItem.useStates(this.states, stateAnimationEnable);\n\n this.mark.emit(HOOK_EVENT.AFTER_ELEMENT_STATE, { states }, this);\n\n return true;\n }\n\n protected getStateAttrs = (stateName: string, nextStates: string[]) => {\n const isRuntimeState = !isNil(this.runtimeStatesEncoder?.[stateName]);\n const encoder = isRuntimeState\n ? {\n ...(this.mark.getSpec() as MarkSpec).encode?.[stateName],\n ...this.runtimeStatesEncoder[stateName]\n }\n : (this.mark.getSpec() as MarkSpec).encode?.[stateName];\n\n const glyphStateAttributes = {} as {\n attributes: Partial<IGraphicAttribute>;\n subAttributes: Partial<IGraphicAttribute>[];\n };\n\n if (!encoder) {\n return glyphStateAttributes;\n }\n\n if (isFunction(encoder)) {\n glyphStateAttributes.attributes = (encoder as StateProxyEncodeSpec)(this.getDatum(), this, stateName, nextStates);\n return glyphStateAttributes;\n }\n\n if (!isRuntimeState && this.graphicItem.glyphStates?.[stateName]) {\n return this.graphicItem.glyphStates[stateName];\n }\n\n if (encoder) {\n const item = this.items[0];\n const targetItems = [Object.assign({}, item, { nextAttrs: {} })];\n\n invokeEncoderToItems(this, targetItems, encoder, (this.mark as any).parameters());\n this.coordinateTransformEncode(targetItems);\n\n glyphStateAttributes.attributes = targetItems[0].nextAttrs;\n\n if (!this.graphicItem.glyphStates) {\n this.graphicItem.glyphStates = { [stateName]: glyphStateAttributes };\n } else if (!this.graphicItem.glyphStates[stateName]) {\n this.graphicItem.glyphStates[stateName] = glyphStateAttributes;\n }\n\n return glyphStateAttributes;\n }\n\n return glyphStateAttributes;\n };\n\n encodeGraphic() {\n this.coordinateTransformEncode(this.items);\n const graphicAttributes = this.transformElementItems(this.items, this.mark.markType);\n\n const isGraphicInit = !this.graphicItem;\n if (!this.graphicItem) {\n this.initGraphicItem();\n }\n\n if (this.diffState === DiffState.enter || isGraphicInit) {\n // apply default encoder when enter or graphic item is created\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(true);\n this.applyGraphicAttributes(graphicAttributes);\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(false);\n } else {\n this.applyGraphicAttributes(graphicAttributes);\n }\n\n if ((this.diffState === DiffState.enter || this.diffState === DiffState.update) && this.states.length) {\n Object.values(this.glyphGraphicItems).forEach(graphicItem => {\n // 更新数据流后,states计算不缓存\n graphicItem.states = {};\n });\n this.useStates(this.states);\n }\n\n // clear item attributes\n this.items.map(item => {\n item.nextAttrs = {};\n });\n }\n\n encodeCustom(nextAttrs?: any): { [markName: string]: any } {\n let customEncodeValues: { [markName: string]: any } = {};\n const channelEncoder = this.glyphMeta.getChannelEncoder();\n const functionEncoder = this.glyphMeta.getFunctionEncoder();\n\n if (functionEncoder) {\n customEncodeValues = functionEncoder.call(\n null,\n Object.assign({}, this.graphicItem?.attribute, nextAttrs),\n this.getDatum(),\n this,\n this.mark.getGlyphConfig()\n );\n }\n if (channelEncoder) {\n // TODO: maybe delete origin encode value?\n let allAttrs: any;\n Object.keys(channelEncoder).forEach(channel => {\n if (!isNil(nextAttrs[channel])) {\n if (!allAttrs) {\n allAttrs = Object.assign({}, this.graphicItem?.attribute, nextAttrs);\n }\n const encodeResult = channelEncoder[channel].call(\n null,\n channel,\n nextAttrs[channel],\n allAttrs,\n this.getDatum(),\n this,\n this.mark.getGlyphConfig()\n );\n Object.keys(encodeResult ?? {}).forEach(markName => {\n customEncodeValues[markName] = Object.assign(customEncodeValues[markName] ?? {}, encodeResult[markName]);\n });\n }\n });\n }\n return customEncodeValues;\n }\n\n private encodeDefault() {\n const defaultEncodeValues: { [markName: string]: any } = {};\n // apply default encode\n if (this.glyphMeta.getDefaultEncoder()) {\n const defaultEncodeResult = this.glyphMeta\n .getDefaultEncoder()\n .call(null, this.getDatum(), this, this.mark.getGlyphConfig());\n Object.assign(defaultEncodeValues, defaultEncodeResult);\n }\n return defaultEncodeValues;\n }\n\n private _onGlyphAttributeUpdate(first: boolean = false) {\n return (attributes: any) => {\n // mark might be released\n if (!this.mark) {\n return attributes;\n }\n const glyphMarks = this.glyphMeta.getMarks();\n\n const graphicAttributes = transformAttributes(this.mark.getAttributeTransforms(), attributes, this);\n\n // apply default encode\n const defaultEncodeValues = first ? this.encodeDefault() : null;\n // apply custom encode\n const customEncodeValues = this.encodeCustom(attributes);\n\n Object.keys(glyphMarks).forEach(markName => {\n const markType = glyphMarks[markName];\n const graphicItem = this.glyphGraphicItems[markName];\n const customAttributes = customEncodeValues?.[markName];\n const additionalAttributes = Object.assign({}, customAttributes);\n if (first) {\n // apply default attributes when visual channel is not set\n const defaultAttributes = defaultEncodeValues?.[markName];\n Object.keys(defaultAttributes ?? {}).forEach(key => {\n if (!has(this.items[0].nextAttrs, key) && !has(additionalAttributes, key)) {\n additionalAttributes[key] = defaultAttributes[key];\n }\n });\n }\n const glyphAttributes = Object.assign({}, cloneTransformAttributes(markType, attributes), additionalAttributes);\n const glyphItems = this._generateGlyphItems(markType, this.items, glyphAttributes);\n this.coordinateTransformEncode(glyphItems);\n const graphicAttributes = this.transformElementItems(glyphItems, markType);\n\n this.applyGlyphGraphicAttributes(graphicAttributes, markName, graphicItem);\n\n if (markType === GrammarMarkType.shape) {\n // FIXME: shape需要拿到原始数据进行编码,暂时把数据绑定到graphicItem上,看后续graphicItem是否需要支持数据绑定\n graphicItem.datum = glyphItems[0].datum;\n }\n });\n\n return graphicAttributes;\n };\n }\n\n private _generateGlyphItems(markType: MarkType, items: MarkElementItem[], additionalAttributes: any) {\n const glyphItems = items.map(item => Object.assign({}, item, { nextAttrs: additionalAttributes }));\n\n if ((CollectionMarkType as string[]).includes(markType) && this.mark.getSpec().enableSegments) {\n // segment mark require all items to apply additional attributes\n glyphItems.forEach((glyphItem, index) => {\n glyphItem.nextAttrs = Object.assign({}, items[index].nextAttrs, additionalAttributes);\n });\n }\n\n return glyphItems;\n }\n\n getGraphicAttribute(channel: string, prev: boolean = false, markName?: any) {\n if (!this.graphicItem) {\n return undefined;\n }\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n if (prev && has(prevGraphicAttributes, channel)) {\n return prevGraphicAttributes[channel];\n }\n\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.attribute[channel];\n }\n\n setGraphicAttribute(channel: string, value: any, final: boolean = true, markName?: any) {\n if (!this.graphicItem) {\n return;\n }\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n\n if (final) {\n finalGraphicAttributes[channel] = value;\n }\n if (!has(prevGraphicAttributes, channel)) {\n prevGraphicAttributes[channel] = graphicItem.attribute[channel];\n }\n\n graphicItem.setAttribute(channel, value);\n }\n\n setGraphicAttributes(attributes: { [channel: string]: any }, final: boolean = true, markName?: any) {\n if (!this.graphicItem) {\n return;\n }\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n\n Object.keys(attributes).forEach(key => {\n if (final) {\n finalGraphicAttributes[key] = attributes[key];\n }\n if (!has(prevGraphicAttributes, key)) {\n prevGraphicAttributes[key] = graphicItem.attribute[key];\n }\n });\n\n graphicItem.setAttributes(attributes);\n }\n\n protected diffAttributes(graphicAttributes: { [channel: string]: any }, markName?: string) {\n const diffResult = {};\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n for (const key in graphicAttributes) {\n if (!has(finalGraphicAttributes, key) || !isEqual(finalGraphicAttributes[key], graphicAttributes[key])) {\n diffResult[key] = graphicAttributes[key];\n }\n }\n return diffResult;\n }\n\n protected applyGlyphGraphicAttributes(graphicAttributes: any, markName: string, graphicItem: any): void {\n if (this.mark.needAnimate()) {\n // If mark need animate, diff attributes.\n const nextGraphicAttributes = this.diffAttributes(graphicAttributes, markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName) ?? {};\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName) ?? {};\n Object.keys(nextGraphicAttributes).forEach(channel => {\n prevGraphicAttributes[channel] = graphicItem.attribute[channel];\n finalGraphicAttributes[channel] = nextGraphicAttributes[channel];\n });\n this.setNextGraphicAttributes(nextGraphicAttributes, markName);\n this.setPrevGraphicAttributes(prevGraphicAttributes, markName);\n this.setFinalGraphicAttributes(finalGraphicAttributes, markName);\n\n // Apply next attributes to current graphic item immediately.\n // Scene graph tree should be handled like no animation exists in dataflow procedure.\n graphicItem.setAttributes(nextGraphicAttributes);\n } else {\n graphicItem.setAttributes(graphicAttributes);\n }\n }\n\n getFinalGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.finalAttrs;\n }\n\n protected setFinalGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.finalAttrs = attributes;\n }\n\n getPrevGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.prevAttrs;\n }\n\n protected setPrevGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.prevAttrs = attributes;\n }\n\n getNextGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.nextAttrs;\n }\n\n protected setNextGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.nextAttrs = attributes;\n }\n\n clearChangedGraphicAttributes() {\n this.setPrevGraphicAttributes(null);\n this.setNextGraphicAttributes(null);\n Object.keys(this.glyphGraphicItems).forEach(markName => {\n this.setPrevGraphicAttributes(null, markName);\n this.setNextGraphicAttributes(null, markName);\n });\n }\n\n clearGraphicAttributes() {\n this.setPrevGraphicAttributes(null);\n this.setNextGraphicAttributes(null);\n this.setFinalGraphicAttributes(null);\n Object.keys(this.glyphGraphicItems).forEach(markName => {\n this.setPrevGraphicAttributes(null, markName);\n this.setNextGraphicAttributes(null, markName);\n this.setFinalGraphicAttributes(null, markName);\n });\n }\n\n remove() {\n this.glyphGraphicItems = null;\n super.remove();\n }\n\n release() {\n if (this.glyphGraphicItems) {\n Object.values(this.glyphGraphicItems).forEach(graphicItem => {\n graphicItem[BridgeElementKey] = null;\n });\n this.glyphGraphicItems = null;\n }\n super.release();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/graph/glyph-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAU9E,OAA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Nil, isBoolean, isFunction, isEqual } from '@visactor/vutils';\nimport type {\n IGlyphElement,\n IGlyphMark,\n MarkElementItem,\n MarkSpec,\n IGlyphMeta,\n MarkType,\n StateProxyEncodeSpec\n} from '../types';\nimport { cloneTransformAttributes, transformAttributes } from './attributes/transform';\nimport { BridgeElementKey, CollectionMarkType } from './constants';\nimport { DiffState, HOOK_EVENT, GrammarMarkType } from './enums';\nimport { Element } from './element';\nimport { invokeEncoderToItems } from './mark/encode';\nimport type { IGraphicAttribute, IGlyph } from '@visactor/vrender-core';\n\nexport class GlyphElement extends Element implements IGlyphElement {\n declare graphicItem: IGlyph;\n\n declare mark: IGlyphMark;\n protected glyphGraphicItems: { [markName: string]: any };\n\n private glyphMeta: IGlyphMeta;\n\n constructor(mark: IGlyphMark) {\n super(mark);\n this.glyphMeta = this.mark.getGlyphMeta();\n }\n\n getGlyphGraphicItems() {\n return this.glyphGraphicItems;\n }\n\n initGraphicItem(attributes: any = {}) {\n if (this.graphicItem) {\n return;\n }\n\n this.graphicItem = this.mark.addGraphicItem(attributes, this.groupKey) as IGlyph;\n this.graphicItem[BridgeElementKey] = this;\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(false);\n\n const glyphMarks = this.glyphMeta.getMarks();\n this.glyphGraphicItems = {};\n this.graphicItem.getSubGraphic().forEach((graphic: any) => {\n const markType = glyphMarks[graphic.name];\n this.glyphGraphicItems[graphic.name] = graphic;\n graphic.onBeforeAttributeUpdate = (attributes: any) => {\n // mark might be released\n if (!this.mark) {\n return attributes;\n }\n const graphicAttributes = transformAttributes(markType, attributes, this, graphic.name);\n return graphicAttributes;\n };\n });\n\n this.clearGraphicAttributes();\n }\n\n useStates(states: string[], hasAnimation?: boolean) {\n if (!this.graphicItem) {\n return false;\n }\n this.mark.emit(HOOK_EVENT.BEFORE_ELEMENT_STATE, { states }, this);\n\n this.states = states.slice();\n\n const stateAnimationEnable = isBoolean(hasAnimation) ? hasAnimation : this.hasStateAnimation();\n\n this.graphicItem.glyphStateProxy = this.getStateAttrs;\n this.graphicItem.useStates(this.states, stateAnimationEnable);\n\n this.mark.emit(HOOK_EVENT.AFTER_ELEMENT_STATE, { states }, this);\n\n return true;\n }\n\n protected getStateAttrs = (stateName: string, nextStates: string[]) => {\n const isRuntimeState = !isNil(this.runtimeStatesEncoder?.[stateName]);\n\n const encoder = isRuntimeState\n ? {\n ...(this.mark.getSpec() as MarkSpec).encode?.[stateName],\n ...this.runtimeStatesEncoder[stateName]\n }\n : (this.mark.getSpec() as MarkSpec).encode?.[stateName];\n\n const glyphStateAttributes = {} as {\n attributes: Partial<IGraphicAttribute>;\n subAttributes: Partial<IGraphicAttribute>[];\n };\n\n if (!encoder) {\n return glyphStateAttributes;\n }\n\n if (isFunction(encoder)) {\n glyphStateAttributes.attributes = (encoder as StateProxyEncodeSpec)(this.getDatum(), this, stateName, nextStates);\n return glyphStateAttributes;\n }\n\n if (!isRuntimeState && this.graphicItem.glyphStates?.[stateName]) {\n return this.graphicItem.glyphStates[stateName];\n }\n\n if (encoder) {\n const item = this.items[0];\n const targetItems = [Object.assign({}, item, { nextAttrs: {} })];\n\n invokeEncoderToItems(this, targetItems, encoder, (this.mark as any).parameters());\n this.coordinateTransformEncode(targetItems);\n\n glyphStateAttributes.attributes = targetItems[0].nextAttrs;\n\n if (!this.graphicItem.glyphStates) {\n this.graphicItem.glyphStates = { [stateName]: glyphStateAttributes };\n } else if (!this.graphicItem.glyphStates[stateName]) {\n this.graphicItem.glyphStates[stateName] = glyphStateAttributes;\n }\n\n return glyphStateAttributes;\n }\n\n return glyphStateAttributes;\n };\n\n encodeGraphic() {\n this.coordinateTransformEncode(this.items);\n const graphicAttributes = this.transformElementItems(this.items, this.mark.markType);\n\n const isGraphicInit = !this.graphicItem;\n if (!this.graphicItem) {\n this.initGraphicItem();\n } else {\n this.graphicItem.clearStates();\n // 更新数据流后,states计算不缓存\n this.graphicItem.states = {};\n this.graphicItem.stateProxy = null;\n }\n\n if (this.diffState === DiffState.enter || isGraphicInit) {\n // apply default encoder when enter or graphic item is created\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(true);\n this.applyGraphicAttributes(graphicAttributes);\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(false);\n } else {\n this.applyGraphicAttributes(graphicAttributes);\n }\n\n if ((this.diffState === DiffState.enter || this.diffState === DiffState.update) && this.states.length) {\n Object.values(this.glyphGraphicItems).forEach(graphicItem => {\n // 更新数据流后,states计算不缓存\n graphicItem.states = {};\n });\n this.useStates(this.states);\n }\n\n // clear item attributes\n this.items.map(item => {\n item.nextAttrs = {};\n });\n }\n\n encodeCustom(nextAttrs?: any): { [markName: string]: any } {\n let customEncodeValues: { [markName: string]: any } = {};\n const channelEncoder = this.glyphMeta.getChannelEncoder();\n const functionEncoder = this.glyphMeta.getFunctionEncoder();\n\n if (functionEncoder) {\n customEncodeValues = functionEncoder.call(\n null,\n Object.assign({}, this.graphicItem?.attribute, nextAttrs),\n this.getDatum(),\n this,\n this.mark.getGlyphConfig()\n );\n }\n if (channelEncoder) {\n // TODO: maybe delete origin encode value?\n let allAttrs: any;\n Object.keys(channelEncoder).forEach(channel => {\n if (!isNil(nextAttrs[channel])) {\n if (!allAttrs) {\n allAttrs = Object.assign({}, this.graphicItem?.attribute, nextAttrs);\n }\n const encodeResult = channelEncoder[channel].call(\n null,\n channel,\n nextAttrs[channel],\n allAttrs,\n this.getDatum(),\n this,\n this.mark.getGlyphConfig()\n );\n Object.keys(encodeResult ?? {}).forEach(markName => {\n customEncodeValues[markName] = Object.assign(customEncodeValues[markName] ?? {}, encodeResult[markName]);\n });\n }\n });\n }\n return customEncodeValues;\n }\n\n private encodeDefault() {\n const defaultEncodeValues: { [markName: string]: any } = {};\n // apply default encode\n if (this.glyphMeta.getDefaultEncoder()) {\n const defaultEncodeResult = this.glyphMeta\n .getDefaultEncoder()\n .call(null, this.getDatum(), this, this.mark.getGlyphConfig());\n Object.assign(defaultEncodeValues, defaultEncodeResult);\n }\n return defaultEncodeValues;\n }\n\n private _onGlyphAttributeUpdate(first: boolean = false) {\n return (attributes: any) => {\n // mark might be released\n if (!this.mark) {\n return attributes;\n }\n const glyphMarks = this.glyphMeta.getMarks();\n\n const graphicAttributes = transformAttributes(this.mark.getAttributeTransforms(), attributes, this);\n\n // apply default encode\n const defaultEncodeValues = first ? this.encodeDefault() : null;\n // apply custom encode\n const customEncodeValues = this.encodeCustom(attributes);\n\n Object.keys(glyphMarks).forEach(markName => {\n const markType = glyphMarks[markName];\n const graphicItem = this.glyphGraphicItems[markName];\n const customAttributes = customEncodeValues?.[markName];\n const additionalAttributes = Object.assign({}, customAttributes);\n if (first) {\n // apply default attributes when visual channel is not set\n const defaultAttributes = defaultEncodeValues?.[markName];\n Object.keys(defaultAttributes ?? {}).forEach(key => {\n if (!has(this.items[0].nextAttrs, key) && !has(additionalAttributes, key)) {\n additionalAttributes[key] = defaultAttributes[key];\n }\n });\n }\n const glyphAttributes = Object.assign({}, cloneTransformAttributes(markType, attributes), additionalAttributes);\n const glyphItems = this._generateGlyphItems(markType, this.items, glyphAttributes);\n this.coordinateTransformEncode(glyphItems);\n const graphicAttributes = this.transformElementItems(glyphItems, markType);\n\n this.applyGlyphGraphicAttributes(graphicAttributes, markName, graphicItem);\n\n if (markType === GrammarMarkType.shape) {\n // FIXME: shape需要拿到原始数据进行编码,暂时把数据绑定到graphicItem上,看后续graphicItem是否需要支持数据绑定\n graphicItem.datum = glyphItems[0].datum;\n }\n });\n\n return graphicAttributes;\n };\n }\n\n private _generateGlyphItems(markType: MarkType, items: MarkElementItem[], additionalAttributes: any) {\n const glyphItems = items.map(item => Object.assign({}, item, { nextAttrs: additionalAttributes }));\n\n if ((CollectionMarkType as string[]).includes(markType) && this.mark.getSpec().enableSegments) {\n // segment mark require all items to apply additional attributes\n glyphItems.forEach((glyphItem, index) => {\n glyphItem.nextAttrs = Object.assign({}, items[index].nextAttrs, additionalAttributes);\n });\n }\n\n return glyphItems;\n }\n\n getGraphicAttribute(channel: string, prev: boolean = false, markName?: any) {\n if (!this.graphicItem) {\n return undefined;\n }\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n if (prev && has(prevGraphicAttributes, channel)) {\n return prevGraphicAttributes[channel];\n }\n\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.attribute[channel];\n }\n\n setGraphicAttribute(channel: string, value: any, final: boolean = true, markName?: any) {\n if (!this.graphicItem) {\n return;\n }\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n\n if (final) {\n finalGraphicAttributes[channel] = value;\n }\n if (!has(prevGraphicAttributes, channel)) {\n prevGraphicAttributes[channel] = graphicItem.attribute[channel];\n }\n\n graphicItem.setAttribute(channel, value);\n }\n\n setGraphicAttributes(attributes: { [channel: string]: any }, final: boolean = true, markName?: any) {\n if (!this.graphicItem) {\n return;\n }\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n\n Object.keys(attributes).forEach(key => {\n if (final) {\n finalGraphicAttributes[key] = attributes[key];\n }\n if (!has(prevGraphicAttributes, key)) {\n prevGraphicAttributes[key] = graphicItem.attribute[key];\n }\n });\n\n graphicItem.setAttributes(attributes);\n }\n\n protected diffAttributes(graphicAttributes: { [channel: string]: any }, markName?: string) {\n const diffResult = {};\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n for (const key in graphicAttributes) {\n if (!has(finalGraphicAttributes, key) || !isEqual(finalGraphicAttributes[key], graphicAttributes[key])) {\n diffResult[key] = graphicAttributes[key];\n }\n }\n return diffResult;\n }\n\n protected applyGlyphGraphicAttributes(graphicAttributes: any, markName: string, graphicItem: any): void {\n if (this.mark.needAnimate()) {\n // If mark need animate, diff attributes.\n const nextGraphicAttributes = this.diffAttributes(graphicAttributes, markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName) ?? {};\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName) ?? {};\n Object.keys(nextGraphicAttributes).forEach(channel => {\n prevGraphicAttributes[channel] = graphicItem.attribute[channel];\n finalGraphicAttributes[channel] = nextGraphicAttributes[channel];\n });\n this.setNextGraphicAttributes(nextGraphicAttributes, markName);\n this.setPrevGraphicAttributes(prevGraphicAttributes, markName);\n this.setFinalGraphicAttributes(finalGraphicAttributes, markName);\n\n // Apply next attributes to current graphic item immediately.\n // Scene graph tree should be handled like no animation exists in dataflow procedure.\n graphicItem.setAttributes(nextGraphicAttributes);\n } else {\n graphicItem.setAttributes(graphicAttributes);\n }\n }\n\n getFinalGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.finalAttrs;\n }\n\n protected setFinalGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.finalAttrs = attributes;\n }\n\n getPrevGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.prevAttrs;\n }\n\n protected setPrevGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.prevAttrs = attributes;\n }\n\n getNextGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.nextAttrs;\n }\n\n protected setNextGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.nextAttrs = attributes;\n }\n\n clearChangedGraphicAttributes() {\n this.setPrevGraphicAttributes(null);\n this.setNextGraphicAttributes(null);\n Object.keys(this.glyphGraphicItems).forEach(markName => {\n this.setPrevGraphicAttributes(null, markName);\n this.setNextGraphicAttributes(null, markName);\n });\n }\n\n clearGraphicAttributes() {\n this.setPrevGraphicAttributes(null);\n this.setNextGraphicAttributes(null);\n this.setFinalGraphicAttributes(null);\n Object.keys(this.glyphGraphicItems).forEach(markName => {\n this.setPrevGraphicAttributes(null, markName);\n this.setNextGraphicAttributes(null, markName);\n this.setFinalGraphicAttributes(null, markName);\n });\n }\n\n remove() {\n this.glyphGraphicItems = null;\n super.remove();\n }\n\n release() {\n if (this.glyphGraphicItems) {\n Object.values(this.glyphGraphicItems).forEach(graphicItem => {\n graphicItem[BridgeElementKey] = null;\n });\n this.glyphGraphicItems = null;\n }\n super.release();\n }\n}\n"]}
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
package/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAEhC,cAAc,SAAS,CAAC;AAExB,cAAc,gBAAgB,CAAC;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EACL,cAAc,EACd,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,YA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cesContent":["// -- Exports -----\nexport const version = \"0.15.0\";\n\nexport * from './graph';\n\nexport * from './interactions';\n\nexport { View } from './view';\nexport { Scale, registerScale } from './view/scale';\nexport { Coordinate, registerCoordinate } from './view/coordinate';\nexport { parseFunctionType, invokeFunctionType } from './parse/util';\nexport { GrammarBase } from './view/grammar-base';\nexport * from './util/text';\nexport * from './types';\nexport { Factory } from './core/factory';\nexport {\n SIGNAL_AUTOFIT,\n SIGNAL_HEIGHT,\n SIGNAL_PADDING,\n SIGNAL_VIEW_HEIGHT,\n SIGNAL_VIEW_WIDTH,\n SIGNAL_WIDTH,\n SIGNAL_VIEW_BOX\n} from './view/constants';\nexport { registerViewEventsAPI } from './view/view-event-mixin';\nexport { registerViewMorphAPI } from './view/view-morph-mixin';\n\nexport { ThemeManager } from './theme/theme-manager';\n\nexport * from './glyph';\nexport * from './component';\nexport * from './transforms';\nexport * from './graph/animation/animation';\n\nexport { vglobal } from '@visactor/vrender-core';\nexport * from './env';\nexport * from './interactions';\nexport * from './semantic-marks/cell';\nexport * from './semantic-marks/interval';\nexport * from './graph/mark/graphic';\nexport { registerDefaultLayout, defaultDoLayout } from './graph/layout/layout';\nexport { registerGlyphMark, GlyphMark } from './view/glyph';\n\nimport { DragNDrop, Gesture } from '@visactor/vrender-kits';\nimport { Factory } from './core/factory';\n\nexport const registerDragPlugin = () => {\n Factory.registerStageEventPlugin('drag', DragNDrop);\n};\n\nexport const registerGesturePlugin = () => {\n Factory.registerStageEventPlugin('gesture', Gesture);\n};\n\nimport { registerViewAnimateAPI } from './view/view-animate-mixin';\nimport { registerMarkAnimateAPI } from './view/mark-animate-mixin';\n\nexport const registerAnimate = () => {\n registerViewAnimateAPI();\n registerMarkAnimateAPI();\n};\n"]}
|
|
@@ -15,7 +15,7 @@ class MarkAnimateMixin {
|
|
|
15
15
|
this.animate = mark.animate, this.animate.mark = this;
|
|
16
16
|
}
|
|
17
17
|
updateAnimate(spec) {
|
|
18
|
-
|
|
18
|
+
this.animate.updateConfig(spec.animation), this.animate.updateState(spec.animationState);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/view/mark-animate-mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAGrD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,gBAAgB;IAAtB;QACE,YAAO,GAAa,IAAI,OAAO,CAAC,IAAwB,EAAE,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/view/mark-animate-mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAGrD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,gBAAgB;IAAtB;QACE,YAAO,GAAa,IAAI,OAAO,CAAC,IAAwB,EAAE,EAAE,CAAC,CAAC;IAoBhE,CAAC;IAlBC,WAAW,CAAC,IAAc;QACxB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,IAAwB,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YACrE,IAAK,IAAY,CAAC,WAAW,EAAE,EAAE;gBAC/B,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;aAC/C;SACF;IACH,CAAC;IAED,YAAY,CAAC,IAAW;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAwB,CAAC;IAC/C,CAAC;IAED,aAAa,CAAC,IAAc;QAC1B,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAChD,CAAC;CACF;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,EAAE;IACzC,KAAK,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;AAChC,CAAC,CAAC","file":"mark-animate-mixin.js","sourcesContent":["import { mixin } from '@visactor/vutils';\nimport { Animate } from '../graph/animation/animate';\nimport type { IMark, MarkSpec } from '../types';\nimport type { IAnimate } from '../types/animate';\nimport { Mark } from './mark';\n\nclass MarkAnimateMixin {\n animate: IAnimate = new Animate(this as unknown as IMark, {});\n\n initAnimate(spec: MarkSpec) {\n if (!this.animate) {\n this.animate = new Animate(this as unknown as IMark, spec.animation);\n if ((this as any).needAnimate()) {\n this.animate.updateState(spec.animationState);\n }\n }\n }\n\n reuseAnimate(mark: IMark) {\n this.animate = mark.animate;\n this.animate.mark = this as unknown as IMark;\n }\n\n updateAnimate(spec: MarkSpec) {\n this.animate.updateConfig(spec.animation);\n this.animate.updateState(spec.animationState);\n }\n}\n\nexport const registerMarkAnimateAPI = () => {\n mixin(Mark, MarkAnimateMixin);\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visactor/vgrammar-core",
|
|
3
|
-
"version": "0.15.0
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "VGrammar is a visual grammar library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"grammar",
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
"dist"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@visactor/vutils": "~0.19.
|
|
28
|
-
"@visactor/vdataset": "~0.19.
|
|
29
|
-
"@visactor/vgrammar-coordinate": "0.15.0
|
|
30
|
-
"@visactor/vgrammar-util": "0.15.0
|
|
31
|
-
"@visactor/vscale": "~0.19.
|
|
32
|
-
"@visactor/vrender-core": "0.21.
|
|
33
|
-
"@visactor/vrender-kits": "0.21.
|
|
34
|
-
"@visactor/vrender-components": "0.21.
|
|
27
|
+
"@visactor/vutils": "~0.19.2",
|
|
28
|
+
"@visactor/vdataset": "~0.19.2",
|
|
29
|
+
"@visactor/vgrammar-coordinate": "0.15.0",
|
|
30
|
+
"@visactor/vgrammar-util": "0.15.0",
|
|
31
|
+
"@visactor/vscale": "~0.19.2",
|
|
32
|
+
"@visactor/vrender-core": "0.21.1",
|
|
33
|
+
"@visactor/vrender-kits": "0.21.1",
|
|
34
|
+
"@visactor/vrender-components": "0.21.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@rushstack/eslint-patch": "~1.1.4",
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"ts-jest": "~29.1.0",
|
|
45
45
|
"@types/jest": "~29.5.0",
|
|
46
46
|
"typescript": "4.9.5",
|
|
47
|
+
"@internal/bundler": "0.0.1",
|
|
47
48
|
"@internal/eslint-config": "0.0.1",
|
|
48
49
|
"@internal/jest-config": "0.0.1",
|
|
49
|
-
"@internal/bundler": "0.0.1",
|
|
50
50
|
"@internal/ts-config": "0.0.1"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|