@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
|
@@ -56,6 +56,7 @@ export interface IWindow extends Releaseable, Omit<IEventElement, 'on' | 'off' |
|
|
|
56
56
|
top: number;
|
|
57
57
|
left: number;
|
|
58
58
|
};
|
|
59
|
+
setEventListenerTransformer: (transformer: (event: Event) => Event) => void;
|
|
59
60
|
}
|
|
60
61
|
export interface IWindowHandlerContribution extends IContribution<IWindow>, Omit<IEventElement, 'on' | 'off' | 'once' | 'emit' | 'removeAllListeners'> {
|
|
61
62
|
container?: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/interface/window.ts"],"names":[],"mappings":"","file":"window.js","sourcesContent":["// window为内部对象,属性均为stage传入\n\nimport type { IBounds, IBoundsLike, IMatrix, IPointLike } from '@visactor/vutils';\nimport type { ICanvas } from './canvas';\nimport type { IContext2d } from './context';\nimport type { IDomRectLike, IEventElement, Releaseable } from './common';\nimport type { ISyncHook } from './sync-hook';\nimport type { IContribution } from './contribution';\nimport type { IGlobal } from './global';\n\n// TODO: 参数考虑动态注入,比如CreateWindow是native的专用接口\nexport interface IWindowParams {\n canvas?: string | HTMLCanvasElement;\n offscreen?: boolean;\n width?: number;\n height?: number;\n viewBox?: IBoundsLike;\n x?: number;\n y?: number;\n dpr: number;\n container?: string | HTMLElement;\n canvasControled: boolean;\n title: string;\n CreateWindow?: (w: number, h: number, title: string) => void;\n}\n\nexport interface IWindow\n extends Releaseable,\n Omit<IEventElement, 'on' | 'off' | 'once' | 'emit' | 'removeAllListeners'> {\n hooks: {\n onChange: ISyncHook<[number, number, number, number]>;\n };\n // 窗口的大小\n width: number;\n height: number;\n // // 窗口的位置\n // x: number;\n // y: number;\n // 窗口操作配置\n resizable: boolean;\n minHeight: number;\n minWidth: number;\n maxHeight: number;\n maxWidth: number;\n // 窗口配置\n title: string;\n dpr: number;\n style: CSSStyleDeclaration | Record<string, any>;\n\n create: (options: IWindowParams) => void;\n setWindowHandler: (handler: IWindowHandlerContribution) => void;\n setDpr: (dpr: number) => void;\n resize: (w: number, h: number) => void;\n configure: () => void;\n\n // 获取上下文和canvas,可以是2d也可以是GL\n getContext: () => IContext2d;\n getNativeHandler: () => ICanvas;\n getContainer: () => HTMLElement | any;\n getImageBuffer: (type?: string) => any;\n\n clearViewBox: (color?: string) => void;\n setViewBox: (vb: IBoundsLike) => void;\n getViewBox: () => IBounds;\n setViewBoxTransform: (a: number, b: number, c: number, d: number, e: number, f: number) => void;\n getViewBoxTransform: () => IMatrix;\n hasSubView: () => boolean;\n pointTransform: (x: number, y: number) => IPointLike;\n\n getBoundingClientRect: () => IDomRectLike;\n\n isVisible: (bbox?: IBoundsLike) => boolean;\n\n onVisibleChange: (cb: (currentVisible: boolean) => void) => void;\n\n getTopLeft: (baseWindow?: boolean) => { top: number; left: number };\n}\n\nexport interface IWindowHandlerContribution\n extends IContribution<IWindow>,\n Omit<IEventElement, 'on' | 'off' | 'once' | 'emit' | 'removeAllListeners'> {\n container?: any;\n\n configure: (window: IWindow, global: IGlobal) => void;\n createWindow: (params: IWindowParams) => void;\n releaseWindow: () => void;\n resizeWindow: (width: number, height: number) => void;\n setDpr: (dpr: number) => void;\n getDpr: () => number;\n getWH: () => { width: number; height: number };\n getXY: () => { x: number; y: number };\n getTitle: () => string;\n\n // 获取上下文和canvas,可以是2d也可以是GL\n getContext: () => IContext2d;\n getNativeHandler: () => ICanvas;\n getImageBuffer?: (type?: string) => any;\n release: (...params: any) => void;\n\n getStyle: () => CSSStyleDeclaration | Record<string, any>;\n setStyle: (s: CSSStyleDeclaration | Record<string, any>) => void;\n\n getBoundingClientRect: () => IDomRectLike;\n clearViewBox: (color?: string) => void;\n setViewBox: (vb: IBoundsLike) => void;\n getViewBox: () => IBounds;\n setViewBoxTransform: (a: number, b: number, c: number, d: number, e: number, f: number) => void;\n getViewBoxTransform: () => IMatrix;\n isVisible: (bbox?: IBoundsLike) => boolean;\n\n onVisibleChange: (cb: (currentVisible: boolean) => void) => void;\n getTopLeft: (baseWindow?: boolean) => { top: number; left: number };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/interface/window.ts"],"names":[],"mappings":"","file":"window.js","sourcesContent":["// window为内部对象,属性均为stage传入\n\nimport type { IBounds, IBoundsLike, IMatrix, IPointLike } from '@visactor/vutils';\nimport type { ICanvas } from './canvas';\nimport type { IContext2d } from './context';\nimport type { IDomRectLike, IEventElement, Releaseable } from './common';\nimport type { ISyncHook } from './sync-hook';\nimport type { IContribution } from './contribution';\nimport type { IGlobal } from './global';\n\n// TODO: 参数考虑动态注入,比如CreateWindow是native的专用接口\nexport interface IWindowParams {\n canvas?: string | HTMLCanvasElement;\n offscreen?: boolean;\n width?: number;\n height?: number;\n viewBox?: IBoundsLike;\n x?: number;\n y?: number;\n dpr: number;\n container?: string | HTMLElement;\n canvasControled: boolean;\n title: string;\n CreateWindow?: (w: number, h: number, title: string) => void;\n}\n\nexport interface IWindow\n extends Releaseable,\n Omit<IEventElement, 'on' | 'off' | 'once' | 'emit' | 'removeAllListeners'> {\n hooks: {\n onChange: ISyncHook<[number, number, number, number]>;\n };\n // 窗口的大小\n width: number;\n height: number;\n // // 窗口的位置\n // x: number;\n // y: number;\n // 窗口操作配置\n resizable: boolean;\n minHeight: number;\n minWidth: number;\n maxHeight: number;\n maxWidth: number;\n // 窗口配置\n title: string;\n dpr: number;\n style: CSSStyleDeclaration | Record<string, any>;\n\n create: (options: IWindowParams) => void;\n setWindowHandler: (handler: IWindowHandlerContribution) => void;\n setDpr: (dpr: number) => void;\n resize: (w: number, h: number) => void;\n configure: () => void;\n\n // 获取上下文和canvas,可以是2d也可以是GL\n getContext: () => IContext2d;\n getNativeHandler: () => ICanvas;\n getContainer: () => HTMLElement | any;\n getImageBuffer: (type?: string) => any;\n\n clearViewBox: (color?: string) => void;\n setViewBox: (vb: IBoundsLike) => void;\n getViewBox: () => IBounds;\n setViewBoxTransform: (a: number, b: number, c: number, d: number, e: number, f: number) => void;\n getViewBoxTransform: () => IMatrix;\n hasSubView: () => boolean;\n pointTransform: (x: number, y: number) => IPointLike;\n\n getBoundingClientRect: () => IDomRectLike;\n\n isVisible: (bbox?: IBoundsLike) => boolean;\n\n onVisibleChange: (cb: (currentVisible: boolean) => void) => void;\n\n getTopLeft: (baseWindow?: boolean) => { top: number; left: number };\n\n setEventListenerTransformer: (transformer: (event: Event) => Event) => void;\n}\n\nexport interface IWindowHandlerContribution\n extends IContribution<IWindow>,\n Omit<IEventElement, 'on' | 'off' | 'once' | 'emit' | 'removeAllListeners'> {\n container?: any;\n\n configure: (window: IWindow, global: IGlobal) => void;\n createWindow: (params: IWindowParams) => void;\n releaseWindow: () => void;\n resizeWindow: (width: number, height: number) => void;\n setDpr: (dpr: number) => void;\n getDpr: () => number;\n getWH: () => { width: number; height: number };\n getXY: () => { x: number; y: number };\n getTitle: () => string;\n\n // 获取上下文和canvas,可以是2d也可以是GL\n getContext: () => IContext2d;\n getNativeHandler: () => ICanvas;\n getImageBuffer?: (type?: string) => any;\n release: (...params: any) => void;\n\n getStyle: () => CSSStyleDeclaration | Record<string, any>;\n setStyle: (s: CSSStyleDeclaration | Record<string, any>) => void;\n\n getBoundingClientRect: () => IDomRectLike;\n clearViewBox: (color?: string) => void;\n setViewBox: (vb: IBoundsLike) => void;\n getViewBox: () => IBounds;\n setViewBoxTransform: (a: number, b: number, c: number, d: number, e: number, f: number) => void;\n getViewBoxTransform: () => IMatrix;\n isVisible: (bbox?: IBoundsLike) => boolean;\n\n onVisibleChange: (cb: (currentVisible: boolean) => void) => void;\n getTopLeft: (baseWindow?: boolean) => { top: number; left: number };\n}\n"]}
|
package/cjs/modules.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IGlobal, IGraphicService } from './interface';
|
|
1
|
+
import type { IGlobal, IGraphicService, IRenderService } from './interface';
|
|
2
2
|
import type { IGraphicUtil, ILayerService, ITransformUtil } from './interface/core';
|
|
3
3
|
export declare function preLoadAllModule(): void;
|
|
4
4
|
export declare namespace preLoadAllModule {
|
|
@@ -8,4 +8,5 @@ export declare const vglobal: IGlobal;
|
|
|
8
8
|
export declare const graphicUtil: IGraphicUtil;
|
|
9
9
|
export declare const transformUtil: ITransformUtil;
|
|
10
10
|
export declare const graphicService: IGraphicService;
|
|
11
|
+
export declare const renderService: IRenderService;
|
|
11
12
|
export declare const layerService: ILayerService;
|
package/cjs/modules.js
CHANGED
|
@@ -8,9 +8,9 @@ var __importDefault = this && this.__importDefault || function(mod) {
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", {
|
|
10
10
|
value: !0
|
|
11
|
-
}), exports.layerService = exports.graphicService = exports.transformUtil = exports.graphicUtil = exports.vglobal = exports.preLoadAllModule = void 0;
|
|
11
|
+
}), exports.layerService = exports.renderService = exports.graphicService = exports.transformUtil = exports.graphicUtil = exports.vglobal = exports.preLoadAllModule = void 0;
|
|
12
12
|
|
|
13
|
-
const core_modules_1 = __importDefault(require("./core/core-modules")), render_modules_1 = __importDefault(require("./render/render-modules")), pick_modules_1 = __importDefault(require("./picker/pick-modules")), graphic_module_1 = __importDefault(require("./graphic/graphic-service/graphic-module")), plugin_modules_1 = __importDefault(require("./plugins/plugin-modules")), modules_1 = __importDefault(require("./core/contributions/modules")), modules_2 = __importDefault(require("./render/contributions/modules")), constants_1 = require("./core/constants"), application_1 = require("./application"), constants_2 = require("./graphic/constants"), constants_3 = require("./core/constants"), container_1 = require("./container"), constants_4 = require("./constants");
|
|
13
|
+
const core_modules_1 = __importDefault(require("./core/core-modules")), render_modules_1 = __importDefault(require("./render/render-modules")), pick_modules_1 = __importDefault(require("./picker/pick-modules")), graphic_module_1 = __importDefault(require("./graphic/graphic-service/graphic-module")), plugin_modules_1 = __importDefault(require("./plugins/plugin-modules")), modules_1 = __importDefault(require("./core/contributions/modules")), modules_2 = __importDefault(require("./render/contributions/modules")), constants_1 = require("./core/constants"), application_1 = require("./application"), constants_2 = require("./graphic/constants"), constants_3 = require("./core/constants"), container_1 = require("./container"), constants_4 = require("./constants"), render_1 = require("./render");
|
|
14
14
|
|
|
15
15
|
function preLoadAllModule() {
|
|
16
16
|
preLoadAllModule.__loaded || (preLoadAllModule.__loaded = !0, container_1.container.load(core_modules_1.default),
|
|
@@ -24,6 +24,7 @@ exports.vglobal = container_1.container.get(constants_4.VGlobal), application_1.
|
|
|
24
24
|
exports.graphicUtil = container_1.container.get(constants_3.GraphicUtil), application_1.application.graphicUtil = exports.graphicUtil,
|
|
25
25
|
exports.transformUtil = container_1.container.get(constants_3.TransformUtil), application_1.application.transformUtil = exports.transformUtil,
|
|
26
26
|
exports.graphicService = container_1.container.get(constants_2.GraphicService),
|
|
27
|
-
application_1.application.graphicService = exports.graphicService, exports.
|
|
27
|
+
application_1.application.graphicService = exports.graphicService, exports.renderService = container_1.container.get(render_1.RenderService),
|
|
28
|
+
application_1.application.renderService = exports.renderService, exports.layerService = container_1.container.get(constants_1.LayerService),
|
|
28
29
|
application_1.application.layerService = exports.layerService;
|
|
29
30
|
//# sourceMappingURL=modules.js.map
|
package/cjs/modules.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/modules.ts"],"names":[],"mappings":";;;;;;AAAA,uEAA6C;AAC7C,6EAAmD;AACnD,yEAA+C;AAE/C,8FAAqE;AACrE,8EAAoD;AACpD,2EAAoE;AACpE,6EAAqE;AAGrE,gDAAgD;AAIhD,+CAA4C;AAE5C,mDAAqD;AACrD,gDAA8D;AAC9D,2CAAwC;AACxC,2CAAsC;
|
|
1
|
+
{"version":3,"sources":["../src/modules.ts"],"names":[],"mappings":";;;;;;AAAA,uEAA6C;AAC7C,6EAAmD;AACnD,yEAA+C;AAE/C,8FAAqE;AACrE,8EAAoD;AACpD,2EAAoE;AACpE,6EAAqE;AAGrE,gDAAgD;AAIhD,+CAA4C;AAE5C,mDAAqD;AACrD,gDAA8D;AAC9D,2CAAwC;AACxC,2CAAsC;AACtC,qCAAyC;AAEzC,SAAgB,gBAAgB;IAC9B,IAAI,gBAAgB,CAAC,QAAQ,EAAE;QAC7B,OAAO;KACR;IACD,gBAAgB,CAAC,QAAQ,GAAG,IAAI,CAAC;IACjC,qBAAS,CAAC,IAAI,CAAC,sBAAU,CAAC,CAAC;IAC3B,qBAAS,CAAC,IAAI,CAAC,wBAAa,CAAC,CAAC;IAC9B,qBAAS,CAAC,IAAI,CAAC,wBAAY,CAAC,CAAC;IAC7B,qBAAS,CAAC,IAAI,CAAC,sBAAU,CAAC,CAAC;IAE3B,qBAAS,CAAC,IAAI,CAAC,wBAAY,CAAC,CAAC;IAC7B,IAAA,iBAAwB,EAAC,qBAAS,CAAC,CAAC;IACpC,IAAA,iBAAuB,EAAC,qBAAS,CAAC,CAAC;AACrC,CAAC;AAbD,4CAaC;AAED,gBAAgB,CAAC,QAAQ,GAAG,KAAK,CAAC;AAElC,gBAAgB,EAAE,CAAC;AAKN,QAAA,OAAO,GAAG,qBAAS,CAAC,GAAG,CAAU,mBAAO,CAAC,CAAC;AACvD,yBAAW,CAAC,MAAM,GAAG,eAAO,CAAC;AAChB,QAAA,WAAW,GAAG,qBAAS,CAAC,GAAG,CAAe,uBAAW,CAAC,CAAC;AACpE,yBAAW,CAAC,WAAW,GAAG,mBAAW,CAAC;AACzB,QAAA,aAAa,GAAG,qBAAS,CAAC,GAAG,CAAiB,yBAAa,CAAC,CAAC;AAC1E,yBAAW,CAAC,aAAa,GAAG,qBAAa,CAAC;AAC7B,QAAA,cAAc,GAAG,qBAAS,CAAC,GAAG,CAAkB,0BAAc,CAAC,CAAC;AAC7E,yBAAW,CAAC,cAAc,GAAG,sBAAc,CAAC;AAC/B,QAAA,aAAa,GAAG,qBAAS,CAAC,GAAG,CAAiB,sBAAa,CAAC,CAAC;AAC1E,yBAAW,CAAC,aAAa,GAAG,qBAAa,CAAC;AAa7B,QAAA,YAAY,GAAG,qBAAS,CAAC,GAAG,CAAgB,wBAAY,CAAC,CAAC;AACvE,yBAAW,CAAC,YAAY,GAAG,oBAAY,CAAC","file":"modules.js","sourcesContent":["import coreModule from './core/core-modules';\nimport renderModule from './render/render-modules';\nimport pickModule from './picker/pick-modules';\n// import allocatorModule from './allocator/allocator-modules';\nimport graphicModule from './graphic/graphic-service/graphic-module';\nimport pluginModule from './plugins/plugin-modules';\nimport loadBuiltinContributions from './core/contributions/modules';\nimport loadRenderContributions from './render/contributions/modules';\n// import loadPickContributions from './picker/contributions/modules';\n// import loadCanvasContributions from './canvas/contributions/modules';\nimport { LayerService } from './core/constants';\n// import { IMat4Allocate, IMatrixAllocate, Mat4Allocate, MatrixAllocate } from './allocator/matrix-allocate';\n// import { GlobalPickerService } from './picker/constants';\nimport type { IGlobal, IGraphicService, IPickerService, IRenderService } from './interface';\nimport { application } from './application';\nimport type { IGraphicUtil, ILayerService, ITransformUtil } from './interface/core';\nimport { GraphicService } from './graphic/constants';\nimport { GraphicUtil, TransformUtil } from './core/constants';\nimport { container } from './container';\nimport { VGlobal } from './constants';\nimport { RenderService } from './render';\n\nexport function preLoadAllModule() {\n if (preLoadAllModule.__loaded) {\n return;\n }\n preLoadAllModule.__loaded = true;\n container.load(coreModule);\n container.load(graphicModule);\n container.load(renderModule);\n container.load(pickModule);\n // container.load(allocatorModule);\n container.load(pluginModule);\n loadBuiltinContributions(container);\n loadRenderContributions(container);\n}\n\npreLoadAllModule.__loaded = false;\n\npreLoadAllModule();\n// loadPickContributions(container);\n// loadCanvasContributions(container);\n\n// 全局变量\nexport const vglobal = container.get<IGlobal>(VGlobal);\napplication.global = vglobal;\nexport const graphicUtil = container.get<IGraphicUtil>(GraphicUtil);\napplication.graphicUtil = graphicUtil;\nexport const transformUtil = container.get<ITransformUtil>(TransformUtil);\napplication.transformUtil = transformUtil;\nexport const graphicService = container.get<IGraphicService>(GraphicService);\napplication.graphicService = graphicService;\nexport const renderService = container.get<IRenderService>(RenderService);\napplication.renderService = renderService;\n// export const matrixAllocate = container.get<IMatrixAllocate>(MatrixAllocate);\n// export const mat4Allocate = container.get<IMat4Allocate>(Mat4Allocate);\n// export const canvasAllocate = container.get<ICanvasAllocate>(CanvasAllocate);\n// export const arcAllocate = container.get<IArcAllocate>(ArcAllocate);\n// export const areaAllocate = container.get<IAreaAllocate>(AreaAllocate);\n// export const circleAllocate = container.get<ICircleAllocate>(CircleAllocate);\n// export const lineAllocate = container.get<ILineAllocate>(LineAllocate);\n// export const pathAllocate = container.get<IPathAllocate>(PathAllocate);\n// export const rectAllocate = container.get<IRectAllocate>(RectAllocate);\n// export const symbolAllocate = container.get<ISymbolAllocate>(SymbolAllocate);\n// export const textAllocate = container.get<ITextAllocate>(TextAllocate);\n// export const pickerService = container.get<IPickerService>(GlobalPickerService);\nexport const layerService = container.get<ILayerService>(LayerService);\napplication.layerService = layerService;\n"]}
|
|
@@ -5,6 +5,7 @@ export declare class DefaultGlobalPickerService implements IPickerService {
|
|
|
5
5
|
pickerMap: Map<number, IGraphicPicker>;
|
|
6
6
|
global: IGlobal;
|
|
7
7
|
constructor();
|
|
8
|
+
reInit(): void;
|
|
8
9
|
configure(global: IGlobal, env: EnvType): void;
|
|
9
10
|
pick(graphics: IGraphic[], point: IPointLike, params?: IPickParams): PickResult;
|
|
10
11
|
containsPoint(graphic: IGraphic, point: IPointLike, params?: IPickParams): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/picker/global-picker-service.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,6CAAiD;AACjD,6DAA8D;AAW9D,gDAA6C;AAKtC,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAMrC;QACE,IAAI,CAAC,MAAM,GAAG,yBAAW,CAAC,MAAM,CAAC;QACjC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,uBAAuB,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE;YAC/E,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC/C,CAAC;IAED,SAAS,CAAC,MAAe,EAAE,GAAY;IAKvC,CAAC;IAID,IAAI,CAAC,QAAoB,E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GAAG,IAAI,CAAC,OAAO,CAAC;wBAC9B,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;qBAC7B;iBACF;gBACD,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;YAC5C,CAAC,CAAC,CAAC;SACJ;QAED,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,WAAW,EAAE;YACnD,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;SACtB;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAGD,QAAQ,CACN,OAAiB,EACjB,KAAiB,EACjB,YAA4B,EAC5B,MAAoB;QAEpB,IAAI,OAAO,CAAC,SAAS,CAAC,QAAQ,KAAK,KAAK,EAAE;YACxC,OAAO,IAAI,CAAC;SACb;QACD,IAAI,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;YAC3C,OAAO;gBACL,OAAO,EAAE,OAAO;aACjB,CAAC;SACH;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AA1IY,0BAA0B;IADtC,IAAA,2BAAU,GAAE;;GACA,0BAA0B,CA0ItC;AA1IY,gEAA0B","file":"global-picker-service.js","sourcesContent":["import type { IMatrix, IPoint, IPointLike } from '@visactor/vutils';\nimport { Matrix, Point } from '@visactor/vutils';\nimport { inject, injectable } from '../common/inversify-lite';\nimport type {\n IGraphic,\n IGroup,\n EnvType,\n IGlobal,\n IPickerService,\n IGraphicPicker,\n IPickParams,\n PickResult\n} from '../interface';\nimport { application } from '../application';\n\n// 默认的pick-service,提供基本的最优选中策略,尽量不需要用户自己实现contribution\n// 用户可以写plugin\n@injectable()\nexport class DefaultGlobalPickerService implements IPickerService {\n type: 'global';\n\n declare pickerMap: Map<number, IGraphicPicker>;\n declare global: IGlobal;\n\n constructor() {\n this.global = application.global;\n this.global.hooks.onSetEnv.tap('global-picker-service', (lastEnv, env, global) => {\n this.configure(global, env);\n });\n this.configure(this.global, this.global.env);\n }\n\n reInit() {\n return;\n }\n\n configure(global: IGlobal, env: EnvType) {\n // if (!this.global.env) return;\n // this.contributions.getContributions().forEach(handlerContribution => {\n // handlerContribution.configure(this, this.global);\n // });\n }\n\n // todo: params支持\n // todo: 性能优化\n pick(graphics: IGraphic[], point: IPointLike, params?: IPickParams): PickResult {\n let result: PickResult = {\n graphic: null,\n group: null\n };\n const parentMatrix = new Matrix(1, 0, 0, 1, 0, 0);\n let group: IGroup;\n for (let i = 0; i < graphics.length; i++) {\n if (graphics[i].isContainer) {\n result = this.pickGroup(graphics[i] as IGroup, point, parentMatrix, params);\n } else {\n const data = this.pickItem(graphics[i], point, parentMatrix, params);\n if (data) {\n result.graphic = data.graphic;\n result.params = data.params;\n }\n }\n if (result.graphic) {\n break;\n }\n if (!group) {\n group = result.group;\n }\n }\n if (!result.graphic) {\n result.group = group;\n }\n // 判断是否有shadow-dom\n if (result.graphic) {\n let g = result.graphic;\n while (g.parent) {\n g = g.parent;\n }\n if (g.shadowHost) {\n result.params = {\n shadowTarget: result.graphic\n };\n result.graphic = g.shadowHost;\n }\n }\n return result;\n }\n\n containsPoint(graphic: IGraphic, point: IPointLike, params?: IPickParams): boolean {\n return !!this.pickItem(graphic, point, null, params);\n }\n\n pickGroup(group: IGroup, point: IPointLike, parentMatrix: IMatrix, params?: IPickParams): PickResult {\n let result: PickResult = {\n group: null,\n graphic: null\n };\n if (group.attribute.visibleAll === false) {\n return result;\n }\n // 转换坐标空间\n const transMatrix = group.transMatrix;\n\n const newPoint: IPoint = new Point(point.x, point.y);\n parentMatrix.transformPoint(newPoint, newPoint);\n const insideGroup = group.AABBBounds.containsPoint(newPoint);\n // 如果group没有被选中,直接跳过\n if (!insideGroup) {\n return result;\n }\n // todo: 支持带有path的group的选中\n const groupPicked = group.attribute.pickable !== false && insideGroup;\n\n parentMatrix.multiply(transMatrix.a, transMatrix.b, transMatrix.c, transMatrix.d, transMatrix.e, transMatrix.f);\n\n if (group.attribute.childrenPickable !== false) {\n group.forEachChildren((graphic: IGraphic) => {\n if (graphic.isContainer) {\n result = this.pickGroup(graphic as IGroup, point, parentMatrix, params);\n } else {\n const newPoint: IPoint = new Point(point.x, point.y);\n parentMatrix.transformPoint(newPoint, newPoint);\n const data = this.pickItem(graphic, newPoint, parentMatrix, params);\n if (data) {\n result.graphic = data.graphic;\n result.params = data.params;\n }\n }\n return !!result.graphic || !!result.group;\n });\n }\n\n if (!result.graphic && !result.group && groupPicked) {\n result.group = group;\n }\n\n return result;\n }\n\n // todo: switch统一改为数字map\n pickItem(\n graphic: IGraphic,\n point: IPointLike,\n parentMatrix: IMatrix | null,\n params?: IPickParams\n ): PickResult | null {\n if (graphic.attribute.pickable === false) {\n return null;\n }\n if (graphic.AABBBounds.containsPoint(point)) {\n return {\n graphic: graphic\n };\n }\n return null;\n }\n}\n"]}
|
|
@@ -10,6 +10,7 @@ export declare abstract class DefaultPickService implements IPickerService {
|
|
|
10
10
|
pickerServiceInterceptorContributions: IPickServiceInterceptorContribution[];
|
|
11
11
|
global: IGlobal;
|
|
12
12
|
constructor(pickItemInterceptorContributions: IContributionProvider<IPickItemInterceptorContribution>, pickServiceInterceptorContributions: IContributionProvider<IPickServiceInterceptorContribution>);
|
|
13
|
+
reInit(): void;
|
|
13
14
|
protected _init(): void;
|
|
14
15
|
abstract configure(global: IGlobal, env: EnvType): void;
|
|
15
16
|
pick(graphics: IGraphic[], point: IPoint, params: IPickParams): PickResult;
|
|
@@ -23,6 +23,9 @@ let DefaultPickService = class {
|
|
|
23
23
|
this.pickItemInterceptorContributions = pickItemInterceptorContributions, this.pickServiceInterceptorContributions = pickServiceInterceptorContributions,
|
|
24
24
|
this.type = "default", this.global = application_1.application.global;
|
|
25
25
|
}
|
|
26
|
+
reInit() {
|
|
27
|
+
this._init();
|
|
28
|
+
}
|
|
26
29
|
_init() {
|
|
27
30
|
this.InterceptorContributions = this.pickItemInterceptorContributions.getContributions().sort(((a, b) => a.order - b.order)),
|
|
28
31
|
this.pickerServiceInterceptorContributions = this.pickServiceInterceptorContributions.getContributions().sort(((a, b) => a.order - b.order));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/picker/picker-service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,6CAA6D;AAC7D,6DAAqE;AACrE,yCAAyC;AAEzC,2EAAuE;AAevE,4CAA4C;AAC5C,8CAAqD;AACrD,6CAAgE;AAChE,kEAA4E;AAC5E,gDAA6C;AAC7C,2CAA0E;AAGnE,IAAe,kBAAkB,GAAjC,MAAe,kBAAkB;IAQtC,YAKqB,gCAAyF,EAIzF,mCAA+F;QAJ/F,qCAAgC,GAAhC,gCAAgC,CAAyD;QAIzF,wCAAmC,GAAnC,mCAAmC,CAA4D;QAhBpH,SAAI,GAAW,SAAS,CAAC;QAkBvB,IAAI,CAAC,MAAM,GAAG,yBAAW,CAAC,MAAM,CAAC;IACnC,CAAC;IAES,KAAK;QACb,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,gCAAgC;aAClE,gBAAgB,EAAE;aAClB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;QACrC,IAAI,CAAC,qCAAqC,GAAG,IAAI,CAAC,mCAAmC;aAClF,gBAAgB,EAAE;aAClB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAMD,IAAI,CAAC,QAAoB,EAAE,KAAa,EAAE,MAAmB;QAC3D,IAAI,MAAM,GAAe;YACvB,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,IAAI;SACZ,CAAC;QAEF,MAAM,CAAC,aAAa,GAAG,IAAI,CAAC;QAE5B,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,KA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;qBACnC;iBACF;gBACD,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;YAC5C,CAAC,EACD,IAAI,EACJ,CAAC,CAAC,OAAO,CAAC,MAAM,CACjB,CAAC;SACH;QACD,IAAI,OAAO,CAAC,WAAW,KAAK,UAAU,EAAE;YACtC,8BAAY,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;SACxC;QACD,OAAO,CAAC,WAAW,GAAG,UAAU,CAAC;QAEjC,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,WAAW,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE;YAC1E,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;SACtB;QACD,gCAAc,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QACxC,OAAO,MAAM,CAAC;IAChB,CAAC;IAUS,YAAY,CAAC,OAAiB;QACtC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACtD,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,IAAI,CAAC;SACb;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAA;AA7OqB,kBAAkB;IADvC,IAAA,2BAAU,GAAE;IAYR,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,+BAAmB,CAAC,CAAA;IAG1B,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,kCAAsB,CAAC,CAAA;;GAhBZ,kBAAkB,CA6OvC;AA7OqB,gDAAkB","file":"picker-service.js","sourcesContent":["import type { IMatrix, IPoint, IPointLike } from '@visactor/vutils';\nimport { AABBBounds, Matrix, Point } from '@visactor/vutils';\nimport { inject, injectable, named } from '../common/inversify-lite';\nimport { foreach } from '../common/sort';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../common/contribution-provider';\nimport type {\n IContext2d,\n IGraphic,\n IGroup,\n EnvType,\n IGlobal,\n IPickerService,\n IGraphicPicker,\n IPickParams,\n PickResult,\n IPickItemInterceptorContribution,\n IContributionProvider,\n IPickServiceInterceptorContribution\n} from '../interface';\nimport { getTheme } from '../graphic/theme';\nimport { DefaultAttribute } from '../graphic/config';\nimport { mat3Tomat4, multiplyMat4Mat4 } from '../common/matrix';\nimport { mat4Allocate, matrixAllocate } from '../allocator/matrix-allocate';\nimport { application } from '../application';\nimport { PickItemInterceptor, PickServiceInterceptor } from './constants';\n\n@injectable()\nexport abstract class DefaultPickService implements IPickerService {\n type: string = 'default';\n declare pickerMap: Map<number, IGraphicPicker>;\n declare pickContext?: IContext2d;\n declare InterceptorContributions: IPickItemInterceptorContribution[];\n declare pickerServiceInterceptorContributions: IPickServiceInterceptorContribution[];\n declare global: IGlobal;\n\n constructor(\n // 拦截器\n // @ts-ignore\n @inject(ContributionProvider)\n @named(PickItemInterceptor)\n protected readonly pickItemInterceptorContributions: IContributionProvider<IPickItemInterceptorContribution>,\n // @ts-ignore\n @inject(ContributionProvider)\n @named(PickServiceInterceptor)\n protected readonly pickServiceInterceptorContributions: IContributionProvider<IPickServiceInterceptorContribution>\n ) {\n this.global = application.global;\n }\n\n protected _init() {\n this.InterceptorContributions = this.pickItemInterceptorContributions\n .getContributions()\n .sort((a, b) => a.order - b.order);\n this.pickerServiceInterceptorContributions = this.pickServiceInterceptorContributions\n .getContributions()\n .sort((a, b) => a.order - b.order);\n }\n\n abstract configure(global: IGlobal, env: EnvType): void;\n\n // todo: params支持\n // todo: 性能优化\n pick(graphics: IGraphic[], point: IPoint, params: IPickParams): PickResult {\n let result: PickResult = {\n graphic: null,\n group: null\n };\n // point变换\n params.pickerService = this;\n\n const w = params.bounds.width();\n const h = params.bounds.height();\n if (!new AABBBounds().setValue(0, 0, w, h).containsPoint(point)) {\n return result;\n }\n if (this.pickContext) {\n this.pickContext.inuse = true;\n }\n params.pickContext = this.pickContext;\n this.pickContext && this.pickContext.clearMatrix(true, 1);\n\n const parentMatrix = new Matrix(1, 0, 0, 1, 0, 0);\n let group: IGroup;\n for (let i = graphics.length - 1; i >= 0; i--) {\n if (graphics[i].isContainer) {\n result = this.pickGroup(graphics[i] as IGroup, point, parentMatrix, params);\n } else {\n result = this.pickItem(graphics[i], point, parentMatrix, params);\n }\n if (result.graphic) {\n break;\n }\n if (!group) {\n group = result.group;\n }\n }\n if (!result.graphic) {\n result.group = group;\n }\n if (this.pickContext) {\n this.pickContext.inuse = false;\n }\n\n if (this.pickerServiceInterceptorContributions.length) {\n for (let i = 0; i < this.pickerServiceInterceptorContributions.length; i++) {\n const drawContribution = this.pickerServiceInterceptorContributions[i];\n if (drawContribution.afterPickItem) {\n result = drawContribution.afterPickItem(result, this, point, params, { parentMatrix });\n }\n }\n }\n // // 判断是否有shadow-dom\n // if (result.graphic) {\n // let g = result.graphic;\n // while (g.parent) {\n // g = g.parent;\n // }\n // if (g.shadowHost) {\n // result.params = {\n // shadowTarget: result.graphic\n // };\n // result.graphic = g.shadowHost;\n // }\n // }\n\n return result;\n }\n\n containsPoint(graphic: IGraphic, point: IPointLike, params: IPickParams): boolean {\n return !!this.pickItem(graphic, point, null, params ?? { pickContext: this.pickContext, pickerService: this })\n ?.graphic;\n }\n\n // TODO: 支持3d模式的拾取和自定义path的拾取\n pickGroup(group: IGroup, point: IPointLike, parentMatrix: IMatrix, params: IPickParams): PickResult {\n let result: PickResult = {\n group: null,\n graphic: null\n };\n if (group.attribute.visibleAll === false) {\n return result;\n }\n const context = params.pickContext;\n const lastMatrix = context.modelMatrix;\n // 如果是3d,那么需要生成modelMatrix\n if (context.camera) {\n const m = group.transMatrix;\n const matrix = mat4Allocate.allocate();\n mat3Tomat4(matrix, m);\n if (lastMatrix) {\n if (matrix) {\n const m = mat4Allocate.allocate();\n context.modelMatrix = multiplyMat4Mat4(m, lastMatrix, matrix);\n mat4Allocate.free(matrix);\n }\n } else {\n // 转化context的matrix为lastMatrix\n mat3Tomat4(matrix, group.globalTransMatrix);\n context.modelMatrix = matrix;\n }\n }\n // 添加拦截器\n if (this.InterceptorContributions.length) {\n for (let i = 0; i < this.InterceptorContributions.length; i++) {\n const drawContribution = this.InterceptorContributions[i];\n if (drawContribution.beforePickItem) {\n const result = drawContribution.beforePickItem(group, this, point, params, { parentMatrix });\n if (result) {\n if (context.modelMatrix !== lastMatrix) {\n mat4Allocate.free(context.modelMatrix);\n }\n context.modelMatrix = lastMatrix;\n return result;\n }\n }\n }\n }\n // 转换坐标空间\n const transMatrix = group.transMatrix;\n const currentGroupMatrix = matrixAllocate.allocateByObj(parentMatrix);\n const newPoint: IPoint = new Point(point.x, point.y);\n currentGroupMatrix.transformPoint(newPoint, newPoint);\n // todo: 支持带有path的group的选中\n const insideGroup = group.AABBBounds.containsPoint(newPoint);\n // 如果group没有被选中,直接跳过(如果是3d模式,那么继续)\n if (!insideGroup && !group.stage.camera) {\n return result;\n }\n // pickGroup,Group目前只支持拦截模式(用于shadow节点)\n const pickedItem = this.pickItem(group, newPoint.clone(), parentMatrix, params);\n if (pickedItem && pickedItem.graphic) {\n result.graphic = pickedItem.graphic;\n result.params = pickedItem.params;\n }\n const groupPicked = group.attribute.pickable !== false && insideGroup;\n\n currentGroupMatrix.multiply(\n transMatrix.a,\n transMatrix.b,\n transMatrix.c,\n transMatrix.d,\n transMatrix.e,\n transMatrix.f\n );\n if (group.attribute.childrenPickable !== false && !(pickedItem && pickedItem.graphic)) {\n foreach(\n group,\n DefaultAttribute.zIndex,\n (graphic: IGraphic) => {\n if (graphic.isContainer) {\n // 偏移scrollX和scrollY\n const newPoint: IPoint = new Point(point.x, point.y);\n const theme = getTheme(group).group;\n const { scrollX = theme.scrollX, scrollY = theme.scrollY } = group.attribute;\n newPoint.x -= scrollX;\n newPoint.y -= scrollY;\n result = this.pickGroup(graphic as IGroup, newPoint, currentGroupMatrix, params);\n } else {\n const newPoint: IPoint = new Point(point.x, point.y);\n currentGroupMatrix.transformPoint(newPoint, newPoint);\n // 偏移scrollX和scrollY\n const theme = getTheme(group).group;\n const { scrollX = theme.scrollX, scrollY = theme.scrollY } = group.attribute;\n newPoint.x -= scrollX;\n newPoint.y -= scrollY;\n const pickedItem = this.pickItem(graphic, newPoint, parentMatrix, params);\n if (pickedItem && pickedItem.graphic) {\n result.graphic = pickedItem.graphic;\n result.params = pickedItem.params;\n }\n }\n return !!result.graphic || !!result.group;\n },\n true,\n !!context.camera\n );\n }\n if (context.modelMatrix !== lastMatrix) {\n mat4Allocate.free(context.modelMatrix);\n }\n context.modelMatrix = lastMatrix;\n\n if (!result.graphic && !result.group && groupPicked && !group.stage.camera) {\n result.group = group;\n }\n matrixAllocate.free(currentGroupMatrix);\n return result;\n }\n\n // todo: switch统一改为数字map\n abstract pickItem(\n graphic: IGraphic,\n point: IPointLike,\n parentMatrix: IMatrix | null,\n params: IPickParams\n ): PickResult | null;\n\n protected selectPicker(graphic: IGraphic): IGraphicPicker | null {\n const picker = this.pickerMap.get(graphic.numberType);\n if (!picker) {\n return null;\n }\n return picker;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/picker/picker-service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,6CAA6D;AAC7D,6DAAqE;AACrE,yCAAyC;AAEzC,2EAAuE;AAevE,4CAA4C;AAC5C,8CAAqD;AACrD,6CAAgE;AAChE,kEAA4E;AAC5E,gDAA6C;AAC7C,2CAA0E;AAGnE,IAAe,kBAAkB,GAAjC,MAAe,kBAAkB;IAQtC,YAKqB,gCAAyF,EAIzF,mCAA+F;QAJ/F,qCAAgC,GAAhC,gCAAgC,CAAyD;QAIzF,wCAAmC,GAAnC,mCAAmC,CAA4D;QAhBpH,SAAI,GAAW,SAAS,CAAC;QAkBvB,IAAI,CAAC,MAAM,GAAG,yBAAW,CAAC,MAAM,CAAC;IACn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AAkB,CAAC,CAAC;QACxC,OAAO,MAAM,CAAC;IAChB,CAAC;IAUS,YAAY,CAAC,OAAiB;QACtC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACtD,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,IAAI,CAAC;SACb;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAA;AAjPqB,kBAAkB;IADvC,IAAA,2BAAU,GAAE;IAYR,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,+BAAmB,CAAC,CAAA;IAG1B,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,kCAAsB,CAAC,CAAA;;GAhBZ,kBAAkB,CAiPvC;AAjPqB,gDAAkB","file":"picker-service.js","sourcesContent":["import type { IMatrix, IPoint, IPointLike } from '@visactor/vutils';\nimport { AABBBounds, Matrix, Point } from '@visactor/vutils';\nimport { inject, injectable, named } from '../common/inversify-lite';\nimport { foreach } from '../common/sort';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../common/contribution-provider';\nimport type {\n IContext2d,\n IGraphic,\n IGroup,\n EnvType,\n IGlobal,\n IPickerService,\n IGraphicPicker,\n IPickParams,\n PickResult,\n IPickItemInterceptorContribution,\n IContributionProvider,\n IPickServiceInterceptorContribution\n} from '../interface';\nimport { getTheme } from '../graphic/theme';\nimport { DefaultAttribute } from '../graphic/config';\nimport { mat3Tomat4, multiplyMat4Mat4 } from '../common/matrix';\nimport { mat4Allocate, matrixAllocate } from '../allocator/matrix-allocate';\nimport { application } from '../application';\nimport { PickItemInterceptor, PickServiceInterceptor } from './constants';\n\n@injectable()\nexport abstract class DefaultPickService implements IPickerService {\n type: string = 'default';\n declare pickerMap: Map<number, IGraphicPicker>;\n declare pickContext?: IContext2d;\n declare InterceptorContributions: IPickItemInterceptorContribution[];\n declare pickerServiceInterceptorContributions: IPickServiceInterceptorContribution[];\n declare global: IGlobal;\n\n constructor(\n // 拦截器\n // @ts-ignore\n @inject(ContributionProvider)\n @named(PickItemInterceptor)\n protected readonly pickItemInterceptorContributions: IContributionProvider<IPickItemInterceptorContribution>,\n // @ts-ignore\n @inject(ContributionProvider)\n @named(PickServiceInterceptor)\n protected readonly pickServiceInterceptorContributions: IContributionProvider<IPickServiceInterceptorContribution>\n ) {\n this.global = application.global;\n }\n\n reInit() {\n this._init();\n }\n\n protected _init() {\n this.InterceptorContributions = this.pickItemInterceptorContributions\n .getContributions()\n .sort((a, b) => a.order - b.order);\n this.pickerServiceInterceptorContributions = this.pickServiceInterceptorContributions\n .getContributions()\n .sort((a, b) => a.order - b.order);\n }\n\n abstract configure(global: IGlobal, env: EnvType): void;\n\n // todo: params支持\n // todo: 性能优化\n pick(graphics: IGraphic[], point: IPoint, params: IPickParams): PickResult {\n let result: PickResult = {\n graphic: null,\n group: null\n };\n // point变换\n params.pickerService = this;\n\n const w = params.bounds.width();\n const h = params.bounds.height();\n if (!new AABBBounds().setValue(0, 0, w, h).containsPoint(point)) {\n return result;\n }\n if (this.pickContext) {\n this.pickContext.inuse = true;\n }\n params.pickContext = this.pickContext;\n this.pickContext && this.pickContext.clearMatrix(true, 1);\n\n const parentMatrix = new Matrix(1, 0, 0, 1, 0, 0);\n let group: IGroup;\n for (let i = graphics.length - 1; i >= 0; i--) {\n if (graphics[i].isContainer) {\n result = this.pickGroup(graphics[i] as IGroup, point, parentMatrix, params);\n } else {\n result = this.pickItem(graphics[i], point, parentMatrix, params);\n }\n if (result.graphic) {\n break;\n }\n if (!group) {\n group = result.group;\n }\n }\n if (!result.graphic) {\n result.group = group;\n }\n if (this.pickContext) {\n this.pickContext.inuse = false;\n }\n\n if (this.pickerServiceInterceptorContributions.length) {\n for (let i = 0; i < this.pickerServiceInterceptorContributions.length; i++) {\n const drawContribution = this.pickerServiceInterceptorContributions[i];\n if (drawContribution.afterPickItem) {\n result = drawContribution.afterPickItem(result, this, point, params, { parentMatrix });\n }\n }\n }\n // // 判断是否有shadow-dom\n // if (result.graphic) {\n // let g = result.graphic;\n // while (g.parent) {\n // g = g.parent;\n // }\n // if (g.shadowHost) {\n // result.params = {\n // shadowTarget: result.graphic\n // };\n // result.graphic = g.shadowHost;\n // }\n // }\n\n return result;\n }\n\n containsPoint(graphic: IGraphic, point: IPointLike, params: IPickParams): boolean {\n return !!this.pickItem(graphic, point, null, params ?? { pickContext: this.pickContext, pickerService: this })\n ?.graphic;\n }\n\n // TODO: 支持3d模式的拾取和自定义path的拾取\n pickGroup(group: IGroup, point: IPointLike, parentMatrix: IMatrix, params: IPickParams): PickResult {\n let result: PickResult = {\n group: null,\n graphic: null\n };\n if (group.attribute.visibleAll === false) {\n return result;\n }\n const context = params.pickContext;\n const lastMatrix = context.modelMatrix;\n // 如果是3d,那么需要生成modelMatrix\n if (context.camera) {\n const m = group.transMatrix;\n const matrix = mat4Allocate.allocate();\n mat3Tomat4(matrix, m);\n if (lastMatrix) {\n if (matrix) {\n const m = mat4Allocate.allocate();\n context.modelMatrix = multiplyMat4Mat4(m, lastMatrix, matrix);\n mat4Allocate.free(matrix);\n }\n } else {\n // 转化context的matrix为lastMatrix\n mat3Tomat4(matrix, group.globalTransMatrix);\n context.modelMatrix = matrix;\n }\n }\n // 添加拦截器\n if (this.InterceptorContributions.length) {\n for (let i = 0; i < this.InterceptorContributions.length; i++) {\n const drawContribution = this.InterceptorContributions[i];\n if (drawContribution.beforePickItem) {\n const result = drawContribution.beforePickItem(group, this, point, params, { parentMatrix });\n if (result) {\n if (context.modelMatrix !== lastMatrix) {\n mat4Allocate.free(context.modelMatrix);\n }\n context.modelMatrix = lastMatrix;\n return result;\n }\n }\n }\n }\n // 转换坐标空间\n const transMatrix = group.transMatrix;\n const currentGroupMatrix = matrixAllocate.allocateByObj(parentMatrix);\n const newPoint: IPoint = new Point(point.x, point.y);\n currentGroupMatrix.transformPoint(newPoint, newPoint);\n // todo: 支持带有path的group的选中\n const insideGroup = group.AABBBounds.containsPoint(newPoint);\n // 如果group没有被选中,直接跳过(如果是3d模式,那么继续)\n if (!insideGroup && !group.stage.camera) {\n return result;\n }\n // pickGroup,Group目前只支持拦截模式(用于shadow节点)\n const pickedItem = this.pickItem(group, newPoint.clone(), parentMatrix, params);\n if (pickedItem && pickedItem.graphic) {\n result.graphic = pickedItem.graphic;\n result.params = pickedItem.params;\n }\n const groupPicked = group.attribute.pickable !== false && insideGroup;\n\n currentGroupMatrix.multiply(\n transMatrix.a,\n transMatrix.b,\n transMatrix.c,\n transMatrix.d,\n transMatrix.e,\n transMatrix.f\n );\n if (group.attribute.childrenPickable !== false && !(pickedItem && pickedItem.graphic)) {\n foreach(\n group,\n DefaultAttribute.zIndex,\n (graphic: IGraphic) => {\n if (graphic.isContainer) {\n // 偏移scrollX和scrollY\n const newPoint: IPoint = new Point(point.x, point.y);\n const theme = getTheme(group).group;\n const { scrollX = theme.scrollX, scrollY = theme.scrollY } = group.attribute;\n newPoint.x -= scrollX;\n newPoint.y -= scrollY;\n result = this.pickGroup(graphic as IGroup, newPoint, currentGroupMatrix, params);\n } else {\n const newPoint: IPoint = new Point(point.x, point.y);\n currentGroupMatrix.transformPoint(newPoint, newPoint);\n // 偏移scrollX和scrollY\n const theme = getTheme(group).group;\n const { scrollX = theme.scrollX, scrollY = theme.scrollY } = group.attribute;\n newPoint.x -= scrollX;\n newPoint.y -= scrollY;\n const pickedItem = this.pickItem(graphic, newPoint, parentMatrix, params);\n if (pickedItem && pickedItem.graphic) {\n result.graphic = pickedItem.graphic;\n result.params = pickedItem.params;\n }\n }\n return !!result.graphic || !!result.group;\n },\n true,\n !!context.camera\n );\n }\n if (context.modelMatrix !== lastMatrix) {\n mat4Allocate.free(context.modelMatrix);\n }\n context.modelMatrix = lastMatrix;\n\n if (!result.graphic && !result.group && groupPicked && !group.stage.camera) {\n result.group = group;\n }\n matrixAllocate.free(currentGroupMatrix);\n return result;\n }\n\n // todo: switch统一改为数字map\n abstract pickItem(\n graphic: IGraphic,\n point: IPointLike,\n parentMatrix: IMatrix | null,\n params: IPickParams\n ): PickResult | null;\n\n protected selectPicker(graphic: IGraphic): IGraphicPicker | null {\n const picker = this.pickerMap.get(graphic.numberType);\n if (!picker) {\n return null;\n }\n return picker;\n }\n}\n"]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.AutoRenderPlugin = void 0;
|
|
6
6
|
|
|
7
|
-
const generator_1 = require("../../common/generator")
|
|
7
|
+
const generator_1 = require("../../common/generator");
|
|
8
8
|
|
|
9
9
|
class AutoRenderPlugin {
|
|
10
10
|
constructor() {
|
|
@@ -14,15 +14,16 @@ class AutoRenderPlugin {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
activate(context) {
|
|
17
|
-
this.pluginService = context
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
this.pluginService = context;
|
|
18
|
+
const stage = this.pluginService.stage;
|
|
19
|
+
stage && (stage.graphicService.hooks.onAttributeUpdate.tap(this.key, this.handleChange),
|
|
20
|
+
stage.graphicService.hooks.onSetStage.tap(this.key, this.handleChange), stage.graphicService.hooks.onRemove.tap(this.key, this.handleChange));
|
|
20
21
|
}
|
|
21
22
|
deactivate(context) {
|
|
22
|
-
const filterByName = taps => taps.filter((item => item.name !== this.key));
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const filterByName = taps => taps.filter((item => item.name !== this.key)), stage = this.pluginService.stage;
|
|
24
|
+
stage && (stage.graphicService.hooks.onAttributeUpdate.taps = filterByName(stage.graphicService.hooks.onAttributeUpdate.taps),
|
|
25
|
+
stage.graphicService.hooks.onSetStage.taps = filterByName(stage.graphicService.hooks.onSetStage.taps),
|
|
26
|
+
stage.graphicService.hooks.onRemove.taps = filterByName(stage.graphicService.hooks.onRemove.taps));
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugins/builtin-plugin/auto-render-plugin.ts"],"names":[],"mappings":";;;AAAA,sDAAmD;
|
|
1
|
+
{"version":3,"sources":["../src/plugins/builtin-plugin/auto-render-plugin.ts"],"names":[],"mappings":";;;AAAA,sDAAmD;AAInD,MAAa,gBAAgB;IAA7B;QACE,SAAI,GAAuB,kBAAkB,CAAC;QAC9C,gBAAW,GAAiB,YAAY,CAAC;QAEzC,SAAI,GAAW,qBAAS,CAAC,kBAAkB,EAAE,CAAC;QAC9C,QAAG,GAAW,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEpC,iBAAY,GAAG,CAAC,OAAiB,EAAE,EAAE;YACnC,IAAI,OAAO,CAAC,SAAS,EAAE;gBACrB,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;aAC7B;YACD,IAAI,OAAO,CAAC,KAAK,KAAK,IAAI,CAAC,aAAa,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,IAAI,IAAI,EAAE;gBACvE,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC;aACjC;QACH,CAAC,CAAC;IA2BJ,CAAC;IAzBC,QAAQ,CAAC,OAAuB;QAC9B,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;QAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;QACvC,IAAI,CAAC,KAAK,EAAE;YACV,OAAO;SACR;QACD,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC9E,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QACvE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IACvE,CAAC;IACD,UAAU,CAAC,OAAuB;QAChC,MAAM,YAAY,GAAG,CAAC,IAAe,EAAE,EAAE;YACvC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;gBACxB,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC;YAChC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QACF,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;QACvC,IAAI,CAAC,KAAK,EAAE;YACV,OAAO;SACR;QAED,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,iBAAiB,CAAC,IAAI,GAAG,YAAY,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACpH,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,GAAG,YAAY,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACtG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,GAAG,YAAY,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACpG,CAAC;CACF;AAzCD,4CAyCC","file":"auto-render-plugin.js","sourcesContent":["import { Generator } from '../../common/generator';\nimport { application } from '../../application';\nimport type { FullTap, IGraphic, IPlugin, IPluginService } from '../../interface';\n\nexport class AutoRenderPlugin implements IPlugin {\n name: 'AutoRenderPlugin' = 'AutoRenderPlugin';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n _uid: number = Generator.GenAutoIncrementId();\n key: string = this.name + this._uid;\n\n handleChange = (graphic: IGraphic) => {\n if (graphic.glyphHost) {\n graphic = graphic.glyphHost;\n }\n if (graphic.stage === this.pluginService.stage && graphic.stage != null) {\n graphic.stage.renderNextFrame();\n }\n };\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n const stage = this.pluginService.stage;\n if (!stage) {\n return;\n }\n stage.graphicService.hooks.onAttributeUpdate.tap(this.key, this.handleChange);\n stage.graphicService.hooks.onSetStage.tap(this.key, this.handleChange);\n stage.graphicService.hooks.onRemove.tap(this.key, this.handleChange);\n }\n deactivate(context: IPluginService): void {\n const filterByName = (taps: FullTap[]) => {\n return taps.filter(item => {\n return item.name !== this.key;\n });\n };\n const stage = this.pluginService.stage;\n if (!stage) {\n return;\n }\n\n stage.graphicService.hooks.onAttributeUpdate.taps = filterByName(stage.graphicService.hooks.onAttributeUpdate.taps);\n stage.graphicService.hooks.onSetStage.taps = filterByName(stage.graphicService.hooks.onSetStage.taps);\n stage.graphicService.hooks.onRemove.taps = filterByName(stage.graphicService.hooks.onRemove.taps);\n }\n}\n"]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.DirtyBoundsPlugin = void 0;
|
|
6
6
|
|
|
7
|
-
const vutils_1 = require("@visactor/vutils"), generator_1 = require("../../common/generator"),
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), generator_1 = require("../../common/generator"), globalBounds = new vutils_1.AABBBounds;
|
|
8
8
|
|
|
9
9
|
class DirtyBoundsPlugin {
|
|
10
10
|
constructor() {
|
|
@@ -14,24 +14,27 @@ class DirtyBoundsPlugin {
|
|
|
14
14
|
activate(context) {
|
|
15
15
|
this.pluginService = context, context.stage.hooks.afterRender.tap(this.key, (stage => {
|
|
16
16
|
stage && stage === this.pluginService.stage && stage.dirtyBounds.clear();
|
|
17
|
-
}))
|
|
17
|
+
}));
|
|
18
|
+
const stage = this.pluginService.stage;
|
|
19
|
+
stage && (stage.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key, ((graphic, stage, willUpdate, bounds) => {
|
|
18
20
|
graphic.glyphHost && (graphic = graphic.glyphHost), stage && stage === this.pluginService.stage && stage.renderCount && (graphic.isContainer && !graphic.shouldSelfChangeUpdateAABBBounds() || willUpdate && (globalBounds.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2),
|
|
19
21
|
stage.dirty(globalBounds, graphic.parent && graphic.parent.globalTransMatrix)));
|
|
20
|
-
})),
|
|
22
|
+
})), stage.graphicService.hooks.afterUpdateAABBBounds.tap(this.key, ((graphic, stage, bounds, params, selfChange) => {
|
|
21
23
|
stage && stage === this.pluginService.stage && stage.renderCount && (graphic.isContainer && !selfChange || stage.dirty(params.globalAABBBounds));
|
|
22
|
-
})),
|
|
24
|
+
})), stage.graphicService.hooks.clearAABBBounds.tap(this.key, ((graphic, stage, bounds) => {
|
|
23
25
|
stage && stage === this.pluginService.stage && stage.renderCount && stage && stage.dirty(bounds);
|
|
24
|
-
})),
|
|
26
|
+
})), stage.graphicService.hooks.onRemove.tap(this.key, (graphic => {
|
|
25
27
|
const stage = graphic.stage;
|
|
26
28
|
stage && stage === this.pluginService.stage && stage.renderCount && stage && stage.dirty(graphic.globalAABBBounds);
|
|
27
|
-
}));
|
|
29
|
+
})));
|
|
28
30
|
}
|
|
29
31
|
deactivate(context) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const stage = this.pluginService.stage;
|
|
33
|
+
stage && (stage.graphicService.hooks.beforeUpdateAABBBounds.taps = stage.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((item => item.name !== this.key)),
|
|
34
|
+
stage.graphicService.hooks.afterUpdateAABBBounds.taps = stage.graphicService.hooks.afterUpdateAABBBounds.taps.filter((item => item.name !== this.key)),
|
|
35
|
+
stage.graphicService.hooks.clearAABBBounds.taps = stage.graphicService.hooks.clearAABBBounds.taps.filter((item => item.name !== this.key)),
|
|
36
|
+
stage.hooks.afterRender.taps = stage.hooks.afterRender.taps.filter((item => item.name !== this.key)),
|
|
37
|
+
stage.graphicService.hooks.onRemove.taps = stage.graphicService.hooks.onRemove.taps.filter((item => item.name !== this.key)));
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
40
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugins/builtin-plugin/dirty-bounds-plugin.ts"],"names":[],"mappings":";;;AACA,6CAA8C;AAC9C,sDAAmD;
|
|
1
|
+
{"version":3,"sources":["../src/plugins/builtin-plugin/dirty-bounds-plugin.ts"],"names":[],"mappings":";;;AACA,6CAA8C;AAC9C,sDAAmD;AAInD,MAAM,YAAY,GAAG,IAAI,mBAAU,EAAE,CAAC;AAEtC,MAAa,iBAAiB;IAA9B;QACE,SAAI,GAAwB,mBAAmB,CAAC;QAChD,gBAAW,GAAiB,YAAY,CAAC;QAEzC,SAAI,GAAW,qBAAS,CAAC,kBAAkB,EAAE,CAAC;QAC9C,QAAG,GAAW,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;IAgGtC,CAAC;IA9FC,QAAQ,CAAC,OAAuB;QAC9B,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;QAC7B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE;YACpD,IAAI,CAAC,CAAC,KAAK,IAAI,KAAK,KAAK,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;gBAClD,OAAO;aACR;YACD,KAAK,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;QAC5B,CAAC,CAAC,CAAC;QACH,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;QACvC,IAAI,CAAC,KAAK,EAAE;YACV,OAAO;SACR;QACD,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,sBAAsB,CAAC,GAAG,CACnD,IAAI,CAAC,GAAG,EACR,CAAC,OAAiB,EAAE,KAAa,EAAE,UAAmB,EAAE,MAAmB,EAAE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AC,CAAC,CAAC;QACL,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YAC9G,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC;QAChC,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YACxE,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC;QAChC,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YAChG,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC;QAChC,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AArGD,8CAqGC","file":"dirty-bounds-plugin.js","sourcesContent":["import type { IAABBBounds } from '@visactor/vutils';\nimport { AABBBounds } from '@visactor/vutils';\nimport { Generator } from '../../common/generator';\nimport type { IGraphic, IStage, IPlugin, IPluginService } from '../../interface';\nimport { application } from '../../application';\n\nconst globalBounds = new AABBBounds();\n\nexport class DirtyBoundsPlugin implements IPlugin {\n name: 'DirtyBoundsPlugin' = 'DirtyBoundsPlugin';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n _uid: number = Generator.GenAutoIncrementId();\n key: string = this.name + this._uid;\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n context.stage.hooks.afterRender.tap(this.key, stage => {\n if (!(stage && stage === this.pluginService.stage)) {\n return;\n }\n stage.dirtyBounds.clear();\n });\n const stage = this.pluginService.stage;\n if (!stage) {\n return;\n }\n stage.graphicService.hooks.beforeUpdateAABBBounds.tap(\n this.key,\n (graphic: IGraphic, stage: IStage, willUpdate: boolean, bounds: IAABBBounds) => {\n if (graphic.glyphHost) {\n graphic = graphic.glyphHost;\n }\n if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {\n return;\n }\n // group的子元素导致的bounds更新不用做dirtyBounds\n if (graphic.isContainer && !graphic.shouldSelfChangeUpdateAABBBounds()) {\n return;\n }\n if (willUpdate) {\n globalBounds.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2);\n stage.dirty(globalBounds, graphic.parent && graphic.parent.globalTransMatrix);\n }\n }\n );\n stage.graphicService.hooks.afterUpdateAABBBounds.tap(\n this.key,\n (\n graphic: IGraphic,\n stage: IStage,\n bounds: IAABBBounds,\n params: { globalAABBBounds: IAABBBounds },\n selfChange: boolean\n ) => {\n if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {\n return;\n }\n // group的子元素导致的bounds更新不用做dirtyBounds\n if (graphic.isContainer && !selfChange) {\n return;\n }\n stage.dirty(params.globalAABBBounds);\n }\n );\n stage.graphicService.hooks.clearAABBBounds.tap(\n this.key,\n (graphic: IGraphic, stage: IStage, bounds: IAABBBounds) => {\n if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {\n return;\n }\n if (stage) {\n stage.dirty(bounds);\n }\n }\n );\n stage.graphicService.hooks.onRemove.tap(this.key, (graphic: IGraphic) => {\n const stage = graphic.stage;\n if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {\n return;\n }\n if (stage) {\n stage.dirty(graphic.globalAABBBounds);\n }\n });\n }\n deactivate(context: IPluginService): void {\n const stage = this.pluginService.stage;\n if (!stage) {\n return;\n }\n stage.graphicService.hooks.beforeUpdateAABBBounds.taps =\n stage.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(item => {\n return item.name !== this.key;\n });\n stage.graphicService.hooks.afterUpdateAABBBounds.taps =\n stage.graphicService.hooks.afterUpdateAABBBounds.taps.filter(item => {\n return item.name !== this.key;\n });\n stage.graphicService.hooks.clearAABBBounds.taps = stage.graphicService.hooks.clearAABBBounds.taps.filter(item => {\n return item.name !== this.key;\n });\n stage.hooks.afterRender.taps = stage.hooks.afterRender.taps.filter(item => {\n return item.name !== this.key;\n });\n stage.graphicService.hooks.onRemove.taps = stage.graphicService.hooks.onRemove.taps.filter(item => {\n return item.name !== this.key;\n });\n }\n}\n"]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.registerFlexLayoutPlugin = exports.FlexLayoutPlugin = void 0;
|
|
6
6
|
|
|
7
|
-
const theme_1 = require("../../graphic/theme"), generator_1 = require("../../common/generator"), vutils_1 = require("@visactor/vutils"),
|
|
7
|
+
const theme_1 = require("../../graphic/theme"), generator_1 = require("../../common/generator"), vutils_1 = require("@visactor/vutils"), factory_1 = require("../../factory"), _tempBounds = new vutils_1.AABBBounds;
|
|
8
8
|
|
|
9
9
|
class FlexLayoutPlugin {
|
|
10
10
|
constructor() {
|
|
@@ -226,21 +226,24 @@ class FlexLayoutPlugin {
|
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
228
|
activate(context) {
|
|
229
|
-
this.pluginService = context
|
|
229
|
+
this.pluginService = context;
|
|
230
|
+
const stage = this.pluginService.stage;
|
|
231
|
+
stage && (stage.graphicService.hooks.onAttributeUpdate.tap(this.key, (graphic => {
|
|
230
232
|
graphic.glyphHost && (graphic = graphic.glyphHost), graphic.stage && graphic.stage === this.pluginService.stage && this.tryLayout(graphic, !1);
|
|
231
|
-
})),
|
|
233
|
+
})), stage.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key, ((graphic, stage, willUpdate, bounds) => {
|
|
232
234
|
graphic.glyphHost && (graphic = graphic.glyphHost), stage && stage === this.pluginService.stage && graphic.isContainer && !this.skipBoundsTrigger && _tempBounds.copy(bounds);
|
|
233
|
-
})),
|
|
235
|
+
})), stage.graphicService.hooks.afterUpdateAABBBounds.tap(this.key, ((graphic, stage, bounds, params, selfChange) => {
|
|
234
236
|
stage && stage === this.pluginService.stage && graphic.isContainer && !this.skipBoundsTrigger && (_tempBounds.equals(bounds) || this.tryLayout(graphic, !1));
|
|
235
|
-
})),
|
|
237
|
+
})), stage.graphicService.hooks.onSetStage.tap(this.key, (graphic => {
|
|
236
238
|
graphic.glyphHost && (graphic = graphic.glyphHost), this.tryLayout(graphic, !1);
|
|
237
|
-
}));
|
|
239
|
+
})));
|
|
238
240
|
}
|
|
239
241
|
deactivate(context) {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
const stage = this.pluginService.stage;
|
|
243
|
+
stage && (stage.graphicService.hooks.onAttributeUpdate.taps = stage.graphicService.hooks.onAttributeUpdate.taps.filter((item => item.name !== this.key)),
|
|
244
|
+
stage.graphicService.hooks.beforeUpdateAABBBounds.taps = stage.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((item => item.name !== this.key)),
|
|
245
|
+
stage.graphicService.hooks.afterUpdateAABBBounds.taps = stage.graphicService.hooks.afterUpdateAABBBounds.taps.filter((item => item.name !== this.key)),
|
|
246
|
+
stage.graphicService.hooks.onSetStage.taps = stage.graphicService.hooks.onSetStage.taps.filter((item => item.name !== this.key)));
|
|
244
247
|
}
|
|
245
248
|
}
|
|
246
249
|
|