@visactor/vrender-core 0.22.10 → 0.22.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/animate/config.d.ts +1 -2
- package/cjs/animate/config.js +1 -5
- package/cjs/animate/config.js.map +1 -1
- package/cjs/application.d.ts +2 -1
- package/cjs/application.js.map +1 -1
- package/cjs/canvas/constants.js +1 -2
- package/cjs/canvas/empty-context.d.ts +1 -0
- package/cjs/canvas/empty-context.js +4 -0
- package/cjs/canvas/empty-context.js.map +1 -1
- package/cjs/color-string/interpolate.d.ts +1 -0
- package/cjs/color-string/interpolate.js +12 -4
- package/cjs/color-string/interpolate.js.map +1 -1
- package/cjs/color-string/store.js +2 -1
- package/cjs/common/contribution-provider.d.ts +16 -0
- package/cjs/common/contribution-provider.js +21 -2
- package/cjs/common/contribution-provider.js.map +1 -1
- package/cjs/common/custom-path2d.js +2 -2
- package/cjs/common/custom-path2d.js.map +1 -1
- package/cjs/common/diff.d.ts +1 -0
- package/cjs/common/diff.js +19 -0
- package/cjs/common/diff.js.map +1 -0
- package/cjs/common/enums.d.ts +0 -16
- package/cjs/common/enums.js +2 -11
- package/cjs/common/enums.js.map +1 -1
- package/cjs/common/event-listener-manager.d.ts +14 -0
- package/cjs/common/event-listener-manager.js +52 -0
- package/cjs/common/event-listener-manager.js.map +1 -0
- package/cjs/common/event-transformer.d.ts +12 -0
- package/cjs/common/event-transformer.js +91 -0
- package/cjs/common/event-transformer.js.map +1 -0
- package/cjs/common/morphing-utils.js +32 -124
- package/cjs/common/morphing-utils.js.map +1 -1
- package/cjs/common/performance-raf.d.ts +8 -0
- package/cjs/common/performance-raf.js +32 -0
- package/cjs/common/performance-raf.js.map +1 -0
- package/cjs/common/polygon.js +4 -2
- package/cjs/common/polygon.js.map +1 -1
- package/cjs/common/render-area.js +1 -0
- package/cjs/common/segment/curve/cubic-bezier.d.ts +1 -2
- package/cjs/common/segment/curve/cubic-bezier.js +3 -8
- package/cjs/common/segment/curve/cubic-bezier.js.map +1 -1
- package/cjs/common/segment/curve/quadratic-bezier.d.ts +1 -0
- package/cjs/common/segment/curve/quadratic-bezier.js +10 -3
- package/cjs/common/segment/curve/quadratic-bezier.js.map +1 -1
- package/cjs/common/segment/index.d.ts +1 -0
- package/cjs/common/segment/index.js +1 -1
- package/cjs/common/segment/index.js.map +1 -1
- package/cjs/common/shape/arc.d.ts +1 -1
- package/cjs/common/shape/arc.js +7 -3
- package/cjs/common/shape/arc.js.map +1 -1
- package/cjs/common/simplify.js +1 -2
- package/cjs/common/split-path.js +1 -1
- package/cjs/common/split-path.js.map +1 -1
- package/cjs/common/store.js +1 -1
- package/cjs/common/text.js +1 -1
- package/cjs/common/utils.d.ts +0 -2
- package/cjs/common/utils.js +5 -9
- package/cjs/common/utils.js.map +1 -1
- package/cjs/core/application.js +1 -1
- package/cjs/core/camera.js +1 -1
- package/cjs/core/global.d.ts +10 -5
- package/cjs/core/global.js +23 -12
- package/cjs/core/global.js.map +1 -1
- package/cjs/core/stage.d.ts +9 -3
- package/cjs/core/stage.js +37 -20
- package/cjs/core/stage.js.map +1 -1
- package/cjs/core/window.d.ts +5 -4
- package/cjs/core/window.js +14 -13
- package/cjs/core/window.js.map +1 -1
- package/cjs/event/event-system.js +11 -10
- package/cjs/event/event-system.js.map +1 -1
- package/cjs/graphic/arc.d.ts +1 -2
- package/cjs/graphic/arc.js +3 -2
- package/cjs/graphic/arc.js.map +1 -1
- package/cjs/graphic/area.d.ts +1 -2
- package/cjs/graphic/area.js +4 -1
- package/cjs/graphic/area.js.map +1 -1
- package/cjs/graphic/circle.d.ts +1 -2
- package/cjs/graphic/circle.js +5 -2
- package/cjs/graphic/circle.js.map +1 -1
- package/cjs/graphic/config.js +2 -1
- package/cjs/graphic/config.js.map +1 -1
- package/cjs/graphic/graphic-service/graphic-module.js +1 -2
- package/cjs/graphic/graphic-service/graphic-module.js.map +1 -1
- package/cjs/graphic/graphic-service/graphic-service.js +2 -3
- package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
- package/cjs/graphic/graphic.d.ts +9 -12
- package/cjs/graphic/graphic.js +48 -105
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/graphic/group.js +8 -8
- package/cjs/graphic/group.js.map +1 -1
- package/cjs/graphic/line.d.ts +1 -2
- package/cjs/graphic/line.js +5 -1
- package/cjs/graphic/line.js.map +1 -1
- package/cjs/graphic/rect.js +5 -2
- package/cjs/graphic/rect.js.map +1 -1
- package/cjs/graphic/richtext/icon.d.ts +1 -1
- package/cjs/graphic/richtext/icon.js.map +1 -1
- package/cjs/graphic/richtext/paragraph.js +2 -2
- package/cjs/graphic/richtext/paragraph.js.map +1 -1
- package/cjs/graphic/star.d.ts +1 -2
- package/cjs/graphic/star.js +4 -2
- package/cjs/graphic/star.js.map +1 -1
- package/cjs/index.d.ts +4 -3
- package/cjs/index.js +13 -13
- package/cjs/index.js.map +1 -1
- package/cjs/interface/animate.d.ts +1 -160
- package/cjs/interface/animate.js +1 -4
- package/cjs/interface/animate.js.map +1 -1
- package/cjs/interface/animation/animate.d.ts +117 -0
- package/cjs/interface/animation/animate.js +10 -0
- package/cjs/interface/animation/animate.js.map +1 -0
- package/cjs/interface/animation/easing.d.ts +3 -0
- package/cjs/interface/animation/easing.js +6 -0
- package/cjs/interface/animation/easing.js.map +1 -0
- package/cjs/interface/animation/index.d.ts +5 -0
- package/cjs/{animate/Ticker → interface/animation}/index.js +3 -3
- package/cjs/interface/animation/index.js.map +1 -0
- package/cjs/interface/animation/ticker.d.ts +39 -0
- package/cjs/{animate/Ticker/type.js → interface/animation/ticker.js} +1 -1
- package/cjs/interface/animation/ticker.js.map +1 -0
- package/cjs/interface/animation/timeline.d.ts +17 -0
- package/cjs/interface/animation/timeline.js +6 -0
- package/cjs/interface/animation/timeline.js.map +1 -0
- package/cjs/interface/animation/type.d.ts +13 -0
- package/cjs/interface/animation/type.js +15 -0
- package/cjs/interface/animation/type.js.map +1 -0
- package/cjs/interface/context.d.ts +1 -0
- package/cjs/interface/context.js.map +1 -1
- package/cjs/interface/event-listener-manager.d.ts +7 -0
- package/cjs/interface/event-listener-manager.js +6 -0
- package/cjs/interface/event-listener-manager.js.map +1 -0
- package/cjs/interface/global.d.ts +4 -1
- package/cjs/interface/global.js.map +1 -1
- package/cjs/interface/graphic.d.ts +11 -3
- package/cjs/interface/graphic.js.map +1 -1
- package/cjs/interface/index.d.ts +1 -1
- package/cjs/interface/index.js +9 -9
- package/cjs/interface/index.js.map +1 -1
- package/cjs/interface/picker.d.ts +1 -0
- package/cjs/interface/picker.js.map +1 -1
- package/cjs/interface/render.d.ts +10 -0
- package/cjs/interface/render.js.map +1 -1
- package/cjs/interface/stage.d.ts +4 -1
- package/cjs/interface/stage.js.map +1 -1
- package/cjs/interface/window.d.ts +1 -0
- package/cjs/interface/window.js.map +1 -1
- package/cjs/modules.d.ts +2 -1
- package/cjs/modules.js +4 -3
- package/cjs/modules.js.map +1 -1
- package/cjs/picker/global-picker-service.d.ts +1 -0
- package/cjs/picker/global-picker-service.js +1 -0
- package/cjs/picker/global-picker-service.js.map +1 -1
- package/cjs/picker/picker-service.d.ts +1 -0
- package/cjs/picker/picker-service.js +3 -0
- package/cjs/picker/picker-service.js.map +1 -1
- package/cjs/plugins/builtin-plugin/auto-render-plugin.js +9 -8
- package/cjs/plugins/builtin-plugin/auto-render-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js +14 -11
- package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +13 -10
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.js +0 -1
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/incremental-auto-render-plugin.js +8 -5
- package/cjs/plugins/builtin-plugin/incremental-auto-render-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin.d.ts +2 -2
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js +6 -5
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
- package/cjs/render/contributions/render/arc-render.d.ts +6 -4
- package/cjs/render/contributions/render/arc-render.js +22 -20
- package/cjs/render/contributions/render/arc-render.js.map +1 -1
- package/cjs/render/contributions/render/area-render.d.ts +2 -2
- package/cjs/render/contributions/render/area-render.js +5 -5
- package/cjs/render/contributions/render/area-render.js.map +1 -1
- package/cjs/render/contributions/render/base-render.d.ts +4 -2
- package/cjs/render/contributions/render/base-render.js +5 -2
- package/cjs/render/contributions/render/base-render.js.map +1 -1
- package/cjs/render/contributions/render/circle-render.d.ts +2 -2
- package/cjs/render/contributions/render/circle-render.js +3 -3
- package/cjs/render/contributions/render/circle-render.js.map +1 -1
- package/cjs/render/contributions/render/draw-contribution.d.ts +2 -0
- package/cjs/render/contributions/render/draw-contribution.js +28 -19
- package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
- package/cjs/render/contributions/render/draw-interceptor.js +2 -1
- package/cjs/render/contributions/render/draw-interceptor.js.map +1 -1
- package/cjs/render/contributions/render/glyph-render.d.ts +1 -0
- package/cjs/render/contributions/render/glyph-render.js +1 -0
- package/cjs/render/contributions/render/glyph-render.js.map +1 -1
- package/cjs/render/contributions/render/graphic-render.d.ts +1 -0
- package/cjs/render/contributions/render/graphic-render.js.map +1 -1
- package/cjs/render/contributions/render/group-render.d.ts +3 -2
- package/cjs/render/contributions/render/group-render.js +19 -11
- package/cjs/render/contributions/render/group-render.js.map +1 -1
- package/cjs/render/contributions/render/image-render.d.ts +2 -2
- package/cjs/render/contributions/render/image-render.js +3 -3
- package/cjs/render/contributions/render/image-render.js.map +1 -1
- package/cjs/render/contributions/render/line-render.js +1 -1
- package/cjs/render/contributions/render/line-render.js.map +1 -1
- package/cjs/render/contributions/render/path-render.d.ts +2 -2
- package/cjs/render/contributions/render/path-render.js +3 -3
- package/cjs/render/contributions/render/path-render.js.map +1 -1
- package/cjs/render/contributions/render/polygon-render.d.ts +2 -2
- package/cjs/render/contributions/render/polygon-render.js +3 -3
- package/cjs/render/contributions/render/polygon-render.js.map +1 -1
- package/cjs/render/contributions/render/rect-render.d.ts +5 -3
- package/cjs/render/contributions/render/rect-render.js +20 -18
- package/cjs/render/contributions/render/rect-render.js.map +1 -1
- package/cjs/render/contributions/render/symbol-render.d.ts +6 -4
- package/cjs/render/contributions/render/symbol-render.js +19 -14
- package/cjs/render/contributions/render/symbol-render.js.map +1 -1
- package/cjs/render/contributions/render/text-render.d.ts +2 -2
- package/cjs/render/contributions/render/text-render.js +3 -3
- package/cjs/render/contributions/render/text-render.js.map +1 -1
- package/cjs/render/render-service.d.ts +2 -1
- package/cjs/render/render-service.js +3 -0
- package/cjs/render/render-service.js.map +1 -1
- package/dist/index.es.js +5531 -8162
- package/es/animate/config.d.ts +1 -2
- package/es/animate/config.js +0 -5
- package/es/animate/config.js.map +1 -1
- package/es/application.d.ts +2 -1
- package/es/application.js.map +1 -1
- package/es/canvas/constants.js +1 -2
- package/es/canvas/empty-context.d.ts +1 -0
- package/es/canvas/empty-context.js +4 -0
- package/es/canvas/empty-context.js.map +1 -1
- package/es/color-string/interpolate.d.ts +1 -0
- package/es/color-string/interpolate.js +8 -1
- package/es/color-string/interpolate.js.map +1 -1
- package/es/color-string/store.js +2 -1
- package/es/common/contribution-provider.d.ts +16 -0
- package/es/common/contribution-provider.js +20 -1
- package/es/common/contribution-provider.js.map +1 -1
- package/es/common/custom-path2d.js +2 -2
- package/es/common/custom-path2d.js.map +1 -1
- package/es/common/diff.d.ts +1 -0
- package/es/common/diff.js +11 -0
- package/es/common/diff.js.map +1 -0
- package/es/common/enums.d.ts +0 -16
- package/es/common/enums.js +0 -20
- package/es/common/enums.js.map +1 -1
- package/es/common/event-listener-manager.d.ts +14 -0
- package/es/common/event-listener-manager.js +44 -0
- package/es/common/event-listener-manager.js.map +1 -0
- package/es/common/event-transformer.d.ts +12 -0
- package/es/common/event-transformer.js +81 -0
- package/es/common/event-transformer.js.map +1 -0
- package/es/common/morphing-utils.js +29 -124
- package/es/common/morphing-utils.js.map +1 -1
- package/es/common/performance-raf.d.ts +8 -0
- package/es/common/performance-raf.js +24 -0
- package/es/common/performance-raf.js.map +1 -0
- package/es/common/polygon.js +4 -2
- package/es/common/polygon.js.map +1 -1
- package/es/common/render-area.js +2 -1
- package/es/common/segment/curve/cubic-bezier.d.ts +1 -2
- package/es/common/segment/curve/cubic-bezier.js +1 -8
- package/es/common/segment/curve/cubic-bezier.js.map +1 -1
- package/es/common/segment/curve/quadratic-bezier.d.ts +1 -0
- package/es/common/segment/curve/quadratic-bezier.js +5 -2
- package/es/common/segment/curve/quadratic-bezier.js.map +1 -1
- package/es/common/segment/index.d.ts +1 -0
- package/es/common/segment/index.js +2 -0
- package/es/common/segment/index.js.map +1 -1
- package/es/common/shape/arc.d.ts +1 -1
- package/es/common/shape/arc.js +7 -3
- package/es/common/shape/arc.js.map +1 -1
- package/es/common/simplify.js +1 -2
- package/es/common/split-path.js +1 -1
- package/es/common/split-path.js.map +1 -1
- package/es/common/store.js +1 -1
- package/es/common/text.js +1 -1
- package/es/common/utils.d.ts +0 -2
- package/es/common/utils.js +1 -5
- package/es/common/utils.js.map +1 -1
- package/es/core/application.js +1 -1
- package/es/core/camera.js +1 -1
- package/es/core/global.d.ts +10 -5
- package/es/core/global.js +26 -11
- package/es/core/global.js.map +1 -1
- package/es/core/stage.d.ts +9 -3
- package/es/core/stage.js +38 -22
- package/es/core/stage.js.map +1 -1
- package/es/core/window.d.ts +5 -4
- package/es/core/window.js +15 -12
- package/es/core/window.js.map +1 -1
- package/es/event/event-system.js +11 -10
- package/es/event/event-system.js.map +1 -1
- package/es/graphic/arc.d.ts +1 -2
- package/es/graphic/arc.js +3 -2
- package/es/graphic/arc.js.map +1 -1
- package/es/graphic/area.d.ts +1 -2
- package/es/graphic/area.js +4 -1
- package/es/graphic/area.js.map +1 -1
- package/es/graphic/circle.d.ts +1 -2
- package/es/graphic/circle.js +4 -2
- package/es/graphic/circle.js.map +1 -1
- package/es/graphic/config.js +2 -1
- package/es/graphic/config.js.map +1 -1
- package/es/graphic/graphic-service/graphic-module.js +1 -1
- package/es/graphic/graphic-service/graphic-module.js.map +1 -1
- package/es/graphic/graphic-service/graphic-service.js +1 -4
- package/es/graphic/graphic-service/graphic-service.js.map +1 -1
- package/es/graphic/graphic.d.ts +9 -12
- package/es/graphic/graphic.js +52 -109
- package/es/graphic/graphic.js.map +1 -1
- package/es/graphic/group.js +7 -7
- package/es/graphic/group.js.map +1 -1
- package/es/graphic/line.d.ts +1 -2
- package/es/graphic/line.js +5 -1
- package/es/graphic/line.js.map +1 -1
- package/es/graphic/rect.js +5 -2
- package/es/graphic/rect.js.map +1 -1
- package/es/graphic/richtext/icon.d.ts +1 -1
- package/es/graphic/richtext/icon.js.map +1 -1
- package/es/graphic/richtext/paragraph.js +2 -2
- package/es/graphic/richtext/paragraph.js.map +1 -1
- package/es/graphic/star.d.ts +1 -2
- package/es/graphic/star.js +4 -2
- package/es/graphic/star.js.map +1 -1
- package/es/index.d.ts +4 -3
- package/es/index.js +7 -5
- package/es/index.js.map +1 -1
- package/es/interface/animate.d.ts +1 -160
- package/es/interface/animate.js +2 -1
- package/es/interface/animate.js.map +1 -1
- package/es/interface/animation/animate.d.ts +117 -0
- package/es/interface/animation/animate.js +6 -0
- package/es/interface/animation/animate.js.map +1 -0
- package/es/interface/animation/easing.d.ts +3 -0
- package/es/interface/animation/easing.js +2 -0
- package/es/interface/animation/easing.js.map +1 -0
- package/es/interface/animation/index.d.ts +5 -0
- package/es/interface/animation/index.js +10 -0
- package/es/interface/animation/index.js.map +1 -0
- package/es/interface/animation/ticker.d.ts +39 -0
- package/es/{animate/Ticker/type.js → interface/animation/ticker.js} +1 -1
- package/es/interface/animation/ticker.js.map +1 -0
- package/es/interface/animation/timeline.d.ts +17 -0
- package/es/interface/animation/timeline.js +2 -0
- package/es/interface/animation/timeline.js.map +1 -0
- package/es/interface/animation/type.d.ts +13 -0
- package/es/interface/animation/type.js +14 -0
- package/es/interface/animation/type.js.map +1 -0
- package/es/interface/context.d.ts +1 -0
- package/es/interface/context.js.map +1 -1
- package/es/interface/event-listener-manager.d.ts +7 -0
- package/es/interface/event-listener-manager.js +2 -0
- package/es/interface/event-listener-manager.js.map +1 -0
- package/es/interface/global.d.ts +4 -1
- package/es/interface/global.js.map +1 -1
- package/es/interface/graphic.d.ts +11 -3
- package/es/interface/graphic.js.map +1 -1
- package/es/interface/index.d.ts +1 -1
- package/es/interface/index.js +2 -2
- package/es/interface/index.js.map +1 -1
- package/es/interface/picker.d.ts +1 -0
- package/es/interface/picker.js.map +1 -1
- package/es/interface/render.d.ts +10 -0
- package/es/interface/render.js.map +1 -1
- package/es/interface/stage.d.ts +4 -1
- package/es/interface/stage.js.map +1 -1
- package/es/interface/window.d.ts +1 -0
- package/es/interface/window.js.map +1 -1
- package/es/modules.d.ts +2 -1
- package/es/modules.js +6 -0
- package/es/modules.js.map +1 -1
- package/es/picker/global-picker-service.d.ts +1 -0
- package/es/picker/global-picker-service.js +1 -0
- package/es/picker/global-picker-service.js.map +1 -1
- package/es/picker/picker-service.d.ts +1 -0
- package/es/picker/picker-service.js +3 -0
- package/es/picker/picker-service.js.map +1 -1
- package/es/plugins/builtin-plugin/auto-render-plugin.js +8 -8
- package/es/plugins/builtin-plugin/auto-render-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/dirty-bounds-plugin.js +13 -12
- package/es/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/flex-layout-plugin.js +12 -11
- package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/html-attribute-plugin.js +0 -1
- package/es/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/incremental-auto-render-plugin.js +8 -5
- package/es/plugins/builtin-plugin/incremental-auto-render-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/richtext-edit-plugin.d.ts +2 -2
- package/es/plugins/builtin-plugin/richtext-edit-plugin.js +4 -5
- package/es/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
- package/es/render/contributions/render/arc-render.d.ts +6 -4
- package/es/render/contributions/render/arc-render.js +22 -20
- package/es/render/contributions/render/arc-render.js.map +1 -1
- package/es/render/contributions/render/area-render.d.ts +2 -2
- package/es/render/contributions/render/area-render.js +5 -5
- package/es/render/contributions/render/area-render.js.map +1 -1
- package/es/render/contributions/render/base-render.d.ts +4 -2
- package/es/render/contributions/render/base-render.js +5 -2
- package/es/render/contributions/render/base-render.js.map +1 -1
- package/es/render/contributions/render/circle-render.d.ts +2 -2
- package/es/render/contributions/render/circle-render.js +3 -3
- package/es/render/contributions/render/circle-render.js.map +1 -1
- package/es/render/contributions/render/draw-contribution.d.ts +2 -0
- package/es/render/contributions/render/draw-contribution.js +28 -19
- package/es/render/contributions/render/draw-contribution.js.map +1 -1
- package/es/render/contributions/render/draw-interceptor.js +2 -1
- package/es/render/contributions/render/draw-interceptor.js.map +1 -1
- package/es/render/contributions/render/glyph-render.d.ts +1 -0
- package/es/render/contributions/render/glyph-render.js +1 -0
- package/es/render/contributions/render/glyph-render.js.map +1 -1
- package/es/render/contributions/render/graphic-render.d.ts +1 -0
- package/es/render/contributions/render/graphic-render.js.map +1 -1
- package/es/render/contributions/render/group-render.d.ts +3 -2
- package/es/render/contributions/render/group-render.js +19 -11
- package/es/render/contributions/render/group-render.js.map +1 -1
- package/es/render/contributions/render/image-render.d.ts +2 -2
- package/es/render/contributions/render/image-render.js +3 -3
- package/es/render/contributions/render/image-render.js.map +1 -1
- package/es/render/contributions/render/line-render.js +1 -1
- package/es/render/contributions/render/line-render.js.map +1 -1
- package/es/render/contributions/render/path-render.d.ts +2 -2
- package/es/render/contributions/render/path-render.js +3 -3
- package/es/render/contributions/render/path-render.js.map +1 -1
- package/es/render/contributions/render/polygon-render.d.ts +2 -2
- package/es/render/contributions/render/polygon-render.js +3 -3
- package/es/render/contributions/render/polygon-render.js.map +1 -1
- package/es/render/contributions/render/rect-render.d.ts +5 -3
- package/es/render/contributions/render/rect-render.js +20 -17
- package/es/render/contributions/render/rect-render.js.map +1 -1
- package/es/render/contributions/render/symbol-render.d.ts +6 -4
- package/es/render/contributions/render/symbol-render.js +19 -14
- package/es/render/contributions/render/symbol-render.js.map +1 -1
- package/es/render/contributions/render/text-render.d.ts +2 -2
- package/es/render/contributions/render/text-render.js +3 -3
- package/es/render/contributions/render/text-render.js.map +1 -1
- package/es/render/render-service.d.ts +2 -1
- package/es/render/render-service.js +3 -0
- package/es/render/render-service.js.map +1 -1
- package/package.json +2 -2
- package/cjs/animate/Ticker/default-ticker.d.ts +0 -40
- package/cjs/animate/Ticker/default-ticker.js +0 -140
- package/cjs/animate/Ticker/default-ticker.js.map +0 -1
- package/cjs/animate/Ticker/index.d.ts +0 -5
- package/cjs/animate/Ticker/index.js.map +0 -1
- package/cjs/animate/Ticker/manual-ticker-handler.d.ts +0 -15
- package/cjs/animate/Ticker/manual-ticker-handler.js +0 -36
- package/cjs/animate/Ticker/manual-ticker-handler.js.map +0 -1
- package/cjs/animate/Ticker/manual-ticker.d.ts +0 -19
- package/cjs/animate/Ticker/manual-ticker.js +0 -37
- package/cjs/animate/Ticker/manual-ticker.js.map +0 -1
- package/cjs/animate/Ticker/raf-tick-handler.d.ts +0 -9
- package/cjs/animate/Ticker/raf-tick-handler.js +0 -30
- package/cjs/animate/Ticker/raf-tick-handler.js.map +0 -1
- package/cjs/animate/Ticker/timeout-tick-handler.d.ts +0 -9
- package/cjs/animate/Ticker/timeout-tick-handler.js +0 -28
- package/cjs/animate/Ticker/timeout-tick-handler.js.map +0 -1
- package/cjs/animate/Ticker/type.d.ts +0 -6
- package/cjs/animate/Ticker/type.js.map +0 -1
- package/cjs/animate/animate.d.ts +0 -147
- package/cjs/animate/animate.js +0 -403
- package/cjs/animate/animate.js.map +0 -1
- package/cjs/animate/custom-animate.d.ts +0 -236
- package/cjs/animate/custom-animate.js +0 -722
- package/cjs/animate/custom-animate.js.map +0 -1
- package/cjs/animate/default-ticker.d.ts +0 -2
- package/cjs/animate/default-ticker.js +0 -14
- package/cjs/animate/default-ticker.js.map +0 -1
- package/cjs/animate/easing-func.d.ts +0 -1
- package/cjs/animate/easing-func.js +0 -16
- package/cjs/animate/easing-func.js.map +0 -1
- package/cjs/animate/easing.d.ts +0 -49
- package/cjs/animate/easing.js +0 -141
- package/cjs/animate/easing.js.map +0 -1
- package/cjs/animate/group-fade.d.ts +0 -16
- package/cjs/animate/group-fade.js +0 -66
- package/cjs/animate/group-fade.js.map +0 -1
- package/cjs/animate/index.d.ts +0 -8
- package/cjs/animate/index.js +0 -24
- package/cjs/animate/index.js.map +0 -1
- package/cjs/animate/morphing.d.ts +0 -52
- package/cjs/animate/morphing.js +0 -292
- package/cjs/animate/morphing.js.map +0 -1
- package/cjs/animate/timeline.d.ts +0 -17
- package/cjs/animate/timeline.js +0 -46
- package/cjs/animate/timeline.js.map +0 -1
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin-old.d.ts +0 -1
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin-old.js +0 -3
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin-old.js.map +0 -1
- package/es/animate/Ticker/default-ticker.d.ts +0 -40
- package/es/animate/Ticker/default-ticker.js +0 -138
- package/es/animate/Ticker/default-ticker.js.map +0 -1
- package/es/animate/Ticker/index.d.ts +0 -5
- package/es/animate/Ticker/index.js +0 -10
- package/es/animate/Ticker/index.js.map +0 -1
- package/es/animate/Ticker/manual-ticker-handler.d.ts +0 -15
- package/es/animate/Ticker/manual-ticker-handler.js +0 -28
- package/es/animate/Ticker/manual-ticker-handler.js.map +0 -1
- package/es/animate/Ticker/manual-ticker.d.ts +0 -19
- package/es/animate/Ticker/manual-ticker.js +0 -31
- package/es/animate/Ticker/manual-ticker.js.map +0 -1
- package/es/animate/Ticker/raf-tick-handler.d.ts +0 -9
- package/es/animate/Ticker/raf-tick-handler.js +0 -22
- package/es/animate/Ticker/raf-tick-handler.js.map +0 -1
- package/es/animate/Ticker/timeout-tick-handler.d.ts +0 -9
- package/es/animate/Ticker/timeout-tick-handler.js +0 -20
- package/es/animate/Ticker/timeout-tick-handler.js.map +0 -1
- package/es/animate/Ticker/type.d.ts +0 -6
- package/es/animate/Ticker/type.js.map +0 -1
- package/es/animate/animate.d.ts +0 -147
- package/es/animate/animate.js +0 -398
- package/es/animate/animate.js.map +0 -1
- package/es/animate/custom-animate.d.ts +0 -236
- package/es/animate/custom-animate.js +0 -699
- package/es/animate/custom-animate.js.map +0 -1
- package/es/animate/default-ticker.d.ts +0 -2
- package/es/animate/default-ticker.js +0 -12
- package/es/animate/default-ticker.js.map +0 -1
- package/es/animate/easing-func.d.ts +0 -1
- package/es/animate/easing-func.js +0 -10
- package/es/animate/easing-func.js.map +0 -1
- package/es/animate/easing.d.ts +0 -49
- package/es/animate/easing.js +0 -134
- package/es/animate/easing.js.map +0 -1
- package/es/animate/group-fade.d.ts +0 -16
- package/es/animate/group-fade.js +0 -56
- package/es/animate/group-fade.js.map +0 -1
- package/es/animate/index.d.ts +0 -8
- package/es/animate/index.js +0 -16
- package/es/animate/index.js.map +0 -1
- package/es/animate/morphing.d.ts +0 -52
- package/es/animate/morphing.js +0 -295
- package/es/animate/morphing.js.map +0 -1
- package/es/animate/timeline.d.ts +0 -17
- package/es/animate/timeline.js +0 -42
- package/es/animate/timeline.js.map +0 -1
- package/es/plugins/builtin-plugin/richtext-edit-plugin-old.d.ts +0 -1
- package/es/plugins/builtin-plugin/richtext-edit-plugin-old.js +0 -3
- package/es/plugins/builtin-plugin/richtext-edit-plugin-old.js.map +0 -1
package/es/animate/morphing.js
DELETED
|
@@ -1,295 +0,0 @@
|
|
|
1
|
-
import { splitArc, splitCircle, splitLine, splitRect, splitPolygon, splitArea, splitPath } from "./../common/split-path";
|
|
2
|
-
|
|
3
|
-
import { CustomPath2D } from "../common/custom-path2d";
|
|
4
|
-
|
|
5
|
-
import { ACustomAnimate } from "./animate";
|
|
6
|
-
|
|
7
|
-
import { alignBezierCurves, applyTransformOnBezierCurves, findBestMorphingRotation, pathToBezierCurves } from "../common/morphing-utils";
|
|
8
|
-
|
|
9
|
-
import { application } from "../application";
|
|
10
|
-
|
|
11
|
-
import { isNil } from "@visactor/vutils";
|
|
12
|
-
|
|
13
|
-
import { interpolateColor } from "../color-string/interpolate";
|
|
14
|
-
|
|
15
|
-
import { ColorStore, ColorType } from "../color-string";
|
|
16
|
-
|
|
17
|
-
import { DefaultMorphingAnimateConfig } from "./config";
|
|
18
|
-
|
|
19
|
-
import { isTransformKey } from "../common/utils";
|
|
20
|
-
|
|
21
|
-
import { AttributeUpdateType } from "../common/enums";
|
|
22
|
-
|
|
23
|
-
const interpolateOtherAttrs = (attrs, out, ratio) => {
|
|
24
|
-
attrs.forEach((entry => {
|
|
25
|
-
if (Number.isFinite(entry.to)) out[entry.key] = entry.from + (entry.to - entry.from) * ratio; else if ("fill" === entry.key || "stroke" === entry.key) {
|
|
26
|
-
const color = interpolateColor(entry.from, entry.to, ratio, !1);
|
|
27
|
-
color && (out[entry.key] = color);
|
|
28
|
-
}
|
|
29
|
-
}));
|
|
30
|
-
}, interpolateMorphingData = (morphingData, path, ratio) => {
|
|
31
|
-
const tmpArr = [], newCp = [];
|
|
32
|
-
path.clear();
|
|
33
|
-
for (let i = 0; i < morphingData.length; i++) {
|
|
34
|
-
const item = morphingData[i], from = item.from, to = item.to, angle = item.rotation * ratio, fromCp = item.fromCp, toCp = item.toCp, sa = Math.sin(angle), ca = Math.cos(angle);
|
|
35
|
-
newCp[0] = fromCp[0] + (toCp[0] - fromCp[0]) * ratio, newCp[1] = fromCp[1] + (toCp[1] - fromCp[1]) * ratio;
|
|
36
|
-
for (let m = 0; m < from.length; m += 2) {
|
|
37
|
-
const x0 = from[m], y0 = from[m + 1], x = x0 * (1 - ratio) + to[m] * ratio, y = y0 * (1 - ratio) + to[m + 1] * ratio;
|
|
38
|
-
tmpArr[m] = x * ca - y * sa + newCp[0], tmpArr[m + 1] = x * sa + y * ca + newCp[1];
|
|
39
|
-
}
|
|
40
|
-
let x0 = tmpArr[0], y0 = tmpArr[1];
|
|
41
|
-
path.moveTo(x0, y0);
|
|
42
|
-
for (let m = 2; m < from.length; m += 6) {
|
|
43
|
-
const x1 = tmpArr[m], y1 = tmpArr[m + 1], x2 = tmpArr[m + 2], y2 = tmpArr[m + 3], x3 = tmpArr[m + 4], y3 = tmpArr[m + 5];
|
|
44
|
-
x0 === x1 && y0 === y1 && x2 === x3 && y2 === y3 ? path.lineTo(x3, y3) : path.bezierCurveTo(x1, y1, x2, y2, x3, y3),
|
|
45
|
-
x0 = x3, y0 = y3;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}, parseMorphingData = (fromPath, toPath, config) => {
|
|
49
|
-
const fromBezier = fromPath ? pathToBezierCurves(fromPath) : [], toBezier = pathToBezierCurves(toPath);
|
|
50
|
-
config && fromBezier && (config.fromTransform && applyTransformOnBezierCurves(fromBezier, config.fromTransform.clone().getInverse()),
|
|
51
|
-
applyTransformOnBezierCurves(fromBezier, config.toTransfrom));
|
|
52
|
-
const [fromBezierCurves, toBezierCurves] = alignBezierCurves(fromBezier, toBezier);
|
|
53
|
-
return fromPath ? findBestMorphingRotation(fromBezierCurves, toBezierCurves, 10, Math.PI) : toBezierCurves.map(((to, index) => ({
|
|
54
|
-
from: fromBezierCurves[index],
|
|
55
|
-
to: to,
|
|
56
|
-
fromCp: [ 0, 0 ],
|
|
57
|
-
toCp: [ 0, 0 ],
|
|
58
|
-
rotation: 0
|
|
59
|
-
})));
|
|
60
|
-
}, validateOtherAttrs = [ "fill", "fillOpacity", "shadowBlur", "shadowColor", "shadowOffsetX", "shadowOffsetY", "stroke", "strokeOpacity", "lineDashOffset" ], parseOtherAnimateAttrs = (fromAttrs, toAttrs) => {
|
|
61
|
-
if (!fromAttrs || !toAttrs) return null;
|
|
62
|
-
const res = [];
|
|
63
|
-
let hasAttr = !1;
|
|
64
|
-
return Object.keys(fromAttrs).forEach((fromKey => {
|
|
65
|
-
if (!validateOtherAttrs.includes(fromKey)) return;
|
|
66
|
-
const toValue = toAttrs[fromKey];
|
|
67
|
-
isNil(toValue) || isNil(fromAttrs[fromKey]) || toValue === fromAttrs[fromKey] || ("fill" === fromKey || "stroke" === fromKey ? res.push({
|
|
68
|
-
from: "string" == typeof fromAttrs[fromKey] ? ColorStore.Get(fromAttrs[fromKey], ColorType.Color255) : fromAttrs[fromKey],
|
|
69
|
-
to: "string" == typeof toValue ? ColorStore.Get(toValue, ColorType.Color255) : toValue,
|
|
70
|
-
key: fromKey
|
|
71
|
-
}) : res.push({
|
|
72
|
-
from: fromAttrs[fromKey],
|
|
73
|
-
to: toValue,
|
|
74
|
-
key: fromKey
|
|
75
|
-
}), hasAttr = !0);
|
|
76
|
-
})), hasAttr ? res : null;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export class MorphingPath extends ACustomAnimate {
|
|
80
|
-
constructor(config, duration, easing) {
|
|
81
|
-
super(0, 1, duration, easing), this.morphingData = config.morphingData, this.otherAttrs = config.otherAttrs,
|
|
82
|
-
this.saveOnEnd = config.saveOnEnd;
|
|
83
|
-
}
|
|
84
|
-
getEndProps() {
|
|
85
|
-
return {};
|
|
86
|
-
}
|
|
87
|
-
onBind() {
|
|
88
|
-
this.target.createPathProxy(), this.onUpdate(!1, 0, this.target.attribute);
|
|
89
|
-
}
|
|
90
|
-
onEnd() {}
|
|
91
|
-
onUpdate(end, ratio, out) {
|
|
92
|
-
const target = this.target, pathProxy = "function" == typeof target.pathProxy ? target.pathProxy(target.attribute) : target.pathProxy;
|
|
93
|
-
interpolateMorphingData(this.morphingData, pathProxy, ratio), this.otherAttrs && this.otherAttrs.length && interpolateOtherAttrs(this.otherAttrs, out, ratio),
|
|
94
|
-
end && !this.saveOnEnd && (this.target.pathProxy = null);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export const morphPath = (fromGraphic, toGraphic, animationConfig, fromGraphicTransform) => {
|
|
99
|
-
var _a, _b, _c;
|
|
100
|
-
if (fromGraphic && (!fromGraphic.valid || !fromGraphic.toCustomPath)) return __DEV__ && console.error(fromGraphic, " is not validate"),
|
|
101
|
-
null;
|
|
102
|
-
if (!toGraphic.valid || !toGraphic.toCustomPath) return __DEV__ && console.error(toGraphic, " is not validate"),
|
|
103
|
-
null;
|
|
104
|
-
let fromTransform = null == fromGraphic ? void 0 : fromGraphic.globalTransMatrix;
|
|
105
|
-
fromGraphicTransform && fromTransform && (fromTransform = fromGraphicTransform.clone().multiply(fromTransform.a, fromTransform.b, fromTransform.c, fromTransform.d, fromTransform.e, fromTransform.f));
|
|
106
|
-
const morphingData = parseMorphingData(null === (_a = null == fromGraphic ? void 0 : fromGraphic.toCustomPath) || void 0 === _a ? void 0 : _a.call(fromGraphic), toGraphic.toCustomPath(), {
|
|
107
|
-
fromTransform: fromTransform,
|
|
108
|
-
toTransfrom: toGraphic.globalTransMatrix
|
|
109
|
-
}), attrs = parseOtherAnimateAttrs(null == fromGraphic ? void 0 : fromGraphic.attribute, toGraphic.attribute), animate = toGraphic.animate(animationConfig);
|
|
110
|
-
return (null == animationConfig ? void 0 : animationConfig.delay) && animate.wait(animationConfig.delay),
|
|
111
|
-
animate.play(new MorphingPath({
|
|
112
|
-
morphingData: morphingData,
|
|
113
|
-
otherAttrs: attrs
|
|
114
|
-
}, null !== (_b = null == animationConfig ? void 0 : animationConfig.duration) && void 0 !== _b ? _b : DefaultMorphingAnimateConfig.duration, null !== (_c = null == animationConfig ? void 0 : animationConfig.easing) && void 0 !== _c ? _c : DefaultMorphingAnimateConfig.easing)),
|
|
115
|
-
animate;
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
export const oneToMultiMorph = (fromGraphic, toGraphics, animationConfig) => {
|
|
119
|
-
var _a;
|
|
120
|
-
const validateToGraphics = toGraphics.filter((graphic => graphic && graphic.toCustomPath && graphic.valid));
|
|
121
|
-
validateToGraphics.length || __DEV__ && console.error(validateToGraphics, " is not validate"),
|
|
122
|
-
fromGraphic.valid && fromGraphic.toCustomPath || __DEV__ && console.error(fromGraphic, " is not validate");
|
|
123
|
-
const childGraphics = ("clone" === (null == animationConfig ? void 0 : animationConfig.splitPath) ? cloneGraphic : null !== (_a = null == animationConfig ? void 0 : animationConfig.splitPath) && void 0 !== _a ? _a : splitGraphic)(fromGraphic, validateToGraphics.length, !1), oldOnEnd = null == animationConfig ? void 0 : animationConfig.onEnd;
|
|
124
|
-
let count = validateToGraphics.length;
|
|
125
|
-
const onEachEnd = () => {
|
|
126
|
-
count--, 0 === count && oldOnEnd && oldOnEnd();
|
|
127
|
-
};
|
|
128
|
-
validateToGraphics.forEach(((toChild, index) => {
|
|
129
|
-
var _a;
|
|
130
|
-
const fromChild = childGraphics[index], delay = (null !== (_a = null == animationConfig ? void 0 : animationConfig.delay) && void 0 !== _a ? _a : 0) + ((null == animationConfig ? void 0 : animationConfig.individualDelay) ? animationConfig.individualDelay(index, validateToGraphics.length, fromChild, toChild) : 0);
|
|
131
|
-
morphPath(fromChild, toChild, Object.assign({}, animationConfig, {
|
|
132
|
-
onEnd: onEachEnd,
|
|
133
|
-
delay: delay
|
|
134
|
-
}), fromGraphic.globalTransMatrix);
|
|
135
|
-
}));
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
export class MultiToOneMorphingPath extends ACustomAnimate {
|
|
139
|
-
constructor(config, duration, easing) {
|
|
140
|
-
super(0, 1, duration, easing), this.morphingData = config.morphingData, this.otherAttrs = config.otherAttrs;
|
|
141
|
-
}
|
|
142
|
-
getEndProps() {
|
|
143
|
-
return {};
|
|
144
|
-
}
|
|
145
|
-
onBind() {
|
|
146
|
-
this.addPathProxy();
|
|
147
|
-
}
|
|
148
|
-
addPathProxy() {
|
|
149
|
-
this.target.shadowRoot.forEachChildren((child => {
|
|
150
|
-
child.createPathProxy();
|
|
151
|
-
})), this.onUpdate(!1, 0, this.target.attribute);
|
|
152
|
-
}
|
|
153
|
-
clearPathProxy() {
|
|
154
|
-
this.target.shadowRoot.forEachChildren((child => {
|
|
155
|
-
child.pathProxy = null;
|
|
156
|
-
}));
|
|
157
|
-
}
|
|
158
|
-
onEnd() {}
|
|
159
|
-
onUpdate(end, ratio, out) {
|
|
160
|
-
this.target.shadowRoot.forEachChildren(((child, index) => {
|
|
161
|
-
var _a;
|
|
162
|
-
interpolateMorphingData(this.morphingData[index], "function" == typeof child.pathProxy ? child.pathProxy(child.attribute) : child.pathProxy, ratio),
|
|
163
|
-
(null === (_a = this.otherAttrs) || void 0 === _a ? void 0 : _a[index]) && this.otherAttrs[index].length && interpolateOtherAttrs(this.otherAttrs[index], child.attribute, ratio);
|
|
164
|
-
})), end && (this.clearPathProxy(), this.morphingData = null);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
const parseShadowChildAttrs = graphicAttrs => {
|
|
169
|
-
const attrs = {};
|
|
170
|
-
return Object.keys(graphicAttrs).forEach((key => {
|
|
171
|
-
isTransformKey(key) || (attrs[key] = graphicAttrs[key]);
|
|
172
|
-
})), attrs;
|
|
173
|
-
}, appendShadowChildrenToGraphic = (graphic, children, count) => {
|
|
174
|
-
const childAttrs = parseShadowChildAttrs(graphic.attribute), shadowRoot = graphic.attachShadow();
|
|
175
|
-
if (children.length) shadowRoot.setTheme({
|
|
176
|
-
[children[0].type]: childAttrs
|
|
177
|
-
}), children.forEach((element => {
|
|
178
|
-
element.setAttributes({
|
|
179
|
-
pickable: !1
|
|
180
|
-
}), shadowRoot.appendChild(element);
|
|
181
|
-
})); else {
|
|
182
|
-
const box = graphic.AABBBounds, width = box.width(), height = box.height();
|
|
183
|
-
shadowRoot.setTheme({
|
|
184
|
-
rect: childAttrs
|
|
185
|
-
}), new Array(count).fill(0).forEach((el => {
|
|
186
|
-
const child = application.graphicService.creator.rect({
|
|
187
|
-
x: 0,
|
|
188
|
-
y: 0,
|
|
189
|
-
width: width,
|
|
190
|
-
height: height,
|
|
191
|
-
pickable: !1
|
|
192
|
-
});
|
|
193
|
-
shadowRoot.appendChild(child), children.push(child);
|
|
194
|
-
}));
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
export const cloneGraphic = (graphic, count, needAppend) => {
|
|
199
|
-
const children = [], childAttrs = needAppend ? null : parseShadowChildAttrs(graphic.attribute), path = graphic.toCustomPath();
|
|
200
|
-
for (let i = 0; i < count; i++) {
|
|
201
|
-
const element = {
|
|
202
|
-
path: (new CustomPath2D).fromCustomPath2D(path)
|
|
203
|
-
};
|
|
204
|
-
children.push(application.graphicService.creator.path(needAppend ? element : Object.assign({}, childAttrs, element)));
|
|
205
|
-
}
|
|
206
|
-
return needAppend && appendShadowChildrenToGraphic(graphic, children, count), children;
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
export const splitGraphic = (graphic, count, needAppend) => {
|
|
210
|
-
const children = [], childAttrs = needAppend ? null : parseShadowChildAttrs(graphic.attribute);
|
|
211
|
-
if ("rect" === graphic.type) {
|
|
212
|
-
splitRect(graphic, count).forEach((element => {
|
|
213
|
-
children.push(application.graphicService.creator.rect(needAppend ? element : Object.assign({}, childAttrs, element)));
|
|
214
|
-
}));
|
|
215
|
-
} else if ("arc" === graphic.type) {
|
|
216
|
-
splitArc(graphic, count).forEach((element => {
|
|
217
|
-
children.push(application.graphicService.creator.arc(needAppend ? element : Object.assign({}, childAttrs, element)));
|
|
218
|
-
}));
|
|
219
|
-
} else if ("circle" === graphic.type) {
|
|
220
|
-
splitCircle(graphic, count).forEach((element => {
|
|
221
|
-
children.push(application.graphicService.creator.arc(needAppend ? element : Object.assign({}, childAttrs, element)));
|
|
222
|
-
}));
|
|
223
|
-
} else if ("line" === graphic.type) {
|
|
224
|
-
const childrenAttrs = splitLine(graphic, count), defaultSymbol = {
|
|
225
|
-
size: 10,
|
|
226
|
-
symbolType: "circle"
|
|
227
|
-
};
|
|
228
|
-
childrenAttrs.forEach((element => {
|
|
229
|
-
children.push(application.graphicService.creator.symbol(needAppend ? Object.assign({}, element, defaultSymbol) : Object.assign({}, childAttrs, element, defaultSymbol)));
|
|
230
|
-
}));
|
|
231
|
-
} else if ("polygon" === graphic.type) {
|
|
232
|
-
splitPolygon(graphic, count).forEach((element => {
|
|
233
|
-
children.push(application.graphicService.creator.polygon(needAppend ? element : Object.assign({}, childAttrs, element)));
|
|
234
|
-
}));
|
|
235
|
-
} else if ("area" === graphic.type) {
|
|
236
|
-
splitArea(graphic, count).forEach((element => {
|
|
237
|
-
children.push(application.graphicService.creator.polygon(needAppend ? element : Object.assign({}, childAttrs, element)));
|
|
238
|
-
}));
|
|
239
|
-
} else if ("path" === graphic.type) {
|
|
240
|
-
splitPath(graphic, count).forEach((element => {
|
|
241
|
-
"path" in element ? children.push(application.graphicService.creator.path(needAppend ? element : Object.assign({}, childAttrs, element))) : children.push(application.graphicService.creator.polygon(needAppend ? element : Object.assign({}, childAttrs, element)));
|
|
242
|
-
}));
|
|
243
|
-
}
|
|
244
|
-
return needAppend && appendShadowChildrenToGraphic(graphic, children, count), children;
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
export const multiToOneMorph = (fromGraphics, toGraphic, animationConfig) => {
|
|
248
|
-
var _a, _b, _c;
|
|
249
|
-
const validateFromGraphics = fromGraphics.filter((graphic => graphic.toCustomPath && graphic.valid));
|
|
250
|
-
validateFromGraphics.length || __DEV__ && console.error(fromGraphics, " is not validate"),
|
|
251
|
-
toGraphic.valid && toGraphic.toCustomPath || __DEV__ && console.error(toGraphic, " is not validate");
|
|
252
|
-
const childGraphics = ("clone" === (null == animationConfig ? void 0 : animationConfig.splitPath) ? cloneGraphic : null !== (_a = null == animationConfig ? void 0 : animationConfig.splitPath) && void 0 !== _a ? _a : splitGraphic)(toGraphic, validateFromGraphics.length, !0), toAttrs = toGraphic.attribute;
|
|
253
|
-
toGraphic.setAttribute("visible", !1);
|
|
254
|
-
const morphingData = validateFromGraphics.map(((graphic, index) => parseMorphingData(graphic.toCustomPath(), childGraphics[index].toCustomPath(), {
|
|
255
|
-
fromTransform: graphic.globalTransMatrix,
|
|
256
|
-
toTransfrom: childGraphics[index].globalTransMatrix
|
|
257
|
-
}))), otherAttrs = validateFromGraphics.map(((graphic, index) => parseOtherAnimateAttrs(graphic.attribute, toAttrs)));
|
|
258
|
-
if (null == animationConfig ? void 0 : animationConfig.individualDelay) {
|
|
259
|
-
const oldOnEnd = animationConfig.onEnd;
|
|
260
|
-
let count = validateFromGraphics.length;
|
|
261
|
-
const onEachEnd = () => {
|
|
262
|
-
count--, 0 === count && (toGraphic.setAttributes({
|
|
263
|
-
visible: !0,
|
|
264
|
-
ratio: null
|
|
265
|
-
}, !1, {
|
|
266
|
-
type: AttributeUpdateType.ANIMATE_END
|
|
267
|
-
}), toGraphic.detachShadow(), oldOnEnd && oldOnEnd());
|
|
268
|
-
};
|
|
269
|
-
childGraphics.forEach(((to, index) => {
|
|
270
|
-
var _a, _b, _c;
|
|
271
|
-
const delay = (null !== (_a = animationConfig.delay) && void 0 !== _a ? _a : 0) + animationConfig.individualDelay(index, validateFromGraphics.length, fromGraphics[index], to), animate = to.animate(Object.assign({}, animationConfig, {
|
|
272
|
-
onEnd: onEachEnd
|
|
273
|
-
}));
|
|
274
|
-
animate.wait(delay), animate.play(new MorphingPath({
|
|
275
|
-
morphingData: morphingData[index],
|
|
276
|
-
saveOnEnd: !0,
|
|
277
|
-
otherAttrs: otherAttrs[index]
|
|
278
|
-
}, null !== (_b = animationConfig.duration) && void 0 !== _b ? _b : DefaultMorphingAnimateConfig.duration, null !== (_c = animationConfig.easing) && void 0 !== _c ? _c : DefaultMorphingAnimateConfig.easing));
|
|
279
|
-
}));
|
|
280
|
-
} else {
|
|
281
|
-
const oldOnEnd = null == animationConfig ? void 0 : animationConfig.onEnd, config = animationConfig ? Object.assign({}, animationConfig) : {};
|
|
282
|
-
config.onEnd = () => {
|
|
283
|
-
toGraphic.setAttribute("visible", !0, !1, {
|
|
284
|
-
type: AttributeUpdateType.ANIMATE_END
|
|
285
|
-
}), toGraphic.detachShadow(), oldOnEnd && oldOnEnd();
|
|
286
|
-
};
|
|
287
|
-
const animate = toGraphic.animate(config);
|
|
288
|
-
(null == animationConfig ? void 0 : animationConfig.delay) && animate.wait(animationConfig.delay),
|
|
289
|
-
animate.play(new MultiToOneMorphingPath({
|
|
290
|
-
morphingData: morphingData,
|
|
291
|
-
otherAttrs: otherAttrs
|
|
292
|
-
}, null !== (_b = null == animationConfig ? void 0 : animationConfig.duration) && void 0 !== _b ? _b : DefaultMorphingAnimateConfig.duration, null !== (_c = null == animationConfig ? void 0 : animationConfig.easing) && void 0 !== _c ? _c : DefaultMorphingAnimateConfig.easing));
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
|
-
//# sourceMappingURL=morphing.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/animate/morphing.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,WAAW,EACX,SAAS,EACT,SAAS,EACT,YAAY,EACZ,SAAS,EACT,SAAS,EACV,MAAM,wBAAwB,CAAC;AAgBhC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EACL,iBAAiB,EACjB,4BAA4B,EAC5B,wBAAwB,EACxB,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE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,CAAC","file":"morphing.js","sourcesContent":["import {\n splitArc,\n splitCircle,\n splitLine,\n splitRect,\n splitPolygon,\n splitArea,\n splitPath\n} from './../common/split-path';\nimport type {\n ICustomPath2D,\n IGraphic,\n MorphingAnimateConfig,\n IRect,\n EasingType,\n MultiMorphingAnimateConfig,\n IArc,\n ICircle,\n IGraphicAttribute,\n ILine,\n IPolygon,\n IArea,\n IPath\n} from './../interface';\nimport { CustomPath2D } from '../common/custom-path2d';\nimport { ACustomAnimate } from './animate';\nimport {\n alignBezierCurves,\n applyTransformOnBezierCurves,\n findBestMorphingRotation,\n pathToBezierCurves\n} from '../common/morphing-utils';\nimport { application } from '../application';\nimport type { IMatrix } from '@visactor/vutils';\nimport { isNil } from '@visactor/vutils';\nimport { interpolateColor } from '../color-string/interpolate';\nimport { ColorStore, ColorType } from '../color-string';\nimport { DefaultMorphingAnimateConfig } from './config';\nimport { isTransformKey } from '../common/utils';\nimport { AttributeUpdateType } from '../common/enums';\n\ndeclare const __DEV__: boolean;\n\ninterface MorphingDataItem {\n from: number[];\n to: number[];\n fromCp: number[];\n toCp: number[];\n rotation: number;\n}\n\ninterface OtherAttrItem {\n from: any;\n to: any;\n key: string;\n}\n\nconst interpolateOtherAttrs = (attrs: OtherAttrItem[], out: any, ratio: number) => {\n attrs.forEach(entry => {\n if (Number.isFinite(entry.to)) {\n out[entry.key] = entry.from + (entry.to - entry.from) * ratio;\n } else if (entry.key === 'fill' || entry.key === 'stroke') {\n // 保存解析的结果到step\n const color = interpolateColor(entry.from, entry.to, ratio, false);\n if (color) {\n out[entry.key] = color;\n }\n }\n });\n};\n\n/* Adapted from zrender by ecomfe\n * https://github.com/ecomfe/zrender\n * Licensed under the BSD-3-Clause\n\n * url: https://github.com/ecomfe/zrender/blob/master/src/tool/morphPath.ts\n * License: https://github.com/ecomfe/zrender/blob/master/LICENSE\n * @license\n */\nconst interpolateMorphingData = (morphingData: MorphingDataItem[], path: ICustomPath2D, ratio: number) => {\n const tmpArr: number[] = [];\n const newCp: number[] = [];\n path.clear();\n\n for (let i = 0; i < morphingData.length; i++) {\n const item = morphingData[i];\n const from = item.from;\n const to = item.to;\n const angle = item.rotation * ratio;\n const fromCp = item.fromCp;\n const toCp = item.toCp;\n const sa = Math.sin(angle);\n const ca = Math.cos(angle);\n\n newCp[0] = fromCp[0] + (toCp[0] - fromCp[0]) * ratio;\n newCp[1] = fromCp[1] + (toCp[1] - fromCp[1]) * ratio;\n\n for (let m = 0; m < from.length; m += 2) {\n const x0 = from[m];\n const y0 = from[m + 1];\n const x1 = to[m];\n const y1 = to[m + 1];\n\n const x = x0 * (1 - ratio) + x1 * ratio;\n const y = y0 * (1 - ratio) + y1 * ratio;\n\n tmpArr[m] = x * ca - y * sa + newCp[0];\n tmpArr[m + 1] = x * sa + y * ca + newCp[1];\n }\n\n let x0 = tmpArr[0];\n let y0 = tmpArr[1];\n\n path.moveTo(x0, y0);\n\n for (let m = 2; m < from.length; m += 6) {\n const x1 = tmpArr[m];\n const y1 = tmpArr[m + 1];\n const x2 = tmpArr[m + 2];\n const y2 = tmpArr[m + 3];\n const x3 = tmpArr[m + 4];\n const y3 = tmpArr[m + 5];\n\n // Is a line.\n if (x0 === x1 && y0 === y1 && x2 === x3 && y2 === y3) {\n path.lineTo(x3, y3);\n } else {\n path.bezierCurveTo(x1, y1, x2, y2, x3, y3);\n }\n x0 = x3;\n y0 = y3;\n }\n }\n};\n\nconst parseMorphingData = (\n fromPath: ICustomPath2D | null,\n toPath: ICustomPath2D,\n config?: {\n fromTransform?: IMatrix;\n toTransfrom: IMatrix;\n }\n) => {\n const fromBezier = fromPath ? pathToBezierCurves(fromPath) : [];\n const toBezier = pathToBezierCurves(toPath);\n\n if (config && fromBezier) {\n config.fromTransform && applyTransformOnBezierCurves(fromBezier, config.fromTransform.clone().getInverse());\n applyTransformOnBezierCurves(fromBezier, config.toTransfrom);\n // applyTransformOnBezierCurves(toBezier, config.toTransfrom.clone().getInverse());\n }\n\n const [fromBezierCurves, toBezierCurves] = alignBezierCurves(fromBezier, toBezier);\n\n return fromPath\n ? findBestMorphingRotation(fromBezierCurves, toBezierCurves, 10, Math.PI)\n : toBezierCurves.map((to, index) => {\n return {\n from: fromBezierCurves[index],\n to,\n fromCp: [0, 0],\n toCp: [0, 0],\n rotation: 0\n };\n });\n};\n\nconst validateOtherAttrs = [\n 'fill',\n 'fillOpacity',\n 'shadowBlur',\n 'shadowColor',\n 'shadowOffsetX',\n 'shadowOffsetY',\n 'stroke',\n 'strokeOpacity',\n 'lineDashOffset'\n // 'lineWidth'\n];\n\nconst parseOtherAnimateAttrs = (\n fromAttrs: Partial<IGraphicAttribute> | null,\n toAttrs: Partial<IGraphicAttribute> | null\n) => {\n if (!fromAttrs || !toAttrs) {\n return null;\n }\n const res: OtherAttrItem[] = [];\n let hasAttr = false;\n\n Object.keys(fromAttrs).forEach(fromKey => {\n if (!validateOtherAttrs.includes(fromKey)) {\n return;\n }\n\n const toValue = toAttrs[fromKey];\n if (!isNil(toValue) && !isNil(fromAttrs[fromKey]) && toValue !== fromAttrs[fromKey]) {\n if (fromKey === 'fill' || fromKey === 'stroke') {\n res.push({\n from:\n typeof fromAttrs[fromKey] === 'string'\n ? ColorStore.Get(fromAttrs[fromKey] as unknown as string, ColorType.Color255)\n : fromAttrs[fromKey],\n to: typeof toValue === 'string' ? ColorStore.Get(toValue as string, ColorType.Color255) : toValue,\n key: fromKey\n });\n } else {\n res.push({ from: fromAttrs[fromKey], to: toValue, key: fromKey });\n }\n\n hasAttr = true;\n }\n });\n\n return hasAttr ? res : null;\n};\n\nexport class MorphingPath extends ACustomAnimate<number> {\n declare path: CustomPath2D;\n\n saveOnEnd?: boolean;\n otherAttrs?: OtherAttrItem[];\n\n constructor(\n config: { morphingData: MorphingDataItem[]; otherAttrs?: OtherAttrItem[]; saveOnEnd?: boolean },\n duration: number,\n easing: EasingType\n ) {\n super(0, 1, duration, easing);\n this.morphingData = config.morphingData;\n this.otherAttrs = config.otherAttrs;\n this.saveOnEnd = config.saveOnEnd;\n }\n\n private morphingData?: MorphingDataItem[];\n\n getEndProps(): Record<string, any> {\n return {};\n }\n\n onBind(): void {\n (this.target as IGraphic).createPathProxy();\n this.onUpdate(false, 0, (this.target as IGraphic).attribute);\n }\n\n onEnd(): void {\n return;\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const target = this.target as IGraphic;\n const pathProxy = typeof target.pathProxy === 'function' ? target.pathProxy(target.attribute) : target.pathProxy;\n interpolateMorphingData(this.morphingData, pathProxy, ratio);\n if (this.otherAttrs && this.otherAttrs.length) {\n interpolateOtherAttrs(this.otherAttrs, out, ratio);\n }\n // 计算位置\n if (end && !this.saveOnEnd) {\n (this.target as IGraphic).pathProxy = null;\n }\n }\n}\n\nexport const morphPath = (\n fromGraphic: IGraphic | null,\n toGraphic: IGraphic,\n animationConfig?: MorphingAnimateConfig,\n fromGraphicTransform?: IMatrix\n) => {\n if (fromGraphic && (!fromGraphic.valid || !fromGraphic.toCustomPath)) {\n if (__DEV__) {\n console.error(fromGraphic, ' is not validate');\n }\n return null;\n }\n\n if (!toGraphic.valid || !toGraphic.toCustomPath) {\n if (__DEV__) {\n console.error(toGraphic, ' is not validate');\n }\n return null;\n }\n\n let fromTransform = fromGraphic?.globalTransMatrix;\n\n if (fromGraphicTransform && fromTransform) {\n fromTransform = fromGraphicTransform\n .clone()\n .multiply(fromTransform.a, fromTransform.b, fromTransform.c, fromTransform.d, fromTransform.e, fromTransform.f);\n }\n const morphingData = parseMorphingData(fromGraphic?.toCustomPath?.(), toGraphic.toCustomPath(), {\n fromTransform,\n toTransfrom: toGraphic.globalTransMatrix\n });\n\n const attrs = parseOtherAnimateAttrs(fromGraphic?.attribute, toGraphic.attribute);\n const animate = toGraphic.animate(animationConfig);\n\n if (animationConfig?.delay) {\n animate.wait(animationConfig.delay);\n }\n\n animate.play(\n new MorphingPath(\n { morphingData, otherAttrs: attrs },\n animationConfig?.duration ?? DefaultMorphingAnimateConfig.duration,\n animationConfig?.easing ?? DefaultMorphingAnimateConfig.easing\n )\n );\n\n return animate;\n};\n\nexport const oneToMultiMorph = (\n fromGraphic: IGraphic,\n toGraphics: IGraphic[],\n animationConfig?: MultiMorphingAnimateConfig\n) => {\n const validateToGraphics = toGraphics.filter(graphic => graphic && graphic.toCustomPath && graphic.valid);\n if (!validateToGraphics.length) {\n if (__DEV__) {\n console.error(validateToGraphics, ' is not validate');\n }\n }\n\n if (!fromGraphic.valid || !fromGraphic.toCustomPath) {\n if (__DEV__) {\n console.error(fromGraphic, ' is not validate');\n }\n }\n\n const childGraphics: IGraphic[] = (\n animationConfig?.splitPath === 'clone' ? cloneGraphic : animationConfig?.splitPath ?? splitGraphic\n )(fromGraphic, validateToGraphics.length, false);\n\n const oldOnEnd = animationConfig?.onEnd;\n let count = validateToGraphics.length;\n const onEachEnd = () => {\n count--;\n if (count === 0 && oldOnEnd) {\n oldOnEnd();\n }\n };\n\n validateToGraphics.forEach((toChild, index) => {\n const fromChild = childGraphics[index];\n const delay =\n (animationConfig?.delay ?? 0) +\n (animationConfig?.individualDelay\n ? animationConfig.individualDelay(index, validateToGraphics.length, fromChild, toChild)\n : 0);\n morphPath(\n fromChild,\n toChild,\n Object.assign({}, animationConfig, { onEnd: onEachEnd, delay }),\n fromGraphic.globalTransMatrix\n );\n });\n};\n\nexport class MultiToOneMorphingPath extends ACustomAnimate<number> {\n declare path: CustomPath2D;\n\n otherAttrs?: OtherAttrItem[][];\n\n constructor(\n config: { morphingData: MorphingDataItem[][]; otherAttrs?: OtherAttrItem[][] },\n duration: number,\n easing: EasingType\n ) {\n super(0, 1, duration, easing);\n this.morphingData = config.morphingData;\n this.otherAttrs = config.otherAttrs;\n }\n\n private morphingData?: MorphingDataItem[][];\n\n getEndProps(): Record<string, any> {\n return {};\n }\n\n onBind(): void {\n this.addPathProxy();\n }\n\n private addPathProxy() {\n const shadowRoot = (this.target as IGraphic).shadowRoot;\n\n shadowRoot.forEachChildren(child => {\n (child as IGraphic).createPathProxy();\n });\n\n this.onUpdate(false, 0, (this.target as IGraphic).attribute);\n }\n\n private clearPathProxy() {\n const shadowRoot = (this.target as IGraphic).shadowRoot;\n\n shadowRoot.forEachChildren(child => {\n (child as IGraphic).pathProxy = null;\n });\n }\n\n onEnd(): void {\n return;\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const shadowRoot = (this.target as IGraphic).shadowRoot;\n\n shadowRoot.forEachChildren((child: IGraphic, index) => {\n interpolateMorphingData(\n this.morphingData[index],\n typeof child.pathProxy === 'function' ? child.pathProxy(child.attribute) : child.pathProxy,\n ratio\n );\n\n if (this.otherAttrs?.[index] && this.otherAttrs[index].length) {\n interpolateOtherAttrs(this.otherAttrs[index], child.attribute, ratio);\n }\n });\n\n // 计算位置\n if (end) {\n this.clearPathProxy();\n this.morphingData = null;\n }\n }\n}\n\nconst parseShadowChildAttrs = (graphicAttrs: Partial<IGraphicAttribute>) => {\n const attrs: Partial<IGraphicAttribute> = {};\n\n Object.keys(graphicAttrs).forEach(key => {\n if (!isTransformKey(key)) {\n attrs[key] = graphicAttrs[key];\n }\n });\n\n // if (attrs.fill == null) {\n // attrs.fill = !!attrs.fillColor;\n // }\n // if (attrs.stroke == null) {\n // attrs.stroke = !!attrs.strokeColor;\n // }\n\n return attrs;\n};\n\nconst appendShadowChildrenToGraphic = (graphic: IGraphic, children: IGraphic[], count: number) => {\n const childAttrs = parseShadowChildAttrs(graphic.attribute);\n const shadowRoot = graphic.attachShadow();\n\n if (children.length) {\n shadowRoot.setTheme({\n [children[0].type]: childAttrs\n });\n children.forEach(element => {\n element.setAttributes({ pickable: false });\n shadowRoot.appendChild(element);\n });\n } else {\n const box = graphic.AABBBounds;\n const width = box.width();\n const height = box.height();\n\n shadowRoot.setTheme({\n rect: childAttrs\n });\n new Array(count).fill(0).forEach(el => {\n const child = application.graphicService.creator.rect({\n x: 0,\n y: 0,\n width,\n height: height,\n pickable: false\n });\n shadowRoot.appendChild(child);\n children.push(child);\n });\n }\n};\n\nexport const cloneGraphic = (graphic: IGraphic, count: number, needAppend?: boolean) => {\n const children: IGraphic[] = [];\n const childAttrs = needAppend ? null : parseShadowChildAttrs(graphic.attribute);\n const path = graphic.toCustomPath();\n\n for (let i = 0; i < count; i++) {\n const element = {\n path: new CustomPath2D().fromCustomPath2D(path)\n };\n\n children.push(\n application.graphicService.creator.path(needAppend ? element : Object.assign({}, childAttrs, element))\n );\n }\n\n if (needAppend) {\n appendShadowChildrenToGraphic(graphic, children, count);\n }\n\n return children;\n};\n\nexport const splitGraphic = (graphic: IGraphic, count: number, needAppend?: boolean) => {\n const children: IGraphic[] = [];\n const childAttrs = needAppend ? null : parseShadowChildAttrs(graphic.attribute);\n\n if (graphic.type === 'rect') {\n const childrenAttrs = splitRect(graphic as IRect, count);\n childrenAttrs.forEach(element => {\n children.push(\n application.graphicService.creator.rect(needAppend ? element : Object.assign({}, childAttrs, element))\n );\n });\n } else if (graphic.type === 'arc') {\n const childrenAttrs = splitArc(graphic as IArc, count);\n childrenAttrs.forEach(element => {\n children.push(\n application.graphicService.creator.arc(needAppend ? element : Object.assign({}, childAttrs, element))\n );\n });\n } else if (graphic.type === 'circle') {\n const childrenAttrs = splitCircle(graphic as ICircle, count);\n childrenAttrs.forEach(element => {\n children.push(\n application.graphicService.creator.arc(needAppend ? element : Object.assign({}, childAttrs, element))\n );\n });\n } else if (graphic.type === 'line') {\n const childrenAttrs = splitLine(graphic as ILine, count);\n const defaultSymbol = { size: 10, symbolType: 'circle' };\n\n childrenAttrs.forEach(element => {\n children.push(\n application.graphicService.creator.symbol(\n needAppend ? Object.assign({}, element, defaultSymbol) : Object.assign({}, childAttrs, element, defaultSymbol)\n )\n );\n });\n } else if (graphic.type === 'polygon') {\n const childrenAttrs = splitPolygon(graphic as IPolygon, count);\n childrenAttrs.forEach(element => {\n children.push(\n application.graphicService.creator.polygon(needAppend ? element : Object.assign({}, childAttrs, element))\n );\n });\n } else if (graphic.type === 'area') {\n const childrenAttrs = splitArea(graphic as IArea, count);\n childrenAttrs.forEach(element => {\n children.push(\n application.graphicService.creator.polygon(needAppend ? element : Object.assign({}, childAttrs, element))\n );\n });\n } else if (graphic.type === 'path') {\n const childrenAttrs = splitPath(graphic as IPath, count);\n childrenAttrs.forEach(element => {\n if ('path' in element) {\n children.push(\n application.graphicService.creator.path(needAppend ? element : Object.assign({}, childAttrs, element))\n );\n } else {\n children.push(\n application.graphicService.creator.polygon(needAppend ? element : Object.assign({}, childAttrs, element))\n );\n }\n });\n }\n\n if (needAppend) {\n appendShadowChildrenToGraphic(graphic, children, count);\n }\n\n return children;\n};\n\n/**\n * 多对一动画\n * @param fromGraphics\n * @param toGraphic\n * @param animationConfig\n */\nexport const multiToOneMorph = (\n fromGraphics: IGraphic[],\n toGraphic: IGraphic,\n animationConfig?: MultiMorphingAnimateConfig\n) => {\n const validateFromGraphics = fromGraphics.filter(graphic => graphic.toCustomPath && graphic.valid);\n if (!validateFromGraphics.length) {\n if (__DEV__) {\n console.error(fromGraphics, ' is not validate');\n }\n }\n\n if (!toGraphic.valid || !toGraphic.toCustomPath) {\n if (__DEV__) {\n console.error(toGraphic, ' is not validate');\n }\n }\n\n const childGraphics: IGraphic[] = (\n animationConfig?.splitPath === 'clone' ? cloneGraphic : animationConfig?.splitPath ?? splitGraphic\n )(toGraphic, validateFromGraphics.length, true);\n\n const toAttrs = toGraphic.attribute;\n toGraphic.setAttribute('visible', false);\n\n const morphingData = validateFromGraphics.map((graphic, index) => {\n return parseMorphingData(graphic.toCustomPath(), childGraphics[index].toCustomPath(), {\n fromTransform: graphic.globalTransMatrix,\n toTransfrom: childGraphics[index].globalTransMatrix\n });\n });\n const otherAttrs = validateFromGraphics.map((graphic, index) => {\n return parseOtherAnimateAttrs(graphic.attribute, toAttrs);\n });\n\n if (animationConfig?.individualDelay) {\n const oldOnEnd = animationConfig.onEnd;\n let count = validateFromGraphics.length;\n const onEachEnd = () => {\n count--;\n if (count === 0) {\n toGraphic.setAttributes({ visible: true, ratio: null } as any, false, {\n type: AttributeUpdateType.ANIMATE_END\n });\n toGraphic.detachShadow();\n if (oldOnEnd) {\n oldOnEnd();\n }\n }\n };\n childGraphics.forEach((to, index) => {\n const delay =\n (animationConfig.delay ?? 0) +\n animationConfig.individualDelay(index, validateFromGraphics.length, fromGraphics[index], to);\n const animate = to.animate(Object.assign({}, animationConfig, { onEnd: onEachEnd }));\n animate.wait(delay);\n\n animate.play(\n new MorphingPath(\n {\n morphingData: morphingData[index],\n saveOnEnd: true,\n otherAttrs: otherAttrs[index]\n },\n animationConfig.duration ?? DefaultMorphingAnimateConfig.duration,\n animationConfig.easing ?? DefaultMorphingAnimateConfig.easing\n )\n );\n });\n } else {\n const oldOnEnd = animationConfig?.onEnd;\n const config = animationConfig ? Object.assign({}, animationConfig) : {};\n\n config.onEnd = () => {\n toGraphic.setAttribute('visible', true, false, { type: AttributeUpdateType.ANIMATE_END });\n toGraphic.detachShadow();\n\n if (oldOnEnd) {\n oldOnEnd();\n }\n };\n\n const animate = toGraphic.animate(config);\n\n if (animationConfig?.delay) {\n animate.wait(animationConfig.delay);\n }\n\n animate.play(\n new MultiToOneMorphingPath(\n { morphingData, otherAttrs },\n animationConfig?.duration ?? DefaultMorphingAnimateConfig.duration,\n animationConfig?.easing ?? DefaultMorphingAnimateConfig.easing\n )\n );\n }\n};\n"]}
|
package/es/animate/timeline.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { IAnimate, ITimeline } from '../interface';
|
|
2
|
-
export declare class DefaultTimeline implements ITimeline {
|
|
3
|
-
id: number;
|
|
4
|
-
protected animateHead: IAnimate | null;
|
|
5
|
-
protected animateTail: IAnimate | null;
|
|
6
|
-
protected ticker: any;
|
|
7
|
-
animateCount: number;
|
|
8
|
-
protected paused: boolean;
|
|
9
|
-
constructor();
|
|
10
|
-
addAnimate(animate: IAnimate): void;
|
|
11
|
-
pause(): void;
|
|
12
|
-
resume(): void;
|
|
13
|
-
tick(delta: number): void;
|
|
14
|
-
clear(): void;
|
|
15
|
-
removeAnimate(animate: IAnimate, release?: boolean): void;
|
|
16
|
-
}
|
|
17
|
-
export declare const defaultTimeline: DefaultTimeline;
|
package/es/animate/timeline.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { AnimateStatus } from "../common/enums";
|
|
2
|
-
|
|
3
|
-
import { Generator } from "../common/generator";
|
|
4
|
-
|
|
5
|
-
export class DefaultTimeline {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.id = Generator.GenAutoIncrementId(), this.animateHead = null, this.animateTail = null,
|
|
8
|
-
this.animateCount = 0, this.paused = !1;
|
|
9
|
-
}
|
|
10
|
-
addAnimate(animate) {
|
|
11
|
-
this.animateTail ? (this.animateTail.nextAnimate = animate, animate.prevAnimate = this.animateTail,
|
|
12
|
-
this.animateTail = animate, animate.nextAnimate = null) : (this.animateHead = animate,
|
|
13
|
-
this.animateTail = animate), this.animateCount++;
|
|
14
|
-
}
|
|
15
|
-
pause() {
|
|
16
|
-
this.paused = !0;
|
|
17
|
-
}
|
|
18
|
-
resume() {
|
|
19
|
-
this.paused = !1;
|
|
20
|
-
}
|
|
21
|
-
tick(delta) {
|
|
22
|
-
if (this.paused) return;
|
|
23
|
-
let animate = this.animateHead;
|
|
24
|
-
for (this.animateCount = 0; animate; ) animate.status === AnimateStatus.END ? this.removeAnimate(animate) : animate.status === AnimateStatus.RUNNING || animate.status === AnimateStatus.INITIAL ? (this.animateCount++,
|
|
25
|
-
animate.advance(delta)) : animate.status === AnimateStatus.PAUSED && this.animateCount++,
|
|
26
|
-
animate = animate.nextAnimate;
|
|
27
|
-
}
|
|
28
|
-
clear() {
|
|
29
|
-
let animate = this.animateHead;
|
|
30
|
-
for (;animate; ) animate.release(), animate = animate.nextAnimate;
|
|
31
|
-
this.animateHead = null, this.animateTail = null, this.animateCount = 0;
|
|
32
|
-
}
|
|
33
|
-
removeAnimate(animate, release = !0) {
|
|
34
|
-
animate._onRemove && animate._onRemove.forEach((cb => cb())), animate === this.animateHead ? (this.animateHead = animate.nextAnimate,
|
|
35
|
-
animate === this.animateTail ? this.animateTail = null : this.animateHead.prevAnimate = null) : animate === this.animateTail ? (this.animateTail = animate.prevAnimate,
|
|
36
|
-
this.animateTail.nextAnimate = null) : (animate.prevAnimate.nextAnimate = animate.nextAnimate,
|
|
37
|
-
animate.nextAnimate.prevAnimate = animate.prevAnimate), release && animate.release();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export const defaultTimeline = new DefaultTimeline;
|
|
42
|
-
//# sourceMappingURL=timeline.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/animate/timeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIhD,MAAM,OAAO,eAAe;IAQ1B;QACE,IAAI,CAAC,EAAE,GAAG,SAAS,CAAC,kBAAkB,EAAE,CAAC;QACzC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,UAAU,CAAC,OAAiB;QAC1B,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;YAC3B,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;SAC5B;aAAM;YACL,IAAI,CAAC,WAAW,CAAC,WAAW,GAAG,OAAO,CAAC;YACvC,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;YACvC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;YAC3B,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;SAC5B;QACD,IAAI,CAAC,YAAY,EAAE,CAAC;IACtB,CAAC;IAED,KA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AAE,EAAE,CAAC,CAAC;QAC3D,IAAI,OAAO,KAAK,IAAI,CAAC,WAAW,EAAE;YAChC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;YACvC,IAAI,OAAO,KAAK,IAAI,CAAC,WAAW,EAAE;gBAEhC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;aACzB;iBAAM;gBAEL,IAAI,CAAC,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC;aACrC;SACF;aAAM,IAAI,OAAO,KAAK,IAAI,CAAC,WAAW,EAAE;YAEvC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;YACvC,IAAI,CAAC,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC;SAErC;aAAM;YACL,OAAO,CAAC,WAAW,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;YACtD,OAAO,CAAC,WAAW,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;SAIvD;QACD,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QAE7B,OAAO;IACT,CAAC;CACF;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC","file":"timeline.js","sourcesContent":["import { AnimateStatus } from '../common/enums';\nimport { Generator } from '../common/generator';\nimport type { IAnimate, ITimeline } from '../interface';\n\n// 管理一组动画\nexport class DefaultTimeline implements ITimeline {\n declare id: number;\n protected declare animateHead: IAnimate | null;\n protected declare animateTail: IAnimate | null;\n protected declare ticker: any;\n declare animateCount: number;\n protected declare paused: boolean;\n\n constructor() {\n this.id = Generator.GenAutoIncrementId();\n this.animateHead = null;\n this.animateTail = null;\n this.animateCount = 0;\n this.paused = false;\n }\n\n addAnimate(animate: IAnimate) {\n if (!this.animateTail) {\n this.animateHead = animate;\n this.animateTail = animate;\n } else {\n this.animateTail.nextAnimate = animate;\n animate.prevAnimate = this.animateTail;\n this.animateTail = animate;\n animate.nextAnimate = null;\n }\n this.animateCount++;\n }\n\n pause() {\n this.paused = true;\n }\n resume() {\n this.paused = false;\n }\n\n tick(delta: number) {\n if (this.paused) {\n return;\n }\n let animate = this.animateHead;\n this.animateCount = 0;\n while (animate) {\n if (animate.status === AnimateStatus.END) {\n this.removeAnimate(animate);\n } else if (animate.status === AnimateStatus.RUNNING || animate.status === AnimateStatus.INITIAL) {\n this.animateCount++;\n animate.advance(delta);\n } else if (animate.status === AnimateStatus.PAUSED) {\n // 暂停\n this.animateCount++;\n }\n animate = animate.nextAnimate;\n }\n }\n\n clear() {\n let animate = this.animateHead;\n while (animate) {\n animate.release();\n animate = animate.nextAnimate;\n }\n this.animateHead = null;\n this.animateTail = null;\n this.animateCount = 0;\n }\n\n removeAnimate(animate: IAnimate, release: boolean = true) {\n animate._onRemove && animate._onRemove.forEach(cb => cb());\n if (animate === this.animateHead) {\n this.animateHead = animate.nextAnimate;\n if (animate === this.animateTail) {\n // 只有一个元素\n this.animateTail = null;\n } else {\n // 有多个元素\n this.animateHead.prevAnimate = null;\n }\n } else if (animate === this.animateTail) {\n // 有多个元素\n this.animateTail = animate.prevAnimate;\n this.animateTail.nextAnimate = null;\n // animate.prevAnimate = null;\n } else {\n animate.prevAnimate.nextAnimate = animate.nextAnimate;\n animate.nextAnimate.prevAnimate = animate.prevAnimate;\n // animate不支持二次复用,不需要重置\n // animate.prevAnimate = null;\n // animate.nextAnimate = null;\n }\n release && animate.release();\n\n return;\n }\n}\n\nexport const defaultTimeline = new DefaultTimeline();\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugins/builtin-plugin/richtext-edit-plugin-old.ts"],"names":[],"mappings":"","file":"richtext-edit-plugin-old.js","sourcesContent":["// import type { IPointLike } from '@visactor/vutils';\n// import { isObject, isString, max, merge } from '@visactor/vutils';\n// import { Generator } from '../../common/generator';\n// import { createGroup, createLine, createRect } from '../../graphic';\n// import type {\n// IGroup,\n// ILine,\n// IPlugin,\n// IPluginService,\n// IRect,\n// IRichText,\n// IRichTextCharacter,\n// IRichTextFrame,\n// IRichTextIcon,\n// IRichTextLine,\n// IRichTextParagraph,\n// IRichTextParagraphCharacter,\n// ITicker,\n// ITimeline\n// } from '../../interface';\n// import { EditModule, findCursorIndexIgnoreLinebreak } from './edit-module';\n// import { Animate, DefaultTicker, DefaultTimeline } from '../../animate';\n\n// type UpdateType = 'input' | 'change' | 'onfocus' | 'defocus' | 'selection' | 'dispatch';\n\n// class Selection {\n// cacheSelectionStartCursorIdx: number;\n// cacheCurCursorIdx: number;\n// selectionStartCursorIdx: number;\n// curCursorIdx: number;\n// rt: IRichText;\n\n// constructor(\n// cacheSelectionStartCursorIdx: number,\n// cacheCurCursorIdx: number,\n// selectionStartCursorIdx: number,\n// curCursorIdx: number,\n// rt: IRichText\n// ) {\n// this.curCursorIdx = curCursorIdx;\n// this.selectionStartCursorIdx = selectionStartCursorIdx;\n// this.cacheCurCursorIdx = cacheCurCursorIdx;\n// this.cacheSelectionStartCursorIdx = cacheSelectionStartCursorIdx;\n// this.rt = rt;\n// }\n\n// isEmpty(): boolean {\n// return this.selectionStartCursorIdx === this.curCursorIdx;\n// }\n\n// hasFormat(key: string): boolean {\n// return this.getFormat(key) != null;\n// }\n\n// /**\n// * 获取第idx中key的值\n// * @param key\n// * @param idx cursor左侧字符的值,如果idx为-1则认为是特殊情况,为右侧字符的值\n// */\n// _getFormat(key: string, idx: number) {\n// if (!this.rt) {\n// return null;\n// }\n// const config = this.rt.attribute.textConfig as any;\n// if (idx < 0) {\n// idx = 0;\n// }\n// if (idx >= config.length) {\n// return null;\n// }\n// return config[idx][key] ?? (this.rt.attribute as any)[key];\n// }\n// getFormat(key: string): any {\n// return this.getAllFormat(key)[0];\n// }\n\n// getAllFormat(key: string): any {\n// const valSet = new Set();\n// let minCursorIdx = Math.min(this.selectionStartCursorIdx, this.curCursorIdx);\n// let maxCursorIdx = Math.max(this.selectionStartCursorIdx, this.curCursorIdx);\n// if (minCursorIdx === maxCursorIdx) {\n// return [this._getFormat(key, minCursorIdx)];\n// }\n// minCursorIdx++;\n// maxCursorIdx++;\n// const maxConfigIdx = this.rt.attribute.textConfig.length - 1;\n// if (minCursorIdx > maxConfigIdx) {\n// minCursorIdx = maxConfigIdx;\n// }\n// if (maxCursorIdx > maxConfigIdx) {\n// maxCursorIdx = maxConfigIdx;\n// }\n// for (let i = minCursorIdx; i < maxCursorIdx; i++) {\n// const val = this._getFormat(key, i);\n// val && valSet.add(val);\n// }\n// return Array.from(valSet.values());\n// }\n// }\n\n// export const FORMAT_TEXT_COMMAND = 'FORMAT_TEXT_COMMAND';\n// export const FORMAT_ELEMENT_COMMAND = 'FORMAT_ELEMENT_COMMAND';\n// export class RichTextEditPlugin implements IPlugin {\n// name: 'RichTextEditPlugin' = 'RichTextEditPlugin';\n// activeEvent: 'onRegister' = 'onRegister';\n// pluginService: IPluginService;\n// _uid: number = Generator.GenAutoIncrementId();\n// key: string = this.name + this._uid;\n// editing: boolean = false;\n// editLine: ILine;\n// editBg: IGroup;\n// pointerDown: boolean = false;\n// // 用于selection中保存上一次click时候的位置\n// lastPoint?: IPointLike;\n// editModule: EditModule;\n// currRt: IRichText;\n\n// // 当前的cursor信息\n// // 0.1为第一个字符右侧, -0.1为第一个字符左侧\n// // 1.1为第二个字符右侧,0.9为第二个字符左侧\n// curCursorIdx: number;\n// selectionStartCursorIdx: number;\n\n// commandCbs: Map<string, Array<(payload: any, p: RichTextEditPlugin) => void>>;\n// updateCbs: Array<(type: UpdateType, p: RichTextEditPlugin) => void>;\n\n// ticker: ITicker;\n// timeline: ITimeline;\n\n// // 富文本有align或者baseline的时候,需要对光标做偏移\n// protected declare deltaX: number;\n// protected declare deltaY: number;\n\n// constructor() {\n// this.commandCbs = new Map();\n// this.commandCbs.set(FORMAT_TEXT_COMMAND, [this.formatTextCommandCb]);\n// this.updateCbs = [];\n// this.timeline = new DefaultTimeline();\n// this.ticker = new DefaultTicker([this.timeline]);\n// this.deltaX = 0;\n// this.deltaY = 0;\n// }\n\n// static CreateSelection(rt: IRichText) {\n// if (!rt) {\n// return null;\n// }\n// const { textConfig = [] } = rt.attribute;\n// return new Selection(\n// -1,\n// textConfig.length - 1,\n// findCursorIndexIgnoreLinebreak(textConfig, -1),\n// findCursorIndexIgnoreLinebreak(textConfig, textConfig.length - 1),\n// rt\n// );\n// }\n\n// /**\n// * 获取当前选择的区间范围\n// * @param defaultAll 如果force为true,又没有选择,则认为选择了所有然后进行匹配,如果为false,则认为什么都没有选择,返回null\n// * @returns\n// */\n// getSelection(defaultAll: boolean = false) {\n// if (!this.currRt) {\n// return null;\n// }\n// if (\n// this.selectionStartCursorIdx != null &&\n// this.curCursorIdx != null\n// // this.selectionStartCursorIdx !== this.curCursorIdx &&\n// ) {\n// return new Selection(\n// this.selectionStartCursorIdx,\n// this.curCursorIdx,\n// findCursorIndexIgnoreLinebreak(this.currRt.attribute.textConfig, this.selectionStartCursorIdx),\n// findCursorIndexIgnoreLinebreak(this.currRt.attribute.textConfig, this.curCursorIdx),\n// this.currRt\n// );\n// } else if (defaultAll) {\n// return RichTextEditPlugin.CreateSelection(this.currRt);\n// }\n// return null;\n// }\n\n// /* command */\n// formatTextCommandCb(payload: string, p: RichTextEditPlugin) {\n// const rt = p.currRt;\n// if (!rt) {\n// return;\n// }\n// const selectionData = p.getSelection();\n// if (!selectionData) {\n// return;\n// }\n// const { selectionStartCursorIdx, curCursorIdx } = selectionData;\n// const minCursorIdx = Math.min(selectionStartCursorIdx, curCursorIdx);\n// const maxCursorIdx = Math.max(selectionStartCursorIdx, curCursorIdx);\n// const config = rt.attribute.textConfig.slice(minCursorIdx + 1, maxCursorIdx + 1);\n// if (payload === 'bold') {\n// config.forEach((item: IRichTextParagraphCharacter) => (item.fontWeight = 'bold'));\n// } else if (payload === 'italic') {\n// config.forEach((item: IRichTextParagraphCharacter) => (item.fontStyle = 'italic'));\n// } else if (payload === 'underline') {\n// config.forEach((item: IRichTextParagraphCharacter) => (item.underline = true));\n// } else if (payload === 'lineThrough') {\n// config.forEach((item: IRichTextParagraphCharacter) => (item.lineThrough = true));\n// } else if (isObject(payload)) {\n// config.forEach((item: IRichTextParagraphCharacter) => merge(item, payload));\n// }\n// rt.setAttributes(rt.attribute);\n// }\n\n// dispatchCommand(command: string, payload: any) {\n// const cbs = this.commandCbs.get(command);\n// cbs && cbs.forEach(cb => cb(payload, this));\n// this.updateCbs.forEach(cb => cb('dispatch', this));\n// }\n\n// registerCommand(command: string, cb: (payload: any, p: RichTextEditPlugin) => void) {\n// const cbs: Array<(payload: any, p: RichTextEditPlugin) => void> = this.commandCbs.get(command) || [];\n// cbs.push(cb);\n// }\n\n// registerUpdateListener(cb: (type: UpdateType, p: RichTextEditPlugin) => void) {\n// const cbs = this.updateCbs || [];\n// cbs.push(cb);\n// }\n\n// activate(context: IPluginService): void {\n// this.pluginService = context;\n// this.editModule = new EditModule();\n// // context.stage.on('click', this.handleClick);\n// context.stage.on('pointermove', this.handleMove);\n// context.stage.on('pointerdown', this.handlePointerDown);\n// context.stage.on('pointerup', this.handlePointerUp);\n// context.stage.on('pointerleave', this.handlePointerUp);\n\n// this.editModule.onInput(this.handleInput);\n// this.editModule.onChange(this.handleChange);\n// }\n\n// handleInput = (text: string, isComposing: boolean, cursorIdx: number, rt: IRichText, orient: 'left' | 'right') => {\n// // 修改cursor的位置,但并不同步,因为这可能是临时的\n// const p = this.getPointByColumnIdx(cursorIdx, rt, orient);\n// this.hideSelection();\n// this.setCursor(p.x, p.y1, p.y2);\n// this.updateCbs.forEach(cb => cb('input', this));\n// };\n// handleChange = (text: string, isComposing: boolean, cursorIdx: number, rt: IRichText, orient: 'left' | 'right') => {\n// // 修改cursor的位置,并同步到editModule\n// const p = this.getPointByColumnIdx(cursorIdx, rt, orient);\n// this.curCursorIdx = cursorIdx;\n// this.selectionStartCursorIdx = cursorIdx;\n// this.setCursorAndTextArea(p.x, p.y1, p.y2, rt);\n// this.hideSelection();\n// this.updateCbs.forEach(cb => cb('change', this));\n// };\n\n// handleMove = (e: PointerEvent) => {\n// if (!this.isRichtext(e)) {\n// return;\n// }\n// this.currRt = e.target as IRichText;\n// this.handleEnter(e);\n// (e.target as any).once('pointerleave', this.handleLeave);\n\n// this.showSelection(e);\n// };\n\n// showSelection(e: PointerEvent) {\n// const cache = (e.target as IRichText).getFrameCache();\n// if (!(cache && this.editBg)) {\n// return;\n// }\n// if (this.pointerDown) {\n// let p0 = this.lastPoint;\n// // 计算p1在字符中的位置\n// let p1 = this.getEventPosition(e);\n// let line1Info = this.getLineByPoint(cache, p1);\n// if (!line1Info) {\n// return;\n// }\n// const column1 = this.getColumnByLinePoint(line1Info, p1);\n// const y1 = line1Info.top;\n// const y2 = line1Info.top + line1Info.height;\n// let x = column1.left + column1.width;\n// let cursorIndex = this.getColumnIndex(cache, column1);\n// if (p1.x < column1.left + column1.width / 2) {\n// x = column1.left;\n// cursorIndex -= 1;\n// }\n// p1.x = x;\n// p1.y = (y1 + y2) / 2;\n// let line0Info = this.getLineByPoint(cache, p0);\n// if (p0.y > p1.y || (p0.y === p1.y && p0.x > p1.x)) {\n// [p0, p1] = [p1, p0];\n// [line1Info, line0Info] = [line0Info, line1Info];\n// }\n\n// this.editBg.removeAllChild();\n// if (line0Info === line1Info) {\n// // const column0 = this.getColumnByLinePoint(line0Info, p0);\n// this.editBg.setAttributes({\n// x: p0.x,\n// y: line0Info.top,\n// width: p1.x - p0.x,\n// height: line0Info.height,\n// fill: '#336df4',\n// fillOpacity: 0.2\n// });\n// } else {\n// this.editBg.setAttributes({ x: 0, y: line0Info.top, width: 0, height: 0 });\n// const startIdx = cache.lines.findIndex(item => item === line0Info);\n// const endIdx = cache.lines.findIndex(item => item === line1Info);\n// let y = 0;\n// for (let i = startIdx; i <= endIdx; i++) {\n// const line = cache.lines[i];\n// if (i === startIdx) {\n// const p = line.paragraphs[line.paragraphs.length - 1];\n// this.editBg.add(\n// createRect({\n// x: p0.x,\n// y,\n// width: p.left + p.width - p0.x,\n// height: line.height,\n// fill: '#336df4',\n// fillOpacity: 0.2\n// })\n// );\n// } else if (i === endIdx) {\n// const p = line.paragraphs[0];\n// this.editBg.add(\n// createRect({\n// x: p.left,\n// y,\n// width: p1.x - p.left,\n// height: line.height,\n// fill: '#336df4',\n// fillOpacity: 0.2\n// })\n// );\n// } else {\n// const p0 = line.paragraphs[0];\n// const p1 = line.paragraphs[line.paragraphs.length - 1];\n// this.editBg.add(\n// createRect({\n// x: p0.left,\n// y,\n// width: p1.left + p1.width - p0.left,\n// height: line.height,\n// fill: '#336df4',\n// fillOpacity: 0.2\n// })\n// );\n// }\n// y += line.height;\n// }\n// }\n\n// this.curCursorIdx = cursorIndex;\n// this.setCursorAndTextArea(x, y1 + 2, y2 - 2, e.target as IRichText);\n\n// this.applyUpdate();\n// this.updateCbs.forEach(cb => cb('selection', this));\n// }\n// }\n\n// hideSelection() {\n// if (this.editBg) {\n// this.editBg.removeAllChild();\n// this.editBg.setAttributes({ fill: 'transparent' });\n// }\n// }\n\n// handlePointerDown = (e: PointerEvent) => {\n// if (this.editing) {\n// this.onFocus(e);\n// } else {\n// this.deFocus(e);\n// }\n// this.applyUpdate();\n// this.pointerDown = true;\n// this.updateCbs.forEach(cb => cb(this.editing ? 'onfocus' : 'defocus', this));\n// console.log(this.selectionStartCursorIdx);\n// };\n// handlePointerUp = (e: PointerEvent) => {\n// this.pointerDown = false;\n// };\n\n// forceFocus(e: PointerEvent) {\n// this.handleEnter(e);\n// this.handlePointerDown(e);\n// this.handlePointerUp(e);\n// }\n\n// // 鼠标进入\n// handleEnter = (e: PointerEvent) => {\n// this.editing = true;\n// this.pluginService.stage.setCursor('text');\n// };\n\n// // 鼠标离开\n// handleLeave = (e: PointerEvent) => {\n// this.editing = false;\n// this.pluginService.stage.setCursor('default');\n// };\n\n// isRichtext(e: PointerEvent) {\n// return !!(e.target && (e.target as any).type === 'richtext' && (e.target as any).attribute.editable);\n// }\n\n// protected getEventPosition(e: PointerEvent): IPointLike {\n// const p = this.pluginService.stage.eventPointTransform(e);\n\n// const p1 = { x: 0, y: 0 };\n// (e.target as IRichText).globalTransMatrix.transformPoint(p, p1);\n// p1.x -= this.deltaX;\n// p1.y -= this.deltaY;\n// return p1;\n// }\n\n// protected getLineByPoint(cache: IRichTextFrame, p1: IPointLike): IRichTextLine {\n// let lineInfo = cache.lines[0];\n// for (let i = 0; i < cache.lines.length; i++) {\n// if (lineInfo.top <= p1.y && lineInfo.top + lineInfo.height >= p1.y) {\n// break;\n// }\n// lineInfo = cache.lines[i + 1];\n// }\n\n// return lineInfo;\n// }\n// protected getColumnByLinePoint(lineInfo: IRichTextLine, p1: IPointLike): IRichTextParagraph | IRichTextIcon {\n// let columnInfo = lineInfo.paragraphs[0];\n// for (let i = 0; i < lineInfo.paragraphs.length; i++) {\n// if (columnInfo.left <= p1.x && columnInfo.left + columnInfo.width >= p1.x) {\n// break;\n// }\n// columnInfo = lineInfo.paragraphs[i];\n// }\n\n// return columnInfo;\n// }\n\n// onFocus(e: PointerEvent) {\n// this.deFocus(e);\n// this.currRt = e.target as IRichText;\n\n// // 添加shadowGraphic\n// const target = e.target as IRichText;\n// RichTextEditPlugin.tryUpdateRichtext(target);\n// const shadowRoot = target.attachShadow();\n// const cache = target.getFrameCache();\n// if (!cache) {\n// return;\n// }\n\n// this.deltaX = 0;\n// this.deltaY = 0;\n// const height = cache.actualHeight;\n// const width = cache.lines.reduce((w, item) => Math.max(w, item.actualWidth), 0);\n// if (cache.globalAlign === 'center') {\n// this.deltaX = -width / 2;\n// } else if (cache.globalAlign === 'right') {\n// this.deltaX = -width;\n// }\n// if (cache.globalBaseline === 'middle') {\n// this.deltaY = -height / 2;\n// } else if (cache.globalBaseline === 'bottom') {\n// this.deltaY = -height;\n// }\n\n// shadowRoot.setAttributes({ shadowRootIdx: -1, x: this.deltaX, y: this.deltaY });\n// if (!this.editLine) {\n// const line = createLine({ x: 0, y: 0, lineWidth: 1, stroke: 'black' });\n// // 不使用stage的Ticker,避免影响其他的动画以及受到其他动画影响\n// const animate = line.animate();\n// animate.setTimeline(this.timeline);\n// animate.to({ opacity: 1 }, 10, 'linear').wait(700).to({ opacity: 0 }, 10, 'linear').wait(700).loop(Infinity);\n// this.editLine = line;\n// this.ticker.start(true);\n\n// const g = createGroup({ x: 0, y: 0, width: 0, height: 0 });\n// this.editBg = g;\n// shadowRoot.add(this.editLine);\n// shadowRoot.add(this.editBg);\n// }\n\n// const p1 = this.getEventPosition(e);\n\n// const lineInfo = this.getLineByPoint(cache, p1);\n\n// if (lineInfo) {\n// const columnInfo = this.getColumnByLinePoint(lineInfo, p1);\n// if (!columnInfo) {\n// return;\n// }\n\n// let y1 = lineInfo.top;\n// let y2 = lineInfo.top + lineInfo.height;\n// let x = columnInfo.left + columnInfo.width;\n// y1 += 2;\n// y2 -= 2;\n// let cursorIndex = this.getColumnIndex(cache, columnInfo);\n// if (p1.x < columnInfo.left + columnInfo.width / 2) {\n// x = columnInfo.left;\n// cursorIndex -= 1;\n// }\n\n// this.lastPoint = { x, y: (y1 + y2) / 2 };\n\n// this.curCursorIdx = cursorIndex;\n// this.selectionStartCursorIdx = cursorIndex;\n// this.setCursorAndTextArea(x, y1, y2, target);\n// }\n// }\n\n// protected getPointByColumnIdx(idx: number, rt: IRichText, orient: 'left' | 'right') {\n// const cache = rt.getFrameCache();\n// const column = this.getColumnByIndex(cache, idx);\n// const height = rt.attribute.fontSize ?? (rt.attribute.textConfig?.[0] as any)?.fontSize;\n// if (!column) {\n// return {\n// x: 0,\n// y1: 0,\n// y2: height\n// };\n// }\n// const { lineInfo, columnInfo } = column;\n// let y1 = lineInfo.top;\n// let y2 = lineInfo.top + lineInfo.height;\n// const x = columnInfo.left + (orient === 'left' ? 0 : columnInfo.width);\n// y1 += 2;\n// y2 -= 2;\n\n// return { x, y1, y2 };\n// }\n\n// protected getColumnIndex(cache: IRichTextFrame, cInfo: IRichTextParagraph | IRichTextIcon) {\n// // TODO 认为都是单个字符拆分的\n// let inputIndex = -1;\n// for (let i = 0; i < cache.lines.length; i++) {\n// const line = cache.lines[i];\n// for (let j = 0; j < line.paragraphs.length; j++) {\n// inputIndex++;\n// if (cInfo === line.paragraphs[j]) {\n// return inputIndex;\n// }\n// }\n// }\n// return -1;\n// }\n// protected getColumnByIndex(\n// cache: IRichTextFrame,\n// index: number\n// ): {\n// lineInfo: IRichTextLine;\n// columnInfo: IRichTextParagraph | IRichTextIcon;\n// } | null {\n// // TODO 认为都是单个字符拆分的\n// let inputIndex = -1;\n// for (let i = 0; i < cache.lines.length; i++) {\n// const lineInfo = cache.lines[i];\n// for (let j = 0; j < lineInfo.paragraphs.length; j++) {\n// const columnInfo = lineInfo.paragraphs[j];\n// inputIndex++;\n// if (inputIndex === index) {\n// return {\n// lineInfo,\n// columnInfo\n// };\n// }\n// }\n// }\n// return null;\n// }\n\n// protected setCursorAndTextArea(x: number, y1: number, y2: number, rt: IRichText) {\n// this.editLine.setAttributes({\n// points: [\n// { x, y: y1 },\n// { x, y: y2 }\n// ]\n// });\n// const out = { x: 0, y: 0 };\n// rt.globalTransMatrix.getInverse().transformPoint({ x, y: y1 }, out);\n// // TODO 考虑stage变换\n// const { left, top } = this.pluginService.stage.window.getBoundingClientRect();\n// out.x += left;\n// out.y += top;\n\n// this.editModule.moveTo(out.x, out.y, rt, this.curCursorIdx, this.selectionStartCursorIdx);\n// }\n// protected setCursor(x: number, y1: number, y2: number) {\n// this.editLine.setAttributes({\n// points: [\n// { x, y: y1 },\n// { x, y: y2 }\n// ]\n// });\n// }\n\n// applyUpdate() {\n// this.pluginService.stage.renderNextFrame();\n// }\n// deFocus(e: PointerEvent) {\n// const target = this.currRt as IRichText;\n// if (!target) {\n// return;\n// }\n// target.detachShadow();\n// this.currRt = null;\n// if (this.editLine) {\n// this.editLine.parent.removeChild(this.editLine);\n// this.editLine.release();\n// this.editLine = null;\n\n// this.editBg.parent.removeChild(this.editBg);\n// this.editBg.release();\n// this.editBg = null;\n// }\n// }\n\n// static splitText(text: string) {\n// // 😁这种emoji长度算两个,所以得处理一下\n// return Array.from(text);\n// }\n\n// static tryUpdateRichtext(richtext: IRichText) {\n// const cache = richtext.getFrameCache();\n// if (\n// !cache.lines.every(line =>\n// line.paragraphs.every(\n// item => !(item.text && isString(item.text) && RichTextEditPlugin.splitText(item.text).length > 1)\n// )\n// )\n// ) {\n// const tc: IRichTextCharacter[] = [];\n// richtext.attribute.textConfig.forEach((item: IRichTextParagraphCharacter) => {\n// const textList = RichTextEditPlugin.splitText(item.text.toString());\n// if (isString(item.text) && textList.length > 1) {\n// // 拆分\n// for (let i = 0; i < textList.length; i++) {\n// const t = textList[i];\n// tc.push({ ...item, text: t });\n// }\n// } else {\n// tc.push(item);\n// }\n// });\n// richtext.setAttributes({ textConfig: tc });\n// richtext.doUpdateFrameCache(tc);\n// }\n// }\n\n// onSelect() {\n// return;\n// }\n\n// deactivate(context: IPluginService): void {\n// // context.stage.off('pointerdown', this.handleClick);\n// context.stage.off('pointermove', this.handleMove);\n// context.stage.off('pointerdown', this.handlePointerDown);\n// context.stage.off('pointerup', this.handlePointerUp);\n// context.stage.off('pointerleave', this.handlePointerUp);\n// }\n\n// release() {\n// this.editModule.release();\n// }\n// }\n"]}
|