@visactor/vrender-core 0.19.4-alpha.4 → 0.19.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/allocator/allocator-modules.js +0 -2
- package/cjs/allocator/bounds-allocate.js +1 -1
- package/cjs/allocator/bounds-allocate.js.map +1 -1
- package/cjs/allocator/canvas-allocate.js +11 -9
- package/cjs/allocator/canvas-allocate.js.map +1 -1
- package/cjs/allocator/graphic-allocate.js +5 -9
- package/cjs/allocator/graphic-allocate.js.map +1 -1
- package/cjs/allocator/matrix-allocate.js +2 -6
- package/cjs/allocator/matrix-allocate.js.map +1 -1
- package/cjs/animate/Ticker/default-ticker.js +25 -14
- package/cjs/animate/Ticker/default-ticker.js.map +1 -1
- package/cjs/animate/animate.js +8 -7
- package/cjs/animate/animate.js.map +1 -1
- package/cjs/animate/config.js +1 -2
- package/cjs/animate/custom-animate.js +54 -51
- package/cjs/animate/custom-animate.js.map +1 -1
- package/cjs/animate/easing.js +19 -8
- package/cjs/animate/easing.js.map +1 -1
- package/cjs/animate/morphing.js +20 -23
- package/cjs/animate/morphing.js.map +1 -1
- package/cjs/application.js +7 -1
- package/cjs/application.js.map +1 -1
- package/cjs/canvas/conical-gradient.js +12 -5
- package/cjs/canvas/conical-gradient.js.map +1 -1
- package/cjs/canvas/contributions/base-canvas.js +19 -7
- package/cjs/canvas/contributions/base-canvas.js.map +1 -1
- package/cjs/color-string/interpolate.js +5 -3
- package/cjs/color-string/interpolate.js.map +1 -1
- package/cjs/color-string/store.js +3 -1
- package/cjs/color-string/store.js.map +1 -1
- package/cjs/common/bounds-context.js +1 -0
- package/cjs/common/bounds-context.js.map +1 -1
- package/cjs/common/canvas-utils.js +3 -6
- package/cjs/common/canvas-utils.js.map +1 -1
- package/cjs/common/contribution-provider.js +3 -0
- package/cjs/common/contribution-provider.js.map +1 -1
- package/cjs/common/custom-path2d.js +7 -1
- package/cjs/common/custom-path2d.js.map +1 -1
- package/cjs/common/generator.js +2 -1
- package/cjs/common/generator.js.map +1 -1
- package/cjs/common/inversify/binding.js +12 -0
- package/cjs/common/inversify/binding.js.map +1 -1
- package/cjs/common/inversify/container.js +4 -0
- package/cjs/common/inversify/container.js.map +1 -1
- package/cjs/common/inversify/cotainer-module.js +2 -0
- package/cjs/common/inversify/cotainer-module.js.map +1 -1
- package/cjs/common/inversify/meta-data.js +2 -0
- package/cjs/common/inversify/meta-data.js.map +1 -1
- package/cjs/common/inversify/syntax/binding_in_syntax.js +1 -0
- package/cjs/common/inversify/syntax/binding_in_syntax.js.map +1 -1
- package/cjs/common/inversify/syntax/binding_to_syntax.js +1 -0
- package/cjs/common/inversify/syntax/binding_to_syntax.js.map +1 -1
- package/cjs/common/inversify-lite/annotation/lazy_service_identifier.js +1 -0
- package/cjs/common/inversify-lite/annotation/lazy_service_identifier.js.map +1 -1
- package/cjs/common/inversify-lite/bindings/binding.js +14 -0
- package/cjs/common/inversify-lite/bindings/binding.js.map +1 -1
- package/cjs/common/inversify-lite/container/container.js +22 -46
- package/cjs/common/inversify-lite/container/container.js.map +1 -1
- package/cjs/common/inversify-lite/container/container_module.js +4 -0
- package/cjs/common/inversify-lite/container/container_module.js.map +1 -1
- package/cjs/common/inversify-lite/container/lookup.js +1 -0
- package/cjs/common/inversify-lite/container/lookup.js.map +1 -1
- package/cjs/common/inversify-lite/planning/context.js +4 -0
- package/cjs/common/inversify-lite/planning/context.js.map +1 -1
- package/cjs/common/inversify-lite/planning/metadata.js +2 -0
- package/cjs/common/inversify-lite/planning/metadata.js.map +1 -1
- package/cjs/common/inversify-lite/planning/plan.js +2 -0
- package/cjs/common/inversify-lite/planning/plan.js.map +1 -1
- package/cjs/common/inversify-lite/planning/queryable_string.js +1 -0
- package/cjs/common/inversify-lite/planning/queryable_string.js.map +1 -1
- package/cjs/common/inversify-lite/planning/request.js +8 -0
- package/cjs/common/inversify-lite/planning/request.js.map +1 -1
- package/cjs/common/inversify-lite/planning/target.js +7 -0
- package/cjs/common/inversify-lite/planning/target.js.map +1 -1
- package/cjs/common/inversify-lite/resolution/instantiation.js +16 -42
- package/cjs/common/inversify-lite/resolution/instantiation.js.map +1 -1
- package/cjs/common/inversify-lite/scope/scope.js +3 -29
- package/cjs/common/inversify-lite/scope/scope.js.map +1 -1
- package/cjs/common/inversify-lite/syntax/binding_in_syntax.js +1 -0
- package/cjs/common/inversify-lite/syntax/binding_in_syntax.js.map +1 -1
- package/cjs/common/inversify-lite/syntax/binding_in_when_on_syntax.js +3 -0
- package/cjs/common/inversify-lite/syntax/binding_in_when_on_syntax.js.map +1 -1
- package/cjs/common/inversify-lite/syntax/binding_on_syntax.js +1 -0
- package/cjs/common/inversify-lite/syntax/binding_on_syntax.js.map +1 -1
- package/cjs/common/inversify-lite/syntax/binding_to_syntax.js +1 -0
- package/cjs/common/inversify-lite/syntax/binding_to_syntax.js.map +1 -1
- package/cjs/common/inversify-lite/syntax/binding_when_on_syntax.js +2 -0
- package/cjs/common/inversify-lite/syntax/binding_when_on_syntax.js.map +1 -1
- package/cjs/common/inversify-lite/syntax/binding_when_syntax.js +1 -0
- package/cjs/common/inversify-lite/syntax/binding_when_syntax.js.map +1 -1
- package/cjs/common/polygon.js +1 -2
- package/cjs/common/polygon.js.map +1 -1
- package/cjs/common/render-area.js +2 -3
- package/cjs/common/render-area.js.map +1 -1
- package/cjs/common/render-curve.js +4 -8
- package/cjs/common/render-curve.js.map +1 -1
- package/cjs/common/seg-context.js +12 -3
- package/cjs/common/seg-context.js.map +1 -1
- package/cjs/common/segment/basis.js +13 -0
- package/cjs/common/segment/basis.js.map +1 -1
- package/cjs/common/segment/common.js +2 -2
- package/cjs/common/segment/common.js.map +1 -1
- package/cjs/common/segment/curve/arc.js +2 -2
- package/cjs/common/segment/curve/arc.js.map +1 -1
- package/cjs/common/segment/curve/base.js +4 -0
- package/cjs/common/segment/curve/base.js.map +1 -1
- package/cjs/common/segment/curve/cubic-bezier.js +2 -2
- package/cjs/common/segment/curve/cubic-bezier.js.map +1 -1
- package/cjs/common/segment/curve/curve-context.js +4 -0
- package/cjs/common/segment/curve/curve-context.js.map +1 -1
- package/cjs/common/segment/curve/ellipse.js +3 -3
- package/cjs/common/segment/curve/ellipse.js.map +1 -1
- package/cjs/common/segment/curve/line.js +2 -1
- package/cjs/common/segment/curve/line.js.map +1 -1
- package/cjs/common/segment/curve/move.js +2 -1
- package/cjs/common/segment/curve/move.js.map +1 -1
- package/cjs/common/segment/curve/path.js +2 -0
- package/cjs/common/segment/curve/path.js.map +1 -1
- package/cjs/common/segment/curve/quadratic-bezier.js +2 -2
- package/cjs/common/segment/curve/quadratic-bezier.js.map +1 -1
- package/cjs/common/segment/linear-closed.js.map +1 -1
- package/cjs/common/segment/linear.js +10 -0
- package/cjs/common/segment/linear.js.map +1 -1
- package/cjs/common/segment/monotone.js +13 -0
- package/cjs/common/segment/monotone.js.map +1 -1
- package/cjs/common/segment/step.js +13 -2
- package/cjs/common/segment/step.js.map +1 -1
- package/cjs/common/sort.js +3 -34
- package/cjs/common/sort.js.map +1 -1
- package/cjs/common/split-path.js +4 -11
- package/cjs/common/split-path.js.map +1 -1
- package/cjs/common/utils.d.ts +1 -1
- package/cjs/common/utils.js +10 -6
- package/cjs/common/utils.js.map +1 -1
- package/cjs/common/xml/parser.js +3 -2
- package/cjs/common/xml/parser.js.map +1 -1
- package/cjs/core/camera.js +11 -4
- package/cjs/core/camera.js.map +1 -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/layerHandler/canvas2d-contribution.js +20 -11
- package/cjs/core/contributions/layerHandler/canvas2d-contribution.js.map +1 -1
- package/cjs/core/contributions/layerHandler/empty-contribution.js +8 -8
- package/cjs/core/contributions/layerHandler/empty-contribution.js.map +1 -1
- package/cjs/core/contributions/layerHandler/offscreen2d-contribution.js +5 -6
- package/cjs/core/contributions/layerHandler/offscreen2d-contribution.js.map +1 -1
- package/cjs/core/contributions/textMeasure/AtextMeasure.js +11 -8
- package/cjs/core/contributions/textMeasure/AtextMeasure.js.map +1 -1
- package/cjs/core/contributions/textMeasure/layout.js +3 -0
- package/cjs/core/contributions/textMeasure/layout.js.map +1 -1
- package/cjs/core/contributions/window/base-contribution.js +2 -0
- package/cjs/core/contributions/window/base-contribution.js.map +1 -1
- package/cjs/core/global.js +8 -0
- package/cjs/core/global.js.map +1 -1
- package/cjs/core/graphic-utils.js +16 -5
- package/cjs/core/graphic-utils.js.map +1 -1
- package/cjs/core/layer-service.js +7 -7
- package/cjs/core/layer-service.js.map +1 -1
- package/cjs/core/layer.js +7 -9
- package/cjs/core/layer.js.map +1 -1
- package/cjs/core/stage.js +79 -35
- package/cjs/core/stage.js.map +1 -1
- package/cjs/core/window.js +16 -13
- package/cjs/core/window.js.map +1 -1
- package/cjs/event/event-manager.js +152 -143
- package/cjs/event/event-manager.js.map +1 -1
- package/cjs/event/event-system.js +60 -43
- package/cjs/event/event-system.js.map +1 -1
- package/cjs/event/event-target.js +1 -3
- package/cjs/event/event-target.js.map +1 -1
- package/cjs/event/federated-event/base-event.js +43 -15
- package/cjs/event/federated-event/base-event.js.map +1 -1
- package/cjs/event/federated-event/mouse-event.js +27 -18
- package/cjs/event/federated-event/mouse-event.js.map +1 -1
- package/cjs/event/federated-event/pointer-event.js +13 -8
- package/cjs/event/federated-event/pointer-event.js.map +1 -1
- package/cjs/event/federated-event/wheel-event.js +14 -10
- package/cjs/event/federated-event/wheel-event.js.map +1 -1
- package/cjs/graphic/arc.js +10 -5
- package/cjs/graphic/arc.js.map +1 -1
- package/cjs/graphic/arc3d.js +7 -4
- package/cjs/graphic/arc3d.js.map +1 -1
- package/cjs/graphic/area.js +14 -9
- package/cjs/graphic/area.js.map +1 -1
- package/cjs/graphic/builtin-symbol/arrow.js +2 -3
- package/cjs/graphic/builtin-symbol/arrow.js.map +1 -1
- package/cjs/graphic/builtin-symbol/arrow2-down.js +2 -3
- package/cjs/graphic/builtin-symbol/arrow2-down.js.map +1 -1
- package/cjs/graphic/builtin-symbol/arrow2-left.js +2 -3
- package/cjs/graphic/builtin-symbol/arrow2-left.js.map +1 -1
- package/cjs/graphic/builtin-symbol/arrow2-right.js +2 -3
- package/cjs/graphic/builtin-symbol/arrow2-right.js.map +1 -1
- package/cjs/graphic/builtin-symbol/arrow2-up.js +2 -3
- package/cjs/graphic/builtin-symbol/arrow2-up.js.map +1 -1
- package/cjs/graphic/builtin-symbol/circle.js +2 -3
- package/cjs/graphic/builtin-symbol/circle.js.map +1 -1
- package/cjs/graphic/builtin-symbol/close.js +2 -3
- package/cjs/graphic/builtin-symbol/close.js.map +1 -1
- package/cjs/graphic/builtin-symbol/cross.js +2 -3
- package/cjs/graphic/builtin-symbol/cross.js.map +1 -1
- package/cjs/graphic/builtin-symbol/diamond.js +2 -3
- package/cjs/graphic/builtin-symbol/diamond.js.map +1 -1
- package/cjs/graphic/builtin-symbol/line-h.js +2 -3
- package/cjs/graphic/builtin-symbol/line-h.js.map +1 -1
- package/cjs/graphic/builtin-symbol/line-v.js +2 -3
- package/cjs/graphic/builtin-symbol/line-v.js.map +1 -1
- package/cjs/graphic/builtin-symbol/rect.js +2 -3
- package/cjs/graphic/builtin-symbol/rect.js.map +1 -1
- package/cjs/graphic/builtin-symbol/square.js +2 -3
- package/cjs/graphic/builtin-symbol/square.js.map +1 -1
- package/cjs/graphic/builtin-symbol/star.js +2 -3
- package/cjs/graphic/builtin-symbol/star.js.map +1 -1
- package/cjs/graphic/builtin-symbol/stroke.js +2 -3
- package/cjs/graphic/builtin-symbol/stroke.js.map +1 -1
- package/cjs/graphic/builtin-symbol/thin-triangle.js +2 -3
- package/cjs/graphic/builtin-symbol/thin-triangle.js.map +1 -1
- package/cjs/graphic/builtin-symbol/triangle-down.js +2 -3
- package/cjs/graphic/builtin-symbol/triangle-down.js.map +1 -1
- package/cjs/graphic/builtin-symbol/triangle-left.js +2 -3
- package/cjs/graphic/builtin-symbol/triangle-left.js.map +1 -1
- package/cjs/graphic/builtin-symbol/triangle-right.js +2 -3
- package/cjs/graphic/builtin-symbol/triangle-right.js.map +1 -1
- package/cjs/graphic/builtin-symbol/triangle-up.js +2 -3
- package/cjs/graphic/builtin-symbol/triangle-up.js.map +1 -1
- package/cjs/graphic/builtin-symbol/triangle.js +1 -3
- package/cjs/graphic/builtin-symbol/triangle.js.map +1 -1
- package/cjs/graphic/builtin-symbol/utils.js +6 -1
- package/cjs/graphic/builtin-symbol/utils.js.map +1 -1
- package/cjs/graphic/builtin-symbol/wedge.js +2 -3
- package/cjs/graphic/builtin-symbol/wedge.js.map +1 -1
- package/cjs/graphic/builtin-symbol/wye.js +2 -3
- package/cjs/graphic/builtin-symbol/wye.js.map +1 -1
- package/cjs/graphic/circle.js +8 -6
- package/cjs/graphic/circle.js.map +1 -1
- package/cjs/graphic/config.js +59 -32
- package/cjs/graphic/config.js.map +1 -1
- package/cjs/graphic/glyph.js +10 -9
- package/cjs/graphic/glyph.js.map +1 -1
- package/cjs/graphic/graphic-service/graphic-service.js +12 -8
- package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
- package/cjs/graphic/graphic.d.ts +1 -0
- package/cjs/graphic/graphic.js +32 -42
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/graphic/group.js +9 -5
- package/cjs/graphic/group.js.map +1 -1
- package/cjs/graphic/image.js +18 -16
- package/cjs/graphic/image.js.map +1 -1
- package/cjs/graphic/line.js +11 -6
- package/cjs/graphic/line.js.map +1 -1
- package/cjs/graphic/node-tree.js +25 -44
- package/cjs/graphic/node-tree.js.map +1 -1
- package/cjs/graphic/path.js +12 -6
- package/cjs/graphic/path.js.map +1 -1
- package/cjs/graphic/polygon.js +7 -4
- package/cjs/graphic/polygon.js.map +1 -1
- package/cjs/graphic/pyramid3d.js +4 -3
- package/cjs/graphic/pyramid3d.js.map +1 -1
- package/cjs/graphic/rect.js +7 -3
- package/cjs/graphic/rect.js.map +1 -1
- package/cjs/graphic/rect3d.js +5 -4
- package/cjs/graphic/rect3d.js.map +1 -1
- package/cjs/graphic/richtext/frame.js +19 -0
- package/cjs/graphic/richtext/frame.js.map +1 -1
- package/cjs/graphic/richtext/icon.js +14 -6
- package/cjs/graphic/richtext/icon.js.map +1 -1
- package/cjs/graphic/richtext/line.js +14 -2
- package/cjs/graphic/richtext/line.js.map +1 -1
- package/cjs/graphic/richtext/paragraph.js +22 -0
- package/cjs/graphic/richtext/paragraph.js.map +1 -1
- package/cjs/graphic/richtext/utils.js +1 -2
- package/cjs/graphic/richtext/utils.js.map +1 -1
- package/cjs/graphic/richtext/wrapper.js +12 -0
- package/cjs/graphic/richtext/wrapper.js.map +1 -1
- package/cjs/graphic/richtext.js +38 -45
- package/cjs/graphic/richtext.js.map +1 -1
- package/cjs/graphic/shadow-root.js +2 -1
- package/cjs/graphic/shadow-root.js.map +1 -1
- package/cjs/graphic/symbol.js +12 -5
- package/cjs/graphic/symbol.js.map +1 -1
- package/cjs/graphic/text.js +45 -45
- package/cjs/graphic/text.js.map +1 -1
- package/cjs/graphic/theme.js +4 -0
- package/cjs/graphic/theme.js.map +1 -1
- package/cjs/graphic/tools.js +16 -44
- package/cjs/graphic/tools.js.map +1 -1
- package/cjs/graphic/wrap-text.js +7 -7
- package/cjs/graphic/wrap-text.js.map +1 -1
- package/cjs/interface/global.d.ts +2 -1
- package/cjs/interface/global.js.map +1 -1
- package/cjs/interface/graphic.d.ts +1 -0
- package/cjs/interface/graphic.js.map +1 -1
- package/cjs/picker/global-picker-service.js +1 -0
- package/cjs/picker/global-picker-service.js.map +1 -1
- package/cjs/picker/pick-interceptor.js +5 -15
- package/cjs/picker/pick-interceptor.js.map +1 -1
- package/cjs/picker/picker-service.js +5 -5
- package/cjs/picker/picker-service.js.map +1 -1
- package/cjs/plugins/builtin-plugin/3dview-transform-plugin.js +26 -20
- package/cjs/plugins/builtin-plugin/3dview-transform-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/auto-render-plugin.js +5 -4
- package/cjs/plugins/builtin-plugin/auto-render-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js +5 -4
- package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +11 -8
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.js +28 -19
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/incremental-auto-render-plugin.js +12 -8
- package/cjs/plugins/builtin-plugin/incremental-auto-render-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/react-attribute-plugin.js +6 -7
- package/cjs/plugins/builtin-plugin/react-attribute-plugin.js.map +1 -1
- package/cjs/plugins/plugin-service.js +1 -0
- package/cjs/plugins/plugin-service.js.map +1 -1
- package/cjs/render/contributions/render/arc-render.js +6 -4
- package/cjs/render/contributions/render/arc-render.js.map +1 -1
- package/cjs/render/contributions/render/arc3d-render.js +5 -7
- package/cjs/render/contributions/render/arc3d-render.js.map +1 -1
- package/cjs/render/contributions/render/area-render.js +21 -23
- package/cjs/render/contributions/render/area-render.js.map +1 -1
- package/cjs/render/contributions/render/base-render.js +5 -0
- package/cjs/render/contributions/render/base-render.js.map +1 -1
- package/cjs/render/contributions/render/circle-render.js +6 -4
- package/cjs/render/contributions/render/circle-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/arc-contribution-render.js +3 -4
- package/cjs/render/contributions/render/contributions/arc-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/area-texture-contribution-render.js +6 -9
- package/cjs/render/contributions/render/contributions/area-texture-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/base-contribution-render.js +10 -8
- package/cjs/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/base-texture-contribution-render.js +4 -4
- package/cjs/render/contributions/render/contributions/base-texture-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/circle-contribution-render.js +3 -4
- package/cjs/render/contributions/render/contributions/circle-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/group-contribution-render.js +1 -3
- package/cjs/render/contributions/render/contributions/group-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/image-contribution-render.js +1 -3
- package/cjs/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/rect-contribution-render.js +11 -14
- package/cjs/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/symbol-contribution-render.js +3 -4
- package/cjs/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/text-contribution-render.js +6 -8
- package/cjs/render/contributions/render/contributions/text-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/draw-contribution.js +12 -14
- package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
- package/cjs/render/contributions/render/draw-interceptor.js +11 -21
- package/cjs/render/contributions/render/draw-interceptor.js.map +1 -1
- package/cjs/render/contributions/render/glyph-render.js +2 -3
- package/cjs/render/contributions/render/glyph-render.js.map +1 -1
- package/cjs/render/contributions/render/graphic-render.js +4 -1
- package/cjs/render/contributions/render/graphic-render.js.map +1 -1
- package/cjs/render/contributions/render/group-render.js +7 -3
- package/cjs/render/contributions/render/group-render.js.map +1 -1
- package/cjs/render/contributions/render/image-render.js +4 -2
- package/cjs/render/contributions/render/image-render.js.map +1 -1
- package/cjs/render/contributions/render/incremental-area-render.js +1 -3
- package/cjs/render/contributions/render/incremental-area-render.js.map +1 -1
- package/cjs/render/contributions/render/incremental-draw-contribution.js +80 -109
- package/cjs/render/contributions/render/incremental-draw-contribution.js.map +1 -1
- package/cjs/render/contributions/render/incremental-line-render.js +1 -3
- package/cjs/render/contributions/render/incremental-line-render.js.map +1 -1
- package/cjs/render/contributions/render/line-render.js +12 -16
- package/cjs/render/contributions/render/line-render.js.map +1 -1
- package/cjs/render/contributions/render/path-render.js +8 -7
- package/cjs/render/contributions/render/path-render.js.map +1 -1
- package/cjs/render/contributions/render/polygon-render.js +6 -4
- package/cjs/render/contributions/render/polygon-render.js.map +1 -1
- package/cjs/render/contributions/render/pyramid3d-render.js +3 -5
- package/cjs/render/contributions/render/pyramid3d-render.js.map +1 -1
- package/cjs/render/contributions/render/rect-render.js +8 -7
- package/cjs/render/contributions/render/rect-render.js.map +1 -1
- package/cjs/render/contributions/render/rect3d-render.js +5 -7
- package/cjs/render/contributions/render/rect3d-render.js.map +1 -1
- package/cjs/render/contributions/render/richtext-render.js +4 -3
- package/cjs/render/contributions/render/richtext-render.js.map +1 -1
- package/cjs/render/contributions/render/symbol-render.js +11 -14
- package/cjs/render/contributions/render/symbol-render.js.map +1 -1
- package/cjs/render/contributions/render/text-render.js +8 -8
- package/cjs/render/contributions/render/text-render.js.map +1 -1
- package/cjs/render/contributions/render/utils.js +1 -1
- package/cjs/render/contributions/render/utils.js.map +1 -1
- package/cjs/render/render-service.js +11 -2
- package/cjs/render/render-service.js.map +1 -1
- package/cjs/resource-loader/loader.js +13 -16
- package/cjs/resource-loader/loader.js.map +1 -1
- package/cjs/tapable/Hook.js +3 -0
- package/cjs/tapable/Hook.js.map +1 -1
- package/dist/index.es.js +28908 -0
- package/es/allocator/allocator-modules.js +0 -2
- package/es/allocator/bounds-allocate.js +1 -1
- package/es/allocator/bounds-allocate.js.map +1 -1
- package/es/allocator/canvas-allocate.js +11 -9
- package/es/allocator/canvas-allocate.js.map +1 -1
- package/es/allocator/graphic-allocate.js +5 -9
- package/es/allocator/graphic-allocate.js.map +1 -1
- package/es/allocator/matrix-allocate.js +2 -6
- package/es/allocator/matrix-allocate.js.map +1 -1
- package/es/animate/Ticker/default-ticker.js +25 -14
- package/es/animate/Ticker/default-ticker.js.map +1 -1
- package/es/animate/animate.js +7 -8
- package/es/animate/animate.js.map +1 -1
- package/es/animate/config.js +1 -2
- package/es/animate/custom-animate.js +52 -50
- package/es/animate/custom-animate.js.map +1 -1
- package/es/animate/easing.js +18 -8
- package/es/animate/easing.js.map +1 -1
- package/es/animate/morphing.js +20 -23
- package/es/animate/morphing.js.map +1 -1
- package/es/application.js +7 -1
- package/es/application.js.map +1 -1
- package/es/canvas/conical-gradient.js +12 -6
- package/es/canvas/conical-gradient.js.map +1 -1
- package/es/canvas/contributions/base-canvas.js +19 -7
- package/es/canvas/contributions/base-canvas.js.map +1 -1
- package/es/color-string/interpolate.js +5 -3
- package/es/color-string/interpolate.js.map +1 -1
- package/es/color-string/store.js +2 -2
- package/es/color-string/store.js.map +1 -1
- package/es/common/bounds-context.js +1 -0
- package/es/common/bounds-context.js.map +1 -1
- package/es/common/canvas-utils.js +3 -6
- package/es/common/canvas-utils.js.map +1 -1
- package/es/common/contribution-provider.js +3 -0
- package/es/common/contribution-provider.js.map +1 -1
- package/es/common/custom-path2d.js +7 -1
- package/es/common/custom-path2d.js.map +1 -1
- package/es/common/generator.js +1 -2
- package/es/common/generator.js.map +1 -1
- package/es/common/inversify/binding.js +12 -0
- package/es/common/inversify/binding.js.map +1 -1
- package/es/common/inversify/container.js +4 -0
- package/es/common/inversify/container.js.map +1 -1
- package/es/common/inversify/cotainer-module.js +2 -0
- package/es/common/inversify/cotainer-module.js.map +1 -1
- package/es/common/inversify/meta-data.js +2 -0
- package/es/common/inversify/meta-data.js.map +1 -1
- package/es/common/inversify/syntax/binding_in_syntax.js +1 -0
- package/es/common/inversify/syntax/binding_in_syntax.js.map +1 -1
- package/es/common/inversify/syntax/binding_to_syntax.js +1 -0
- package/es/common/inversify/syntax/binding_to_syntax.js.map +1 -1
- package/es/common/inversify-lite/annotation/lazy_service_identifier.js +1 -0
- package/es/common/inversify-lite/annotation/lazy_service_identifier.js.map +1 -1
- package/es/common/inversify-lite/bindings/binding.js +14 -0
- package/es/common/inversify-lite/bindings/binding.js.map +1 -1
- package/es/common/inversify-lite/container/container.js +22 -48
- package/es/common/inversify-lite/container/container.js.map +1 -1
- package/es/common/inversify-lite/container/container_module.js +4 -0
- package/es/common/inversify-lite/container/container_module.js.map +1 -1
- package/es/common/inversify-lite/container/lookup.js +1 -0
- package/es/common/inversify-lite/container/lookup.js.map +1 -1
- package/es/common/inversify-lite/planning/context.js +4 -0
- package/es/common/inversify-lite/planning/context.js.map +1 -1
- package/es/common/inversify-lite/planning/metadata.js +2 -0
- package/es/common/inversify-lite/planning/metadata.js.map +1 -1
- package/es/common/inversify-lite/planning/plan.js +2 -0
- package/es/common/inversify-lite/planning/plan.js.map +1 -1
- package/es/common/inversify-lite/planning/queryable_string.js +1 -0
- package/es/common/inversify-lite/planning/queryable_string.js.map +1 -1
- package/es/common/inversify-lite/planning/request.js +8 -0
- package/es/common/inversify-lite/planning/request.js.map +1 -1
- package/es/common/inversify-lite/planning/target.js +7 -0
- package/es/common/inversify-lite/planning/target.js.map +1 -1
- package/es/common/inversify-lite/resolution/instantiation.js +16 -44
- package/es/common/inversify-lite/resolution/instantiation.js.map +1 -1
- package/es/common/inversify-lite/scope/scope.js +3 -29
- package/es/common/inversify-lite/scope/scope.js.map +1 -1
- package/es/common/inversify-lite/syntax/binding_in_syntax.js +1 -0
- package/es/common/inversify-lite/syntax/binding_in_syntax.js.map +1 -1
- package/es/common/inversify-lite/syntax/binding_in_when_on_syntax.js +3 -0
- package/es/common/inversify-lite/syntax/binding_in_when_on_syntax.js.map +1 -1
- package/es/common/inversify-lite/syntax/binding_on_syntax.js +1 -0
- package/es/common/inversify-lite/syntax/binding_on_syntax.js.map +1 -1
- package/es/common/inversify-lite/syntax/binding_to_syntax.js +1 -0
- package/es/common/inversify-lite/syntax/binding_to_syntax.js.map +1 -1
- package/es/common/inversify-lite/syntax/binding_when_on_syntax.js +2 -0
- package/es/common/inversify-lite/syntax/binding_when_on_syntax.js.map +1 -1
- package/es/common/inversify-lite/syntax/binding_when_syntax.js +1 -0
- package/es/common/inversify-lite/syntax/binding_when_syntax.js.map +1 -1
- package/es/common/polygon.js +1 -2
- package/es/common/polygon.js.map +1 -1
- package/es/common/render-area.js +2 -3
- package/es/common/render-area.js.map +1 -1
- package/es/common/render-curve.js +4 -8
- package/es/common/render-curve.js.map +1 -1
- package/es/common/seg-context.js +12 -3
- package/es/common/seg-context.js.map +1 -1
- package/es/common/segment/basis.js +13 -0
- package/es/common/segment/basis.js.map +1 -1
- package/es/common/segment/common.js +1 -1
- package/es/common/segment/common.js.map +1 -1
- package/es/common/segment/curve/arc.js +2 -1
- package/es/common/segment/curve/arc.js.map +1 -1
- package/es/common/segment/curve/base.js +4 -0
- package/es/common/segment/curve/base.js.map +1 -1
- package/es/common/segment/curve/cubic-bezier.js +2 -2
- package/es/common/segment/curve/cubic-bezier.js.map +1 -1
- package/es/common/segment/curve/curve-context.js +4 -0
- package/es/common/segment/curve/curve-context.js.map +1 -1
- package/es/common/segment/curve/ellipse.js +3 -3
- package/es/common/segment/curve/ellipse.js.map +1 -1
- package/es/common/segment/curve/line.js +2 -1
- package/es/common/segment/curve/line.js.map +1 -1
- package/es/common/segment/curve/move.js +2 -1
- package/es/common/segment/curve/move.js.map +1 -1
- package/es/common/segment/curve/path.js +2 -0
- package/es/common/segment/curve/path.js.map +1 -1
- package/es/common/segment/curve/quadratic-bezier.js +2 -2
- package/es/common/segment/curve/quadratic-bezier.js.map +1 -1
- package/es/common/segment/linear-closed.js.map +1 -1
- package/es/common/segment/linear.js +10 -0
- package/es/common/segment/linear.js.map +1 -1
- package/es/common/segment/monotone.js +13 -0
- package/es/common/segment/monotone.js.map +1 -1
- package/es/common/segment/step.js +12 -1
- package/es/common/segment/step.js.map +1 -1
- package/es/common/sort.js +3 -34
- package/es/common/sort.js.map +1 -1
- package/es/common/split-path.js +4 -11
- package/es/common/split-path.js.map +1 -1
- package/es/common/utils.d.ts +1 -1
- package/es/common/utils.js +9 -7
- package/es/common/utils.js.map +1 -1
- package/es/common/xml/parser.js +2 -2
- package/es/common/xml/parser.js.map +1 -1
- package/es/core/camera.js +11 -4
- package/es/core/camera.js.map +1 -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/layerHandler/canvas2d-contribution.js +20 -11
- package/es/core/contributions/layerHandler/canvas2d-contribution.js.map +1 -1
- package/es/core/contributions/layerHandler/empty-contribution.js +8 -8
- package/es/core/contributions/layerHandler/empty-contribution.js.map +1 -1
- package/es/core/contributions/layerHandler/offscreen2d-contribution.js +5 -6
- package/es/core/contributions/layerHandler/offscreen2d-contribution.js.map +1 -1
- package/es/core/contributions/textMeasure/AtextMeasure.js +11 -8
- package/es/core/contributions/textMeasure/AtextMeasure.js.map +1 -1
- package/es/core/contributions/textMeasure/layout.js +3 -0
- package/es/core/contributions/textMeasure/layout.js.map +1 -1
- package/es/core/contributions/window/base-contribution.js +2 -0
- package/es/core/contributions/window/base-contribution.js.map +1 -1
- package/es/core/global.js +8 -0
- package/es/core/global.js.map +1 -1
- package/es/core/graphic-utils.js +16 -5
- package/es/core/graphic-utils.js.map +1 -1
- package/es/core/layer-service.js +7 -7
- package/es/core/layer-service.js.map +1 -1
- package/es/core/layer.js +7 -9
- package/es/core/layer.js.map +1 -1
- package/es/core/stage.js +79 -35
- package/es/core/stage.js.map +1 -1
- package/es/core/window.js +16 -14
- package/es/core/window.js.map +1 -1
- package/es/event/event-manager.js +152 -143
- package/es/event/event-manager.js.map +1 -1
- package/es/event/event-system.js +60 -43
- package/es/event/event-system.js.map +1 -1
- package/es/event/event-target.js +1 -3
- package/es/event/event-target.js.map +1 -1
- package/es/event/federated-event/base-event.js +43 -15
- package/es/event/federated-event/base-event.js.map +1 -1
- package/es/event/federated-event/mouse-event.js +27 -18
- package/es/event/federated-event/mouse-event.js.map +1 -1
- package/es/event/federated-event/pointer-event.js +13 -8
- package/es/event/federated-event/pointer-event.js.map +1 -1
- package/es/event/federated-event/wheel-event.js +13 -11
- package/es/event/federated-event/wheel-event.js.map +1 -1
- package/es/graphic/arc.js +9 -6
- package/es/graphic/arc.js.map +1 -1
- package/es/graphic/arc3d.js +6 -5
- package/es/graphic/arc3d.js.map +1 -1
- package/es/graphic/area.js +13 -10
- package/es/graphic/area.js.map +1 -1
- package/es/graphic/builtin-symbol/arrow.js +2 -3
- package/es/graphic/builtin-symbol/arrow.js.map +1 -1
- package/es/graphic/builtin-symbol/arrow2-down.js +2 -3
- package/es/graphic/builtin-symbol/arrow2-down.js.map +1 -1
- package/es/graphic/builtin-symbol/arrow2-left.js +2 -3
- package/es/graphic/builtin-symbol/arrow2-left.js.map +1 -1
- package/es/graphic/builtin-symbol/arrow2-right.js +2 -3
- package/es/graphic/builtin-symbol/arrow2-right.js.map +1 -1
- package/es/graphic/builtin-symbol/arrow2-up.js +2 -3
- package/es/graphic/builtin-symbol/arrow2-up.js.map +1 -1
- package/es/graphic/builtin-symbol/circle.js +2 -3
- package/es/graphic/builtin-symbol/circle.js.map +1 -1
- package/es/graphic/builtin-symbol/close.js +2 -3
- package/es/graphic/builtin-symbol/close.js.map +1 -1
- package/es/graphic/builtin-symbol/cross.js +2 -3
- package/es/graphic/builtin-symbol/cross.js.map +1 -1
- package/es/graphic/builtin-symbol/diamond.js +2 -3
- package/es/graphic/builtin-symbol/diamond.js.map +1 -1
- package/es/graphic/builtin-symbol/line-h.js +2 -3
- package/es/graphic/builtin-symbol/line-h.js.map +1 -1
- package/es/graphic/builtin-symbol/line-v.js +2 -3
- package/es/graphic/builtin-symbol/line-v.js.map +1 -1
- package/es/graphic/builtin-symbol/rect.js +2 -3
- package/es/graphic/builtin-symbol/rect.js.map +1 -1
- package/es/graphic/builtin-symbol/square.js +2 -3
- package/es/graphic/builtin-symbol/square.js.map +1 -1
- package/es/graphic/builtin-symbol/star.js +2 -3
- package/es/graphic/builtin-symbol/star.js.map +1 -1
- package/es/graphic/builtin-symbol/stroke.js +2 -3
- package/es/graphic/builtin-symbol/stroke.js.map +1 -1
- package/es/graphic/builtin-symbol/thin-triangle.js +2 -3
- package/es/graphic/builtin-symbol/thin-triangle.js.map +1 -1
- package/es/graphic/builtin-symbol/triangle-down.js +2 -3
- package/es/graphic/builtin-symbol/triangle-down.js.map +1 -1
- package/es/graphic/builtin-symbol/triangle-left.js +2 -3
- package/es/graphic/builtin-symbol/triangle-left.js.map +1 -1
- package/es/graphic/builtin-symbol/triangle-right.js +2 -3
- package/es/graphic/builtin-symbol/triangle-right.js.map +1 -1
- package/es/graphic/builtin-symbol/triangle-up.js +2 -3
- package/es/graphic/builtin-symbol/triangle-up.js.map +1 -1
- package/es/graphic/builtin-symbol/triangle.js +1 -3
- package/es/graphic/builtin-symbol/triangle.js.map +1 -1
- package/es/graphic/builtin-symbol/utils.js +6 -2
- package/es/graphic/builtin-symbol/utils.js.map +1 -1
- package/es/graphic/builtin-symbol/wedge.js +2 -3
- package/es/graphic/builtin-symbol/wedge.js.map +1 -1
- package/es/graphic/builtin-symbol/wye.js +2 -3
- package/es/graphic/builtin-symbol/wye.js.map +1 -1
- package/es/graphic/circle.js +7 -6
- package/es/graphic/circle.js.map +1 -1
- package/es/graphic/config.js +73 -44
- package/es/graphic/config.js.map +1 -1
- package/es/graphic/glyph.js +9 -9
- package/es/graphic/glyph.js.map +1 -1
- package/es/graphic/graphic-service/graphic-service.js +12 -8
- package/es/graphic/graphic-service/graphic-service.js.map +1 -1
- package/es/graphic/graphic.d.ts +1 -0
- package/es/graphic/graphic.js +32 -42
- package/es/graphic/graphic.js.map +1 -1
- package/es/graphic/group.js +8 -5
- package/es/graphic/group.js.map +1 -1
- package/es/graphic/image.js +17 -16
- package/es/graphic/image.js.map +1 -1
- package/es/graphic/line.js +10 -7
- package/es/graphic/line.js.map +1 -1
- package/es/graphic/node-tree.js +25 -44
- package/es/graphic/node-tree.js.map +1 -1
- package/es/graphic/path.js +11 -7
- package/es/graphic/path.js.map +1 -1
- package/es/graphic/polygon.js +6 -4
- package/es/graphic/polygon.js.map +1 -1
- package/es/graphic/pyramid3d.js +3 -3
- package/es/graphic/pyramid3d.js.map +1 -1
- package/es/graphic/rect.js +6 -4
- package/es/graphic/rect.js.map +1 -1
- package/es/graphic/rect3d.js +4 -4
- package/es/graphic/rect3d.js.map +1 -1
- package/es/graphic/richtext/frame.js +19 -0
- package/es/graphic/richtext/frame.js.map +1 -1
- package/es/graphic/richtext/icon.js +14 -6
- package/es/graphic/richtext/icon.js.map +1 -1
- package/es/graphic/richtext/line.js +14 -2
- package/es/graphic/richtext/line.js.map +1 -1
- package/es/graphic/richtext/paragraph.js +22 -0
- package/es/graphic/richtext/paragraph.js.map +1 -1
- package/es/graphic/richtext/utils.js +1 -2
- package/es/graphic/richtext/utils.js.map +1 -1
- package/es/graphic/richtext/wrapper.js +12 -0
- package/es/graphic/richtext/wrapper.js.map +1 -1
- package/es/graphic/richtext.js +37 -46
- package/es/graphic/richtext.js.map +1 -1
- package/es/graphic/shadow-root.js +2 -1
- package/es/graphic/shadow-root.js.map +1 -1
- package/es/graphic/symbol.js +11 -6
- package/es/graphic/symbol.js.map +1 -1
- package/es/graphic/text.js +39 -40
- package/es/graphic/text.js.map +1 -1
- package/es/graphic/theme.js +4 -0
- package/es/graphic/theme.js.map +1 -1
- package/es/graphic/tools.js +16 -44
- package/es/graphic/tools.js.map +1 -1
- package/es/graphic/wrap-text.js +6 -6
- package/es/graphic/wrap-text.js.map +1 -1
- package/es/interface/global.d.ts +2 -1
- package/es/interface/global.js.map +1 -1
- package/es/interface/graphic.d.ts +1 -0
- package/es/interface/graphic.js.map +1 -1
- package/es/picker/global-picker-service.js +1 -0
- package/es/picker/global-picker-service.js.map +1 -1
- package/es/picker/pick-interceptor.js +5 -15
- package/es/picker/pick-interceptor.js.map +1 -1
- package/es/picker/picker-service.js +5 -5
- package/es/picker/picker-service.js.map +1 -1
- package/es/plugins/builtin-plugin/3dview-transform-plugin.js +26 -20
- package/es/plugins/builtin-plugin/3dview-transform-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/auto-render-plugin.js +5 -4
- package/es/plugins/builtin-plugin/auto-render-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/dirty-bounds-plugin.js +5 -4
- package/es/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/flex-layout-plugin.js +11 -8
- package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/html-attribute-plugin.js +28 -17
- package/es/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/incremental-auto-render-plugin.js +12 -8
- package/es/plugins/builtin-plugin/incremental-auto-render-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/react-attribute-plugin.js +6 -6
- package/es/plugins/builtin-plugin/react-attribute-plugin.js.map +1 -1
- package/es/plugins/plugin-service.js +1 -0
- package/es/plugins/plugin-service.js.map +1 -1
- package/es/render/contributions/render/arc-render.js +6 -4
- package/es/render/contributions/render/arc-render.js.map +1 -1
- package/es/render/contributions/render/arc3d-render.js +5 -7
- package/es/render/contributions/render/arc3d-render.js.map +1 -1
- package/es/render/contributions/render/area-render.js +21 -23
- package/es/render/contributions/render/area-render.js.map +1 -1
- package/es/render/contributions/render/base-render.js +5 -0
- package/es/render/contributions/render/base-render.js.map +1 -1
- package/es/render/contributions/render/circle-render.js +6 -4
- package/es/render/contributions/render/circle-render.js.map +1 -1
- package/es/render/contributions/render/contributions/arc-contribution-render.js +3 -3
- package/es/render/contributions/render/contributions/arc-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/area-texture-contribution-render.js +2 -5
- package/es/render/contributions/render/contributions/area-texture-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/base-contribution-render.js +10 -7
- package/es/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/base-texture-contribution-render.js +4 -3
- package/es/render/contributions/render/contributions/base-texture-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/circle-contribution-render.js +3 -3
- package/es/render/contributions/render/contributions/circle-contribution-render.js.map +1 -1
- 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.js +1 -3
- package/es/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/rect-contribution-render.js +11 -11
- package/es/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/symbol-contribution-render.js +3 -3
- package/es/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/text-contribution-render.js +6 -8
- package/es/render/contributions/render/contributions/text-contribution-render.js.map +1 -1
- package/es/render/contributions/render/draw-contribution.js +12 -14
- package/es/render/contributions/render/draw-contribution.js.map +1 -1
- package/es/render/contributions/render/draw-interceptor.js +11 -21
- package/es/render/contributions/render/draw-interceptor.js.map +1 -1
- package/es/render/contributions/render/glyph-render.js +2 -3
- package/es/render/contributions/render/glyph-render.js.map +1 -1
- package/es/render/contributions/render/graphic-render.js +4 -1
- package/es/render/contributions/render/graphic-render.js.map +1 -1
- package/es/render/contributions/render/group-render.js +7 -3
- package/es/render/contributions/render/group-render.js.map +1 -1
- package/es/render/contributions/render/image-render.js +5 -2
- package/es/render/contributions/render/image-render.js.map +1 -1
- package/es/render/contributions/render/incremental-area-render.js +1 -3
- package/es/render/contributions/render/incremental-area-render.js.map +1 -1
- package/es/render/contributions/render/incremental-draw-contribution.js +80 -109
- package/es/render/contributions/render/incremental-draw-contribution.js.map +1 -1
- package/es/render/contributions/render/incremental-line-render.js +1 -3
- package/es/render/contributions/render/incremental-line-render.js.map +1 -1
- package/es/render/contributions/render/line-render.js +12 -16
- package/es/render/contributions/render/line-render.js.map +1 -1
- package/es/render/contributions/render/path-render.js +8 -6
- package/es/render/contributions/render/path-render.js.map +1 -1
- package/es/render/contributions/render/polygon-render.js +6 -4
- package/es/render/contributions/render/polygon-render.js.map +1 -1
- package/es/render/contributions/render/pyramid3d-render.js +3 -5
- package/es/render/contributions/render/pyramid3d-render.js.map +1 -1
- package/es/render/contributions/render/rect-render.js +8 -6
- package/es/render/contributions/render/rect-render.js.map +1 -1
- package/es/render/contributions/render/rect3d-render.js +5 -7
- package/es/render/contributions/render/rect3d-render.js.map +1 -1
- package/es/render/contributions/render/richtext-render.js +4 -3
- package/es/render/contributions/render/richtext-render.js.map +1 -1
- package/es/render/contributions/render/symbol-render.js +11 -14
- package/es/render/contributions/render/symbol-render.js.map +1 -1
- package/es/render/contributions/render/text-render.js +9 -8
- package/es/render/contributions/render/text-render.js.map +1 -1
- package/es/render/contributions/render/utils.js +1 -1
- package/es/render/contributions/render/utils.js.map +1 -1
- package/es/render/render-service.js +11 -2
- package/es/render/render-service.js.map +1 -1
- package/es/resource-loader/loader.js +12 -17
- package/es/resource-loader/loader.js.map +1 -1
- package/es/tapable/Hook.js +3 -0
- package/es/tapable/Hook.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/render/contributions/render/path-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAA2E;AAE3E,iFAA6E;AAC7E,6EAAwE;AAgBxE,kDAAkD;AAClD,0DAA8D;AAE9D,yDAAmE;AAEnE,+CAA2C;AAE3C,uFAGkD;AAG3C,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,wBAAiB;
|
|
1
|
+
{"version":3,"sources":["../src/render/contributions/render/path-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAA2E;AAE3E,iFAA6E;AAC7E,6EAAwE;AAgBxE,kDAAkD;AAClD,0DAA8D;AAE9D,yDAAmE;AAEnE,+CAA2C;AAE3C,uFAGkD;AAG3C,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,wBAAiB;IAQvC;IAPrB,IAAI,CAAS;IACb,UAAU,GAAW,4BAAgB,CAAC;IACtC,SAAS,CAAkC;IAE3C,YAGqB,uBAAuE;QAE1F,KAAK,EAAE,CAAC;QAFW,4BAAuB,GAAvB,uBAAuB,CAAgD;QAG1F,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G,MAAM,aAAa,GAAG,IAAA,gBAAQ,EAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC;QACzD,IAAI,CAAC,SAAS,GAAG,aAAa,CAAC;QAC/B,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;QAC5D,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;CACF,CAAA;AA9GY,uBAAuB;IADnC,IAAA,2BAAU,GAAE;IAOR,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,kCAAsB,CAAC,CAAA;;GAPrB,uBAAuB,CA8GnC;AA9GY,0DAAuB","file":"path-render.js","sourcesContent":["import { inject, injectable, named } from '../../../common/inversify-lite';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { renderCommandList } from '../../../common/render-command-list';\nimport type {\n IPath,\n ICustomPath2D,\n IContext2d,\n IThemeAttribute,\n IGraphicAttribute,\n IMarkAttribute,\n IPathRenderContribution,\n IGraphicRender,\n IContributionProvider,\n IDrawContext,\n IGraphicRenderDrawParams,\n IRenderService,\n IPathGraphicAttribute\n} from '../../../interface';\nimport { getTheme } from '../../../graphic/theme';\nimport { PATH_NUMBER_TYPE } from '../../../graphic/constants';\nimport { drawPathProxy, fillVisible, runFill, runStroke, strokeVisible } from './utils';\nimport { PathRenderContribution } from './contributions/constants';\nimport { BaseRenderContributionTime } from '../../../common/enums';\nimport { BaseRender } from './base-render';\nimport { mat4Allocate } from '../../../allocator/matrix-allocate';\nimport {\n defaultPathBackgroundRenderContribution,\n defaultPathTextureRenderContribution\n} from './contributions/path-contribution-render';\n\n@injectable()\nexport class DefaultCanvasPathRender extends BaseRender<IPath> implements IGraphicRender {\n type: 'path';\n numberType: number = PATH_NUMBER_TYPE;\n tempTheme: Required<IPathGraphicAttribute>;\n\n constructor(\n @inject(ContributionProvider)\n @named(PathRenderContribution)\n protected readonly pathRenderContribitions: IContributionProvider<IPathRenderContribution>\n ) {\n super();\n this.builtinContributions = [defaultPathBackgroundRenderContribution, defaultPathTextureRenderContribution];\n this.init(pathRenderContribitions);\n }\n\n drawShape(\n path: IPath,\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 pathAttribute = graphicService.themeService.getCurrentTheme().pathAttribute;\n const pathAttribute = this.tempTheme ?? getTheme(path, params?.theme).path;\n const { x: originX = pathAttribute.x, y: originY = pathAttribute.y } = path.attribute;\n\n const z = this.z ?? 0;\n\n const data = this.valid(path, pathAttribute, fillCb, strokeCb);\n if (!data) {\n return;\n }\n const { fVisible, sVisible, doFill, doStroke } = data;\n\n context.beginPath();\n if (path.pathShape) {\n renderCommandList((path.pathShape as ICustomPath2D).commandList, context, x, y, 1, 1, z);\n } else {\n const path2D = path.attribute.path ?? pathAttribute.path;\n renderCommandList((path2D as ICustomPath2D).commandList, context, x, y, 1, 1, z);\n }\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(path, path.attribute, pathAttribute);\n\n this.beforeRenderStep(\n path,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n pathAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n\n if (doStroke) {\n if (strokeCb) {\n strokeCb(context, path.attribute, pathAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(path, path.attribute, originX - x, originY - y, pathAttribute);\n context.stroke();\n }\n }\n if (doFill) {\n if (fillCb) {\n fillCb(context, path.attribute, pathAttribute);\n } else if (fVisible) {\n context.setCommonStyle(path, path.attribute, originX - x, originY - y, pathAttribute);\n context.fill();\n }\n }\n\n this.afterRenderStep(\n path,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n pathAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n\n draw(path: IPath, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const pathAttribute = getTheme(path, params?.theme).path;\n this.tempTheme = pathAttribute;\n this._draw(path, pathAttribute, false, drawContext, params);\n this.tempTheme = null;\n }\n}\n"]}
|
|
@@ -19,13 +19,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
19
19
|
const vutils_1 = require("@visactor/vutils"), inversify_lite_1 = require("../../../common/inversify-lite"), theme_1 = require("../../../graphic/theme"), constants_1 = require("../../../graphic/constants"), polygon_1 = require("../../../common/polygon"), constants_2 = require("./contributions/constants"), contribution_provider_1 = require("../../../common/contribution-provider"), base_render_1 = require("./base-render"), polygon_contribution_render_1 = require("./contributions/polygon-contribution-render");
|
|
20
20
|
|
|
21
21
|
let DefaultCanvasPolygonRender = class extends base_render_1.BaseRender {
|
|
22
|
+
polygonRenderContribitions;
|
|
23
|
+
type;
|
|
24
|
+
numberType=constants_1.POLYGON_NUMBER_TYPE;
|
|
22
25
|
constructor(polygonRenderContribitions) {
|
|
23
|
-
super(), this.polygonRenderContribitions = polygonRenderContribitions, this.
|
|
24
|
-
this.builtinContributions = [ polygon_contribution_render_1.defaultPolygonBackgroundRenderContribution, polygon_contribution_render_1.defaultPolygonTextureRenderContribution ],
|
|
26
|
+
super(), this.polygonRenderContribitions = polygonRenderContribitions, this.builtinContributions = [ polygon_contribution_render_1.defaultPolygonBackgroundRenderContribution, polygon_contribution_render_1.defaultPolygonTextureRenderContribution ],
|
|
25
27
|
this.init(polygonRenderContribitions);
|
|
26
28
|
}
|
|
27
29
|
drawShape(polygon, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
28
|
-
const polygonAttribute = (0, theme_1.getTheme)(polygon,
|
|
30
|
+
const polygonAttribute = (0, theme_1.getTheme)(polygon, params?.theme).polygon, {points: points = polygonAttribute.points, cornerRadius: cornerRadius = polygonAttribute.cornerRadius, x: originX = polygonAttribute.x, y: originY = polygonAttribute.y, closePath: closePath = polygonAttribute.closePath} = polygon.attribute, data = this.valid(polygon, polygonAttribute, fillCb, strokeCb);
|
|
29
31
|
if (!data) return;
|
|
30
32
|
const {fVisible: fVisible, sVisible: sVisible, doFill: doFill, doStroke: doStroke} = data;
|
|
31
33
|
context.beginPath(), cornerRadius <= 0 || (0, vutils_1.isArray)(cornerRadius) && cornerRadius.every((num => 0 === num)) ? (0,
|
|
@@ -38,7 +40,7 @@ let DefaultCanvasPolygonRender = class extends base_render_1.BaseRender {
|
|
|
38
40
|
context.stroke())), this.afterRenderStep(polygon, context, x, y, doFill, doStroke, fVisible, sVisible, polygonAttribute, drawContext, fillCb, strokeCb);
|
|
39
41
|
}
|
|
40
42
|
draw(polygon, renderService, drawContext, params) {
|
|
41
|
-
const polygonAttribute = (0, theme_1.getTheme)(polygon,
|
|
43
|
+
const polygonAttribute = (0, theme_1.getTheme)(polygon, params?.theme).polygon;
|
|
42
44
|
this._draw(polygon, polygonAttribute, !1, drawContext, params);
|
|
43
45
|
}
|
|
44
46
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/render/contributions/render/polygon-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA2C;AAC3C,mEAA2E;AAC3E,kDAAkD;AAClD,0DAAiE;AAcjE,qDAA0E;AAE1E,yDAAsE;AAEtE,iFAA6E;AAE7E,+CAA2C;AAC3C,6FAGqD;AAG9C,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,wBAAoB;
|
|
1
|
+
{"version":3,"sources":["../src/render/contributions/render/polygon-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA2C;AAC3C,mEAA2E;AAC3E,kDAA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EAAE,OAAO,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;aACxD;iBAAM,IAAI,QAAQ,EAAE;gBAEnB,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,EAAE,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC,EAAE,gBAAgB,CAAC,CAAC;gBAC/F,OAAO,CAAC,MAAM,EAAE,CAAC;aAClB;SACF;QAED,IAAI,CAAC,eAAe,CAClB,OAAO,EACP,OAAO,EACP,CAAC,EACD,CAAC,EACD,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,MAAM,EACN,QAAQ,CACT,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,OAAiB,EAAE,aAA6B,EAAE,WAAyB,EAAE,MAAiC;QACjH,MAAM,gBAAgB,GAAG,IAAA,gBAAQ,EAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC;QAClE,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IACpE,CAAC;CACF,CAAA;AApHY,0BAA0B;IADtC,IAAA,2BAAU,GAAE;IAMR,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,qCAAyB,CAAC,CAAA;;GANxB,0BAA0B,CAoHtC;AApHY,gEAA0B","file":"polygon-render.js","sourcesContent":["import { isArray } from '@visactor/vutils';\nimport { inject, injectable, named } from '../../../common/inversify-lite';\nimport { getTheme } from '../../../graphic/theme';\nimport { POLYGON_NUMBER_TYPE } from '../../../graphic/constants';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n IPolygon,\n IThemeAttribute,\n IGraphicRender,\n IPolygonRenderContribution,\n IContributionProvider,\n IDrawContext,\n IGraphicRenderDrawParams,\n IRenderService\n} from '../../../interface';\nimport { drawPolygon, drawRoundedPolygon } from '../../../common/polygon';\nimport { drawPathProxy, fillVisible, runFill, runStroke, strokeVisible } from './utils';\nimport { PolygonRenderContribution } from './contributions/constants';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { BaseRenderContributionTime } from '../../../common/enums';\nimport { BaseRender } from './base-render';\nimport {\n defaultPolygonBackgroundRenderContribution,\n defaultPolygonTextureRenderContribution\n} from './contributions/polygon-contribution-render';\n\n@injectable()\nexport class DefaultCanvasPolygonRender extends BaseRender<IPolygon> implements IGraphicRender {\n type: 'polygon';\n numberType: number = POLYGON_NUMBER_TYPE;\n\n constructor(\n @inject(ContributionProvider)\n @named(PolygonRenderContribution)\n protected readonly polygonRenderContribitions: IContributionProvider<IPolygonRenderContribution>\n ) {\n super();\n this.builtinContributions = [defaultPolygonBackgroundRenderContribution, defaultPolygonTextureRenderContribution];\n this.init(polygonRenderContribitions);\n }\n\n drawShape(\n polygon: IPolygon,\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 polygonAttribute = graphicService.themeService.getCurrentTheme().polygonAttribute;\n const polygonAttribute = getTheme(polygon, params?.theme).polygon;\n const {\n points = polygonAttribute.points,\n cornerRadius = polygonAttribute.cornerRadius,\n x: originX = polygonAttribute.x,\n y: originY = polygonAttribute.y,\n closePath = polygonAttribute.closePath\n } = polygon.attribute;\n\n const data = this.valid(polygon, polygonAttribute, fillCb, strokeCb);\n if (!data) {\n return;\n }\n const { fVisible, sVisible, doFill, doStroke } = data;\n\n context.beginPath();\n\n if ((cornerRadius as number) <= 0 || (isArray(cornerRadius) && (<number[]>cornerRadius).every(num => num === 0))) {\n drawPolygon(context.camera ? context : context.nativeContext, points, x, y);\n } else {\n // FIXME: type\n drawRoundedPolygon(context.camera ? context : context.nativeContext, points, x, y, cornerRadius, closePath);\n }\n // polygon 默认闭合\n closePath && context.closePath();\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(polygon, polygon.attribute, polygonAttribute);\n\n this.beforeRenderStep(\n polygon,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n polygonAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n\n if (doFill) {\n if (fillCb) {\n fillCb(context, polygon.attribute, polygonAttribute);\n } else if (fVisible) {\n // 存在fill\n context.setCommonStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute);\n context.fill();\n }\n }\n if (doStroke) {\n if (strokeCb) {\n strokeCb(context, polygon.attribute, polygonAttribute);\n } else if (sVisible) {\n // 存在stroke\n context.setStrokeStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute);\n context.stroke();\n }\n }\n\n this.afterRenderStep(\n polygon,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n polygonAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n\n draw(polygon: IPolygon, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const polygonAttribute = getTheme(polygon, params?.theme).polygon;\n this._draw(polygon, polygonAttribute, false, drawContext, params);\n }\n}\n"]}
|
|
@@ -13,12 +13,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
13
13
|
const inversify_lite_1 = require("../../../common/inversify-lite"), theme_1 = require("../../../graphic/theme"), constants_1 = require("../../../graphic/constants"), base_render_1 = require("./base-render"), color_string_1 = require("../../../color-string");
|
|
14
14
|
|
|
15
15
|
let DefaultCanvasPyramid3dRender = class extends base_render_1.BaseRender {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
16
|
+
type="pyramid3d";
|
|
17
|
+
numberType=constants_1.PYRAMID3D_NUMBER_TYPE;
|
|
19
18
|
drawShape(pyramid3d, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
20
|
-
|
|
21
|
-
const pyramidAttribute = (0, theme_1.getTheme)(pyramid3d, null == params ? void 0 : params.theme).polygon, {fill: fill = pyramidAttribute.fill, stroke: stroke = pyramidAttribute.stroke, face: face = [ !0, !0, !0, !0, !0, !0 ]} = pyramid3d.attribute, z = null !== (_a = this.z) && void 0 !== _a ? _a : 0;
|
|
19
|
+
const pyramidAttribute = (0, theme_1.getTheme)(pyramid3d, params?.theme).polygon, {fill: fill = pyramidAttribute.fill, stroke: stroke = pyramidAttribute.stroke, face: face = [ !0, !0, !0, !0, !0, !0 ]} = pyramid3d.attribute, z = this.z ?? 0;
|
|
22
20
|
if (!this.valid(pyramid3d, pyramidAttribute, fillCb, strokeCb)) return;
|
|
23
21
|
const {light: light, camera: camera} = drawContext.stage || {}, face3d = pyramid3d.findFace();
|
|
24
22
|
if (!1 !== fill) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/render/contributions/render/pyramid3d-render.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mEAA4D;AAC5D,kDAAkD;AAClD,0DAAmE;AAkBnE,+CAA2C;AAC3C,wDAA8D;AAGvD,IAAM,4BAA4B,GAAlC,MAAM,4BAA6B,SAAQ,wBAAsB;IAAjE;;QACL,SAAI,GAAG,WAAW,CAAC;QACnB,eAAU,GAAW,iCAAqB,CAAC;IA2K7C,CAAC;IAxKC,SAAS,CACP,SAAqB,EACrB,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,WAAyB,EACzB,MAAiC,EACjC,MAIY,EACZ,QAIY;;QAGZ,MAAM,gBAAgB,GAAG,IAAA,gBAAQ,EAAC,SAAS,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,CAAC,OAAO,CAAC;QACpE,MAAM,EACJ,IAAI,GAAG,gBA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\nimport { getTheme } from '../../../graphic/theme';\nimport { PYRAMID3D_NUMBER_TYPE } from '../../../graphic/constants';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IDirectionLight,\n IMarkAttribute,\n IPyramid3d,\n IFace3d,\n IThemeAttribute,\n ICamera,\n IPolygonItem,\n IGraphicRender,\n IDrawContext,\n IGraphicRenderDrawParams,\n IRenderService\n} from '../../../interface';\nimport { fillVisible, runFill, runStroke, strokeVisible } from './utils';\nimport { mat4Allocate } from '../../../allocator/matrix-allocate';\nimport { BaseRender } from './base-render';\nimport { ColorStore, ColorType } from '../../../color-string';\n\n@injectable()\nexport class DefaultCanvasPyramid3dRender extends BaseRender<IPyramid3d> implements IGraphicRender {\n type = 'pyramid3d';\n numberType: number = PYRAMID3D_NUMBER_TYPE;\n declare z: number;\n\n drawShape(\n pyramid3d: IPyramid3d,\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 rectAttribute = graphicService.themeService.getCurrentTheme().rectAttribute;\n const pyramidAttribute = getTheme(pyramid3d, params?.theme).polygon;\n const {\n fill = pyramidAttribute.fill,\n stroke = pyramidAttribute.stroke,\n face = [true, true, true, true, true, true]\n } = pyramid3d.attribute;\n\n const z = this.z ?? 0;\n\n const data = this.valid(pyramid3d, pyramidAttribute, fillCb, strokeCb);\n if (!data) {\n return;\n }\n // const { fVisible, sVisible, doFill, doStroke } = data;\n\n const { light, camera } = drawContext.stage || {};\n\n const face3d = pyramid3d.findFace();\n\n if (fill !== false) {\n context.setCommonStyle(pyramid3d, pyramid3d.attribute, x, y, pyramidAttribute);\n let fc = fill;\n if (typeof fc !== 'string') {\n fc = 'black';\n }\n this.fill(x, y, z, face3d, face, fc, context, light, camera, pyramid3d, pyramidAttribute, fillCb);\n }\n if (stroke !== false) {\n context.setStrokeStyle(pyramid3d, pyramid3d.attribute, x, y, pyramidAttribute);\n this.stroke(x, y, z, face3d, context);\n }\n }\n\n stroke(x: number, y: number, z: number, face3d: IFace3d, context: IContext2d) {\n const vertices = face3d.vertices;\n face3d.edges.forEach(p => {\n const p1 = vertices[p[0]];\n const p2 = vertices[p[1]];\n const v1 = {\n x: x + p1[0],\n y: y + p1[1],\n z: z + p1[2]\n };\n const v2 = {\n x: x + p2[0],\n y: y + p2[1],\n z: z + p2[2]\n };\n context.beginPath();\n context.moveTo(v1.x, v1.y, v1.z);\n context.lineTo(v2.x, v2.y, v2.z);\n context.stroke();\n });\n }\n fill(\n x: number,\n y: number,\n z: number,\n face3d: IFace3d,\n faces: [boolean, boolean, boolean, boolean, boolean, boolean],\n fillColor: string,\n context: IContext2d,\n light: IDirectionLight,\n camera: ICamera,\n pyramid3d: IPyramid3d,\n pyramid3dAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n const rgbArray = ColorStore.Get(fillColor as string, ColorType.Color255);\n\n // 上下左右前后\n // 0,1,2,3,4,5\n const vertices = face3d.vertices;\n // 计算每个顶点的view\n const viewdVerticesZ = vertices.map(v => {\n return context.view(v[0], v[1], v[2])[2];\n });\n // 排序\n const sortFace: { faceIdx: number; polygon: IPolygonItem }[] = [];\n face3d.polygons.forEach((p, i) => {\n if (!faces[i]) {\n return;\n }\n sortFace.push({\n faceIdx: i,\n polygon: p\n });\n // 设置ave_z进行排序\n const { polygon, normal } = p;\n\n const z1 = viewdVerticesZ[polygon[0]];\n const z2 = viewdVerticesZ[polygon[1]];\n const z3 = viewdVerticesZ[polygon[2]];\n const z4 = viewdVerticesZ[polygon[3]];\n\n p.ave_z = z1 + z2 + z3 + z4;\n });\n sortFace.sort((a, b) => b.polygon.ave_z - a.polygon.ave_z);\n sortFace.forEach(item => {\n const { polygon, normal } = item.polygon;\n\n const p1 = vertices[polygon[0]];\n const p2 = vertices[polygon[1]];\n const p3 = vertices[polygon[2]];\n const p4 = vertices[polygon[3]];\n\n const v1 = {\n x: x + p1[0],\n y: y + p1[1],\n z: z + p1[2]\n };\n const v2 = {\n x: x + p2[0],\n y: y + p2[1],\n z: z + p2[2]\n };\n const v3 = {\n x: x + p3[0],\n y: y + p3[1],\n z: z + p3[2]\n };\n const v4 = {\n x: x + p4[0],\n y: y + p4[1],\n z: z + p4[2]\n };\n context.beginPath();\n context.moveTo(v1.x, v1.y, v1.z);\n context.lineTo(v2.x, v2.y, v2.z);\n context.lineTo(v3.x, v3.y, v3.z);\n context.lineTo(v4.x, v4.y, v4.z);\n context.closePath();\n if (fillCb) {\n fillCb(context, pyramid3d.attribute, pyramid3dAttribute);\n } else {\n context.fillStyle = light ? light.computeColor(normal, rgbArray as any) : fillColor;\n context.fill();\n }\n });\n }\n\n draw(pyramid3d: IPyramid3d, renderService: IRenderService, drawContext: IDrawContext) {\n const pyramid3dAttribute = getTheme(pyramid3d).polygon;\n this._draw(pyramid3d, pyramid3dAttribute, false, drawContext);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/render/contributions/render/pyramid3d-render.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mEAA4D;AAC5D,kDAAkD;AAClD,0DAAmE;AAkBnE,+CAA2C;AAC3C,wDAA8D;AAGvD,IAAM,4BAA4B,GAAlC,MAAM,4BAA6B,SAAQ,wBAAsB;IACtE,IAAI,GAAG,WAAW,CAAC;IACnB,UAAU,GAAW,iCAAqB,CAAC;IAG3C,SAAS,CACP,SAAqB,EACrB,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,WAAyB,EACzB,MAAiC,EACjC,MAIY,EACZ,QAIY;QAGZ,MAAM,gBAAgB,GAAG,IAAA,g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GAAE;GACA,4BAA4B,CA6KxC;AA7KY,oEAA4B","file":"pyramid3d-render.js","sourcesContent":["import { injectable } from '../../../common/inversify-lite';\nimport { getTheme } from '../../../graphic/theme';\nimport { PYRAMID3D_NUMBER_TYPE } from '../../../graphic/constants';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IDirectionLight,\n IMarkAttribute,\n IPyramid3d,\n IFace3d,\n IThemeAttribute,\n ICamera,\n IPolygonItem,\n IGraphicRender,\n IDrawContext,\n IGraphicRenderDrawParams,\n IRenderService\n} from '../../../interface';\nimport { fillVisible, runFill, runStroke, strokeVisible } from './utils';\nimport { mat4Allocate } from '../../../allocator/matrix-allocate';\nimport { BaseRender } from './base-render';\nimport { ColorStore, ColorType } from '../../../color-string';\n\n@injectable()\nexport class DefaultCanvasPyramid3dRender extends BaseRender<IPyramid3d> implements IGraphicRender {\n type = 'pyramid3d';\n numberType: number = PYRAMID3D_NUMBER_TYPE;\n declare z: number;\n\n drawShape(\n pyramid3d: IPyramid3d,\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 rectAttribute = graphicService.themeService.getCurrentTheme().rectAttribute;\n const pyramidAttribute = getTheme(pyramid3d, params?.theme).polygon;\n const {\n fill = pyramidAttribute.fill,\n stroke = pyramidAttribute.stroke,\n face = [true, true, true, true, true, true]\n } = pyramid3d.attribute;\n\n const z = this.z ?? 0;\n\n const data = this.valid(pyramid3d, pyramidAttribute, fillCb, strokeCb);\n if (!data) {\n return;\n }\n // const { fVisible, sVisible, doFill, doStroke } = data;\n\n const { light, camera } = drawContext.stage || {};\n\n const face3d = pyramid3d.findFace();\n\n if (fill !== false) {\n context.setCommonStyle(pyramid3d, pyramid3d.attribute, x, y, pyramidAttribute);\n let fc = fill;\n if (typeof fc !== 'string') {\n fc = 'black';\n }\n this.fill(x, y, z, face3d, face, fc, context, light, camera, pyramid3d, pyramidAttribute, fillCb);\n }\n if (stroke !== false) {\n context.setStrokeStyle(pyramid3d, pyramid3d.attribute, x, y, pyramidAttribute);\n this.stroke(x, y, z, face3d, context);\n }\n }\n\n stroke(x: number, y: number, z: number, face3d: IFace3d, context: IContext2d) {\n const vertices = face3d.vertices;\n face3d.edges.forEach(p => {\n const p1 = vertices[p[0]];\n const p2 = vertices[p[1]];\n const v1 = {\n x: x + p1[0],\n y: y + p1[1],\n z: z + p1[2]\n };\n const v2 = {\n x: x + p2[0],\n y: y + p2[1],\n z: z + p2[2]\n };\n context.beginPath();\n context.moveTo(v1.x, v1.y, v1.z);\n context.lineTo(v2.x, v2.y, v2.z);\n context.stroke();\n });\n }\n fill(\n x: number,\n y: number,\n z: number,\n face3d: IFace3d,\n faces: [boolean, boolean, boolean, boolean, boolean, boolean],\n fillColor: string,\n context: IContext2d,\n light: IDirectionLight,\n camera: ICamera,\n pyramid3d: IPyramid3d,\n pyramid3dAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n const rgbArray = ColorStore.Get(fillColor as string, ColorType.Color255);\n\n // 上下左右前后\n // 0,1,2,3,4,5\n const vertices = face3d.vertices;\n // 计算每个顶点的view\n const viewdVerticesZ = vertices.map(v => {\n return context.view(v[0], v[1], v[2])[2];\n });\n // 排序\n const sortFace: { faceIdx: number; polygon: IPolygonItem }[] = [];\n face3d.polygons.forEach((p, i) => {\n if (!faces[i]) {\n return;\n }\n sortFace.push({\n faceIdx: i,\n polygon: p\n });\n // 设置ave_z进行排序\n const { polygon, normal } = p;\n\n const z1 = viewdVerticesZ[polygon[0]];\n const z2 = viewdVerticesZ[polygon[1]];\n const z3 = viewdVerticesZ[polygon[2]];\n const z4 = viewdVerticesZ[polygon[3]];\n\n p.ave_z = z1 + z2 + z3 + z4;\n });\n sortFace.sort((a, b) => b.polygon.ave_z - a.polygon.ave_z);\n sortFace.forEach(item => {\n const { polygon, normal } = item.polygon;\n\n const p1 = vertices[polygon[0]];\n const p2 = vertices[polygon[1]];\n const p3 = vertices[polygon[2]];\n const p4 = vertices[polygon[3]];\n\n const v1 = {\n x: x + p1[0],\n y: y + p1[1],\n z: z + p1[2]\n };\n const v2 = {\n x: x + p2[0],\n y: y + p2[1],\n z: z + p2[2]\n };\n const v3 = {\n x: x + p3[0],\n y: y + p3[1],\n z: z + p3[2]\n };\n const v4 = {\n x: x + p4[0],\n y: y + p4[1],\n z: z + p4[2]\n };\n context.beginPath();\n context.moveTo(v1.x, v1.y, v1.z);\n context.lineTo(v2.x, v2.y, v2.z);\n context.lineTo(v3.x, v3.y, v3.z);\n context.lineTo(v4.x, v4.y, v4.z);\n context.closePath();\n if (fillCb) {\n fillCb(context, pyramid3d.attribute, pyramid3dAttribute);\n } else {\n context.fillStyle = light ? light.computeColor(normal, rgbArray as any) : fillColor;\n context.fill();\n }\n });\n }\n\n draw(pyramid3d: IPyramid3d, renderService: IRenderService, drawContext: IDrawContext) {\n const pyramid3dAttribute = getTheme(pyramid3d).polygon;\n this._draw(pyramid3d, pyramid3dAttribute, false, drawContext);\n }\n}\n"]}
|
|
@@ -19,17 +19,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
19
19
|
const vutils_1 = require("@visactor/vutils"), inversify_lite_1 = require("../../../common/inversify-lite"), theme_1 = require("../../../graphic/theme"), constants_1 = require("../../../graphic/constants"), rect_1 = require("../../../common/shape/rect"), contribution_provider_1 = require("../../../common/contribution-provider"), constants_2 = require("./contributions/constants"), utils_1 = require("./utils"), base_render_1 = require("./base-render"), contributions_1 = require("./contributions");
|
|
20
20
|
|
|
21
21
|
let DefaultCanvasRectRender = class extends base_render_1.BaseRender {
|
|
22
|
+
rectRenderContribitions;
|
|
23
|
+
type="rect";
|
|
24
|
+
numberType=constants_1.RECT_NUMBER_TYPE;
|
|
25
|
+
tempTheme;
|
|
22
26
|
constructor(rectRenderContribitions) {
|
|
23
|
-
super(), this.rectRenderContribitions = rectRenderContribitions, this.
|
|
24
|
-
this.numberType = constants_1.RECT_NUMBER_TYPE, this.builtinContributions = [ contributions_1.defaultRectRenderContribution, contributions_1.defaultRectBackgroundRenderContribution, contributions_1.defaultRectTextureRenderContribution ],
|
|
27
|
+
super(), this.rectRenderContribitions = rectRenderContribitions, this.builtinContributions = [ contributions_1.defaultRectRenderContribution, contributions_1.defaultRectBackgroundRenderContribution, contributions_1.defaultRectTextureRenderContribution ],
|
|
25
28
|
this.init(rectRenderContribitions);
|
|
26
29
|
}
|
|
27
30
|
drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
28
|
-
|
|
29
|
-
const rectAttribute = null !== (_a = this.tempTheme) && void 0 !== _a ? _a : (0,
|
|
30
|
-
theme_1.getTheme)(rect, null == params ? void 0 : params.theme).rect, {fill: fill = rectAttribute.fill, background: background, stroke: stroke = rectAttribute.stroke, cornerRadius: cornerRadius = rectAttribute.cornerRadius, opacity: opacity = rectAttribute.opacity, fillOpacity: fillOpacity = rectAttribute.fillOpacity, lineWidth: lineWidth = rectAttribute.lineWidth, strokeOpacity: strokeOpacity = rectAttribute.strokeOpacity, visible: visible = rectAttribute.visible, x1: x1, y1: y1, x: originX = rectAttribute.x, y: originY = rectAttribute.y} = rect.attribute;
|
|
31
|
+
const rectAttribute = this.tempTheme ?? (0, theme_1.getTheme)(rect, params?.theme).rect, {fill: fill = rectAttribute.fill, background: background, stroke: stroke = rectAttribute.stroke, cornerRadius: cornerRadius = rectAttribute.cornerRadius, opacity: opacity = rectAttribute.opacity, fillOpacity: fillOpacity = rectAttribute.fillOpacity, lineWidth: lineWidth = rectAttribute.lineWidth, strokeOpacity: strokeOpacity = rectAttribute.strokeOpacity, visible: visible = rectAttribute.visible, x1: x1, y1: y1, x: originX = rectAttribute.x, y: originY = rectAttribute.y} = rect.attribute;
|
|
31
32
|
let {width: width, height: height} = rect.attribute;
|
|
32
|
-
width = (
|
|
33
|
+
width = (width ?? x1 - originX) || 0, height = (height ?? y1 - originY) || 0;
|
|
33
34
|
const fVisible = (0, utils_1.rectFillVisible)(opacity, fillOpacity, width, height, fill), sVisible = (0,
|
|
34
35
|
utils_1.rectStrokeVisible)(opacity, strokeOpacity, width, height), doFill = (0,
|
|
35
36
|
utils_1.runFill)(fill, background), doStroke = (0, utils_1.runStroke)(stroke, lineWidth);
|
|
@@ -49,7 +50,7 @@ let DefaultCanvasRectRender = class extends base_render_1.BaseRender {
|
|
|
49
50
|
context.stroke())), this.afterRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
|
|
50
51
|
}
|
|
51
52
|
draw(rect, renderService, drawContext, params) {
|
|
52
|
-
const rectAttribute = (0, theme_1.getTheme)(rect,
|
|
53
|
+
const rectAttribute = (0, theme_1.getTheme)(rect, params?.theme).rect;
|
|
53
54
|
this.tempTheme = rectAttribute, this._draw(rect, rectAttribute, !1, drawContext, params),
|
|
54
55
|
this.tempTheme = null;
|
|
55
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/render/contributions/render/rect-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA2C;AAC3C,mEAA2E;AAC3E,kDAAkD;AAClD,0DAA8D;AAC9D,qDAA4D;AAE5D,iFAA6E;AAe7E,yDAAmE;AACnE,mCAAiF;AACjF,+CAA2C;AAC3C,mDAIyB;AAGlB,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,wBAAiB;
|
|
1
|
+
{"version":3,"sources":["../src/render/contributions/render/rect-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA2C;AAC3C,mEAA2E;AAC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WAAW,EACX,MAAM,EACN,QAAQ,CACT,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,IAAW,EAAE,aAA6B,EAAE,WAAyB,EAAE,MAAiC;QAC3G,MAAM,aAAa,GAAG,IAAA,gBAAQ,EAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC;QACzD,IAAI,CAAC,SAAS,GAAG,aAAa,CAAC;QAC/B,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;QAC5D,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;CACF,CAAA;AAxJY,uBAAuB;IADnC,IAAA,2BAAU,GAAE;IAOR,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,kCAAsB,CAAC,CAAA;;GAPrB,uBAAuB,CAwJnC;AAxJY,0DAAuB","file":"rect-render.js","sourcesContent":["import { isArray } from '@visactor/vutils';\nimport { inject, injectable, named } from '../../../common/inversify-lite';\nimport { getTheme } from '../../../graphic/theme';\nimport { RECT_NUMBER_TYPE } from '../../../graphic/constants';\nimport { createRectPath } from '../../../common/shape/rect';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n IRect,\n IThemeAttribute,\n IGraphicRender,\n IDrawContext,\n IGraphicRenderDrawParams,\n IRenderService,\n IRectRenderContribution,\n IContributionProvider,\n IRectGraphicAttribute\n} from '../../../interface';\nimport { RectRenderContribution } from './contributions/constants';\nimport { rectFillVisible, rectStrokeVisible, runFill, runStroke } from './utils';\nimport { BaseRender } from './base-render';\nimport {\n defaultRectBackgroundRenderContribution,\n defaultRectRenderContribution,\n defaultRectTextureRenderContribution\n} from './contributions';\n\n@injectable()\nexport class DefaultCanvasRectRender extends BaseRender<IRect> implements IGraphicRender {\n type = 'rect';\n numberType: number = RECT_NUMBER_TYPE;\n tempTheme: Required<IRectGraphicAttribute>;\n\n constructor(\n @inject(ContributionProvider)\n @named(RectRenderContribution)\n protected readonly rectRenderContribitions: IContributionProvider<IRectRenderContribution>\n ) {\n super();\n this.builtinContributions = [\n defaultRectRenderContribution,\n defaultRectBackgroundRenderContribution,\n defaultRectTextureRenderContribution\n ];\n this.init(rectRenderContribitions);\n }\n\n drawShape(\n rect: IRect,\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 rectAttribute = this.tempTheme ?? getTheme(rect, params?.theme).rect;\n const {\n fill = rectAttribute.fill,\n background,\n stroke = rectAttribute.stroke,\n cornerRadius = rectAttribute.cornerRadius,\n opacity = rectAttribute.opacity,\n fillOpacity = rectAttribute.fillOpacity,\n lineWidth = rectAttribute.lineWidth,\n strokeOpacity = rectAttribute.strokeOpacity,\n visible = rectAttribute.visible,\n x1,\n y1,\n x: originX = rectAttribute.x,\n y: originY = rectAttribute.y\n } = rect.attribute;\n let { width, height } = rect.attribute;\n width = (width ?? x1 - originX) || 0;\n height = (height ?? y1 - originY) || 0;\n\n // 不绘制或者透明\n const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill);\n const sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height);\n const doFill = runFill(fill, background);\n const doStroke = runStroke(stroke, lineWidth);\n\n if (!(rect.valid && visible)) {\n return;\n }\n\n if (!(doFill || doStroke)) {\n return;\n }\n\n // 如果存在fillCb和strokeCb,那就不直接跳过\n if (!(fVisible || sVisible || fillCb || strokeCb || background)) {\n return;\n }\n\n if (cornerRadius === 0 || (isArray(cornerRadius) && (<number[]>cornerRadius).every(num => num === 0))) {\n // 不需要处理圆角\n context.beginPath();\n context.rect(x, y, width, height);\n } else {\n context.beginPath();\n\n // 测试后,cache对于重绘性能提升不大,但是在首屏有一定性能损耗,因此rect不再使用cache\n createRectPath(context, x, y, width, height, cornerRadius);\n }\n\n const doFillOrStroke = {\n doFill,\n doStroke\n };\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute);\n\n this.beforeRenderStep(\n rect,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n rectAttribute,\n drawContext,\n fillCb,\n strokeCb,\n doFillOrStroke\n );\n\n if (doFillOrStroke.doFill) {\n if (fillCb) {\n fillCb(context, rect.attribute, rectAttribute);\n } else if (fVisible) {\n // 存在fill\n context.setCommonStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute);\n context.fill();\n }\n }\n if (doFillOrStroke.doStroke) {\n if (strokeCb) {\n strokeCb(context, rect.attribute, rectAttribute);\n } else if (sVisible) {\n // 存在stroke\n context.setStrokeStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute);\n context.stroke();\n }\n }\n\n this.afterRenderStep(\n rect,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n rectAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n\n draw(rect: IRect, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const rectAttribute = getTheme(rect, params?.theme).rect;\n this.tempTheme = rectAttribute;\n this._draw(rect, rectAttribute, false, drawContext, params);\n this.tempTheme = null;\n }\n}\n"]}
|
|
@@ -13,15 +13,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
13
13
|
const inversify_lite_1 = require("../../../common/inversify-lite"), theme_1 = require("../../../graphic/theme"), utils_1 = require("./utils"), base_render_1 = require("./base-render"), constants_1 = require("../../../graphic/constants"), color_string_1 = require("../../../color-string");
|
|
14
14
|
|
|
15
15
|
let DefaultCanvasRect3dRender = class extends base_render_1.BaseRender {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
16
|
+
type="rect3d";
|
|
17
|
+
numberType=constants_1.RECT3D_NUMBER_TYPE;
|
|
19
18
|
drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
20
|
-
|
|
21
|
-
const rectAttribute = (0, theme_1.getTheme)(rect, null == params ? void 0 : params.theme).rect, {fill: fill = rectAttribute.fill, stroke: stroke = rectAttribute.stroke, x1: x1, y1: y1, x: originX, y: originY, opacity: opacity = rectAttribute.opacity, fillOpacity: fillOpacity = rectAttribute.fillOpacity, lineWidth: lineWidth = rectAttribute.lineWidth, strokeOpacity: strokeOpacity = rectAttribute.strokeOpacity, visible: visible = rectAttribute.visible} = rect.attribute;
|
|
19
|
+
const rectAttribute = (0, theme_1.getTheme)(rect, params?.theme).rect, {fill: fill = rectAttribute.fill, stroke: stroke = rectAttribute.stroke, x1: x1, y1: y1, x: originX, y: originY, opacity: opacity = rectAttribute.opacity, fillOpacity: fillOpacity = rectAttribute.fillOpacity, lineWidth: lineWidth = rectAttribute.lineWidth, strokeOpacity: strokeOpacity = rectAttribute.strokeOpacity, visible: visible = rectAttribute.visible} = rect.attribute;
|
|
22
20
|
let {width: width, height: height} = rect.attribute;
|
|
23
|
-
width = (
|
|
24
|
-
const z =
|
|
21
|
+
width = (width ?? x1 - originX) || 0, height = (height ?? y1 - originY) || 0;
|
|
22
|
+
const z = this.z ?? 0, fVisible = (0, utils_1.rectFillVisible)(opacity, fillOpacity, width, height, fill), sVisible = (0,
|
|
25
23
|
utils_1.rectStrokeVisible)(opacity, strokeOpacity, width, height), doFill = (0,
|
|
26
24
|
utils_1.runFill)(fill), doStroke = (0, utils_1.runStroke)(stroke, lineWidth);
|
|
27
25
|
if (!rect.valid || !visible) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/render/contributions/render/rect3d-render.ts"],"names":[],"m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AAC,CAAC,CAAC;aACb,CAAC;YACF,OAAO,CAAC,SAAS,EAAE,CAAC;YACpB,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;YACjC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;YACjC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;YACjC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;YACjC,OAAO,CAAC,SAAS,EAAE,CAAC;YACpB,IAAI,MAAM,EAAE;gBACV,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;aAC7B;iBAAM;gBACL,OAAO,CAAC,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,QAAe,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;gBACpF,OAAO,CAAC,IAAI,EAAE,CAAC;aAChB;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,IAAa,EAAE,aAA6B,EAAE,WAAyB;QAC1E,MAAM,aAAa,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC,IAAI,CAAC;QAC1C,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;IACtD,CAAC;CACF,CAAA;AA9LY,yBAAyB;IADrC,IAAA,2BAAU,GAAE;GACA,yBAAyB,CA8LrC;AA9LY,8DAAyB","file":"rect3d-render.js","sourcesContent":["import { injectable } from '../../../common/inversify-lite';\nimport { getTheme } from '../../../graphic/theme';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IDirectionLight,\n IFace3d,\n IMarkAttribute,\n IPolygonItem,\n IRect3d,\n IThemeAttribute,\n IGraphicRender,\n IDrawContext,\n IGraphicRenderDrawParams,\n IRenderService\n} from '../../../interface';\nimport { rectFillVisible, rectStrokeVisible, runFill, runStroke } from './utils';\nimport { BaseRender } from './base-render';\nimport { RECT3D_NUMBER_TYPE } from '../../../graphic/constants';\nimport { ColorStore, ColorType } from '../../../color-string';\n@injectable()\nexport class DefaultCanvasRect3dRender extends BaseRender<IRect3d> implements IGraphicRender {\n type = 'rect3d';\n numberType: number = RECT3D_NUMBER_TYPE;\n declare z: number;\n\n drawShape(\n rect: IRect3d,\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 rectAttribute = graphicService.themeService.getCurrentTheme().rectAttribute;\n const rectAttribute = getTheme(rect, params?.theme).rect;\n const {\n fill = rectAttribute.fill,\n stroke = rectAttribute.stroke,\n x1,\n y1,\n x: originX,\n y: originY,\n opacity = rectAttribute.opacity,\n fillOpacity = rectAttribute.fillOpacity,\n lineWidth = rectAttribute.lineWidth,\n strokeOpacity = rectAttribute.strokeOpacity,\n visible = rectAttribute.visible\n } = rect.attribute;\n let { width, height } = rect.attribute;\n\n width = (width ?? x1 - originX) || 0;\n height = (height ?? y1 - originY) || 0;\n\n const z = this.z ?? 0;\n\n // 不绘制或者透明\n const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill);\n const sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height);\n const doFill = runFill(fill);\n const doStroke = runStroke(stroke, lineWidth);\n\n if (!(rect.valid && visible)) {\n return;\n }\n\n if (!(doFill || doStroke)) {\n return;\n }\n\n // 如果存在fillCb和strokeCb,那就不直接跳过\n if (!(fVisible || sVisible || fillCb || strokeCb)) {\n return;\n }\n\n const { light, camera } = drawContext.stage || {};\n const face3d = rect.findFace();\n\n if (fill !== false) {\n context.setCommonStyle(rect, rect.attribute, x, y, rectAttribute);\n let fc = fill;\n if (typeof fc !== 'string') {\n fc = 'black';\n }\n this.fill(x, y, z, face3d, fc, context, light, fillCb);\n }\n if (stroke !== false) {\n context.setStrokeStyle(rect, rect.attribute, x, y, rectAttribute);\n this.stroke(x, y, z, face3d, context);\n }\n }\n\n stroke(x: number, y: number, z: number, face3d: IFace3d, context: IContext2d) {\n const vertices = face3d.vertices;\n face3d.edges.forEach(edge => {\n const p1 = vertices[edge[0]];\n const v1 = {\n x: x + p1[0],\n y: y + p1[1],\n z: z + p1[2]\n };\n const p2 = vertices[edge[1]];\n const v2 = {\n x: x + p2[0],\n y: y + p2[1],\n z: z + p2[2]\n };\n context.beginPath();\n context.moveTo(v1.x, v1.y, v1.z);\n context.lineTo(v2.x, v2.y, v2.z);\n context.stroke();\n });\n }\n fill(\n x: number,\n y: number,\n z: number,\n face3d: IFace3d,\n fillColor: string,\n context: IContext2d,\n light: IDirectionLight,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n const rgbArray = ColorStore.Get(fillColor as string, ColorType.Color255);\n // 上下左右前后\n // 0,1,2,3,4,5\n const vertices = face3d.vertices;\n // 计算每个顶点的view\n const viewdVerticesZ = vertices.map(v => {\n return context.view(v[0], v[1], v[2])[2];\n });\n // 排序\n const sortFace: { faceIdx: number; polygon: IPolygonItem }[] = [];\n face3d.polygons.forEach((p, i) => {\n sortFace.push({\n faceIdx: i,\n polygon: p\n });\n // 设置ave_z进行排序\n const { polygon, normal } = p;\n\n const z1 = viewdVerticesZ[polygon[0]];\n const z2 = viewdVerticesZ[polygon[1]];\n const z3 = viewdVerticesZ[polygon[2]];\n const z4 = viewdVerticesZ[polygon[3]];\n\n p.ave_z = z1 + z2 + z3 + z4;\n });\n sortFace.sort((a, b) => b.polygon.ave_z - a.polygon.ave_z);\n\n sortFace.forEach(item => {\n const { polygon, normal } = item.polygon;\n\n const p1 = vertices[polygon[0]];\n const p2 = vertices[polygon[1]];\n const p3 = vertices[polygon[2]];\n const p4 = vertices[polygon[3]];\n\n const v1 = {\n x: x + p1[0],\n y: y + p1[1],\n z: z + p1[2]\n };\n const v2 = {\n x: x + p2[0],\n y: y + p2[1],\n z: z + p2[2]\n };\n const v3 = {\n x: x + p3[0],\n y: y + p3[1],\n z: z + p3[2]\n };\n const v4 = {\n x: x + p4[0],\n y: y + p4[1],\n z: z + p4[2]\n };\n context.beginPath();\n context.moveTo(v1.x, v1.y, v1.z);\n context.lineTo(v2.x, v2.y, v2.z);\n context.lineTo(v3.x, v3.y, v3.z);\n context.lineTo(v4.x, v4.y, v4.z);\n context.closePath();\n if (fillCb) {\n fillCb(context, null, null);\n } else {\n context.fillStyle = light ? light.computeColor(normal, rgbArray as any) : fillColor;\n context.fill();\n }\n });\n }\n\n draw(rect: IRect3d, renderService: IRenderService, drawContext: IDrawContext) {\n const rectAttribute = getTheme(rect).rect;\n this._draw(rect, rectAttribute, false, drawContext);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/render/contributions/render/rect3d-render.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mEAA4D;AAC5D,kDAAkD;AAelD,mCAAiF;AACjF,+CAA2C;AAC3C,0DAAgE;AAChE,wDAA8D;AAEvD,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,wBAAmB;IAChE,IAAI,GAAG,QAAQ,CAAC;IAChB,UAAU,GAAW,8BAAkB,CAAC;IAGxC,SAAS,CACP,IAAa,EACb,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,WAAyB,EACzB,MAAiC,EACjC,MAIY,EACZ,Q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C,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;YACjC,OAAO,CAAC,SAAS,EAAE,CAAC;YACpB,IAAI,MAAM,EAAE;gBACV,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;aAC7B;iBAAM;gBACL,OAAO,CAAC,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,QAAe,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;gBACpF,OAAO,CAAC,IAAI,EAAE,CAAC;aAChB;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,IAAa,EAAE,aAA6B,EAAE,WAAyB;QAC1E,MAAM,aAAa,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC,IAAI,CAAC;QAC1C,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;IACtD,CAAC;CACF,CAAA;AA9LY,yBAAyB;IADrC,IAAA,2BAAU,GAAE;GACA,yBAAyB,CA8LrC;AA9LY,8DAAyB","file":"rect3d-render.js","sourcesContent":["import { injectable } from '../../../common/inversify-lite';\nimport { getTheme } from '../../../graphic/theme';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IDirectionLight,\n IFace3d,\n IMarkAttribute,\n IPolygonItem,\n IRect3d,\n IThemeAttribute,\n IGraphicRender,\n IDrawContext,\n IGraphicRenderDrawParams,\n IRenderService\n} from '../../../interface';\nimport { rectFillVisible, rectStrokeVisible, runFill, runStroke } from './utils';\nimport { BaseRender } from './base-render';\nimport { RECT3D_NUMBER_TYPE } from '../../../graphic/constants';\nimport { ColorStore, ColorType } from '../../../color-string';\n@injectable()\nexport class DefaultCanvasRect3dRender extends BaseRender<IRect3d> implements IGraphicRender {\n type = 'rect3d';\n numberType: number = RECT3D_NUMBER_TYPE;\n declare z: number;\n\n drawShape(\n rect: IRect3d,\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 rectAttribute = graphicService.themeService.getCurrentTheme().rectAttribute;\n const rectAttribute = getTheme(rect, params?.theme).rect;\n const {\n fill = rectAttribute.fill,\n stroke = rectAttribute.stroke,\n x1,\n y1,\n x: originX,\n y: originY,\n opacity = rectAttribute.opacity,\n fillOpacity = rectAttribute.fillOpacity,\n lineWidth = rectAttribute.lineWidth,\n strokeOpacity = rectAttribute.strokeOpacity,\n visible = rectAttribute.visible\n } = rect.attribute;\n let { width, height } = rect.attribute;\n\n width = (width ?? x1 - originX) || 0;\n height = (height ?? y1 - originY) || 0;\n\n const z = this.z ?? 0;\n\n // 不绘制或者透明\n const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill);\n const sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height);\n const doFill = runFill(fill);\n const doStroke = runStroke(stroke, lineWidth);\n\n if (!(rect.valid && visible)) {\n return;\n }\n\n if (!(doFill || doStroke)) {\n return;\n }\n\n // 如果存在fillCb和strokeCb,那就不直接跳过\n if (!(fVisible || sVisible || fillCb || strokeCb)) {\n return;\n }\n\n const { light, camera } = drawContext.stage || {};\n const face3d = rect.findFace();\n\n if (fill !== false) {\n context.setCommonStyle(rect, rect.attribute, x, y, rectAttribute);\n let fc = fill;\n if (typeof fc !== 'string') {\n fc = 'black';\n }\n this.fill(x, y, z, face3d, fc, context, light, fillCb);\n }\n if (stroke !== false) {\n context.setStrokeStyle(rect, rect.attribute, x, y, rectAttribute);\n this.stroke(x, y, z, face3d, context);\n }\n }\n\n stroke(x: number, y: number, z: number, face3d: IFace3d, context: IContext2d) {\n const vertices = face3d.vertices;\n face3d.edges.forEach(edge => {\n const p1 = vertices[edge[0]];\n const v1 = {\n x: x + p1[0],\n y: y + p1[1],\n z: z + p1[2]\n };\n const p2 = vertices[edge[1]];\n const v2 = {\n x: x + p2[0],\n y: y + p2[1],\n z: z + p2[2]\n };\n context.beginPath();\n context.moveTo(v1.x, v1.y, v1.z);\n context.lineTo(v2.x, v2.y, v2.z);\n context.stroke();\n });\n }\n fill(\n x: number,\n y: number,\n z: number,\n face3d: IFace3d,\n fillColor: string,\n context: IContext2d,\n light: IDirectionLight,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n const rgbArray = ColorStore.Get(fillColor as string, ColorType.Color255);\n // 上下左右前后\n // 0,1,2,3,4,5\n const vertices = face3d.vertices;\n // 计算每个顶点的view\n const viewdVerticesZ = vertices.map(v => {\n return context.view(v[0], v[1], v[2])[2];\n });\n // 排序\n const sortFace: { faceIdx: number; polygon: IPolygonItem }[] = [];\n face3d.polygons.forEach((p, i) => {\n sortFace.push({\n faceIdx: i,\n polygon: p\n });\n // 设置ave_z进行排序\n const { polygon, normal } = p;\n\n const z1 = viewdVerticesZ[polygon[0]];\n const z2 = viewdVerticesZ[polygon[1]];\n const z3 = viewdVerticesZ[polygon[2]];\n const z4 = viewdVerticesZ[polygon[3]];\n\n p.ave_z = z1 + z2 + z3 + z4;\n });\n sortFace.sort((a, b) => b.polygon.ave_z - a.polygon.ave_z);\n\n sortFace.forEach(item => {\n const { polygon, normal } = item.polygon;\n\n const p1 = vertices[polygon[0]];\n const p2 = vertices[polygon[1]];\n const p3 = vertices[polygon[2]];\n const p4 = vertices[polygon[3]];\n\n const v1 = {\n x: x + p1[0],\n y: y + p1[1],\n z: z + p1[2]\n };\n const v2 = {\n x: x + p2[0],\n y: y + p2[1],\n z: z + p2[2]\n };\n const v3 = {\n x: x + p3[0],\n y: y + p3[1],\n z: z + p3[2]\n };\n const v4 = {\n x: x + p4[0],\n y: y + p4[1],\n z: z + p4[2]\n };\n context.beginPath();\n context.moveTo(v1.x, v1.y, v1.z);\n context.lineTo(v2.x, v2.y, v2.z);\n context.lineTo(v3.x, v3.y, v3.z);\n context.lineTo(v4.x, v4.y, v4.z);\n context.closePath();\n if (fillCb) {\n fillCb(context, null, null);\n } else {\n context.fillStyle = light ? light.computeColor(normal, rgbArray as any) : fillColor;\n context.fill();\n }\n });\n }\n\n draw(rect: IRect3d, renderService: IRenderService, drawContext: IDrawContext) {\n const rectAttribute = getTheme(rect).rect;\n this._draw(rect, rectAttribute, false, drawContext);\n }\n}\n"]}
|
|
@@ -15,8 +15,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
15
15
|
const inversify_lite_1 = require("../../../common/inversify-lite"), rect_1 = require("../../../common/shape/rect"), theme_1 = require("../../../graphic/theme"), constants_1 = require("../../../graphic/constants"), utils_1 = require("./utils"), base_render_1 = require("./base-render"), text_contribution_render_1 = require("./contributions/text-contribution-render");
|
|
16
16
|
|
|
17
17
|
let DefaultCanvasRichTextRender = class extends base_render_1.BaseRender {
|
|
18
|
+
type;
|
|
19
|
+
numberType=constants_1.RICHTEXT_NUMBER_TYPE;
|
|
18
20
|
constructor() {
|
|
19
|
-
super(), this.
|
|
21
|
+
super(), this.builtinContributions = [ text_contribution_render_1.defaultTextBackgroundRenderContribution ],
|
|
20
22
|
this.init();
|
|
21
23
|
}
|
|
22
24
|
drawShape(richtext, context, x, y, drawContext) {
|
|
@@ -29,7 +31,6 @@ let DefaultCanvasRichTextRender = class extends base_render_1.BaseRender {
|
|
|
29
31
|
richtext.getFrameCache().draw(context, this.drawIcon), this.afterRenderStep(richtext, context, x, y, fVisible, sVisible, fVisible, sVisible, richtextAttribute, drawContext);
|
|
30
32
|
}
|
|
31
33
|
drawIcon(icon, context, x, y, baseline) {
|
|
32
|
-
var _a;
|
|
33
34
|
const richtextIconAttribute = (0, theme_1.getTheme)(icon).richtextIcon, {width: width = richtextIconAttribute.width, height: height = richtextIconAttribute.height, opacity: opacity = richtextIconAttribute.opacity, image: url, backgroundFill: backgroundFill = richtextIconAttribute.backgroundFill, backgroundFillOpacity: backgroundFillOpacity = richtextIconAttribute.backgroundFillOpacity, backgroundStroke: backgroundStroke = richtextIconAttribute.backgroundStroke, backgroundStrokeOpacity: backgroundStrokeOpacity = richtextIconAttribute.backgroundStrokeOpacity, backgroundRadius: backgroundRadius = richtextIconAttribute.backgroundRadius, margin: margin} = icon.attribute, {backgroundWidth: backgroundWidth = width, backgroundHeight: backgroundHeight = height} = icon.attribute;
|
|
34
35
|
if (margin && (x += icon._marginArray[3], y += icon._marginArray[0]), icon._hovered) {
|
|
35
36
|
const expandX = (backgroundWidth - width) / 2, expandY = (backgroundHeight - height) / 2;
|
|
@@ -39,7 +40,7 @@ let DefaultCanvasRichTextRender = class extends base_render_1.BaseRender {
|
|
|
39
40
|
context.fill()), backgroundStroke && (context.globalAlpha = backgroundStrokeOpacity,
|
|
40
41
|
context.strokeStyle = backgroundStroke, context.stroke());
|
|
41
42
|
}
|
|
42
|
-
const res = url &&
|
|
43
|
+
const res = url && icon?.resources?.get(url);
|
|
43
44
|
res && "success" === res.state && (context.globalAlpha = opacity, context.drawImage(res.data, x, y, width, height));
|
|
44
45
|
}
|
|
45
46
|
draw(richtext, renderService, drawContext) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/render/contributions/render/richtext-render.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mEAA4D;AAC5D,qDAA4D;AAC5D,kDAAkD;AAClD,0DAAkE;AASlE,mCAAsC;AACtC,+CAA2C;AAC3C,uFAAmG;AAG5F,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,wBAAqB;
|
|
1
|
+
{"version":3,"sources":["../src/render/contributions/render/richtext-render.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mEAA4D;AAC5D,qDAA4D;AAC5D,kDAAkD;AAClD,0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AAiB,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;IAC9D,CAAC;CACF,CAAA;AA/HY,2BAA2B;IADvC,IAAA,2BAAU,GAAE;;GACA,2BAA2B,CA+HvC;AA/HY,kEAA2B","file":"richtext-render.js","sourcesContent":["import { injectable } from '../../../common/inversify-lite';\nimport { createRectPath } from '../../../common/shape/rect';\nimport { getTheme } from '../../../graphic/theme';\nimport { RICHTEXT_NUMBER_TYPE } from '../../../graphic/constants';\nimport type {\n IContext2d,\n IRichText,\n IRichTextIcon,\n IDrawContext,\n IRenderService,\n IGraphicRender\n} from '../../../interface';\nimport { fillVisible } from './utils';\nimport { BaseRender } from './base-render';\nimport { defaultTextBackgroundRenderContribution } from './contributions/text-contribution-render';\n\n@injectable()\nexport class DefaultCanvasRichTextRender extends BaseRender<IRichText> implements IGraphicRender {\n type: 'richtext';\n numberType: number = RICHTEXT_NUMBER_TYPE;\n\n constructor() {\n super();\n this.builtinContributions = [defaultTextBackgroundRenderContribution as any];\n this.init();\n }\n\n drawShape(richtext: IRichText, context: IContext2d, x: number, y: number, drawContext: IDrawContext) {\n const richtextAttribute = getTheme(richtext).richtext;\n const {\n strokeOpacity = richtextAttribute.strokeOpacity,\n opacity = richtextAttribute.opacity,\n fillOpacity = richtextAttribute.fillOpacity,\n visible = richtextAttribute.visible\n } = richtext.attribute;\n\n if (!(richtext.valid && visible)) {\n return;\n }\n\n const fVisible = fillVisible(opacity, fillOpacity, true);\n const sVisible = fillVisible(opacity, strokeOpacity, true);\n if (!fVisible) {\n return;\n }\n\n context.translate(x, y);\n this.beforeRenderStep(\n richtext,\n context,\n x,\n y,\n fVisible,\n sVisible,\n fVisible,\n sVisible,\n richtextAttribute,\n drawContext\n );\n const frame = richtext.getFrameCache();\n frame.draw(context, this.drawIcon);\n\n this.afterRenderStep(\n richtext,\n context,\n x,\n y,\n fVisible,\n sVisible,\n fVisible,\n sVisible,\n richtextAttribute,\n drawContext\n );\n }\n\n drawIcon(icon: IRichTextIcon, context: IContext2d, x: number, y: number, baseline: number) {\n const richtextIconAttribute = getTheme(icon).richtextIcon;\n\n const {\n width = richtextIconAttribute.width,\n height = richtextIconAttribute.height,\n opacity = richtextIconAttribute.opacity,\n image: url,\n backgroundFill = richtextIconAttribute.backgroundFill,\n // backgroundFillColor = richtextIconAttribute.backgroundFillColor,\n backgroundFillOpacity = richtextIconAttribute.backgroundFillOpacity,\n backgroundStroke = richtextIconAttribute.backgroundStroke,\n // backgroundStrokeColor = richtextIconAttribute.backgroundStrokeColor,\n backgroundStrokeOpacity = richtextIconAttribute.backgroundStrokeOpacity,\n backgroundRadius = richtextIconAttribute.backgroundRadius,\n margin\n } = icon.attribute;\n\n const { backgroundWidth = width, backgroundHeight = height } = icon.attribute;\n\n if (margin) {\n x += icon._marginArray[3];\n y += icon._marginArray[0];\n }\n\n // y -= height / 2 - baseline;\n\n // 绘制background\n if (icon._hovered) {\n const expandX = (backgroundWidth - width) / 2;\n const expandY = (backgroundHeight - height) / 2;\n\n if (backgroundRadius === 0) {\n // 不需要处理圆角\n context.beginPath();\n context.rect(x - expandX, y - expandY, backgroundWidth, backgroundHeight);\n } else {\n context.beginPath();\n createRectPath(context, x - expandX, y - expandY, backgroundWidth, backgroundHeight, backgroundRadius);\n }\n if (backgroundFill) {\n // context.setCommonStyle(rect, rect.attribute, x, y, rectAttribute);\n context.globalAlpha = backgroundFillOpacity;\n context.fillStyle = backgroundFill as string;\n context.fill();\n }\n if (backgroundStroke) {\n // context.setStrokeStyle(rect, rect.attribute, x, y, rectAttribute);\n context.globalAlpha = backgroundStrokeOpacity;\n context.strokeStyle = backgroundStroke as string;\n context.stroke();\n }\n }\n\n // 绘制图标\n const res = url && icon?.resources?.get(url);\n if (!res || res.state !== 'success') {\n return;\n }\n // context.setCommonStyle(icon, icon.attribute, x, y, iconAttribute);\n context.globalAlpha = opacity;\n context.drawImage(res.data, x, y, width, height);\n }\n\n draw(richtext: IRichText, renderService: IRenderService, drawContext: IDrawContext) {\n const richtextAttribute = getTheme(richtext).richtext;\n this._draw(richtext, richtextAttribute, false, drawContext);\n }\n}\n"]}
|
|
@@ -19,27 +19,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
19
19
|
const inversify_lite_1 = require("../../../common/inversify-lite"), contribution_provider_1 = require("../../../common/contribution-provider"), theme_1 = require("../../../graphic/theme"), constants_1 = require("../../../graphic/constants"), base_render_1 = require("./base-render"), constants_2 = require("./contributions/constants"), vutils_1 = require("@visactor/vutils"), contributions_1 = require("./contributions");
|
|
20
20
|
|
|
21
21
|
let DefaultCanvasSymbolRender = class extends base_render_1.BaseRender {
|
|
22
|
+
symbolRenderContribitions;
|
|
23
|
+
type;
|
|
24
|
+
numberType=constants_1.SYMBOL_NUMBER_TYPE;
|
|
22
25
|
constructor(symbolRenderContribitions) {
|
|
23
|
-
super(), this.symbolRenderContribitions = symbolRenderContribitions, this.
|
|
24
|
-
this.builtinContributions = [ contributions_1.defaultSymbolRenderContribution, contributions_1.defaultSymbolBackgroundRenderContribution, contributions_1.defaultSymbolTextureRenderContribution ],
|
|
26
|
+
super(), this.symbolRenderContribitions = symbolRenderContribitions, this.builtinContributions = [ contributions_1.defaultSymbolRenderContribution, contributions_1.defaultSymbolBackgroundRenderContribution, contributions_1.defaultSymbolTextureRenderContribution ],
|
|
25
27
|
this.init(symbolRenderContribitions);
|
|
26
28
|
}
|
|
27
29
|
drawShape(symbol, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
28
|
-
|
|
29
|
-
const symbolAttribute = (0, theme_1.getTheme)(symbol, null == params ? void 0 : params.theme).symbol, {size: size = symbolAttribute.size, x: originX = symbolAttribute.x, y: originY = symbolAttribute.y, scaleX: scaleX = symbolAttribute.scaleX, scaleY: scaleY = symbolAttribute.scaleY} = symbol.attribute, data = this.valid(symbol, symbolAttribute, fillCb, strokeCb);
|
|
30
|
+
const symbolAttribute = (0, theme_1.getTheme)(symbol, params?.theme).symbol, {size: size = symbolAttribute.size, x: originX = symbolAttribute.x, y: originY = symbolAttribute.y, scaleX: scaleX = symbolAttribute.scaleX, scaleY: scaleY = symbolAttribute.scaleY} = symbol.attribute, data = this.valid(symbol, symbolAttribute, fillCb, strokeCb);
|
|
30
31
|
if (!data) return;
|
|
31
32
|
const {fVisible: fVisible, sVisible: sVisible, doFill: doFill, doStroke: doStroke} = data, parsedPath = symbol.getParsedPath();
|
|
32
33
|
if (!parsedPath) return;
|
|
33
|
-
const {keepDirIn3d: keepDirIn3d = symbolAttribute.keepDirIn3d} = symbol.attribute, z =
|
|
34
|
+
const {keepDirIn3d: keepDirIn3d = symbolAttribute.keepDirIn3d} = symbol.attribute, z = this.z ?? 0;
|
|
34
35
|
if (context.beginPath(), keepDirIn3d && context.camera && context.project) {
|
|
35
36
|
const p = context.project(x, y, z), camera = context.camera;
|
|
36
37
|
context.camera = null, !1 === parsedPath.draw(context, (0, vutils_1.isArray)(size) ? [ size[0] * scaleX, size[1] * scaleY ] : size * scaleX, p.x, p.y, void 0, ((p, a) => {
|
|
37
|
-
var _a, _b, _c;
|
|
38
38
|
if (symbol._parsedPath.svgCache) {
|
|
39
39
|
const obj = Object.assign({}, a);
|
|
40
|
-
obj.fill =
|
|
41
|
-
obj.
|
|
42
|
-
obj.fillOpacity = symbol.attribute.fillOpacity, obj.stroke = null !== (_c = a.stroke) && void 0 !== _c ? _c : symbol.attribute.stroke,
|
|
40
|
+
obj.fill = a.fill ?? symbol.attribute.fill, obj.opacity = a.fill ?? symbol.attribute.opacity,
|
|
41
|
+
obj.fillOpacity = symbol.attribute.fillOpacity, obj.stroke = a.stroke ?? symbol.attribute.stroke,
|
|
43
42
|
a = obj;
|
|
44
43
|
}
|
|
45
44
|
a.fill && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : (context.setCommonStyle(symbol, a, originX - x, originY - y, symbolAttribute),
|
|
@@ -47,12 +46,10 @@ let DefaultCanvasSymbolRender = class extends base_render_1.BaseRender {
|
|
|
47
46
|
context.stroke()));
|
|
48
47
|
})) && context.closePath(), context.camera = camera;
|
|
49
48
|
} else !1 === parsedPath.draw(context, size, x, y, z, ((p, a) => {
|
|
50
|
-
var _a, _b, _c;
|
|
51
49
|
if (symbol._parsedPath.svgCache) {
|
|
52
50
|
const obj = Object.assign({}, a);
|
|
53
|
-
obj.fill =
|
|
54
|
-
obj.
|
|
55
|
-
obj.fillOpacity = symbol.attribute.fillOpacity, obj.stroke = null !== (_c = a.stroke) && void 0 !== _c ? _c : symbol.attribute.stroke,
|
|
51
|
+
obj.fill = a.fill ?? symbol.attribute.fill, obj.opacity = a.opacity ?? symbol.attribute.opacity,
|
|
52
|
+
obj.fillOpacity = symbol.attribute.fillOpacity, obj.stroke = a.stroke ?? symbol.attribute.stroke,
|
|
56
53
|
a = obj;
|
|
57
54
|
}
|
|
58
55
|
a.fill && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : (context.setCommonStyle(symbol, a, originX - x, originY - y, symbolAttribute),
|
|
@@ -66,7 +63,7 @@ let DefaultCanvasSymbolRender = class extends base_render_1.BaseRender {
|
|
|
66
63
|
context.stroke())), this.afterRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
|
|
67
64
|
}
|
|
68
65
|
draw(symbol, renderService, drawContext, params) {
|
|
69
|
-
const symbolAttribute = (0, theme_1.getTheme)(symbol,
|
|
66
|
+
const symbolAttribute = (0, theme_1.getTheme)(symbol, params?.theme).symbol;
|
|
70
67
|
this._draw(symbol, symbolAttribute, !1, drawContext, params);
|
|
71
68
|
}
|
|
72
69
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/render/contributions/render/symbol-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,mEAA2E;AAE3E,iFAA6E;AAC7E,kDAAkD;AAClD,0DAAgE;AAehE,+CAA2C;AAE3C,yDAAqE;AAErE,6CAA2C;AAC3C,mDAIyB;AAGlB,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,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E,WAAW,EAAE,MAAM,CAAC,CAAC;IAClE,CAAC;CACF,CAAA;AAlNY,yBAAyB;IADrC,IAAA,2BAAU,GAAE;IAMR,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,oCAAwB,CAAC,CAAA;;GANvB,yBAAyB,CAkNrC;AAlNY,8DAAyB","file":"symbol-render.js","sourcesContent":["import { mat4Allocate } from '../../../allocator/matrix-allocate';\nimport { inject, injectable, named } from '../../../common/inversify-lite';\n// eslint-disable-next-line\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { getTheme } from '../../../graphic/theme';\nimport { SYMBOL_NUMBER_TYPE } from '../../../graphic/constants';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n ISymbol,\n IThemeAttribute,\n ISymbolRenderContribution,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider\n} from '../../../interface';\nimport type {} from '../../render-service';\nimport { BaseRender } from './base-render';\nimport { BaseRenderContributionTime } from '../../../common/enums';\nimport { SymbolRenderContribution } from './contributions/constants';\nimport { drawPathProxy, fillVisible, runFill, runStroke, strokeVisible } from './utils';\nimport { isArray } from '@visactor/vutils';\nimport {\n defaultSymbolBackgroundRenderContribution,\n defaultSymbolRenderContribution,\n defaultSymbolTextureRenderContribution\n} from './contributions';\n\n@injectable()\nexport class DefaultCanvasSymbolRender extends BaseRender<ISymbol> implements IGraphicRender {\n type: 'symbol';\n numberType: number = SYMBOL_NUMBER_TYPE;\n\n constructor(\n @inject(ContributionProvider)\n @named(SymbolRenderContribution)\n protected readonly symbolRenderContribitions: IContributionProvider<ISymbolRenderContribution>\n ) {\n super();\n this.builtinContributions = [\n defaultSymbolRenderContribution,\n defaultSymbolBackgroundRenderContribution,\n defaultSymbolTextureRenderContribution\n ];\n this.init(symbolRenderContribitions);\n }\n\n drawShape(\n symbol: ISymbol,\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 symbolAttribute = graphicService.themeService.getCurrentTheme().symbolAttribute;\n const symbolAttribute = getTheme(symbol, params?.theme).symbol;\n\n const {\n size = symbolAttribute.size,\n x: originX = symbolAttribute.x,\n y: originY = symbolAttribute.y,\n scaleX = symbolAttribute.scaleX,\n scaleY = symbolAttribute.scaleY\n } = symbol.attribute;\n\n const data = this.valid(symbol, symbolAttribute, fillCb, strokeCb);\n if (!data) {\n return;\n }\n const { fVisible, sVisible, doFill, doStroke } = data;\n\n const parsedPath = symbol.getParsedPath();\n // todo: 考虑使用path\n if (!parsedPath) {\n return;\n }\n\n const { keepDirIn3d = symbolAttribute.keepDirIn3d } = symbol.attribute;\n const z = this.z ?? 0;\n context.beginPath();\n if (keepDirIn3d && context.camera && context.project) {\n const p = context.project(x, y, z);\n const camera = context.camera;\n context.camera = null;\n if (\n parsedPath.draw(\n context,\n isArray(size) ? [size[0] * scaleX, size[1] * scaleY] : size * scaleX,\n p.x,\n p.y,\n undefined,\n (p, a) => {\n // 如果是svg的话,合并一下fill和stroke\n if (symbol._parsedPath.svgCache) {\n const obj = Object.assign({}, a);\n obj.fill = a.fill ?? symbol.attribute.fill;\n obj.opacity = a.fill ?? symbol.attribute.opacity;\n obj.fillOpacity = symbol.attribute.fillOpacity;\n obj.stroke = a.stroke ?? symbol.attribute.stroke;\n a = obj;\n }\n if (a.fill) {\n if (fillCb) {\n fillCb(context, symbol.attribute, symbolAttribute);\n } else {\n context.setCommonStyle(symbol, a, originX - x, originY - y, symbolAttribute);\n context.fill();\n }\n }\n if (a.stroke) {\n if (strokeCb) {\n strokeCb(context, symbol.attribute, symbolAttribute);\n } else {\n context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute);\n context.stroke();\n }\n }\n }\n ) === false\n ) {\n context.closePath();\n }\n context.camera = camera;\n } else {\n if (\n parsedPath.draw(context, size, x, y, z, (p, a) => {\n // 如果是svg的话,合并一下fill和stroke\n if (symbol._parsedPath.svgCache) {\n const obj = Object.assign({}, a);\n obj.fill = a.fill ?? symbol.attribute.fill;\n obj.opacity = a.opacity ?? symbol.attribute.opacity;\n obj.fillOpacity = symbol.attribute.fillOpacity;\n obj.stroke = a.stroke ?? symbol.attribute.stroke;\n a = obj;\n }\n if (a.fill) {\n if (fillCb) {\n fillCb(context, symbol.attribute, symbolAttribute);\n } else {\n context.setCommonStyle(symbol, a, originX - x, originY - y, symbolAttribute);\n context.fill();\n }\n }\n if (a.stroke) {\n if (strokeCb) {\n strokeCb(context, symbol.attribute, symbolAttribute);\n } else {\n context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute);\n context.stroke();\n }\n }\n }) === false\n ) {\n context.closePath();\n }\n }\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute);\n\n this.beforeRenderStep(\n symbol,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n symbolAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n\n // if (fill !== false) {\n // context.setCommonStyle(symbol.attribute, symbolAttribute);\n // context.fill();\n // }\n // if (stroke !== false) {\n // context.setStrokeStyle(symbol.attribute, symbolAttribute);\n // context.stroke();\n // }\n\n // svg就不用fill和stroke了\n if (doFill && !parsedPath.isSvg) {\n if (fillCb) {\n fillCb(context, symbol.attribute, symbolAttribute);\n } else if (fVisible) {\n context.setCommonStyle(symbol, symbol.attribute, originX - x, originY - y, symbolAttribute);\n context.fill();\n }\n }\n if (doStroke && !parsedPath.isSvg) {\n if (strokeCb) {\n strokeCb(context, symbol.attribute, symbolAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(\n symbol,\n symbol.attribute,\n (originX - x) / scaleX,\n (originY - y) / scaleY,\n symbolAttribute\n );\n context.stroke();\n }\n }\n\n this.afterRenderStep(\n symbol,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n symbolAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n\n draw(symbol: ISymbol, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const symbolAttribute = getTheme(symbol, params?.theme).symbol;\n this._draw(symbol, symbolAttribute, false, drawContext, params);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/render/contributions/render/symbol-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,mEAA2E;AAE3E,iFAA6E;AAC7E,kDAAkD;AAClD,0DAAgE;AAehE,+CAA2C;AAE3C,yDAAqE;AAErE,6CAA2C;AAC3C,mDAIyB;AAGlB,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,wBAAmB;IAO3C;IANrB,IAAI,CAAW;IACf,UAAU,GAAW,8BAAkB,CAAC;IAExC,YAGqB,yBAA2E;QAE9F,KAAK,EAAE,CAAC;QAFW,8BAAyB,GAAzB,yBAAyB,CAAkD;QAG9F,IAAI,CAAC,oBAAoB,GAAG;YAC1B,+CAA+B;YAC/B,yDAAyC;YACzC,sDAAsC;SACvC,CAAC;QACF,IAAI,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACvC,CAAC;IAED,SAAS,CACP,MAAe,EACf,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,WAAyB,EACzB,MAAiC,EACjC,MAIY,EACZ,QAIY;QAGZ,MAAM,eAAe,GAAG,IAAA,gBAAQ,EAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,MAAM,CAAC;QAE/D,MAAM,EACJ,IAAI,GAAG,eAAe,CAAC,IAAI,EAC3B,CAAC,EAAE,OAAO,GAAG,eAA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GAAG,CAAC,CAAC,GAAG,MAAM,EACtB,CAAC,OAAO,GAAG,CAAC,CAAC,GAAG,MAAM,EACtB,eAAe,CAChB,CAAC;gBACF,OAAO,CAAC,MAAM,EAAE,CAAC;aAClB;SACF;QAED,IAAI,CAAC,eAAe,CAClB,MAAM,EACN,OAAO,EACP,CAAC,EACD,CAAC,EACD,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,WAAW,EACX,MAAM,EACN,QAAQ,CACT,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,MAAe,EAAE,aAA6B,EAAE,WAAyB,EAAE,MAAiC;QAC/G,MAAM,eAAe,GAAG,IAAA,gBAAQ,EAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,MAAM,CAAC;QAC/D,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IAClE,CAAC;CACF,CAAA;AAlNY,yBAAyB;IADrC,IAAA,2BAAU,GAAE;IAMR,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,oCAAwB,CAAC,CAAA;;GANvB,yBAAyB,CAkNrC;AAlNY,8DAAyB","file":"symbol-render.js","sourcesContent":["import { mat4Allocate } from '../../../allocator/matrix-allocate';\nimport { inject, injectable, named } from '../../../common/inversify-lite';\n// eslint-disable-next-line\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { getTheme } from '../../../graphic/theme';\nimport { SYMBOL_NUMBER_TYPE } from '../../../graphic/constants';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n ISymbol,\n IThemeAttribute,\n ISymbolRenderContribution,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider\n} from '../../../interface';\nimport type {} from '../../render-service';\nimport { BaseRender } from './base-render';\nimport { BaseRenderContributionTime } from '../../../common/enums';\nimport { SymbolRenderContribution } from './contributions/constants';\nimport { drawPathProxy, fillVisible, runFill, runStroke, strokeVisible } from './utils';\nimport { isArray } from '@visactor/vutils';\nimport {\n defaultSymbolBackgroundRenderContribution,\n defaultSymbolRenderContribution,\n defaultSymbolTextureRenderContribution\n} from './contributions';\n\n@injectable()\nexport class DefaultCanvasSymbolRender extends BaseRender<ISymbol> implements IGraphicRender {\n type: 'symbol';\n numberType: number = SYMBOL_NUMBER_TYPE;\n\n constructor(\n @inject(ContributionProvider)\n @named(SymbolRenderContribution)\n protected readonly symbolRenderContribitions: IContributionProvider<ISymbolRenderContribution>\n ) {\n super();\n this.builtinContributions = [\n defaultSymbolRenderContribution,\n defaultSymbolBackgroundRenderContribution,\n defaultSymbolTextureRenderContribution\n ];\n this.init(symbolRenderContribitions);\n }\n\n drawShape(\n symbol: ISymbol,\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 symbolAttribute = graphicService.themeService.getCurrentTheme().symbolAttribute;\n const symbolAttribute = getTheme(symbol, params?.theme).symbol;\n\n const {\n size = symbolAttribute.size,\n x: originX = symbolAttribute.x,\n y: originY = symbolAttribute.y,\n scaleX = symbolAttribute.scaleX,\n scaleY = symbolAttribute.scaleY\n } = symbol.attribute;\n\n const data = this.valid(symbol, symbolAttribute, fillCb, strokeCb);\n if (!data) {\n return;\n }\n const { fVisible, sVisible, doFill, doStroke } = data;\n\n const parsedPath = symbol.getParsedPath();\n // todo: 考虑使用path\n if (!parsedPath) {\n return;\n }\n\n const { keepDirIn3d = symbolAttribute.keepDirIn3d } = symbol.attribute;\n const z = this.z ?? 0;\n context.beginPath();\n if (keepDirIn3d && context.camera && context.project) {\n const p = context.project(x, y, z);\n const camera = context.camera;\n context.camera = null;\n if (\n parsedPath.draw(\n context,\n isArray(size) ? [size[0] * scaleX, size[1] * scaleY] : size * scaleX,\n p.x,\n p.y,\n undefined,\n (p, a) => {\n // 如果是svg的话,合并一下fill和stroke\n if (symbol._parsedPath.svgCache) {\n const obj = Object.assign({}, a);\n obj.fill = a.fill ?? symbol.attribute.fill;\n obj.opacity = a.fill ?? symbol.attribute.opacity;\n obj.fillOpacity = symbol.attribute.fillOpacity;\n obj.stroke = a.stroke ?? symbol.attribute.stroke;\n a = obj;\n }\n if (a.fill) {\n if (fillCb) {\n fillCb(context, symbol.attribute, symbolAttribute);\n } else {\n context.setCommonStyle(symbol, a, originX - x, originY - y, symbolAttribute);\n context.fill();\n }\n }\n if (a.stroke) {\n if (strokeCb) {\n strokeCb(context, symbol.attribute, symbolAttribute);\n } else {\n context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute);\n context.stroke();\n }\n }\n }\n ) === false\n ) {\n context.closePath();\n }\n context.camera = camera;\n } else {\n if (\n parsedPath.draw(context, size, x, y, z, (p, a) => {\n // 如果是svg的话,合并一下fill和stroke\n if (symbol._parsedPath.svgCache) {\n const obj = Object.assign({}, a);\n obj.fill = a.fill ?? symbol.attribute.fill;\n obj.opacity = a.opacity ?? symbol.attribute.opacity;\n obj.fillOpacity = symbol.attribute.fillOpacity;\n obj.stroke = a.stroke ?? symbol.attribute.stroke;\n a = obj;\n }\n if (a.fill) {\n if (fillCb) {\n fillCb(context, symbol.attribute, symbolAttribute);\n } else {\n context.setCommonStyle(symbol, a, originX - x, originY - y, symbolAttribute);\n context.fill();\n }\n }\n if (a.stroke) {\n if (strokeCb) {\n strokeCb(context, symbol.attribute, symbolAttribute);\n } else {\n context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute);\n context.stroke();\n }\n }\n }) === false\n ) {\n context.closePath();\n }\n }\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute);\n\n this.beforeRenderStep(\n symbol,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n symbolAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n\n // if (fill !== false) {\n // context.setCommonStyle(symbol.attribute, symbolAttribute);\n // context.fill();\n // }\n // if (stroke !== false) {\n // context.setStrokeStyle(symbol.attribute, symbolAttribute);\n // context.stroke();\n // }\n\n // svg就不用fill和stroke了\n if (doFill && !parsedPath.isSvg) {\n if (fillCb) {\n fillCb(context, symbol.attribute, symbolAttribute);\n } else if (fVisible) {\n context.setCommonStyle(symbol, symbol.attribute, originX - x, originY - y, symbolAttribute);\n context.fill();\n }\n }\n if (doStroke && !parsedPath.isSvg) {\n if (strokeCb) {\n strokeCb(context, symbol.attribute, symbolAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(\n symbol,\n symbol.attribute,\n (originX - x) / scaleX,\n (originY - y) / scaleY,\n symbolAttribute\n );\n context.stroke();\n }\n }\n\n this.afterRenderStep(\n symbol,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n symbolAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n\n draw(symbol: ISymbol, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const symbolAttribute = getTheme(symbol, params?.theme).symbol;\n this._draw(symbol, symbolAttribute, false, drawContext, params);\n }\n}\n"]}
|