@visactor/vrender 0.12.3 → 0.13.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/canvas/contributions/browser/conical-gradient.d.ts +2 -2
- package/cjs/canvas/contributions/browser/conical-gradient.js +1 -1
- package/cjs/canvas/contributions/browser/conical-gradient.js.map +1 -1
- package/cjs/canvas/contributions/feishu/context.d.ts +2 -1
- package/cjs/canvas/contributions/feishu/context.js +3 -0
- package/cjs/canvas/contributions/feishu/context.js.map +1 -1
- package/cjs/canvas/contributions/lynx/context.d.ts +1 -0
- package/cjs/canvas/contributions/lynx/context.js +3 -0
- package/cjs/canvas/contributions/lynx/context.js.map +1 -1
- package/cjs/canvas/contributions/modules.d.ts +1 -1
- package/cjs/canvas/contributions/modules.js +2 -2
- package/cjs/canvas/contributions/modules.js.map +1 -1
- package/cjs/canvas/contributions/taro/context.d.ts +2 -1
- package/cjs/canvas/contributions/taro/context.js +3 -0
- package/cjs/canvas/contributions/taro/context.js.map +1 -1
- package/cjs/canvas/contributions/tt/context.d.ts +2 -1
- package/cjs/canvas/contributions/tt/context.js +3 -0
- package/cjs/canvas/contributions/tt/context.js.map +1 -1
- package/cjs/canvas/contributions/wx/canvas.d.ts +48 -0
- package/cjs/canvas/contributions/wx/canvas.js +102 -0
- package/cjs/canvas/contributions/wx/canvas.js.map +1 -0
- package/cjs/canvas/contributions/wx/context.d.ts +7 -0
- package/cjs/canvas/contributions/wx/context.js +24 -0
- package/cjs/canvas/contributions/wx/context.js.map +1 -0
- package/cjs/canvas/contributions/wx/index.d.ts +2 -0
- package/cjs/canvas/contributions/wx/index.js +21 -0
- package/cjs/canvas/contributions/wx/index.js.map +1 -0
- package/cjs/canvas/contributions/wx/modules.d.ts +3 -0
- package/cjs/canvas/contributions/wx/modules.js +13 -0
- package/cjs/canvas/contributions/wx/modules.js.map +1 -0
- package/cjs/common/contribution-provider.js +1 -1
- package/cjs/common/contribution-provider.js.map +1 -1
- package/cjs/common/render-area.d.ts +1 -1
- package/cjs/common/render-area.js +1 -0
- package/cjs/common/render-area.js.map +1 -1
- package/cjs/core/contributions/env/base-contribution.d.ts +3 -1
- package/cjs/core/contributions/env/base-contribution.js +6 -0
- package/cjs/core/contributions/env/base-contribution.js.map +1 -1
- package/cjs/core/contributions/env/feishu-contribution.d.ts +2 -0
- package/cjs/core/contributions/env/feishu-contribution.js +8 -2
- package/cjs/core/contributions/env/feishu-contribution.js.map +1 -1
- package/cjs/core/contributions/env/lynx-contribution.d.ts +2 -0
- package/cjs/core/contributions/env/lynx-contribution.js +18 -4
- package/cjs/core/contributions/env/lynx-contribution.js.map +1 -1
- package/cjs/core/contributions/env/modules.js +2 -1
- package/cjs/core/contributions/env/modules.js.map +1 -1
- package/cjs/core/contributions/env/node-contribution.d.ts +3 -1
- package/cjs/core/contributions/env/node-contribution.js +6 -0
- package/cjs/core/contributions/env/node-contribution.js.map +1 -1
- package/cjs/core/contributions/env/taro-contribution.d.ts +2 -0
- package/cjs/core/contributions/env/taro-contribution.js +8 -2
- package/cjs/core/contributions/env/taro-contribution.js.map +1 -1
- package/cjs/core/contributions/env/wx-contribution.d.ts +39 -0
- package/cjs/core/contributions/env/wx-contribution.js +131 -0
- package/cjs/core/contributions/env/wx-contribution.js.map +1 -0
- package/cjs/core/contributions/layerHandler/canvas2d-contribution.js +1 -1
- package/cjs/core/contributions/layerHandler/canvas2d-contribution.js.map +1 -1
- package/cjs/core/contributions/window/modules.js +2 -1
- package/cjs/core/contributions/window/modules.js.map +1 -1
- package/cjs/core/contributions/window/wx-contribution.d.ts +46 -0
- package/cjs/core/contributions/window/wx-contribution.js +159 -0
- package/cjs/core/contributions/window/wx-contribution.js.map +1 -0
- package/cjs/core/global.d.ts +5 -3
- package/cjs/core/global.js +19 -6
- package/cjs/core/global.js.map +1 -1
- package/cjs/core/layer-service.d.ts +4 -2
- package/cjs/core/layer-service.js +10 -6
- package/cjs/core/layer-service.js.map +1 -1
- package/cjs/core/layer.d.ts +3 -6
- package/cjs/core/layer.js +6 -6
- package/cjs/core/layer.js.map +1 -1
- package/cjs/core/stage.d.ts +7 -3
- package/cjs/core/stage.js +21 -9
- package/cjs/core/stage.js.map +1 -1
- package/cjs/graphic/builtin-symbol/circle.d.ts +1 -0
- package/cjs/graphic/builtin-symbol/circle.js +4 -0
- package/cjs/graphic/builtin-symbol/circle.js.map +1 -1
- package/cjs/graphic/graphic.d.ts +2 -0
- package/cjs/graphic/graphic.js +11 -0
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/graphic/text.js +1 -1
- package/cjs/graphic/text.js.map +1 -1
- package/cjs/index.d.ts +4 -1
- package/cjs/index.js +16 -15
- package/cjs/index.js.map +1 -1
- package/cjs/interface/contribution.d.ts +15 -37
- package/cjs/interface/contribution.js.map +1 -1
- package/cjs/interface/core.d.ts +2 -2
- package/cjs/interface/core.js.map +1 -1
- package/cjs/interface/global.d.ts +6 -1
- package/cjs/interface/global.js.map +1 -1
- package/cjs/interface/graphic/symbol.d.ts +1 -0
- package/cjs/interface/graphic/symbol.js.map +1 -1
- package/cjs/interface/graphic.d.ts +1 -0
- package/cjs/interface/graphic.js.map +1 -1
- package/cjs/interface/layer.d.ts +7 -0
- package/cjs/interface/layer.js.map +1 -1
- package/cjs/interface/plugin.d.ts +3 -1
- package/cjs/interface/plugin.js.map +1 -1
- package/cjs/interface/stage.d.ts +8 -2
- package/cjs/interface/stage.js.map +1 -1
- package/cjs/plugins/builtin-plugin/poptip-plugin.d.ts +1 -0
- package/cjs/plugins/builtin-plugin/poptip-plugin.js +3 -0
- package/cjs/plugins/builtin-plugin/poptip-plugin.js.map +1 -0
- package/cjs/plugins/constants.d.ts +2 -0
- package/cjs/plugins/constants.js +7 -0
- package/cjs/plugins/constants.js.map +1 -0
- package/cjs/plugins/plugin-modules.js +3 -2
- package/cjs/plugins/plugin-modules.js.map +1 -1
- package/cjs/plugins/plugin-service.d.ts +6 -4
- package/cjs/plugins/plugin-service.js +17 -8
- package/cjs/plugins/plugin-service.js.map +1 -1
- package/cjs/render/contributions/render/arc-render.d.ts +2 -1
- package/cjs/render/contributions/render/arc-render.js +48 -17
- package/cjs/render/contributions/render/arc-render.js.map +1 -1
- package/cjs/render/contributions/render/area-render.d.ts +1 -1
- package/cjs/render/contributions/render/area-render.js +22 -12
- package/cjs/render/contributions/render/area-render.js.map +1 -1
- package/cjs/render/contributions/render/circle-render.js +4 -4
- package/cjs/render/contributions/render/circle-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/arc-contribution-render.d.ts +2 -3
- package/cjs/render/contributions/render/contributions/arc-contribution-render.js +2 -4
- package/cjs/render/contributions/render/contributions/arc-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/area-contribution-render.d.ts +2 -3
- package/cjs/render/contributions/render/contributions/area-contribution-render.js +2 -4
- package/cjs/render/contributions/render/contributions/area-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/base-contribution-render.d.ts +17 -5
- package/cjs/render/contributions/render/contributions/base-contribution-render.js +28 -4
- package/cjs/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/circle-contribution-render.d.ts +2 -3
- package/cjs/render/contributions/render/contributions/circle-contribution-render.js +2 -4
- package/cjs/render/contributions/render/contributions/circle-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/constants.d.ts +11 -0
- package/cjs/render/contributions/render/contributions/constants.js +12 -0
- package/cjs/render/contributions/render/contributions/constants.js.map +1 -0
- package/cjs/render/contributions/render/contributions/group-contribution-render.d.ts +2 -3
- package/cjs/render/contributions/render/contributions/group-contribution-render.js +2 -4
- package/cjs/render/contributions/render/contributions/group-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/image-contribution-render.d.ts +2 -3
- package/cjs/render/contributions/render/contributions/image-contribution-render.js +2 -4
- package/cjs/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/path-contribution-render.d.ts +0 -1
- package/cjs/render/contributions/render/contributions/path-contribution-render.js +1 -3
- package/cjs/render/contributions/render/contributions/path-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/polygon-contribution-render.d.ts +0 -1
- package/cjs/render/contributions/render/contributions/polygon-contribution-render.js +1 -3
- package/cjs/render/contributions/render/contributions/polygon-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/rect-contribution-render.d.ts +4 -5
- package/cjs/render/contributions/render/contributions/rect-contribution-render.js +4 -6
- package/cjs/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/symbol-contribution-render.d.ts +2 -3
- package/cjs/render/contributions/render/contributions/symbol-contribution-render.js +2 -4
- package/cjs/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/text-contribution-render.d.ts +1 -0
- package/cjs/render/contributions/render/contributions/text-contribution-render.js +6 -0
- package/cjs/render/contributions/render/contributions/text-contribution-render.js.map +1 -0
- package/cjs/render/contributions/render/group-render.js +5 -5
- package/cjs/render/contributions/render/group-render.js.map +1 -1
- package/cjs/render/contributions/render/image-render.js +5 -5
- package/cjs/render/contributions/render/image-render.js.map +1 -1
- package/cjs/render/contributions/render/module.js +47 -36
- package/cjs/render/contributions/render/module.js.map +1 -1
- package/cjs/render/contributions/render/path-render.js +4 -4
- package/cjs/render/contributions/render/path-render.js.map +1 -1
- package/cjs/render/contributions/render/polygon-render.js +4 -4
- package/cjs/render/contributions/render/polygon-render.js.map +1 -1
- package/cjs/render/contributions/render/rect-render.js +4 -4
- package/cjs/render/contributions/render/rect-render.js.map +1 -1
- package/cjs/render/contributions/render/symbol-render.js +4 -4
- package/cjs/render/contributions/render/symbol-render.js.map +1 -1
- package/cjs/render/contributions/render/text-render.d.ts +5 -1
- package/cjs/render/contributions/render/text-render.js +26 -6
- package/cjs/render/contributions/render/text-render.js.map +1 -1
- package/cjs/render/index.d.ts +1 -0
- package/cjs/render/index.js +2 -1
- package/cjs/render/index.js.map +1 -1
- package/dist/index.js +3212 -2459
- package/dist/index.min.js +1 -1
- package/es/canvas/contributions/browser/conical-gradient.d.ts +2 -2
- package/es/canvas/contributions/browser/conical-gradient.js +1 -1
- package/es/canvas/contributions/browser/conical-gradient.js.map +1 -1
- package/es/canvas/contributions/feishu/context.d.ts +2 -1
- package/es/canvas/contributions/feishu/context.js +3 -0
- package/es/canvas/contributions/feishu/context.js.map +1 -1
- package/es/canvas/contributions/lynx/context.d.ts +1 -0
- package/es/canvas/contributions/lynx/context.js +3 -0
- package/es/canvas/contributions/lynx/context.js.map +1 -1
- package/es/canvas/contributions/modules.d.ts +1 -1
- package/es/canvas/contributions/modules.js +3 -1
- package/es/canvas/contributions/modules.js.map +1 -1
- package/es/canvas/contributions/taro/context.d.ts +2 -1
- package/es/canvas/contributions/taro/context.js +3 -0
- package/es/canvas/contributions/taro/context.js.map +1 -1
- package/es/canvas/contributions/tt/context.d.ts +2 -1
- package/es/canvas/contributions/tt/context.js +3 -0
- package/es/canvas/contributions/tt/context.js.map +1 -1
- package/es/canvas/contributions/wx/canvas.d.ts +48 -0
- package/es/canvas/contributions/wx/canvas.js +101 -0
- package/es/canvas/contributions/wx/canvas.js.map +1 -0
- package/es/canvas/contributions/wx/context.d.ts +7 -0
- package/es/canvas/contributions/wx/context.js +21 -0
- package/es/canvas/contributions/wx/context.js.map +1 -0
- package/es/canvas/contributions/wx/index.d.ts +2 -0
- package/es/canvas/contributions/wx/index.js +4 -0
- package/es/canvas/contributions/wx/index.js.map +1 -0
- package/es/canvas/contributions/wx/modules.d.ts +3 -0
- package/es/canvas/contributions/wx/modules.js +13 -0
- package/es/canvas/contributions/wx/modules.js.map +1 -0
- package/es/common/contribution-provider.js +1 -1
- package/es/common/contribution-provider.js.map +1 -1
- package/es/common/render-area.d.ts +1 -1
- package/es/common/render-area.js +1 -0
- package/es/common/render-area.js.map +1 -1
- package/es/core/contributions/env/base-contribution.d.ts +3 -1
- package/es/core/contributions/env/base-contribution.js +6 -0
- package/es/core/contributions/env/base-contribution.js.map +1 -1
- package/es/core/contributions/env/feishu-contribution.d.ts +2 -0
- package/es/core/contributions/env/feishu-contribution.js +8 -2
- package/es/core/contributions/env/feishu-contribution.js.map +1 -1
- package/es/core/contributions/env/lynx-contribution.d.ts +2 -0
- package/es/core/contributions/env/lynx-contribution.js +18 -4
- package/es/core/contributions/env/lynx-contribution.js.map +1 -1
- package/es/core/contributions/env/modules.js +3 -0
- package/es/core/contributions/env/modules.js.map +1 -1
- package/es/core/contributions/env/node-contribution.d.ts +3 -1
- package/es/core/contributions/env/node-contribution.js +6 -0
- package/es/core/contributions/env/node-contribution.js.map +1 -1
- package/es/core/contributions/env/taro-contribution.d.ts +2 -0
- package/es/core/contributions/env/taro-contribution.js +8 -2
- package/es/core/contributions/env/taro-contribution.js.map +1 -1
- package/es/core/contributions/env/wx-contribution.d.ts +39 -0
- package/es/core/contributions/env/wx-contribution.js +130 -0
- package/es/core/contributions/env/wx-contribution.js.map +1 -0
- package/es/core/contributions/layerHandler/canvas2d-contribution.js +1 -1
- package/es/core/contributions/layerHandler/canvas2d-contribution.js.map +1 -1
- package/es/core/contributions/window/modules.js +3 -0
- package/es/core/contributions/window/modules.js.map +1 -1
- package/es/core/contributions/window/wx-contribution.d.ts +46 -0
- package/es/core/contributions/window/wx-contribution.js +161 -0
- package/es/core/contributions/window/wx-contribution.js.map +1 -0
- package/es/core/global.d.ts +5 -3
- package/es/core/global.js +19 -6
- package/es/core/global.js.map +1 -1
- package/es/core/layer-service.d.ts +4 -2
- package/es/core/layer-service.js +10 -6
- package/es/core/layer-service.js.map +1 -1
- package/es/core/layer.d.ts +3 -6
- package/es/core/layer.js +7 -6
- package/es/core/layer.js.map +1 -1
- package/es/core/stage.d.ts +7 -3
- package/es/core/stage.js +22 -9
- package/es/core/stage.js.map +1 -1
- package/es/graphic/builtin-symbol/circle.d.ts +1 -0
- package/es/graphic/builtin-symbol/circle.js +4 -0
- package/es/graphic/builtin-symbol/circle.js.map +1 -1
- package/es/graphic/graphic.d.ts +2 -0
- package/es/graphic/graphic.js +11 -0
- package/es/graphic/graphic.js.map +1 -1
- package/es/graphic/text.js +1 -1
- package/es/graphic/text.js.map +1 -1
- package/es/index.d.ts +4 -1
- package/es/index.js +7 -1
- package/es/index.js.map +1 -1
- package/es/interface/contribution.d.ts +15 -37
- package/es/interface/contribution.js.map +1 -1
- package/es/interface/core.d.ts +2 -2
- package/es/interface/core.js.map +1 -1
- package/es/interface/global.d.ts +6 -1
- package/es/interface/global.js.map +1 -1
- package/es/interface/graphic/symbol.d.ts +1 -0
- package/es/interface/graphic/symbol.js.map +1 -1
- package/es/interface/graphic.d.ts +1 -0
- package/es/interface/graphic.js.map +1 -1
- package/es/interface/layer.d.ts +7 -0
- package/es/interface/layer.js.map +1 -1
- package/es/interface/plugin.d.ts +3 -1
- package/es/interface/plugin.js.map +1 -1
- package/es/interface/stage.d.ts +8 -2
- package/es/interface/stage.js.map +1 -1
- package/es/plugins/builtin-plugin/poptip-plugin.d.ts +1 -0
- package/es/plugins/builtin-plugin/poptip-plugin.js +3 -0
- package/es/plugins/builtin-plugin/poptip-plugin.js.map +1 -0
- package/es/plugins/constants.d.ts +2 -0
- package/es/plugins/constants.js +4 -0
- package/es/plugins/constants.js.map +1 -0
- package/es/plugins/plugin-modules.js +9 -2
- package/es/plugins/plugin-modules.js.map +1 -1
- package/es/plugins/plugin-service.d.ts +6 -4
- package/es/plugins/plugin-service.js +19 -6
- package/es/plugins/plugin-service.js.map +1 -1
- package/es/render/contributions/render/arc-render.d.ts +2 -1
- package/es/render/contributions/render/arc-render.js +47 -15
- package/es/render/contributions/render/arc-render.js.map +1 -1
- package/es/render/contributions/render/area-render.d.ts +1 -1
- package/es/render/contributions/render/area-render.js +21 -10
- package/es/render/contributions/render/area-render.js.map +1 -1
- package/es/render/contributions/render/circle-render.js +3 -3
- package/es/render/contributions/render/circle-render.js.map +1 -1
- package/es/render/contributions/render/contributions/arc-contribution-render.d.ts +2 -3
- package/es/render/contributions/render/contributions/arc-contribution-render.js +1 -3
- package/es/render/contributions/render/contributions/arc-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/area-contribution-render.d.ts +2 -3
- package/es/render/contributions/render/contributions/area-contribution-render.js +1 -3
- package/es/render/contributions/render/contributions/area-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/base-contribution-render.d.ts +17 -5
- package/es/render/contributions/render/contributions/base-contribution-render.js +30 -3
- package/es/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/circle-contribution-render.d.ts +2 -3
- package/es/render/contributions/render/contributions/circle-contribution-render.js +1 -3
- package/es/render/contributions/render/contributions/circle-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/constants.d.ts +11 -0
- package/es/render/contributions/render/contributions/constants.js +22 -0
- package/es/render/contributions/render/contributions/constants.js.map +1 -0
- package/es/render/contributions/render/contributions/group-contribution-render.d.ts +2 -3
- package/es/render/contributions/render/contributions/group-contribution-render.js +1 -3
- package/es/render/contributions/render/contributions/group-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/image-contribution-render.d.ts +2 -3
- package/es/render/contributions/render/contributions/image-contribution-render.js +1 -3
- package/es/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/path-contribution-render.d.ts +0 -1
- package/es/render/contributions/render/contributions/path-contribution-render.js +0 -2
- package/es/render/contributions/render/contributions/path-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/polygon-contribution-render.d.ts +0 -1
- package/es/render/contributions/render/contributions/polygon-contribution-render.js +0 -2
- package/es/render/contributions/render/contributions/polygon-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/rect-contribution-render.d.ts +4 -5
- package/es/render/contributions/render/contributions/rect-contribution-render.js +3 -5
- package/es/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/symbol-contribution-render.d.ts +2 -3
- package/es/render/contributions/render/contributions/symbol-contribution-render.js +1 -3
- package/es/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/text-contribution-render.d.ts +1 -0
- package/es/render/contributions/render/contributions/text-contribution-render.js +2 -0
- package/es/render/contributions/render/contributions/text-contribution-render.js.map +1 -0
- package/es/render/contributions/render/group-render.js +3 -3
- package/es/render/contributions/render/group-render.js.map +1 -1
- package/es/render/contributions/render/image-render.js +3 -3
- package/es/render/contributions/render/image-render.js.map +1 -1
- package/es/render/contributions/render/module.js +28 -14
- package/es/render/contributions/render/module.js.map +1 -1
- package/es/render/contributions/render/path-render.js +3 -3
- package/es/render/contributions/render/path-render.js.map +1 -1
- package/es/render/contributions/render/polygon-render.js +3 -3
- package/es/render/contributions/render/polygon-render.js.map +1 -1
- package/es/render/contributions/render/rect-render.js +3 -3
- package/es/render/contributions/render/rect-render.js.map +1 -1
- package/es/render/contributions/render/symbol-render.js +3 -3
- package/es/render/contributions/render/symbol-render.js.map +1 -1
- package/es/render/contributions/render/text-render.d.ts +5 -1
- package/es/render/contributions/render/text-render.js +30 -6
- package/es/render/contributions/render/text-render.js.map +1 -1
- package/es/render/index.d.ts +1 -0
- package/es/render/index.js +2 -0
- package/es/render/index.js.map +1 -1
- package/es/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -24,7 +24,7 @@ import { cornerTangents, drawArcPath, drawPathProxy, fillVisible, intersect, run
|
|
|
24
24
|
|
|
25
25
|
import { getConicGradientAt } from "../../../canvas/contributions/browser/conical-gradient";
|
|
26
26
|
|
|
27
|
-
import { ArcRenderContribution } from "./contributions/
|
|
27
|
+
import { ArcRenderContribution } from "./contributions/constants";
|
|
28
28
|
|
|
29
29
|
import { BaseRenderContributionTime } from "../../../common/enums";
|
|
30
30
|
|
|
@@ -32,7 +32,8 @@ import { ARC_NUMBER_TYPE } from "../../../graphic/constants";
|
|
|
32
32
|
|
|
33
33
|
let DefaultCanvasArcRender = class {
|
|
34
34
|
constructor(arcRenderContribitions) {
|
|
35
|
-
this.arcRenderContribitions = arcRenderContribitions, this.numberType = ARC_NUMBER_TYPE
|
|
35
|
+
this.arcRenderContribitions = arcRenderContribitions, this.numberType = ARC_NUMBER_TYPE,
|
|
36
|
+
this._arcBeforeRenderContribitions = [], this._arcAfterRenderContribitions = [];
|
|
36
37
|
}
|
|
37
38
|
drawArcTailCapPath(arc, context, cx, cy, outerRadius, innerRadius, _sa, _ea) {
|
|
38
39
|
const capAngle = _ea - _sa, data = arc.getParsedAngle(), startAngle = data.startAngle;
|
|
@@ -84,17 +85,38 @@ let DefaultCanvasArcRender = class {
|
|
|
84
85
|
if (!arc.valid || !visible) return;
|
|
85
86
|
if (!(doFill || doStroke || background)) return;
|
|
86
87
|
if (!(fVisible || sVisible || fillCb || strokeCb || background)) return;
|
|
87
|
-
const {outerRadius: outerRadius = arcAttribute.outerRadius, innerRadius: innerRadius = arcAttribute.innerRadius, cap: cap = arcAttribute.cap, forceShowCap: forceShowCap = arcAttribute.forceShowCap} = arc.attribute
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
88
|
+
const {outerRadius: outerRadius = arcAttribute.outerRadius, innerRadius: innerRadius = arcAttribute.innerRadius, cap: cap = arcAttribute.cap, forceShowCap: forceShowCap = arcAttribute.forceShowCap} = arc.attribute;
|
|
89
|
+
let beforeRenderContribitionsRuned = !1;
|
|
90
|
+
const {isFullStroke: isFullStroke, stroke: arrayStroke} = parseStroke(stroke);
|
|
91
|
+
if (doFill || isFullStroke || background) {
|
|
92
|
+
if (context.beginPath(), drawArcPath(arc, context, x, y, outerRadius, innerRadius),
|
|
93
|
+
!this._arcBeforeRenderContribitions) {
|
|
94
|
+
const contributions = this.arcRenderContribitions.getContributions() || [];
|
|
95
|
+
contributions.sort(((a, b) => b.order - a.order)), contributions.forEach((c => {
|
|
96
|
+
c.time === BaseRenderContributionTime.beforeFillStroke ? this._arcBeforeRenderContribitions.push(c) : this._arcAfterRenderContribitions.push(c);
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
beforeRenderContribitionsRuned = !0, this._arcBeforeRenderContribitions.forEach((c => {
|
|
100
|
+
c.drawShape(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb);
|
|
101
|
+
})), context.setShadowStyle && context.setShadowStyle(arc, arc.attribute, arcAttribute),
|
|
102
|
+
doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute),
|
|
103
|
+
context.fill())), doStroke && isFullStroke && (strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute),
|
|
104
|
+
context.stroke()));
|
|
105
|
+
}
|
|
106
|
+
if (!isFullStroke && doStroke) {
|
|
96
107
|
context.beginPath();
|
|
97
108
|
drawArcPath(arc, context, x, y, outerRadius, innerRadius, arrayStroke);
|
|
109
|
+
if (!beforeRenderContribitionsRuned) {
|
|
110
|
+
if (!this._arcBeforeRenderContribitions) {
|
|
111
|
+
const contributions = this.arcRenderContribitions.getContributions() || [];
|
|
112
|
+
contributions.sort(((a, b) => b.order - a.order)), contributions.forEach((c => {
|
|
113
|
+
c.time === BaseRenderContributionTime.beforeFillStroke ? this._arcBeforeRenderContribitions.push(c) : this._arcAfterRenderContribitions.push(c);
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
116
|
+
beforeRenderContribitionsRuned = !0, this._arcBeforeRenderContribitions.forEach((c => {
|
|
117
|
+
c.drawShape(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb);
|
|
118
|
+
}));
|
|
119
|
+
}
|
|
98
120
|
strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute),
|
|
99
121
|
context.stroke());
|
|
100
122
|
}
|
|
@@ -104,7 +126,18 @@ let DefaultCanvasArcRender = class {
|
|
|
104
126
|
context.beginPath();
|
|
105
127
|
const capAngle = Math.abs(outerRadius - innerRadius) / 2 / outerRadius, {endAngle: endAngle = arcAttribute.endAngle, fill: fill = arcAttribute.fill} = arc.attribute, startAngle = endAngle;
|
|
106
128
|
if (this.drawArcTailCapPath(arc, context, x, y, outerRadius, innerRadius, startAngle, startAngle + capAngle),
|
|
107
|
-
|
|
129
|
+
!beforeRenderContribitionsRuned) {
|
|
130
|
+
if (!this._arcBeforeRenderContribitions) {
|
|
131
|
+
const contributions = this.arcRenderContribitions.getContributions() || [];
|
|
132
|
+
contributions.sort(((a, b) => b.order - a.order)), contributions.forEach((c => {
|
|
133
|
+
c.time === BaseRenderContributionTime.beforeFillStroke ? this._arcBeforeRenderContribitions.push(c) : this._arcAfterRenderContribitions.push(c);
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
beforeRenderContribitionsRuned = !0, this._arcBeforeRenderContribitions.forEach((c => {
|
|
137
|
+
c.drawShape(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb);
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
if (doFill) {
|
|
108
141
|
const color = fill;
|
|
109
142
|
if ("conical" === color.gradient) {
|
|
110
143
|
const lastColor = getConicGradientAt(0, 0, endAngle, color);
|
|
@@ -116,9 +149,8 @@ let DefaultCanvasArcRender = class {
|
|
|
116
149
|
context.stroke()));
|
|
117
150
|
}
|
|
118
151
|
}
|
|
119
|
-
this.
|
|
120
|
-
|
|
121
|
-
c.time === BaseRenderContributionTime.afterFillStroke && c.drawShape(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, fillCb, strokeCb);
|
|
152
|
+
this._arcAfterRenderContribitions.forEach((c => {
|
|
153
|
+
c.drawShape(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb);
|
|
122
154
|
}));
|
|
123
155
|
}
|
|
124
156
|
draw(arc, renderService, drawContext, params) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/render/contributions/render/arc-render.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAgB7E,OAAO,EACL,cAAc,EACd,WAAW,EACX,aAAa,EACb,WAAW,EACX,SAAS,EACT,OAAO,EACP,SAAS,EACT,aAAa,EACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,kBAAkB,EAAE,MAAM,wDAAwD,CAAC;AAC5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAmBtD,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAKjC,YAGqB,sBAAqE;QAArE,2BAAsB,GAAtB,sBAAsB,CAA+C;QAN1F,eAAU,GAAW,eAAe,CAAC;IAOlC,CAAC;IA+PJ,kBAAkB,CAChB,GAAS,EACT,OAA6B,EAC7B,EAAU,EACV,EAAU,EACV,WAAmB,EACnB,WAAmB,EACnB,GAAW,EACX,GAAW;QAEX,MAAM,QAAQ,GAAG,GAAG,GAAG,GAAG,CAAC;QAC3B,MAAM,IAA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@visactor/vutils';\nimport { inject, injectable, named } from 'inversify';\nimport { getTheme } from '../../../graphic/theme';\nimport { parseStroke } from '../../../common/utils';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport type {\n IContext2d,\n IArc,\n IPath2D,\n IGraphicAttribute,\n IMarkAttribute,\n IThemeAttribute,\n IGradientColor,\n IArcRenderContribution,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider\n} from '../../../interface';\nimport {\n cornerTangents,\n drawArcPath,\n drawPathProxy,\n fillVisible,\n intersect,\n runFill,\n runStroke,\n strokeVisible\n} from './utils';\nimport { getConicGradientAt } from '../../../canvas/contributions/browser/conical-gradient';\nimport { ArcRenderContribution } from './contributions/arc-contribution-render';\nimport { BaseRenderContributionTime } from '../../../common/enums';\nimport { ARC_NUMBER_TYPE } from '../../../graphic/constants';\n/**\n * 部分源码参考 https://github.com/d3/d3-shape/\n * Copyright 2010-2022 Mike Bostock\n\n Permission to use, copy, modify, and/or distribute this software for any purpose\n with or without fee is hereby granted, provided that the above copyright notice\n and this permission notice appear in all copies.\n\n THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS\n OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER\n TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF\n THIS SOFTWARE.\n */\n\n@injectable()\nexport class DefaultCanvasArcRender implements IGraphicRender {\n type: 'arc';\n numberType: number = ARC_NUMBER_TYPE;\n\n protected _arcRenderContribitions: IArcRenderContribution[];\n constructor(\n @inject(ContributionProvider)\n @named(ArcRenderContribution)\n protected readonly arcRenderContribitions: IContributionProvider<IArcRenderContribution>\n ) {}\n\n // drawArcPath(\n // arc: IArc,\n // context: IContext2d | IPath2D,\n // cx: number,\n // cy: number,\n // outerRadius: number,\n // innerRadius: number,\n // partStroke?: boolean[]\n // ) {\n // const { startAngle, endAngle } = arc.getParsedAngle();\n\n // const deltaAngle = abs(endAngle - startAngle);\n // const clockwise: boolean = endAngle > startAngle;\n // let collapsedToLine: boolean = false;\n // // 规范化outerRadius和innerRadius\n // if (outerRadius < innerRadius) {\n // const temp = outerRadius;\n // outerRadius = innerRadius;\n // innerRadius = temp;\n // }\n // // Is it a point?\n // if (outerRadius <= epsilon) {\n // context.moveTo(cx, cy);\n // } else if (deltaAngle >= pi2 - epsilon) {\n // // 是个完整的圆环\n // // Or is it a circle or annulus?\n // context.moveTo(cx + outerRadius * cos(startAngle), cy + outerRadius * sin(startAngle));\n // context.arc(cx, cy, outerRadius, startAngle, endAngle, !clockwise);\n // if (innerRadius > epsilon) {\n // context.moveTo(cx + innerRadius * cos(endAngle), cy + innerRadius * sin(endAngle));\n // context.arc(cx, cy, innerRadius, endAngle, startAngle, clockwise);\n // }\n // } else {\n // const cornerRadius = arc.getParsedCornerRadius();\n // // Or is it a circular or annular sector?\n // const { outerDeltaAngle, innerDeltaAngle, outerStartAngle, outerEndAngle, innerEndAngle, innerStartAngle } =\n // arc.getParsePadAngle(startAngle, endAngle);\n\n // const outerCornerRadiusStart = cornerRadius;\n // const outerCornerRadiusEnd = cornerRadius;\n // const innerCornerRadiusEnd = cornerRadius;\n // const innerCornerRadiusStart = cornerRadius;\n // const maxOuterCornerRadius = Math.max(outerCornerRadiusEnd, outerCornerRadiusStart);\n // const maxInnerCornerRadius = Math.max(innerCornerRadiusEnd, innerCornerRadiusStart);\n // let limitedOcr = maxOuterCornerRadius;\n // let limitedIcr = maxInnerCornerRadius;\n\n // const xors = outerRadius * cos(outerStartAngle);\n // const yors = outerRadius * sin(outerStartAngle);\n // const xire = innerRadius * cos(innerEndAngle);\n // const yire = innerRadius * sin(innerEndAngle);\n\n // // Apply rounded corners?\n // let xore: number;\n // let yore: number;\n // let xirs: number;\n // let yirs: number;\n\n // if (maxInnerCornerRadius > epsilon || maxOuterCornerRadius > epsilon) {\n // xore = outerRadius * cos(outerEndAngle);\n // yore = outerRadius * sin(outerEndAngle);\n // xirs = innerRadius * cos(innerStartAngle);\n // yirs = innerRadius * sin(innerStartAngle);\n\n // // Restrict the corner radius according to the sector angle.\n // if (deltaAngle < pi) {\n // const oc = intersect(xors, yors, xirs, yirs, xore, yore, xire, yire);\n\n // if (oc) {\n // const ax = xors - oc[0];\n // const ay = yors - oc[1];\n // const bx = xore - oc[0];\n // const by = yore - oc[1];\n // const kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2);\n // const lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);\n\n // limitedIcr = min(maxInnerCornerRadius, (innerRadius - lc) / (kc - 1));\n // limitedOcr = min(maxOuterCornerRadius, (outerRadius - lc) / (kc + 1));\n // }\n // }\n // }\n\n // // Is the sector collapsed to a line?\n // // 角度过小,会将acr处理为圆心到半径的一条线\n // if (outerDeltaAngle < 0.001) {\n // // 如果有左右边的话\n // if (partStroke && (partStroke[3] || partStroke[1])) {\n // context.moveTo(cx + xors, cy + yors);\n // }\n // collapsedToLine = true;\n // } else if (limitedOcr > epsilon) {\n // const cornerRadiusStart = min(outerCornerRadiusStart, limitedOcr);\n // const cornerRadiusEnd = min(outerCornerRadiusEnd, limitedOcr);\n // // Does the sector’s outer ring have rounded corners?\n // const t0 = cornerTangents(xirs, yirs, xors, yors, outerRadius, cornerRadiusStart, Number(clockwise));\n // const t1 = cornerTangents(xore, yore, xire, yire, outerRadius, cornerRadiusEnd, Number(clockwise));\n\n // // Have the corners merged?\n // if (limitedOcr < maxOuterCornerRadius && cornerRadiusStart === cornerRadiusEnd) {\n // if (!partStroke || partStroke[0]) {\n // context.moveTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01);\n // context.arc(cx + t0.cx, cy + t0.cy, limitedOcr, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !clockwise);\n // } else {\n // context.moveTo(\n // cx + t0.cx + limitedOcr * cos(atan2(t1.y01, t1.x01)),\n // cy + t0.cy + limitedOcr * sin(atan2(t1.y01, t1.x01))\n // );\n // }\n // } else {\n // // Otherwise, draw the two corners and the ring.\n // if (!partStroke || partStroke[0]) {\n // context.moveTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01);\n // cornerRadiusStart > 0 &&\n // context.arc(\n // cx + t0.cx,\n // cy + t0.cy,\n // cornerRadiusStart,\n // atan2(t0.y01, t0.x01),\n // atan2(t0.y11, t0.x11),\n // !clockwise\n // );\n // context.arc(\n // cx,\n // cy,\n // outerRadius,\n // atan2(t0.cy + t0.y11, t0.cx + t0.x11),\n // atan2(t1.cy + t1.y11, t1.cx + t1.x11),\n // !clockwise\n // );\n // cornerRadiusEnd > 0 &&\n // context.arc(\n // cx + t1.cx,\n // cy + t1.cy,\n // cornerRadiusEnd,\n // atan2(t1.y11, t1.x11),\n // atan2(t1.y01, t1.x01),\n // !clockwise\n // );\n // } else {\n // if (cornerRadiusEnd > 0) {\n // context.moveTo(\n // cx + t1.cx + cornerRadiusEnd * cos(atan2(t1.y01, t1.x01)),\n // cy + t1.cy + cornerRadiusEnd * sin(atan2(t1.y01, t1.x01))\n // );\n // } else {\n // context.moveTo(cx + xore, cy + outerRadius * sin(outerEndAngle));\n // }\n // }\n // }\n // } else {\n // // Or is the outer ring just a circular arc?\n // if (!partStroke || partStroke[0]) {\n // context.moveTo(cx + xors, cy + yors);\n // context.arc(cx, cy, outerRadius, outerStartAngle, outerEndAngle, !clockwise);\n // } else {\n // // context.moveTo(cx + outerRadius * cos(outerEndAngle), cy + yore);\n // }\n // }\n // // Is there no inner ring, and it’s a circular sector?\n // // Or perhaps it’s an annular sector collapsed due to padding?\n // if (!(innerRadius > epsilon) || innerDeltaAngle < 0.001) {\n // if (!partStroke || partStroke[1]) {\n // context.lineTo(cx + xire, cy + yire);\n // } else {\n // context.moveTo(cx + xire, cy + yire);\n // }\n // collapsedToLine = true;\n // } else if (limitedIcr > epsilon) {\n // const cornerRadiusStart = min(innerCornerRadiusStart, limitedIcr);\n // const cornerRadiusEnd = min(innerCornerRadiusEnd, limitedIcr);\n // // Does the sector’s inner ring (or point) have rounded corners?\n // const t0 = cornerTangents(xire, yire, xore, yore, innerRadius, -cornerRadiusEnd, Number(clockwise));\n // const t1 = cornerTangents(xors, yors, xirs, yirs, innerRadius, -cornerRadiusStart, Number(clockwise));\n\n // if (!partStroke || partStroke[1]) {\n // context.lineTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01);\n // } else {\n // context.moveTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01);\n // }\n\n // // Have the corners merged?\n // if (limitedIcr < maxInnerCornerRadius && cornerRadiusStart === cornerRadiusEnd) {\n // const arcEndAngle = atan2(t1.y01, t1.x01);\n // if (!partStroke || partStroke[2]) {\n // context.arc(cx + t0.cx, cy + t0.cy, limitedIcr, atan2(t0.y01, t0.x01), arcEndAngle, !clockwise);\n // } else {\n // context.moveTo(cx + t0.cx + cos(arcEndAngle), cy + t0.cy + sin(arcEndAngle));\n // }\n // } else {\n // // Otherwise, draw the two corners and the ring.\n // if (!partStroke || partStroke[2]) {\n // cornerRadiusEnd > 0 &&\n // context.arc(\n // cx + t0.cx,\n // cy + t0.cy,\n // cornerRadiusEnd,\n // atan2(t0.y01, t0.x01),\n // atan2(t0.y11, t0.x11),\n // !clockwise\n // );\n // context.arc(\n // cx,\n // cy,\n // innerRadius,\n // atan2(t0.cy + t0.y11, t0.cx + t0.x11),\n // atan2(t1.cy + t1.y11, t1.cx + t1.x11),\n // clockwise\n // );\n // cornerRadiusStart > 0 &&\n // context.arc(\n // cx + t1.cx,\n // cy + t1.cy,\n // cornerRadiusStart,\n // atan2(t1.y11, t1.x11),\n // atan2(t1.y01, t1.x01),\n // !clockwise\n // );\n // } else {\n // if (cornerRadiusStart > 0) {\n // context.moveTo(\n // cx + t1.cx + cornerRadiusStart * cos(atan2(t1.y01, t1.x01)),\n // cy + t1.cy + cornerRadiusStart * sin(atan2(t1.y01, t1.x01))\n // );\n // } else {\n // context.moveTo(cx + xirs, cy + yirs);\n // }\n // }\n // }\n // } else {\n // // Or is the inner ring just a circular arc?\n // if (!partStroke || partStroke[1]) {\n // context.lineTo(cx + xire, cy + yire);\n // } else {\n // context.moveTo(cx + xire, cy + yire);\n // }\n // if (!partStroke || partStroke[2]) {\n // context.arc(cx, cy, innerRadius, innerEndAngle, innerStartAngle, clockwise);\n // } else {\n // context.moveTo(cx + innerRadius * cos(innerStartAngle), cy + innerRadius * sin(innerStartAngle));\n // }\n // }\n // }\n\n // if (!partStroke) {\n // context.closePath();\n // } else if (partStroke[3]) {\n // context.lineTo(cx + outerRadius * cos(endAngle), cy + outerRadius * cos(endAngle));\n // }\n\n // return collapsedToLine;\n // }\n\n // 绘制尾部cap\n drawArcTailCapPath(\n arc: IArc,\n context: IContext2d | IPath2D,\n cx: number,\n cy: number,\n outerRadius: number,\n innerRadius: number,\n _sa: number,\n _ea: number\n ) {\n const capAngle = _ea - _sa;\n const data = arc.getParsedAngle();\n const startAngle = data.startAngle;\n let endAngle = data.endAngle;\n endAngle = _ea;\n const deltaAngle = abs(endAngle - startAngle);\n const clockwise: boolean = endAngle > startAngle;\n let collapsedToLine: boolean = false;\n // 规范化outerRadius和innerRadius\n if (outerRadius < innerRadius) {\n const temp = outerRadius;\n outerRadius = innerRadius;\n innerRadius = temp;\n }\n\n const cornerRadius = arc.getParsedCornerRadius();\n // Or is it a circular or annular sector?\n const { outerDeltaAngle, innerDeltaAngle, outerStartAngle, outerEndAngle, innerEndAngle, innerStartAngle } =\n arc.getParsePadAngle(startAngle, endAngle);\n\n const outerCornerRadiusStart = cornerRadius;\n const outerCornerRadiusEnd = cornerRadius;\n const innerCornerRadiusEnd = cornerRadius;\n const innerCornerRadiusStart = cornerRadius;\n const maxOuterCornerRadius = Math.max(outerCornerRadiusEnd, outerCornerRadiusStart);\n const maxInnerCornerRadius = Math.max(innerCornerRadiusEnd, innerCornerRadiusStart);\n let limitedOcr = maxOuterCornerRadius;\n let limitedIcr = maxInnerCornerRadius;\n\n const xors = outerRadius * cos(outerStartAngle);\n const yors = outerRadius * sin(outerStartAngle);\n const xire = innerRadius * cos(innerEndAngle);\n const yire = innerRadius * sin(innerEndAngle);\n\n // Apply rounded corners?\n let xore: number;\n let yore: number;\n let xirs: number;\n let yirs: number;\n\n if (maxInnerCornerRadius > epsilon || maxOuterCornerRadius > epsilon) {\n xore = outerRadius * cos(outerEndAngle);\n yore = outerRadius * sin(outerEndAngle);\n xirs = innerRadius * cos(innerStartAngle);\n yirs = innerRadius * sin(innerStartAngle);\n\n // Restrict the corner radius according to the sector angle.\n if (deltaAngle < pi) {\n const oc = intersect(xors, yors, xirs, yirs, xore, yore, xire, yire);\n\n if (oc) {\n const ax = xors - oc[0];\n const ay = yors - oc[1];\n const bx = xore - oc[0];\n const by = yore - oc[1];\n const kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2);\n const lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);\n\n limitedIcr = min(maxInnerCornerRadius, (innerRadius - lc) / (kc - 1));\n limitedOcr = min(maxOuterCornerRadius, (outerRadius - lc) / (kc + 1));\n }\n }\n }\n\n if (limitedOcr > epsilon) {\n const cornerRadiusStart = min(outerCornerRadiusStart, limitedOcr);\n const cornerRadiusEnd = min(outerCornerRadiusEnd, limitedOcr);\n // Does the sector’s outer ring have rounded corners?\n const t0 = cornerTangents(xirs, yirs, xors, yors, outerRadius, cornerRadiusStart, Number(clockwise));\n const t1 = cornerTangents(xore, yore, xire, yire, outerRadius, cornerRadiusEnd, Number(clockwise));\n\n // Have the corners merged?\n if (limitedOcr < maxOuterCornerRadius && cornerRadiusStart === cornerRadiusEnd) {\n context.moveTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01);\n context.arc(cx + t0.cx, cy + t0.cy, limitedOcr, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !clockwise);\n } else {\n const a1 = endAngle - capAngle - 0.03;\n const a2 = atan2(t1.y11, t1.x11);\n context.arc(cx, cy, outerRadius, a1, a2, !clockwise);\n cornerRadiusEnd > 0 &&\n context.arc(\n cx + t1.cx,\n cy + t1.cy,\n cornerRadiusEnd,\n atan2(t1.y11, t1.x11),\n atan2(t1.y01, t1.x01),\n !clockwise\n );\n }\n } else {\n context.moveTo(cx + xors, cy + yors);\n }\n // else {\n // // Or is the outer ring just a circular arc?\n // if (!partStroke || partStroke[0]) {\n // context.moveTo(cx + xors, cy + yors);\n // context.arc(cx, cy, outerRadius, outerStartAngle, outerEndAngle, !clockwise);\n // } else {\n // // context.moveTo(cx + outerRadius * cos(outerEndAngle), cy + yore);\n // }\n // }\n // // Is there no inner ring, and it’s a circular sector?\n // // Or perhaps it’s an annular sector collapsed due to padding?\n if (!(innerRadius > epsilon) || innerDeltaAngle < 0.001) {\n context.lineTo(cx + xire, cy + yire);\n collapsedToLine = true;\n } else if (limitedIcr > epsilon) {\n const cornerRadiusStart = min(innerCornerRadiusStart, limitedIcr);\n const cornerRadiusEnd = min(innerCornerRadiusEnd, limitedIcr);\n // Does the sector’s inner ring (or point) have rounded corners?\n const t0 = cornerTangents(xire, yire, xore, yore, innerRadius, -cornerRadiusEnd, Number(clockwise));\n const t1 = cornerTangents(xors, yors, xirs, yirs, innerRadius, -cornerRadiusStart, Number(clockwise));\n\n context.lineTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01);\n\n // Have the corners merged?\n if (limitedIcr < maxInnerCornerRadius && cornerRadiusStart === cornerRadiusEnd) {\n const arcEndAngle = atan2(t1.y01, t1.x01);\n context.arc(cx + t0.cx, cy + t0.cy, limitedIcr, atan2(t0.y01, t0.x01), arcEndAngle, !clockwise);\n } else {\n cornerRadiusEnd > 0 &&\n context.arc(\n cx + t0.cx,\n cy + t0.cy,\n cornerRadiusEnd,\n atan2(t0.y01, t0.x01),\n atan2(t0.y11, t0.x11),\n !clockwise\n );\n const a1 = atan2(t0.cy + t0.y11, t0.cx + t0.x11);\n const a2 = endAngle - capAngle - 0.03;\n context.arc(cx, cy, innerRadius, a1, a2, clockwise);\n }\n } else {\n context.lineTo(cx + innerRadius * cos(innerStartAngle), cy + innerRadius * sin(innerStartAngle));\n }\n\n return collapsedToLine;\n }\n\n drawShape(\n arc: IArc,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n // const arcAttribute = graphicService.themeService.getCurrentTheme().arcAttribute;\n const arcAttribute = getTheme(arc, params?.theme).arc;\n const {\n fill = arcAttribute.fill,\n background,\n stroke = arcAttribute.stroke,\n opacity = arcAttribute.opacity,\n fillOpacity = arcAttribute.fillOpacity,\n lineWidth = arcAttribute.lineWidth,\n strokeOpacity = arcAttribute.strokeOpacity,\n visible = arcAttribute.visible,\n x: originX = arcAttribute.x,\n y: originY = arcAttribute.y\n } = arc.attribute;\n // 不绘制或者透明\n const fVisible = fillVisible(opacity, fillOpacity);\n const sVisible = strokeVisible(opacity, strokeOpacity);\n const doFill = runFill(fill);\n const doStroke = runStroke(stroke, lineWidth);\n\n if (!(arc.valid && visible)) {\n return;\n }\n\n if (!(doFill || doStroke || background)) {\n return;\n }\n\n // 如果存在fillCb和strokeCb,那就不直接跳过\n if (!(fVisible || sVisible || fillCb || strokeCb || background)) {\n return;\n }\n\n const {\n outerRadius = arcAttribute.outerRadius,\n innerRadius = arcAttribute.innerRadius,\n cap = arcAttribute.cap,\n forceShowCap = arcAttribute.forceShowCap\n } = arc.attribute;\n\n const { isFullStroke, stroke: arrayStroke } = parseStroke(stroke);\n if (doFill || isFullStroke || background) {\n context.beginPath();\n // if (arc.shouldUpdateShape()) {\n // // 更新shape\n // arc.cache = new Path2D(context);\n // this.drawArcPath(arc, arc.cache, x, y, outerRadius, innerRadius);\n // arc.clearUpdateShapeTag();\n // } else {\n // if (arc.cache) {\n // renderCommandList(arc.cache.commandList, context);\n // }\n // }\n // 测试后,cache对于重绘性能提升不大,但是在首屏有一定性能损耗,因此arc不再使用cache\n drawArcPath(arc, context, x, y, outerRadius, innerRadius);\n\n if (!this._arcRenderContribitions) {\n this._arcRenderContribitions = this.arcRenderContribitions.getContributions() || [];\n this._arcRenderContribitions.sort((a, b) => b.order - a.order);\n }\n this._arcRenderContribitions.forEach(c => {\n if (c.time === BaseRenderContributionTime.beforeFillStroke) {\n // c.useStyle && context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute);\n c.drawShape(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, fillCb, strokeCb);\n }\n });\n\n // shadow\n context.setShadowStyle && context.setShadowStyle(arc, arc.attribute, arcAttribute);\n\n if (doFill) {\n if (fillCb) {\n fillCb(context, arc.attribute, arcAttribute);\n } else if (fVisible) {\n context.setCommonStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute);\n context.fill();\n }\n }\n\n if (doStroke && isFullStroke) {\n if (strokeCb) {\n strokeCb(context, arc.attribute, arcAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute);\n context.stroke();\n }\n }\n }\n\n // 需要局部渲染描边的时候\n if (!isFullStroke && doStroke) {\n context.beginPath();\n const collapsedToLine = drawArcPath(arc, context, x, y, outerRadius, innerRadius, arrayStroke);\n\n if (strokeCb) {\n strokeCb(context, arc.attribute, arcAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute);\n context.stroke();\n }\n }\n\n // 绘制cap\n if (cap && forceShowCap) {\n const { startAngle: sa, endAngle: ea } = arc.getParsedAngle();\n const deltaAngle = abs(ea - sa);\n if (deltaAngle >= pi2 - epsilon) {\n context.beginPath();\n const capWidth = Math.abs(outerRadius - innerRadius) / 2;\n // 以外边界长度为准\n const capAngle = capWidth / outerRadius;\n const { endAngle = arcAttribute.endAngle, fill = arcAttribute.fill } = arc.attribute;\n const startAngle = endAngle;\n this.drawArcTailCapPath(arc, context, x, y, outerRadius, innerRadius, startAngle, startAngle + capAngle);\n if (doFill) {\n // 获取渐变色最后一个颜色\n const color = fill;\n if ((color as IGradientColor).gradient === 'conical') {\n const lastColor = getConicGradientAt(0, 0, endAngle, color as any);\n if (fillCb) {\n // fillCb(context, arc.attribute, arcAttribute);\n } else if (fillVisible) {\n // context.closePath();\n context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute);\n context.fillStyle = lastColor as string;\n context.fill();\n }\n }\n }\n if (doStroke) {\n if (strokeCb) {\n // fillCb(context, arc.attribute, arcAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute);\n // context.strokeStyle = 'red';\n context.stroke();\n }\n }\n }\n }\n\n if (!this._arcRenderContribitions) {\n this._arcRenderContribitions = this.arcRenderContribitions.getContributions() || [];\n }\n this._arcRenderContribitions.forEach(c => {\n if (c.time === BaseRenderContributionTime.afterFillStroke) {\n c.drawShape(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, fillCb, strokeCb);\n }\n });\n }\n\n draw(arc: IArc, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const { context } = drawContext;\n if (!context) {\n return;\n }\n\n // const arcAttribute = graphicService.themeService.getCurrentTheme().arcAttribute;\n const arcAttribute = getTheme(arc, params?.theme).arc;\n\n context.highPerformanceSave();\n\n let { x = arcAttribute.x, y = arcAttribute.y } = arc.attribute;\n if (!arc.transMatrix.onlyTranslate()) {\n // 性能较差\n x = 0;\n y = 0;\n context.transformFromMatrix(arc.transMatrix, true);\n } else {\n const point = arc.getOffsetXY(arcAttribute);\n x += point.x;\n y += point.y;\n // 当前context有rotate/scale,重置matrix\n context.setTransformForCurrent();\n }\n\n if (drawPathProxy(arc, context, x, y, drawContext, params)) {\n context.highPerformanceRestore();\n return;\n }\n\n this.drawShape(arc, context, x, y, drawContext, params);\n\n context.highPerformanceRestore();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/render/contributions/render/arc-render.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAgB7E,OAAO,EACL,cAAc,EACd,WAAW,EACX,aAAa,EACb,WAAW,EACX,SAAS,EACT,OAAO,EACP,SAAS,EACT,aAAa,EACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,kBAAkB,EAAE,MAAM,wDAAwD,CAAC;AAC5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAmBtD,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAMjC,YAGqB,sBAAqE;QAArE,2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W,CAAC,aAAa,EAAE,EAAE;YAEpC,CAAC,GAAG,CAAC,CAAC;YACN,CAAC,GAAG,CAAC,CAAC;YACN,OAAO,CAAC,mBAAmB,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;SACpD;aAAM;YACL,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;YAC5C,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;YACb,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;YAEb,OAAO,CAAC,sBAAsB,EAAE,CAAC;SAClC;QAED,IAAI,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE;YAC1D,OAAO,CAAC,sBAAsB,EAAE,CAAC;YACjC,OAAO;SACR;QAED,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;QAExD,OAAO,CAAC,sBAAsB,EAAE,CAAC;IACnC,CAAC;CACF,CAAA;AAzcY,sBAAsB;IADlC,UAAU,EAAE;IAQR,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,qBAAqB,CAAC,CAAA;;GARpB,sBAAsB,CAyclC;SAzcY,sBAAsB","file":"arc-render.js","sourcesContent":["import { abs, acos, atan2, cos, epsilon, min, pi, sin, sqrt, pi2 } from '@visactor/vutils';\nimport { inject, injectable, named } from 'inversify';\nimport { getTheme } from '../../../graphic/theme';\nimport { parseStroke } from '../../../common/utils';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport type {\n IContext2d,\n IArc,\n IPath2D,\n IGraphicAttribute,\n IMarkAttribute,\n IThemeAttribute,\n IGradientColor,\n IArcRenderContribution,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider\n} from '../../../interface';\nimport {\n cornerTangents,\n drawArcPath,\n drawPathProxy,\n fillVisible,\n intersect,\n runFill,\n runStroke,\n strokeVisible\n} from './utils';\nimport { getConicGradientAt } from '../../../canvas/contributions/browser/conical-gradient';\nimport { ArcRenderContribution } from './contributions/constants';\nimport { BaseRenderContributionTime } from '../../../common/enums';\nimport { ARC_NUMBER_TYPE } from '../../../graphic/constants';\n/**\n * 部分源码参考 https://github.com/d3/d3-shape/\n * Copyright 2010-2022 Mike Bostock\n\n Permission to use, copy, modify, and/or distribute this software for any purpose\n with or without fee is hereby granted, provided that the above copyright notice\n and this permission notice appear in all copies.\n\n THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS\n OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER\n TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF\n THIS SOFTWARE.\n */\n\n@injectable()\nexport class DefaultCanvasArcRender implements IGraphicRender {\n type: 'arc';\n numberType: number = ARC_NUMBER_TYPE;\n\n protected _arcBeforeRenderContribitions: IArcRenderContribution[] = [];\n protected _arcAfterRenderContribitions: IArcRenderContribution[] = [];\n constructor(\n @inject(ContributionProvider)\n @named(ArcRenderContribution)\n protected readonly arcRenderContribitions: IContributionProvider<IArcRenderContribution>\n ) {}\n\n // 绘制尾部cap\n drawArcTailCapPath(\n arc: IArc,\n context: IContext2d | IPath2D,\n cx: number,\n cy: number,\n outerRadius: number,\n innerRadius: number,\n _sa: number,\n _ea: number\n ) {\n const capAngle = _ea - _sa;\n const data = arc.getParsedAngle();\n const startAngle = data.startAngle;\n let endAngle = data.endAngle;\n endAngle = _ea;\n const deltaAngle = abs(endAngle - startAngle);\n const clockwise: boolean = endAngle > startAngle;\n let collapsedToLine: boolean = false;\n // 规范化outerRadius和innerRadius\n if (outerRadius < innerRadius) {\n const temp = outerRadius;\n outerRadius = innerRadius;\n innerRadius = temp;\n }\n\n const cornerRadius = arc.getParsedCornerRadius();\n // Or is it a circular or annular sector?\n const { outerDeltaAngle, innerDeltaAngle, outerStartAngle, outerEndAngle, innerEndAngle, innerStartAngle } =\n arc.getParsePadAngle(startAngle, endAngle);\n\n const outerCornerRadiusStart = cornerRadius;\n const outerCornerRadiusEnd = cornerRadius;\n const innerCornerRadiusEnd = cornerRadius;\n const innerCornerRadiusStart = cornerRadius;\n const maxOuterCornerRadius = Math.max(outerCornerRadiusEnd, outerCornerRadiusStart);\n const maxInnerCornerRadius = Math.max(innerCornerRadiusEnd, innerCornerRadiusStart);\n let limitedOcr = maxOuterCornerRadius;\n let limitedIcr = maxInnerCornerRadius;\n\n const xors = outerRadius * cos(outerStartAngle);\n const yors = outerRadius * sin(outerStartAngle);\n const xire = innerRadius * cos(innerEndAngle);\n const yire = innerRadius * sin(innerEndAngle);\n\n // Apply rounded corners?\n let xore: number;\n let yore: number;\n let xirs: number;\n let yirs: number;\n\n if (maxInnerCornerRadius > epsilon || maxOuterCornerRadius > epsilon) {\n xore = outerRadius * cos(outerEndAngle);\n yore = outerRadius * sin(outerEndAngle);\n xirs = innerRadius * cos(innerStartAngle);\n yirs = innerRadius * sin(innerStartAngle);\n\n // Restrict the corner radius according to the sector angle.\n if (deltaAngle < pi) {\n const oc = intersect(xors, yors, xirs, yirs, xore, yore, xire, yire);\n\n if (oc) {\n const ax = xors - oc[0];\n const ay = yors - oc[1];\n const bx = xore - oc[0];\n const by = yore - oc[1];\n const kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2);\n const lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);\n\n limitedIcr = min(maxInnerCornerRadius, (innerRadius - lc) / (kc - 1));\n limitedOcr = min(maxOuterCornerRadius, (outerRadius - lc) / (kc + 1));\n }\n }\n }\n\n if (limitedOcr > epsilon) {\n const cornerRadiusStart = min(outerCornerRadiusStart, limitedOcr);\n const cornerRadiusEnd = min(outerCornerRadiusEnd, limitedOcr);\n // Does the sector’s outer ring have rounded corners?\n const t0 = cornerTangents(xirs, yirs, xors, yors, outerRadius, cornerRadiusStart, Number(clockwise));\n const t1 = cornerTangents(xore, yore, xire, yire, outerRadius, cornerRadiusEnd, Number(clockwise));\n\n // Have the corners merged?\n if (limitedOcr < maxOuterCornerRadius && cornerRadiusStart === cornerRadiusEnd) {\n context.moveTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01);\n context.arc(cx + t0.cx, cy + t0.cy, limitedOcr, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !clockwise);\n } else {\n const a1 = endAngle - capAngle - 0.03;\n const a2 = atan2(t1.y11, t1.x11);\n context.arc(cx, cy, outerRadius, a1, a2, !clockwise);\n cornerRadiusEnd > 0 &&\n context.arc(\n cx + t1.cx,\n cy + t1.cy,\n cornerRadiusEnd,\n atan2(t1.y11, t1.x11),\n atan2(t1.y01, t1.x01),\n !clockwise\n );\n }\n } else {\n context.moveTo(cx + xors, cy + yors);\n }\n // else {\n // // Or is the outer ring just a circular arc?\n // if (!partStroke || partStroke[0]) {\n // context.moveTo(cx + xors, cy + yors);\n // context.arc(cx, cy, outerRadius, outerStartAngle, outerEndAngle, !clockwise);\n // } else {\n // // context.moveTo(cx + outerRadius * cos(outerEndAngle), cy + yore);\n // }\n // }\n // // Is there no inner ring, and it’s a circular sector?\n // // Or perhaps it’s an annular sector collapsed due to padding?\n if (!(innerRadius > epsilon) || innerDeltaAngle < 0.001) {\n context.lineTo(cx + xire, cy + yire);\n collapsedToLine = true;\n } else if (limitedIcr > epsilon) {\n const cornerRadiusStart = min(innerCornerRadiusStart, limitedIcr);\n const cornerRadiusEnd = min(innerCornerRadiusEnd, limitedIcr);\n // Does the sector’s inner ring (or point) have rounded corners?\n const t0 = cornerTangents(xire, yire, xore, yore, innerRadius, -cornerRadiusEnd, Number(clockwise));\n const t1 = cornerTangents(xors, yors, xirs, yirs, innerRadius, -cornerRadiusStart, Number(clockwise));\n\n context.lineTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01);\n\n // Have the corners merged?\n if (limitedIcr < maxInnerCornerRadius && cornerRadiusStart === cornerRadiusEnd) {\n const arcEndAngle = atan2(t1.y01, t1.x01);\n context.arc(cx + t0.cx, cy + t0.cy, limitedIcr, atan2(t0.y01, t0.x01), arcEndAngle, !clockwise);\n } else {\n cornerRadiusEnd > 0 &&\n context.arc(\n cx + t0.cx,\n cy + t0.cy,\n cornerRadiusEnd,\n atan2(t0.y01, t0.x01),\n atan2(t0.y11, t0.x11),\n !clockwise\n );\n const a1 = atan2(t0.cy + t0.y11, t0.cx + t0.x11);\n const a2 = endAngle - capAngle - 0.03;\n context.arc(cx, cy, innerRadius, a1, a2, clockwise);\n }\n } else {\n context.lineTo(cx + innerRadius * cos(innerStartAngle), cy + innerRadius * sin(innerStartAngle));\n }\n\n return collapsedToLine;\n }\n\n drawShape(\n arc: IArc,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n // const arcAttribute = graphicService.themeService.getCurrentTheme().arcAttribute;\n const arcAttribute = getTheme(arc, params?.theme).arc;\n const {\n fill = arcAttribute.fill,\n background,\n stroke = arcAttribute.stroke,\n opacity = arcAttribute.opacity,\n fillOpacity = arcAttribute.fillOpacity,\n lineWidth = arcAttribute.lineWidth,\n strokeOpacity = arcAttribute.strokeOpacity,\n visible = arcAttribute.visible,\n x: originX = arcAttribute.x,\n y: originY = arcAttribute.y\n } = arc.attribute;\n // 不绘制或者透明\n const fVisible = fillVisible(opacity, fillOpacity);\n const sVisible = strokeVisible(opacity, strokeOpacity);\n const doFill = runFill(fill);\n const doStroke = runStroke(stroke, lineWidth);\n\n if (!(arc.valid && visible)) {\n return;\n }\n\n if (!(doFill || doStroke || background)) {\n return;\n }\n\n // 如果存在fillCb和strokeCb,那就不直接跳过\n if (!(fVisible || sVisible || fillCb || strokeCb || background)) {\n return;\n }\n\n const {\n outerRadius = arcAttribute.outerRadius,\n innerRadius = arcAttribute.innerRadius,\n cap = arcAttribute.cap,\n forceShowCap = arcAttribute.forceShowCap\n } = arc.attribute;\n\n let beforeRenderContribitionsRuned = false;\n\n const { isFullStroke, stroke: arrayStroke } = parseStroke(stroke);\n if (doFill || isFullStroke || background) {\n context.beginPath();\n // if (arc.shouldUpdateShape()) {\n // // 更新shape\n // arc.cache = new Path2D(context);\n // this.drawArcPath(arc, arc.cache, x, y, outerRadius, innerRadius);\n // arc.clearUpdateShapeTag();\n // } else {\n // if (arc.cache) {\n // renderCommandList(arc.cache.commandList, context);\n // }\n // }\n // 测试后,cache对于重绘性能提升不大,但是在首屏有一定性能损耗,因此arc不再使用cache\n drawArcPath(arc, context, x, y, outerRadius, innerRadius);\n\n if (!this._arcBeforeRenderContribitions) {\n const contributions = this.arcRenderContribitions.getContributions() || [];\n contributions.sort((a, b) => b.order - a.order);\n contributions.forEach(c => {\n if (c.time === BaseRenderContributionTime.beforeFillStroke) {\n this._arcBeforeRenderContribitions.push(c);\n } else {\n this._arcAfterRenderContribitions.push(c);\n }\n });\n }\n beforeRenderContribitionsRuned = true;\n this._arcBeforeRenderContribitions.forEach(c => {\n c.drawShape(\n arc,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n arcAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n });\n\n // shadow\n context.setShadowStyle && context.setShadowStyle(arc, arc.attribute, arcAttribute);\n\n if (doFill) {\n if (fillCb) {\n fillCb(context, arc.attribute, arcAttribute);\n } else if (fVisible) {\n context.setCommonStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute);\n context.fill();\n }\n }\n\n if (doStroke && isFullStroke) {\n if (strokeCb) {\n strokeCb(context, arc.attribute, arcAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute);\n context.stroke();\n }\n }\n }\n\n // 需要局部渲染描边的时候\n if (!isFullStroke && doStroke) {\n context.beginPath();\n const collapsedToLine = drawArcPath(arc, context, x, y, outerRadius, innerRadius, arrayStroke);\n\n if (!beforeRenderContribitionsRuned) {\n if (!this._arcBeforeRenderContribitions) {\n const contributions = this.arcRenderContribitions.getContributions() || [];\n contributions.sort((a, b) => b.order - a.order);\n contributions.forEach(c => {\n if (c.time === BaseRenderContributionTime.beforeFillStroke) {\n this._arcBeforeRenderContribitions.push(c);\n } else {\n this._arcAfterRenderContribitions.push(c);\n }\n });\n }\n beforeRenderContribitionsRuned = true;\n this._arcBeforeRenderContribitions.forEach(c => {\n c.drawShape(\n arc,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n arcAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n });\n }\n\n if (strokeCb) {\n strokeCb(context, arc.attribute, arcAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute);\n context.stroke();\n }\n }\n\n // 绘制cap\n if (cap && forceShowCap) {\n const { startAngle: sa, endAngle: ea } = arc.getParsedAngle();\n const deltaAngle = abs(ea - sa);\n if (deltaAngle >= pi2 - epsilon) {\n context.beginPath();\n const capWidth = Math.abs(outerRadius - innerRadius) / 2;\n // 以外边界长度为准\n const capAngle = capWidth / outerRadius;\n const { endAngle = arcAttribute.endAngle, fill = arcAttribute.fill } = arc.attribute;\n const startAngle = endAngle;\n this.drawArcTailCapPath(arc, context, x, y, outerRadius, innerRadius, startAngle, startAngle + capAngle);\n\n if (!beforeRenderContribitionsRuned) {\n if (!this._arcBeforeRenderContribitions) {\n const contributions = this.arcRenderContribitions.getContributions() || [];\n contributions.sort((a, b) => b.order - a.order);\n contributions.forEach(c => {\n if (c.time === BaseRenderContributionTime.beforeFillStroke) {\n this._arcBeforeRenderContribitions.push(c);\n } else {\n this._arcAfterRenderContribitions.push(c);\n }\n });\n }\n beforeRenderContribitionsRuned = true;\n this._arcBeforeRenderContribitions.forEach(c => {\n c.drawShape(\n arc,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n arcAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n });\n }\n\n if (doFill) {\n // 获取渐变色最后一个颜色\n const color = fill;\n if ((color as IGradientColor).gradient === 'conical') {\n const lastColor = getConicGradientAt(0, 0, endAngle, color as any);\n if (fillCb) {\n // fillCb(context, arc.attribute, arcAttribute);\n } else if (fillVisible) {\n // context.closePath();\n context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute);\n context.fillStyle = lastColor as string;\n context.fill();\n }\n }\n }\n if (doStroke) {\n if (strokeCb) {\n // fillCb(context, arc.attribute, arcAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute);\n // context.strokeStyle = 'red';\n context.stroke();\n }\n }\n }\n }\n\n this._arcAfterRenderContribitions.forEach(c => {\n c.drawShape(\n arc,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n arcAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n });\n }\n\n draw(arc: IArc, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const { context } = drawContext;\n if (!context) {\n return;\n }\n\n // const arcAttribute = graphicService.themeService.getCurrentTheme().arcAttribute;\n const arcAttribute = getTheme(arc, params?.theme).arc;\n\n context.highPerformanceSave();\n\n let { x = arcAttribute.x, y = arcAttribute.y } = arc.attribute;\n if (!arc.transMatrix.onlyTranslate()) {\n // 性能较差\n x = 0;\n y = 0;\n context.transformFromMatrix(arc.transMatrix, true);\n } else {\n const point = arc.getOffsetXY(arcAttribute);\n x += point.x;\n y += point.y;\n // 当前context有rotate/scale,重置matrix\n context.setTransformForCurrent();\n }\n\n if (drawPathProxy(arc, context, x, y, drawContext, params)) {\n context.highPerformanceRestore();\n return;\n }\n\n this.drawShape(arc, context, x, y, drawContext, params);\n\n context.highPerformanceRestore();\n }\n}\n"]}
|
|
@@ -7,5 +7,5 @@ export declare class DefaultCanvasAreaRender implements IGraphicRender {
|
|
|
7
7
|
constructor(areaRenderContribitions: IContributionProvider<IAreaRenderContribution>);
|
|
8
8
|
drawShape(area: IArea, context: IContext2d, x: number, y: number, drawContext: IDrawContext, params?: IGraphicRenderDrawParams, fillCb?: (ctx: IContext2d, lineAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean): void;
|
|
9
9
|
draw(area: IArea, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams): void;
|
|
10
|
-
protected drawSegmentItem(context: IContext2d, cache: IAreaCacheItem, fill: boolean, fillOpacity: number, attribute: Partial<IAreaGraphicAttribute>, defaultAttribute: Required<IAreaGraphicAttribute> | Partial<IAreaGraphicAttribute>[], clipRange: number, offsetX: number, offsetY: number, offsetZ: number, area: IArea, fillCb?: (ctx: IContext2d, lineAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute | IThemeAttribute[]) => boolean): boolean;
|
|
10
|
+
protected drawSegmentItem(context: IContext2d, cache: IAreaCacheItem, fill: boolean, fillOpacity: number, stroke: boolean, strokeOpacity: number, attribute: Partial<IAreaGraphicAttribute>, defaultAttribute: Required<IAreaGraphicAttribute> | Partial<IAreaGraphicAttribute>[], clipRange: number, offsetX: number, offsetY: number, offsetZ: number, area: IArea, drawContext: IDrawContext, fillCb?: (ctx: IContext2d, lineAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute | IThemeAttribute[]) => boolean, strokeCb?: (ctx: IContext2d, lineAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute | IThemeAttribute[]) => boolean): boolean;
|
|
11
11
|
}
|
|
@@ -10,7 +10,7 @@ var __decorate = this && this.__decorate || function(decorators, target, key, de
|
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
import { min } from "@visactor/vutils";
|
|
13
|
+
import { isArray, min } from "@visactor/vutils";
|
|
14
14
|
|
|
15
15
|
import { inject, injectable, named } from "inversify";
|
|
16
16
|
|
|
@@ -22,7 +22,7 @@ import { getTheme } from "../../../graphic/theme";
|
|
|
22
22
|
|
|
23
23
|
import { drawPathProxy, fillVisible, runFill, runStroke, strokeVisible } from "./utils";
|
|
24
24
|
|
|
25
|
-
import { AreaRenderContribution } from "./contributions/
|
|
25
|
+
import { AreaRenderContribution } from "./contributions/constants";
|
|
26
26
|
|
|
27
27
|
import { BaseRenderContributionTime } from "../../../common/enums";
|
|
28
28
|
|
|
@@ -30,6 +30,8 @@ import { drawAreaSegments } from "../../../common/render-area";
|
|
|
30
30
|
|
|
31
31
|
import { AREA_NUMBER_TYPE } from "../../../graphic/constants";
|
|
32
32
|
|
|
33
|
+
import { drawSegments } from "../../../common/render-curve";
|
|
34
|
+
|
|
33
35
|
function calcLineCache(points, curveType, params) {
|
|
34
36
|
switch (curveType) {
|
|
35
37
|
case "linear":
|
|
@@ -122,7 +124,7 @@ let DefaultCanvasAreaRender = class {
|
|
|
122
124
|
if (Array.isArray(area.cacheArea)) if (1 === clipRange) {
|
|
123
125
|
let skip = !1;
|
|
124
126
|
area.cacheArea.forEach(((cache, index) => {
|
|
125
|
-
skip || (skip = this.drawSegmentItem(context, cache,
|
|
127
|
+
skip || (skip = this.drawSegmentItem(context, cache, doFill, fillOpacity, doStroke, strokeOpacity, area.attribute.segments[index], [ areaAttribute, area.attribute ], clipRange, x, y, z, area, drawContext, fillCb, strokeCb));
|
|
126
128
|
}));
|
|
127
129
|
} else {
|
|
128
130
|
const totalLength = area.cacheArea.reduce(((l, c) => l + c.top.getLength()), 0), totalDrawLength = clipRange * totalLength;
|
|
@@ -130,9 +132,9 @@ let DefaultCanvasAreaRender = class {
|
|
|
130
132
|
area.cacheArea.forEach(((cache, index) => {
|
|
131
133
|
if (skip) return;
|
|
132
134
|
const curSegLength = cache.top.getLength(), _cr = (totalDrawLength - drawedLengthUntilLast) / curSegLength;
|
|
133
|
-
drawedLengthUntilLast += curSegLength, _cr > 0 && (skip = this.drawSegmentItem(context, cache,
|
|
135
|
+
drawedLengthUntilLast += curSegLength, _cr > 0 && (skip = this.drawSegmentItem(context, cache, doFill, fillOpacity, doStroke, strokeOpacity, area.attribute.segments[index], [ areaAttribute, area.attribute ], min(_cr, 1), x, y, z, area, drawContext, fillCb, strokeCb));
|
|
134
136
|
}));
|
|
135
|
-
} else this.drawSegmentItem(context, area.cacheArea,
|
|
137
|
+
} else this.drawSegmentItem(context, area.cacheArea, doFill, fillOpacity, doStroke, strokeOpacity, area.attribute, areaAttribute, clipRange, x, y, z, area, drawContext, fillCb, strokeCb);
|
|
136
138
|
}
|
|
137
139
|
draw(area, renderService, drawContext, params) {
|
|
138
140
|
const {context: context} = drawContext, areaAttribute = getTheme(area, null == params ? void 0 : params.theme).area;
|
|
@@ -144,7 +146,7 @@ let DefaultCanvasAreaRender = class {
|
|
|
144
146
|
drawPathProxy(area, context, x, y, drawContext, params) || this.drawShape(area, context, x, y, drawContext, params),
|
|
145
147
|
context.highPerformanceRestore();
|
|
146
148
|
}
|
|
147
|
-
drawSegmentItem(context, cache, fill, fillOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, fillCb) {
|
|
149
|
+
drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, fillCb, strokeCb) {
|
|
148
150
|
context.beginPath();
|
|
149
151
|
drawAreaSegments(context.camera ? context : context.nativeContext, cache, clipRange, {
|
|
150
152
|
offsetX: offsetX,
|
|
@@ -152,15 +154,24 @@ let DefaultCanvasAreaRender = class {
|
|
|
152
154
|
offsetZ: offsetZ
|
|
153
155
|
}), this._areaRenderContribitions || (this._areaRenderContribitions = this.areaRenderContribitions.getContributions() || [],
|
|
154
156
|
this._areaRenderContribitions.sort(((a, b) => b.order - a.order))), this._areaRenderContribitions.forEach((c => {
|
|
155
|
-
c.time === BaseRenderContributionTime.beforeFillStroke && c.drawShape(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, defaultAttribute, fillCb, null, {
|
|
157
|
+
c.time === BaseRenderContributionTime.beforeFillStroke && c.drawShape(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, defaultAttribute, drawContext, fillCb, null, {
|
|
156
158
|
attribute: attribute
|
|
157
159
|
});
|
|
158
160
|
})), context.setShadowStyle && context.setShadowStyle(area, attribute, defaultAttribute);
|
|
159
161
|
const {x: originX = 0, x: originY = 0} = attribute;
|
|
160
|
-
|
|
161
|
-
context.fill())),
|
|
162
|
+
if (!1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(area, attribute, originX - offsetX, originY - offsetY, defaultAttribute),
|
|
163
|
+
context.fill())), !1 !== stroke) if (strokeCb) strokeCb(context, attribute, defaultAttribute); else {
|
|
164
|
+
const {stroke: stroke} = attribute;
|
|
165
|
+
isArray(stroke) && stroke[0] && !1 === stroke[1] && (context.beginPath(), drawSegments(context.camera ? context : context.nativeContext, cache.top, clipRange, "auto", {
|
|
166
|
+
offsetX: offsetX,
|
|
167
|
+
offsetY: offsetY,
|
|
168
|
+
offsetZ: offsetZ
|
|
169
|
+
})), context.setStrokeStyle(area, attribute, originX - offsetX, originY - offsetY, defaultAttribute),
|
|
170
|
+
context.stroke();
|
|
171
|
+
}
|
|
172
|
+
return this._areaRenderContribitions || (this._areaRenderContribitions = this.areaRenderContribitions.getContributions() || []),
|
|
162
173
|
this._areaRenderContribitions.forEach((c => {
|
|
163
|
-
c.time === BaseRenderContributionTime.afterFillStroke && c.drawShape(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, defaultAttribute, fillCb, null, {
|
|
174
|
+
c.time === BaseRenderContributionTime.afterFillStroke && c.drawShape(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, defaultAttribute, drawContext, fillCb, null, {
|
|
164
175
|
attribute: attribute
|
|
165
176
|
});
|
|
166
177
|
})), !1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/render/contributions/render/area-render.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAoBtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACxB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,SAAS,aAAa,CACpB,M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BAAwB,GAAG,IAAI,CAAC,uBAAuB,CAAC,gBAAgB,EAAE,IAAI,EAAE,CAAC;SACvF;QACD,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YACxC,IAAI,CAAC,CAAC,IAAI,KAAK,0BAA0B,CAAC,eAAe,EAAE;gBACzD,CAAC,CAAC,SAAS,CACT,IAAI,EACJ,OAAO,EACP,OAAO,EACP,OAAO,EACP,CAAC,CAAC,WAAW,EACb,KAAK,EACL,IAAI,EACJ,KAAK,EACL,gBAAuB,EACvB,MAAM,EACN,IAAI,EACJ,EAAE,SAAS,EAAE,CACd,CAAC;aACH;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,CAAC;IACb,CAAC;CACF,CAAA;AAxVY,uBAAuB;IADnC,UAAU,EAAE;IAOR,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,sBAAsB,CAAC,CAAA;;GAPrB,uBAAuB,CAwVnC;SAxVY,uBAAuB","file":"area-render.js","sourcesContent":["import type { IPointLike } from '@visactor/vutils';\nimport { min } from '@visactor/vutils';\nimport { inject, injectable, named } from 'inversify';\nimport type {\n IArea,\n IAreaCacheItem,\n IAreaGraphicAttribute,\n IGraphicAttribute,\n IContext2d,\n ICurveType,\n IMarkAttribute,\n IThemeAttribute,\n ISegPath2D,\n IDirection,\n IAreaRenderContribution,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider\n} from '../../../interface';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport {\n genLinearSegments,\n genBasisSegments,\n genMonotoneXSegments,\n genMonotoneYSegments,\n genStepSegments,\n genLinearClosedSegments\n} from '../../../common/segment';\n\nimport { getTheme } from '../../../graphic/theme';\nimport { drawPathProxy, fillVisible, runFill, runStroke, strokeVisible } from './utils';\nimport { AreaRenderContribution } from './contributions/area-contribution-render';\nimport { BaseRenderContributionTime } from '../../../common/enums';\nimport { drawAreaSegments } from '../../../common/render-area';\nimport { AREA_NUMBER_TYPE } from '../../../graphic/constants';\n\nfunction calcLineCache(\n points: IPointLike[],\n curveType: ICurveType,\n params?: { direction?: IDirection; startPoint?: IPointLike }\n): ISegPath2D | null {\n switch (curveType) {\n case 'linear':\n return genLinearSegments(points, params);\n case 'basis':\n return genBasisSegments(points, params);\n case 'monotoneX':\n return genMonotoneXSegments(points, params);\n case 'monotoneY':\n return genMonotoneYSegments(points, params);\n case 'step':\n return genStepSegments(points, 0.5, params);\n case 'stepBefore':\n return genStepSegments(points, 0, params);\n case 'stepAfter':\n return genStepSegments(points, 1, params);\n case 'linearClosed':\n return genLinearClosedSegments(points, params);\n default:\n return genLinearSegments(points, params);\n }\n}\n\n@injectable()\nexport class DefaultCanvasAreaRender implements IGraphicRender {\n type: 'area';\n numberType: number = AREA_NUMBER_TYPE;\n\n protected _areaRenderContribitions: IAreaRenderContribution[];\n constructor(\n @inject(ContributionProvider)\n @named(AreaRenderContribution)\n protected readonly areaRenderContribitions: IContributionProvider<IAreaRenderContribution>\n ) {}\n\n drawShape(\n area: IArea,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n lineAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n const areaAttribute = getTheme(area, params?.theme).area;\n const {\n fill = areaAttribute.fill,\n fillOpacity = areaAttribute.fillOpacity,\n opacity = areaAttribute.opacity,\n visible = areaAttribute.visible,\n z = areaAttribute.z,\n stroke = area.attribute.stroke,\n lineWidth = areaAttribute.lineWidth,\n strokeOpacity = areaAttribute.strokeOpacity\n } = area.attribute;\n\n // 不绘制或者透明\n const fVisible = fillVisible(opacity, fillOpacity);\n const doFill = runFill(fill);\n const doStroke = runStroke(stroke, lineWidth);\n const sVisible = strokeVisible(opacity, strokeOpacity);\n\n if (!(area.valid && visible)) {\n return;\n }\n\n if (!doFill && !doStroke) {\n return;\n }\n\n // 如果存在fillCb和strokeCb,那就不直接跳过\n if (!(fVisible || fillCb) && !sVisible && !strokeCb) {\n return;\n }\n\n const { clipRange = areaAttribute.clipRange } = area.attribute;\n\n // 更新cache\n if (area.shouldUpdateShape()) {\n const { points, segments, curveType = areaAttribute.curveType } = area.attribute;\n if (segments && segments.length) {\n let startPoint: IPointLike;\n let lastTopSeg: ISegPath2D;\n const topCaches = segments.map((seg, index) => {\n // 添加上一个segment结束的点作为这个segment的起始点\n if (index === 1) {\n startPoint = { x: lastTopSeg.endX, y: lastTopSeg.endY };\n } else if (index > 1) {\n startPoint.x = lastTopSeg.endX;\n startPoint.y = lastTopSeg.endY;\n }\n lastTopSeg = calcLineCache(seg.points, curveType, {\n startPoint\n });\n return lastTopSeg;\n });\n let lastBottomSeg: ISegPath2D;\n const bottomCaches = [];\n for (let i = segments.length - 1; i >= 0; i--) {\n const points = segments[i].points;\n const bottomPoints: IPointLike[] = [];\n for (let i = points.length - 1; i >= 0; i--) {\n bottomPoints.push({\n x: points[i].x1 ?? points[i].x,\n y: points[i].y1 ?? points[i].y\n });\n }\n // 处理一下bottom的segments,bottom的segments需要手动添加endPoints\n if (i !== 0) {\n const lastSegmentPoints = segments[i - 1].points;\n const endPoint = lastSegmentPoints[lastSegmentPoints.length - 1];\n endPoint &&\n bottomPoints.push({\n x: endPoint.x1 ?? endPoint.x,\n y: endPoint.y1 ?? endPoint.y\n });\n }\n lastBottomSeg = calcLineCache(bottomPoints, curveType);\n bottomCaches.unshift(lastBottomSeg);\n }\n area.cacheArea = bottomCaches.map((item, index) => ({\n top: topCaches[index],\n bottom: item\n }));\n } else if (points && points.length) {\n // 转换points\n const topPoints = points;\n const bottomPoints: IPointLike[] = [];\n for (let i = points.length - 1; i >= 0; i--) {\n bottomPoints.push({\n x: points[i].x1 ?? points[i].x,\n y: points[i].y1 ?? points[i].y\n });\n }\n const topCache = calcLineCache(topPoints, curveType);\n const bottomCache = calcLineCache(\n bottomPoints,\n curveType === 'stepBefore' ? 'stepAfter' : curveType === 'stepAfter' ? 'stepBefore' : curveType\n );\n\n area.cacheArea = { top: topCache, bottom: bottomCache };\n } else {\n area.cache = null;\n area.clearUpdateShapeTag();\n return;\n }\n area.clearUpdateShapeTag();\n }\n\n if (Array.isArray(area.cacheArea)) {\n if (clipRange === 1) {\n let skip = false;\n // 性能优化,不需要clip的线段不需要计算长度\n area.cacheArea.forEach((cache, index) => {\n if (skip) {\n return;\n }\n skip = this.drawSegmentItem(\n context,\n cache,\n !!fill,\n fillOpacity,\n area.attribute.segments[index],\n [areaAttribute, area.attribute],\n clipRange,\n x,\n y,\n z,\n area,\n fillCb\n );\n });\n } else {\n // 如果是segments的话,每个clipRange需要重新计算\n // 整个线段的总长度\n const totalLength = area.cacheArea.reduce((l, c) => l + c.top.getLength(), 0);\n // 总需要绘制的长度\n const totalDrawLength = clipRange * totalLength;\n // 直到上次绘制的长度\n let drawedLengthUntilLast = 0;\n let skip = false;\n area.cacheArea.forEach((cache, index) => {\n if (skip) {\n return;\n }\n const curSegLength = cache.top.getLength();\n const _cr = (totalDrawLength - drawedLengthUntilLast) / curSegLength;\n drawedLengthUntilLast += curSegLength;\n if (_cr > 0) {\n skip = this.drawSegmentItem(\n context,\n cache,\n !!fill,\n fillOpacity,\n area.attribute.segments[index],\n [areaAttribute, area.attribute],\n min(_cr, 1),\n x,\n y,\n z,\n area,\n fillCb\n );\n }\n });\n }\n } else {\n this.drawSegmentItem(\n context,\n area.cacheArea as IAreaCacheItem,\n !!fill,\n fillOpacity,\n area.attribute,\n areaAttribute,\n clipRange,\n x,\n y,\n z,\n area,\n fillCb\n );\n }\n }\n\n draw(area: IArea, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const { context } = drawContext;\n\n // const areaAttribute = graphicService.themeService.getCurrentTheme().areaAttribute;\n const areaAttribute = getTheme(area, params?.theme).area;\n let { x = areaAttribute.x, y = areaAttribute.y } = area.attribute;\n\n context.highPerformanceSave();\n\n if (!area.transMatrix.onlyTranslate()) {\n // 性能较差\n x = 0;\n y = 0;\n context.transformFromMatrix(area.transMatrix, true);\n } else {\n const point = area.getOffsetXY(areaAttribute);\n x += point.x;\n y += point.y;\n // 当前context有rotate/scale,重置matrix\n context.setTransformForCurrent();\n }\n\n if (drawPathProxy(area, context, x, y, drawContext, params)) {\n context.highPerformanceRestore();\n return;\n }\n\n this.drawShape(area, context, x, y, drawContext, params);\n\n context.highPerformanceRestore();\n }\n\n /**\n * 绘制segment\n * @param context\n * @param cache\n * @param fill\n * @param stroke\n * @param attribute\n * @param defaultAttribute\n * @param clipRange\n * @param offsetX\n * @param offsetY\n * @param fillCb\n * @param strokeCb\n * @returns 返回true代表跳过后续绘制\n */\n protected drawSegmentItem(\n context: IContext2d,\n cache: IAreaCacheItem,\n fill: boolean,\n fillOpacity: number,\n attribute: Partial<IAreaGraphicAttribute>,\n defaultAttribute: Required<IAreaGraphicAttribute> | Partial<IAreaGraphicAttribute>[],\n clipRange: number,\n offsetX: number,\n offsetY: number,\n offsetZ: number,\n area: IArea,\n fillCb?: (\n ctx: IContext2d,\n lineAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute | IThemeAttribute[]\n ) => boolean\n ): boolean {\n context.beginPath();\n\n const ret: boolean = false;\n drawAreaSegments(context.camera ? context : context.nativeContext, cache, clipRange, {\n offsetX,\n offsetY,\n offsetZ\n });\n\n if (!this._areaRenderContribitions) {\n this._areaRenderContribitions = this.areaRenderContribitions.getContributions() || [];\n this._areaRenderContribitions.sort((a, b) => b.order - a.order);\n }\n this._areaRenderContribitions.forEach(c => {\n if (c.time === BaseRenderContributionTime.beforeFillStroke) {\n // c.useStyle && context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute);\n c.drawShape(\n area,\n context,\n offsetX,\n offsetY,\n !!fillOpacity,\n false,\n fill,\n false,\n defaultAttribute as any,\n fillCb,\n null,\n { attribute }\n );\n }\n });\n\n // shadow\n context.setShadowStyle && context.setShadowStyle(area, attribute, defaultAttribute);\n\n const { x: originX = 0, x: originY = 0 } = attribute;\n if (fill !== false) {\n if (fillCb) {\n fillCb(context, attribute, defaultAttribute);\n } else if (fillOpacity) {\n context.setCommonStyle(area, attribute, originX - offsetX, originY - offsetY, defaultAttribute);\n context.fill();\n }\n }\n\n if (!this._areaRenderContribitions) {\n this._areaRenderContribitions = this.areaRenderContribitions.getContributions() || [];\n }\n this._areaRenderContribitions.forEach(c => {\n if (c.time === BaseRenderContributionTime.afterFillStroke) {\n c.drawShape(\n area,\n context,\n offsetX,\n offsetY,\n !!fillOpacity,\n false,\n fill,\n false,\n defaultAttribute as any,\n fillCb,\n null,\n { attribute }\n );\n }\n });\n\n return ret;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/render/contributions/render/area-render.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAoBtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACxB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,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;YACxC,IAAI,CAAC,CAAC,IAAI,KAAK,0BAA0B,CAAC,eAAe,EAAE;gBACzD,CAAC,CAAC,SAAS,CACT,IAAI,EACJ,OAAO,EACP,OAAO,EACP,OAAO,EACP,CAAC,CAAC,WAAW,EACb,KAAK,EACL,IAAI,EACJ,KAAK,EACL,gBAAuB,EACvB,WAAW,EACX,MAAM,EACN,IAAI,EACJ,EAAE,SAAS,EAAE,CACd,CAAC;aACH;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,CAAC;IACb,CAAC;CACF,CAAA;AAhYY,uBAAuB;IADnC,UAAU,EAAE;IAOR,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,sBAAsB,CAAC,CAAA;;GAPrB,uBAAuB,CAgYnC;SAhYY,uBAAuB","file":"area-render.js","sourcesContent":["import type { IPointLike } from '@visactor/vutils';\nimport { isArray, min } from '@visactor/vutils';\nimport { inject, injectable, named } from 'inversify';\nimport type {\n IArea,\n IAreaCacheItem,\n IAreaGraphicAttribute,\n IGraphicAttribute,\n IContext2d,\n ICurveType,\n IMarkAttribute,\n IThemeAttribute,\n ISegPath2D,\n IDirection,\n IAreaRenderContribution,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider\n} from '../../../interface';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport {\n genLinearSegments,\n genBasisSegments,\n genMonotoneXSegments,\n genMonotoneYSegments,\n genStepSegments,\n genLinearClosedSegments\n} from '../../../common/segment';\n\nimport { getTheme } from '../../../graphic/theme';\nimport { drawPathProxy, fillVisible, runFill, runStroke, strokeVisible } from './utils';\nimport { AreaRenderContribution } from './contributions/constants';\nimport { BaseRenderContributionTime } from '../../../common/enums';\nimport { drawAreaSegments } from '../../../common/render-area';\nimport { AREA_NUMBER_TYPE } from '../../../graphic/constants';\nimport { drawSegments } from '../../../common/render-curve';\n\nfunction calcLineCache(\n points: IPointLike[],\n curveType: ICurveType,\n params?: { direction?: IDirection; startPoint?: IPointLike }\n): ISegPath2D | null {\n switch (curveType) {\n case 'linear':\n return genLinearSegments(points, params);\n case 'basis':\n return genBasisSegments(points, params);\n case 'monotoneX':\n return genMonotoneXSegments(points, params);\n case 'monotoneY':\n return genMonotoneYSegments(points, params);\n case 'step':\n return genStepSegments(points, 0.5, params);\n case 'stepBefore':\n return genStepSegments(points, 0, params);\n case 'stepAfter':\n return genStepSegments(points, 1, params);\n case 'linearClosed':\n return genLinearClosedSegments(points, params);\n default:\n return genLinearSegments(points, params);\n }\n}\n\n@injectable()\nexport class DefaultCanvasAreaRender implements IGraphicRender {\n type: 'area';\n numberType: number = AREA_NUMBER_TYPE;\n\n protected _areaRenderContribitions: IAreaRenderContribution[];\n constructor(\n @inject(ContributionProvider)\n @named(AreaRenderContribution)\n protected readonly areaRenderContribitions: IContributionProvider<IAreaRenderContribution>\n ) {}\n\n drawShape(\n area: IArea,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n lineAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n const areaAttribute = getTheme(area, params?.theme).area;\n const {\n fill = areaAttribute.fill,\n fillOpacity = areaAttribute.fillOpacity,\n opacity = areaAttribute.opacity,\n visible = areaAttribute.visible,\n z = areaAttribute.z,\n stroke = area.attribute.stroke,\n lineWidth = areaAttribute.lineWidth,\n strokeOpacity = areaAttribute.strokeOpacity\n } = area.attribute;\n\n // 不绘制或者透明\n const fVisible = fillVisible(opacity, fillOpacity);\n const doFill = runFill(fill);\n const doStroke = runStroke(stroke, lineWidth);\n const sVisible = strokeVisible(opacity, strokeOpacity);\n\n if (!(area.valid && visible)) {\n return;\n }\n\n if (!doFill && !doStroke) {\n return;\n }\n\n // 如果存在fillCb和strokeCb,那就不直接跳过\n if (!(fVisible || fillCb) && !sVisible && !strokeCb) {\n return;\n }\n\n const { clipRange = areaAttribute.clipRange } = area.attribute;\n\n // 更新cache\n if (area.shouldUpdateShape()) {\n const { points, segments, curveType = areaAttribute.curveType } = area.attribute;\n if (segments && segments.length) {\n let startPoint: IPointLike;\n let lastTopSeg: ISegPath2D;\n const topCaches = segments.map((seg, index) => {\n // 添加上一个segment结束的点作为这个segment的起始点\n if (index === 1) {\n startPoint = { x: lastTopSeg.endX, y: lastTopSeg.endY };\n } else if (index > 1) {\n startPoint.x = lastTopSeg.endX;\n startPoint.y = lastTopSeg.endY;\n }\n lastTopSeg = calcLineCache(seg.points, curveType, {\n startPoint\n });\n return lastTopSeg;\n });\n let lastBottomSeg: ISegPath2D;\n const bottomCaches = [];\n for (let i = segments.length - 1; i >= 0; i--) {\n const points = segments[i].points;\n const bottomPoints: IPointLike[] = [];\n for (let i = points.length - 1; i >= 0; i--) {\n bottomPoints.push({\n x: points[i].x1 ?? points[i].x,\n y: points[i].y1 ?? points[i].y\n });\n }\n // 处理一下bottom的segments,bottom的segments需要手动添加endPoints\n if (i !== 0) {\n const lastSegmentPoints = segments[i - 1].points;\n const endPoint = lastSegmentPoints[lastSegmentPoints.length - 1];\n endPoint &&\n bottomPoints.push({\n x: endPoint.x1 ?? endPoint.x,\n y: endPoint.y1 ?? endPoint.y\n });\n }\n lastBottomSeg = calcLineCache(bottomPoints, curveType);\n bottomCaches.unshift(lastBottomSeg);\n }\n area.cacheArea = bottomCaches.map((item, index) => ({\n top: topCaches[index],\n bottom: item\n }));\n } else if (points && points.length) {\n // 转换points\n const topPoints = points;\n const bottomPoints: IPointLike[] = [];\n for (let i = points.length - 1; i >= 0; i--) {\n bottomPoints.push({\n x: points[i].x1 ?? points[i].x,\n y: points[i].y1 ?? points[i].y\n });\n }\n const topCache = calcLineCache(topPoints, curveType);\n const bottomCache = calcLineCache(\n bottomPoints,\n curveType === 'stepBefore' ? 'stepAfter' : curveType === 'stepAfter' ? 'stepBefore' : curveType\n );\n\n area.cacheArea = { top: topCache, bottom: bottomCache };\n } else {\n area.cache = null;\n area.clearUpdateShapeTag();\n return;\n }\n area.clearUpdateShapeTag();\n }\n\n if (Array.isArray(area.cacheArea)) {\n if (clipRange === 1) {\n let skip = false;\n // 性能优化,不需要clip的线段不需要计算长度\n area.cacheArea.forEach((cache, index) => {\n if (skip) {\n return;\n }\n skip = this.drawSegmentItem(\n context,\n cache,\n doFill,\n fillOpacity,\n doStroke,\n strokeOpacity,\n area.attribute.segments[index],\n [areaAttribute, area.attribute],\n clipRange,\n x,\n y,\n z,\n area,\n drawContext,\n fillCb,\n strokeCb\n );\n });\n } else {\n // 如果是segments的话,每个clipRange需要重新计算\n // 整个线段的总长度\n const totalLength = area.cacheArea.reduce((l, c) => l + c.top.getLength(), 0);\n // 总需要绘制的长度\n const totalDrawLength = clipRange * totalLength;\n // 直到上次绘制的长度\n let drawedLengthUntilLast = 0;\n let skip = false;\n area.cacheArea.forEach((cache, index) => {\n if (skip) {\n return;\n }\n const curSegLength = cache.top.getLength();\n const _cr = (totalDrawLength - drawedLengthUntilLast) / curSegLength;\n drawedLengthUntilLast += curSegLength;\n if (_cr > 0) {\n skip = this.drawSegmentItem(\n context,\n cache,\n doFill,\n fillOpacity,\n doStroke,\n strokeOpacity,\n area.attribute.segments[index],\n [areaAttribute, area.attribute],\n min(_cr, 1),\n x,\n y,\n z,\n area,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n });\n }\n } else {\n this.drawSegmentItem(\n context,\n area.cacheArea as IAreaCacheItem,\n doFill,\n fillOpacity,\n doStroke,\n strokeOpacity,\n area.attribute,\n areaAttribute,\n clipRange,\n x,\n y,\n z,\n area,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n }\n\n draw(area: IArea, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const { context } = drawContext;\n\n // const areaAttribute = graphicService.themeService.getCurrentTheme().areaAttribute;\n const areaAttribute = getTheme(area, params?.theme).area;\n let { x = areaAttribute.x, y = areaAttribute.y } = area.attribute;\n\n context.highPerformanceSave();\n\n if (!area.transMatrix.onlyTranslate()) {\n // 性能较差\n x = 0;\n y = 0;\n context.transformFromMatrix(area.transMatrix, true);\n } else {\n const point = area.getOffsetXY(areaAttribute);\n x += point.x;\n y += point.y;\n // 当前context有rotate/scale,重置matrix\n context.setTransformForCurrent();\n }\n\n if (drawPathProxy(area, context, x, y, drawContext, params)) {\n context.highPerformanceRestore();\n return;\n }\n\n this.drawShape(area, context, x, y, drawContext, params);\n\n context.highPerformanceRestore();\n }\n\n /**\n * 绘制segment\n * @param context\n * @param cache\n * @param fill\n * @param stroke\n * @param attribute\n * @param defaultAttribute\n * @param clipRange\n * @param offsetX\n * @param offsetY\n * @param fillCb\n * @param strokeCb\n * @returns 返回true代表跳过后续绘制\n */\n protected drawSegmentItem(\n context: IContext2d,\n cache: IAreaCacheItem,\n fill: boolean,\n fillOpacity: number,\n stroke: boolean,\n strokeOpacity: number,\n attribute: Partial<IAreaGraphicAttribute>,\n defaultAttribute: Required<IAreaGraphicAttribute> | Partial<IAreaGraphicAttribute>[],\n clipRange: number,\n offsetX: number,\n offsetY: number,\n offsetZ: number,\n area: IArea,\n drawContext: IDrawContext,\n fillCb?: (\n ctx: IContext2d,\n lineAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute | IThemeAttribute[]\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n lineAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute | IThemeAttribute[]\n ) => boolean\n ): boolean {\n context.beginPath();\n\n const ret: boolean = false;\n drawAreaSegments(context.camera ? context : context.nativeContext, cache, clipRange, {\n offsetX,\n offsetY,\n offsetZ\n });\n\n if (!this._areaRenderContribitions) {\n this._areaRenderContribitions = this.areaRenderContribitions.getContributions() || [];\n this._areaRenderContribitions.sort((a, b) => b.order - a.order);\n }\n this._areaRenderContribitions.forEach(c => {\n if (c.time === BaseRenderContributionTime.beforeFillStroke) {\n // c.useStyle && context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute);\n c.drawShape(\n area,\n context,\n offsetX,\n offsetY,\n !!fillOpacity,\n false,\n fill,\n false,\n defaultAttribute as any,\n drawContext,\n fillCb,\n null,\n { attribute }\n );\n }\n });\n\n // shadow\n context.setShadowStyle && context.setShadowStyle(area, attribute, defaultAttribute);\n\n const { x: originX = 0, x: originY = 0 } = attribute;\n if (fill !== false) {\n if (fillCb) {\n fillCb(context, attribute, defaultAttribute);\n } else if (fillOpacity) {\n context.setCommonStyle(area, attribute, originX - offsetX, originY - offsetY, defaultAttribute);\n context.fill();\n }\n }\n\n if (stroke !== false) {\n if (strokeCb) {\n strokeCb(context, attribute, defaultAttribute);\n } else {\n const { stroke } = attribute;\n if (isArray(stroke) && stroke[0] && stroke[1] === false) {\n context.beginPath();\n drawSegments(context.camera ? context : context.nativeContext, cache.top, clipRange, 'auto', {\n offsetX,\n offsetY,\n offsetZ\n });\n }\n context.setStrokeStyle(area, attribute, originX - offsetX, originY - offsetY, defaultAttribute);\n context.stroke();\n }\n }\n\n if (!this._areaRenderContribitions) {\n this._areaRenderContribitions = this.areaRenderContribitions.getContributions() || [];\n }\n this._areaRenderContribitions.forEach(c => {\n if (c.time === BaseRenderContributionTime.afterFillStroke) {\n c.drawShape(\n area,\n context,\n offsetX,\n offsetY,\n !!fillOpacity,\n false,\n fill,\n false,\n defaultAttribute as any,\n drawContext,\n fillCb,\n null,\n { attribute }\n );\n }\n });\n\n return ret;\n }\n}\n"]}
|
|
@@ -16,7 +16,7 @@ import { getTheme } from "../../../graphic/theme";
|
|
|
16
16
|
|
|
17
17
|
import { CIRCLE_NUMBER_TYPE } from "../../../graphic/constants";
|
|
18
18
|
|
|
19
|
-
import { CircleRenderContribution } from "./contributions/
|
|
19
|
+
import { CircleRenderContribution } from "./contributions/constants";
|
|
20
20
|
|
|
21
21
|
import { ContributionProvider } from "../../../common/contribution-provider";
|
|
22
22
|
|
|
@@ -33,12 +33,12 @@ let DefaultCanvasCircleRender = class {
|
|
|
33
33
|
circle.valid && visible && (doFill || doStroke || background) && (fVisible || sVisible || fillCb || strokeCb || background) && (context.beginPath(),
|
|
34
34
|
context.arc(x, y, radius, startAngle, endAngle), context.closePath(), this._circleRenderContribitions || (this._circleRenderContribitions = this.circleRenderContribitions.getContributions() || [],
|
|
35
35
|
this._circleRenderContribitions.sort(((a, b) => b.order - a.order))), this._circleRenderContribitions.forEach((c => {
|
|
36
|
-
c.time === BaseRenderContributionTime.beforeFillStroke && c.drawShape(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, fillCb, strokeCb);
|
|
36
|
+
c.time === BaseRenderContributionTime.beforeFillStroke && c.drawShape(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, drawContext, fillCb, strokeCb);
|
|
37
37
|
})), context.setShadowStyle && context.setShadowStyle(circle, circle.attribute, circleAttribute),
|
|
38
38
|
doFill && (fillCb ? fillCb(context, circle.attribute, circleAttribute) : fVisible && (context.setCommonStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute),
|
|
39
39
|
context.fill())), doStroke && (strokeCb ? strokeCb(context, circle.attribute, circleAttribute) : sVisible && (context.setStrokeStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute),
|
|
40
40
|
context.stroke())), this._circleRenderContribitions.forEach((c => {
|
|
41
|
-
c.time === BaseRenderContributionTime.afterFillStroke && c.drawShape(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, fillCb, strokeCb);
|
|
41
|
+
c.time === BaseRenderContributionTime.afterFillStroke && c.drawShape(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, drawContext, fillCb, strokeCb);
|
|
42
42
|
})));
|
|
43
43
|
}
|
|
44
44
|
draw(circle, renderService, drawContext, params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,EAAE,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;QAE3D,OAAO,CAAC,sBAAsB,EAAE,CAAC;IACnC,CAAC;CACF,CAAA;AAjJY,yBAAyB;IADrC,UAAU,EAAE;IAQR,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,wBAAwB,CAAC,CAAA;;GARvB,yBAAyB,CAiJrC;SAjJY,yBAAyB","file":"circle-render.js","sourcesContent":["import { inject, injectable, named } from 'inversify';\nimport type {\n IGraphicAttribute,\n ICircle,\n IContext2d,\n IMarkAttribute,\n IThemeAttribute,\n ICircleRenderContribution,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider\n} from '../../../interface';\nimport { getTheme } from '../../../graphic/theme';\nimport { CIRCLE_NUMBER_TYPE } from '../../../graphic/constants';\nimport { CircleRenderContribution } from './contributions/circle-contribution-render';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { drawPathProxy, fillVisible, runFill, runStroke, strokeVisible } from './utils';\nimport { BaseRenderContributionTime } from '../../../common/enums';\n\n@injectable()\nexport class DefaultCanvasCircleRender implements IGraphicRender {\n type: 'circle';\n numberType: number = CIRCLE_NUMBER_TYPE;\n\n protected _circleRenderContribitions: ICircleRenderContribution[];\n\n constructor(\n @inject(ContributionProvider)\n @named(CircleRenderContribution)\n protected readonly circleRenderContribitions: IContributionProvider<ICircleRenderContribution>\n ) {}\n\n drawShape(\n circle: ICircle,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n // const circleAttribute = graphicService.themeService.getCurrentTheme().circleAttribute;\n const circleAttribute = getTheme(circle, params?.theme).circle;\n const {\n fill = circleAttribute.fill,\n background,\n stroke = circleAttribute.stroke,\n radius = circleAttribute.radius,\n startAngle = circleAttribute.startAngle,\n endAngle = circleAttribute.endAngle,\n fillOpacity = circleAttribute.fillOpacity,\n strokeOpacity = circleAttribute.strokeOpacity,\n opacity = circleAttribute.opacity,\n lineWidth = circleAttribute.lineWidth,\n visible = circleAttribute.visible,\n x: originX = circleAttribute.x,\n y: originY = circleAttribute.y\n } = circle.attribute;\n\n // 不绘制或者透明\n const fVisible = fillVisible(opacity, fillOpacity);\n const sVisible = strokeVisible(opacity, strokeOpacity);\n const doFill = runFill(fill);\n const doStroke = runStroke(stroke, lineWidth);\n\n if (!(circle.valid && visible)) {\n return;\n }\n\n if (!(doFill || doStroke || background)) {\n return;\n }\n\n // 如果存在fillCb和strokeCb,那就不直接跳过\n if (!(fVisible || sVisible || fillCb || strokeCb || background)) {\n return;\n }\n\n context.beginPath();\n context.arc(x, y, radius, startAngle, endAngle);\n context.closePath();\n\n if (!this._circleRenderContribitions) {\n this._circleRenderContribitions = this.circleRenderContribitions.getContributions() || [];\n this._circleRenderContribitions.sort((a, b) => b.order - a.order);\n }\n\n this._circleRenderContribitions.forEach(c => {\n if (c.time === BaseRenderContributionTime.beforeFillStroke) {\n // c.useStyle && context.setCommonStyle(circle, circle.attribute, x, y, circleAttribute);\n c.drawShape(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, fillCb, strokeCb);\n }\n });\n\n // shadow\n context.setShadowStyle && context.setShadowStyle(circle, circle.attribute, circleAttribute);\n\n if (doFill) {\n if (fillCb) {\n fillCb(context, circle.attribute, circleAttribute);\n } else if (fVisible) {\n context.setCommonStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute);\n context.fill();\n }\n }\n\n if (doStroke) {\n if (strokeCb) {\n strokeCb(context, circle.attribute, circleAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute);\n context.stroke();\n }\n }\n\n this._circleRenderContribitions.forEach(c => {\n if (c.time === BaseRenderContributionTime.afterFillStroke) {\n // c.useStyle && context.setCommonStyle(circle, circle.attribute, x, y, circleAttribute);\n c.drawShape(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, fillCb, strokeCb);\n }\n });\n }\n\n draw(circle: ICircle, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const { context } = drawContext;\n if (!context) {\n return;\n }\n\n context.highPerformanceSave();\n\n // const circleAttribute = graphicService.themeService.getCurrentTheme().circleAttribute;\n const circleAttribute = getTheme(circle, params?.theme).circle;\n let { x = circleAttribute.x, y = circleAttribute.y } = circle.attribute;\n if (!circle.transMatrix.onlyTranslate()) {\n // 性能较差\n x = 0;\n y = 0;\n context.transformFromMatrix(circle.transMatrix, true);\n } else {\n const point = circle.getOffsetXY(circleAttribute);\n x += point.x;\n y += point.y;\n // 当前context有rotate/scale,重置matrix\n context.setTransformForCurrent();\n }\n\n if (drawPathProxy(circle, context, x, y, drawContext, params)) {\n context.highPerformanceRestore();\n return;\n }\n\n this.drawShape(circle, context, x, y, drawContext, params);\n\n context.highPerformanceRestore();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/render/contributions/render/circle-render.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AActD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,E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uBAAN,MAAM,CAAE,KAAK,CAAC,CAAC,MAAM,CAAC;QAC/D,IAAI,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC;QACxE,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,aAAa,EAAE,EAAE;YAEvC,CAAC,GAAG,CAAC,CAAC;YACN,CAAC,GAAG,CAAC,CAAC;YACN,OAAO,CAAC,mBAAmB,CAAC,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;SACvD;aAAM;YACL,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;YAClD,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;YACb,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;YAEb,OAAO,CAAC,sBAAsB,EAAE,CAAC;SAClC;QAED,IAAI,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE;YAC7D,OAAO,CAAC,sBAAsB,EAAE,CAAC;YACjC,OAAO;SACR;QAED,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;QAE3D,OAAO,CAAC,sBAAsB,EAAE,CAAC;IACnC,CAAC;CACF,CAAA;AA3KY,yBAAyB;IADrC,UAAU,EAAE;IAQR,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,wBAAwB,CAAC,CAAA;;GARvB,yBAAyB,CA2KrC;SA3KY,yBAAyB","file":"circle-render.js","sourcesContent":["import { inject, injectable, named } from 'inversify';\nimport type {\n IGraphicAttribute,\n ICircle,\n IContext2d,\n IMarkAttribute,\n IThemeAttribute,\n ICircleRenderContribution,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider\n} from '../../../interface';\nimport { getTheme } from '../../../graphic/theme';\nimport { CIRCLE_NUMBER_TYPE } from '../../../graphic/constants';\nimport { CircleRenderContribution } from './contributions/constants';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { drawPathProxy, fillVisible, runFill, runStroke, strokeVisible } from './utils';\nimport { BaseRenderContributionTime } from '../../../common/enums';\n\n@injectable()\nexport class DefaultCanvasCircleRender implements IGraphicRender {\n type: 'circle';\n numberType: number = CIRCLE_NUMBER_TYPE;\n\n protected _circleRenderContribitions: ICircleRenderContribution[];\n\n constructor(\n @inject(ContributionProvider)\n @named(CircleRenderContribution)\n protected readonly circleRenderContribitions: IContributionProvider<ICircleRenderContribution>\n ) {}\n\n drawShape(\n circle: ICircle,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n // const circleAttribute = graphicService.themeService.getCurrentTheme().circleAttribute;\n const circleAttribute = getTheme(circle, params?.theme).circle;\n const {\n fill = circleAttribute.fill,\n background,\n stroke = circleAttribute.stroke,\n radius = circleAttribute.radius,\n startAngle = circleAttribute.startAngle,\n endAngle = circleAttribute.endAngle,\n fillOpacity = circleAttribute.fillOpacity,\n strokeOpacity = circleAttribute.strokeOpacity,\n opacity = circleAttribute.opacity,\n lineWidth = circleAttribute.lineWidth,\n visible = circleAttribute.visible,\n x: originX = circleAttribute.x,\n y: originY = circleAttribute.y\n } = circle.attribute;\n\n // 不绘制或者透明\n const fVisible = fillVisible(opacity, fillOpacity);\n const sVisible = strokeVisible(opacity, strokeOpacity);\n const doFill = runFill(fill);\n const doStroke = runStroke(stroke, lineWidth);\n\n if (!(circle.valid && visible)) {\n return;\n }\n\n if (!(doFill || doStroke || background)) {\n return;\n }\n\n // 如果存在fillCb和strokeCb,那就不直接跳过\n if (!(fVisible || sVisible || fillCb || strokeCb || background)) {\n return;\n }\n\n context.beginPath();\n context.arc(x, y, radius, startAngle, endAngle);\n context.closePath();\n\n if (!this._circleRenderContribitions) {\n this._circleRenderContribitions = this.circleRenderContribitions.getContributions() || [];\n this._circleRenderContribitions.sort((a, b) => b.order - a.order);\n }\n\n this._circleRenderContribitions.forEach(c => {\n if (c.time === BaseRenderContributionTime.beforeFillStroke) {\n // c.useStyle && context.setCommonStyle(circle, circle.attribute, x, y, circleAttribute);\n c.drawShape(\n circle,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n circleAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n });\n\n // shadow\n context.setShadowStyle && context.setShadowStyle(circle, circle.attribute, circleAttribute);\n\n if (doFill) {\n if (fillCb) {\n fillCb(context, circle.attribute, circleAttribute);\n } else if (fVisible) {\n context.setCommonStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute);\n context.fill();\n }\n }\n\n if (doStroke) {\n if (strokeCb) {\n strokeCb(context, circle.attribute, circleAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute);\n context.stroke();\n }\n }\n\n this._circleRenderContribitions.forEach(c => {\n if (c.time === BaseRenderContributionTime.afterFillStroke) {\n // c.useStyle && context.setCommonStyle(circle, circle.attribute, x, y, circleAttribute);\n c.drawShape(\n circle,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n circleAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n });\n }\n\n draw(circle: ICircle, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const { context } = drawContext;\n if (!context) {\n return;\n }\n\n context.highPerformanceSave();\n\n // const circleAttribute = graphicService.themeService.getCurrentTheme().circleAttribute;\n const circleAttribute = getTheme(circle, params?.theme).circle;\n let { x = circleAttribute.x, y = circleAttribute.y } = circle.attribute;\n if (!circle.transMatrix.onlyTranslate()) {\n // 性能较差\n x = 0;\n y = 0;\n context.transformFromMatrix(circle.transMatrix, true);\n } else {\n const point = circle.getOffsetXY(circleAttribute);\n x += point.x;\n y += point.y;\n // 当前context有rotate/scale,重置matrix\n context.setTransformForCurrent();\n }\n\n if (drawPathProxy(circle, context, x, y, drawContext, params)) {\n context.highPerformanceRestore();\n return;\n }\n\n this.drawShape(circle, context, x, y, drawContext, params);\n\n context.highPerformanceRestore();\n }\n}\n"]}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import type { IGraphicAttribute, IContext2d, IMarkAttribute, IArc, IArcGraphicAttribute, IThemeAttribute, IArcRenderContribution } from '../../../../interface';
|
|
1
|
+
import type { IGraphicAttribute, IContext2d, IMarkAttribute, IArc, IArcGraphicAttribute, IThemeAttribute, IArcRenderContribution, IDrawContext } from '../../../../interface';
|
|
2
2
|
import { DefaultBaseBackgroundRenderContribution, DefaultBaseTextureRenderContribution } from './base-contribution-render';
|
|
3
3
|
import { BaseRenderContributionTime } from '../../../../common/enums';
|
|
4
|
-
export declare const ArcRenderContribution: unique symbol;
|
|
5
4
|
export declare class DefaultArcRenderContribution implements IArcRenderContribution {
|
|
6
5
|
time: BaseRenderContributionTime;
|
|
7
6
|
useStyle: boolean;
|
|
8
7
|
order: number;
|
|
9
|
-
drawShape(arc: IArc, context: IContext2d, x: number, y: number, doFill: boolean, doStroke: boolean, fVisible: boolean, sVisible: boolean, arcAttribute: Required<IArcGraphicAttribute>, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean): void;
|
|
8
|
+
drawShape(arc: IArc, context: IContext2d, x: number, y: number, doFill: boolean, doStroke: boolean, fVisible: boolean, sVisible: boolean, arcAttribute: Required<IArcGraphicAttribute>, drawContext: IDrawContext, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean): void;
|
|
10
9
|
}
|
|
11
10
|
export declare class DefaultArcBackgroundRenderContribution extends DefaultBaseBackgroundRenderContribution implements IArcRenderContribution {
|
|
12
11
|
time: BaseRenderContributionTime;
|