@visactor/vrender 0.15.0-alpha.2 → 0.15.0-alpha.4
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/animate/animate.d.ts +1 -0
- package/cjs/animate/animate.js +3 -0
- package/cjs/animate/animate.js.map +1 -1
- package/cjs/animate/default-ticker.js +1 -1
- package/cjs/animate/default-ticker.js.map +1 -1
- package/cjs/animate/timeline.d.ts +1 -1
- package/cjs/animate/timeline.js +2 -2
- package/cjs/animate/timeline.js.map +1 -1
- package/cjs/canvas/contributions/browser/context.d.ts +1 -0
- package/cjs/common/enums.d.ts +4 -2
- package/cjs/common/enums.js +3 -2
- package/cjs/common/enums.js.map +1 -1
- package/cjs/core/contributions/window/base-contribution.d.ts +2 -0
- package/cjs/core/contributions/window/base-contribution.js +4 -0
- package/cjs/core/contributions/window/base-contribution.js.map +1 -1
- package/cjs/core/contributions/window/browser-contribution.d.ts +7 -0
- package/cjs/core/contributions/window/browser-contribution.js +26 -2
- package/cjs/core/contributions/window/browser-contribution.js.map +1 -1
- package/cjs/core/stage.d.ts +6 -1
- package/cjs/core/stage.js +24 -9
- package/cjs/core/stage.js.map +1 -1
- package/cjs/core/window.d.ts +2 -0
- package/cjs/core/window.js +6 -0
- package/cjs/core/window.js.map +1 -1
- package/cjs/event/event-manager.js +6 -4
- package/cjs/event/event-manager.js.map +1 -1
- package/cjs/graphic/arc.d.ts +7 -0
- package/cjs/graphic/arc.js +3 -1
- package/cjs/graphic/arc.js.map +1 -1
- package/cjs/graphic/config.js +4 -2
- package/cjs/graphic/config.js.map +1 -1
- package/cjs/graphic/graphic.d.ts +3 -0
- package/cjs/graphic/graphic.js +34 -17
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/graphic/group.js +1 -1
- package/cjs/graphic/group.js.map +1 -1
- package/cjs/graphic/text.js +21 -12
- package/cjs/graphic/text.js.map +1 -1
- package/cjs/graphic/wrap-text.js +14 -8
- package/cjs/graphic/wrap-text.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/interface/animate.d.ts +3 -1
- package/cjs/interface/animate.js.map +1 -1
- package/cjs/interface/graphic/arc.d.ts +2 -0
- package/cjs/interface/graphic/arc.js.map +1 -1
- package/cjs/interface/graphic/image.d.ts +1 -0
- package/cjs/interface/graphic/image.js.map +1 -1
- package/cjs/interface/graphic/text.d.ts +1 -0
- package/cjs/interface/graphic/text.js.map +1 -1
- package/cjs/interface/graphic.d.ts +12 -2
- package/cjs/interface/graphic.js.map +1 -1
- package/cjs/interface/stage.d.ts +6 -1
- package/cjs/interface/stage.js.map +1 -1
- package/cjs/interface/window.d.ts +4 -0
- package/cjs/interface/window.js.map +1 -1
- package/cjs/jsx/graphicType.d.ts +2 -3
- package/cjs/jsx/graphicType.js.map +1 -1
- package/cjs/jsx/jsx-classic.js +4 -3
- package/cjs/jsx/jsx-classic.js.map +1 -1
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.d.ts +2 -0
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +42 -21
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/cjs/render/contributions/render/arc-render.js +9 -2
- package/cjs/render/contributions/render/arc-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/arc-contribution-render.js +9 -7
- package/cjs/render/contributions/render/contributions/arc-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/circle-contribution-render.js +9 -7
- package/cjs/render/contributions/render/contributions/circle-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/image-contribution-render.js +23 -1
- package/cjs/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/rect-contribution-render.js +9 -7
- package/cjs/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/symbol-contribution-render.js +24 -22
- package/cjs/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/image-render.js +7 -3
- package/cjs/render/contributions/render/image-render.js.map +1 -1
- package/cjs/render/contributions/render/utils.d.ts +2 -2
- package/cjs/render/contributions/render/utils.js.map +1 -1
- package/dist/index.js +769 -673
- package/dist/index.min.js +1 -1
- package/es/animate/animate.d.ts +1 -0
- package/es/animate/animate.js +3 -0
- package/es/animate/animate.js.map +1 -1
- package/es/animate/default-ticker.js +1 -1
- package/es/animate/default-ticker.js.map +1 -1
- package/es/animate/timeline.d.ts +1 -1
- package/es/animate/timeline.js +2 -2
- package/es/animate/timeline.js.map +1 -1
- package/es/canvas/contributions/browser/context.d.ts +1 -0
- package/es/common/enums.d.ts +4 -2
- package/es/common/enums.js +3 -2
- package/es/common/enums.js.map +1 -1
- package/es/core/contributions/window/base-contribution.d.ts +2 -0
- package/es/core/contributions/window/base-contribution.js +4 -0
- package/es/core/contributions/window/base-contribution.js.map +1 -1
- package/es/core/contributions/window/browser-contribution.d.ts +7 -0
- package/es/core/contributions/window/browser-contribution.js +26 -2
- package/es/core/contributions/window/browser-contribution.js.map +1 -1
- package/es/core/stage.d.ts +6 -1
- package/es/core/stage.js +25 -8
- package/es/core/stage.js.map +1 -1
- package/es/core/window.d.ts +2 -0
- package/es/core/window.js +6 -0
- package/es/core/window.js.map +1 -1
- package/es/event/event-manager.js +6 -4
- package/es/event/event-manager.js.map +1 -1
- package/es/graphic/arc.d.ts +7 -0
- package/es/graphic/arc.js +3 -1
- package/es/graphic/arc.js.map +1 -1
- package/es/graphic/config.js +4 -2
- package/es/graphic/config.js.map +1 -1
- package/es/graphic/graphic.d.ts +3 -0
- package/es/graphic/graphic.js +35 -18
- package/es/graphic/graphic.js.map +1 -1
- package/es/graphic/group.js +1 -1
- package/es/graphic/group.js.map +1 -1
- package/es/graphic/text.js +21 -12
- package/es/graphic/text.js.map +1 -1
- package/es/graphic/wrap-text.js +14 -8
- package/es/graphic/wrap-text.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/interface/animate.d.ts +3 -1
- package/es/interface/animate.js.map +1 -1
- package/es/interface/graphic/arc.d.ts +2 -0
- package/es/interface/graphic/arc.js.map +1 -1
- package/es/interface/graphic/image.d.ts +1 -0
- package/es/interface/graphic/image.js.map +1 -1
- package/es/interface/graphic/text.d.ts +1 -0
- package/es/interface/graphic/text.js.map +1 -1
- package/es/interface/graphic.d.ts +12 -2
- package/es/interface/graphic.js.map +1 -1
- package/es/interface/stage.d.ts +6 -1
- package/es/interface/stage.js.map +1 -1
- package/es/interface/window.d.ts +4 -0
- package/es/interface/window.js.map +1 -1
- package/es/jsx/graphicType.d.ts +2 -3
- package/es/jsx/graphicType.js.map +1 -1
- package/es/jsx/jsx-classic.js +4 -3
- package/es/jsx/jsx-classic.js.map +1 -1
- package/es/plugins/builtin-plugin/flex-layout-plugin.d.ts +2 -0
- package/es/plugins/builtin-plugin/flex-layout-plugin.js +47 -20
- package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/es/render/contributions/render/arc-render.js +10 -3
- package/es/render/contributions/render/arc-render.js.map +1 -1
- package/es/render/contributions/render/contributions/arc-contribution-render.js +9 -7
- package/es/render/contributions/render/contributions/arc-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/circle-contribution-render.js +9 -7
- package/es/render/contributions/render/contributions/circle-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/image-contribution-render.js +27 -0
- package/es/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/rect-contribution-render.js +9 -7
- package/es/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/symbol-contribution-render.js +22 -20
- package/es/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
- package/es/render/contributions/render/image-render.js +10 -2
- package/es/render/contributions/render/image-render.js.map +1 -1
- package/es/render/contributions/render/utils.d.ts +2 -2
- package/es/render/contributions/render/utils.js.map +1 -1
- package/es/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/contributions/window/browser-contribution.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yCAA+C;AAC/C,mEAAsE;AACtE,yDAAsD;AACtD,2DAAoE;AAWpE,kDAA6C;AAGtC,IAAM,gCAAgC,GAAtC,MAAM,gCACX,SAAQ,iDAA6B;IAWrC,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC;IAChD,CAAC;IAED,YAA8C,MAAe;QAC3D,KAAK,EAAE,CAAC;QADoC,WAAM,GAAN,MAAM,CAAS;QAV7D,SAAI,GAAY,SAAS,CAAC;IAY1B,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;IAED,KAAK;QACH,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;YACjD,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;SACpD,CAAC;IACJ,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,qBAAqB,EAAE,CAAC;IAC1D,CAAC;IAED,YAAY,CAAC,MAAqB;QAEhC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YAClB,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;SACnC;aAAM;YACL,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;SACnC;IAGH,CAAC;IAYO,oBAAoB,CAAC,MAAqB;QAEhD,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;YAC5C,KA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gCAAgC,CAyO5C;AAzOY,4EAAgC","file":"browser-contribution.js","sourcesContent":["import { inject, injectable } from 'inversify';\nimport { BrowserCanvas } from '../../../canvas/contributions/browser';\nimport { Generator } from '../../../common/generator';\nimport { BaseWindowHandlerContribution } from './base-contribution';\nimport type {\n IContext2d,\n ICanvas,\n IDomRectLike,\n EnvType,\n IGlobal,\n IWindowHandlerContribution,\n IWindowParams\n} from '../../../interface';\nimport type { IBoundsLike } from '@visactor/vutils';\nimport { VGlobal } from '../../../constants';\n\n@injectable()\nexport class BrowserWindowHandlerContribution\n extends BaseWindowHandlerContribution\n implements IWindowHandlerContribution\n{\n static env: EnvType = 'browser';\n\n type: EnvType = 'browser';\n\n canvas: ICanvas;\n\n observer?: MutationObserver;\n\n get container(): HTMLElement | null {\n return this.canvas.nativeCanvas.parentElement;\n }\n\n constructor(@inject(VGlobal) private readonly global: IGlobal) {\n super();\n }\n\n getTitle(): string {\n return this.canvas.id.toString();\n }\n\n getWH(): { width: number; height: number } {\n return {\n width: this.canvas.width / (this.canvas.dpr || 1),\n height: this.canvas.height / (this.canvas.dpr || 1)\n };\n }\n\n getXY(): { x: number; y: number } {\n return this.canvas.nativeCanvas.getBoundingClientRect();\n }\n\n createWindow(params: IWindowParams): void {\n // 如果没有传入canvas,那么就创建一个canvas\n if (!params.canvas) {\n this.createWindowByConfig(params);\n } else {\n this.createWindowByCanvas(params);\n }\n\n // this.bindOnChangeEvent();\n }\n\n // private bindOnChangeEvent() {\n // const { nativeCanvas } = this.canvas;\n // const observer = new MutationObserver((mutations, observer) => {\n // mutations.forEach((mutaion) => {\n // console.log(mutaion);\n // })\n // });\n // observer.observe(nativeCanvas, { attributes: true, childList: true, subtree: true })\n // }\n\n private createWindowByConfig(params: IWindowParams) {\n // 创建canvas\n const nativeCanvas = this.global.createCanvas({\n width: params.width,\n height: params.height\n });\n // 保存到dom中\n let container: HTMLElement | null;\n if (typeof params.container === 'string') {\n container = this.global.getElementById(params.container);\n } else if (params.container) {\n container = params.container;\n } else {\n container = this.global.getRootElement();\n }\n if (!container) {\n throw new Error('发生错误,containerId可能传入有误');\n }\n\n if (!params.offscreen) {\n container.appendChild(nativeCanvas);\n } else {\n container = null;\n }\n\n // 绑定\n const options = {\n width: params.width,\n height: params.height,\n dpr: params.dpr,\n nativeCanvas,\n container,\n id: Generator.GenAutoIncrementId().toString(),\n canvasControled: true\n };\n this.canvas = new BrowserCanvas(options);\n // 应用位置属性\n // window上的不需要设置position\n // this.canvas.applyPosition();\n // this.canvas.resetStyle(options);\n }\n private createWindowByCanvas(params: IWindowParams) {\n // 获取canvas\n let canvas: HTMLCanvasElement | null;\n if (typeof params.canvas === 'string') {\n canvas = this.global.getElementById(params.canvas) as HTMLCanvasElement | null;\n if (!canvas) {\n throw new Error('canvasId 参数不正确,请确认canvas存在并插入dom');\n }\n } else {\n canvas = params!.canvas as HTMLCanvasElement | null;\n }\n if (!canvas) {\n throw new Error('发生错误,传入的canvas不正确');\n }\n\n // 如果没有传入wh,或者是不受控制的canvas,那就用canvas的原始wh\n let width = params.width;\n let height = params.height;\n if (width == null || height == null || !params.canvasControled) {\n const data = canvas.getBoundingClientRect();\n width = data.width;\n height = data.height;\n }\n // 如果没有dpr,就使用canvas的原始dpr\n let dpr = params.dpr;\n if (params.canvasControled === false) {\n if (dpr) {\n console.warn('canvasControled为false后,dpr参数将无效');\n }\n dpr = null;\n }\n if (dpr == null) {\n const ctx = canvas.getContext('2d');\n // 兼容XTable\n dpr = (ctx as any).pixelRatio ?? canvas.width / width;\n }\n this.canvas = new BrowserCanvas({\n width: width,\n height: height,\n dpr: dpr,\n nativeCanvas: canvas,\n canvasControled: params.canvasControled\n });\n // if (params.canvasControled) {\n // this.canvas.resetStyle({\n // width,\n // height,\n // dpr\n // });\n // }\n }\n releaseWindow(): void {\n this.canvas.release();\n }\n resizeWindow(width: number, height: number): void {\n this.canvas.resize(width, height);\n }\n setDpr(dpr: number): void {\n this.canvas.dpr = dpr;\n }\n\n getContext(): IContext2d {\n return this.canvas.getContext();\n }\n getNativeHandler(): ICanvas {\n return this.canvas;\n }\n getDpr(): number {\n return this.canvas.dpr;\n }\n\n addEventListener<K extends keyof DocumentEventMap>(\n type: K,\n listener: (this: Document, ev: DocumentEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions\n ): void;\n addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions\n ): void {\n return (this.canvas.nativeCanvas as HTMLCanvasElement).addEventListener(type, listener, options);\n }\n removeEventListener<K extends keyof DocumentEventMap>(\n type: K,\n listener: (this: Document, ev: DocumentEventMap[K]) => any,\n options?: boolean | EventListenerOptions\n ): void;\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions\n ): void {\n return (this.canvas.nativeCanvas as HTMLCanvasElement).removeEventListener(type, listener, options);\n }\n dispatchEvent(event: any): boolean {\n return (this.canvas.nativeCanvas as HTMLCanvasElement).dispatchEvent(event);\n }\n\n getStyle(): CSSStyleDeclaration | Record<string, any> {\n return this.canvas.nativeCanvas.style;\n }\n setStyle(style: CSSStyleDeclaration | Record<string, any>) {\n this.canvas.nativeCanvas.style = style;\n }\n\n getBoundingClientRect(): IDomRectLike {\n const c = this.canvas.nativeCanvas as HTMLCanvasElement;\n const wh = this.getWH();\n if (!c.parentElement) {\n return {\n x: 0,\n y: 0,\n width: wh.width,\n height: wh.height,\n left: 0,\n top: 0,\n right: 0,\n bottom: 0\n };\n }\n return this.canvas.nativeCanvas.getBoundingClientRect();\n }\n\n clearViewBox(vb: IBoundsLike, color?: string): void {\n const context = this.getContext();\n const dpr = this.getDpr();\n context.nativeContext.save();\n (context.nativeContext as CanvasRenderingContext2D).setTransform(dpr, 0, 0, dpr, 0, 0);\n context.clearRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1);\n if (color) {\n context.fillStyle = color;\n context.fillRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1);\n }\n context.nativeContext.restore();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/core/contributions/window/browser-contribution.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yCAA+C;AAC/C,mEAAsE;AACtE,yDAAsD;AACtD,2DAAoE;AAWpE,kDAA6C;AAGtC,IAAM,gCAAgC,GAAtC,MAAM,gCACX,SAAQ,iDAA6B;IAcrC,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC;IAChD,CAAC;IAED,YAA8C,MAAe;QAC3D,KAAK,EAAE,CAAC;QADoC,WAAM,GAAN,MAAM,CAAS;QAb7D,SAAI,GAAY,SAAS,CAAC;QAexB,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;IACpC,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;IAED,KAAK;QACH,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;YACjD,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;SACpD,CAAC;IACJ,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,qBAAqB,EAAE,CAAC;IAC1D,CAAC;IAED,YAAY,CAAC,MAAqB;QAEhC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YAClB,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;SACnC;aAAM;YACL,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;SACnC;QAED,IAAI,CAAC,QAAQ,EAAE,CAAC;IAGlB,CAAC;IAES,QAAQ;QAChB,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;I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I,CAAC,kBAAkB,GAAG,EAAE,CAAC;IAC/B,CAAC;;AApRM,oCAAG,GAAY,SAAS,CAAC;AAJrB,gCAAgC;IAD5C,IAAA,sBAAU,GAAE;IAoBE,WAAA,IAAA,kBAAM,EAAC,mBAAO,CAAC,CAAA;;GAnBjB,gCAAgC,CAyR5C;AAzRY,4EAAgC","file":"browser-contribution.js","sourcesContent":["import { inject, injectable } from 'inversify';\nimport { BrowserCanvas } from '../../../canvas/contributions/browser';\nimport { Generator } from '../../../common/generator';\nimport { BaseWindowHandlerContribution } from './base-contribution';\nimport type {\n IContext2d,\n ICanvas,\n IDomRectLike,\n EnvType,\n IGlobal,\n IWindowHandlerContribution,\n IWindowParams\n} from '../../../interface';\nimport type { IBoundsLike } from '@visactor/vutils';\nimport { VGlobal } from '../../../constants';\n\n@injectable()\nexport class BrowserWindowHandlerContribution\n extends BaseWindowHandlerContribution\n implements IWindowHandlerContribution\n{\n static env: EnvType = 'browser';\n\n type: EnvType = 'browser';\n\n canvas: ICanvas;\n\n observer?: MutationObserver;\n\n protected _canvasIsIntersecting: boolean;\n protected _onVisibleChangeCb: (currentVisible: boolean) => void;\n\n get container(): HTMLElement | null {\n return this.canvas.nativeCanvas.parentElement;\n }\n\n constructor(@inject(VGlobal) private readonly global: IGlobal) {\n super();\n this._canvasIsIntersecting = true;\n }\n\n getTitle(): string {\n return this.canvas.id.toString();\n }\n\n getWH(): { width: number; height: number } {\n return {\n width: this.canvas.width / (this.canvas.dpr || 1),\n height: this.canvas.height / (this.canvas.dpr || 1)\n };\n }\n\n getXY(): { x: number; y: number } {\n return this.canvas.nativeCanvas.getBoundingClientRect();\n }\n\n createWindow(params: IWindowParams): void {\n // 如果没有传入canvas,那么就创建一个canvas\n if (!params.canvas) {\n this.createWindowByConfig(params);\n } else {\n this.createWindowByCanvas(params);\n }\n\n this.postInit();\n\n // this.bindOnChangeEvent();\n }\n\n protected postInit() {\n this.observerCanvas();\n }\n\n isElementVisible(el: HTMLElement) {\n const rect = el.getBoundingClientRect();\n const vWidth = window.innerWidth || document.documentElement.clientWidth;\n const vHeight = window.innerHeight || document.documentElement.clientHeight;\n\n if (rect.right < 0 || rect.bottom < 0 || rect.left > vWidth || rect.top > vHeight) {\n return false;\n }\n\n return true;\n }\n\n protected observerCanvas() {\n this._canvasIsIntersecting = this.isElementVisible(this.canvas.nativeCanvas);\n const observer = new IntersectionObserver((entries, observer) => {\n entries.forEach(entry => {\n if (this._canvasIsIntersecting !== entry.isIntersecting) {\n this._canvasIsIntersecting = entry.isIntersecting;\n this._onVisibleChangeCb(entry.isIntersecting);\n } else {\n this._canvasIsIntersecting = entry.isIntersecting;\n }\n });\n });\n if (!observer) {\n return;\n }\n observer.observe(this.canvas.nativeCanvas);\n }\n\n // private bindOnChangeEvent() {\n // const { nativeCanvas } = this.canvas;\n // const observer = new MutationObserver((mutations, observer) => {\n // mutations.forEach((mutaion) => {\n // console.log(mutaion);\n // })\n // });\n // observer.observe(nativeCanvas, { attributes: true, childList: true, subtree: true })\n // }\n\n private createWindowByConfig(params: IWindowParams) {\n // 创建canvas\n const nativeCanvas = this.global.createCanvas({\n width: params.width,\n height: params.height\n });\n // 保存到dom中\n let container: HTMLElement | null;\n if (typeof params.container === 'string') {\n container = this.global.getElementById(params.container);\n } else if (params.container) {\n container = params.container;\n } else {\n container = this.global.getRootElement();\n }\n if (!container) {\n throw new Error('发生错误,containerId可能传入有误');\n }\n\n if (!params.offscreen) {\n container.appendChild(nativeCanvas);\n } else {\n container = null;\n }\n\n // 绑定\n const options = {\n width: params.width,\n height: params.height,\n dpr: params.dpr,\n nativeCanvas,\n container,\n id: Generator.GenAutoIncrementId().toString(),\n canvasControled: true\n };\n this.canvas = new BrowserCanvas(options);\n // 应用位置属性\n // window上的不需要设置position\n // this.canvas.applyPosition();\n // this.canvas.resetStyle(options);\n }\n private createWindowByCanvas(params: IWindowParams) {\n // 获取canvas\n let canvas: HTMLCanvasElement | null;\n if (typeof params.canvas === 'string') {\n canvas = this.global.getElementById(params.canvas) as HTMLCanvasElement | null;\n if (!canvas) {\n throw new Error('canvasId 参数不正确,请确认canvas存在并插入dom');\n }\n } else {\n canvas = params!.canvas as HTMLCanvasElement | null;\n }\n if (!canvas) {\n throw new Error('发生错误,传入的canvas不正确');\n }\n\n // 如果没有传入wh,或者是不受控制的canvas,那就用canvas的原始wh\n let width = params.width;\n let height = params.height;\n if (width == null || height == null || !params.canvasControled) {\n const data = canvas.getBoundingClientRect();\n width = data.width;\n height = data.height;\n }\n // 如果没有dpr,就使用canvas的原始dpr\n let dpr = params.dpr;\n if (params.canvasControled === false) {\n if (dpr) {\n console.warn('canvasControled为false后,dpr参数将无效');\n }\n dpr = null;\n }\n if (dpr == null) {\n const ctx = canvas.getContext('2d');\n // 兼容XTable\n dpr = (ctx as any).pixelRatio ?? canvas.width / width;\n }\n this.canvas = new BrowserCanvas({\n width: width,\n height: height,\n dpr: dpr,\n nativeCanvas: canvas,\n canvasControled: params.canvasControled\n });\n // if (params.canvasControled) {\n // this.canvas.resetStyle({\n // width,\n // height,\n // dpr\n // });\n // }\n }\n releaseWindow(): void {\n this.canvas.release();\n }\n resizeWindow(width: number, height: number): void {\n this.canvas.resize(width, height);\n }\n setDpr(dpr: number): void {\n this.canvas.dpr = dpr;\n }\n\n getContext(): IContext2d {\n return this.canvas.getContext();\n }\n getNativeHandler(): ICanvas {\n return this.canvas;\n }\n getDpr(): number {\n return this.canvas.dpr;\n }\n\n addEventListener<K extends keyof DocumentEventMap>(\n type: K,\n listener: (this: Document, ev: DocumentEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions\n ): void;\n addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions\n ): void {\n return (this.canvas.nativeCanvas as HTMLCanvasElement).addEventListener(type, listener, options);\n }\n removeEventListener<K extends keyof DocumentEventMap>(\n type: K,\n listener: (this: Document, ev: DocumentEventMap[K]) => any,\n options?: boolean | EventListenerOptions\n ): void;\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions\n ): void {\n return (this.canvas.nativeCanvas as HTMLCanvasElement).removeEventListener(type, listener, options);\n }\n dispatchEvent(event: any): boolean {\n return (this.canvas.nativeCanvas as HTMLCanvasElement).dispatchEvent(event);\n }\n\n getStyle(): CSSStyleDeclaration | Record<string, any> {\n return this.canvas.nativeCanvas.style;\n }\n setStyle(style: CSSStyleDeclaration | Record<string, any>) {\n this.canvas.nativeCanvas.style = style;\n }\n\n getBoundingClientRect(): IDomRectLike {\n const c = this.canvas.nativeCanvas as HTMLCanvasElement;\n const wh = this.getWH();\n if (!c.parentElement) {\n return {\n x: 0,\n y: 0,\n width: wh.width,\n height: wh.height,\n left: 0,\n top: 0,\n right: 0,\n bottom: 0\n };\n }\n return this.canvas.nativeCanvas.getBoundingClientRect();\n }\n\n clearViewBox(vb: IBoundsLike, color?: string): void {\n const context = this.getContext();\n const dpr = this.getDpr();\n context.nativeContext.save();\n (context.nativeContext as CanvasRenderingContext2D).setTransform(dpr, 0, 0, dpr, 0, 0);\n context.clearRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1);\n if (color) {\n context.fillStyle = color;\n context.fillRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1);\n }\n context.nativeContext.restore();\n }\n\n isVisible(bbox?: IBoundsLike) {\n return this._canvasIsIntersecting;\n }\n\n onVisibleChange(cb: (currentVisible: boolean) => void) {\n this._onVisibleChangeCb = cb;\n }\n}\n"]}
|
package/cjs/core/stage.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IAABBBounds, IBounds, IBoundsLike, IMatrix } from '@visactor/vutils';
|
|
2
2
|
import { AABBBounds } from '@visactor/vutils';
|
|
3
|
-
import type { IGraphic, IGroup, IExportType, IStage, IStageParams, ILayer, IColor, IOption3D, ICamera, vec3, IDirectionLight, ITicker, IRenderService, IPickerService, IPluginService, ISyncHook, IDrawContext, IWindow, ILayerService } from '../interface';
|
|
3
|
+
import type { IGraphic, IGroup, IExportType, IStage, IStageParams, ILayer, IColor, IOption3D, ICamera, vec3, IDirectionLight, ITicker, IRenderService, IPickerService, IPluginService, ISyncHook, IDrawContext, IWindow, ILayerService, ITimeline, IOptimizeType } from '../interface';
|
|
4
4
|
import type { Layer } from './layer';
|
|
5
5
|
import { Group } from '../graphic';
|
|
6
6
|
export declare class Stage extends Group implements IStage {
|
|
@@ -55,12 +55,17 @@ export declare class Stage extends Group implements IStage {
|
|
|
55
55
|
private readonly eventSystem?;
|
|
56
56
|
protected _beforeRender?: (stage: IStage) => void;
|
|
57
57
|
protected _afterRender?: (stage: IStage) => void;
|
|
58
|
+
protected _skipRender?: number;
|
|
58
59
|
protected _afterNextRenderCbs?: ((stage: IStage) => void)[];
|
|
59
60
|
protected lastRenderparams?: Partial<IDrawContext>;
|
|
60
61
|
protected interactiveLayer?: ILayer;
|
|
61
62
|
protected supportInteractiveLayer: boolean;
|
|
63
|
+
protected timeline: ITimeline;
|
|
62
64
|
params: Partial<IStageParams>;
|
|
63
65
|
constructor(params: Partial<IStageParams>);
|
|
66
|
+
optmize(params?: IOptimizeType): void;
|
|
67
|
+
protected optmizeRender(skipRenderWithOutRange?: boolean): void;
|
|
68
|
+
getTimeline(): ITimeline;
|
|
64
69
|
get3dOptions(options: IOption3D): {
|
|
65
70
|
center: {
|
|
66
71
|
x?: number;
|
package/cjs/core/stage.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.Stage = void 0;
|
|
6
6
|
|
|
7
|
-
const vutils_1 = require("@visactor/vutils"), window_1 = require("./window"), event_1 = require("../event"), container_1 = require("../container"), render_1 = require("../render"), graphic_1 = require("../graphic"), picker_service_1 = require("../picker/picker-service"), constants_1 = require("../plugins/constants"), auto_render_plugin_1 = require("../plugins/builtin-plugin/auto-render-plugin"), _3dview_transform_plugin_1 = require("../plugins/builtin-plugin/3dview-transform-plugin"), incremental_auto_render_plugin_1 = require("../plugins/builtin-plugin/incremental-auto-render-plugin"), html_attribute_plugin_1 = require("../plugins/builtin-plugin/html-attribute-plugin"), dirty_bounds_plugin_1 = require("../plugins/builtin-plugin/dirty-bounds-plugin"), flex_layout_plugin_1 = require("../plugins/builtin-plugin/flex-layout-plugin"), default_ticker_1 = require("../animate/default-ticker"), tapable_1 = require("../tapable"), light_1 = require("./light"), camera_1 = require("./camera"), constants_2 = require("../constants"), constants_3 = require("./constants"), DefaultConfig = {
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), window_1 = require("./window"), event_1 = require("../event"), container_1 = require("../container"), render_1 = require("../render"), graphic_1 = require("../graphic"), picker_service_1 = require("../picker/picker-service"), constants_1 = require("../plugins/constants"), auto_render_plugin_1 = require("../plugins/builtin-plugin/auto-render-plugin"), _3dview_transform_plugin_1 = require("../plugins/builtin-plugin/3dview-transform-plugin"), incremental_auto_render_plugin_1 = require("../plugins/builtin-plugin/incremental-auto-render-plugin"), html_attribute_plugin_1 = require("../plugins/builtin-plugin/html-attribute-plugin"), dirty_bounds_plugin_1 = require("../plugins/builtin-plugin/dirty-bounds-plugin"), flex_layout_plugin_1 = require("../plugins/builtin-plugin/flex-layout-plugin"), default_ticker_1 = require("../animate/default-ticker"), tapable_1 = require("../tapable"), light_1 = require("./light"), camera_1 = require("./camera"), constants_2 = require("../constants"), constants_3 = require("./constants"), animate_1 = require("../animate"), DefaultConfig = {
|
|
8
8
|
WIDTH: 500,
|
|
9
9
|
HEIGHT: 500,
|
|
10
10
|
X: 0,
|
|
@@ -123,7 +123,20 @@ class Stage extends graphic_1.Group {
|
|
|
123
123
|
params.enableLayout && this.enableLayout(), this.hooks.beforeRender.tap("constructor", this.beforeRender),
|
|
124
124
|
this.hooks.afterRender.tap("constructor", this.afterRender), this._beforeRender = params.beforeRender,
|
|
125
125
|
this._afterRender = params.afterRender, this.ticker = params.ticker || default_ticker_1.defaultTicker,
|
|
126
|
-
this.supportInteractiveLayer = !1 !== params.interactiveLayer
|
|
126
|
+
this.supportInteractiveLayer = !1 !== params.interactiveLayer, this.timeline = new animate_1.DefaultTimeline,
|
|
127
|
+
this.ticker.addTimeline(this.timeline), this.timeline.pause(), this.optmize(params.optimize);
|
|
128
|
+
}
|
|
129
|
+
optmize(params) {
|
|
130
|
+
this.optmizeRender(null == params ? void 0 : params.skipRenderWithOutRange);
|
|
131
|
+
}
|
|
132
|
+
optmizeRender(skipRenderWithOutRange = !0) {
|
|
133
|
+
skipRenderWithOutRange && (this._skipRender = this.window.isVisible() ? 0 : 1, this.window.onVisibleChange((visible => {
|
|
134
|
+
visible ? (this.dirtyBounds && this.dirtyBounds.setValue(0, 0, this._viewBox.width(), this._viewBox.height()),
|
|
135
|
+
this._skipRender > 1 && this.renderNextFrame(), this._skipRender = 0) : this._skipRender = 1;
|
|
136
|
+
})));
|
|
137
|
+
}
|
|
138
|
+
getTimeline() {
|
|
139
|
+
return this.timeline;
|
|
127
140
|
}
|
|
128
141
|
get3dOptions(options) {
|
|
129
142
|
const {center: center = {
|
|
@@ -260,8 +273,8 @@ class Stage extends graphic_1.Group {
|
|
|
260
273
|
this.window.clearViewBox(this._viewBox, color);
|
|
261
274
|
}
|
|
262
275
|
render(layers, params) {
|
|
263
|
-
this.ticker.start(), this.
|
|
264
|
-
(layers || this).forEach(((layer, i) => {
|
|
276
|
+
this.ticker.start(), this.timeline.resume(), this._skipRender || (this.lastRenderparams = params,
|
|
277
|
+
this.hooks.beforeRender.call(this), (layers || this).forEach(((layer, i) => {
|
|
265
278
|
layer.render({
|
|
266
279
|
renderService: this.renderService,
|
|
267
280
|
background: layer === this.defaultLayer ? this.background : void 0,
|
|
@@ -269,7 +282,8 @@ class Stage extends graphic_1.Group {
|
|
|
269
282
|
}, Object.assign({
|
|
270
283
|
renderStyle: this.renderStyle
|
|
271
284
|
}, params));
|
|
272
|
-
})), this.combineLayersToWindow(), this.nextFrameRenderLayerSet.clear(), this.hooks.afterRender.call(this)
|
|
285
|
+
})), this.combineLayersToWindow(), this.nextFrameRenderLayerSet.clear(), this.hooks.afterRender.call(this)),
|
|
286
|
+
this._skipRender && this._skipRender++;
|
|
273
287
|
}
|
|
274
288
|
combineLayersToWindow() {
|
|
275
289
|
this.forEach(((layer, i) => {
|
|
@@ -293,7 +307,7 @@ class Stage extends graphic_1.Group {
|
|
|
293
307
|
})));
|
|
294
308
|
}
|
|
295
309
|
_doRenderInThisFrame() {
|
|
296
|
-
this.
|
|
310
|
+
this.timeline.resume(), this.ticker.start(), this.nextFrameRenderLayerSet.size && !this._skipRender && (this.hooks.beforeRender.call(this),
|
|
297
311
|
this.forEach((layer => {
|
|
298
312
|
this.nextFrameRenderLayerSet.has(layer) && layer.render({
|
|
299
313
|
renderService: this.renderService,
|
|
@@ -302,7 +316,8 @@ class Stage extends graphic_1.Group {
|
|
|
302
316
|
}, Object.assign({
|
|
303
317
|
renderStyle: this.renderStyle
|
|
304
318
|
}, this.lastRenderparams || {}));
|
|
305
|
-
})), this.combineLayersToWindow(), this.hooks.afterRender.call(this), this.nextFrameRenderLayerSet.clear())
|
|
319
|
+
})), this.combineLayersToWindow(), this.hooks.afterRender.call(this), this.nextFrameRenderLayerSet.clear()),
|
|
320
|
+
this._skipRender && this._skipRender++;
|
|
306
321
|
}
|
|
307
322
|
resizeWindow(w, h, rerender = !0) {
|
|
308
323
|
this.window.resize(w, h), rerender && this.render();
|
|
@@ -400,8 +415,8 @@ class Stage extends graphic_1.Group {
|
|
|
400
415
|
return this.renderTo(window, {
|
|
401
416
|
x: x,
|
|
402
417
|
y: y,
|
|
403
|
-
width: window.width,
|
|
404
|
-
height: window.height
|
|
418
|
+
width: viewBox ? viewBox.x2 : window.width,
|
|
419
|
+
height: viewBox ? viewBox.y2 : window.height
|
|
405
420
|
}), window;
|
|
406
421
|
}
|
|
407
422
|
toCanvas(fullImage = !0, viewBox) {
|
package/cjs/core/stage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
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AgB,EAAE,CAAC;QACpC,IAAI,CAAC,CAAC,YAAY,EAAE;YAClB,OAAO,CAAC,CAAC,YAAY,CAAC;SACvB;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,CAAC,IAAa;QACrB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AAhvBD,sBAgvBC","file":"stage.js","sourcesContent":["import type { IAABBBounds, IBounds, IBoundsLike, IMatrix } from '@visactor/vutils';\nimport { AABBBounds, Bounds, Point } from '@visactor/vutils';\nimport type {\n IGraphic,\n IGroup,\n IExportType,\n IStage,\n IStageParams,\n ILayer,\n IColor,\n IGlobal,\n IOption3D,\n ICamera,\n vec3,\n IDirectionLight,\n ITicker,\n IRenderService,\n IPickerService,\n IPluginService,\n ISyncHook,\n IDrawContext,\n IWindow,\n IPlugin,\n IContributionProvider,\n ILayerService\n} from '../interface';\nimport { VWindow } from './window';\nimport type { Layer } from './layer';\nimport { EventSystem } from '../event';\nimport { container } from '../container';\nimport { RenderService } from '../render';\nimport { Group, Theme } from '../graphic';\nimport { PickerService } from '../picker/picker-service';\nimport { PluginService } from '../plugins/constants';\nimport { AutoRenderPlugin } from '../plugins/builtin-plugin/auto-render-plugin';\nimport { ViewTransform3dPlugin } from '../plugins/builtin-plugin/3dview-transform-plugin';\nimport { IncrementalAutoRenderPlugin } from '../plugins/builtin-plugin/incremental-auto-render-plugin';\nimport { HtmlAttributePlugin } from '../plugins/builtin-plugin/html-attribute-plugin';\nimport { DirtyBoundsPlugin } from '../plugins/builtin-plugin/dirty-bounds-plugin';\nimport { FlexLayoutPlugin } from '../plugins/builtin-plugin/flex-layout-plugin';\nimport { defaultTicker } from '../animate/default-ticker';\nimport { SyncHook } from '../tapable';\nimport { DirectionalLight } from './light';\nimport { OrthoCamera } from './camera';\nimport { VGlobal } from '../constants';\nimport { LayerService } from './constants';\n\nconst DefaultConfig = {\n WIDTH: 500,\n HEIGHT: 500,\n X: 0,\n Y: 0,\n BACKGROUND: 'white'\n};\n\n/**\n * Stage是一个舞台或一个视口,并不直接对应一个或多个Canvas,逻辑上和Canvas无关\n *\n * 1. Stage对应一个Canvas的整体,Stage的宽高即为Canvas的宽高\n * 2. Stage小于Canvas,Stage作为Canvas某个区域的视口,只管理这个区域\n * 3. 多图层时Stage的多个图层对应多个Canvas\n *\n * 原生环境下Stage可以拥有一个Window或者使用Window的一块区域\n *\n * 【注】如果希望获取完整的Canvas或窗口或者调整窗口信息,请使用Window模块\n */\nexport class Stage extends Group implements IStage {\n declare parent: IStage | null;\n\n // protected _x: number;\n // protected _y: number;\n // // 窗口的宽高\n // private _width: number;\n // private _height: number;\n // 视口的宽高\n // private _viewWidth: number;\n // private _viewHeight: number;\n protected _viewBox: AABBBounds;\n private _background: string | IColor;\n private _subView: boolean; // 是否是存在子视图\n protected nextFrameRenderLayerSet: Set<Layer>;\n protected willNextFrameRender: boolean;\n protected _cursor: string;\n renderCount: number;\n dirtyBounds: IBounds | null;\n option3d?: IOption3D;\n declare light?: IDirectionLight;\n declare camera?: ICamera;\n declare renderStyle?: string;\n\n declare hooks: {\n beforeRender: ISyncHook<[IStage]>;\n afterRender: ISyncHook<[IStage]>;\n };\n\n set viewBox(b: IBoundsLike) {\n this._viewBox.setValue(b.x1, b.y1, b.x2, b.y2);\n }\n get viewBox(): AABBBounds {\n return this._viewBox;\n }\n\n get x(): number {\n return this._viewBox.x1;\n }\n set x(x: number) {\n this._viewBox.translate(x - this._viewBox.x1, 0);\n }\n get y(): number {\n return this._viewBox.y1;\n }\n set y(y: number) {\n this._viewBox.translate(0, y - this._viewBox.y1);\n }\n get width(): number {\n return this.window.width;\n }\n set width(w: number) {\n this.resize(w, this.height);\n }\n get viewWidth(): number {\n return this._viewBox.width();\n }\n set viewWidth(w: number) {\n this.resizeView(w, this.viewHeight);\n }\n get viewHeight(): number {\n return this._viewBox.height();\n }\n set viewHeight(h: number) {\n this.resizeView(this.viewWidth, h);\n }\n get height(): number {\n return this.window.height;\n }\n set height(h: number) {\n this.resize(this.width, h);\n }\n get dpr(): number {\n return this.window.dpr;\n }\n set dpr(r: number) {\n this.setDpr(r);\n }\n get background(): string | IColor {\n return this._background ?? DefaultConfig.BACKGROUND;\n }\n set background(b: string | IColor) {\n this._background = b;\n }\n get defaultLayer(): ILayer {\n return this.at(0) as unknown as ILayer;\n }\n\n ticker: ITicker;\n\n autoRender: boolean;\n _enableLayout: boolean;\n htmlAttribute: boolean | string | any;\n increaseAutoRender: boolean;\n view3dTranform: boolean;\n readonly window: IWindow;\n private readonly global: IGlobal;\n readonly renderService: IRenderService;\n readonly pickerService: IPickerService;\n readonly pluginService: IPluginService;\n readonly layerService: ILayerService;\n private readonly eventSystem?: EventSystem;\n\n protected _beforeRender?: (stage: IStage) => void;\n protected _afterRender?: (stage: IStage) => void;\n protected _afterNextRenderCbs?: ((stage: IStage) => void)[];\n protected lastRenderparams?: Partial<IDrawContext>;\n\n protected interactiveLayer?: ILayer;\n protected supportInteractiveLayer: boolean;\n\n declare params: Partial<IStageParams>;\n\n /**\n * 所有属性都具有默认值。\n * Canvas为字符串或者Canvas元素,那么默认图层就会绑定到这个Canvas上\n * 如果不传入Canvas,那么会新建一个Canvas,用户可以通过Window模块管理这个Canvas\n * 1. 如果没有传入宽高,那么默认为canvas宽高,如果传入了宽高则stage使用传入宽高作为视口宽高\n * @param params\n */\n constructor(params: Partial<IStageParams>) {\n super({});\n this.params = params;\n this.theme = new Theme();\n this.hooks = {\n beforeRender: new SyncHook(['stage']),\n afterRender: new SyncHook(['stage'])\n };\n this.global = container.get<IGlobal>(VGlobal);\n this.window = container.get<IWindow>(VWindow);\n this.renderService = container.get<IRenderService>(RenderService);\n this.pickerService = container.get<IPickerService>(PickerService);\n this.pluginService = container.get<IPluginService>(PluginService);\n this.layerService = container.get<ILayerService>(LayerService);\n this.pluginService.active(this, params);\n\n this.window.create({\n width: params.width,\n height: params.height,\n container: params.container,\n dpr: params.dpr || this.global.devicePixelRatio,\n canvasControled: params.canvasControled !== false,\n title: params.title || '',\n canvas: params.canvas\n });\n\n this._viewBox = new AABBBounds();\n if (params.viewBox) {\n this._viewBox.setValue(params.viewBox.x1, params.viewBox.y1, params.viewBox.x2, params.viewBox.y2);\n } else {\n this._viewBox.setValue(0, 0, this.width, this.height);\n }\n\n this.renderCount = 0;\n\n // // 没有传入xy就默认为0\n // this._x = params.x ?? DefaultConfig.X;\n // this._y = params.y ?? DefaultConfig.Y;\n // // 没有传入view的宽高则默认为window的宽高\n // this._viewWidth = params.viewWidth ?? this.window.width;\n // this._viewHeight = params.viewHeight ?? this.window.height;\n this._subView = !(this._viewBox.width() === this.width && this._viewBox.height() === this.height);\n // this._AABBBounds.set(this._x, this._y, this._viewWidth + this._x, this._viewHeight + this._y);\n // 背景色默认为纯白色\n this._background = params.background ?? DefaultConfig.BACKGROUND;\n\n // 创建一个默认layer图层\n // this.appendChild(new Layer(this, this.global, this.window, { main: true }));\n this.appendChild(this.layerService.createLayer(this, { main: true }));\n\n this.nextFrameRenderLayerSet = new Set();\n this.willNextFrameRender = false;\n this.stage = this;\n this.renderStyle = params.renderStyle;\n\n if (this.global.supportEvent) {\n this.eventSystem = new EventSystem({\n targetElement: this.window,\n resolution: this.window.dpr || this.global.devicePixelRatio,\n rootNode: this as any,\n global: this.global,\n viewport: {\n viewBox: this._viewBox,\n get x(): number {\n return this.viewBox.x1;\n },\n get y(): number {\n return this.viewBox.y1;\n },\n get width(): number {\n return this.viewBox.width();\n },\n get height(): number {\n return this.viewBox.height();\n }\n }\n });\n }\n\n // this.autoRender = params.autoRender;\n if (params.autoRender) {\n this.enableAutoRender();\n }\n // 默认不开启dirtyBounds\n if (params.disableDirtyBounds === false) {\n this.enableDirtyBounds();\n }\n\n if (params.enableHtmlAttribute) {\n this.enableHtmlAttribute(params.enableHtmlAttribute);\n }\n\n params.enableLayout && this.enableLayout();\n this.hooks.beforeRender.tap('constructor', this.beforeRender);\n this.hooks.afterRender.tap('constructor', this.afterRender);\n this._beforeRender = params.beforeRender;\n this._afterRender = params.afterRender;\n this.ticker = params.ticker || defaultTicker;\n this.supportInteractiveLayer = params.interactiveLayer !== false;\n }\n\n get3dOptions(options: IOption3D) {\n const {\n center = { x: this.width / 2, y: this.height / 2, z: 0, dx: 0, dy: 0, dz: 0 },\n light = {},\n alpha = 0,\n beta = 0,\n camera,\n fieldRatio = 1,\n fieldDepth\n } = options;\n\n return {\n ...options,\n center,\n light,\n alpha,\n beta,\n camera,\n fieldRatio,\n fieldDepth\n };\n }\n\n set3dOptions(options: IOption3D) {\n this.option3d = options;\n const options3d = this.get3dOptions(options);\n const { light, center, camera, alpha, beta, fieldRatio, fieldDepth } = options3d;\n const { dir = [1, 1, -1], color = 'white', ambient } = light;\n\n const centerX = (center.x ?? this.width / 2) + (center.dx ?? 0);\n const centerY = (center.y ?? this.height / 2) + (center.dy ?? 0);\n const centerZ = (center.z ?? 0) + (center.dz ?? 0);\n const centerVec3: vec3 = [centerX, centerY, centerZ];\n const z = 1;\n let cameraX = 0;\n let cameraY = 0;\n let cameraZ = 0;\n if (!camera) {\n cameraX = Math.sin(alpha) + centerX;\n cameraY = Math.sin(beta) + centerY;\n cameraZ = Math.cos(alpha) * Math.cos(beta) * z;\n }\n\n this.light = new DirectionalLight(dir, color, ambient);\n const cameraParams = {\n left: 0,\n right: this.width,\n top: 0,\n bottom: this.height,\n fieldRatio: fieldRatio,\n fieldDepth,\n viewParams: {\n pos: [cameraX, cameraY, cameraZ] as vec3,\n center: centerVec3,\n up: [0, 1, 0] as vec3\n }\n };\n if (this.camera) {\n this.camera.params = cameraParams;\n } else {\n this.camera = new OrthoCamera(cameraParams);\n }\n\n if (options.enableView3dTransform) {\n this.enableView3dTransform();\n }\n }\n\n protected beforeRender = (stage: IStage) => {\n this._beforeRender && this._beforeRender(stage);\n };\n\n protected afterRender = (stage: IStage) => {\n this.renderCount++;\n this._afterRender && this._afterRender(stage);\n this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage));\n this._afterNextRenderCbs = null;\n };\n\n setBeforeRender(cb: (stage: IStage) => void) {\n this._beforeRender = cb;\n }\n\n setAfterRender(cb: (stage: IStage) => void) {\n this._afterRender = cb;\n }\n\n afterNextRender(cb: (stage: IStage) => void) {\n if (!this._afterNextRenderCbs) {\n this._afterNextRenderCbs = [];\n }\n this._afterNextRenderCbs.push(cb);\n }\n\n enableView3dTransform() {\n if (this.view3dTranform) {\n return;\n }\n this.view3dTranform = true;\n this.pluginService.register(new ViewTransform3dPlugin());\n }\n\n disableView3dTranform() {\n if (!this.view3dTranform) {\n return;\n }\n this.view3dTranform = false;\n this.pluginService.findPluginsByName('ViewTransform3dPlugin').forEach(plugin => {\n plugin.deactivate(this.pluginService);\n });\n }\n\n enableAutoRender() {\n if (this.autoRender) {\n return;\n }\n this.autoRender = true;\n this.pluginService.register(new AutoRenderPlugin());\n }\n disableAutoRender() {\n if (!this.autoRender) {\n return;\n }\n this.autoRender = false;\n this.pluginService.findPluginsByName('AutoRenderPlugin').forEach(plugin => {\n plugin.deactivate(this.pluginService);\n });\n }\n enableIncrementalAutoRender() {\n if (this.increaseAutoRender) {\n return;\n }\n this.increaseAutoRender = true;\n this.pluginService.register(new IncrementalAutoRenderPlugin());\n }\n disableIncrementalAutoRender() {\n if (!this.increaseAutoRender) {\n return;\n }\n this.increaseAutoRender = false;\n this.pluginService.findPluginsByName('IncrementalAutoRenderPlugin').forEach(plugin => {\n plugin.deactivate(this.pluginService);\n });\n }\n enableDirtyBounds() {\n if (this.dirtyBounds) {\n return;\n }\n this.dirtyBounds = new Bounds();\n let plugin = this.pluginService.findPluginsByName('DirtyBoundsPlugin')[0];\n if (!plugin) {\n plugin = new DirtyBoundsPlugin();\n this.pluginService.register(plugin);\n }\n plugin.activate(this.pluginService);\n }\n disableDirtyBounds() {\n if (!this.dirtyBounds) {\n return;\n }\n this.dirtyBounds = null;\n this.pluginService.findPluginsByName('DirtyBoundsPlugin').forEach(plugin => {\n plugin.deactivate(this.pluginService);\n });\n }\n enableLayout() {\n if (this._enableLayout) {\n return;\n }\n this._enableLayout = true;\n this.pluginService.register(new FlexLayoutPlugin());\n }\n disableLayout() {\n if (!this._enableLayout) {\n return;\n }\n this._enableLayout = false;\n this.pluginService.findPluginsByName('FlexLayoutPlugin').forEach(plugin => {\n plugin.deactivate(this.pluginService);\n });\n }\n enableHtmlAttribute(container?: any) {\n if (this.htmlAttribute) {\n return;\n }\n this.htmlAttribute = container;\n this.pluginService.register(new HtmlAttributePlugin());\n }\n disableHtmlAttribute() {\n if (!this.htmlAttribute) {\n return;\n }\n this.htmlAttribute = false;\n this.pluginService.findPluginsByName('HtmlAttributePlugin').forEach(plugin => {\n plugin.deactivate(this.pluginService);\n });\n }\n\n // /**\n // * stage的appendChild,add\n // * @param node\n // * @returns\n // */\n // appendChild<T extends Node>(node: T): T | null {\n // const layer = this.at(0);\n // if (!layer) {\n // return null;\n // }\n // return layer.appendChild<T>(node);\n // }\n\n protected tryUpdateAABBBounds(): AABBBounds {\n const viewBox = this._viewBox;\n this._AABBBounds.setValue(viewBox.x1, viewBox.y1, viewBox.x2, viewBox.y2);\n return this._AABBBounds;\n }\n\n combineLayer(ILayer1: ILayer, ILayer2: ILayer): ILayer {\n throw new Error('暂不支持');\n }\n // 如果传入CanvasId,如果存在相同Id,说明这两个图层使用相同的Canvas绘制\n // 但需要注意的是依然是两个图层(用于解决Table嵌入ChartSpace不影响Table的绘制)\n createLayer(canvasId?: string): ILayer {\n // 创建一个默认layer图层\n const layer = this.layerService.createLayer(this, {\n main: false,\n canvasId\n });\n this.appendChild(layer);\n return layer;\n // const layer = new Layer(this, this.global, this.window, {\n // main: false,\n // canvasId\n // });\n // this.appendChild(layer);\n // return layer;\n }\n sortLayer(cb: (ILayer1: ILayer, layer2: ILayer) => number): void {\n const children = this.children;\n children.sort(cb);\n this.removeAllChild();\n children.forEach(c => {\n this.appendChild(c);\n });\n }\n removeLayer(ILayerId: number): ILayer | false {\n return this.removeChild(this.findChildByUid(ILayerId) as IGraphic) as ILayer;\n }\n tryInitInteractiveLayer() {\n // TODO:顺序可能会存在问题\n // 支持交互层,且没有创建过,那就创建\n if (this.supportInteractiveLayer && !this.interactiveLayer) {\n this.interactiveLayer = this.createLayer();\n this.interactiveLayer.name = '_builtin_interactive';\n }\n // this.interactiveLayer.afterDraw(l => {\n // l.removeAllChild();\n // });\n }\n\n clearViewBox(color?: string) {\n this.window.clearViewBox(this._viewBox, color);\n }\n\n render(layers?: ILayer[], params?: Partial<IDrawContext>): void {\n this.ticker.start();\n this.lastRenderparams = params;\n this.hooks.beforeRender.call(this);\n (layers || this).forEach<ILayer>((layer, i) => {\n layer.render(\n {\n renderService: this.renderService,\n background: layer === this.defaultLayer ? this.background : undefined,\n updateBounds: !!this.dirtyBounds\n },\n { renderStyle: this.renderStyle, ...params }\n );\n });\n this.combineLayersToWindow();\n this.nextFrameRenderLayerSet.clear();\n this.hooks.afterRender.call(this);\n }\n\n protected combineLayersToWindow() {\n this.forEach<ILayer>((layer, i) => {\n layer.combineTo(this.window, {\n clear: i === 0,\n x: this.x,\n y: this.y,\n width: this.viewWidth,\n height: this.viewHeight,\n renderService: this.renderService,\n background: layer === this.defaultLayer ? this.background : undefined,\n updateBounds: !!this.dirtyBounds\n });\n });\n }\n\n renderNextFrame(layers?: ILayer[]): void {\n // 性能优化,避免重复add\n if (this.nextFrameRenderLayerSet.size !== this.childrenCount) {\n (layers || this).forEach<ILayer>((layer: any) => {\n this.nextFrameRenderLayerSet.add(layer);\n });\n }\n if (!this.willNextFrameRender) {\n this.willNextFrameRender = true;\n this.global.getRequestAnimationFrame()(() => {\n this._doRenderInThisFrame(), (this.willNextFrameRender = false);\n });\n }\n }\n\n _doRenderInThisFrame() {\n if (this.nextFrameRenderLayerSet.size) {\n this.ticker.start();\n this.hooks.beforeRender.call(this);\n this.forEach((layer: Layer) => {\n if (this.nextFrameRenderLayerSet.has(layer)) {\n layer.render(\n {\n renderService: this.renderService,\n background: layer === this.defaultLayer ? this.background : undefined,\n updateBounds: !!this.dirtyBounds\n },\n { renderStyle: this.renderStyle, ...(this.lastRenderparams || {}) }\n );\n }\n });\n this.combineLayersToWindow();\n this.hooks.afterRender.call(this);\n this.nextFrameRenderLayerSet.clear();\n }\n }\n\n resizeWindow(w: number, h: number, rerender: boolean = true) {\n this.window.resize(w, h);\n rerender && this.render();\n }\n\n /**\n * 语法糖,如果viewBox和window宽高一样的话,那么会同时缩放window和viewBox\n * @param w\n * @param h\n * @param rerender\n */\n resize(w: number, h: number, rerender: boolean = true): void {\n this.window.resize(w, h);\n this.forEachChildren<ILayer>(c => {\n c.resize(w, h);\n });\n // 如果不是子图的stage,那么认为用户也想要resize view\n if (!this._subView) {\n this.viewBox.setValue(this.viewBox.x1, this.viewBox.y1, this.viewBox.x1 + w, this.viewBox.y1 + h);\n }\n // 设置camera\n // this.camera && (this.camera.params = { ...this.camera.params, right: this.width, bottom: this.height });\n this.camera && this.option3d && this.set3dOptions(this.option3d);\n rerender && this.render();\n }\n resizeView(w: number, h: number, rerender: boolean = true) {\n this.viewBox.setValue(this.viewBox.x1, this.viewBox.y1, this.viewBox.x1 + w, this.viewBox.y1 + h);\n this.forEachChildren<ILayer>(c => {\n c.resizeView(w, h);\n });\n // 设置camera\n this.camera && (this.camera.params = { ...this.camera.params, right: this.width, bottom: this.height });\n rerender && this.render();\n }\n setViewBox(viewBox: IBoundsLike, rerender: boolean): void;\n setViewBox(x: number, y: number, w: number, h: number, rerender: boolean): void;\n setViewBox(x: number | IBoundsLike, y: number | boolean, w?: number, h?: number, rerender?: boolean): void {\n let isRerender: boolean = true;\n\n if (typeof x === 'object') {\n this.viewBox.setValue(x.x1, x.y1, x.x2, x.y2);\n if (y === false) {\n isRerender = false;\n }\n } else {\n this.viewBox.setValue(x, y as number, x + w, (y as number) + h);\n\n if (rerender === false) {\n isRerender = false;\n }\n }\n\n this.forEachChildren<ILayer>(c => {\n c.resizeView(this.viewBox.width(), this.viewBox.height());\n });\n isRerender && this.render();\n }\n setDpr(dpr: number): void {\n // this.window.setDpr(dpr);\n this.forEachChildren<ILayer>(c => {\n c.setDpr(dpr);\n });\n }\n setOrigin(x: number, y: number): void {\n throw new Error('暂不支持');\n }\n export(type: IExportType): HTMLCanvasElement | ImageData {\n throw new Error('暂不支持');\n }\n pick(x: number, y: number): { graphic: IGraphic | null; group: IGroup | null } | false {\n // 暂时不提供layer的pick\n const result = this.pickerService.pick(this.children as unknown as IGraphic[], new Point(x, y), {\n bounds: this.AABBBounds\n });\n if (result?.graphic || result?.group) {\n return result;\n }\n return false;\n }\n\n // 动画相关\n startAnimate(t: number): void {\n throw new Error('暂不支持');\n }\n setToFrame(t: number): void {\n throw new Error('暂不支持');\n }\n\n release() {\n super.release();\n this.eventSystem && this.eventSystem.release();\n this.pluginService.release();\n this.forEach(layer => {\n layer.release();\n });\n this.interactiveLayer && this.interactiveLayer.release();\n this.window.release();\n }\n\n setStage(stage?: IStage) {\n return;\n // this.stage = this;\n // this.forEachChildren(item => {\n // (item as Layer).setStage(this);\n // });\n }\n\n /**\n * 添加dirty区域,会修改参数b\n * @param b\n * @param matrix\n */\n dirty(b: IBounds, matrix?: IMatrix) {\n if (matrix) {\n b.transformWithMatrix(matrix);\n }\n if (this.dirtyBounds.empty()) {\n this.dirtyBounds.setValue(b.x1, b.y1, b.x2, b.y2);\n }\n this.dirtyBounds.union(b);\n }\n\n getLayer(name: string): undefined | ILayer {\n const layer = this.children.filter(layer => layer.name === name);\n return layer[0] as ILayer;\n }\n\n renderTo(window: IWindow, params: { x: number; y: number; width: number; height: number }) {\n this.forEachChildren<ILayer>((layer, i) => {\n layer.drawTo(window, {\n ...params,\n renderService: this.renderService,\n background: layer === this.defaultLayer ? this.background : undefined,\n clear: i === 0, // 第一个layer需要clear\n updateBounds: !!this.dirtyBounds\n });\n });\n }\n\n /**\n * 渲染到新的window上去\n * @param fullImage 是否是全量的image,因为可能之前的window有一部分场景树超过window的帧缓冲了\n * @returns\n */\n renderToNewWindow(fullImage: boolean = true, viewBox?: IAABBBounds): IWindow {\n const window = container.get<IWindow>(VWindow);\n if (fullImage) {\n window.create({\n width: this.viewWidth,\n height: this.viewHeight,\n dpr: this.window.dpr,\n canvasControled: true,\n offscreen: true,\n title: ''\n });\n } else {\n const width = viewBox ? viewBox.width() : Math.min(this.viewWidth, this.window.width - this.x);\n const height = viewBox ? viewBox.height() : Math.min(this.viewHeight, this.window.height - this.y);\n window.create({\n width,\n height,\n dpr: this.window.dpr,\n canvasControled: true,\n offscreen: true,\n title: ''\n });\n }\n\n const x = viewBox ? -viewBox.x1 : 0;\n const y = viewBox ? -viewBox.y1 : 0;\n this.renderTo(window, {\n x,\n y,\n width: window.width,\n height: window.height\n });\n return window;\n }\n\n toCanvas(fullImage: boolean = true, viewBox?: IAABBBounds): HTMLCanvasElement | null {\n const window = this.renderToNewWindow(fullImage, viewBox);\n const c = window.getNativeHandler();\n if (c.nativeCanvas) {\n return c.nativeCanvas;\n }\n return null;\n }\n\n setCursor(mode?: string): void {\n this._cursor = mode;\n this.eventSystem.setCursor(mode);\n }\n\n getCursor() {\n return this._cursor;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/core/stage.ts"],"names":[],"mappings":";;;AACA,6CAA6D;AA2B7D,qCAAmC;AAEnC,oCAAuC;AACvC,4CAAyC;AACzC,sCAA0C;AAC1C,wCAA0C;AAC1C,6DAAyD;AACzD,oDAAqD;AACrD,qFAAgF;AAChF,gGAA0F;AAC1F,6GAAuG;AACvG,2FAAsF;AACtF,uFAAkF;AAClF,qFAAgF;AAChF,8DAA0D;AAC1D,wCAAsC;AACtC,mCAA2C;AAC3C,qCAAuC;AACvC,4CAAuC;AACvC,2CAA2C;AAC3C,wCAA6C;AAE7C,MAAM,aAAa,GAAG;IACpB,KAAK,EAAE,GAAG;IACV,MAAM,EAAE,GAAG;IAC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AAY,CAAC;SACvB;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,CAAC,IAAa;QACrB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AAnxBD,sBAmxBC","file":"stage.js","sourcesContent":["import type { IAABBBounds, IBounds, IBoundsLike, IMatrix } from '@visactor/vutils';\nimport { AABBBounds, Bounds, Point } from '@visactor/vutils';\nimport type {\n IGraphic,\n IGroup,\n IExportType,\n IStage,\n IStageParams,\n ILayer,\n IColor,\n IGlobal,\n IOption3D,\n ICamera,\n vec3,\n IDirectionLight,\n ITicker,\n IRenderService,\n IPickerService,\n IPluginService,\n ISyncHook,\n IDrawContext,\n IWindow,\n IPlugin,\n IContributionProvider,\n ILayerService,\n ITimeline,\n IOptimizeType\n} from '../interface';\nimport { VWindow } from './window';\nimport type { Layer } from './layer';\nimport { EventSystem } from '../event';\nimport { container } from '../container';\nimport { RenderService } from '../render';\nimport { Group, Theme } from '../graphic';\nimport { PickerService } from '../picker/picker-service';\nimport { PluginService } from '../plugins/constants';\nimport { AutoRenderPlugin } from '../plugins/builtin-plugin/auto-render-plugin';\nimport { ViewTransform3dPlugin } from '../plugins/builtin-plugin/3dview-transform-plugin';\nimport { IncrementalAutoRenderPlugin } from '../plugins/builtin-plugin/incremental-auto-render-plugin';\nimport { HtmlAttributePlugin } from '../plugins/builtin-plugin/html-attribute-plugin';\nimport { DirtyBoundsPlugin } from '../plugins/builtin-plugin/dirty-bounds-plugin';\nimport { FlexLayoutPlugin } from '../plugins/builtin-plugin/flex-layout-plugin';\nimport { defaultTicker } from '../animate/default-ticker';\nimport { SyncHook } from '../tapable';\nimport { DirectionalLight } from './light';\nimport { OrthoCamera } from './camera';\nimport { VGlobal } from '../constants';\nimport { LayerService } from './constants';\nimport { DefaultTimeline } from '../animate';\n\nconst DefaultConfig = {\n WIDTH: 500,\n HEIGHT: 500,\n X: 0,\n Y: 0,\n BACKGROUND: 'white'\n};\n\n/**\n * Stage是一个舞台或一个视口,并不直接对应一个或多个Canvas,逻辑上和Canvas无关\n *\n * 1. Stage对应一个Canvas的整体,Stage的宽高即为Canvas的宽高\n * 2. Stage小于Canvas,Stage作为Canvas某个区域的视口,只管理这个区域\n * 3. 多图层时Stage的多个图层对应多个Canvas\n *\n * 原生环境下Stage可以拥有一个Window或者使用Window的一块区域\n *\n * 【注】如果希望获取完整的Canvas或窗口或者调整窗口信息,请使用Window模块\n */\nexport class Stage extends Group implements IStage {\n declare parent: IStage | null;\n\n protected _viewBox: AABBBounds;\n private _background: string | IColor;\n private _subView: boolean; // 是否是存在子视图\n protected nextFrameRenderLayerSet: Set<Layer>;\n protected willNextFrameRender: boolean;\n protected _cursor: string;\n renderCount: number;\n dirtyBounds: IBounds | null;\n option3d?: IOption3D;\n declare light?: IDirectionLight;\n declare camera?: ICamera;\n declare renderStyle?: string;\n\n declare hooks: {\n beforeRender: ISyncHook<[IStage]>;\n afterRender: ISyncHook<[IStage]>;\n };\n\n set viewBox(b: IBoundsLike) {\n this._viewBox.setValue(b.x1, b.y1, b.x2, b.y2);\n }\n get viewBox(): AABBBounds {\n return this._viewBox;\n }\n\n get x(): number {\n return this._viewBox.x1;\n }\n set x(x: number) {\n this._viewBox.translate(x - this._viewBox.x1, 0);\n }\n get y(): number {\n return this._viewBox.y1;\n }\n set y(y: number) {\n this._viewBox.translate(0, y - this._viewBox.y1);\n }\n get width(): number {\n return this.window.width;\n }\n set width(w: number) {\n this.resize(w, this.height);\n }\n get viewWidth(): number {\n return this._viewBox.width();\n }\n set viewWidth(w: number) {\n this.resizeView(w, this.viewHeight);\n }\n get viewHeight(): number {\n return this._viewBox.height();\n }\n set viewHeight(h: number) {\n this.resizeView(this.viewWidth, h);\n }\n get height(): number {\n return this.window.height;\n }\n set height(h: number) {\n this.resize(this.width, h);\n }\n get dpr(): number {\n return this.window.dpr;\n }\n set dpr(r: number) {\n this.setDpr(r);\n }\n get background(): string | IColor {\n return this._background ?? DefaultConfig.BACKGROUND;\n }\n set background(b: string | IColor) {\n this._background = b;\n }\n get defaultLayer(): ILayer {\n return this.at(0) as unknown as ILayer;\n }\n\n ticker: ITicker;\n\n autoRender: boolean;\n _enableLayout: boolean;\n htmlAttribute: boolean | string | any;\n increaseAutoRender: boolean;\n view3dTranform: boolean;\n readonly window: IWindow;\n private readonly global: IGlobal;\n readonly renderService: IRenderService;\n readonly pickerService: IPickerService;\n readonly pluginService: IPluginService;\n readonly layerService: ILayerService;\n private readonly eventSystem?: EventSystem;\n\n protected _beforeRender?: (stage: IStage) => void;\n protected _afterRender?: (stage: IStage) => void;\n protected _skipRender?: number;\n protected _afterNextRenderCbs?: ((stage: IStage) => void)[];\n protected lastRenderparams?: Partial<IDrawContext>;\n\n protected interactiveLayer?: ILayer;\n protected supportInteractiveLayer: boolean;\n protected timeline: ITimeline;\n\n declare params: Partial<IStageParams>;\n\n /**\n * 所有属性都具有默认值。\n * Canvas为字符串或者Canvas元素,那么默认图层就会绑定到这个Canvas上\n * 如果不传入Canvas,那么会新建一个Canvas,用户可以通过Window模块管理这个Canvas\n * 1. 如果没有传入宽高,那么默认为canvas宽高,如果传入了宽高则stage使用传入宽高作为视口宽高\n * @param params\n */\n constructor(params: Partial<IStageParams>) {\n super({});\n this.params = params;\n this.theme = new Theme();\n this.hooks = {\n beforeRender: new SyncHook(['stage']),\n afterRender: new SyncHook(['stage'])\n };\n this.global = container.get<IGlobal>(VGlobal);\n this.window = container.get<IWindow>(VWindow);\n this.renderService = container.get<IRenderService>(RenderService);\n this.pickerService = container.get<IPickerService>(PickerService);\n this.pluginService = container.get<IPluginService>(PluginService);\n this.layerService = container.get<ILayerService>(LayerService);\n this.pluginService.active(this, params);\n\n this.window.create({\n width: params.width,\n height: params.height,\n container: params.container,\n dpr: params.dpr || this.global.devicePixelRatio,\n canvasControled: params.canvasControled !== false,\n title: params.title || '',\n canvas: params.canvas\n });\n\n this._viewBox = new AABBBounds();\n if (params.viewBox) {\n this._viewBox.setValue(params.viewBox.x1, params.viewBox.y1, params.viewBox.x2, params.viewBox.y2);\n } else {\n this._viewBox.setValue(0, 0, this.width, this.height);\n }\n\n this.renderCount = 0;\n\n // // 没有传入xy就默认为0\n // this._x = params.x ?? DefaultConfig.X;\n // this._y = params.y ?? DefaultConfig.Y;\n // // 没有传入view的宽高则默认为window的宽高\n // this._viewWidth = params.viewWidth ?? this.window.width;\n // this._viewHeight = params.viewHeight ?? this.window.height;\n this._subView = !(this._viewBox.width() === this.width && this._viewBox.height() === this.height);\n // this._AABBBounds.set(this._x, this._y, this._viewWidth + this._x, this._viewHeight + this._y);\n // 背景色默认为纯白色\n this._background = params.background ?? DefaultConfig.BACKGROUND;\n\n // 创建一个默认layer图层\n // this.appendChild(new Layer(this, this.global, this.window, { main: true }));\n this.appendChild(this.layerService.createLayer(this, { main: true }));\n\n this.nextFrameRenderLayerSet = new Set();\n this.willNextFrameRender = false;\n this.stage = this;\n this.renderStyle = params.renderStyle;\n\n if (this.global.supportEvent) {\n this.eventSystem = new EventSystem({\n targetElement: this.window,\n resolution: this.window.dpr || this.global.devicePixelRatio,\n rootNode: this as any,\n global: this.global,\n viewport: {\n viewBox: this._viewBox,\n get x(): number {\n return this.viewBox.x1;\n },\n get y(): number {\n return this.viewBox.y1;\n },\n get width(): number {\n return this.viewBox.width();\n },\n get height(): number {\n return this.viewBox.height();\n }\n }\n });\n }\n\n // this.autoRender = params.autoRender;\n if (params.autoRender) {\n this.enableAutoRender();\n }\n // 默认不开启dirtyBounds\n if (params.disableDirtyBounds === false) {\n this.enableDirtyBounds();\n }\n\n if (params.enableHtmlAttribute) {\n this.enableHtmlAttribute(params.enableHtmlAttribute);\n }\n\n params.enableLayout && this.enableLayout();\n this.hooks.beforeRender.tap('constructor', this.beforeRender);\n this.hooks.afterRender.tap('constructor', this.afterRender);\n this._beforeRender = params.beforeRender;\n this._afterRender = params.afterRender;\n this.ticker = params.ticker || defaultTicker;\n this.supportInteractiveLayer = params.interactiveLayer !== false;\n this.timeline = new DefaultTimeline();\n this.ticker.addTimeline(this.timeline);\n this.timeline.pause();\n this.optmize(params.optimize);\n }\n\n // 优化策略\n optmize(params?: IOptimizeType) {\n this.optmizeRender(params?.skipRenderWithOutRange);\n }\n\n // 优化渲染\n protected optmizeRender(skipRenderWithOutRange: boolean = true) {\n if (!skipRenderWithOutRange) {\n return;\n }\n // 不在视口内的时候,跳过渲染\n this._skipRender = this.window.isVisible() ? 0 : 1;\n this.window.onVisibleChange(visible => {\n if (visible) {\n if (this.dirtyBounds) {\n this.dirtyBounds.setValue(0, 0, this._viewBox.width(), this._viewBox.height());\n }\n if (this._skipRender > 1) {\n this.renderNextFrame();\n }\n this._skipRender = 0;\n } else {\n this._skipRender = 1;\n }\n });\n }\n\n getTimeline() {\n return this.timeline;\n }\n\n get3dOptions(options: IOption3D) {\n const {\n center = { x: this.width / 2, y: this.height / 2, z: 0, dx: 0, dy: 0, dz: 0 },\n light = {},\n alpha = 0,\n beta = 0,\n camera,\n fieldRatio = 1,\n fieldDepth\n } = options;\n\n return {\n ...options,\n center,\n light,\n alpha,\n beta,\n camera,\n fieldRatio,\n fieldDepth\n };\n }\n\n set3dOptions(options: IOption3D) {\n this.option3d = options;\n const options3d = this.get3dOptions(options);\n const { light, center, camera, alpha, beta, fieldRatio, fieldDepth } = options3d;\n const { dir = [1, 1, -1], color = 'white', ambient } = light;\n\n const centerX = (center.x ?? this.width / 2) + (center.dx ?? 0);\n const centerY = (center.y ?? this.height / 2) + (center.dy ?? 0);\n const centerZ = (center.z ?? 0) + (center.dz ?? 0);\n const centerVec3: vec3 = [centerX, centerY, centerZ];\n const z = 1;\n let cameraX = 0;\n let cameraY = 0;\n let cameraZ = 0;\n if (!camera) {\n cameraX = Math.sin(alpha) + centerX;\n cameraY = Math.sin(beta) + centerY;\n cameraZ = Math.cos(alpha) * Math.cos(beta) * z;\n }\n\n this.light = new DirectionalLight(dir, color, ambient);\n const cameraParams = {\n left: 0,\n right: this.width,\n top: 0,\n bottom: this.height,\n fieldRatio: fieldRatio,\n fieldDepth,\n viewParams: {\n pos: [cameraX, cameraY, cameraZ] as vec3,\n center: centerVec3,\n up: [0, 1, 0] as vec3\n }\n };\n if (this.camera) {\n this.camera.params = cameraParams;\n } else {\n this.camera = new OrthoCamera(cameraParams);\n }\n\n if (options.enableView3dTransform) {\n this.enableView3dTransform();\n }\n }\n\n protected beforeRender = (stage: IStage) => {\n this._beforeRender && this._beforeRender(stage);\n };\n\n protected afterRender = (stage: IStage) => {\n this.renderCount++;\n this._afterRender && this._afterRender(stage);\n this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage));\n this._afterNextRenderCbs = null;\n };\n\n setBeforeRender(cb: (stage: IStage) => void) {\n this._beforeRender = cb;\n }\n\n setAfterRender(cb: (stage: IStage) => void) {\n this._afterRender = cb;\n }\n\n afterNextRender(cb: (stage: IStage) => void) {\n if (!this._afterNextRenderCbs) {\n this._afterNextRenderCbs = [];\n }\n this._afterNextRenderCbs.push(cb);\n }\n\n enableView3dTransform() {\n if (this.view3dTranform) {\n return;\n }\n this.view3dTranform = true;\n this.pluginService.register(new ViewTransform3dPlugin());\n }\n\n disableView3dTranform() {\n if (!this.view3dTranform) {\n return;\n }\n this.view3dTranform = false;\n this.pluginService.findPluginsByName('ViewTransform3dPlugin').forEach(plugin => {\n plugin.deactivate(this.pluginService);\n });\n }\n\n enableAutoRender() {\n if (this.autoRender) {\n return;\n }\n this.autoRender = true;\n this.pluginService.register(new AutoRenderPlugin());\n }\n disableAutoRender() {\n if (!this.autoRender) {\n return;\n }\n this.autoRender = false;\n this.pluginService.findPluginsByName('AutoRenderPlugin').forEach(plugin => {\n plugin.deactivate(this.pluginService);\n });\n }\n enableIncrementalAutoRender() {\n if (this.increaseAutoRender) {\n return;\n }\n this.increaseAutoRender = true;\n this.pluginService.register(new IncrementalAutoRenderPlugin());\n }\n disableIncrementalAutoRender() {\n if (!this.increaseAutoRender) {\n return;\n }\n this.increaseAutoRender = false;\n this.pluginService.findPluginsByName('IncrementalAutoRenderPlugin').forEach(plugin => {\n plugin.deactivate(this.pluginService);\n });\n }\n enableDirtyBounds() {\n if (this.dirtyBounds) {\n return;\n }\n this.dirtyBounds = new Bounds();\n let plugin = this.pluginService.findPluginsByName('DirtyBoundsPlugin')[0];\n if (!plugin) {\n plugin = new DirtyBoundsPlugin();\n this.pluginService.register(plugin);\n }\n plugin.activate(this.pluginService);\n }\n disableDirtyBounds() {\n if (!this.dirtyBounds) {\n return;\n }\n this.dirtyBounds = null;\n this.pluginService.findPluginsByName('DirtyBoundsPlugin').forEach(plugin => {\n plugin.deactivate(this.pluginService);\n });\n }\n enableLayout() {\n if (this._enableLayout) {\n return;\n }\n this._enableLayout = true;\n this.pluginService.register(new FlexLayoutPlugin());\n }\n disableLayout() {\n if (!this._enableLayout) {\n return;\n }\n this._enableLayout = false;\n this.pluginService.findPluginsByName('FlexLayoutPlugin').forEach(plugin => {\n plugin.deactivate(this.pluginService);\n });\n }\n enableHtmlAttribute(container?: any) {\n if (this.htmlAttribute) {\n return;\n }\n this.htmlAttribute = container;\n this.pluginService.register(new HtmlAttributePlugin());\n }\n disableHtmlAttribute() {\n if (!this.htmlAttribute) {\n return;\n }\n this.htmlAttribute = false;\n this.pluginService.findPluginsByName('HtmlAttributePlugin').forEach(plugin => {\n plugin.deactivate(this.pluginService);\n });\n }\n\n // /**\n // * stage的appendChild,add\n // * @param node\n // * @returns\n // */\n // appendChild<T extends Node>(node: T): T | null {\n // const layer = this.at(0);\n // if (!layer) {\n // return null;\n // }\n // return layer.appendChild<T>(node);\n // }\n\n protected tryUpdateAABBBounds(): AABBBounds {\n const viewBox = this._viewBox;\n this._AABBBounds.setValue(viewBox.x1, viewBox.y1, viewBox.x2, viewBox.y2);\n return this._AABBBounds;\n }\n\n combineLayer(ILayer1: ILayer, ILayer2: ILayer): ILayer {\n throw new Error('暂不支持');\n }\n // 如果传入CanvasId,如果存在相同Id,说明这两个图层使用相同的Canvas绘制\n // 但需要注意的是依然是两个图层(用于解决Table嵌入ChartSpace不影响Table的绘制)\n createLayer(canvasId?: string): ILayer {\n // 创建一个默认layer图层\n const layer = this.layerService.createLayer(this, {\n main: false,\n canvasId\n });\n this.appendChild(layer);\n return layer;\n // const layer = new Layer(this, this.global, this.window, {\n // main: false,\n // canvasId\n // });\n // this.appendChild(layer);\n // return layer;\n }\n sortLayer(cb: (ILayer1: ILayer, layer2: ILayer) => number): void {\n const children = this.children;\n children.sort(cb);\n this.removeAllChild();\n children.forEach(c => {\n this.appendChild(c);\n });\n }\n removeLayer(ILayerId: number): ILayer | false {\n return this.removeChild(this.findChildByUid(ILayerId) as IGraphic) as ILayer;\n }\n tryInitInteractiveLayer() {\n // TODO:顺序可能会存在问题\n // 支持交互层,且没有创建过,那就创建\n if (this.supportInteractiveLayer && !this.interactiveLayer) {\n this.interactiveLayer = this.createLayer();\n this.interactiveLayer.name = '_builtin_interactive';\n }\n // this.interactiveLayer.afterDraw(l => {\n // l.removeAllChild();\n // });\n }\n\n clearViewBox(color?: string) {\n this.window.clearViewBox(this._viewBox, color);\n }\n\n render(layers?: ILayer[], params?: Partial<IDrawContext>): void {\n this.ticker.start();\n this.timeline.resume();\n if (!this._skipRender) {\n this.lastRenderparams = params;\n this.hooks.beforeRender.call(this);\n (layers || this).forEach<ILayer>((layer, i) => {\n layer.render(\n {\n renderService: this.renderService,\n background: layer === this.defaultLayer ? this.background : undefined,\n updateBounds: !!this.dirtyBounds\n },\n { renderStyle: this.renderStyle, ...params }\n );\n });\n this.combineLayersToWindow();\n this.nextFrameRenderLayerSet.clear();\n this.hooks.afterRender.call(this);\n }\n this._skipRender && this._skipRender++;\n }\n\n protected combineLayersToWindow() {\n this.forEach<ILayer>((layer, i) => {\n layer.combineTo(this.window, {\n clear: i === 0,\n x: this.x,\n y: this.y,\n width: this.viewWidth,\n height: this.viewHeight,\n renderService: this.renderService,\n background: layer === this.defaultLayer ? this.background : undefined,\n updateBounds: !!this.dirtyBounds\n });\n });\n }\n\n renderNextFrame(layers?: ILayer[]): void {\n // 性能优化,避免重复add\n if (this.nextFrameRenderLayerSet.size !== this.childrenCount) {\n (layers || this).forEach<ILayer>((layer: any) => {\n this.nextFrameRenderLayerSet.add(layer);\n });\n }\n if (!this.willNextFrameRender) {\n this.willNextFrameRender = true;\n this.global.getRequestAnimationFrame()(() => {\n this._doRenderInThisFrame(), (this.willNextFrameRender = false);\n });\n }\n }\n\n _doRenderInThisFrame() {\n this.timeline.resume();\n this.ticker.start();\n if (this.nextFrameRenderLayerSet.size && !this._skipRender) {\n this.hooks.beforeRender.call(this);\n this.forEach((layer: Layer) => {\n if (this.nextFrameRenderLayerSet.has(layer)) {\n layer.render(\n {\n renderService: this.renderService,\n background: layer === this.defaultLayer ? this.background : undefined,\n updateBounds: !!this.dirtyBounds\n },\n { renderStyle: this.renderStyle, ...(this.lastRenderparams || {}) }\n );\n }\n });\n this.combineLayersToWindow();\n this.hooks.afterRender.call(this);\n this.nextFrameRenderLayerSet.clear();\n }\n this._skipRender && this._skipRender++;\n }\n\n resizeWindow(w: number, h: number, rerender: boolean = true) {\n this.window.resize(w, h);\n rerender && this.render();\n }\n\n /**\n * 语法糖,如果viewBox和window宽高一样的话,那么会同时缩放window和viewBox\n * @param w\n * @param h\n * @param rerender\n */\n resize(w: number, h: number, rerender: boolean = true): void {\n this.window.resize(w, h);\n this.forEachChildren<ILayer>(c => {\n c.resize(w, h);\n });\n // 如果不是子图的stage,那么认为用户也想要resize view\n if (!this._subView) {\n this.viewBox.setValue(this.viewBox.x1, this.viewBox.y1, this.viewBox.x1 + w, this.viewBox.y1 + h);\n }\n // 设置camera\n // this.camera && (this.camera.params = { ...this.camera.params, right: this.width, bottom: this.height });\n this.camera && this.option3d && this.set3dOptions(this.option3d);\n rerender && this.render();\n }\n resizeView(w: number, h: number, rerender: boolean = true) {\n this.viewBox.setValue(this.viewBox.x1, this.viewBox.y1, this.viewBox.x1 + w, this.viewBox.y1 + h);\n this.forEachChildren<ILayer>(c => {\n c.resizeView(w, h);\n });\n // 设置camera\n this.camera && (this.camera.params = { ...this.camera.params, right: this.width, bottom: this.height });\n rerender && this.render();\n }\n setViewBox(viewBox: IBoundsLike, rerender: boolean): void;\n setViewBox(x: number, y: number, w: number, h: number, rerender: boolean): void;\n setViewBox(x: number | IBoundsLike, y: number | boolean, w?: number, h?: number, rerender?: boolean): void {\n let isRerender: boolean = true;\n\n if (typeof x === 'object') {\n this.viewBox.setValue(x.x1, x.y1, x.x2, x.y2);\n if (y === false) {\n isRerender = false;\n }\n } else {\n this.viewBox.setValue(x, y as number, x + w, (y as number) + h);\n\n if (rerender === false) {\n isRerender = false;\n }\n }\n\n this.forEachChildren<ILayer>(c => {\n c.resizeView(this.viewBox.width(), this.viewBox.height());\n });\n isRerender && this.render();\n }\n setDpr(dpr: number): void {\n // this.window.setDpr(dpr);\n this.forEachChildren<ILayer>(c => {\n c.setDpr(dpr);\n });\n }\n setOrigin(x: number, y: number): void {\n throw new Error('暂不支持');\n }\n export(type: IExportType): HTMLCanvasElement | ImageData {\n throw new Error('暂不支持');\n }\n pick(x: number, y: number): { graphic: IGraphic | null; group: IGroup | null } | false {\n // 暂时不提供layer的pick\n const result = this.pickerService.pick(this.children as unknown as IGraphic[], new Point(x, y), {\n bounds: this.AABBBounds\n });\n if (result?.graphic || result?.group) {\n return result;\n }\n return false;\n }\n\n // 动画相关\n startAnimate(t: number): void {\n throw new Error('暂不支持');\n }\n setToFrame(t: number): void {\n throw new Error('暂不支持');\n }\n\n release() {\n super.release();\n this.eventSystem && this.eventSystem.release();\n this.pluginService.release();\n this.forEach(layer => {\n layer.release();\n });\n this.interactiveLayer && this.interactiveLayer.release();\n this.window.release();\n }\n\n setStage(stage?: IStage) {\n return;\n // this.stage = this;\n // this.forEachChildren(item => {\n // (item as Layer).setStage(this);\n // });\n }\n\n /**\n * 添加dirty区域,会修改参数b\n * @param b\n * @param matrix\n */\n dirty(b: IBounds, matrix?: IMatrix) {\n if (matrix) {\n b.transformWithMatrix(matrix);\n }\n if (this.dirtyBounds.empty()) {\n this.dirtyBounds.setValue(b.x1, b.y1, b.x2, b.y2);\n }\n this.dirtyBounds.union(b);\n }\n\n getLayer(name: string): undefined | ILayer {\n const layer = this.children.filter(layer => layer.name === name);\n return layer[0] as ILayer;\n }\n\n renderTo(window: IWindow, params: { x: number; y: number; width: number; height: number }) {\n this.forEachChildren<ILayer>((layer, i) => {\n layer.drawTo(window, {\n ...params,\n renderService: this.renderService,\n background: layer === this.defaultLayer ? this.background : undefined,\n clear: i === 0, // 第一个layer需要clear\n updateBounds: !!this.dirtyBounds\n });\n });\n }\n\n /**\n * 渲染到新的window上去\n * @param fullImage 是否是全量的image,因为可能之前的window有一部分场景树超过window的帧缓冲了\n * @returns\n */\n renderToNewWindow(fullImage: boolean = true, viewBox?: IAABBBounds): IWindow {\n const window = container.get<IWindow>(VWindow);\n if (fullImage) {\n window.create({\n width: this.viewWidth,\n height: this.viewHeight,\n dpr: this.window.dpr,\n canvasControled: true,\n offscreen: true,\n title: ''\n });\n } else {\n const width = viewBox ? viewBox.width() : Math.min(this.viewWidth, this.window.width - this.x);\n const height = viewBox ? viewBox.height() : Math.min(this.viewHeight, this.window.height - this.y);\n window.create({\n width,\n height,\n dpr: this.window.dpr,\n canvasControled: true,\n offscreen: true,\n title: ''\n });\n }\n\n const x = viewBox ? -viewBox.x1 : 0;\n const y = viewBox ? -viewBox.y1 : 0;\n this.renderTo(window, {\n x,\n y,\n width: viewBox ? viewBox.x2 : window.width,\n height: viewBox ? viewBox.y2 : window.height\n });\n return window;\n }\n\n toCanvas(fullImage: boolean = true, viewBox?: IAABBBounds): HTMLCanvasElement | null {\n const window = this.renderToNewWindow(fullImage, viewBox);\n const c = window.getNativeHandler();\n if (c.nativeCanvas) {\n return c.nativeCanvas;\n }\n return null;\n }\n\n setCursor(mode?: string): void {\n this._cursor = mode;\n this.eventSystem.setCursor(mode);\n }\n\n getCursor() {\n return this._cursor;\n }\n}\n"]}
|
package/cjs/core/window.d.ts
CHANGED
|
@@ -45,4 +45,6 @@ export declare class DefaultWindow implements IWindow {
|
|
|
45
45
|
getBoundingClientRect(): IDomRectLike;
|
|
46
46
|
getContainer(): HTMLElement | any;
|
|
47
47
|
clearViewBox(viewBox: IBoundsLike, color?: string): void;
|
|
48
|
+
isVisible(bbox?: IBoundsLike): boolean;
|
|
49
|
+
onVisibleChange(cb: (currentVisible: boolean) => void): void;
|
|
48
50
|
}
|
package/cjs/core/window.js
CHANGED
|
@@ -108,6 +108,12 @@ let DefaultWindow = class {
|
|
|
108
108
|
clearViewBox(viewBox, color) {
|
|
109
109
|
this._handler.clearViewBox(viewBox, color);
|
|
110
110
|
}
|
|
111
|
+
isVisible(bbox) {
|
|
112
|
+
return this._handler.isVisible(bbox);
|
|
113
|
+
}
|
|
114
|
+
onVisibleChange(cb) {
|
|
115
|
+
return this._handler.onVisibleChange(cb);
|
|
116
|
+
}
|
|
111
117
|
};
|
|
112
118
|
|
|
113
119
|
__decorate([ (0, inversify_1.postConstruct)(), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], DefaultWindow.prototype, "postInit", null),
|
package/cjs/core/window.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/window.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yCAA8D;AAE9D,mDAAgD;AAUhD,4CAAyC;AACzC,wCAAsC;AACtC,4CAAuC;AAE1B,QAAA,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AAEhC,QAAA,yBAAyB,GAAG,MAAM,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;AAQ1E,IAAM,aAAa,GAAnB,MAAM,aAAa;IAYxB,IAAI,KAAK;QACP,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,MAAM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AAe,CAAC,EAAqC;QACnD,OAAO,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAC3C,CAAC;CACF,CAAA;AA3HC;IAAC,IAAA,yBAAa,GAAE;;;;6CAMf;AA7DU,aAAa;IADzB,IAAA,sBAAU,GAAE;IAmDR,WAAA,IAAA,kBAAM,EAAC,mBAAO,CAAC,CAAA;;GAlDP,aAAa,CAkLzB;AAlLY,sCAAa","file":"window.js","sourcesContent":["import { inject, injectable, postConstruct } from 'inversify';\nimport type { IBoundsLike } from '@visactor/vutils';\nimport { Generator } from '../common/generator';\nimport type {\n ICanvas,\n IContext2d,\n IDomRectLike,\n IGlobal,\n IWindow,\n IWindowHandlerContribution,\n IWindowParams\n} from '../interface';\nimport { container } from '../container';\nimport { SyncHook } from '../tapable';\nimport { VGlobal } from '../constants';\n\nexport const VWindow = Symbol.for('VWindow');\n\nexport const WindowHandlerContribution = Symbol.for('WindowHandlerContribution');\n\n/**\n * 窗口\n * 对于浏览器,就是管理某个Stage影响的Canvas\n * 对于原生,就是管理这个系统窗口\n */\n@injectable()\nexport class DefaultWindow implements IWindow {\n protected _width: number;\n protected _height: number;\n protected _handler: IWindowHandlerContribution;\n\n hooks = {\n onChange: new SyncHook<[number, number, number, number]>(['x', 'y', 'width', 'height'])\n };\n\n // 父窗口(容器),对于浏览器来说就是container dom\n declare parent: Window;\n // 窗口的大小\n get width(): number {\n if (this._handler) {\n const wh = this._handler.getWH();\n return (this._width = wh.width);\n }\n return this._width;\n }\n get height(): number {\n if (this._handler) {\n const wh = this._handler.getWH();\n return (this._height = wh.height);\n }\n return this._height;\n }\n // 窗口的位置\n // declare x: number;\n // declare y: number;\n declare _uid: number;\n // 窗口操作配置\n declare resizable: boolean;\n declare minHeight: number;\n declare minWidth: number;\n declare maxHeight: number;\n declare maxWidth: number;\n // 窗口配置\n declare title: string;\n\n /* 浏览器环境配置 */\n // 这是主体canvas,对于单图层来说就是绘图canvas\n // 对于多图层画布来说,就是用户传入的或者默认的一个canvas\n declare mainCanvas: ICanvas;\n declare layerCanvas: ICanvas[];\n declare actived: boolean;\n get dpr(): number {\n return this._handler.getDpr();\n }\n\n constructor(\n @inject(VGlobal) public readonly global: IGlobal // @inject(ContributionProvider) // @named(WindowHandlerContribution) // protected readonly contributions: ContributionProvider<IWindowHandlerContribution>\n ) {\n this._uid = Generator.GenAutoIncrementId();\n }\n\n @postConstruct()\n protected postInit() {\n this.global.hooks.onSetEnv.tap('window', () => {\n this.active();\n });\n this.active();\n }\n\n protected active() {\n const global = this.global;\n if (!global.env || this.actived) {\n return;\n }\n const handler = container.getNamed<IWindowHandlerContribution>(WindowHandlerContribution, global.env);\n handler.configure(this, global);\n // this.contributions.getContributions().forEach((handlerContribution) => {\n // handlerContribution.configure(this, this.global);\n // });\n this.actived = true;\n }\n\n get style(): CSSStyleDeclaration | Record<string, any> {\n return this._handler.getStyle();\n }\n\n set style(style: CSSStyleDeclaration | Record<string, any>) {\n this._handler.setStyle(style);\n }\n\n create(params: IWindowParams): void {\n // 通过handler创建窗口\n this._handler.createWindow(params);\n\n // 使用window的wh\n const windowWH = this._handler.getWH();\n this._width = windowWH.width;\n this._height = windowWH.height;\n // 使用window的xy\n // const windowXY = this._handler.getXY();\n // this.x = windowXY.x;\n // this.y = windowXY.y;\n // 使用window的title\n this.title = this._handler.getTitle();\n this.resizable = true;\n }\n\n setWindowHandler(handler: IWindowHandlerContribution) {\n this._handler = handler;\n }\n\n setDpr(dpr: number): void {\n return this._handler.setDpr(dpr);\n }\n resize(w: number, h: number): void {\n return this._handler.resizeWindow(w, h);\n }\n configure(): void {\n throw new Error('暂不支持');\n }\n release(): void {\n return this._handler.releaseWindow();\n }\n getContext(): IContext2d {\n return this._handler.getContext();\n }\n getNativeHandler(): ICanvas {\n return this._handler.getNativeHandler();\n }\n getImageBuffer(type?: string): any {\n if (!this._handler.getImageBuffer) {\n return null;\n }\n return this._handler.getImageBuffer(type);\n }\n\n addEventListener<K extends keyof DocumentEventMap>(\n type: K,\n listener: (this: Document, ev: DocumentEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions\n ): void;\n addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions\n ): void {\n return this._handler.addEventListener(type, listener, options);\n }\n removeEventListener<K extends keyof DocumentEventMap>(\n type: K,\n listener: (this: Document, ev: DocumentEventMap[K]) => any,\n options?: boolean | EventListenerOptions\n ): void;\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions\n ): void {\n return this._handler.removeEventListener(type, listener, options);\n }\n\n dispatchEvent(event: any): boolean {\n return this._handler.dispatchEvent(event);\n }\n\n getBoundingClientRect(): IDomRectLike {\n return this._handler.getBoundingClientRect();\n }\n\n getContainer(): HTMLElement | any {\n return this._handler.container;\n }\n\n clearViewBox(viewBox: IBoundsLike, color?: string) {\n this._handler.clearViewBox(viewBox, color);\n }\n\n isVisible(bbox?: IBoundsLike): boolean {\n return this._handler.isVisible(bbox);\n }\n\n onVisibleChange(cb: (currentVisible: boolean) => void) {\n return this._handler.onVisibleChange(cb);\n }\n}\n"]}
|
|
@@ -147,14 +147,15 @@ class EventManager {
|
|
|
147
147
|
this.dispatch.emit(type || e.type, e);
|
|
148
148
|
}
|
|
149
149
|
mapEvent(e) {
|
|
150
|
-
var _a;
|
|
150
|
+
var _a, _b, _c, _d, _e;
|
|
151
151
|
if (!this.rootTarget) return;
|
|
152
152
|
const mappers = this.mappingTable[e.type];
|
|
153
153
|
let target;
|
|
154
154
|
const cacheKey = `${e.canvasX}-${e.canvasY}`;
|
|
155
|
-
if ((null === (_a = this._prePointTargetCache) || void 0 === _a ? void 0 : _a[cacheKey]) ? target = this._prePointTargetCache[cacheKey] : (target = this.pickTarget(e.canvasX, e.canvasY),
|
|
155
|
+
if ((null === (_a = this._prePointTargetCache) || void 0 === _a ? void 0 : _a[cacheKey]) && (null === (_c = null === (_b = this._prePointTargetCache) || void 0 === _b ? void 0 : _b[cacheKey]) || void 0 === _c ? void 0 : _c.stage.renderCount) === (null === (_d = this._prePointTargetCache) || void 0 === _d ? void 0 : _d.stageRenderCount) ? target = this._prePointTargetCache[cacheKey] : (target = this.pickTarget(e.canvasX, e.canvasY),
|
|
156
156
|
this._prePointTargetCache = {
|
|
157
|
-
[cacheKey]: target
|
|
157
|
+
[cacheKey]: target,
|
|
158
|
+
stageRenderCount: null !== (_e = null == target ? void 0 : target.stage.renderCount) && void 0 !== _e ? _e : -1
|
|
158
159
|
}), mappers) for (let i = 0, j = mappers.length; i < j; i++) mappers[i].fn(e, target); else console.warn(`[EventManager]: Event mapping not defined for ${e.type}`);
|
|
159
160
|
}
|
|
160
161
|
propagate(e, type) {
|
|
@@ -256,7 +257,8 @@ class EventManager {
|
|
|
256
257
|
once: !0
|
|
257
258
|
}), listeners.fn.call(listeners.context, e); else for (let i = 0, j = listeners.length; i < j && !e.propagationImmediatelyStopped; i++) listeners[i].once && e.currentTarget.removeEventListener(type, listeners[i].fn, {
|
|
258
259
|
once: !0
|
|
259
|
-
}), listeners[i].fn.call(listeners[i].context, e);
|
|
260
|
+
}), listeners[i].fn.call(listeners[i].context, e);
|
|
261
|
+
this.emitDelegation(e, type);
|
|
260
262
|
}
|
|
261
263
|
emitDelegation(e, type) {
|
|
262
264
|
const listeners = e.currentTarget._events[constant_1.WILDCARD];
|