@visactor/vrender-core 0.19.6-alpha.3 → 0.19.6
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/bounds-allocate.js +1 -1
- package/cjs/allocator/bounds-allocate.js.map +1 -1
- package/cjs/allocator/canvas-allocate.js +9 -11
- package/cjs/allocator/canvas-allocate.js.map +1 -1
- package/cjs/allocator/graphic-allocate.js +9 -5
- package/cjs/allocator/graphic-allocate.js.map +1 -1
- package/cjs/allocator/matrix-allocate.js +6 -2
- package/cjs/allocator/matrix-allocate.js.map +1 -1
- package/cjs/animate/Ticker/default-ticker.js +14 -25
- package/cjs/animate/Ticker/default-ticker.js.map +1 -1
- package/cjs/animate/animate.js +7 -8
- package/cjs/animate/animate.js.map +1 -1
- package/cjs/animate/custom-animate.js +51 -54
- package/cjs/animate/custom-animate.js.map +1 -1
- package/cjs/animate/easing.js +8 -19
- package/cjs/animate/easing.js.map +1 -1
- package/cjs/animate/morphing.js +23 -20
- package/cjs/animate/morphing.js.map +1 -1
- package/cjs/application.js +1 -7
- package/cjs/application.js.map +1 -1
- package/cjs/canvas/conical-gradient.js +5 -12
- package/cjs/canvas/conical-gradient.js.map +1 -1
- package/cjs/canvas/contributions/base-canvas.js +7 -19
- package/cjs/canvas/contributions/base-canvas.js.map +1 -1
- package/cjs/color-string/interpolate.js +3 -5
- package/cjs/color-string/interpolate.js.map +1 -1
- package/cjs/color-string/store.js +1 -3
- package/cjs/color-string/store.js.map +1 -1
- package/cjs/common/bounds-context.js +0 -1
- package/cjs/common/bounds-context.js.map +1 -1
- package/cjs/common/canvas-utils.js +6 -3
- package/cjs/common/canvas-utils.js.map +1 -1
- package/cjs/common/contribution-provider.js +0 -3
- package/cjs/common/contribution-provider.js.map +1 -1
- package/cjs/common/custom-path2d.js +1 -7
- package/cjs/common/custom-path2d.js.map +1 -1
- package/cjs/common/generator.js +1 -2
- package/cjs/common/generator.js.map +1 -1
- package/cjs/common/inversify/binding.js +0 -12
- package/cjs/common/inversify/binding.js.map +1 -1
- package/cjs/common/inversify/container.js +0 -4
- package/cjs/common/inversify/container.js.map +1 -1
- package/cjs/common/inversify/cotainer-module.js +0 -2
- package/cjs/common/inversify/cotainer-module.js.map +1 -1
- package/cjs/common/inversify/meta-data.js +0 -2
- package/cjs/common/inversify/meta-data.js.map +1 -1
- package/cjs/common/inversify/syntax/binding_in_syntax.js +0 -1
- package/cjs/common/inversify/syntax/binding_in_syntax.js.map +1 -1
- package/cjs/common/inversify/syntax/binding_to_syntax.js +0 -1
- package/cjs/common/inversify/syntax/binding_to_syntax.js.map +1 -1
- package/cjs/common/inversify-lite/annotation/lazy_service_identifier.js +0 -1
- package/cjs/common/inversify-lite/annotation/lazy_service_identifier.js.map +1 -1
- package/cjs/common/inversify-lite/bindings/binding.js +0 -14
- package/cjs/common/inversify-lite/bindings/binding.js.map +1 -1
- package/cjs/common/inversify-lite/container/container.js +46 -22
- package/cjs/common/inversify-lite/container/container.js.map +1 -1
- package/cjs/common/inversify-lite/container/container_module.js +0 -4
- package/cjs/common/inversify-lite/container/container_module.js.map +1 -1
- package/cjs/common/inversify-lite/container/lookup.js +0 -1
- package/cjs/common/inversify-lite/container/lookup.js.map +1 -1
- package/cjs/common/inversify-lite/planning/context.js +0 -4
- package/cjs/common/inversify-lite/planning/context.js.map +1 -1
- package/cjs/common/inversify-lite/planning/metadata.js +0 -2
- package/cjs/common/inversify-lite/planning/metadata.js.map +1 -1
- package/cjs/common/inversify-lite/planning/plan.js +0 -2
- package/cjs/common/inversify-lite/planning/plan.js.map +1 -1
- package/cjs/common/inversify-lite/planning/queryable_string.js +0 -1
- package/cjs/common/inversify-lite/planning/queryable_string.js.map +1 -1
- package/cjs/common/inversify-lite/planning/request.js +0 -8
- package/cjs/common/inversify-lite/planning/request.js.map +1 -1
- package/cjs/common/inversify-lite/planning/target.js +0 -7
- package/cjs/common/inversify-lite/planning/target.js.map +1 -1
- package/cjs/common/inversify-lite/resolution/instantiation.js +42 -16
- package/cjs/common/inversify-lite/resolution/instantiation.js.map +1 -1
- package/cjs/common/inversify-lite/scope/scope.js +29 -3
- package/cjs/common/inversify-lite/scope/scope.js.map +1 -1
- package/cjs/common/inversify-lite/syntax/binding_in_syntax.js +0 -1
- 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 +0 -3
- 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 +0 -1
- package/cjs/common/inversify-lite/syntax/binding_on_syntax.js.map +1 -1
- package/cjs/common/inversify-lite/syntax/binding_to_syntax.js +0 -1
- package/cjs/common/inversify-lite/syntax/binding_to_syntax.js.map +1 -1
- package/cjs/common/inversify-lite/syntax/binding_when_on_syntax.js +0 -2
- package/cjs/common/inversify-lite/syntax/binding_when_on_syntax.js.map +1 -1
- package/cjs/common/inversify-lite/syntax/binding_when_syntax.js +0 -1
- package/cjs/common/inversify-lite/syntax/binding_when_syntax.js.map +1 -1
- package/cjs/common/polygon.js +2 -1
- package/cjs/common/polygon.js.map +1 -1
- package/cjs/common/render-area.js +3 -2
- package/cjs/common/render-area.js.map +1 -1
- package/cjs/common/render-curve.js +8 -4
- package/cjs/common/render-curve.js.map +1 -1
- package/cjs/common/seg-context.js +3 -12
- package/cjs/common/seg-context.js.map +1 -1
- package/cjs/common/segment/basis.js +0 -13
- 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 +0 -4
- 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 +0 -4
- 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 +1 -2
- package/cjs/common/segment/curve/line.js.map +1 -1
- package/cjs/common/segment/curve/move.js +1 -2
- package/cjs/common/segment/curve/move.js.map +1 -1
- package/cjs/common/segment/curve/path.js +0 -2
- 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.js +0 -10
- package/cjs/common/segment/linear.js.map +1 -1
- package/cjs/common/segment/monotone.js +0 -13
- package/cjs/common/segment/monotone.js.map +1 -1
- package/cjs/common/segment/step.js +2 -13
- package/cjs/common/segment/step.js.map +1 -1
- package/cjs/common/sort.js +34 -3
- package/cjs/common/sort.js.map +1 -1
- package/cjs/common/split-path.js +11 -4
- package/cjs/common/split-path.js.map +1 -1
- package/cjs/common/utils.js +4 -8
- package/cjs/common/utils.js.map +1 -1
- package/cjs/common/xml/parser.js +2 -3
- package/cjs/common/xml/parser.js.map +1 -1
- package/cjs/core/camera.js +4 -11
- package/cjs/core/camera.js.map +1 -1
- package/cjs/core/contributions/env/base-contribution.js +0 -6
- package/cjs/core/contributions/env/base-contribution.js.map +1 -1
- package/cjs/core/contributions/layerHandler/canvas2d-contribution.js +11 -20
- 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 +6 -5
- package/cjs/core/contributions/layerHandler/offscreen2d-contribution.js.map +1 -1
- package/cjs/core/contributions/textMeasure/AtextMeasure.js +8 -11
- package/cjs/core/contributions/textMeasure/AtextMeasure.js.map +1 -1
- package/cjs/core/contributions/textMeasure/layout.js +0 -3
- package/cjs/core/contributions/textMeasure/layout.js.map +1 -1
- package/cjs/core/contributions/window/base-contribution.js +0 -2
- package/cjs/core/contributions/window/base-contribution.js.map +1 -1
- package/cjs/core/global.js +0 -8
- package/cjs/core/global.js.map +1 -1
- package/cjs/core/graphic-utils.js +5 -16
- 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 +9 -7
- package/cjs/core/layer.js.map +1 -1
- package/cjs/core/stage.js +34 -68
- package/cjs/core/stage.js.map +1 -1
- package/cjs/core/window.js +13 -16
- package/cjs/core/window.js.map +1 -1
- package/cjs/event/event-manager.js +145 -153
- package/cjs/event/event-manager.js.map +1 -1
- package/cjs/event/event-system.js +43 -60
- package/cjs/event/event-system.js.map +1 -1
- package/cjs/event/event-target.js +3 -1
- package/cjs/event/event-target.js.map +1 -1
- package/cjs/event/federated-event/base-event.js +15 -43
- package/cjs/event/federated-event/base-event.js.map +1 -1
- package/cjs/event/federated-event/mouse-event.js +18 -27
- package/cjs/event/federated-event/mouse-event.js.map +1 -1
- package/cjs/event/federated-event/pointer-event.js +8 -12
- package/cjs/event/federated-event/pointer-event.js.map +1 -1
- package/cjs/event/federated-event/wheel-event.js +10 -13
- package/cjs/event/federated-event/wheel-event.js.map +1 -1
- package/cjs/graphic/arc.js +5 -10
- package/cjs/graphic/arc.js.map +1 -1
- package/cjs/graphic/arc3d.js +4 -7
- package/cjs/graphic/arc3d.js.map +1 -1
- package/cjs/graphic/area.js +9 -14
- package/cjs/graphic/area.js.map +1 -1
- package/cjs/graphic/builtin-symbol/arrow.js +3 -2
- package/cjs/graphic/builtin-symbol/arrow.js.map +1 -1
- package/cjs/graphic/builtin-symbol/arrow2-down.js +3 -2
- package/cjs/graphic/builtin-symbol/arrow2-down.js.map +1 -1
- package/cjs/graphic/builtin-symbol/arrow2-left.js +3 -2
- package/cjs/graphic/builtin-symbol/arrow2-left.js.map +1 -1
- package/cjs/graphic/builtin-symbol/arrow2-right.js +3 -2
- package/cjs/graphic/builtin-symbol/arrow2-right.js.map +1 -1
- package/cjs/graphic/builtin-symbol/arrow2-up.js +3 -2
- package/cjs/graphic/builtin-symbol/arrow2-up.js.map +1 -1
- package/cjs/graphic/builtin-symbol/circle.js +3 -2
- package/cjs/graphic/builtin-symbol/circle.js.map +1 -1
- package/cjs/graphic/builtin-symbol/close.js +3 -2
- package/cjs/graphic/builtin-symbol/close.js.map +1 -1
- package/cjs/graphic/builtin-symbol/cross.js +3 -2
- package/cjs/graphic/builtin-symbol/cross.js.map +1 -1
- package/cjs/graphic/builtin-symbol/diamond.js +3 -2
- package/cjs/graphic/builtin-symbol/diamond.js.map +1 -1
- package/cjs/graphic/builtin-symbol/line-h.js +3 -2
- package/cjs/graphic/builtin-symbol/line-h.js.map +1 -1
- package/cjs/graphic/builtin-symbol/line-v.js +3 -2
- package/cjs/graphic/builtin-symbol/line-v.js.map +1 -1
- package/cjs/graphic/builtin-symbol/rect.js +3 -2
- package/cjs/graphic/builtin-symbol/rect.js.map +1 -1
- package/cjs/graphic/builtin-symbol/square.js +3 -2
- package/cjs/graphic/builtin-symbol/square.js.map +1 -1
- package/cjs/graphic/builtin-symbol/star.js +3 -2
- package/cjs/graphic/builtin-symbol/star.js.map +1 -1
- package/cjs/graphic/builtin-symbol/stroke.js +3 -2
- package/cjs/graphic/builtin-symbol/stroke.js.map +1 -1
- package/cjs/graphic/builtin-symbol/thin-triangle.js +3 -2
- package/cjs/graphic/builtin-symbol/thin-triangle.js.map +1 -1
- package/cjs/graphic/builtin-symbol/triangle-down.js +3 -2
- package/cjs/graphic/builtin-symbol/triangle-down.js.map +1 -1
- package/cjs/graphic/builtin-symbol/triangle-left.js +3 -2
- package/cjs/graphic/builtin-symbol/triangle-left.js.map +1 -1
- package/cjs/graphic/builtin-symbol/triangle-right.js +3 -2
- package/cjs/graphic/builtin-symbol/triangle-right.js.map +1 -1
- package/cjs/graphic/builtin-symbol/triangle-up.js +3 -2
- package/cjs/graphic/builtin-symbol/triangle-up.js.map +1 -1
- package/cjs/graphic/builtin-symbol/triangle.js +3 -1
- package/cjs/graphic/builtin-symbol/triangle.js.map +1 -1
- package/cjs/graphic/builtin-symbol/utils.js +1 -6
- package/cjs/graphic/builtin-symbol/utils.js.map +1 -1
- package/cjs/graphic/builtin-symbol/wedge.js +3 -2
- package/cjs/graphic/builtin-symbol/wedge.js.map +1 -1
- package/cjs/graphic/builtin-symbol/wye.js +3 -2
- package/cjs/graphic/builtin-symbol/wye.js.map +1 -1
- package/cjs/graphic/circle.js +6 -8
- package/cjs/graphic/circle.js.map +1 -1
- package/cjs/graphic/config.js +32 -58
- package/cjs/graphic/config.js.map +1 -1
- package/cjs/graphic/glyph.js +9 -10
- package/cjs/graphic/glyph.js.map +1 -1
- package/cjs/graphic/graphic-service/graphic-service.js +8 -12
- package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
- package/cjs/graphic/graphic.js +44 -27
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/graphic/group.js +5 -9
- package/cjs/graphic/group.js.map +1 -1
- package/cjs/graphic/image.js +16 -18
- package/cjs/graphic/image.js.map +1 -1
- package/cjs/graphic/line.js +6 -11
- package/cjs/graphic/line.js.map +1 -1
- package/cjs/graphic/node-tree.js +44 -25
- package/cjs/graphic/node-tree.js.map +1 -1
- package/cjs/graphic/path.js +6 -12
- package/cjs/graphic/path.js.map +1 -1
- package/cjs/graphic/polygon.js +4 -7
- package/cjs/graphic/polygon.js.map +1 -1
- package/cjs/graphic/pyramid3d.js +3 -4
- package/cjs/graphic/pyramid3d.js.map +1 -1
- package/cjs/graphic/rect.js +3 -7
- package/cjs/graphic/rect.js.map +1 -1
- package/cjs/graphic/rect3d.js +4 -5
- package/cjs/graphic/rect3d.js.map +1 -1
- package/cjs/graphic/richtext/frame.js +0 -19
- package/cjs/graphic/richtext/frame.js.map +1 -1
- package/cjs/graphic/richtext/icon.js +6 -14
- package/cjs/graphic/richtext/icon.js.map +1 -1
- package/cjs/graphic/richtext/line.js +2 -14
- package/cjs/graphic/richtext/line.js.map +1 -1
- package/cjs/graphic/richtext/paragraph.js +0 -22
- package/cjs/graphic/richtext/paragraph.js.map +1 -1
- package/cjs/graphic/richtext/utils.js +2 -1
- package/cjs/graphic/richtext/utils.js.map +1 -1
- package/cjs/graphic/richtext/wrapper.js +0 -12
- package/cjs/graphic/richtext/wrapper.js.map +1 -1
- package/cjs/graphic/richtext.js +45 -38
- package/cjs/graphic/richtext.js.map +1 -1
- package/cjs/graphic/shadow-root.js +1 -2
- package/cjs/graphic/shadow-root.js.map +1 -1
- package/cjs/graphic/symbol.js +5 -12
- 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 +0 -4
- package/cjs/graphic/theme.js.map +1 -1
- package/cjs/graphic/tools.js +44 -16
- 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/picker/global-picker-service.js +0 -1
- package/cjs/picker/global-picker-service.js.map +1 -1
- package/cjs/picker/pick-interceptor.js +15 -5
- 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 +20 -26
- package/cjs/plugins/builtin-plugin/3dview-transform-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/auto-render-plugin.js +4 -5
- package/cjs/plugins/builtin-plugin/auto-render-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js +4 -5
- package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +8 -11
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.js +19 -28
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/incremental-auto-render-plugin.js +8 -12
- package/cjs/plugins/builtin-plugin/incremental-auto-render-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/react-attribute-plugin.js +7 -6
- package/cjs/plugins/builtin-plugin/react-attribute-plugin.js.map +1 -1
- package/cjs/plugins/plugin-service.js +0 -1
- package/cjs/plugins/plugin-service.js.map +1 -1
- package/cjs/render/contributions/render/arc-render.js +4 -6
- package/cjs/render/contributions/render/arc-render.js.map +1 -1
- package/cjs/render/contributions/render/arc3d-render.js +7 -5
- package/cjs/render/contributions/render/arc3d-render.js.map +1 -1
- package/cjs/render/contributions/render/area-render.js +23 -21
- package/cjs/render/contributions/render/area-render.js.map +1 -1
- package/cjs/render/contributions/render/base-render.js +0 -5
- package/cjs/render/contributions/render/base-render.js.map +1 -1
- package/cjs/render/contributions/render/circle-render.js +4 -6
- package/cjs/render/contributions/render/circle-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/arc-contribution-render.js +4 -3
- package/cjs/render/contributions/render/contributions/arc-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/area-texture-contribution-render.js +9 -6
- package/cjs/render/contributions/render/contributions/area-texture-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/base-contribution-render.js +8 -10
- 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 +4 -3
- package/cjs/render/contributions/render/contributions/circle-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/group-contribution-render.js +3 -1
- package/cjs/render/contributions/render/contributions/group-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/image-contribution-render.js +3 -1
- package/cjs/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/rect-contribution-render.js +14 -11
- package/cjs/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/symbol-contribution-render.js +4 -3
- package/cjs/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/text-contribution-render.js +8 -6
- package/cjs/render/contributions/render/contributions/text-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/draw-contribution.js +14 -12
- package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
- package/cjs/render/contributions/render/draw-interceptor.js +21 -11
- package/cjs/render/contributions/render/draw-interceptor.js.map +1 -1
- package/cjs/render/contributions/render/glyph-render.js +3 -2
- package/cjs/render/contributions/render/glyph-render.js.map +1 -1
- package/cjs/render/contributions/render/graphic-render.js +1 -4
- package/cjs/render/contributions/render/graphic-render.js.map +1 -1
- package/cjs/render/contributions/render/group-render.js +3 -7
- package/cjs/render/contributions/render/group-render.js.map +1 -1
- package/cjs/render/contributions/render/image-render.js +2 -4
- package/cjs/render/contributions/render/image-render.js.map +1 -1
- package/cjs/render/contributions/render/incremental-area-render.js +3 -1
- package/cjs/render/contributions/render/incremental-area-render.js.map +1 -1
- package/cjs/render/contributions/render/incremental-draw-contribution.js +109 -80
- package/cjs/render/contributions/render/incremental-draw-contribution.js.map +1 -1
- package/cjs/render/contributions/render/incremental-line-render.js +3 -1
- package/cjs/render/contributions/render/incremental-line-render.js.map +1 -1
- package/cjs/render/contributions/render/line-render.js +16 -12
- package/cjs/render/contributions/render/line-render.js.map +1 -1
- package/cjs/render/contributions/render/path-render.js +7 -8
- package/cjs/render/contributions/render/path-render.js.map +1 -1
- package/cjs/render/contributions/render/polygon-render.js +4 -6
- package/cjs/render/contributions/render/polygon-render.js.map +1 -1
- package/cjs/render/contributions/render/pyramid3d-render.js +5 -3
- package/cjs/render/contributions/render/pyramid3d-render.js.map +1 -1
- package/cjs/render/contributions/render/rect-render.js +7 -8
- package/cjs/render/contributions/render/rect-render.js.map +1 -1
- package/cjs/render/contributions/render/rect3d-render.js +7 -5
- package/cjs/render/contributions/render/rect3d-render.js.map +1 -1
- package/cjs/render/contributions/render/richtext-render.js +3 -4
- package/cjs/render/contributions/render/richtext-render.js.map +1 -1
- package/cjs/render/contributions/render/symbol-render.js +14 -11
- 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 +2 -11
- package/cjs/render/render-service.js.map +1 -1
- package/cjs/resource-loader/loader.js +16 -13
- package/cjs/resource-loader/loader.js.map +1 -1
- package/cjs/tapable/Hook.js +0 -3
- package/cjs/tapable/Hook.js.map +1 -1
- package/dist/index.es.js +1709 -2151
- package/es/allocator/bounds-allocate.js +1 -1
- package/es/allocator/bounds-allocate.js.map +1 -1
- package/es/allocator/canvas-allocate.js +9 -11
- package/es/allocator/canvas-allocate.js.map +1 -1
- package/es/allocator/graphic-allocate.js +9 -5
- package/es/allocator/graphic-allocate.js.map +1 -1
- package/es/allocator/matrix-allocate.js +6 -2
- package/es/allocator/matrix-allocate.js.map +1 -1
- package/es/animate/Ticker/default-ticker.js +14 -25
- package/es/animate/Ticker/default-ticker.js.map +1 -1
- package/es/animate/animate.js +8 -7
- package/es/animate/animate.js.map +1 -1
- package/es/animate/custom-animate.js +50 -52
- package/es/animate/custom-animate.js.map +1 -1
- package/es/animate/easing.js +8 -18
- package/es/animate/easing.js.map +1 -1
- package/es/animate/morphing.js +23 -20
- package/es/animate/morphing.js.map +1 -1
- package/es/application.js +1 -7
- package/es/application.js.map +1 -1
- package/es/canvas/conical-gradient.js +6 -12
- package/es/canvas/conical-gradient.js.map +1 -1
- package/es/canvas/contributions/base-canvas.js +7 -19
- package/es/canvas/contributions/base-canvas.js.map +1 -1
- package/es/color-string/interpolate.js +3 -5
- 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 +0 -1
- package/es/common/bounds-context.js.map +1 -1
- package/es/common/canvas-utils.js +6 -3
- package/es/common/canvas-utils.js.map +1 -1
- package/es/common/contribution-provider.js +0 -3
- package/es/common/contribution-provider.js.map +1 -1
- package/es/common/custom-path2d.js +1 -7
- package/es/common/custom-path2d.js.map +1 -1
- package/es/common/generator.js +2 -1
- package/es/common/generator.js.map +1 -1
- package/es/common/inversify/binding.js +0 -12
- package/es/common/inversify/binding.js.map +1 -1
- package/es/common/inversify/container.js +0 -4
- package/es/common/inversify/container.js.map +1 -1
- package/es/common/inversify/cotainer-module.js +0 -2
- package/es/common/inversify/cotainer-module.js.map +1 -1
- package/es/common/inversify/meta-data.js +0 -2
- package/es/common/inversify/meta-data.js.map +1 -1
- package/es/common/inversify/syntax/binding_in_syntax.js +0 -1
- package/es/common/inversify/syntax/binding_in_syntax.js.map +1 -1
- package/es/common/inversify/syntax/binding_to_syntax.js +0 -1
- package/es/common/inversify/syntax/binding_to_syntax.js.map +1 -1
- package/es/common/inversify-lite/annotation/lazy_service_identifier.js +0 -1
- package/es/common/inversify-lite/annotation/lazy_service_identifier.js.map +1 -1
- package/es/common/inversify-lite/bindings/binding.js +0 -14
- package/es/common/inversify-lite/bindings/binding.js.map +1 -1
- package/es/common/inversify-lite/container/container.js +48 -22
- package/es/common/inversify-lite/container/container.js.map +1 -1
- package/es/common/inversify-lite/container/container_module.js +0 -4
- package/es/common/inversify-lite/container/container_module.js.map +1 -1
- package/es/common/inversify-lite/container/lookup.js +0 -1
- package/es/common/inversify-lite/container/lookup.js.map +1 -1
- package/es/common/inversify-lite/planning/context.js +0 -4
- package/es/common/inversify-lite/planning/context.js.map +1 -1
- package/es/common/inversify-lite/planning/metadata.js +0 -2
- package/es/common/inversify-lite/planning/metadata.js.map +1 -1
- package/es/common/inversify-lite/planning/plan.js +0 -2
- package/es/common/inversify-lite/planning/plan.js.map +1 -1
- package/es/common/inversify-lite/planning/queryable_string.js +0 -1
- package/es/common/inversify-lite/planning/queryable_string.js.map +1 -1
- package/es/common/inversify-lite/planning/request.js +0 -8
- package/es/common/inversify-lite/planning/request.js.map +1 -1
- package/es/common/inversify-lite/planning/target.js +0 -7
- package/es/common/inversify-lite/planning/target.js.map +1 -1
- package/es/common/inversify-lite/resolution/instantiation.js +44 -16
- package/es/common/inversify-lite/resolution/instantiation.js.map +1 -1
- package/es/common/inversify-lite/scope/scope.js +29 -3
- package/es/common/inversify-lite/scope/scope.js.map +1 -1
- package/es/common/inversify-lite/syntax/binding_in_syntax.js +0 -1
- 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 +0 -3
- 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 +0 -1
- package/es/common/inversify-lite/syntax/binding_on_syntax.js.map +1 -1
- package/es/common/inversify-lite/syntax/binding_to_syntax.js +0 -1
- package/es/common/inversify-lite/syntax/binding_to_syntax.js.map +1 -1
- package/es/common/inversify-lite/syntax/binding_when_on_syntax.js +0 -2
- package/es/common/inversify-lite/syntax/binding_when_on_syntax.js.map +1 -1
- package/es/common/inversify-lite/syntax/binding_when_syntax.js +0 -1
- package/es/common/inversify-lite/syntax/binding_when_syntax.js.map +1 -1
- package/es/common/polygon.js +2 -1
- package/es/common/polygon.js.map +1 -1
- package/es/common/render-area.js +3 -2
- package/es/common/render-area.js.map +1 -1
- package/es/common/render-curve.js +8 -4
- package/es/common/render-curve.js.map +1 -1
- package/es/common/seg-context.js +3 -12
- package/es/common/seg-context.js.map +1 -1
- package/es/common/segment/basis.js +0 -13
- 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 +1 -2
- package/es/common/segment/curve/arc.js.map +1 -1
- package/es/common/segment/curve/base.js +0 -4
- 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 +0 -4
- 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 +1 -2
- package/es/common/segment/curve/line.js.map +1 -1
- package/es/common/segment/curve/move.js +1 -2
- package/es/common/segment/curve/move.js.map +1 -1
- package/es/common/segment/curve/path.js +0 -2
- 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.js +0 -10
- package/es/common/segment/linear.js.map +1 -1
- package/es/common/segment/monotone.js +0 -13
- package/es/common/segment/monotone.js.map +1 -1
- package/es/common/segment/step.js +1 -12
- package/es/common/segment/step.js.map +1 -1
- package/es/common/sort.js +34 -3
- package/es/common/sort.js.map +1 -1
- package/es/common/split-path.js +11 -4
- package/es/common/split-path.js.map +1 -1
- package/es/common/utils.js +5 -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 +4 -11
- package/es/core/camera.js.map +1 -1
- package/es/core/contributions/env/base-contribution.js +0 -6
- package/es/core/contributions/env/base-contribution.js.map +1 -1
- package/es/core/contributions/layerHandler/canvas2d-contribution.js +11 -20
- 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 +6 -5
- package/es/core/contributions/layerHandler/offscreen2d-contribution.js.map +1 -1
- package/es/core/contributions/textMeasure/AtextMeasure.js +8 -11
- package/es/core/contributions/textMeasure/AtextMeasure.js.map +1 -1
- package/es/core/contributions/textMeasure/layout.js +0 -3
- package/es/core/contributions/textMeasure/layout.js.map +1 -1
- package/es/core/contributions/window/base-contribution.js +0 -2
- package/es/core/contributions/window/base-contribution.js.map +1 -1
- package/es/core/global.js +0 -8
- package/es/core/global.js.map +1 -1
- package/es/core/graphic-utils.js +5 -16
- 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 +9 -7
- package/es/core/layer.js.map +1 -1
- package/es/core/stage.js +34 -68
- package/es/core/stage.js.map +1 -1
- package/es/core/window.js +14 -16
- package/es/core/window.js.map +1 -1
- package/es/event/event-manager.js +145 -153
- package/es/event/event-manager.js.map +1 -1
- package/es/event/event-system.js +43 -60
- package/es/event/event-system.js.map +1 -1
- package/es/event/event-target.js +3 -1
- package/es/event/event-target.js.map +1 -1
- package/es/event/federated-event/base-event.js +15 -43
- package/es/event/federated-event/base-event.js.map +1 -1
- package/es/event/federated-event/mouse-event.js +18 -27
- package/es/event/federated-event/mouse-event.js.map +1 -1
- package/es/event/federated-event/pointer-event.js +8 -12
- package/es/event/federated-event/pointer-event.js.map +1 -1
- package/es/event/federated-event/wheel-event.js +11 -12
- package/es/event/federated-event/wheel-event.js.map +1 -1
- package/es/graphic/arc.js +6 -9
- package/es/graphic/arc.js.map +1 -1
- package/es/graphic/arc3d.js +5 -6
- package/es/graphic/arc3d.js.map +1 -1
- package/es/graphic/area.js +10 -13
- package/es/graphic/area.js.map +1 -1
- package/es/graphic/builtin-symbol/arrow.js +3 -2
- package/es/graphic/builtin-symbol/arrow.js.map +1 -1
- package/es/graphic/builtin-symbol/arrow2-down.js +3 -2
- package/es/graphic/builtin-symbol/arrow2-down.js.map +1 -1
- package/es/graphic/builtin-symbol/arrow2-left.js +3 -2
- package/es/graphic/builtin-symbol/arrow2-left.js.map +1 -1
- package/es/graphic/builtin-symbol/arrow2-right.js +3 -2
- package/es/graphic/builtin-symbol/arrow2-right.js.map +1 -1
- package/es/graphic/builtin-symbol/arrow2-up.js +3 -2
- package/es/graphic/builtin-symbol/arrow2-up.js.map +1 -1
- package/es/graphic/builtin-symbol/circle.js +3 -2
- package/es/graphic/builtin-symbol/circle.js.map +1 -1
- package/es/graphic/builtin-symbol/close.js +3 -2
- package/es/graphic/builtin-symbol/close.js.map +1 -1
- package/es/graphic/builtin-symbol/cross.js +3 -2
- package/es/graphic/builtin-symbol/cross.js.map +1 -1
- package/es/graphic/builtin-symbol/diamond.js +3 -2
- package/es/graphic/builtin-symbol/diamond.js.map +1 -1
- package/es/graphic/builtin-symbol/line-h.js +3 -2
- package/es/graphic/builtin-symbol/line-h.js.map +1 -1
- package/es/graphic/builtin-symbol/line-v.js +3 -2
- package/es/graphic/builtin-symbol/line-v.js.map +1 -1
- package/es/graphic/builtin-symbol/rect.js +3 -2
- package/es/graphic/builtin-symbol/rect.js.map +1 -1
- package/es/graphic/builtin-symbol/square.js +3 -2
- package/es/graphic/builtin-symbol/square.js.map +1 -1
- package/es/graphic/builtin-symbol/star.js +3 -2
- package/es/graphic/builtin-symbol/star.js.map +1 -1
- package/es/graphic/builtin-symbol/stroke.js +3 -2
- package/es/graphic/builtin-symbol/stroke.js.map +1 -1
- package/es/graphic/builtin-symbol/thin-triangle.js +3 -2
- package/es/graphic/builtin-symbol/thin-triangle.js.map +1 -1
- package/es/graphic/builtin-symbol/triangle-down.js +3 -2
- package/es/graphic/builtin-symbol/triangle-down.js.map +1 -1
- package/es/graphic/builtin-symbol/triangle-left.js +3 -2
- package/es/graphic/builtin-symbol/triangle-left.js.map +1 -1
- package/es/graphic/builtin-symbol/triangle-right.js +3 -2
- package/es/graphic/builtin-symbol/triangle-right.js.map +1 -1
- package/es/graphic/builtin-symbol/triangle-up.js +3 -2
- package/es/graphic/builtin-symbol/triangle-up.js.map +1 -1
- package/es/graphic/builtin-symbol/triangle.js +3 -1
- package/es/graphic/builtin-symbol/triangle.js.map +1 -1
- package/es/graphic/builtin-symbol/utils.js +2 -6
- package/es/graphic/builtin-symbol/utils.js.map +1 -1
- package/es/graphic/builtin-symbol/wedge.js +3 -2
- package/es/graphic/builtin-symbol/wedge.js.map +1 -1
- package/es/graphic/builtin-symbol/wye.js +3 -2
- package/es/graphic/builtin-symbol/wye.js.map +1 -1
- package/es/graphic/circle.js +6 -7
- package/es/graphic/circle.js.map +1 -1
- package/es/graphic/config.js +44 -72
- 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 +8 -12
- package/es/graphic/graphic-service/graphic-service.js.map +1 -1
- package/es/graphic/graphic.js +44 -27
- package/es/graphic/graphic.js.map +1 -1
- package/es/graphic/group.js +5 -8
- package/es/graphic/group.js.map +1 -1
- package/es/graphic/image.js +16 -17
- package/es/graphic/image.js.map +1 -1
- package/es/graphic/line.js +7 -10
- package/es/graphic/line.js.map +1 -1
- package/es/graphic/node-tree.js +44 -25
- package/es/graphic/node-tree.js.map +1 -1
- package/es/graphic/path.js +7 -11
- package/es/graphic/path.js.map +1 -1
- package/es/graphic/polygon.js +4 -6
- 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 +4 -6
- 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 +0 -19
- package/es/graphic/richtext/frame.js.map +1 -1
- package/es/graphic/richtext/icon.js +6 -14
- package/es/graphic/richtext/icon.js.map +1 -1
- package/es/graphic/richtext/line.js +2 -14
- package/es/graphic/richtext/line.js.map +1 -1
- package/es/graphic/richtext/paragraph.js +0 -22
- package/es/graphic/richtext/paragraph.js.map +1 -1
- package/es/graphic/richtext/utils.js +2 -1
- package/es/graphic/richtext/utils.js.map +1 -1
- package/es/graphic/richtext/wrapper.js +0 -12
- package/es/graphic/richtext/wrapper.js.map +1 -1
- package/es/graphic/richtext.js +46 -37
- package/es/graphic/richtext.js.map +1 -1
- package/es/graphic/shadow-root.js +1 -2
- package/es/graphic/shadow-root.js.map +1 -1
- package/es/graphic/symbol.js +6 -11
- package/es/graphic/symbol.js.map +1 -1
- package/es/graphic/text.js +40 -39
- package/es/graphic/text.js.map +1 -1
- package/es/graphic/theme.js +0 -4
- package/es/graphic/theme.js.map +1 -1
- package/es/graphic/tools.js +44 -16
- 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/picker/global-picker-service.js +0 -1
- package/es/picker/global-picker-service.js.map +1 -1
- package/es/picker/pick-interceptor.js +15 -5
- 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 +20 -26
- package/es/plugins/builtin-plugin/3dview-transform-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/auto-render-plugin.js +4 -5
- package/es/plugins/builtin-plugin/auto-render-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/dirty-bounds-plugin.js +4 -5
- package/es/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/flex-layout-plugin.js +8 -11
- package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/html-attribute-plugin.js +17 -28
- package/es/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/incremental-auto-render-plugin.js +8 -12
- 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 +0 -1
- package/es/plugins/plugin-service.js.map +1 -1
- package/es/render/contributions/render/arc-render.js +4 -6
- package/es/render/contributions/render/arc-render.js.map +1 -1
- package/es/render/contributions/render/arc3d-render.js +7 -5
- package/es/render/contributions/render/arc3d-render.js.map +1 -1
- package/es/render/contributions/render/area-render.js +23 -21
- package/es/render/contributions/render/area-render.js.map +1 -1
- package/es/render/contributions/render/base-render.js +0 -5
- package/es/render/contributions/render/base-render.js.map +1 -1
- package/es/render/contributions/render/circle-render.js +4 -6
- 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 +5 -2
- package/es/render/contributions/render/contributions/area-texture-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/base-contribution-render.js +7 -10
- package/es/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/base-texture-contribution-render.js +3 -4
- 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 +3 -1
- package/es/render/contributions/render/contributions/group-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/image-contribution-render.js +3 -1
- 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 +8 -6
- package/es/render/contributions/render/contributions/text-contribution-render.js.map +1 -1
- package/es/render/contributions/render/draw-contribution.js +14 -12
- package/es/render/contributions/render/draw-contribution.js.map +1 -1
- package/es/render/contributions/render/draw-interceptor.js +21 -11
- package/es/render/contributions/render/draw-interceptor.js.map +1 -1
- package/es/render/contributions/render/glyph-render.js +3 -2
- package/es/render/contributions/render/glyph-render.js.map +1 -1
- package/es/render/contributions/render/graphic-render.js +1 -4
- package/es/render/contributions/render/graphic-render.js.map +1 -1
- package/es/render/contributions/render/group-render.js +3 -7
- package/es/render/contributions/render/group-render.js.map +1 -1
- package/es/render/contributions/render/image-render.js +2 -5
- package/es/render/contributions/render/image-render.js.map +1 -1
- package/es/render/contributions/render/incremental-area-render.js +3 -1
- package/es/render/contributions/render/incremental-area-render.js.map +1 -1
- package/es/render/contributions/render/incremental-draw-contribution.js +109 -80
- package/es/render/contributions/render/incremental-draw-contribution.js.map +1 -1
- package/es/render/contributions/render/incremental-line-render.js +3 -1
- package/es/render/contributions/render/incremental-line-render.js.map +1 -1
- package/es/render/contributions/render/line-render.js +16 -12
- package/es/render/contributions/render/line-render.js.map +1 -1
- package/es/render/contributions/render/path-render.js +6 -8
- package/es/render/contributions/render/path-render.js.map +1 -1
- package/es/render/contributions/render/polygon-render.js +4 -6
- package/es/render/contributions/render/polygon-render.js.map +1 -1
- package/es/render/contributions/render/pyramid3d-render.js +5 -3
- package/es/render/contributions/render/pyramid3d-render.js.map +1 -1
- package/es/render/contributions/render/rect-render.js +6 -8
- package/es/render/contributions/render/rect-render.js.map +1 -1
- package/es/render/contributions/render/rect3d-render.js +7 -5
- package/es/render/contributions/render/rect3d-render.js.map +1 -1
- package/es/render/contributions/render/richtext-render.js +3 -4
- package/es/render/contributions/render/richtext-render.js.map +1 -1
- package/es/render/contributions/render/symbol-render.js +14 -11
- package/es/render/contributions/render/symbol-render.js.map +1 -1
- package/es/render/contributions/render/text-render.js +8 -9
- 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 +2 -11
- package/es/render/render-service.js.map +1 -1
- package/es/resource-loader/loader.js +17 -12
- package/es/resource-loader/loader.js.map +1 -1
- package/es/tapable/Hook.js +0 -3
- package/es/tapable/Hook.js.map +1 -1
- package/package.json +6 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/render/contributions/render/contributions/base-contribution-render.ts"],"names":[],"mappings":";;;;;;;;;;;;AAWA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAEvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,gCAAgC,EAAE,MAAM,aAAa,CAAC;AAE/D,MAAM,OAAO,uCAAuC;IAClD,IAAI,GAA+B,0BAA0B,CAAC,gBAAgB,CAAC;IAC/E,QAAQ,GAAY,IAAI,CAAC;IACzB,KAAK,GAAW,CAAC,CAAC;IAClB,SAAS,CACP,OAAiB,EACjB,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,MAAe,EACf,QAAiB,EACjB,QAAiB,EACjB,QAAiB,EACjB,gBAA6C,EAC7C,WAAyB,EACzB,MAAiH,EACjH,QAAmH,EACnH,OAAa;QAEb,MAAM,EACJ,UAAU,EACV,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC,WAAW,IAAI,gBAAgB,CAAC,iBAAiB,EACvF,OAAO,GAAG,gBAAgB,CAAC,OAAO,EAClC,cAAc,GAAG,gBAAgB,CAAC,cAAc,EAChD,aAAa,GAAG,gBAAgB,CAAC,aAAa,EAC/C,GAAG,OAAO,CAAC,SAAS,CAAC;QACtB,IAAI,CAAC,UAAU,EAAE;YACf,OAAO;SACR;QAED,IAAI,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,SAAS,EAAE;YAC9C,MAAM,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,UAAiB,CAAC,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,\n IContext2d,\n IGraphic,\n IStage,\n IThemeAttribute,\n IBaseRenderContribution,\n IContributionProvider,\n IDrawContext\n} from '../../../../interface';\nimport type { IBounds } from '@visactor/vutils';\nimport { inject, injectable, named } from '../../../../common/inversify-lite';\nimport { getTheme } from '../../../../graphic';\nimport { canvasAllocate } from '../../../../allocator/canvas-allocate';\nimport { pi2 } from '@visactor/vutils';\nimport { BaseRenderContributionTime } from '../../../../common/enums';\nimport { ContributionProvider } from '../../../../common/contribution-provider';\nimport { InteractiveSubRenderContribution } from './constants';\n\nexport class DefaultBaseBackgroundRenderContribution implements IBaseRenderContribution<IGraphic, IGraphicAttribute> {\n time: BaseRenderContributionTime = BaseRenderContributionTime.beforeFillStroke;\n useStyle: boolean = true;\n order: number = 0;\n drawShape(\n graphic: IGraphic,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<IGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n strokeCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n options?: any\n ) {\n const {\n background,\n backgroundOpacity = graphic.attribute.fillOpacity ?? graphicAttribute.backgroundOpacity,\n opacity = graphicAttribute.opacity,\n backgroundMode = graphicAttribute.backgroundMode,\n backgroundFit = graphicAttribute.backgroundFit\n } = graphic.attribute;\n if (!background) {\n return;\n }\n\n if (graphic.backgroundImg && graphic.resources) {\n const res = graphic.resources.get(background as any);\n if (res.state !== 'success' || !res.data) {\n return;\n }\n\n context.save();\n\n if (graphic.parent && !graphic.transMatrix.onlyTranslate()) {\n const groupAttribute = getTheme(graphic.parent).group;\n const { scrollX = groupAttribute.scrollX, scrollY = groupAttribute.scrollY } = graphic.parent.attribute;\n context.setTransformFromMatrix(graphic.parent.globalTransMatrix, true);\n context.translate(scrollX, scrollY);\n }\n context.clip();\n const b = graphic.AABBBounds;\n context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute);\n context.globalAlpha = backgroundOpacity * opacity;\n this.doDrawImage(context, res.data, b, backgroundMode, backgroundFit);\n context.restore();\n if (!graphic.transMatrix.onlyTranslate()) {\n context.setTransformForCurrent();\n }\n } else {\n context.highPerformanceSave();\n context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute);\n context.globalAlpha = backgroundOpacity * opacity;\n context.fillStyle = background as string;\n context.fill();\n context.highPerformanceRestore();\n }\n }\n\n protected doDrawImage(\n context: IContext2d,\n data: any,\n b: IBounds,\n backgroundMode: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat',\n backgroundFit: boolean\n ): void {\n if (backgroundMode === 'no-repeat') {\n context.drawImage(data, b.x1, b.y1, b.width(), b.height());\n } else {\n const targetW = b.width();\n const targetH = b.height();\n let w = targetW;\n let h = targetH;\n // debugger;\n // TODO 考虑缓存\n if (backgroundFit && backgroundMode !== 'repeat' && (data.width || data.height)) {\n const resW = data.width;\n const resH = data.height;\n\n if (backgroundMode === 'repeat-x') {\n // 高度适应\n const ratio = targetH / resH;\n w = resW * ratio;\n h = targetH;\n } else if (backgroundMode === 'repeat-y') {\n // 宽度适应\n const ratio = targetW / resW;\n h = resH * ratio;\n w = targetW;\n }\n\n const dpr = context.dpr;\n const canvas = canvasAllocate.allocate({ width: w, height: h, dpr });\n const ctx = canvas.getContext('2d');\n if (ctx) {\n ctx.inuse = true;\n ctx.clearMatrix();\n ctx.setTransformForCurrent(true);\n ctx.clearRect(0, 0, w, h);\n ctx.drawImage(data, 0, 0, w, h);\n data = canvas.nativeCanvas;\n }\n canvasAllocate.free(canvas);\n }\n const dpr = context.dpr;\n const pattern = context.createPattern(data, backgroundMode);\n pattern.setTransform && pattern.setTransform(new DOMMatrix([1 / dpr, 0, 0, 1 / dpr, 0, 0]));\n context.fillStyle = pattern;\n context.translate(b.x1, b.y1);\n context.fillRect(0, 0, targetW, targetH);\n context.translate(-b.x1, -b.y1);\n }\n }\n}\n\nexport const defaultBaseBackgroundRenderContribution = new DefaultBaseBackgroundRenderContribution();\n\nexport interface IInteractiveSubRenderContribution {\n render: (\n graphic: IGraphic,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<IGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n strokeCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n options?: any\n ) => void;\n}\n\n@injectable()\nexport class DefaultBaseInteractiveRenderContribution implements IBaseRenderContribution<IGraphic, IGraphicAttribute> {\n time: BaseRenderContributionTime = BaseRenderContributionTime.afterFillStroke;\n useStyle: boolean = true;\n order: number = 0;\n\n _subRenderContribitions?: IInteractiveSubRenderContribution[];\n constructor(\n @inject(ContributionProvider)\n @named(InteractiveSubRenderContribution)\n protected readonly subRenderContribitions: IContributionProvider<IInteractiveSubRenderContribution>\n ) {}\n\n drawShape(\n graphic: IGraphic,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<IGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n strokeCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n options?: any\n ) {\n if (!this._subRenderContribitions) {\n this._subRenderContribitions = this.subRenderContribitions.getContributions();\n }\n this._subRenderContribitions.forEach(c => {\n c.render(\n graphic,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n graphicAttribute,\n drawContext,\n fillCb,\n strokeCb,\n options\n );\n });\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56mVfuiqve2z91t1Ns+AmBjgWnmCvNZyjp6ZUrrVAAZ/d45+EDSBLth3juTFqjZ0L2mK3T9y/sackDQ2651XrCdA4KYuYq6ii1RNaB8SddmI1EKCkGKIZrOWHgzQWSs5pawThdVyoujv1IAUgTRtlCtA6RtTy0ASU+WzgxNQpA0RN+WqUqQFeQKo3QK5goTgKQEEpt362tS0fgFsOay1pEggxAZgFpWV+ZPJEDGJp1wGhl5Gy1XnzhYL8mLCapEZ/IMgIxNOuEdqRKQMQC1cEl4jwg2h+OJjuVPbNKJoLtjQHYC0AMyNq8FB9ECsrQckPjAEMmuzLNtGdqxSSdC/Fp/78qM7wWQvf890DYHfjibJtT7Lxi5ARUHEcDYTaOY+XmWHp3RBVfw/7HE6vQ/kFqNtpDetQkAAAAASUVORK5CYII=';\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/render/contributions/render/contributions/base-contribution-render.ts"],"names":[],"mappings":";;;;;;;;;;;;AAWA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAEvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,gCAAgC,EAAE,MAAM,aAAa,CAAC;AAE/D,MAAM,OAAO,uCAAuC;IAApD;QACE,SAAI,GAA+B,0BAA0B,CAAC,gBAAgB,CAAC;QAC/E,aAAQ,GAAY,IAAI,CAAC;QACzB,UAAK,GAAW,CAAC,CAAC;IAkHpB,CAAC;IAjHC,SAAS,CACP,OAAiB,EACjB,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,MAAe,EACf,QAAiB,EACjB,QAAiB,EACjB,QAAiB,EACjB,gBAA6C,EAC7C,WAAyB,EACzB,MA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,EAAE;YACvC,CAAC,CAAC,MAAM,CACN,OAAO,EACP,OAAO,EACP,CAAC,EACD,CAAC,EACD,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,MAAM,EACN,QAAQ,EACR,OAAO,CACR,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAhDY,wCAAwC;IADpD,UAAU,EAAE;IAQR,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,gCAAgC,CAAC,CAAA;;GAR/B,wCAAwC,CAgDpD;SAhDY,wCAAwC","file":"base-contribution-render.js","sourcesContent":["import type {\n IGraphicAttribute,\n IContext2d,\n IGraphic,\n IStage,\n IThemeAttribute,\n IBaseRenderContribution,\n IContributionProvider,\n IDrawContext\n} from '../../../../interface';\nimport type { IBounds } from '@visactor/vutils';\nimport { inject, injectable, named } from '../../../../common/inversify-lite';\nimport { getTheme } from '../../../../graphic';\nimport { canvasAllocate } from '../../../../allocator/canvas-allocate';\nimport { pi2 } from '@visactor/vutils';\nimport { BaseRenderContributionTime } from '../../../../common/enums';\nimport { ContributionProvider } from '../../../../common/contribution-provider';\nimport { InteractiveSubRenderContribution } from './constants';\n\nexport class DefaultBaseBackgroundRenderContribution implements IBaseRenderContribution<IGraphic, IGraphicAttribute> {\n time: BaseRenderContributionTime = BaseRenderContributionTime.beforeFillStroke;\n useStyle: boolean = true;\n order: number = 0;\n drawShape(\n graphic: IGraphic,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<IGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n strokeCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n options?: any\n ) {\n const {\n background,\n backgroundOpacity = graphic.attribute.fillOpacity ?? graphicAttribute.backgroundOpacity,\n opacity = graphicAttribute.opacity,\n backgroundMode = graphicAttribute.backgroundMode,\n backgroundFit = graphicAttribute.backgroundFit\n } = graphic.attribute;\n if (!background) {\n return;\n }\n\n if (graphic.backgroundImg && graphic.resources) {\n const res = graphic.resources.get(background as any);\n if (res.state !== 'success' || !res.data) {\n return;\n }\n\n context.save();\n\n if (graphic.parent && !graphic.transMatrix.onlyTranslate()) {\n const groupAttribute = getTheme(graphic.parent).group;\n const { scrollX = groupAttribute.scrollX, scrollY = groupAttribute.scrollY } = graphic.parent.attribute;\n context.setTransformFromMatrix(graphic.parent.globalTransMatrix, true);\n context.translate(scrollX, scrollY);\n }\n context.clip();\n const b = graphic.AABBBounds;\n context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute);\n context.globalAlpha = backgroundOpacity * opacity;\n this.doDrawImage(context, res.data, b, backgroundMode, backgroundFit);\n context.restore();\n if (!graphic.transMatrix.onlyTranslate()) {\n context.setTransformForCurrent();\n }\n } else {\n context.highPerformanceSave();\n context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute);\n context.globalAlpha = backgroundOpacity * opacity;\n context.fillStyle = background as string;\n context.fill();\n context.highPerformanceRestore();\n }\n }\n\n protected doDrawImage(\n context: IContext2d,\n data: any,\n b: IBounds,\n backgroundMode: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat',\n backgroundFit: boolean\n ): void {\n if (backgroundMode === 'no-repeat') {\n context.drawImage(data, b.x1, b.y1, b.width(), b.height());\n } else {\n const targetW = b.width();\n const targetH = b.height();\n let w = targetW;\n let h = targetH;\n // debugger;\n // TODO 考虑缓存\n if (backgroundFit && backgroundMode !== 'repeat' && (data.width || data.height)) {\n const resW = data.width;\n const resH = data.height;\n\n if (backgroundMode === 'repeat-x') {\n // 高度适应\n const ratio = targetH / resH;\n w = resW * ratio;\n h = targetH;\n } else if (backgroundMode === 'repeat-y') {\n // 宽度适应\n const ratio = targetW / resW;\n h = resH * ratio;\n w = targetW;\n }\n\n const dpr = context.dpr;\n const canvas = canvasAllocate.allocate({ width: w, height: h, dpr });\n const ctx = canvas.getContext('2d');\n if (ctx) {\n ctx.inuse = true;\n ctx.clearMatrix();\n ctx.setTransformForCurrent(true);\n ctx.clearRect(0, 0, w, h);\n ctx.drawImage(data, 0, 0, w, h);\n data = canvas.nativeCanvas;\n }\n canvasAllocate.free(canvas);\n }\n const dpr = context.dpr;\n const pattern = context.createPattern(data, backgroundMode);\n pattern.setTransform && pattern.setTransform(new DOMMatrix([1 / dpr, 0, 0, 1 / dpr, 0, 0]));\n context.fillStyle = pattern;\n context.translate(b.x1, b.y1);\n context.fillRect(0, 0, targetW, targetH);\n context.translate(-b.x1, -b.y1);\n }\n }\n}\n\nexport const defaultBaseBackgroundRenderContribution = new DefaultBaseBackgroundRenderContribution();\n\nexport interface IInteractiveSubRenderContribution {\n render: (\n graphic: IGraphic,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<IGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n strokeCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n options?: any\n ) => void;\n}\n\n@injectable()\nexport class DefaultBaseInteractiveRenderContribution implements IBaseRenderContribution<IGraphic, IGraphicAttribute> {\n time: BaseRenderContributionTime = BaseRenderContributionTime.afterFillStroke;\n useStyle: boolean = true;\n order: number = 0;\n\n _subRenderContribitions?: IInteractiveSubRenderContribution[];\n constructor(\n @inject(ContributionProvider)\n @named(InteractiveSubRenderContribution)\n protected readonly subRenderContribitions: IContributionProvider<IInteractiveSubRenderContribution>\n ) {}\n\n drawShape(\n graphic: IGraphic,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<IGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n strokeCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n options?: any\n ) {\n if (!this._subRenderContribitions) {\n this._subRenderContribitions = this.subRenderContribitions.getContributions();\n }\n this._subRenderContribitions.forEach(c => {\n c.render(\n graphic,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n graphicAttribute,\n drawContext,\n fillCb,\n strokeCb,\n options\n );\n });\n }\n}\n\n// const rect1 =\n// // @ts-ignore\n// 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFEAAABRCAYAAACqj0o2AAAAAXNSR0IArs4c6QAAByRJREFUeF7tnU1oXUUUx/+XLirxA8QGSdA0tGBNRFNBxYJCoRsXKkZQVFSwKKKFLhp14cbiwoWYgoEiorSgolIRQV24KRQUFAzYKMZaaIm1JEgiQtVgF+XKvPvmvbn3zsf/zLs3Hy/vbTMz557fnDkzc2bmJEnTNEXEb2Lfs5g8/HZETWGVS/9lFTZdJqwoLx6rUxIF8fwpJNePID1yAHhqUv61bA0FcPZwVnp0X70gj04g2XsI6e+/ANfdyH5ho5wc4vlTwGt7kLw1j/RJALtrBHn2Y2Dx20yhvqH6QB6dAE4cQvIekD43CLx8XARSBrEJEP/OZwIVRPWrA6QJUNvFVTuAkedFVhIs3ATYsCit0+UykDxEA2BOoP7KKkHaAGo5/buAbY8E2VAFDIAlnQQgOYgFgFaIVVmkD2CVIAsArTqRIMMQLQCdEDsFyQCsAqQFoFMnAqQfogOgF2IsSAnATkA6AHp1CoB0Q/QADEKUgvzjG2DuE8qNlQpJfKQHYFAnD0g7xADAoEDJZLM0DZx5Pw6grjWwBxi6399GACClkwNkGSIBkBLIgKwCoJaz/Qlgy212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DmQvkPW5fsPFj/FlGdIp48SBtERzr172oGZXuW2OAoNoycJequEFikWOBKDmWtj3BIi3Qq+UTT8EmQIoGrAdAEuaKzs8AirftMmxdaTYD6e8h1IjU7U+tEEmTQElV4bEPvWAiQvb1ze9j1ojiGC6oniuOZ5boxnmjVqZJ4ogNkN0a2S3vnSiPbFpDdeMaSm50Fq4qwTywuW3qnfaWFnByiaqJ37pwDGQexdwOiAog66UTvLk4WuBBnIzGTTqgcEFVfq/MFDwTOno6D2fJa1HorzLgxm7v4XjXIrr2f6Es6obq9KpBMsKAKi2TyWpAWyQ3nDXJne+xLYObegiMgQIYhbqDXAxPTwKTt3XlHrwd671jaZhn1jqWTpBMSH8n4QN9Uy17rI56mVfuiqve2z91t1Ns+AmBjgWnmCvNZyjp6ZUrrVAAZ/d45+EDSBLth3juTFqjZ0L2mK3T9y/sackDQ2651XrCdA4KYuYq6ii1RNaB8SddmI1EKCkGKIZrOWHgzQWSs5pawThdVyoujv1IAUgTRtlCtA6RtTy0ASU+WzgxNQpA0RN+WqUqQFeQKo3QK5goTgKQEEpt362tS0fgFsOay1pEggxAZgFpWV+ZPJEDGJp1wGhl5Gy1XnzhYL8mLCapEZ/IMgIxNOuEdqRKQMQC1cEl4jwg2h+OJjuVPbNKJoLtjQHYC0AMyNq8FB9ECsrQckPjAEMmuzLNtGdqxSSdC/Fp/78qM7wWQvf890DYHfjibJtT7Lxi5ARUHEcDYTaOY+XmWHp3RBVfw/7HE6vQ/kFqNtpDetQkAAAAASUVORK5CYII=';\n"]}
|
|
@@ -5,10 +5,9 @@ import { BaseRenderContributionTime } from "../../../../common/enums";
|
|
|
5
5
|
import { pi2 } from "@visactor/vutils";
|
|
6
6
|
|
|
7
7
|
export class DefaultBaseTextureRenderContribution {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
order=10;
|
|
8
|
+
constructor() {
|
|
9
|
+
this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 10;
|
|
10
|
+
}
|
|
12
11
|
createCommonPattern(size, padding, color, targetContext, cb) {
|
|
13
12
|
const r = (size - 2 * padding) / 2, dpr = targetContext.dpr, canvas = canvasAllocate.allocate({
|
|
14
13
|
width: size,
|
package/es/render/contributions/render/contributions/base-texture-contribution-render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/render/contributions/render/contributions/base-texture-contribution-render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAUtE,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEvC,MAAM,OAAO,oCAAoC;IAC/C,IAAI,GAA+B,0BAA0B,CAAC,eAAe,CAAC;IAC9E,QAAQ,GAAY,IAAI,CAAC;IACzB,UAAU,CAA8B;IACxC,KAAK,GAAW,EAAE,CAAC;IAEnB,mBAAmB,CACjB,IAAY,EACZ,OAAe,EACf,KAAa,EACb,aAAyB,EACzB,EAAkD;QAElD,MAAM,CAAC,GAAG,CAAC,IAAI,GAAG,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;QACnC,MAAM,GAAG,GAAG,aAAa,CAAC,GAAG,CAAC;QAC9B,MAAM,MAAM,GAAG,cAAc,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;QAC3E,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC,GAAG,EAAE;YACR,OAAO,IAAI,CAAC;SACb;QACD,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC;QACjB,GAAG,CAAC,WAAW,EAAE,CAAC;QAClB,GAAG,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;QACjC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE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CAAC,EAAE,gBAAgB,CAAC,CAAC;YAC3E,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC;YAC5B,OAAO,CAAC,IAAI,EAAE,CAAC;YACf,OAAO,CAAC,sBAAsB,EAAE,CAAC;SAClC;IACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,oCAAoC,GAAG,IAAI,oCAAoC,EAAE,CAAC","file":"base-texture-contribution-render.js","sourcesContent":["import { canvasAllocate } from '../../../../allocator/canvas-allocate';\nimport { BaseRenderContributionTime } from '../../../../common/enums';\nimport type {\n IBaseRenderContribution,\n IContext2d,\n IDrawContext,\n IGraphic,\n IGraphicAttribute,\n IStage,\n IThemeAttribute\n} from '../../../../interface';\nimport { pi2 } from '@visactor/vutils';\n\nexport class DefaultBaseTextureRenderContribution implements IBaseRenderContribution<IGraphic, IGraphicAttribute> {\n time: BaseRenderContributionTime = BaseRenderContributionTime.afterFillStroke;\n useStyle: boolean = true;\n textureMap?: Map<string, CanvasPattern>;\n order: number = 10;\n\n createCommonPattern(\n size: number,\n padding: number,\n color: string,\n targetContext: IContext2d,\n cb: (r: number, targetContext: IContext2d) => void\n ) {\n const r = (size - padding * 2) / 2;\n const dpr = targetContext.dpr;\n const canvas = canvasAllocate.allocate({ width: size, height: size, dpr });\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n return null;\n }\n ctx.inuse = true;\n ctx.clearMatrix();\n ctx.setTransformForCurrent(true);\n ctx.clearRect(0, 0, size, size);\n //setup up design for pattern\n cb(r, ctx);\n const pattern = targetContext.createPattern(canvas.nativeCanvas, 'repeat');\n pattern.setTransform && pattern.setTransform(new DOMMatrix([1 / dpr, 0, 0, 1 / dpr, 0, 0]));\n\n canvasAllocate.free(canvas);\n return pattern;\n }\n\n createCirclePattern(size: number, padding: number, color: string, targetContext: IContext2d) {\n return this.createCommonPattern(size, padding, color, targetContext, (r, ctx) => {\n ctx.fillStyle = color;\n ctx.arc(r, r, r, 0, pi2);\n ctx.fill();\n });\n }\n\n createDiamondPattern(size: number, padding: number, color: string, targetContext: IContext2d) {\n return this.createCommonPattern(size, padding, color, targetContext, (r, ctx) => {\n const x = size / 2;\n const y = x;\n ctx.fillStyle = color;\n ctx.moveTo(x, y - r);\n ctx.lineTo(r + x, y);\n ctx.lineTo(x, y + r);\n ctx.lineTo(x - r, y);\n ctx.closePath();\n ctx.fill();\n });\n }\n\n createRectPattern(size: number, padding: number, color: string, targetContext: IContext2d) {\n return this.createCommonPattern(size, padding, color, targetContext, (r, ctx) => {\n const x = padding;\n const y = x;\n ctx.fillStyle = color;\n ctx.fillRect(x, y, r * 2, r * 2);\n });\n }\n\n createVerticalLinePattern(size: number, padding: number, color: string, targetContext: IContext2d) {\n return this.createCommonPattern(size, padding, color, targetContext, (r, ctx) => {\n const x = padding;\n const y = 0;\n ctx.fillStyle = color;\n ctx.fillRect(x, y, r * 2, size);\n });\n }\n\n createHorizontalLinePattern(size: number, padding: number, color: string, targetContext: IContext2d) {\n return this.createCommonPattern(size, padding, color, targetContext, (r, ctx) => {\n const x = 0;\n const y = padding;\n ctx.fillStyle = color;\n ctx.fillRect(x, y, size, r * 2);\n });\n }\n\n createBiasLRLinePattern(size: number, padding: number, color: string, targetContext: IContext2d) {\n return this.createCommonPattern(size, padding, color, targetContext, (r, ctx) => {\n ctx.strokeStyle = color;\n ctx.lineWidth = r;\n ctx.moveTo(0, 0);\n ctx.lineTo(size, size);\n const dx = size / 2;\n const dy = -dx;\n ctx.moveTo(dx, dy);\n ctx.lineTo(dx + size, dy + size);\n ctx.moveTo(-dx, -dy);\n ctx.lineTo(-dx + size, -dy + size);\n ctx.stroke();\n });\n }\n\n createBiasRLLinePattern(size: number, padding: number, color: string, targetContext: IContext2d) {\n return this.createCommonPattern(size, padding, color, targetContext, (r, ctx) => {\n ctx.strokeStyle = color;\n ctx.lineWidth = r;\n ctx.moveTo(size, 0);\n ctx.lineTo(0, size);\n const dx = size / 2;\n const dy = dx;\n ctx.moveTo(size + dx, dy);\n ctx.lineTo(dx, dy + size);\n ctx.moveTo(size - dx, -dy);\n ctx.lineTo(-dx, -dy + size);\n ctx.stroke();\n });\n }\n\n createGridPattern(size: number, padding: number, color: string, targetContext: IContext2d) {\n return this.createCommonPattern(size, padding, color, targetContext, (r, ctx) => {\n const x = padding;\n const y = x;\n ctx.fillStyle = color;\n ctx.fillRect(x, y, r, r);\n ctx.fillRect(x + r, y + r, r, r);\n });\n }\n\n initTextureMap(ctx: IContext2d, stage: IStage) {\n this.textureMap = new Map();\n // ResourceLoader.GetImage(rect1, {\n // imageLoadFail: () => {\n // return;\n // },\n // imageLoadSuccess: (url, img) => {\n // const pattern = ctx.createPattern(img, 'repeat');\n // this.textureMap.set('rect1', pattern);\n // stage && stage.renderNextFrame();\n // }\n // });\n }\n\n drawShape(\n graphic: IGraphic,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<IGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n strokeCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n options?: any\n ) {\n if (!this.textureMap) {\n this.initTextureMap(context, graphic.stage);\n }\n const {\n texture = graphicAttribute.texture,\n textureColor = graphicAttribute.textureColor,\n textureSize = graphicAttribute.textureSize,\n texturePadding = graphicAttribute.texturePadding\n } = graphic.attribute;\n if (!texture) {\n return;\n }\n this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);\n }\n\n protected drawTexture(\n texture: string,\n graphic: IGraphic,\n context: IContext2d,\n x: number,\n y: number,\n graphicAttribute: Required<IGraphicAttribute>,\n textureColor: string,\n textureSize: number,\n texturePadding: number\n ) {\n let pattern: CanvasPattern = this.textureMap.get(texture);\n\n if (!pattern) {\n switch (texture) {\n case 'circle':\n pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);\n break;\n case 'diamond':\n pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);\n break;\n case 'rect':\n pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);\n break;\n case 'vertical-line':\n pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);\n break;\n case 'horizontal-line':\n pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);\n break;\n case 'bias-lr':\n pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);\n break;\n case 'bias-rl':\n pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);\n break;\n case 'grid':\n pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);\n break;\n }\n }\n\n if (pattern) {\n context.highPerformanceSave();\n context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute);\n context.fillStyle = pattern;\n context.fill();\n context.highPerformanceRestore();\n }\n }\n}\n\nexport const defaultBaseTextureRenderContribution = new DefaultBaseTextureRenderContribution();\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/render/contributions/render/contributions/base-texture-contribution-render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAUtE,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEvC,MAAM,OAAO,oCAAoC;IAAjD;QACE,SAAI,GAA+B,0BAA0B,CAAC,eAAe,CAAC;QAC9E,aAAQ,GAAY,IAAI,CAAC;QAEzB,UAAK,GAAW,EAAE,CAAC;IAsNrB,CAAC;IApNC,mBAAmB,CACjB,IAAY,EACZ,OAAe,EACf,KAAa,EACb,aAAyB,EACzB,EAAkD;QAElD,MAAM,CAAC,GAAG,CAAC,IAAI,GAAG,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;QACnC,MAAM,GAAG,GAAG,aAAa,CAAC,GAAG,CAAC;QAC9B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C;oBAC3F,MAAM;gBACR,KAAK,SAAS;oBACZ,OAAO,GAAG,IAAI,CAAC,uBAAuB,CAAC,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;oBAC3F,MAAM;gBACR,KAAK,MAAM;oBACT,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;oBACrF,MAAM;aACT;SACF;QAED,IAAI,OAAO,EAAE;YACX,OAAO,CAAC,mBAAmB,EAAE,CAAC;YAC9B,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,gBAAgB,CAAC,CAAC;YAC3E,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC;YAC5B,OAAO,CAAC,IAAI,EAAE,CAAC;YACf,OAAO,CAAC,sBAAsB,EAAE,CAAC;SAClC;IACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,oCAAoC,GAAG,IAAI,oCAAoC,EAAE,CAAC","file":"base-texture-contribution-render.js","sourcesContent":["import { canvasAllocate } from '../../../../allocator/canvas-allocate';\nimport { BaseRenderContributionTime } from '../../../../common/enums';\nimport type {\n IBaseRenderContribution,\n IContext2d,\n IDrawContext,\n IGraphic,\n IGraphicAttribute,\n IStage,\n IThemeAttribute\n} from '../../../../interface';\nimport { pi2 } from '@visactor/vutils';\n\nexport class DefaultBaseTextureRenderContribution implements IBaseRenderContribution<IGraphic, IGraphicAttribute> {\n time: BaseRenderContributionTime = BaseRenderContributionTime.afterFillStroke;\n useStyle: boolean = true;\n textureMap?: Map<string, CanvasPattern>;\n order: number = 10;\n\n createCommonPattern(\n size: number,\n padding: number,\n color: string,\n targetContext: IContext2d,\n cb: (r: number, targetContext: IContext2d) => void\n ) {\n const r = (size - padding * 2) / 2;\n const dpr = targetContext.dpr;\n const canvas = canvasAllocate.allocate({ width: size, height: size, dpr });\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n return null;\n }\n ctx.inuse = true;\n ctx.clearMatrix();\n ctx.setTransformForCurrent(true);\n ctx.clearRect(0, 0, size, size);\n //setup up design for pattern\n cb(r, ctx);\n const pattern = targetContext.createPattern(canvas.nativeCanvas, 'repeat');\n pattern.setTransform && pattern.setTransform(new DOMMatrix([1 / dpr, 0, 0, 1 / dpr, 0, 0]));\n\n canvasAllocate.free(canvas);\n return pattern;\n }\n\n createCirclePattern(size: number, padding: number, color: string, targetContext: IContext2d) {\n return this.createCommonPattern(size, padding, color, targetContext, (r, ctx) => {\n ctx.fillStyle = color;\n ctx.arc(r, r, r, 0, pi2);\n ctx.fill();\n });\n }\n\n createDiamondPattern(size: number, padding: number, color: string, targetContext: IContext2d) {\n return this.createCommonPattern(size, padding, color, targetContext, (r, ctx) => {\n const x = size / 2;\n const y = x;\n ctx.fillStyle = color;\n ctx.moveTo(x, y - r);\n ctx.lineTo(r + x, y);\n ctx.lineTo(x, y + r);\n ctx.lineTo(x - r, y);\n ctx.closePath();\n ctx.fill();\n });\n }\n\n createRectPattern(size: number, padding: number, color: string, targetContext: IContext2d) {\n return this.createCommonPattern(size, padding, color, targetContext, (r, ctx) => {\n const x = padding;\n const y = x;\n ctx.fillStyle = color;\n ctx.fillRect(x, y, r * 2, r * 2);\n });\n }\n\n createVerticalLinePattern(size: number, padding: number, color: string, targetContext: IContext2d) {\n return this.createCommonPattern(size, padding, color, targetContext, (r, ctx) => {\n const x = padding;\n const y = 0;\n ctx.fillStyle = color;\n ctx.fillRect(x, y, r * 2, size);\n });\n }\n\n createHorizontalLinePattern(size: number, padding: number, color: string, targetContext: IContext2d) {\n return this.createCommonPattern(size, padding, color, targetContext, (r, ctx) => {\n const x = 0;\n const y = padding;\n ctx.fillStyle = color;\n ctx.fillRect(x, y, size, r * 2);\n });\n }\n\n createBiasLRLinePattern(size: number, padding: number, color: string, targetContext: IContext2d) {\n return this.createCommonPattern(size, padding, color, targetContext, (r, ctx) => {\n ctx.strokeStyle = color;\n ctx.lineWidth = r;\n ctx.moveTo(0, 0);\n ctx.lineTo(size, size);\n const dx = size / 2;\n const dy = -dx;\n ctx.moveTo(dx, dy);\n ctx.lineTo(dx + size, dy + size);\n ctx.moveTo(-dx, -dy);\n ctx.lineTo(-dx + size, -dy + size);\n ctx.stroke();\n });\n }\n\n createBiasRLLinePattern(size: number, padding: number, color: string, targetContext: IContext2d) {\n return this.createCommonPattern(size, padding, color, targetContext, (r, ctx) => {\n ctx.strokeStyle = color;\n ctx.lineWidth = r;\n ctx.moveTo(size, 0);\n ctx.lineTo(0, size);\n const dx = size / 2;\n const dy = dx;\n ctx.moveTo(size + dx, dy);\n ctx.lineTo(dx, dy + size);\n ctx.moveTo(size - dx, -dy);\n ctx.lineTo(-dx, -dy + size);\n ctx.stroke();\n });\n }\n\n createGridPattern(size: number, padding: number, color: string, targetContext: IContext2d) {\n return this.createCommonPattern(size, padding, color, targetContext, (r, ctx) => {\n const x = padding;\n const y = x;\n ctx.fillStyle = color;\n ctx.fillRect(x, y, r, r);\n ctx.fillRect(x + r, y + r, r, r);\n });\n }\n\n initTextureMap(ctx: IContext2d, stage: IStage) {\n this.textureMap = new Map();\n // ResourceLoader.GetImage(rect1, {\n // imageLoadFail: () => {\n // return;\n // },\n // imageLoadSuccess: (url, img) => {\n // const pattern = ctx.createPattern(img, 'repeat');\n // this.textureMap.set('rect1', pattern);\n // stage && stage.renderNextFrame();\n // }\n // });\n }\n\n drawShape(\n graphic: IGraphic,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<IGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n strokeCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n options?: any\n ) {\n if (!this.textureMap) {\n this.initTextureMap(context, graphic.stage);\n }\n const {\n texture = graphicAttribute.texture,\n textureColor = graphicAttribute.textureColor,\n textureSize = graphicAttribute.textureSize,\n texturePadding = graphicAttribute.texturePadding\n } = graphic.attribute;\n if (!texture) {\n return;\n }\n this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);\n }\n\n protected drawTexture(\n texture: string,\n graphic: IGraphic,\n context: IContext2d,\n x: number,\n y: number,\n graphicAttribute: Required<IGraphicAttribute>,\n textureColor: string,\n textureSize: number,\n texturePadding: number\n ) {\n let pattern: CanvasPattern = this.textureMap.get(texture);\n\n if (!pattern) {\n switch (texture) {\n case 'circle':\n pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);\n break;\n case 'diamond':\n pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);\n break;\n case 'rect':\n pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);\n break;\n case 'vertical-line':\n pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);\n break;\n case 'horizontal-line':\n pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);\n break;\n case 'bias-lr':\n pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);\n break;\n case 'bias-rl':\n pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);\n break;\n case 'grid':\n pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);\n break;\n }\n }\n\n if (pattern) {\n context.highPerformanceSave();\n context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute);\n context.fillStyle = pattern;\n context.fill();\n context.highPerformanceRestore();\n }\n }\n}\n\nexport const defaultBaseTextureRenderContribution = new DefaultBaseTextureRenderContribution();\n"]}
|
|
@@ -7,9 +7,9 @@ import { BaseRenderContributionTime } from "../../../../common/enums";
|
|
|
7
7
|
import { defaultBaseTextureRenderContribution } from "./base-texture-contribution-render";
|
|
8
8
|
|
|
9
9
|
export class DefaultCircleRenderContribution {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
constructor() {
|
|
11
|
+
this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
|
|
12
|
+
}
|
|
13
13
|
drawShape(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, drawContext, fillCb, strokeCb) {
|
|
14
14
|
const {outerBorder: outerBorder, innerBorder: innerBorder} = circle.attribute, doOuterBorder = outerBorder && !1 !== outerBorder.visible, doInnerBorder = innerBorder && !1 !== innerBorder.visible;
|
|
15
15
|
if (!doOuterBorder && !doInnerBorder) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/render/contributions/render/contributions/circle-contribution-render.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,uCAAuC,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,oCAAoC,EAAE,MAAM,oCAAoC,CAAC;AAE1F,MAAM,OAAO,+BAA+B;
|
|
1
|
+
{"version":3,"sources":["../src/render/contributions/render/contributions/circle-contribution-render.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,uCAAuC,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,oCAAoC,EAAE,MAAM,oCAAoC,CAAC;AAE1F,MAAM,OAAO,+BAA+B;IAA5C;QACE,SAAI,GAA+B,0BAA0B,CAAC,eAAe,CAAC;QAC9E,aAAQ,GAAY,IAAI,CAAC;QACzB,UAAK,GAAW,CAAC,CAAC;IAsGpB,CAAC;IArGC,SAAS,CACP,MAAe,EACf,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,MAAe,EACf,QAAiB,EACjB,QAAiB,EACjB,QAAi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,eAAe,CAAC,CAAC;YAEtG,IAAI,QAAQ,EAAE;gBACZ,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;aAC7D;iBAAM,IAAI,aAAa,EAAE;gBAExB,MAAM,WAAW,GAAI,eAAe,CAAC,WAAmB,CAAC,OAAO,CAAC;gBAChE,eAAe,CAAC,WAAmB,CAAC,OAAO,GAAG,OAAO,CAAC;gBACvD,OAAO,CAAC,cAAc,CACpB,MAAM,EACN,WAAW,EACX,CAAC,OAAO,GAAG,CAAC,CAAC,GAAG,MAAM,EACtB,CAAC,OAAO,GAAG,CAAC,CAAC,GAAG,MAAM,EACtB,eAAe,CAAC,WAAkB,CACnC,CAAC;gBACD,eAAe,CAAC,WAAmB,CAAC,OAAO,GAAG,WAAW,CAAC;gBAC3D,OAAO,CAAC,MAAM,EAAE,CAAC;aAClB;SACF;IACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,+BAA+B,GAAG,IAAI,+BAA+B,EAAE,CAAC;AACrF,MAAM,CAAC,MAAM,sCAAsC,GAAG,oCAAoC,CAAC;AAC3F,MAAM,CAAC,MAAM,yCAAyC,GAAG,uCAAuC,CAAC","file":"circle-contribution-render.js","sourcesContent":["import type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n ICircle,\n ICircleGraphicAttribute,\n IThemeAttribute,\n ICircleRenderContribution,\n IDrawContext\n} from '../../../../interface';\nimport { getScaledStroke } from '../../../../common/canvas-utils';\nimport { defaultBaseBackgroundRenderContribution } from './base-contribution-render';\nimport { BaseRenderContributionTime } from '../../../../common/enums';\nimport { defaultBaseTextureRenderContribution } from './base-texture-contribution-render';\n\nexport class DefaultCircleRenderContribution implements ICircleRenderContribution {\n time: BaseRenderContributionTime = BaseRenderContributionTime.afterFillStroke;\n useStyle: boolean = true;\n order: number = 0;\n drawShape(\n circle: ICircle,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n circleAttribute: Required<ICircleGraphicAttribute>,\n drawContext: IDrawContext,\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 { outerBorder, innerBorder } = circle.attribute;\n const doOuterBorder = outerBorder && outerBorder.visible !== false;\n const doInnerBorder = innerBorder && innerBorder.visible !== false;\n if (!(doOuterBorder || doInnerBorder)) {\n return;\n }\n const {\n radius = circleAttribute.radius,\n startAngle = circleAttribute.startAngle,\n endAngle = circleAttribute.endAngle,\n opacity = circleAttribute.opacity,\n x: originX = circleAttribute.x,\n y: originY = circleAttribute.y,\n scaleX = circleAttribute.scaleX,\n scaleY = circleAttribute.scaleY\n } = circle.attribute;\n\n const doStrokeOuter = !!(outerBorder && outerBorder.stroke);\n const doStrokeInner = !!(innerBorder && innerBorder.stroke);\n\n if (doOuterBorder) {\n const { distance = circleAttribute.outerBorder.distance } = outerBorder;\n const d = getScaledStroke(context, distance as number, context.dpr);\n const dw = d;\n context.beginPath();\n context.arc(x, y, radius + dw, startAngle, endAngle);\n context.closePath();\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(circle, circle.attribute, circleAttribute);\n\n if (strokeCb) {\n strokeCb(context, outerBorder, circleAttribute.outerBorder);\n } else if (doStrokeOuter) {\n // 存在stroke\n const lastOpacity = (circleAttribute.outerBorder as any).opacity;\n (circleAttribute.outerBorder as any).opacity = opacity;\n context.setStrokeStyle(\n circle,\n outerBorder,\n (originX - x) / scaleX,\n (originY - y) / scaleY,\n circleAttribute.outerBorder as any\n );\n (circleAttribute.outerBorder as any).opacity = lastOpacity;\n context.stroke();\n }\n }\n\n if (doInnerBorder) {\n const { distance = circleAttribute.innerBorder.distance } = innerBorder;\n const d = getScaledStroke(context, distance as number, context.dpr);\n const dw = d;\n\n context.beginPath();\n context.arc(x, y, radius - dw, startAngle, endAngle);\n context.closePath();\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(circle, circle.attribute, circleAttribute);\n\n if (strokeCb) {\n strokeCb(context, innerBorder, circleAttribute.innerBorder);\n } else if (doStrokeInner) {\n // 存在stroke\n const lastOpacity = (circleAttribute.innerBorder as any).opacity;\n (circleAttribute.innerBorder as any).opacity = opacity;\n context.setStrokeStyle(\n circle,\n innerBorder,\n (originX - x) / scaleX,\n (originY - y) / scaleY,\n circleAttribute.innerBorder as any\n );\n (circleAttribute.innerBorder as any).opacity = lastOpacity;\n context.stroke();\n }\n }\n }\n}\n\nexport const defaultCircleRenderContribution = new DefaultCircleRenderContribution();\nexport const defaultCircleTextureRenderContribution = defaultBaseTextureRenderContribution;\nexport const defaultCircleBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;\n"]}
|
|
@@ -3,7 +3,9 @@ import { DefaultBaseBackgroundRenderContribution } from "./base-contribution-ren
|
|
|
3
3
|
import { BaseRenderContributionTime } from "../../../../common/enums";
|
|
4
4
|
|
|
5
5
|
export class DefaultGroupBackgroundRenderContribution extends DefaultBaseBackgroundRenderContribution {
|
|
6
|
-
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments), this.time = BaseRenderContributionTime.beforeFillStroke;
|
|
8
|
+
}
|
|
7
9
|
drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
|
|
8
10
|
const {background: background, backgroundMode: backgroundMode = graphicAttribute.backgroundMode, backgroundFit: backgroundFit = graphicAttribute.backgroundFit} = graphic.attribute;
|
|
9
11
|
if (background) if (graphic.backgroundImg && graphic.resources) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/render/contributions/render/contributions/group-contribution-render.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,uCAAuC,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAEtE,MAAM,OAAO,wCACX,SAAQ,uCAAuC;
|
|
1
|
+
{"version":3,"sources":["../src/render/contributions/render/contributions/group-contribution-render.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,uCAAuC,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAEtE,MAAM,OAAO,wCACX,SAAQ,uCAAuC;IADjD;;QAIE,SAAI,GAA+B,0BAA0B,CAAC,gBAAgB,CAAC;IA6CjF,CAAC;IA3CC,SAAS,CACP,OAAe,EACf,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,MAAe,EACf,QAAiB,EACjB,QAAiB,EACjB,QAAiB,EACjB,gBAA6C,EAC7C,WAAyB,EACzB,MAAiH,EACjH,QAAmH;QAEnH,MAAM,EACJ,UAAU,EACV,cAAc,GAAG,gBAAgB,CAAC,cAAc,EAChD,aAAa,GAAG,gBAAgB,CAAC,aAAa,EAC/C,GAAG,OAAO,CAAC,SAAS,CAAC;QACtB,IAAI,CAAC,UAAU,EAAE;YACf,OAAO;SACR;QAED,IAAI,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,SAAS,EAAE;YAC9C,MAAM,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,UAAiB,CAAC,CAAC;YACrD,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE;gBACxC,OAAO;aACR;YAED,OAAO,CAAC,mBAAmB,EAAE,CAAC;YAE9B,OAAO,CAAC,sBAAsB,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;YACvE,MAAM,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;YAC7B,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,cAAc,EAAE,aAAa,CAAC,CAAC;YACtE,OAAO,CAAC,sBAAsB,EAAE,CAAC;YACjC,OAAO,CAAC,sBAAsB,EAAE,CAAC;SAClC;aAAM;YACL,OAAO,CAAC,mBAAmB,EAAE,CAAC;YAC9B,OAAO,CAAC,SAAS,GAAG,UAAoB,CAAC;YACzC,OAAO,CAAC,IAAI,EAAE,CAAC;YACf,OAAO,CAAC,sBAAsB,EAAE,CAAC;SAClC;IACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,wCAAwC,GAAG,IAAI,wCAAwC,EAAE,CAAC","file":"group-contribution-render.js","sourcesContent":["import type {\n IGraphicAttribute,\n IContext2d,\n IGroup,\n IThemeAttribute,\n IGroupRenderContribution,\n IDrawContext\n} from '../../../../interface';\nimport { DefaultBaseBackgroundRenderContribution } from './base-contribution-render';\nimport { BaseRenderContributionTime } from '../../../../common/enums';\n\nexport class DefaultGroupBackgroundRenderContribution\n extends DefaultBaseBackgroundRenderContribution\n implements IGroupRenderContribution\n{\n time: BaseRenderContributionTime = BaseRenderContributionTime.beforeFillStroke;\n\n drawShape(\n graphic: IGroup,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<IGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n strokeCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean\n ) {\n const {\n background,\n backgroundMode = graphicAttribute.backgroundMode,\n backgroundFit = graphicAttribute.backgroundFit\n } = graphic.attribute;\n if (!background) {\n return;\n }\n\n if (graphic.backgroundImg && graphic.resources) {\n const res = graphic.resources.get(background as any);\n if (res.state !== 'success' || !res.data) {\n return;\n }\n\n context.highPerformanceSave();\n\n context.setTransformFromMatrix(graphic.parent.globalTransMatrix, true);\n const b = graphic.AABBBounds;\n this.doDrawImage(context, res.data, b, backgroundMode, backgroundFit);\n context.highPerformanceRestore();\n context.setTransformForCurrent();\n } else {\n context.highPerformanceSave();\n context.fillStyle = background as string;\n context.fill();\n context.highPerformanceRestore();\n }\n }\n}\n\nexport const defaultGroupBackgroundRenderContribution = new DefaultGroupBackgroundRenderContribution();\n"]}
|
|
@@ -11,7 +11,9 @@ import { parsePadding } from "../../../../common/utils";
|
|
|
11
11
|
import { createRectPath } from "../../../../common/shape/rect";
|
|
12
12
|
|
|
13
13
|
export class DefaultImageBackgroundRenderContribution extends DefaultBaseBackgroundRenderContribution {
|
|
14
|
-
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments), this.time = BaseRenderContributionTime.beforeFillStroke;
|
|
16
|
+
}
|
|
15
17
|
drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
|
|
16
18
|
const {background: background, backgroundMode: backgroundMode = graphicAttribute.backgroundMode, backgroundFit: backgroundFit = graphicAttribute.backgroundFit} = graphic.attribute;
|
|
17
19
|
if (background) if (graphic.backgroundImg) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/render/contributions/render/contributions/image-contribution-render.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,uCAAuC,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,OAAO,wCACX,SAAQ,uCAAuC;
|
|
1
|
+
{"version":3,"sources":["../src/render/contributions/render/contributions/image-contribution-render.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,QAAQ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IAAI,aAAa,CAAC;QACnB,CAAC,IAAI,aAAa,CAAC;QACnB,KAAK,IAAI,aAAa,GAAG,CAAC,CAAC;QAC3B,MAAM,IAAI,aAAa,GAAG,CAAC,CAAC;KAC7B;SAAM;QACL,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC;QACtB,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC;QACtB,KAAK,IAAI,aAAa,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;QAC7C,MAAM,IAAI,aAAa,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;KAC/C;IAED,OAAO;QACL,CAAC;QACD,CAAC;QACD,KAAK;QACL,MAAM;KACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,wCAAwC,GAAG,IAAI,wCAAwC,EAAE,CAAC","file":"image-contribution-render.js","sourcesContent":["import type {\n IGraphicAttribute,\n IContext2d,\n IImage,\n IThemeAttribute,\n IImageRenderContribution,\n IDrawContext,\n IBackgroundConfig,\n IGraphic\n} from '../../../../interface';\nimport { getTheme } from '../../../../graphic';\nimport { DefaultBaseBackgroundRenderContribution } from './base-contribution-render';\nimport { BaseRenderContributionTime } from '../../../../common/enums';\nimport { isNumber, isObject } from '@visactor/vutils';\nimport { parsePadding } from '../../../../common/utils';\nimport { createRectPath } from '../../../../common/shape/rect';\n\nexport class DefaultImageBackgroundRenderContribution\n extends DefaultBaseBackgroundRenderContribution\n implements IImageRenderContribution\n{\n time: BaseRenderContributionTime = BaseRenderContributionTime.beforeFillStroke;\n\n drawShape(\n graphic: IImage,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<IGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n strokeCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean\n ) {\n const {\n background,\n backgroundMode = graphicAttribute.backgroundMode,\n backgroundFit = graphicAttribute.backgroundFit\n } = graphic.attribute;\n if (!background) {\n return;\n }\n\n if (!graphic.backgroundImg) {\n if (isObject(background)) {\n const {\n stroke,\n fill,\n lineWidth = 1,\n cornerRadius = 0,\n expandX = 0,\n expandY = 0\n } = background as IBackgroundConfig;\n\n if (!stroke && !fill) {\n return;\n }\n\n context.beginPath();\n const { x, y, width, height } = getActualPosition(graphic);\n if (cornerRadius) {\n createRectPath(context, x - expandX, y - expandY, width + expandX * 2, height + expandY * 2, cornerRadius);\n } else {\n context.rect(x - expandX, y - expandY, width + expandX * 2, height + expandY * 2);\n }\n\n context.globalAlpha = 1;\n if (fill) {\n context.fillStyle = fill as string;\n context.fill();\n }\n\n if (stroke && lineWidth > 0) {\n context.lineWidth = lineWidth;\n context.strokeStyle = stroke as string;\n context.stroke();\n }\n } else {\n context.beginPath();\n const b = graphic.AABBBounds;\n context.rect(x, y, b.width(), b.height());\n context.fillStyle = background as string;\n context.globalAlpha = 1;\n context.fill();\n }\n } else {\n const res = graphic.resources.get(background as any);\n if (res.state !== 'success' || !res.data) {\n return;\n }\n context.save();\n if (graphic.parent && !graphic.transMatrix.onlyTranslate()) {\n const groupAttribute = getTheme(graphic.parent).group;\n const { scrollX = groupAttribute.scrollX, scrollY = groupAttribute.scrollY } = graphic.parent.attribute;\n context.setTransformFromMatrix(graphic.parent.globalTransMatrix, true);\n context.translate(scrollX, scrollY);\n }\n // context.clip();\n const b = graphic.AABBBounds;\n this.doDrawImage(context, res.data, b, backgroundMode, backgroundFit);\n context.restore();\n if (!graphic.transMatrix.onlyTranslate()) {\n context.setTransformForCurrent();\n }\n }\n }\n}\n\nfunction getActualPosition(graphic: IGraphic) {\n const boundsPadding = parsePadding(graphic.attribute.boundsPadding);\n const bounds = graphic.AABBBounds;\n let x = bounds.x1;\n let y = bounds.y1;\n let width = bounds.width();\n let height = bounds.height();\n\n if (isNumber(boundsPadding)) {\n x += boundsPadding;\n y += boundsPadding;\n width -= boundsPadding * 2;\n height -= boundsPadding * 2;\n } else {\n x += boundsPadding[3];\n y += boundsPadding[0];\n width -= boundsPadding[1] + boundsPadding[3];\n height -= boundsPadding[0] + boundsPadding[2];\n }\n\n return {\n x,\n y,\n width,\n height\n };\n}\n\nexport const defaultImageBackgroundRenderContribution = new DefaultImageBackgroundRenderContribution();\n"]}
|
|
@@ -19,15 +19,15 @@ import { BaseRenderContributionTime } from "../../../../common/enums";
|
|
|
19
19
|
import { defaultBaseTextureRenderContribution } from "./base-texture-contribution-render";
|
|
20
20
|
|
|
21
21
|
export class DefaultRectRenderContribution {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
constructor() {
|
|
23
|
+
this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
|
|
24
|
+
}
|
|
25
25
|
drawShape(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb) {
|
|
26
26
|
const {outerBorder: outerBorder, innerBorder: innerBorder} = rect.attribute, doOuterBorder = outerBorder && !1 !== outerBorder.visible, doInnerBorder = innerBorder && !1 !== innerBorder.visible;
|
|
27
27
|
if (!doOuterBorder && !doInnerBorder) return;
|
|
28
28
|
const {cornerRadius: cornerRadius = rectAttribute.cornerRadius, opacity: opacity = rectAttribute.opacity, x: originX = rectAttribute.x, y: originY = rectAttribute.y, scaleX: scaleX = rectAttribute.scaleX, scaleY: scaleY = rectAttribute.scaleY, x1: x1, y1: y1} = rect.attribute;
|
|
29
29
|
let {width: width, height: height} = rect.attribute;
|
|
30
|
-
width = (width
|
|
30
|
+
width = (null != width ? width : x1 - x) || 0, height = (null != height ? height : y1 - y) || 0;
|
|
31
31
|
const doStrokeOuter = !(!outerBorder || !outerBorder.stroke), doStrokeInner = !(!innerBorder || !innerBorder.stroke);
|
|
32
32
|
if (doOuterBorder) {
|
|
33
33
|
const {distance: distance = rectAttribute.outerBorder.distance} = outerBorder, d = getScaledStroke(context, distance, context.dpr), nextX = x - d, nextY = y - d, dw = 2 * d;
|
|
@@ -55,9 +55,9 @@ export class DefaultRectRenderContribution {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
let SplitRectBeforeRenderContribution = class {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
constructor() {
|
|
59
|
+
this.time = BaseRenderContributionTime.beforeFillStroke, this.useStyle = !0, this.order = 0;
|
|
60
|
+
}
|
|
61
61
|
drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb, doFillOrStroke) {
|
|
62
62
|
const {stroke: stroke = groupAttribute.stroke} = group.attribute;
|
|
63
63
|
Array.isArray(stroke) && stroke.some((s => !1 === s)) && (doFillOrStroke.doStroke = !1);
|
|
@@ -69,13 +69,13 @@ SplitRectBeforeRenderContribution = __decorate([ injectable() ], SplitRectBefore
|
|
|
69
69
|
export { SplitRectBeforeRenderContribution };
|
|
70
70
|
|
|
71
71
|
let SplitRectAfterRenderContribution = class {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
constructor() {
|
|
73
|
+
this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
|
|
74
|
+
}
|
|
75
75
|
drawShape(rect, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb) {
|
|
76
76
|
const {x1: x1, y1: y1, x: originX = groupAttribute.x, y: originY = groupAttribute.y, stroke: stroke = groupAttribute.stroke} = rect.attribute;
|
|
77
77
|
let {width: width, height: height} = rect.attribute;
|
|
78
|
-
if (width = (width
|
|
78
|
+
if (width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0,
|
|
79
79
|
Array.isArray(stroke) && stroke.some((s => !1 === s))) {
|
|
80
80
|
if (context.setStrokeStyle(rect, rect.attribute, x, y, groupAttribute), context.beginPath(),
|
|
81
81
|
context.moveTo(x, y), stroke[0] ? context.lineTo(x + width, y) : context.moveTo(x + width, y),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/render/contributions/render/contributions/rect-contribution-render.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAW/D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,uCAAuC,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,oCAAoC,EAAE,MAAM,oCAAoC,CAAC;AAE1F,MAAM,OAAO,6BAA6B;IACxC,IAAI,GAA+B,0BAA0B,CAAC,eAAe,CAAC;IAC9E,QAAQ,GAAY,IAAI,CAAC;IACzB,KAAK,GAAW,CAAC,CAAC;IAClB,SAAS,CACP,IAAW,EACX,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,MAAe,EACf,QAAiB,EACjB,QAAiB,EACjB,QAAiB,EACjB,aAA8C,EAC9C,WAAyB,EACzB,MAIY,EACZ,QAIY;QAEZ,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;QACpD,MAAM,aAAa,GAAG,WAAW,IAAI,WAAW,CAAC,OAAO,KAAK,KAAK,CAAC;QACnE,MAAM,aAAa,GAAG,WAAW,IAAI,WAAW,CAAC,OAAO,KAAK,KAAK,CAAC;QACnE,IAAI,CAAC,CAAC,aAAa,IAAI,aAAa,CAAC,EAAE;YACrC,OAAO;SACR;QACD,MAAM,EACJ,YAAY,GAAG,aAAa,CAAC,YAAY,EACzC,OAAO,GAAG,aAAa,CAAC,OAAO,EAC/B,CAAC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AC,GAAG,OAAO,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC1D,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;SAC5B;aAAM;YACL,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACtB;QAED,OAAO,CAAC,MAAM,EAAE,CAAC;IACnB,CAAC;CACF,CAAA;AA5EY,gCAAgC;IAD5C,UAAU,EAAE;GACA,gCAAgC,CA4E5C;SA5EY,gCAAgC;AA8E7C,MAAM,CAAC,MAAM,6BAA6B,GAAG,IAAI,6BAA6B,EAAE,CAAC;AAGjF,MAAM,CAAC,MAAM,oCAAoC,GAAG,oCAAoC,CAAC;AACzF,MAAM,CAAC,MAAM,uCAAuC,GAAG,uCAAuC,CAAC","file":"rect-contribution-render.js","sourcesContent":["import { isArray } from '@visactor/vutils';\nimport { injectable } from '../../../../common/inversify-lite';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n IRect,\n IRectGraphicAttribute,\n IThemeAttribute,\n IRectRenderContribution,\n IDrawContext\n} from '../../../../interface';\nimport { getScaledStroke } from '../../../../common/canvas-utils';\nimport { defaultBaseBackgroundRenderContribution } from './base-contribution-render';\nimport { createRectPath } from '../../../../common/shape/rect';\nimport { BaseRenderContributionTime } from '../../../../common/enums';\nimport { defaultBaseTextureRenderContribution } from './base-texture-contribution-render';\n\nexport class DefaultRectRenderContribution implements IRectRenderContribution {\n time: BaseRenderContributionTime = BaseRenderContributionTime.afterFillStroke;\n useStyle: boolean = true;\n order: number = 0;\n drawShape(\n rect: IRect,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n rectAttribute: Required<IRectGraphicAttribute>,\n drawContext: IDrawContext,\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 { outerBorder, innerBorder } = rect.attribute;\n const doOuterBorder = outerBorder && outerBorder.visible !== false;\n const doInnerBorder = innerBorder && innerBorder.visible !== false;\n if (!(doOuterBorder || doInnerBorder)) {\n return;\n }\n const {\n cornerRadius = rectAttribute.cornerRadius,\n opacity = rectAttribute.opacity,\n x: originX = rectAttribute.x,\n y: originY = rectAttribute.y,\n scaleX = rectAttribute.scaleX,\n scaleY = rectAttribute.scaleY,\n x1,\n y1\n } = rect.attribute;\n\n let { width, height } = rect.attribute;\n\n width = (width ?? x1 - x) || 0;\n height = (height ?? y1 - y) || 0;\n\n const doStrokeOuter = !!(outerBorder && outerBorder.stroke);\n const doStrokeInner = !!(innerBorder && innerBorder.stroke);\n\n if (doOuterBorder) {\n const { distance = rectAttribute.outerBorder.distance } = outerBorder;\n const d = getScaledStroke(context, distance as number, context.dpr);\n const nextX = x - d;\n const nextY = y - d;\n const dw = d * 2;\n if (cornerRadius === 0 || (isArray(cornerRadius) && (<number[]>cornerRadius).every(num => num === 0))) {\n // 不需要处理圆角\n context.beginPath();\n context.rect(nextX, nextY, width + dw, height + dw);\n } else {\n context.beginPath();\n\n // 测试后,cache对于重绘性能提升不大,但是在首屏有一定性能损耗,因此rect不再使用cache\n createRectPath(context, nextX, nextY, width + dw, height + dw, cornerRadius);\n }\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute);\n\n if (strokeCb) {\n strokeCb(context, outerBorder, rectAttribute.outerBorder);\n } else if (doStrokeOuter) {\n // 存在stroke\n const lastOpacity = (rectAttribute.outerBorder as any).opacity;\n (rectAttribute.outerBorder as any).opacity = opacity;\n context.setStrokeStyle(\n rect,\n outerBorder,\n (originX - x) / scaleX,\n (originY - y) / scaleY,\n rectAttribute.outerBorder as any\n );\n (rectAttribute.outerBorder as any).opacity = lastOpacity;\n context.stroke();\n }\n }\n\n if (doInnerBorder) {\n const { distance = rectAttribute.innerBorder.distance } = innerBorder;\n const d = getScaledStroke(context, distance as number, context.dpr);\n const nextX = x + d;\n const nextY = y + d;\n const dw = d * 2;\n if (cornerRadius === 0 || (isArray(cornerRadius) && (<number[]>cornerRadius).every(num => num === 0))) {\n // 不需要处理圆角\n context.beginPath();\n context.rect(nextX, nextY, width - dw, height - dw);\n } else {\n context.beginPath();\n\n // 测试后,cache对于重绘性能提升不大,但是在首屏有一定性能损耗,因此rect不再使用cache\n createRectPath(context, nextX, nextY, width - dw, height - dw, cornerRadius);\n }\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute);\n\n if (strokeCb) {\n strokeCb(context, innerBorder, rectAttribute.innerBorder);\n } else if (doStrokeInner) {\n // 存在stroke\n const lastOpacity = (rectAttribute.innerBorder as any).opacity;\n (rectAttribute.innerBorder as any).opacity = opacity;\n context.setStrokeStyle(\n rect,\n innerBorder,\n (originX - x) / scaleX,\n (originY - y) / scaleY,\n rectAttribute.innerBorder as any\n );\n (rectAttribute.innerBorder as any).opacity = lastOpacity;\n context.stroke();\n }\n }\n }\n}\n\n@injectable()\nexport class SplitRectBeforeRenderContribution implements IRectRenderContribution {\n time: BaseRenderContributionTime = BaseRenderContributionTime.beforeFillStroke;\n useStyle: boolean = true;\n order: number = 0;\n drawShape(\n group: IRect,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n groupAttribute: Required<IRectGraphicAttribute>,\n drawContext: IDrawContext,\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 doFillOrStroke?: { doFill: boolean; doStroke: boolean }\n ) {\n const { stroke = groupAttribute.stroke } = group.attribute as any;\n\n // 数组且存在为false的项目,那就不绘制\n if (Array.isArray(stroke) && stroke.some(s => s === false)) {\n doFillOrStroke.doStroke = false;\n }\n }\n}\n\n@injectable()\nexport class SplitRectAfterRenderContribution implements IRectRenderContribution {\n time: BaseRenderContributionTime = BaseRenderContributionTime.afterFillStroke;\n useStyle: boolean = true;\n order: number = 0;\n drawShape(\n rect: IRect,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n groupAttribute: Required<IRectGraphicAttribute>,\n drawContext: IDrawContext,\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 {\n x1,\n y1,\n x: originX = groupAttribute.x,\n y: originY = groupAttribute.y,\n stroke = groupAttribute.stroke\n } = rect.attribute as any;\n\n let { width, height } = rect.attribute;\n width = (width ?? x1 - originX) || 0;\n height = (height ?? y1 - originY) || 0;\n\n // 不是数组\n if (!(Array.isArray(stroke) && stroke.some(s => s === false))) {\n return;\n }\n\n context.setStrokeStyle(rect, rect.attribute, x, y, groupAttribute);\n // 单独处理每条边界,目前不考虑圆角\n context.beginPath();\n context.moveTo(x, y);\n // top\n if (stroke[0]) {\n context.lineTo(x + width, y);\n } else {\n context.moveTo(x + width, y);\n }\n // right\n if (stroke[1]) {\n context.lineTo(x + width, y + height);\n } else {\n context.moveTo(x + width, y + height);\n }\n // bottom\n if (stroke[2]) {\n context.lineTo(x, y + height);\n } else {\n context.moveTo(x, y + height);\n }\n // left\n if (stroke[3]) {\n // 没有close path是,起点和终点不连续,需要调整y保证不出现缺口\n const adjustY = stroke[0] ? y - context.lineWidth / 2 : y;\n context.lineTo(x, adjustY);\n } else {\n context.moveTo(x, y);\n }\n\n context.stroke();\n }\n}\n\nexport const defaultRectRenderContribution = new DefaultRectRenderContribution();\n// export const splitRectBeforeRenderContribution = new SplitRectBeforeRenderContribution();\n// export const splitRectAfterRenderContribution = new SplitRectAfterRenderContribution();\nexport const defaultRectTextureRenderContribution = defaultBaseTextureRenderContribution;\nexport const defaultRectBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/render/contributions/render/contributions/rect-contribution-render.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAW/D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,uCAAuC,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,oCAAoC,EAAE,MAAM,oCAAoC,CAAC;AAE1F,MAAM,OAAO,6BAA6B;IAA1C;QACE,SAAI,GAA+B,0BAA0B,CAAC,eAAe,CAAC;QAC9E,aAAQ,GAAY,IAAI,CAAC;QACzB,UAAK,GAAW,CAAC,CAAC;IA4HpB,CAAC;IA3HC,SAAS,CACP,IAAW,EACX,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,MAAe,EACf,QAAiB,EACjB,QAAiB,EACjB,QAAiB,EACjB,aAA8C,EAC9C,WAAyB,EACzB,MAIY,EACZ,QAIY;QAEZ,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;QACpD,MAAM,aAAa,GAAG,WAAW,IAAI,WAAW,CAAC,OAAO,KAAK,KAAK,CAAC;QACnE,MAAM,aAAa,GAAG,WAAW,IAAI,WAAW,CAAC,OAA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AAC;SACvC;QAED,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE;YACb,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC;SAC/B;aAAM;YACL,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC;SAC/B;QAED,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE;YAEb,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC1D,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;SAC5B;aAAM;YACL,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACtB;QAED,OAAO,CAAC,MAAM,EAAE,CAAC;IACnB,CAAC;CACF,CAAA;AA5EY,gCAAgC;IAD5C,UAAU,EAAE;GACA,gCAAgC,CA4E5C;SA5EY,gCAAgC;AA8E7C,MAAM,CAAC,MAAM,6BAA6B,GAAG,IAAI,6BAA6B,EAAE,CAAC;AAGjF,MAAM,CAAC,MAAM,oCAAoC,GAAG,oCAAoC,CAAC;AACzF,MAAM,CAAC,MAAM,uCAAuC,GAAG,uCAAuC,CAAC","file":"rect-contribution-render.js","sourcesContent":["import { isArray } from '@visactor/vutils';\nimport { injectable } from '../../../../common/inversify-lite';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n IRect,\n IRectGraphicAttribute,\n IThemeAttribute,\n IRectRenderContribution,\n IDrawContext\n} from '../../../../interface';\nimport { getScaledStroke } from '../../../../common/canvas-utils';\nimport { defaultBaseBackgroundRenderContribution } from './base-contribution-render';\nimport { createRectPath } from '../../../../common/shape/rect';\nimport { BaseRenderContributionTime } from '../../../../common/enums';\nimport { defaultBaseTextureRenderContribution } from './base-texture-contribution-render';\n\nexport class DefaultRectRenderContribution implements IRectRenderContribution {\n time: BaseRenderContributionTime = BaseRenderContributionTime.afterFillStroke;\n useStyle: boolean = true;\n order: number = 0;\n drawShape(\n rect: IRect,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n rectAttribute: Required<IRectGraphicAttribute>,\n drawContext: IDrawContext,\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 { outerBorder, innerBorder } = rect.attribute;\n const doOuterBorder = outerBorder && outerBorder.visible !== false;\n const doInnerBorder = innerBorder && innerBorder.visible !== false;\n if (!(doOuterBorder || doInnerBorder)) {\n return;\n }\n const {\n cornerRadius = rectAttribute.cornerRadius,\n opacity = rectAttribute.opacity,\n x: originX = rectAttribute.x,\n y: originY = rectAttribute.y,\n scaleX = rectAttribute.scaleX,\n scaleY = rectAttribute.scaleY,\n x1,\n y1\n } = rect.attribute;\n\n let { width, height } = rect.attribute;\n\n width = (width ?? x1 - x) || 0;\n height = (height ?? y1 - y) || 0;\n\n const doStrokeOuter = !!(outerBorder && outerBorder.stroke);\n const doStrokeInner = !!(innerBorder && innerBorder.stroke);\n\n if (doOuterBorder) {\n const { distance = rectAttribute.outerBorder.distance } = outerBorder;\n const d = getScaledStroke(context, distance as number, context.dpr);\n const nextX = x - d;\n const nextY = y - d;\n const dw = d * 2;\n if (cornerRadius === 0 || (isArray(cornerRadius) && (<number[]>cornerRadius).every(num => num === 0))) {\n // 不需要处理圆角\n context.beginPath();\n context.rect(nextX, nextY, width + dw, height + dw);\n } else {\n context.beginPath();\n\n // 测试后,cache对于重绘性能提升不大,但是在首屏有一定性能损耗,因此rect不再使用cache\n createRectPath(context, nextX, nextY, width + dw, height + dw, cornerRadius);\n }\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute);\n\n if (strokeCb) {\n strokeCb(context, outerBorder, rectAttribute.outerBorder);\n } else if (doStrokeOuter) {\n // 存在stroke\n const lastOpacity = (rectAttribute.outerBorder as any).opacity;\n (rectAttribute.outerBorder as any).opacity = opacity;\n context.setStrokeStyle(\n rect,\n outerBorder,\n (originX - x) / scaleX,\n (originY - y) / scaleY,\n rectAttribute.outerBorder as any\n );\n (rectAttribute.outerBorder as any).opacity = lastOpacity;\n context.stroke();\n }\n }\n\n if (doInnerBorder) {\n const { distance = rectAttribute.innerBorder.distance } = innerBorder;\n const d = getScaledStroke(context, distance as number, context.dpr);\n const nextX = x + d;\n const nextY = y + d;\n const dw = d * 2;\n if (cornerRadius === 0 || (isArray(cornerRadius) && (<number[]>cornerRadius).every(num => num === 0))) {\n // 不需要处理圆角\n context.beginPath();\n context.rect(nextX, nextY, width - dw, height - dw);\n } else {\n context.beginPath();\n\n // 测试后,cache对于重绘性能提升不大,但是在首屏有一定性能损耗,因此rect不再使用cache\n createRectPath(context, nextX, nextY, width - dw, height - dw, cornerRadius);\n }\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute);\n\n if (strokeCb) {\n strokeCb(context, innerBorder, rectAttribute.innerBorder);\n } else if (doStrokeInner) {\n // 存在stroke\n const lastOpacity = (rectAttribute.innerBorder as any).opacity;\n (rectAttribute.innerBorder as any).opacity = opacity;\n context.setStrokeStyle(\n rect,\n innerBorder,\n (originX - x) / scaleX,\n (originY - y) / scaleY,\n rectAttribute.innerBorder as any\n );\n (rectAttribute.innerBorder as any).opacity = lastOpacity;\n context.stroke();\n }\n }\n }\n}\n\n@injectable()\nexport class SplitRectBeforeRenderContribution implements IRectRenderContribution {\n time: BaseRenderContributionTime = BaseRenderContributionTime.beforeFillStroke;\n useStyle: boolean = true;\n order: number = 0;\n drawShape(\n group: IRect,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n groupAttribute: Required<IRectGraphicAttribute>,\n drawContext: IDrawContext,\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 doFillOrStroke?: { doFill: boolean; doStroke: boolean }\n ) {\n const { stroke = groupAttribute.stroke } = group.attribute as any;\n\n // 数组且存在为false的项目,那就不绘制\n if (Array.isArray(stroke) && stroke.some(s => s === false)) {\n doFillOrStroke.doStroke = false;\n }\n }\n}\n\n@injectable()\nexport class SplitRectAfterRenderContribution implements IRectRenderContribution {\n time: BaseRenderContributionTime = BaseRenderContributionTime.afterFillStroke;\n useStyle: boolean = true;\n order: number = 0;\n drawShape(\n rect: IRect,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n groupAttribute: Required<IRectGraphicAttribute>,\n drawContext: IDrawContext,\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 {\n x1,\n y1,\n x: originX = groupAttribute.x,\n y: originY = groupAttribute.y,\n stroke = groupAttribute.stroke\n } = rect.attribute as any;\n\n let { width, height } = rect.attribute;\n width = (width ?? x1 - originX) || 0;\n height = (height ?? y1 - originY) || 0;\n\n // 不是数组\n if (!(Array.isArray(stroke) && stroke.some(s => s === false))) {\n return;\n }\n\n context.setStrokeStyle(rect, rect.attribute, x, y, groupAttribute);\n // 单独处理每条边界,目前不考虑圆角\n context.beginPath();\n context.moveTo(x, y);\n // top\n if (stroke[0]) {\n context.lineTo(x + width, y);\n } else {\n context.moveTo(x + width, y);\n }\n // right\n if (stroke[1]) {\n context.lineTo(x + width, y + height);\n } else {\n context.moveTo(x + width, y + height);\n }\n // bottom\n if (stroke[2]) {\n context.lineTo(x, y + height);\n } else {\n context.moveTo(x, y + height);\n }\n // left\n if (stroke[3]) {\n // 没有close path是,起点和终点不连续,需要调整y保证不出现缺口\n const adjustY = stroke[0] ? y - context.lineWidth / 2 : y;\n context.lineTo(x, adjustY);\n } else {\n context.moveTo(x, y);\n }\n\n context.stroke();\n }\n}\n\nexport const defaultRectRenderContribution = new DefaultRectRenderContribution();\n// export const splitRectBeforeRenderContribution = new SplitRectBeforeRenderContribution();\n// export const splitRectAfterRenderContribution = new SplitRectAfterRenderContribution();\nexport const defaultRectTextureRenderContribution = defaultBaseTextureRenderContribution;\nexport const defaultRectBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;\n"]}
|
|
@@ -7,9 +7,9 @@ import { BaseRenderContributionTime } from "../../../../common/enums";
|
|
|
7
7
|
import { defaultBaseTextureRenderContribution } from "./base-texture-contribution-render";
|
|
8
8
|
|
|
9
9
|
export class DefaultSymbolRenderContribution {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
constructor() {
|
|
11
|
+
this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
|
|
12
|
+
}
|
|
13
13
|
drawShape(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb) {
|
|
14
14
|
const parsedPath = symbol.getParsedPath();
|
|
15
15
|
if (!parsedPath) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/render/contributions/render/contributions/symbol-contribution-render.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,uCAAuC,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,oCAAoC,EAAE,MAAM,oCAAoC,CAAC;AAE1F,MAAM,OAAO,+BAA+B;
|
|
1
|
+
{"version":3,"sources":["../src/render/contributions/render/contributions/symbol-contribution-render.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,uCAAuC,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,oCAAoC,EAAE,MAAM,oCAAoC,CAAC;AAE1F,MAAM,OAAO,+BAA+B;IAA5C;QACE,SAAI,GAA+B,0BAA0B,CAAC,eAAe,CAAC;QAC9E,aAAQ,GAAY,IAAI,CAAC;QACzB,UAAK,GAAW,CAAC,CAAC;IA4GpB,CAAC;IA3GC,SAAS,CACP,MAAe,EACf,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,MAAe,EACf,QAAiB,EACjB,QAAiB,EACjB,QAAiB,EACjB,eAAkD,EAClD,WAAyB,EACzB,MAIY,EACZ,QAIY;QAEZ,MAAM,UAAU,GAAG,MAAM,CAAC,aAAa,EAAE,CAAC;QAE1C,IAAI,CAAC,UAAU,EAAE;YACf,OAAO;SACR;QAED,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC;QACtD,MAAM,aAAa,GAAG,WAAW,IAAI,WAAW,CAAC,OAAO,KAAK,KAAK,CAAC;QACnE,MAAM,aAAa,GAAG,WAAW,IAAI,WAAW,CAAC,OAAO,KAAK,KAAK,CAAC;QACnE,IAAI,CAAC,CAAC,aAAa,IAAI,aAAa,CAAC,EAAE;YACrC,OAAO;SACR;QAED,MAAM,EACJ,IAAI,GAAG,eAAe,CAAC,IAAI,EAC3B,OAAO,GAAG,eAAe,CAAC,OAAO,EACjC,CAAC,EAAE,OAAO,GAA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;CACF;AAED,MAAM,CAAC,MAAM,+BAA+B,GAAG,IAAI,+BAA+B,EAAE,CAAC;AACrF,MAAM,CAAC,MAAM,sCAAsC,GAAG,oCAAoC,CAAC;AAC3F,MAAM,CAAC,MAAM,yCAAyC,GAAG,uCAAuC,CAAC","file":"symbol-contribution-render.js","sourcesContent":["import type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n ISymbol,\n ISymbolGraphicAttribute,\n IThemeAttribute,\n ISymbolRenderContribution,\n IDrawContext\n} from '../../../../interface';\nimport { getScaledStroke } from '../../../../common/canvas-utils';\nimport { defaultBaseBackgroundRenderContribution } from './base-contribution-render';\nimport { BaseRenderContributionTime } from '../../../../common/enums';\nimport { defaultBaseTextureRenderContribution } from './base-texture-contribution-render';\n\nexport class DefaultSymbolRenderContribution implements ISymbolRenderContribution {\n time: BaseRenderContributionTime = BaseRenderContributionTime.afterFillStroke;\n useStyle: boolean = true;\n order: number = 0;\n drawShape(\n symbol: ISymbol,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n symbolAttribute: Required<ISymbolGraphicAttribute>,\n drawContext: IDrawContext,\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 parsedPath = symbol.getParsedPath();\n // todo: 考虑使用path\n if (!parsedPath) {\n return;\n }\n\n const { outerBorder, innerBorder } = symbol.attribute;\n const doOuterBorder = outerBorder && outerBorder.visible !== false;\n const doInnerBorder = innerBorder && innerBorder.visible !== false;\n if (!(doOuterBorder || doInnerBorder)) {\n return;\n }\n\n const {\n size = symbolAttribute.size,\n opacity = symbolAttribute.opacity,\n x: originX = symbolAttribute.x,\n y: originY = symbolAttribute.y,\n scaleX = symbolAttribute.scaleX,\n scaleY = symbolAttribute.scaleY\n } = symbol.attribute;\n\n const doStrokeOuter = !!(outerBorder && outerBorder.stroke);\n const doStrokeInner = !!(innerBorder && innerBorder.stroke);\n\n if (doOuterBorder) {\n const { distance = symbolAttribute.outerBorder.distance } = outerBorder;\n const d = getScaledStroke(context, distance as number, context.dpr);\n\n context.beginPath();\n if (parsedPath.drawOffset(context, size, x, y, d) === false) {\n context.closePath();\n }\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute);\n\n if (strokeCb) {\n strokeCb(context, outerBorder, symbolAttribute.outerBorder);\n } else if (doStrokeOuter) {\n // 存在stroke\n const lastOpacity = (symbolAttribute.outerBorder as any).opacity;\n (symbolAttribute.outerBorder as any).opacity = opacity;\n context.setStrokeStyle(\n symbol,\n outerBorder,\n (originX - x) / scaleX,\n (originY - y) / scaleY,\n symbolAttribute.outerBorder as any\n );\n (symbolAttribute.outerBorder as any).opacity = lastOpacity;\n context.stroke();\n }\n }\n\n if (doInnerBorder) {\n const { distance = symbolAttribute.innerBorder.distance } = innerBorder;\n const d = getScaledStroke(context, distance as number, context.dpr);\n\n context.beginPath();\n if (parsedPath.drawOffset(context, size, x, y, -d) === false) {\n context.closePath();\n }\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute);\n\n if (strokeCb) {\n strokeCb(context, innerBorder, symbolAttribute.innerBorder);\n } else if (doStrokeInner) {\n // 存在stroke\n const lastOpacity = (symbolAttribute.innerBorder as any).opacity;\n (symbolAttribute.innerBorder as any).opacity = opacity;\n context.setStrokeStyle(\n symbol,\n innerBorder,\n (originX - x) / scaleX,\n (originY - y) / scaleY,\n symbolAttribute.innerBorder as any\n );\n (symbolAttribute.innerBorder as any).opacity = lastOpacity;\n context.stroke();\n }\n }\n }\n}\n\nexport const defaultSymbolRenderContribution = new DefaultSymbolRenderContribution();\nexport const defaultSymbolTextureRenderContribution = defaultBaseTextureRenderContribution;\nexport const defaultSymbolBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;\n"]}
|
|
@@ -11,8 +11,11 @@ import { getTextBounds } from "../../../../graphic";
|
|
|
11
11
|
import { createRectPath } from "../../../../common/shape/rect";
|
|
12
12
|
|
|
13
13
|
export class DefaultTextBackgroundRenderContribution extends DefaultBaseBackgroundRenderContribution {
|
|
14
|
-
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments), this.time = BaseRenderContributionTime.beforeFillStroke;
|
|
16
|
+
}
|
|
15
17
|
drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
|
|
18
|
+
var _a, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
16
19
|
const {backgroundMode: backgroundMode = graphicAttribute.backgroundMode, backgroundFit: backgroundFit = graphicAttribute.backgroundFit} = graphic.attribute;
|
|
17
20
|
let matrix, {background: background} = graphic.attribute;
|
|
18
21
|
if (!background) return;
|
|
@@ -24,14 +27,13 @@ export class DefaultTextBackgroundRenderContribution extends DefaultBaseBackgrou
|
|
|
24
27
|
context.save(), context.setTransformForCurrent());
|
|
25
28
|
const shouldReCalBounds = isObject(background) && background.background, onlyTranslate = graphic.transMatrix.onlyTranslate();
|
|
26
29
|
if (shouldReCalBounds) {
|
|
27
|
-
const _b = graphic.AABBBounds, x = (background.x
|
|
30
|
+
const _b = graphic.AABBBounds, x = (null !== (_a = background.x) && void 0 !== _a ? _a : _b.x1) + (null !== (_c = background.dx) && void 0 !== _c ? _c : 0), y = (null !== (_d = background.y) && void 0 !== _d ? _d : _b.y1) + (null !== (_e = background.dy) && void 0 !== _e ? _e : 0), w = null !== (_f = background.width) && void 0 !== _f ? _f : _b.width(), h = null !== (_g = background.height) && void 0 !== _g ? _g : _b.height();
|
|
28
31
|
if (b = boundsAllocate.allocate(x, y, x + w, y + h), background = background.background,
|
|
29
32
|
!onlyTranslate) {
|
|
30
33
|
const w = b.width(), h = b.height();
|
|
31
|
-
b.set((background.x
|
|
34
|
+
b.set((null !== (_h = background.x) && void 0 !== _h ? _h : 0) + (null !== (_j = background.dx) && void 0 !== _j ? _j : 0), (null !== (_k = background.y) && void 0 !== _k ? _k : 0) + (null !== (_l = background.dy) && void 0 !== _l ? _l : 0), w, h);
|
|
32
35
|
}
|
|
33
|
-
} else b = graphic.AABBBounds, onlyTranslate || (b = getTextBounds({
|
|
34
|
-
...graphic.attribute,
|
|
36
|
+
} else b = graphic.AABBBounds, onlyTranslate || (b = getTextBounds(Object.assign(Object.assign({}, graphic.attribute), {
|
|
35
37
|
angle: 0,
|
|
36
38
|
scaleX: 1,
|
|
37
39
|
scaleY: 1,
|
|
@@ -39,7 +41,7 @@ export class DefaultTextBackgroundRenderContribution extends DefaultBaseBackgrou
|
|
|
39
41
|
y: 0,
|
|
40
42
|
dx: 0,
|
|
41
43
|
dy: 0
|
|
42
|
-
}).clone());
|
|
44
|
+
})).clone());
|
|
43
45
|
if (graphic.backgroundImg && graphic.resources) {
|
|
44
46
|
const res = graphic.resources.get(background);
|
|
45
47
|
if ("success" !== res.state || !res.data) return void restore();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/render/contributions/render/contributions/text-contribution-render.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAStE,OAAO,EAAE,uCAAuC,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,OAAO,uCACX,SAAQ,uCAAuC;
|
|
1
|
+
{"version":3,"sources":["../src/render/contributions/render/contributions/text-contribution-render.ts"],"names":[],"mappings":"AACA,OAAO,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Ac,EAAE,aAAa,CAAC,CAAC;YACtE,OAAO,CAAC,sBAAsB,EAAE,CAAC;YACjC,OAAO,CAAC,sBAAsB,EAAE,CAAC;SAClC;aAAM;YACL,MAAM,EAAE,sBAAsB,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC;YACrD,OAAO,CAAC,mBAAmB,EAAE,CAAC;YAC9B,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,gBAAgB,CAAC,CAAC;YAC3E,OAAO,CAAC,SAAS,GAAG,UAAoB,CAAC;YACzC,IAAI,sBAAsB,EAAE;gBAE1B,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,sBAAsB,CAAC,CAAC;gBACnF,OAAO,CAAC,IAAI,EAAE,CAAC;aAChB;iBAAM;gBACL,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;aACrD;YACD,OAAO,CAAC,sBAAsB,EAAE,CAAC;SAClC;QAED,IAAI,iBAAiB,EAAE;YACrB,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACxB;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAED,MAAM,CAAC,MAAM,uCAAuC,GAAG,IAAI,uCAAuC,EAAE,CAAC","file":"text-contribution-render.js","sourcesContent":["import type { IAABBBounds, IMatrix, IMatrixLike } from '@visactor/vutils';\nimport { isObject } from '@visactor/vutils';\nimport { BaseRenderContributionTime } from '../../../../common/enums';\nimport type {\n IContext2d,\n IDrawContext,\n IGraphicAttribute,\n IText,\n ITextRenderContribution,\n IThemeAttribute\n} from '../../../../interface';\nimport { DefaultBaseBackgroundRenderContribution } from './base-contribution-render';\nimport { boundsAllocate } from '../../../../allocator/bounds-allocate';\nimport { getTextBounds } from '../../../../graphic';\nimport { createRectPath } from '../../../../common/shape/rect';\n\nexport class DefaultTextBackgroundRenderContribution\n extends DefaultBaseBackgroundRenderContribution\n implements ITextRenderContribution\n{\n time: BaseRenderContributionTime = BaseRenderContributionTime.beforeFillStroke;\n\n drawShape(\n graphic: IText,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<IGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n strokeCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean\n ) {\n const { backgroundMode = graphicAttribute.backgroundMode, backgroundFit = graphicAttribute.backgroundFit } =\n graphic.attribute;\n let { background } = graphic.attribute;\n if (!background) {\n return;\n }\n let matrix: IMatrix;\n const save = () => {\n if (graphic.type === 'richtext') {\n matrix = context.currentMatrix.clone();\n context.restore();\n context.save();\n context.setTransformForCurrent();\n }\n };\n const restore = () => {\n if (graphic.type === 'richtext') {\n context.restore();\n context.save();\n matrix && context.setTransformFromMatrix(matrix, true, 1);\n }\n };\n save();\n let b: IAABBBounds;\n const shouldReCalBounds = isObject(background) && (background as any).background;\n const onlyTranslate = graphic.transMatrix.onlyTranslate();\n if (shouldReCalBounds) {\n const _b = graphic.AABBBounds;\n const x = ((background as any).x ?? _b.x1) + ((background as any).dx ?? 0);\n const y = ((background as any).y ?? _b.y1) + ((background as any).dy ?? 0);\n const w = (background as any).width ?? _b.width();\n const h = (background as any).height ?? _b.height();\n b = boundsAllocate.allocate(x, y, x + w, y + h);\n background = (background as any).background;\n if (!onlyTranslate) {\n const w = b.width();\n const h = b.height();\n b.set(\n ((background as any).x ?? 0) + ((background as any).dx ?? 0),\n ((background as any).y ?? 0) + ((background as any).dy ?? 0),\n w,\n h\n );\n }\n } else {\n b = graphic.AABBBounds;\n if (!onlyTranslate) {\n b = getTextBounds({ ...graphic.attribute, angle: 0, scaleX: 1, scaleY: 1, x: 0, y: 0, dx: 0, dy: 0 }).clone();\n }\n }\n\n if (graphic.backgroundImg && graphic.resources) {\n const res = graphic.resources.get(background as any);\n if (res.state !== 'success' || !res.data) {\n restore();\n return;\n }\n\n context.highPerformanceSave();\n // 默认应用旋转\n if (!onlyTranslate) {\n // TODO 性能优化\n // const _b = getTextBounds({ ...graphic.attribute, angle: 0, scaleX: 1, scaleY: 1, x: 0, y: 0, dx: 0, dy: 0 });\n // b.copy(_b);\n } else {\n context.setTransformFromMatrix(graphic.parent.globalTransMatrix, true);\n }\n\n context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute);\n this.doDrawImage(context, res.data, b, backgroundMode, backgroundFit);\n context.highPerformanceRestore();\n context.setTransformForCurrent();\n } else {\n const { backgroundCornerRadius } = graphic.attribute;\n context.highPerformanceSave();\n context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute);\n context.fillStyle = background as string;\n if (backgroundCornerRadius) {\n // 测试后,cache对于重绘性能提升不大,但是在首屏有一定性能损耗,因此rect不再使用cache\n createRectPath(context, b.x1, b.y1, b.width(), b.height(), backgroundCornerRadius);\n context.fill();\n } else {\n context.fillRect(b.x1, b.y1, b.width(), b.height());\n }\n context.highPerformanceRestore();\n }\n\n if (shouldReCalBounds) {\n boundsAllocate.free(b);\n }\n restore();\n }\n}\n\nexport const defaultTextBackgroundRenderContribution = new DefaultTextBackgroundRenderContribution();\n\n// @injectable()\n// export class DefaultTextPopTipRenderContribution\n// extends DefaultBasePopTipRenderContribution\n// implements ITextRenderContribution\n// {\n// time: BaseRenderContributionTime = BaseRenderContributionTime.afterFillStroke;\n// }\n"]}
|