@visactor/vstory 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/cjs/constants/character.d.ts +2 -1
- package/cjs/constants/character.js +1 -1
- package/cjs/constants/character.js.map +1 -1
- package/cjs/dsl/types/index.d.ts +1 -0
- package/cjs/dsl/types/index.js.map +1 -1
- package/cjs/dsl/utils/datum.js +2 -1
- package/cjs/dsl/utils/flicker.js +1 -2
- package/cjs/edit/const.d.ts +1 -3
- package/cjs/edit/const.js +1 -0
- package/cjs/edit/const.js.map +1 -1
- package/cjs/edit/edit-action.d.ts +9 -0
- package/cjs/edit/edit-action.js +61 -5
- package/cjs/edit/edit-action.js.map +1 -1
- package/cjs/edit/edit-component/base-selection.d.ts +8 -3
- package/cjs/edit/edit-component/base-selection.js +31 -5
- package/cjs/edit/edit-component/base-selection.js.map +1 -1
- package/cjs/edit/edit-component/box-selection.js +1 -1
- package/cjs/edit/edit-component/chart-selection.d.ts +15 -0
- package/cjs/edit/edit-component/chart-selection.js +39 -0
- package/cjs/edit/edit-component/chart-selection.js.map +1 -0
- package/cjs/edit/edit-component/common.d.ts +1 -11
- package/cjs/edit/edit-component/common.js +1 -30
- package/cjs/edit/edit-component/common.js.map +1 -1
- package/cjs/edit/edit-component/edit-control/richtext-control.d.ts +19 -0
- package/cjs/edit/edit-component/edit-control/richtext-control.js +34 -0
- package/cjs/edit/edit-component/edit-control/richtext-control.js.map +1 -0
- package/cjs/edit/edit-component/edit-control/richtext-transform-control.d.ts +2 -3
- package/cjs/edit/edit-component/edit-control/richtext-transform-control.js +30 -32
- package/cjs/edit/edit-component/edit-control/richtext-transform-control.js.map +1 -1
- package/cjs/edit/edit-component/edit-control/transform-control.d.ts +4 -2
- package/cjs/edit/edit-component/edit-control/transform-control.js +10 -6
- package/cjs/edit/edit-component/edit-control/transform-control.js.map +1 -1
- package/cjs/edit/edit-component/edit-control/transform-drag.d.ts +1 -0
- package/cjs/edit/edit-component/edit-control/transform-drag.js +4 -2
- package/cjs/edit/edit-component/edit-control/transform-drag.js.map +1 -1
- package/cjs/edit/edit-component/image-selection.d.ts +1 -2
- package/cjs/edit/edit-component/image-selection.js +3 -6
- package/cjs/edit/edit-component/image-selection.js.map +1 -1
- package/cjs/edit/edit-component/index.js +4 -5
- package/cjs/edit/edit-component/index.js.map +1 -1
- package/cjs/edit/edit-component/mixin/richtext.d.ts +21 -0
- package/cjs/edit/edit-component/mixin/richtext.js +26 -0
- package/cjs/edit/edit-component/mixin/richtext.js.map +1 -0
- package/cjs/edit/edit-component/rect-selection.d.ts +8 -12
- package/cjs/edit/edit-component/rect-selection.js +12 -17
- package/cjs/edit/edit-component/rect-selection.js.map +1 -1
- package/cjs/edit/edit-component/richtext-selection-common.d.ts +19 -0
- package/cjs/edit/edit-component/richtext-selection-common.js +35 -0
- package/cjs/edit/edit-component/richtext-selection-common.js.map +1 -0
- package/cjs/edit/edit-component/richtext-selection.d.ts +0 -2
- package/cjs/edit/edit-component/richtext-selection.js +0 -6
- package/cjs/edit/edit-component/richtext-selection.js.map +1 -1
- package/cjs/edit/edit-component/shape-selection.d.ts +11 -0
- package/cjs/edit/edit-component/shape-selection.js +36 -0
- package/cjs/edit/edit-component/shape-selection.js.map +1 -0
- package/cjs/edit/edit-component/text-selection.d.ts +0 -3
- package/cjs/edit/edit-component/text-selection.js +2 -9
- package/cjs/edit/edit-component/text-selection.js.map +1 -1
- package/cjs/edit/edit.d.ts +5 -2
- package/cjs/edit/edit.js +20 -5
- package/cjs/edit/edit.js.map +1 -1
- package/cjs/edit/interface.d.ts +6 -1
- package/cjs/edit/interface.js +3 -1
- package/cjs/edit/interface.js.map +1 -1
- package/cjs/index.d.ts +3 -0
- package/cjs/index.js +3 -1
- package/cjs/index.js.map +1 -1
- package/cjs/player/interface/player.js +1 -1
- package/cjs/player/interface/scheduler.js +1 -1
- package/cjs/player/player.js +6 -2
- package/cjs/player/player.js.map +1 -1
- package/cjs/player/processor/chart/common/chartAppear.d.ts +2 -2
- package/cjs/player/processor/chart/common/chartAppear.js.map +1 -1
- package/cjs/player/processor/chart/common/commonAppear.d.ts +3 -3
- package/cjs/player/processor/chart/common/commonAppear.js.map +1 -1
- package/cjs/player/processor/chart/component/axisAppear.d.ts +2 -2
- package/cjs/player/processor/chart/component/axisAppear.js.map +1 -1
- package/cjs/player/processor/chart/component/commonAppear.d.ts +3 -3
- package/cjs/player/processor/chart/component/commonAppear.js.map +1 -1
- package/cjs/player/processor/chart/component/labelAppear.d.ts +2 -2
- package/cjs/player/processor/chart/component/labelAppear.js.map +1 -1
- package/cjs/player/processor/chart/rankingBar/rankingBar.d.ts +29 -0
- package/cjs/player/processor/chart/rankingBar/rankingBar.js +54 -0
- package/cjs/player/processor/chart/rankingBar/rankingBar.js.map +1 -0
- package/cjs/player/processor/chart/seriesmark/commonTransformMarkAppear.d.ts +3 -3
- package/cjs/player/processor/chart/seriesmark/commonTransformMarkAppear.js.map +1 -1
- package/cjs/player/processor/chart/seriesmark/transformArcVisibility.d.ts +2 -2
- package/cjs/player/processor/chart/seriesmark/transformArcVisibility.js.map +1 -1
- package/cjs/player/processor/chart/seriesmark/transformLineVisibility.d.ts +2 -2
- package/cjs/player/processor/chart/seriesmark/transformLineVisibility.js.map +1 -1
- package/cjs/player/processor/chart/seriesmark/transformRectVisibility.d.ts +2 -2
- package/cjs/player/processor/chart/seriesmark/transformRectVisibility.js.map +1 -1
- package/cjs/player/processor/chart/seriesmark/transformSymbolVisibility.d.ts +2 -2
- package/cjs/player/processor/chart/seriesmark/transformSymbolVisibility.js.map +1 -1
- package/cjs/player/processor/chart/seriesmark/transformTextVisibility.d.ts +2 -2
- package/cjs/player/processor/chart/seriesmark/transformTextVisibility.js.map +1 -1
- package/cjs/player/processor/chart/vchart.d.ts +35 -24
- package/cjs/player/processor/chart/vchart.js +88 -60
- package/cjs/player/processor/chart/vchart.js.map +1 -1
- package/cjs/player/processor/common/bounce-processor.js +2 -3
- package/cjs/player/processor/common/bounce-processor.js.map +1 -1
- package/cjs/player/processor/common-processor.js +0 -2
- package/cjs/player/processor/component/common-component.js +21 -21
- package/cjs/player/processor/component/common-component.js.map +1 -1
- package/cjs/player/processor/interface/action-processor.d.ts +1 -1
- package/cjs/player/processor/interface/action-processor.js.map +1 -1
- package/cjs/player/processor/interface/common-action.d.ts +3 -2
- package/cjs/player/processor/interface/common-action.js.map +1 -1
- package/cjs/player/processor/interface/style-action.d.ts +4 -5
- package/cjs/player/processor/interface/style-action.js.map +1 -1
- package/cjs/player/processor/processor-item.js +1 -1
- package/cjs/player/processor/processor.js +1 -1
- package/cjs/player/processor/processor.js.map +1 -1
- package/cjs/player/processor/processorMap.d.ts +9 -0
- package/cjs/player/processor/processorMap.js +7 -1
- package/cjs/player/processor/processorMap.js.map +1 -1
- package/cjs/player/scheduler.js +12 -8
- package/cjs/player/scheduler.js.map +1 -1
- package/cjs/story/canvas/canvas.js +3 -4
- package/cjs/story/canvas/canvas.js.map +1 -1
- package/cjs/story/character/base/base.d.ts +4 -0
- package/cjs/story/character/base/base.js +1 -1
- package/cjs/story/character/base/base.js.map +1 -1
- package/cjs/story/character/chart/character.d.ts +15 -0
- package/cjs/story/character/chart/character.js +55 -19
- package/cjs/story/character/chart/character.js.map +1 -1
- package/cjs/story/character/chart/characters/rankingBar.d.ts +4 -0
- package/cjs/story/character/chart/characters/rankingBar.js +15 -0
- package/cjs/story/character/chart/characters/rankingBar.js.map +1 -0
- package/cjs/story/character/chart/graphic/vchart-graphic-picker.js +6 -8
- package/cjs/story/character/chart/graphic/vchart-graphic-picker.js.map +1 -1
- package/cjs/story/character/chart/graphic/vchart-graphic-render.js +6 -6
- package/cjs/story/character/chart/graphic/vchart-graphic-render.js.map +1 -1
- package/cjs/story/character/chart/graphic/vchart-graphic.d.ts +12 -2
- package/cjs/story/character/chart/graphic/vchart-graphic.js +77 -13
- package/cjs/story/character/chart/graphic/vchart-graphic.js.map +1 -1
- package/cjs/story/character/chart/runtime/common-spec.d.ts +2 -4
- package/cjs/story/character/chart/runtime/common-spec.js +0 -2
- package/cjs/story/character/chart/runtime/common-spec.js.map +1 -1
- package/cjs/story/character/chart/runtime/component-spec.d.ts +4 -3
- package/cjs/story/character/chart/runtime/component-spec.js +7 -5
- package/cjs/story/character/chart/runtime/component-spec.js.map +1 -1
- package/cjs/story/character/chart/temp/constant.d.ts +1 -0
- package/cjs/story/character/chart/temp/constant.js +2 -1
- package/cjs/story/character/chart/temp/constant.js.map +1 -1
- package/cjs/story/character/chart/temp/templates/bar.d.ts +20 -0
- package/cjs/story/character/chart/temp/templates/bar.js +31 -0
- package/cjs/story/character/chart/temp/templates/bar.js.map +1 -0
- package/cjs/story/character/chart/temp/templates/base-temp.d.ts +6 -4
- package/cjs/story/character/chart/temp/templates/base-temp.js +1 -1
- package/cjs/story/character/chart/temp/templates/base-temp.js.map +1 -1
- package/cjs/story/character/chart/temp/templates/ranking-bar-temp.d.ts +8 -0
- package/cjs/story/character/chart/temp/templates/ranking-bar-temp.js +22 -0
- package/cjs/story/character/chart/temp/templates/ranking-bar-temp.js.map +1 -0
- package/cjs/story/character/component/character-group/component-group-graphic-render.d.ts +2 -2
- package/cjs/story/character/component/character-group/component-group-graphic-render.js +3 -3
- package/cjs/story/character/component/character-group/component-group-graphic-render.js.map +1 -1
- package/cjs/story/character/component/character-group/component-group-graphic.d.ts +1 -1
- package/cjs/story/character/component/character-group/component-group-graphic.js +6 -4
- package/cjs/story/character/component/character-group/component-group-graphic.js.map +1 -1
- package/cjs/story/character/component/character.d.ts +5 -1
- package/cjs/story/character/component/character.js +18 -1
- package/cjs/story/character/component/character.js.map +1 -1
- package/cjs/story/character/component/characters/character-image.d.ts +3 -0
- package/cjs/story/character/component/characters/character-image.js +4 -0
- package/cjs/story/character/component/characters/character-image.js.map +1 -1
- package/cjs/story/character/component/characters/character-rect.d.ts +3 -0
- package/cjs/story/character/component/characters/character-rect.js +4 -0
- package/cjs/story/character/component/characters/character-rect.js.map +1 -1
- package/cjs/story/character/component/characters/character-shape.d.ts +4 -0
- package/cjs/story/character/component/characters/character-shape.js +15 -0
- package/cjs/story/character/component/characters/character-shape.js.map +1 -1
- package/cjs/story/character/component/graphic/graphic-base-text.d.ts +2 -1
- package/cjs/story/character/component/graphic/graphic-base-text.js +7 -2
- package/cjs/story/character/component/graphic/graphic-base-text.js.map +1 -1
- package/cjs/story/character/component/graphic/symbol.d.ts +3 -0
- package/cjs/story/character/component/graphic/symbol.js +17 -3
- package/cjs/story/character/component/graphic/symbol.js.map +1 -1
- package/cjs/story/character/dsl-interface.d.ts +2 -0
- package/cjs/story/character/dsl-interface.js.map +1 -1
- package/cjs/story/character/runtime-interface.d.ts +9 -4
- package/cjs/story/character/runtime-interface.js.map +1 -1
- package/cjs/story/character/visactor/character.d.ts +15 -0
- package/cjs/story/character/visactor/character.js +17 -1
- package/cjs/story/character/visactor/character.js.map +1 -1
- package/cjs/story/character/visactor/interface.js.map +1 -1
- package/cjs/story/index.js +5 -2
- package/cjs/story/index.js.map +1 -1
- package/cjs/story/interface/dsl-interface.d.ts +3 -2
- package/cjs/story/interface/dsl-interface.js.map +1 -1
- package/cjs/story/interface/runtime-interface.d.ts +2 -0
- package/cjs/story/interface/runtime-interface.js.map +1 -1
- package/cjs/story/story.js +3 -2
- package/cjs/story/story.js.map +1 -1
- package/cjs/story/utils/layout.d.ts +2 -1
- package/cjs/story/utils/layout.js +2 -2
- package/cjs/story/utils/layout.js.map +1 -1
- package/cjs/story/utils/vchart-pick.d.ts +115 -0
- package/cjs/story/utils/vchart-pick.js +109 -0
- package/cjs/story/utils/vchart-pick.js.map +1 -0
- package/dist/index.js +27003 -87350
- package/dist/index.min.js +3 -3
- package/es/constants/character.d.ts +2 -1
- package/es/constants/character.js +1 -1
- package/es/constants/character.js.map +1 -1
- package/es/dsl/types/index.d.ts +1 -0
- package/es/dsl/types/index.js.map +1 -1
- package/es/dsl/utils/datum.js +2 -1
- package/es/dsl/utils/flicker.js +1 -2
- package/es/edit/const.d.ts +1 -3
- package/es/edit/const.js +1 -0
- package/es/edit/const.js.map +1 -1
- package/es/edit/edit-action.d.ts +9 -0
- package/es/edit/edit-action.js +63 -5
- package/es/edit/edit-action.js.map +1 -1
- package/es/edit/edit-component/base-selection.d.ts +8 -3
- package/es/edit/edit-component/base-selection.js +32 -4
- package/es/edit/edit-component/base-selection.js.map +1 -1
- package/es/edit/edit-component/box-selection.js +1 -1
- package/es/edit/edit-component/chart-selection.d.ts +15 -0
- package/es/edit/edit-component/chart-selection.js +31 -0
- package/es/edit/edit-component/chart-selection.js.map +1 -0
- package/es/edit/edit-component/common.d.ts +1 -11
- package/es/edit/edit-component/common.js +1 -24
- package/es/edit/edit-component/common.js.map +1 -1
- package/es/edit/edit-component/edit-control/richtext-control.d.ts +19 -0
- package/es/edit/edit-component/edit-control/richtext-control.js +28 -0
- package/es/edit/edit-component/edit-control/richtext-control.js.map +1 -0
- package/es/edit/edit-component/edit-control/richtext-transform-control.d.ts +2 -3
- package/es/edit/edit-component/edit-control/richtext-transform-control.js +29 -34
- package/es/edit/edit-component/edit-control/richtext-transform-control.js.map +1 -1
- package/es/edit/edit-component/edit-control/transform-control.d.ts +4 -2
- package/es/edit/edit-component/edit-control/transform-control.js +10 -6
- package/es/edit/edit-component/edit-control/transform-control.js.map +1 -1
- package/es/edit/edit-component/edit-control/transform-drag.d.ts +1 -0
- package/es/edit/edit-component/edit-control/transform-drag.js +4 -2
- package/es/edit/edit-component/edit-control/transform-drag.js.map +1 -1
- package/es/edit/edit-component/image-selection.d.ts +1 -2
- package/es/edit/edit-component/image-selection.js +3 -6
- package/es/edit/edit-component/image-selection.js.map +1 -1
- package/es/edit/edit-component/index.js +7 -9
- package/es/edit/edit-component/index.js.map +1 -1
- package/es/edit/edit-component/mixin/richtext.d.ts +21 -0
- package/es/edit/edit-component/mixin/richtext.js +18 -0
- package/es/edit/edit-component/mixin/richtext.js.map +1 -0
- package/es/edit/edit-component/rect-selection.d.ts +8 -12
- package/es/edit/edit-component/rect-selection.js +13 -20
- package/es/edit/edit-component/rect-selection.js.map +1 -1
- package/es/edit/edit-component/richtext-selection-common.d.ts +19 -0
- package/es/edit/edit-component/richtext-selection-common.js +33 -0
- package/es/edit/edit-component/richtext-selection-common.js.map +1 -0
- package/es/edit/edit-component/richtext-selection.d.ts +0 -2
- package/es/edit/edit-component/richtext-selection.js +0 -6
- package/es/edit/edit-component/richtext-selection.js.map +1 -1
- package/es/edit/edit-component/shape-selection.d.ts +11 -0
- package/es/edit/edit-component/shape-selection.js +30 -0
- package/es/edit/edit-component/shape-selection.js.map +1 -0
- package/es/edit/edit-component/text-selection.d.ts +0 -3
- package/es/edit/edit-component/text-selection.js +1 -10
- package/es/edit/edit-component/text-selection.js.map +1 -1
- package/es/edit/edit.d.ts +5 -2
- package/es/edit/edit.js +21 -4
- package/es/edit/edit.js.map +1 -1
- package/es/edit/interface.d.ts +6 -1
- package/es/edit/interface.js +3 -1
- package/es/edit/interface.js.map +1 -1
- package/es/index.d.ts +3 -0
- package/es/index.js +7 -1
- package/es/index.js.map +1 -1
- package/es/player/interface/player.js +1 -1
- package/es/player/interface/scheduler.js +1 -1
- package/es/player/player.js +6 -2
- package/es/player/player.js.map +1 -1
- package/es/player/processor/chart/common/chartAppear.d.ts +2 -2
- package/es/player/processor/chart/common/chartAppear.js.map +1 -1
- package/es/player/processor/chart/common/commonAppear.d.ts +3 -3
- package/es/player/processor/chart/common/commonAppear.js.map +1 -1
- package/es/player/processor/chart/component/axisAppear.d.ts +2 -2
- package/es/player/processor/chart/component/axisAppear.js.map +1 -1
- package/es/player/processor/chart/component/commonAppear.d.ts +3 -3
- package/es/player/processor/chart/component/commonAppear.js.map +1 -1
- package/es/player/processor/chart/component/labelAppear.d.ts +2 -2
- package/es/player/processor/chart/component/labelAppear.js.map +1 -1
- package/es/player/processor/chart/rankingBar/rankingBar.d.ts +29 -0
- package/es/player/processor/chart/rankingBar/rankingBar.js +50 -0
- package/es/player/processor/chart/rankingBar/rankingBar.js.map +1 -0
- package/es/player/processor/chart/seriesmark/commonTransformMarkAppear.d.ts +3 -3
- package/es/player/processor/chart/seriesmark/commonTransformMarkAppear.js.map +1 -1
- package/es/player/processor/chart/seriesmark/transformArcVisibility.d.ts +2 -2
- package/es/player/processor/chart/seriesmark/transformArcVisibility.js.map +1 -1
- package/es/player/processor/chart/seriesmark/transformLineVisibility.d.ts +2 -2
- package/es/player/processor/chart/seriesmark/transformLineVisibility.js.map +1 -1
- package/es/player/processor/chart/seriesmark/transformRectVisibility.d.ts +2 -2
- package/es/player/processor/chart/seriesmark/transformRectVisibility.js.map +1 -1
- package/es/player/processor/chart/seriesmark/transformSymbolVisibility.d.ts +2 -2
- package/es/player/processor/chart/seriesmark/transformSymbolVisibility.js.map +1 -1
- package/es/player/processor/chart/seriesmark/transformTextVisibility.d.ts +2 -2
- package/es/player/processor/chart/seriesmark/transformTextVisibility.js.map +1 -1
- package/es/player/processor/chart/vchart.d.ts +35 -24
- package/es/player/processor/chart/vchart.js +89 -61
- package/es/player/processor/chart/vchart.js.map +1 -1
- package/es/player/processor/common/bounce-processor.js +2 -3
- package/es/player/processor/common/bounce-processor.js.map +1 -1
- package/es/player/processor/common-processor.js +0 -2
- package/es/player/processor/component/common-component.js +21 -21
- package/es/player/processor/component/common-component.js.map +1 -1
- package/es/player/processor/interface/action-processor.d.ts +1 -1
- package/es/player/processor/interface/action-processor.js.map +1 -1
- package/es/player/processor/interface/common-action.d.ts +3 -2
- package/es/player/processor/interface/common-action.js.map +1 -1
- package/es/player/processor/interface/style-action.d.ts +4 -5
- package/es/player/processor/interface/style-action.js.map +1 -1
- package/es/player/processor/processor-item.js +1 -1
- package/es/player/processor/processor.js +1 -1
- package/es/player/processor/processor.js.map +1 -1
- package/es/player/processor/processorMap.d.ts +9 -0
- package/es/player/processor/processorMap.js +8 -0
- package/es/player/processor/processorMap.js.map +1 -1
- package/es/player/scheduler.js +12 -8
- package/es/player/scheduler.js.map +1 -1
- package/es/story/canvas/canvas.js +3 -4
- package/es/story/canvas/canvas.js.map +1 -1
- package/es/story/character/base/base.d.ts +4 -0
- package/es/story/character/base/base.js +1 -1
- package/es/story/character/base/base.js.map +1 -1
- package/es/story/character/chart/character.d.ts +15 -0
- package/es/story/character/chart/character.js +58 -15
- package/es/story/character/chart/character.js.map +1 -1
- package/es/story/character/chart/characters/rankingBar.d.ts +4 -0
- package/es/story/character/chart/characters/rankingBar.js +14 -0
- package/es/story/character/chart/characters/rankingBar.js.map +1 -0
- package/es/story/character/chart/graphic/vchart-graphic-picker.js +6 -8
- package/es/story/character/chart/graphic/vchart-graphic-picker.js.map +1 -1
- package/es/story/character/chart/graphic/vchart-graphic-render.js +7 -7
- package/es/story/character/chart/graphic/vchart-graphic-render.js.map +1 -1
- package/es/story/character/chart/graphic/vchart-graphic.d.ts +12 -2
- package/es/story/character/chart/graphic/vchart-graphic.js +80 -12
- package/es/story/character/chart/graphic/vchart-graphic.js.map +1 -1
- package/es/story/character/chart/runtime/common-spec.d.ts +2 -4
- package/es/story/character/chart/runtime/common-spec.js +0 -2
- package/es/story/character/chart/runtime/common-spec.js.map +1 -1
- package/es/story/character/chart/runtime/component-spec.d.ts +4 -3
- package/es/story/character/chart/runtime/component-spec.js +7 -5
- package/es/story/character/chart/runtime/component-spec.js.map +1 -1
- package/es/story/character/chart/temp/constant.d.ts +1 -0
- package/es/story/character/chart/temp/constant.js +2 -1
- package/es/story/character/chart/temp/constant.js.map +1 -1
- package/es/story/character/chart/temp/templates/bar.d.ts +20 -0
- package/es/story/character/chart/temp/templates/bar.js +27 -0
- package/es/story/character/chart/temp/templates/bar.js.map +1 -0
- package/es/story/character/chart/temp/templates/base-temp.d.ts +6 -4
- package/es/story/character/chart/temp/templates/base-temp.js +1 -1
- package/es/story/character/chart/temp/templates/base-temp.js.map +1 -1
- package/es/story/character/chart/temp/templates/ranking-bar-temp.d.ts +8 -0
- package/es/story/character/chart/temp/templates/ranking-bar-temp.js +18 -0
- package/es/story/character/chart/temp/templates/ranking-bar-temp.js.map +1 -0
- package/es/story/character/component/character-group/component-group-graphic-render.d.ts +2 -2
- package/es/story/character/component/character-group/component-group-graphic-render.js +4 -4
- package/es/story/character/component/character-group/component-group-graphic-render.js.map +1 -1
- package/es/story/character/component/character-group/component-group-graphic.d.ts +1 -1
- package/es/story/character/component/character-group/component-group-graphic.js +5 -3
- package/es/story/character/component/character-group/component-group-graphic.js.map +1 -1
- package/es/story/character/component/character.d.ts +5 -1
- package/es/story/character/component/character.js +18 -1
- package/es/story/character/component/character.js.map +1 -1
- package/es/story/character/component/characters/character-image.d.ts +3 -0
- package/es/story/character/component/characters/character-image.js +4 -0
- package/es/story/character/component/characters/character-image.js.map +1 -1
- package/es/story/character/component/characters/character-rect.d.ts +3 -0
- package/es/story/character/component/characters/character-rect.js +4 -0
- package/es/story/character/component/characters/character-rect.js.map +1 -1
- package/es/story/character/component/characters/character-shape.d.ts +4 -0
- package/es/story/character/component/characters/character-shape.js +15 -0
- package/es/story/character/component/characters/character-shape.js.map +1 -1
- package/es/story/character/component/graphic/graphic-base-text.d.ts +2 -1
- package/es/story/character/component/graphic/graphic-base-text.js +7 -2
- package/es/story/character/component/graphic/graphic-base-text.js.map +1 -1
- package/es/story/character/component/graphic/symbol.d.ts +3 -0
- package/es/story/character/component/graphic/symbol.js +17 -2
- package/es/story/character/component/graphic/symbol.js.map +1 -1
- package/es/story/character/dsl-interface.d.ts +2 -0
- package/es/story/character/dsl-interface.js.map +1 -1
- package/es/story/character/runtime-interface.d.ts +9 -4
- package/es/story/character/runtime-interface.js.map +1 -1
- package/es/story/character/visactor/character.d.ts +15 -0
- package/es/story/character/visactor/character.js +18 -0
- package/es/story/character/visactor/character.js.map +1 -1
- package/es/story/character/visactor/interface.js.map +1 -1
- package/es/story/index.js +7 -3
- package/es/story/index.js.map +1 -1
- package/es/story/interface/dsl-interface.d.ts +3 -2
- package/es/story/interface/dsl-interface.js.map +1 -1
- package/es/story/interface/runtime-interface.d.ts +2 -0
- package/es/story/interface/runtime-interface.js.map +1 -1
- package/es/story/story.js +3 -2
- package/es/story/story.js.map +1 -1
- package/es/story/utils/layout.d.ts +2 -1
- package/es/story/utils/layout.js +2 -2
- package/es/story/utils/layout.js.map +1 -1
- package/es/story/utils/vchart-pick.d.ts +115 -0
- package/es/story/utils/vchart-pick.js +115 -0
- package/es/story/utils/vchart-pick.js.map +1 -0
- package/package.json +11 -10
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { IAction, IActionPayload } from './common-action';
|
|
2
|
-
interface IComponentStylePayLoad extends IActionPayload {
|
|
2
|
+
export interface IComponentStylePayLoad extends IActionPayload {
|
|
3
3
|
graphic?: Record<string, any>;
|
|
4
4
|
text?: Record<string, any>;
|
|
5
5
|
}
|
|
6
6
|
export interface IComponentStyleAction extends IAction<IComponentStylePayLoad> {
|
|
7
7
|
action: 'style';
|
|
8
8
|
}
|
|
9
|
-
interface IComponentMoveToPayLoad extends IActionPayload {
|
|
9
|
+
export interface IComponentMoveToPayLoad extends IActionPayload {
|
|
10
10
|
destination: {
|
|
11
11
|
x: number;
|
|
12
12
|
y: number;
|
|
@@ -15,7 +15,7 @@ interface IComponentMoveToPayLoad extends IActionPayload {
|
|
|
15
15
|
export interface IComponentMoveToAction extends IAction<IComponentMoveToPayLoad> {
|
|
16
16
|
action: 'moveTo';
|
|
17
17
|
}
|
|
18
|
-
interface IComponentScaleToPayLoad extends IActionPayload {
|
|
18
|
+
export interface IComponentScaleToPayLoad extends IActionPayload {
|
|
19
19
|
scale: {
|
|
20
20
|
scaleX: number;
|
|
21
21
|
scaleY: number;
|
|
@@ -28,7 +28,6 @@ export interface IComponentBouncePayLoad extends IActionPayload {
|
|
|
28
28
|
customEase?: string;
|
|
29
29
|
dy?: number;
|
|
30
30
|
}
|
|
31
|
-
export interface IComponentBounceAction extends IAction<
|
|
31
|
+
export interface IComponentBounceAction extends IAction<IComponentBouncePayLoad> {
|
|
32
32
|
action: 'bounce';
|
|
33
33
|
}
|
|
34
|
-
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/player/processor/interface/style-action.ts"],"names":[],"mappings":"","file":"style-action.js","sourcesContent":["import type { IAction, IActionPayload } from './common-action';\n\
|
|
1
|
+
{"version":3,"sources":["../src/player/processor/interface/style-action.ts"],"names":[],"mappings":"","file":"style-action.js","sourcesContent":["import type { IAction, IActionPayload } from './common-action';\n\nexport interface IComponentStylePayLoad extends IActionPayload {\n graphic?: Record<string, any>;\n text?: Record<string, any>;\n}\n\nexport interface IComponentStyleAction extends IAction<IComponentStylePayLoad> {\n action: 'style';\n}\n\nexport interface IComponentMoveToPayLoad extends IActionPayload {\n destination: { x: number; y: number };\n}\nexport interface IComponentMoveToAction extends IAction<IComponentMoveToPayLoad> {\n action: 'moveTo';\n}\nexport interface IComponentScaleToPayLoad extends IActionPayload {\n scale: { scaleX: number; scaleY: number };\n}\nexport interface IComponentScaleToAction extends IAction<IComponentScaleToPayLoad> {\n action: 'scaleTo';\n}\n\nexport interface IComponentBouncePayLoad extends IActionPayload {\n /**\n * 自定义弹跳 easing path string\n */\n customEase?: string;\n /**\n * 跳跃高度\n */\n dy?: number;\n}\n\nexport interface IComponentBounceAction extends IAction<IComponentBouncePayLoad> {\n action: 'bounce';\n}\n"]}
|
|
@@ -15,7 +15,7 @@ export class ActionProcessor {
|
|
|
15
15
|
if (!character) return logger("error", `获取character失败,请检查 ${characterId} 是否绑定到一个合法的character`),
|
|
16
16
|
null;
|
|
17
17
|
const processor = this.getProcessor(character.spec.type, action.action);
|
|
18
|
-
return processor ? processor.getStartTimeAndDuration(action) : (logger("error", `获取processor失败,请检查 ${character.spec.type} 是否支持 ${action.action}`),
|
|
18
|
+
return processor ? processor.getStartTimeAndDuration(action, character) : (logger("error", `获取processor失败,请检查 ${character.spec.type} 是否支持 ${action.action}`),
|
|
19
19
|
null);
|
|
20
20
|
}
|
|
21
21
|
registerProcessor(name, processors) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3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Ae,CAAC,SAAS,GAAG,IAAI,CAAC;QAEjC,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;YAC3B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;SAC3B;IACH,CAAC;;AA7Gc,yBAAS,GAAoB,IAAI,CAAC","file":"processor.js","sourcesContent":["import type { ICharacter } from '../../story/character';\nimport type { IActionSpec, IStory } from '../../story/interface';\nimport { IActionsLink } from '../../story/interface';\nimport { logger } from '../../util/output';\nimport type { IActionProcessor, IActionProcessorItem } from './interface/action-processor';\n\nexport type IProcessorMap = Record<string, Record<string, IActionProcessorItem>>;\n\nexport interface IProcessorReturnType {\n totalTime: number;\n revertActionParams?: {\n action: string;\n payload: Record<string, any>;\n };\n}\n\nexport class ActionProcessor implements IActionProcessor {\n protected _processorMap: Map<string, Record<string, IActionProcessorItem>>;\n\n private static _instance: ActionProcessor = null;\n protected _story: IStory;\n\n constructor(story: IStory, processorMap?: IProcessorMap) {\n if (!ActionProcessor._instance) {\n this.init(story, processorMap);\n ActionProcessor._instance = this;\n }\n return ActionProcessor._instance;\n }\n\n protected init(story: IStory, processorMap?: IProcessorMap) {\n this._processorMap = new Map();\n if (processorMap) {\n for (const key in processorMap) {\n logger('info', `register ${key} processor.`); // TODO: remove log\n this.registerProcessor(key, processorMap[key]);\n }\n }\n this._story = story;\n }\n\n /**\n * 添加Action,根据Action中的characterId添加对应的characterActions实例\n * @param action\n */\n getActInfo(\n characterId: string,\n action: IActionSpec\n ): {\n startTime: number;\n duration: number;\n } | null {\n const character = this._story.getCharactersById(characterId);\n if (!character) {\n logger('error', `获取character失败,请检查 ${characterId} 是否绑定到一个合法的character`);\n return null;\n }\n\n const processor = this.getProcessor(character.spec.type, action.action);\n\n if (!processor) {\n logger('error', `获取processor失败,请检查 ${character.spec.type} 是否支持 ${action.action}`);\n return null;\n }\n return processor.getStartTimeAndDuration(action, character);\n\n // characterActions.forEach(action => {\n // const processor = this.getProcessor(character.spec.type, action.action);\n // });\n }\n\n /**\n *\n * @param name 操作对象名称\n * @param processors 操作对象支持的 processor\n * @returns boolean 注册是否成功\n */\n registerProcessor(name: string, processors: Record<string, IActionProcessorItem>) {\n if (!this._processorMap) {\n return false;\n }\n // 重复注册,目前直接替代\n this._processorMap.set(name, processors);\n return true;\n }\n\n getProcessorList(name: string) {\n return this._processorMap && this._processorMap.get(name);\n }\n\n getProcessor(name: string, actionName: string) {\n return this._processorMap && this._processorMap.get(name)?.[actionName];\n }\n\n /**\n * Execute action\n * @param name\n * @param actionName\n * @param actionParams\n * @returns IProcessorReturnType\n */\n doAction(name: string, actionName: string, character: ICharacter, actionSpec: IActionSpec): void {\n const processor = this.getProcessor(name, actionName);\n if (processor) {\n // try {\n // eslint-disable-next-line no-console\n logger('info', `Execute action => ${actionName}, character => ${name}`); // TODO: remove log\n const actionResult = processor.run(character, actionSpec);\n // eslint-disable-next-line no-console\n logger('info', `Action Executed:`, actionResult); // TODO: remove log\n return actionResult;\n // } catch (err) {\n // logger('error', `Action Executed Error: ${err}`);\n // return null;\n // }\n }\n // eslint-disable-next-line no-console\n logger('error', `Action not found: character => ${name}, action => ${actionName} `); // TODO: remove log\n return undefined;\n }\n\n release() {\n ActionProcessor._instance = null;\n\n if (this._processorMap) {\n this._processorMap.clear();\n this._processorMap = null;\n }\n }\n}\n"]}
|
|
@@ -6,10 +6,15 @@ import { ShapeVisibilityActionProcessor } from './component/shape/shape-visibili
|
|
|
6
6
|
import { TextVisibilityActionProcessor } from './component/text/text-visibility';
|
|
7
7
|
import { TimelineStateActionProcessor, TimelineVisibilityActionProcessor } from './component/timeline/timeline-visibility';
|
|
8
8
|
import { CommonBounceActionProcessor, CommonMoveToActionProcessor, CommonScaleToActionProcessor, CommonStyleActionProcessor } from './component/common-component';
|
|
9
|
+
import { RankingBarPlayActionProcessor } from './chart/rankingBar/rankingBar';
|
|
9
10
|
export declare const processorChartMap: {
|
|
10
11
|
VChart: {
|
|
11
12
|
[x: string]: VChartVisibilityActionProcessor | VChartUpdateActionProcessor | VChartAddActionProcessor | CommonBounceActionProcessor;
|
|
12
13
|
};
|
|
14
|
+
RankingBar: {
|
|
15
|
+
[x: string]: RankingBarPlayActionProcessor | VChartVisibilityActionProcessor | CommonBounceActionProcessor;
|
|
16
|
+
play: RankingBarPlayActionProcessor;
|
|
17
|
+
};
|
|
13
18
|
};
|
|
14
19
|
export declare const processorComponentMap: {
|
|
15
20
|
Rect: {
|
|
@@ -53,4 +58,8 @@ export declare const processorMap: {
|
|
|
53
58
|
VChart: {
|
|
54
59
|
[x: string]: VChartVisibilityActionProcessor | VChartUpdateActionProcessor | VChartAddActionProcessor | CommonBounceActionProcessor;
|
|
55
60
|
};
|
|
61
|
+
RankingBar: {
|
|
62
|
+
[x: string]: RankingBarPlayActionProcessor | VChartVisibilityActionProcessor | CommonBounceActionProcessor;
|
|
63
|
+
play: RankingBarPlayActionProcessor;
|
|
64
|
+
};
|
|
56
65
|
};
|
|
@@ -18,6 +18,8 @@ import { TimelineStateActionProcessor, TimelineVisibilityActionProcessor } from
|
|
|
18
18
|
|
|
19
19
|
import { CommonBounceActionProcessor, CommonMoveToActionProcessor, CommonScaleToActionProcessor, CommonStyleActionProcessor } from "./component/common-component";
|
|
20
20
|
|
|
21
|
+
import { RankingBarPlayActionProcessor } from "./chart/rankingBar/rankingBar";
|
|
22
|
+
|
|
21
23
|
export const processorChartMap = {
|
|
22
24
|
VChart: {
|
|
23
25
|
[ACTION_TYPE.APPEAR]: new VChartVisibilityActionProcessor,
|
|
@@ -25,6 +27,12 @@ export const processorChartMap = {
|
|
|
25
27
|
[ACTION_TYPE.BOUNCE]: new CommonBounceActionProcessor,
|
|
26
28
|
[VCHART_ACTION_TYPE.UPDATE]: new VChartUpdateActionProcessor,
|
|
27
29
|
[VCHART_ACTION_TYPE.ADD]: new VChartAddActionProcessor
|
|
30
|
+
},
|
|
31
|
+
RankingBar: {
|
|
32
|
+
[ACTION_TYPE.APPEAR]: new VChartVisibilityActionProcessor,
|
|
33
|
+
[ACTION_TYPE.DISAPPEAR]: new VChartVisibilityActionProcessor,
|
|
34
|
+
[ACTION_TYPE.BOUNCE]: new CommonBounceActionProcessor,
|
|
35
|
+
play: new RankingBarPlayActionProcessor
|
|
28
36
|
}
|
|
29
37
|
};
|
|
30
38
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/player/processor/processorMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAkB,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,8BAA8B,EAAE,MAAM,oCAAoC,CAAC;AACpF,OAAO,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AACxH,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAAE,8BAA8B,EAAE,MAAM,oCAAoC,CAAC;AACpF,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EACL,4BAA4B,EAC5B,iCAAiC,EAClC,MAAM,0CAA0C,CAAC;AAClD,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,4BAA4B,EAC5B,0BAA0B,EAC3B,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/player/processor/processorMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAkB,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,8BAA8B,EAAE,MAAM,oCAAoC,CAAC;AACpF,OAAO,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,+BAA+B,EAAE,MAAM,gBAAgB,C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C,WAAW,CAAC,MAAM,CAAC,EAAE,IAAI,2BAA2B,EAAE;KACxD;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,mCACpB,iBAAiB,GACjB,qBAAqB,CACzB,CAAC","file":"processorMap.js","sourcesContent":["import { ACTION_TYPE, VCHART_ACTION_TYPE } from '../../constants/action';\nimport { StoryChartType, StoryComponentType } from '../../constants/character';\nimport { ImageVisibilityActionProcessor } from './component/image/image-visibility';\nimport { VChartAddActionProcessor, VChartUpdateActionProcessor, VChartVisibilityActionProcessor } from './chart/vchart';\nimport { LineVisibilityActionProcessor } from './component/line/line-visibility';\nimport { RectVisibilityActionProcessor } from './component/rect/rect-visibility';\nimport { ShapeVisibilityActionProcessor } from './component/shape/shape-visibility';\nimport { TextVisibilityActionProcessor } from './component/text/text-visibility';\nimport {\n TimelineStateActionProcessor,\n TimelineVisibilityActionProcessor\n} from './component/timeline/timeline-visibility';\nimport {\n CommonBounceActionProcessor,\n CommonMoveToActionProcessor,\n CommonScaleToActionProcessor,\n CommonStyleActionProcessor\n} from './component/common-component';\nimport { RankingBarPlayActionProcessor } from './chart/rankingBar/rankingBar';\n\nexport const processorChartMap = {\n [StoryChartType.VCHART]: {\n [ACTION_TYPE.APPEAR]: new VChartVisibilityActionProcessor(),\n [ACTION_TYPE.DISAPPEAR]: new VChartVisibilityActionProcessor(),\n [ACTION_TYPE.BOUNCE]: new CommonBounceActionProcessor(),\n [VCHART_ACTION_TYPE.UPDATE]: new VChartUpdateActionProcessor(),\n [VCHART_ACTION_TYPE.ADD]: new VChartAddActionProcessor()\n },\n [StoryChartType.RANKINGBAR]: {\n [ACTION_TYPE.APPEAR]: new VChartVisibilityActionProcessor(),\n [ACTION_TYPE.DISAPPEAR]: new VChartVisibilityActionProcessor(),\n [ACTION_TYPE.BOUNCE]: new CommonBounceActionProcessor(),\n play: new RankingBarPlayActionProcessor()\n }\n};\n\nexport const processorComponentMap = {\n [StoryComponentType.RECT]: {\n [ACTION_TYPE.APPEAR]: new RectVisibilityActionProcessor(),\n [ACTION_TYPE.DISAPPEAR]: new RectVisibilityActionProcessor(),\n [ACTION_TYPE.STYLE]: new CommonStyleActionProcessor(),\n [ACTION_TYPE.MOVETO]: new CommonMoveToActionProcessor(),\n [ACTION_TYPE.SCALETO]: new CommonScaleToActionProcessor(),\n [ACTION_TYPE.BOUNCE]: new CommonBounceActionProcessor()\n },\n [StoryComponentType.LINE]: {\n [ACTION_TYPE.APPEAR]: new LineVisibilityActionProcessor(),\n [ACTION_TYPE.DISAPPEAR]: new LineVisibilityActionProcessor(),\n [ACTION_TYPE.STYLE]: new CommonStyleActionProcessor(),\n [ACTION_TYPE.MOVETO]: new CommonMoveToActionProcessor(),\n [ACTION_TYPE.SCALETO]: new CommonScaleToActionProcessor(),\n [ACTION_TYPE.BOUNCE]: new CommonBounceActionProcessor()\n },\n [StoryComponentType.SHAPE]: {\n [ACTION_TYPE.APPEAR]: new ShapeVisibilityActionProcessor(),\n [ACTION_TYPE.DISAPPEAR]: new ShapeVisibilityActionProcessor(),\n [ACTION_TYPE.STYLE]: new CommonStyleActionProcessor(),\n [ACTION_TYPE.MOVETO]: new CommonMoveToActionProcessor(),\n [ACTION_TYPE.SCALETO]: new CommonScaleToActionProcessor(),\n [ACTION_TYPE.BOUNCE]: new CommonBounceActionProcessor()\n },\n [StoryComponentType.IMAGE]: {\n [ACTION_TYPE.APPEAR]: new ImageVisibilityActionProcessor(),\n [ACTION_TYPE.DISAPPEAR]: new ImageVisibilityActionProcessor(),\n [ACTION_TYPE.STYLE]: new CommonStyleActionProcessor(),\n [ACTION_TYPE.MOVETO]: new CommonMoveToActionProcessor(),\n [ACTION_TYPE.SCALETO]: new CommonScaleToActionProcessor(),\n [ACTION_TYPE.BOUNCE]: new CommonBounceActionProcessor()\n },\n [StoryComponentType.TEXT]: {\n [ACTION_TYPE.APPEAR]: new TextVisibilityActionProcessor(),\n [ACTION_TYPE.DISAPPEAR]: new TextVisibilityActionProcessor(),\n [ACTION_TYPE.STYLE]: new CommonStyleActionProcessor(),\n [ACTION_TYPE.MOVETO]: new CommonMoveToActionProcessor(),\n [ACTION_TYPE.SCALETO]: new CommonScaleToActionProcessor(),\n [ACTION_TYPE.BOUNCE]: new CommonBounceActionProcessor()\n },\n [StoryComponentType.TIMELINE]: {\n [ACTION_TYPE.APPEAR]: new TimelineVisibilityActionProcessor(),\n [ACTION_TYPE.DISAPPEAR]: new TimelineVisibilityActionProcessor(),\n [ACTION_TYPE.STYLE]: new CommonStyleActionProcessor(),\n [ACTION_TYPE.MOVETO]: new CommonMoveToActionProcessor(),\n [ACTION_TYPE.SCALETO]: new CommonScaleToActionProcessor(),\n [ACTION_TYPE.STATE]: new TimelineStateActionProcessor(),\n [ACTION_TYPE.BOUNCE]: new CommonBounceActionProcessor()\n }\n};\n\nexport const processorMap = {\n ...processorChartMap,\n ...processorComponentMap\n};\n"]}
|
package/es/player/scheduler.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isString } from "@visactor/vutils";
|
|
2
|
+
|
|
1
3
|
class ActionItem {
|
|
2
4
|
constructor(st, d, as, ci) {
|
|
3
5
|
this.startTime = st, this.duration = d, this.actionSpec = as, this.characterId = ci;
|
|
@@ -39,7 +41,7 @@ export class Scheduler {
|
|
|
39
41
|
return toAct.sceneInfoList.forEach((sceneInfo => {
|
|
40
42
|
const {startTime: sceneStartTime} = sceneInfo;
|
|
41
43
|
sceneInfo.actionList.forEach((actionInfo => {
|
|
42
|
-
sceneStartTime + actionInfo.startTime
|
|
44
|
+
sceneStartTime + actionInfo.startTime <= formatToTime && (this._runnedAct.has(actionInfo) || (this._runnedAct.add(actionInfo),
|
|
43
45
|
actions.push(actionInfo)));
|
|
44
46
|
}));
|
|
45
47
|
})), actions;
|
|
@@ -71,17 +73,19 @@ export class Scheduler {
|
|
|
71
73
|
scene.actions.forEach(((action, actIdx) => {
|
|
72
74
|
let character_st = 1 / 0, character_et = -1 / 0;
|
|
73
75
|
action.characterActions.forEach((ca => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
(isString(action.characterId) ? [ action.characterId ] : action.characterId).forEach((characterId => {
|
|
77
|
+
const info = this._actionProcessor.getActInfo(characterId, ca);
|
|
78
|
+
if (!info) return;
|
|
79
|
+
const item = new ActionItem(info.startTime, info.duration, ca, characterId);
|
|
80
|
+
character_st = Math.max(Math.min(item.startTime, character_st), 0), character_et = Math.max(item.startTime + item.duration, character_et),
|
|
81
|
+
actionList.push(item);
|
|
82
|
+
}));
|
|
79
83
|
})), scene_st = actIdx ? Math.max(Math.min(character_st, scene_st), 0) : character_st,
|
|
80
84
|
scene_et = actIdx ? Math.max(character_et, scene_et) : character_et;
|
|
81
85
|
}));
|
|
82
86
|
return {
|
|
83
|
-
startTime: sceneStartTime
|
|
84
|
-
duration: scene_et
|
|
87
|
+
startTime: sceneStartTime,
|
|
88
|
+
duration: scene_et,
|
|
85
89
|
id: scene.id,
|
|
86
90
|
actionList: actionList
|
|
87
91
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/player/scheduler.ts"],"names":[],"mappings":"AA0BA,MAAM,UAAU;IAMd,YAAY,EAAU,EAAE,CAAS,EAAE,EAAe,EAAE,EAAU;QAC5D,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACxB,CAAC;CACF;AAED,MAAM,OAAO,SAAS;IAKpB,YAAY,eAAiC;QAC3C,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAC;QACxC,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,EAAE,CAAC;IAC9B,CAAC;IAED,IAAI,CAAC,IAAgB;QACnB,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,QAAQ,CAAC,I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{ IStory } from '../story/interface';\nimport type { IActionProcessor } from './processor/interface/action-processor';\nimport type { IScheduler } from './interface/scheduler';\n\ninterface IActInfo {\n startTime: number;\n duration: number;\n id: string;\n sceneInfoList: ISceneInfo[];\n}\ninterface ISceneInfo {\n startTime: number;\n duration: number;\n id: string;\n actionList: IActionItem[];\n}\n\nexport interface IActionItem {\n startTime: number;\n duration: number;\n actionSpec: IActionSpec;\n characterId: string;\n}\n\nclass ActionItem implements IActionItem {\n startTime: number;\n duration: number;\n actionSpec: IActionSpec;\n characterId: string;\n\n constructor(st: number, d: number, as: IActionSpec, ci: string) {\n this.startTime = st;\n this.duration = d;\n this.actionSpec = as;\n this.characterId = ci;\n }\n}\n\nexport class Scheduler implements IScheduler {\n protected _actionProcessor: IActionProcessor;\n protected _actsInfo: IActInfo[];\n protected _runnedAct: Set<IActionItem>;\n\n constructor(actionProcessor: IActionProcessor) {\n this._actionProcessor = actionProcessor;\n this._runnedAct = new Set();\n }\n\n init(acts: IActSpec[]) {\n this.clearState();\n this.initActs(acts);\n }\n\n clearState(): void {\n this._runnedAct.clear();\n }\n\n getTotalTime(): number {\n return this._actsInfo.reduce((t, actInfo) => Math.max(t, actInfo.startTime + actInfo.duration), 0);\n }\n\n findActByTime(t: number) {\n // 规范化t\n const totalTime = this.getTotalTime();\n if (totalTime <= 0) {\n return {\n actInfo: this._actsInfo[0],\n t: 0\n };\n }\n for (let i = 0; i < this._actsInfo.length; i++) {\n const actInfo = this._actsInfo[i];\n if (actInfo.startTime <= t && actInfo.startTime + actInfo.duration > t) {\n return {\n actInfo: actInfo,\n t: t - actInfo.startTime\n };\n }\n }\n return {\n actInfo: this._actsInfo[this._actsInfo.length - 1],\n t: t - this._actsInfo[this._actsInfo.length - 1].startTime\n };\n }\n\n /**\n * 获取某个时间区间的所有Action,toTime实际上是当前时间,fromTime是上一次的时间\n * 避免跳帧\n * @param fromTime 上一次的时间\n * @param toTime 当前时间\n */\n getActionsInRange(fromTime: number, toTime: number) {\n // 先找到目前是在哪个幕中\n const { actInfo: fromAct, t: formatFromTime } = this.findActByTime(fromTime);\n const { actInfo: toAct, t: formatToTime } = this.findActByTime(toTime);\n if (fromAct !== toAct) {\n // TODO 跳帧了\n }\n // const formatFromTime = Scheduler.formatTimeInAction(fromTime, toAct);\n // const formatToTime = Scheduler.formatTimeInAction(toTime, toAct);\n\n const actions: IActionItem[] = [];\n toAct.sceneInfoList.forEach(sceneInfo => {\n const { startTime: sceneStartTime } = sceneInfo;\n sceneInfo.actionList.forEach(actionInfo => {\n const startTime = sceneStartTime + actionInfo.startTime;\n if (startTime < formatToTime) {\n if (!this._runnedAct.has(actionInfo)) {\n this._runnedAct.add(actionInfo);\n actions.push(actionInfo);\n }\n }\n });\n });\n // actions.length && console.log('找到', fromTime, toTime, actions);\n return actions;\n }\n\n protected initActs(acts: IActSpec[]) {\n // act与act之间是串联的\n let startTime = 0;\n this._actsInfo = acts.map(act => {\n const actInfo = this._getActInfo(act, startTime);\n startTime += actInfo.duration;\n return actInfo;\n });\n }\n\n protected _getActInfo(act: IActSpec, actStartTime: number): IActInfo {\n let sceneStartTime = 0;\n const sceneInfoList = act.scenes.map(scene => {\n const sceneInfo = this._getSceneInfo(scene, sceneStartTime + (scene.delay ?? 0));\n sceneStartTime = sceneInfo.startTime + sceneInfo.duration;\n return sceneInfo;\n });\n const startTime = sceneInfoList.reduce((st, info) => Math.min(info.startTime, st), 0);\n const endTime = sceneInfoList.reduce((et, info) => Math.max(info.startTime + info.duration, et), 0);\n return {\n startTime: actStartTime,\n duration: startTime + endTime - startTime,\n id: act.id,\n sceneInfoList\n };\n }\n\n protected _getSceneInfo(scene: ISceneSpec, sceneStartTime: number): ISceneInfo {\n let scene_st = 0;\n let scene_et = 0;\n const actionList: IActionItem[] = [];\n scene.actions.forEach((action, actIdx) => {\n let character_st = Infinity;\n let character_et = -Infinity;\n action.characterActions.forEach(ca => {\n const info = this._actionProcessor.getActInfo(action.characterId, ca);\n if (!info) {\n return;\n }\n const item = new ActionItem(info.startTime, info.duration, ca, action.characterId);\n\n character_st = Math.max(Math.min(item.startTime, character_st), 0);\n character_et = Math.max(item.startTime + item.duration, character_et);\n actionList.push(item);\n });\n\n scene_st = !actIdx ? character_st : Math.max(Math.min(character_st, scene_st), 0);\n scene_et = !actIdx ? character_et : Math.max(character_et, scene_et);\n });\n\n const sceneInfo: ISceneInfo = {\n startTime: sceneStartTime + scene_st,\n duration: scene_et - scene_st,\n id: scene.id,\n actionList\n };\n\n return sceneInfo;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/player/scheduler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AA0BtD,MAAM,UAAU;IAMd,YAAY,EAAU,EAAE,CAAS,EAAE,EAAe,EAAE,EAAU;QAC5D,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACxB,CAAC;CACF;AAED,MAAM,OAAO,SAAS;IAKpB,YAAY,eAAiC;QAC3C,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAC;QACxC,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,EAAE,CAAC;IAC9B,CAAC;IAED,IAAI,CAAC,IAAgB;QACnB,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IAED,UAAU;QACR,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,EAAE,C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AAE,CAAC,CAAC;oBAC/D,IAAI,CAAC,IAAI,EAAE;wBACT,OAAO;qBACR;oBACD,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC;oBAE5E,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC;oBACnE,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;oBACtE,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACxB,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,QAAQ,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;YAClF,QAAQ,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;QAEH,MAAM,SAAS,GAAe;YAC5B,SAAS,EAAE,cAAc;YACzB,QAAQ,EAAE,QAAQ;YAClB,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,UAAU;SACX,CAAC;QAEF,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","file":"scheduler.js","sourcesContent":["import { isNumber, isString } from '@visactor/vutils';\nimport type { IActionSpec, IActSpec, ISceneSpec } from '../story/interface';\nimport { IStory } from '../story/interface';\nimport type { IActionProcessor } from './processor/interface/action-processor';\nimport type { IScheduler } from './interface/scheduler';\n\ninterface IActInfo {\n startTime: number;\n duration: number;\n id: string;\n sceneInfoList: ISceneInfo[];\n}\ninterface ISceneInfo {\n startTime: number;\n duration: number;\n id: string;\n actionList: IActionItem[];\n}\n\nexport interface IActionItem {\n startTime: number;\n duration: number;\n actionSpec: IActionSpec;\n characterId: string;\n}\n\nclass ActionItem implements IActionItem {\n startTime: number;\n duration: number;\n actionSpec: IActionSpec;\n characterId: string;\n\n constructor(st: number, d: number, as: IActionSpec, ci: string) {\n this.startTime = st;\n this.duration = d;\n this.actionSpec = as;\n this.characterId = ci;\n }\n}\n\nexport class Scheduler implements IScheduler {\n protected _actionProcessor: IActionProcessor;\n protected _actsInfo: IActInfo[];\n protected _runnedAct: Set<IActionItem>;\n\n constructor(actionProcessor: IActionProcessor) {\n this._actionProcessor = actionProcessor;\n this._runnedAct = new Set();\n }\n\n init(acts: IActSpec[]) {\n this.clearState();\n this.initActs(acts);\n }\n\n clearState(): void {\n this._runnedAct.clear();\n }\n\n getTotalTime(): number {\n return this._actsInfo.reduce((t, actInfo) => Math.max(t, actInfo.startTime + actInfo.duration), 0);\n }\n\n findActByTime(t: number) {\n // 规范化t\n const totalTime = this.getTotalTime();\n if (totalTime <= 0) {\n return {\n actInfo: this._actsInfo[0],\n t: 0\n };\n }\n for (let i = 0; i < this._actsInfo.length; i++) {\n const actInfo = this._actsInfo[i];\n if (actInfo.startTime <= t && actInfo.startTime + actInfo.duration > t) {\n return {\n actInfo: actInfo,\n t: t - actInfo.startTime\n };\n }\n }\n return {\n actInfo: this._actsInfo[this._actsInfo.length - 1],\n t: t - this._actsInfo[this._actsInfo.length - 1].startTime\n };\n }\n\n /**\n * 获取某个时间区间的所有Action,toTime实际上是当前时间,fromTime是上一次的时间\n * 避免跳帧\n * @param fromTime 上一次的时间\n * @param toTime 当前时间\n */\n getActionsInRange(fromTime: number, toTime: number) {\n // 先找到目前是在哪个幕中\n const { actInfo: fromAct, t: formatFromTime } = this.findActByTime(fromTime);\n const { actInfo: toAct, t: formatToTime } = this.findActByTime(toTime);\n if (fromAct !== toAct) {\n // TODO 跳帧了\n }\n // const formatFromTime = Scheduler.formatTimeInAction(fromTime, toAct);\n // const formatToTime = Scheduler.formatTimeInAction(toTime, toAct);\n\n const actions: IActionItem[] = [];\n toAct.sceneInfoList.forEach(sceneInfo => {\n const { startTime: sceneStartTime } = sceneInfo;\n sceneInfo.actionList.forEach(actionInfo => {\n const startTime = sceneStartTime + actionInfo.startTime;\n if (startTime <= formatToTime) {\n if (!this._runnedAct.has(actionInfo)) {\n this._runnedAct.add(actionInfo);\n actions.push(actionInfo);\n }\n }\n });\n });\n // actions.length && console.log('找到', fromTime, toTime, actions);\n return actions;\n }\n\n protected initActs(acts: IActSpec[]) {\n // act与act之间是串联的\n let startTime = 0;\n this._actsInfo = acts.map(act => {\n const actInfo = this._getActInfo(act, startTime);\n startTime += actInfo.duration;\n return actInfo;\n });\n }\n\n protected _getActInfo(act: IActSpec, actStartTime: number): IActInfo {\n let sceneStartTime = 0;\n const sceneInfoList = act.scenes.map(scene => {\n const sceneInfo = this._getSceneInfo(scene, sceneStartTime + (scene.delay ?? 0));\n sceneStartTime = sceneInfo.startTime + sceneInfo.duration;\n return sceneInfo;\n });\n const startTime = sceneInfoList.reduce((st, info) => Math.min(info.startTime, st), 0);\n const endTime = sceneInfoList.reduce((et, info) => Math.max(info.startTime + info.duration, et), 0);\n return {\n startTime: actStartTime,\n duration: startTime + endTime - startTime,\n id: act.id,\n sceneInfoList\n };\n }\n\n protected _getSceneInfo(scene: ISceneSpec, sceneStartTime: number): ISceneInfo {\n let scene_st = 0;\n let scene_et = 0;\n const actionList: IActionItem[] = [];\n scene.actions.forEach((action, actIdx) => {\n let character_st = Infinity;\n let character_et = -Infinity;\n action.characterActions.forEach(ca => {\n const characterIdList = isString(action.characterId) ? [action.characterId] : action.characterId;\n characterIdList.forEach(characterId => {\n const info = this._actionProcessor.getActInfo(characterId, ca);\n if (!info) {\n return;\n }\n const item = new ActionItem(info.startTime, info.duration, ca, characterId);\n\n character_st = Math.max(Math.min(item.startTime, character_st), 0);\n character_et = Math.max(item.startTime + item.duration, character_et);\n actionList.push(item);\n });\n });\n\n scene_st = !actIdx ? character_st : Math.max(Math.min(character_st, scene_st), 0);\n scene_et = !actIdx ? character_et : Math.max(character_et, scene_et);\n });\n\n const sceneInfo: ISceneInfo = {\n startTime: sceneStartTime,\n duration: scene_et,\n id: scene.id,\n actionList\n };\n\n return sceneInfo;\n }\n}\n"]}
|
|
@@ -28,17 +28,16 @@ export class StoryCanvas {
|
|
|
28
28
|
width: this._canvas.clientWidth,
|
|
29
29
|
height: this._canvas.clientHeight,
|
|
30
30
|
canvasControled: !0,
|
|
31
|
-
autoRender: !
|
|
31
|
+
autoRender: !0,
|
|
32
32
|
disableDirtyBounds: !0,
|
|
33
33
|
ticker: new ManualTicker([]),
|
|
34
|
+
pluginList: [ "RichTextEditPlugin" ],
|
|
34
35
|
dpr: window.devicePixelRatio,
|
|
35
36
|
event: {
|
|
36
37
|
clickInterval: 300
|
|
37
38
|
}
|
|
38
39
|
});
|
|
39
|
-
this._stage = stage
|
|
40
|
-
"click" === type && console.log("canvas", e);
|
|
41
|
-
}));
|
|
40
|
+
this._stage = stage;
|
|
42
41
|
}
|
|
43
42
|
getEventDetail(event) {
|
|
44
43
|
const characterMap = this._story.getCharacters();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/story/canvas/canvas.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACpG,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAInD,gBAAgB,EAAE,CAAC;AACnB,cAAc,CAAC,SAAS,CAAC,CAAC;AAC1B,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AAE1B,MAAM,OAAO,WAAW;IAItB,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,SAAS;QACP,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sourcesContent":["import type { Story } from '../story';\nimport type { IStage } from '@visactor/vrender';\nimport { createStage, vglobal, container, preLoadAllModule, ManualTicker } from '@visactor/vrender';\nimport { loadBrowserEnv } from '@visactor/vrender';\nimport type { IStoryCanvas, StoryEvent } from '../interface/runtime-interface';\nimport type { ICharacter } from '../character/runtime-interface';\n\npreLoadAllModule();\nloadBrowserEnv(container);\nvglobal.setEnv('browser');\n\nexport class StoryCanvas implements IStoryCanvas {\n protected _story: Story;\n protected _canvas: HTMLCanvasElement;\n protected _stage: IStage;\n getStage() {\n return this._stage;\n }\n\n getCanvas() {\n return this._canvas;\n }\n\n protected _container: HTMLDivElement;\n get container() {\n return this._container;\n }\n\n constructor(story: Story, container: HTMLDivElement) {\n this._story = story;\n this._container = container;\n this._initCanvas();\n }\n\n protected _initCanvas() {\n const canvas = document.createElement('canvas');\n canvas.width = this._container.clientWidth * window.devicePixelRatio;\n canvas.height = this._container.clientHeight * window.devicePixelRatio;\n canvas.style.width = this._container.clientWidth + 'px';\n canvas.style.height = this._container.clientHeight + 'px';\n canvas.style.position = 'absolute';\n canvas.id = `_visactor_story_canvas_${this._story.id}`;\n this._container.appendChild(canvas);\n this._canvas = canvas;\n const stage = createStage({\n canvas: this._canvas,\n width: this._canvas.clientWidth,\n height: this._canvas.clientHeight,\n canvasControled: true,\n // 得开启自动渲染,否则编辑场景中无法触发视图更新\n autoRender: true,\n disableDirtyBounds: true,\n ticker: new ManualTicker([]),\n pluginList: ['RichTextEditPlugin'],\n dpr: window.devicePixelRatio,\n event: {\n clickInterval: 300\n }\n });\n // @ts-ignore\n this._stage = stage;\n }\n\n getEventDetail(event: StoryEvent) {\n // 得到交互元素的详细信息\n const characterMap = this._story.getCharacters();\n let characterInfo;\n let character: ICharacter;\n Object.keys(this._story.getCharacters()).find(id => {\n const characterTemp = characterMap[id];\n const info = characterTemp.checkEvent(event);\n if (info) {\n characterInfo = info;\n character = characterTemp;\n return true;\n }\n return false;\n });\n\n return {\n character,\n characterInfo\n };\n }\n\n release() {\n this._stage.release();\n }\n}\n"]}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import type { IBoundsLike } from '@visactor/vutils';
|
|
1
2
|
import type { ICharacterInitOption, ICharacterPickInfo } from '../runtime-interface';
|
|
2
3
|
import type { ICharacter, ICharacterSpec } from '..';
|
|
3
4
|
import type { IGroup } from '@visactor/vrender';
|
|
4
5
|
import type { StoryEvent } from '../../interface';
|
|
5
6
|
export declare abstract class CharacterBase implements ICharacter {
|
|
6
7
|
readonly id: string;
|
|
8
|
+
readonly visActorType: string;
|
|
9
|
+
readonly type: string;
|
|
7
10
|
protected _spec: ICharacterSpec;
|
|
8
11
|
get spec(): ICharacterSpec;
|
|
9
12
|
protected _graphic: any;
|
|
@@ -23,6 +26,7 @@ export declare abstract class CharacterBase implements ICharacter {
|
|
|
23
26
|
abstract hide(): void;
|
|
24
27
|
getPositionData(): void;
|
|
25
28
|
abstract getGraphicParent(): IGroup;
|
|
29
|
+
abstract getLayoutBounds(): IBoundsLike;
|
|
26
30
|
abstract clearCharacter(): void;
|
|
27
31
|
abstract checkEvent(event: StoryEvent): false | ICharacterPickInfo;
|
|
28
32
|
release(): void;
|
|
@@ -11,7 +11,7 @@ export class CharacterBase {
|
|
|
11
11
|
return this._option;
|
|
12
12
|
}
|
|
13
13
|
constructor(spec, option) {
|
|
14
|
-
this.id = spec.id, this._spec = spec, this._option = option;
|
|
14
|
+
this.type = spec.type, this.id = spec.id, this._spec = spec, this._option = option;
|
|
15
15
|
}
|
|
16
16
|
updateSpec(spec) {
|
|
17
17
|
var _a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/story/character/base/base.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/story/character/base/base.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAOlD,MAAM,OAAgB,aAAa;IAKjC,IAAI,IAAI;QACN,OAA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EAAE,CAAC;IACd,CAAC;IASD,eAAe;QACb,OAAO;IACT,CAAC;IAQD,OAAO;QACL,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IACjE,CAAC;CACF","file":"base.js","sourcesContent":["import type { IBoundsLike } from '@visactor/vutils';\nimport { isValid, merge } from '@visactor/vutils';\nimport type { ICharacterInitOption, ICharacterPickInfo } from '../runtime-interface';\nimport type { ICharacter, ICharacterSpec } from '..';\nimport type { IGroup } from '@visactor/vrender';\nimport type { StoryEvent } from '../../interface';\nimport { IVisactorGraphic } from '../visactor/interface';\n\nexport abstract class CharacterBase implements ICharacter {\n readonly id: string;\n readonly visActorType: string;\n readonly type: string;\n protected _spec: ICharacterSpec;\n get spec() {\n return this._spec;\n }\n protected declare _graphic: any;\n get graphic() {\n return this._graphic;\n }\n\n protected _option: ICharacterInitOption;\n get option() {\n return this._option;\n }\n\n constructor(spec: ICharacterSpec, option: ICharacterInitOption) {\n this.type = spec.type;\n this.id = spec.id;\n this._spec = spec;\n this._option = option;\n }\n updateSpec(spec: Omit<Partial<ICharacterSpec>, 'id' | 'type'>): void {\n if (spec.position) {\n this._spec.position = spec.position;\n }\n if (isValid(spec.zIndex)) {\n this._spec.zIndex = spec.zIndex;\n }\n if (spec.options) {\n this._spec.options = merge(this._spec.options ?? {}, spec.options);\n }\n }\n\n setAttributes(attr: Record<string, any>) {\n throw new Error('请重载setAttributes函数');\n }\n\n tickTo(t: number): void {\n throw new Error('Method not implemented.');\n }\n\n init() {\n this._initRuntime();\n this._parserSpec();\n this._initGraphics();\n }\n\n reset() {\n this.clearCharacter();\n this.init();\n }\n\n protected abstract _initRuntime(): void;\n protected abstract _parserSpec(): void;\n protected abstract _initGraphics(): void;\n\n abstract show(): void;\n abstract hide(): void;\n\n getPositionData() {\n return;\n }\n\n abstract getGraphicParent(): IGroup;\n abstract getLayoutBounds(): IBoundsLike;\n\n abstract clearCharacter(): void;\n\n abstract checkEvent(event: StoryEvent): false | ICharacterPickInfo;\n release() {\n this.graphic && this.graphic.release && this.graphic.release();\n }\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IChartCharacterRuntimeConstructor } from './runtime/interface';
|
|
2
2
|
import type { IChartCharacterSpec } from '../dsl-interface';
|
|
3
|
+
import { Chart } from './graphic/vchart-graphic';
|
|
3
4
|
import { CharacterVisactor } from '../visactor/character';
|
|
4
5
|
import { SpecProcess } from './spec-process/spec-process';
|
|
5
6
|
import type { ITicker } from '@visactor/vrender';
|
|
@@ -8,18 +9,32 @@ import type { ICharacterPickInfo } from '../runtime-interface';
|
|
|
8
9
|
export declare class CharacterChart extends CharacterVisactor {
|
|
9
10
|
static type: string;
|
|
10
11
|
static RunTime: IChartCharacterRuntimeConstructor[];
|
|
12
|
+
readonly visActorType = "chart";
|
|
11
13
|
protected _specProcess: SpecProcess;
|
|
12
14
|
protected _ticker: ITicker;
|
|
15
|
+
_graphic: Chart;
|
|
13
16
|
protected _spec: IChartCharacterSpec;
|
|
14
17
|
get spec(): IChartCharacterSpec;
|
|
15
18
|
protected _initSpecProcess(): void;
|
|
16
19
|
protected _initRuntime(): void;
|
|
17
20
|
protected _parserSpec(): void;
|
|
18
21
|
protected _initGraphics(): void;
|
|
22
|
+
setAttributes(attr: Record<string, any>): void;
|
|
23
|
+
getViewBoxFromSpec(): {
|
|
24
|
+
layout: Partial<import("../runtime-interface").ILayoutAttribute>;
|
|
25
|
+
viewBox: {
|
|
26
|
+
x1: number;
|
|
27
|
+
x2: number;
|
|
28
|
+
y1: number;
|
|
29
|
+
y2: number;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
private _getChartOption;
|
|
19
33
|
protected _afterRender(): void;
|
|
20
34
|
protected _updateVisactorSpec(): void;
|
|
21
35
|
clearCharacter(): void;
|
|
22
36
|
tickTo(t: number): void;
|
|
23
37
|
checkEvent(event: StoryEvent): false | ICharacterPickInfo;
|
|
24
38
|
release(): void;
|
|
39
|
+
private _reflow;
|
|
25
40
|
}
|
|
@@ -2,14 +2,12 @@ import { CommonSpecRuntime } from "./runtime/common-spec";
|
|
|
2
2
|
|
|
3
3
|
import { ComponentSpecRuntime } from "./runtime/component-spec";
|
|
4
4
|
|
|
5
|
-
import { cloneDeep } from "@visactor/vutils";
|
|
5
|
+
import { cloneDeep, merge } from "@visactor/vutils";
|
|
6
6
|
|
|
7
|
-
import VChart from "@visactor/vchart";
|
|
7
|
+
import { VChart } from "@visactor/vchart";
|
|
8
8
|
|
|
9
9
|
import { Chart } from "./graphic/vchart-graphic";
|
|
10
10
|
|
|
11
|
-
import { getLayoutFromWidget } from "../../utils/layout";
|
|
12
|
-
|
|
13
11
|
import { CharacterVisactor } from "../visactor/character";
|
|
14
12
|
|
|
15
13
|
import { SpecProcess } from "./spec-process/spec-process";
|
|
@@ -18,7 +16,14 @@ import { ChartDataTempTransform } from "./spec-process/data-temp-transform";
|
|
|
18
16
|
|
|
19
17
|
import { SeriesSpecRuntime } from "./runtime/series-spec";
|
|
20
18
|
|
|
19
|
+
import { getLayoutFromWidget } from "../../utils/layout";
|
|
20
|
+
|
|
21
|
+
import { getChartModelWithEvent } from "../../utils/vchart-pick";
|
|
22
|
+
|
|
21
23
|
export class CharacterChart extends CharacterVisactor {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments), this.visActorType = "chart";
|
|
26
|
+
}
|
|
22
27
|
get spec() {
|
|
23
28
|
return this._spec;
|
|
24
29
|
}
|
|
@@ -34,14 +39,9 @@ export class CharacterChart extends CharacterVisactor {
|
|
|
34
39
|
this._specProcess.updateConfig(this._spec);
|
|
35
40
|
}
|
|
36
41
|
_initGraphics() {
|
|
37
|
-
var _a;
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
x2: layout.x + layout.width,
|
|
41
|
-
y1: layout.y,
|
|
42
|
-
y2: layout.y + layout.height
|
|
43
|
-
}, spec = cloneDeep(this._specProcess.getVisSpec());
|
|
44
|
-
spec.width = layout.width, spec.height = layout.height, this._graphic = new Chart(Object.assign(Object.assign({
|
|
42
|
+
var _a, _b;
|
|
43
|
+
const {spec: spec, viewBox: viewBox} = this._getChartOption();
|
|
44
|
+
this._graphic = new Chart(Object.assign(Object.assign({
|
|
45
45
|
renderCanvas: this._option.canvas.getCanvas(),
|
|
46
46
|
spec: spec,
|
|
47
47
|
ClassType: VChart,
|
|
@@ -56,7 +56,7 @@ export class CharacterChart extends CharacterVisactor {
|
|
|
56
56
|
ticker: this._option.canvas.getStage().ticker,
|
|
57
57
|
visibleAll: !1
|
|
58
58
|
}, null !== (_a = this._spec.options.panel) && void 0 !== _a ? _a : {}), {
|
|
59
|
-
chartInitOptions: {
|
|
59
|
+
chartInitOptions: merge({
|
|
60
60
|
animation: !0,
|
|
61
61
|
disableTriggerEvent: !0,
|
|
62
62
|
performanceHook: {
|
|
@@ -76,9 +76,32 @@ export class CharacterChart extends CharacterVisactor {
|
|
|
76
76
|
}));
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
}
|
|
79
|
+
}, null !== (_b = this._spec.options.initOption) && void 0 !== _b ? _b : {})
|
|
80
80
|
})), this.option.graphicParent.add(this._graphic);
|
|
81
81
|
}
|
|
82
|
+
setAttributes(attr) {
|
|
83
|
+
attr.position && (this._spec.position = attr.position, this._graphic.updateViewBox(this.getViewBoxFromSpec().viewBox));
|
|
84
|
+
}
|
|
85
|
+
getViewBoxFromSpec() {
|
|
86
|
+
const layout = getLayoutFromWidget(this._spec.position);
|
|
87
|
+
return {
|
|
88
|
+
layout: layout,
|
|
89
|
+
viewBox: {
|
|
90
|
+
x1: layout.x,
|
|
91
|
+
x2: layout.x + layout.width,
|
|
92
|
+
y1: layout.y,
|
|
93
|
+
y2: layout.y + layout.height
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
_getChartOption() {
|
|
98
|
+
var _a;
|
|
99
|
+
const {layout: layout, viewBox: viewBox} = this.getViewBoxFromSpec(), spec = cloneDeep(null !== (_a = this._specProcess.getVisSpec()) && void 0 !== _a ? _a : this._spec.options.spec);
|
|
100
|
+
return spec.width = layout.width, spec.height = layout.height, {
|
|
101
|
+
viewBox: viewBox,
|
|
102
|
+
spec: spec
|
|
103
|
+
};
|
|
104
|
+
}
|
|
82
105
|
_afterRender() {}
|
|
83
106
|
_updateVisactorSpec() {
|
|
84
107
|
var _a;
|
|
@@ -91,11 +114,31 @@ export class CharacterChart extends CharacterVisactor {
|
|
|
91
114
|
this._ticker.tickAt(t);
|
|
92
115
|
}
|
|
93
116
|
checkEvent(event) {
|
|
94
|
-
|
|
117
|
+
var _a;
|
|
118
|
+
if (!(null !== (_a = event.detailPath) && void 0 !== _a ? _a : event.path).some((g => g === this._graphic))) return !1;
|
|
119
|
+
const chartPath = event.detailPath[event.detailPath.length - 1], result = getChartModelWithEvent(this._graphic.vProduct, event);
|
|
120
|
+
if (!result) return !!this._graphic.pointInViewBox(event.canvasX, event.canvasY) && {
|
|
121
|
+
part: "null",
|
|
122
|
+
graphic: null,
|
|
123
|
+
modelInfo: null,
|
|
124
|
+
graphicType: "null"
|
|
125
|
+
};
|
|
126
|
+
const graphic = null == chartPath ? void 0 : chartPath[chartPath.length - 1];
|
|
127
|
+
return {
|
|
128
|
+
part: result.type,
|
|
129
|
+
modelInfo: result,
|
|
130
|
+
graphic: graphic,
|
|
131
|
+
graphicType: graphic.type
|
|
132
|
+
};
|
|
95
133
|
}
|
|
96
134
|
release() {
|
|
97
135
|
this.option.graphicParent.removeChild(this._graphic), this._graphic.release && this._graphic.release();
|
|
98
136
|
}
|
|
137
|
+
_reflow() {
|
|
138
|
+
if (!this._graphic) return void this._initGraphics();
|
|
139
|
+
const {spec: spec} = this._getChartOption();
|
|
140
|
+
this._graphic.updateSpec(spec);
|
|
141
|
+
}
|
|
99
142
|
}
|
|
100
143
|
|
|
101
144
|
CharacterChart.type = "CharacterChart", CharacterChart.RunTime = [ ComponentSpecRuntime, C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ACjE,iBAAiE;CAClE,CAAC","file":"character.js","sourcesContent":["import { CommonSpecRuntime } from './runtime/common-spec';\nimport { ComponentSpecRuntime } from './runtime/component-spec';\nimport type { IChartCharacterRuntimeConstructor } from './runtime/interface';\nimport { cloneDeep } from '@visactor/vutils';\nimport VChart from '@visactor/vchart';\nimport type { IChartCharacterSpec } from '../dsl-interface';\nimport { Chart } from './graphic/vchart-graphic';\nimport { getLayoutFromWidget } from '../../utils/layout';\nimport { CharacterVisactor } from '../visactor/character';\nimport { SpecProcess } from './spec-process/spec-process';\nimport { ChartDataTempTransform } from './spec-process/data-temp-transform';\nimport type { ITicker } from '@visactor/vrender';\nimport type { IChartTemp } from './temp/interface';\nimport { SeriesSpecRuntime } from './runtime/series-spec';\nimport type { StoryEvent } from '../../interface/runtime-interface';\nimport type { ICharacterPickInfo } from '../runtime-interface';\n\nexport class CharacterChart extends CharacterVisactor {\n static type = 'CharacterChart';\n static RunTime: IChartCharacterRuntimeConstructor[] = [\n ComponentSpecRuntime as unknown as IChartCharacterRuntimeConstructor,\n CommonSpecRuntime as unknown as IChartCharacterRuntimeConstructor,\n SeriesSpecRuntime as unknown as IChartCharacterRuntimeConstructor\n ];\n\n protected declare _specProcess: SpecProcess;\n protected _ticker: ITicker;\n\n protected declare _spec: IChartCharacterSpec;\n get spec() {\n return this._spec;\n }\n\n protected _initSpecProcess(): void {\n this._specProcess = new SpecProcess(this as any, ChartDataTempTransform, this.onSpecReady);\n }\n\n protected _initRuntime(): void {\n CharacterChart.RunTime.forEach(R => {\n this._runtime.push(new R(this));\n });\n }\n\n protected _parserSpec(): void {\n this._specProcess.updateConfig(this._spec);\n }\n protected _initGraphics(): void {\n // this._ticker = new ManualTicker([]);\n const layout = getLayoutFromWidget(this._spec.position);\n const viewBox = {\n x1: layout.x,\n x2: layout.x + layout.width,\n y1: layout.y,\n y2: layout.y + layout.height\n };\n const spec = cloneDeep(this._specProcess.getVisSpec());\n spec.width = layout.width;\n spec.height = layout.height;\n // @ts-ignore\n this._graphic = new Chart({\n renderCanvas: this._option.canvas.getCanvas(),\n spec: spec,\n ClassType: VChart,\n vchart: null,\n zIndex: this._spec.zIndex,\n mode: 'desktop-browser',\n dpr: window.devicePixelRatio,\n interactive: false,\n autoRender: false,\n disableDirtyBounds: true,\n viewBox,\n ticker: this._option.canvas.getStage().ticker,\n visibleAll: false,\n ...(this._spec.options.panel ?? {}),\n chartInitOptions: {\n animation: true,\n disableTriggerEvent: true,\n performanceHook: {\n afterInitializeChart: () => {\n (<IChartTemp>this.specProcess.dataTempTransform?.specTemp)?.afterInitializeChart({ character: this });\n this._runtime.forEach(r => r.afterInitializeChart?.());\n },\n afterVRenderDraw: () => {\n this._runtime.forEach(r => r.afterVRenderDraw?.());\n }\n }\n }\n });\n this.option.graphicParent.add(this._graphic as any);\n }\n\n protected _afterRender(): void {\n // console.log('afterRender');\n return;\n }\n protected _updateVisactorSpec(): void {\n // console.log('_updateVisactorSpec', this._specProcess.getVisSpec());\n this._graphic?.updateSpec(this._specProcess.getVisSpec());\n }\n\n clearCharacter(): void {\n this._graphic.vProduct.release();\n this._graphic.parent.removeChild(this._graphic);\n }\n\n tickTo(t: number): void {\n this._ticker.tickAt(t);\n }\n\n checkEvent(event: StoryEvent): false | ICharacterPickInfo {\n return false;\n }\n\n release(): void {\n this.option.graphicParent.removeChild(this._graphic as any);\n this._graphic.release && this._graphic.release();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/story/character/chart/character.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,iBAAiB,EA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,CAAC,QAAQ,EAAE;YAClB,IAAI,CAAC,aAAa,EAAE,CAAC;YACrB,OAAO;SACR;QACD,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QACxC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;;AA5JM,mBAAI,GAAG,gBAAgB,CAAC;AACxB,sBAAO,GAAwC;IACpD,oBAAoE;IACpE,iBAAiE;IACjE,iBAAiE;CAClE,CAAC","file":"character.js","sourcesContent":["import { CommonSpecRuntime } from './runtime/common-spec';\nimport { ComponentSpecRuntime } from './runtime/component-spec';\nimport type { IChartCharacterRuntimeConstructor } from './runtime/interface';\nimport { cloneDeep, merge } from '@visactor/vutils';\nimport { VChart } from '@visactor/vchart';\nimport type { IChartCharacterSpec } from '../dsl-interface';\nimport { Chart } from './graphic/vchart-graphic';\nimport { CharacterVisactor } from '../visactor/character';\nimport { SpecProcess } from './spec-process/spec-process';\nimport { ChartDataTempTransform } from './spec-process/data-temp-transform';\nimport type { ITicker } from '@visactor/vrender';\nimport type { IChartTemp } from './temp/interface';\nimport { SeriesSpecRuntime } from './runtime/series-spec';\nimport type { StoryEvent } from '../../interface/runtime-interface';\nimport type { ICharacterPickInfo } from '../runtime-interface';\nimport { getLayoutFromWidget } from '../../utils/layout';\nimport { getChartModelWithEvent } from '../../utils/vchart-pick';\n\nexport class CharacterChart extends CharacterVisactor {\n static type = 'CharacterChart';\n static RunTime: IChartCharacterRuntimeConstructor[] = [\n ComponentSpecRuntime as unknown as IChartCharacterRuntimeConstructor,\n CommonSpecRuntime as unknown as IChartCharacterRuntimeConstructor,\n SeriesSpecRuntime as unknown as IChartCharacterRuntimeConstructor\n ];\n\n readonly visActorType = 'chart';\n\n protected declare _specProcess: SpecProcess;\n protected _ticker: ITicker;\n\n declare _graphic: Chart;\n\n protected declare _spec: IChartCharacterSpec;\n get spec() {\n return this._spec;\n }\n\n protected _initSpecProcess(): void {\n this._specProcess = new SpecProcess(this as any, ChartDataTempTransform, this.onSpecReady);\n }\n\n protected _initRuntime(): void {\n CharacterChart.RunTime.forEach(R => {\n this._runtime.push(new R(this));\n });\n }\n\n protected _parserSpec(): void {\n this._specProcess.updateConfig(this._spec);\n }\n protected _initGraphics(): void {\n const { spec, viewBox } = this._getChartOption();\n // @ts-ignore\n this._graphic = new Chart({\n renderCanvas: this._option.canvas.getCanvas(),\n spec,\n ClassType: VChart,\n vchart: null,\n zIndex: this._spec.zIndex,\n mode: 'desktop-browser',\n dpr: window.devicePixelRatio,\n interactive: false,\n autoRender: false,\n disableDirtyBounds: true,\n viewBox,\n ticker: this._option.canvas.getStage().ticker,\n visibleAll: false,\n ...(this._spec.options.panel ?? {}),\n chartInitOptions: merge(\n {\n animation: true,\n disableTriggerEvent: true,\n performanceHook: {\n afterInitializeChart: () => {\n (<IChartTemp>this.specProcess.dataTempTransform?.specTemp)?.afterInitializeChart({ character: this });\n this._runtime.forEach(r => r.afterInitializeChart?.());\n },\n afterVRenderDraw: () => {\n this._runtime.forEach(r => r.afterVRenderDraw?.());\n }\n }\n },\n this._spec.options.initOption ?? {}\n )\n });\n this.option.graphicParent.add(this._graphic as any);\n }\n\n setAttributes(attr: Record<string, any>): void {\n // character 的属性\n if (attr.position) {\n this._spec.position = attr.position;\n // 位置属性\n this._graphic.updateViewBox(this.getViewBoxFromSpec().viewBox);\n }\n }\n getViewBoxFromSpec() {\n const layout = getLayoutFromWidget(this._spec.position);\n const viewBox = {\n x1: layout.x,\n x2: layout.x + layout.width,\n y1: layout.y,\n y2: layout.y + layout.height\n };\n return { layout, viewBox };\n }\n\n private _getChartOption() {\n const { layout, viewBox } = this.getViewBoxFromSpec();\n const spec = cloneDeep(this._specProcess.getVisSpec() ?? this._spec.options.spec);\n spec.width = layout.width;\n spec.height = layout.height;\n return {\n viewBox,\n spec\n };\n }\n\n protected _afterRender(): void {\n // console.log('afterRender');\n return;\n }\n protected _updateVisactorSpec(): void {\n this._graphic?.updateSpec(this._specProcess.getVisSpec());\n }\n\n clearCharacter(): void {\n this._graphic.vProduct.release();\n this._graphic.parent.removeChild(this._graphic);\n }\n\n tickTo(t: number): void {\n this._ticker.tickAt(t);\n }\n\n checkEvent(event: StoryEvent): false | ICharacterPickInfo {\n if (!(event.detailPath ?? event.path).some(g => g === this._graphic)) {\n return false;\n }\n const chartPath = event.detailPath[event.detailPath.length - 1];\n const result = getChartModelWithEvent(this._graphic.vProduct, event);\n if (!result) {\n // 点击到图表的空白区域\n if (this._graphic.pointInViewBox((event as any).canvasX, (event as any).canvasY)) {\n return {\n part: 'null',\n graphic: null,\n modelInfo: null,\n graphicType: 'null'\n };\n }\n return false;\n }\n const graphic = chartPath?.[chartPath.length - 1];\n return {\n part: result.type,\n modelInfo: result,\n graphic,\n graphicType: graphic.type\n };\n }\n\n release(): void {\n this.option.graphicParent.removeChild(this._graphic as any);\n this._graphic.release && this._graphic.release();\n }\n\n private _reflow() {\n if (!this._graphic) {\n this._initGraphics();\n return;\n }\n const { spec } = this._getChartOption();\n this._graphic.updateSpec(spec);\n }\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { registerRankingBarChart } from "@visactor/vchart-extension";
|
|
2
|
+
|
|
3
|
+
import { StoryFactory } from "../../../factory/factory";
|
|
4
|
+
|
|
5
|
+
import { CharacterChart } from "../character";
|
|
6
|
+
|
|
7
|
+
import { RankingBarTemp } from "../temp/templates/ranking-bar-temp";
|
|
8
|
+
|
|
9
|
+
StoryFactory.registerChartTemp(RankingBarTemp.type, RankingBarTemp), registerRankingBarChart();
|
|
10
|
+
|
|
11
|
+
export class RankingBarCharacter extends CharacterChart {}
|
|
12
|
+
|
|
13
|
+
RankingBarCharacter.type = "RankingBar";
|
|
14
|
+
//# sourceMappingURL=rankingBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/story/character/chart/characters/rankingBar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAIpE,YAAY,CAAC,iBAAiB,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;AAEpE,uBAAuB,EAAE,CAAC;AAE1B,MAAM,OAAO,mBAAoB,SAAQ,cAAc;;AAC9C,wBAAI,GAAG,YAAY,CAAC","file":"rankingBar.js","sourcesContent":["import { registerRankingBarChart } from '@visactor/vchart-extension';\nimport { StoryFactory } from '../../../factory/factory';\nimport { CharacterChart } from '../character';\nimport { RankingBarTemp } from '../temp/templates/ranking-bar-temp';\nimport { VChartTemp } from '../temp/templates/vchart-temp';\n\n// StoryFactory.registerChartTemp(RankingBarTemp.type, VChartTemp);\nStoryFactory.registerChartTemp(RankingBarTemp.type, RankingBarTemp);\n\nregisterRankingBarChart();\n\nexport class RankingBarCharacter extends CharacterChart {\n static type = 'RankingBar';\n}\n"]}
|