@visactor/vstory 0.0.4 → 0.0.5-alpha.0
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/story-chart/chart.js +2 -1
- package/cjs/dsl/story-chart/line.js +1 -1
- package/cjs/dsl/story-chart/pie.js +1 -1
- package/cjs/dsl/story-processor/index.js +1 -1
- package/cjs/dsl/types/index.d.ts +1 -0
- package/cjs/dsl/types/index.js.map +1 -1
- 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 +30 -4
- package/cjs/edit/edit-component/base-selection.js.map +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 -32
- 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 +2 -5
- 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 +3 -11
- 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/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/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.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/scene/scene.js +2 -0
- 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 +54 -12
- 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 +18 -3
- 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/cjs/util/space.js +2 -1
- package/dist/index.js +23405 -26034
- 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/story-chart/chart.js +2 -1
- package/es/dsl/story-chart/line.js +1 -1
- package/es/dsl/story-chart/pie.js +1 -1
- package/es/dsl/story-processor/index.js +1 -1
- package/es/dsl/types/index.d.ts +1 -0
- package/es/dsl/types/index.js.map +1 -1
- 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 +31 -3
- package/es/edit/edit-component/base-selection.js.map +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 -26
- 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 +2 -5
- 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 +2 -12
- 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/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/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.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/scene/scene.js +2 -0
- 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 +57 -14
- 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 +18 -3
- 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/es/util/space.js +2 -1
- package/package.json +8 -7
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.BarTemp = void 0;
|
|
6
|
+
|
|
7
|
+
const constant_1 = require("../constant"), base_temp_1 = require("./base-temp");
|
|
8
|
+
|
|
9
|
+
class BarTemp extends base_temp_1.BaseTemp {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments), this.type = BarTemp.type, this.seriesType = "bar", this.defaultTotalLabel = !0;
|
|
12
|
+
}
|
|
13
|
+
getSpec(data, ctx, opt) {
|
|
14
|
+
throw new Error("Method not implemented.");
|
|
15
|
+
}
|
|
16
|
+
checkDataEnable(data, info, opt) {
|
|
17
|
+
throw new Error("Method not implemented.");
|
|
18
|
+
}
|
|
19
|
+
_getSeriesSpec() {
|
|
20
|
+
return {
|
|
21
|
+
type: "bar",
|
|
22
|
+
stack: !0
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
afterInitializeChart(ctx) {
|
|
26
|
+
console.log("afterInitializeChart");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
exports.BarTemp = BarTemp, BarTemp.type = constant_1.TemplateChartType.vchart;
|
|
31
|
+
//# sourceMappingURL=bar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/story/character/chart/temp/templates/bar.ts"],"names":[],"mappings":";;;AAAA,0CAAgD;AAEhD,2CAAuC;AAGvC,MAAa,OAAQ,SAAQ,oBAAQ;IAArC;;QAQE,SAAI,GAAW,OAAO,CAAC,IAAI,CAAC;QAE5B,eAAU,GAAG,KAAK,CAAC;QAEnB,sBAAiB,GAAG,IAAI,CAAC;IAa3B,CAAC;IAxBC,OAAO,CAAC,IAAkB,EAAE,GAAkC,EAAE,GAAS;QACvE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,eAAe,CAAC,IAAkB,EAAE,IAAc,EAAE,GAAS;QAC3D,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAQS,cAAc;QACtB,OAAO;YACL,IAAI,EAAE,KAAK;YACX,KAAK,EAAE,IAAI;SACZ,CAAC;IACJ,CAAC;IAED,oBAAoB,CAAC,GAAkC;QAErD,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;IACtC,CAAC;;AAxBH,0BAyBC;AAlBQ,YAAI,GAAW,4BAAiB,CAAC,MAAM,CAAC","file":"bar.js","sourcesContent":["import { TemplateChartType } from '../constant';\nimport type { CharacterChart } from '../../character';\nimport { BaseTemp } from './base-temp';\nimport type { StandardData, DataInfo } from '../../data/interface';\n\nexport class BarTemp extends BaseTemp {\n getSpec(data: StandardData, ctx: { character: CharacterChart }, opt?: any) {\n throw new Error('Method not implemented.');\n }\n checkDataEnable(data: StandardData, info: DataInfo, opt?: any): boolean {\n throw new Error('Method not implemented.');\n }\n static type: string = TemplateChartType.vchart;\n type: string = BarTemp.type;\n // 唯一系列类型\n seriesType = 'bar';\n // 默认是否展示总计标签\n defaultTotalLabel = true;\n\n protected _getSeriesSpec() {\n return {\n type: 'bar',\n stack: true\n };\n }\n\n afterInitializeChart(ctx: { character: CharacterChart }): void {\n // eslint-disable-next-line no-console\n console.log('afterInitializeChart');\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IChartTemp } from '../interface';
|
|
2
|
-
import { DataInfo, StandardData } from '../../data/interface';
|
|
3
|
-
import { CharacterChart } from '../../character';
|
|
1
|
+
import type { IChartTemp } from '../interface';
|
|
2
|
+
import type { DataInfo, StandardData } from '../../data/interface';
|
|
3
|
+
import type { CharacterChart } from '../../character';
|
|
4
4
|
export declare const EDITOR_SERIES_MARK_SINGLE = "_editor_series_mark_single";
|
|
5
5
|
export declare const EDITOR_SERIES_MARK_SINGLE_LEVEL = 100;
|
|
6
6
|
export declare abstract class BaseTemp implements IChartTemp {
|
|
@@ -11,7 +11,9 @@ export declare abstract class BaseTemp implements IChartTemp {
|
|
|
11
11
|
abstract checkDataEnable(data: StandardData, info: DataInfo, opt?: any): boolean;
|
|
12
12
|
clear(): void;
|
|
13
13
|
getChartType(): string;
|
|
14
|
-
afterInitializeChart(
|
|
14
|
+
afterInitializeChart(ctx: {
|
|
15
|
+
character: CharacterChart;
|
|
16
|
+
}): void;
|
|
15
17
|
standardizedSpec(spec: any, ctx: {
|
|
16
18
|
character: CharacterChart;
|
|
17
19
|
}): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/story/character/chart/temp/templates/base-temp.ts"],"names":[],"mappings":";;;AAIa,QAAA,yBAAyB,GAAG,4BAA4B,CAAC;AACzD,QAAA,+BAA+B,GAAG,GAAG,CAAC;AAEnD,MAAsB,QAAQ;IAI5B,KAAK;IAEL,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,oBAAoB;
|
|
1
|
+
{"version":3,"sources":["../src/story/character/chart/temp/templates/base-temp.ts"],"names":[],"mappings":";;;AAIa,QAAA,yBAAyB,GAAG,4BAA4B,CAAC;AACzD,QAAA,+BAA+B,GAAG,GAAG,CAAC;AAEnD,MAAsB,QAAQ;IAI5B,KAAK;IAEL,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,oBAAoB,CAAC,GAAkC;IAEvD,CAAC;IAED,gBAAgB,CAAC,IAAS,EAAE,GAAkC;IAE9D,CAAC;CACF;AAnBD,4BAmBC","file":"base-temp.js","sourcesContent":["import type { IChartTemp } from '../interface';\nimport type { DataInfo, StandardData } from '../../data/interface';\nimport type { CharacterChart } from '../../character';\n\nexport const EDITOR_SERIES_MARK_SINGLE = '_editor_series_mark_single';\nexport const EDITOR_SERIES_MARK_SINGLE_LEVEL = 100;\n\nexport abstract class BaseTemp implements IChartTemp {\n type: string;\n abstract getSpec(data: StandardData, ctx: { character: CharacterChart }, opt?: any): any;\n abstract checkDataEnable(data: StandardData, info: DataInfo, opt?: any): boolean;\n clear() {\n // do nothing\n }\n\n getChartType() {\n return this.type;\n }\n\n afterInitializeChart(ctx: { character: CharacterChart }) {\n // do nothing\n }\n\n standardizedSpec(spec: any, ctx: { character: CharacterChart }) {\n // do nothing\n }\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { StandardData } from '../../data/interface';
|
|
2
|
+
import { BaseTemp } from './base-temp';
|
|
3
|
+
export declare class RankingBarTemp extends BaseTemp {
|
|
4
|
+
static type: string;
|
|
5
|
+
type: string;
|
|
6
|
+
checkDataEnable(data: StandardData, opt?: any): boolean;
|
|
7
|
+
getSpec(data: StandardData, opt: any): any;
|
|
8
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.RankingBarTemp = void 0;
|
|
6
|
+
|
|
7
|
+
const base_temp_1 = require("./base-temp"), constant_1 = require("../constant");
|
|
8
|
+
|
|
9
|
+
class RankingBarTemp extends base_temp_1.BaseTemp {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments), this.type = RankingBarTemp.type;
|
|
12
|
+
}
|
|
13
|
+
checkDataEnable(data, opt) {
|
|
14
|
+
return !0;
|
|
15
|
+
}
|
|
16
|
+
getSpec(data, opt) {
|
|
17
|
+
return opt.character.spec.options.spec;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
exports.RankingBarTemp = RankingBarTemp, RankingBarTemp.type = constant_1.TemplateChartType.rankingBar;
|
|
22
|
+
//# sourceMappingURL=ranking-bar-temp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/story/character/chart/temp/templates/ranking-bar-temp.ts"],"names":[],"mappings":";;;AACA,2CAAuC;AACvC,0CAAgD;AAEhD,MAAa,cAAe,SAAQ,oBAAQ;IAA5C;;QAEE,SAAI,GAAW,cAAc,CAAC,IAAI,CAAC;IAQrC,CAAC;IAPC,eAAe,CAAC,IAAkB,EAAE,GAAS;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CAAC,IAAkB,EAAE,GAAQ;QAElC,OAAO,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,IAAW,CAAC;IAChD,CAAC;;AATH,wCAUC;AATQ,mBAAI,GAAW,4BAAiB,CAAC,UAAU,CAAC","file":"ranking-bar-temp.js","sourcesContent":["import type { StandardData } from '../../data/interface';\nimport { BaseTemp } from './base-temp';\nimport { TemplateChartType } from '../constant';\n\nexport class RankingBarTemp extends BaseTemp {\n static type: string = TemplateChartType.rankingBar;\n type: string = RankingBarTemp.type;\n checkDataEnable(data: StandardData, opt?: any): boolean {\n return true;\n }\n getSpec(data: StandardData, opt: any) {\n // TODO 转换特定chart Spec到通用common spec\n return opt.character.spec.options.spec as any;\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IDrawContext, IGraphicRender, IGraphicRenderDrawParams, IRenderService, IGroup } from '@visactor/vrender';
|
|
2
2
|
import { DefaultCanvasGroupRender } from '@visactor/vrender';
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
3
|
+
export declare const ComponentRender: unique symbol;
|
|
4
|
+
export declare const ComponentRenderContribution: unique symbol;
|
|
5
5
|
export declare class ComponentGroupRender extends DefaultCanvasGroupRender implements IGraphicRender {
|
|
6
6
|
type: any;
|
|
7
7
|
numberType: number;
|
|
@@ -8,15 +8,15 @@ var __decorate = this && this.__decorate || function(decorators, target, key, de
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", {
|
|
10
10
|
value: !0
|
|
11
|
-
}), exports.ComponentGroupRender = exports.
|
|
11
|
+
}), exports.ComponentGroupRender = exports.ComponentRenderContribution = exports.ComponentRender = void 0;
|
|
12
12
|
|
|
13
13
|
const vrender_1 = require("@visactor/vrender"), component_group_graphic_1 = require("./component-group-graphic"), config_1 = require("../../../../constants/config");
|
|
14
14
|
|
|
15
|
-
exports.
|
|
15
|
+
exports.ComponentRender = Symbol.for("VStoryComponentRender"), exports.ComponentRenderContribution = Symbol.for("VStoryComponentRenderContribution");
|
|
16
16
|
|
|
17
17
|
let ComponentGroupRender = class extends vrender_1.DefaultCanvasGroupRender {
|
|
18
18
|
constructor() {
|
|
19
|
-
super(...arguments), this.type = "vstory-component-group", this.numberType = component_group_graphic_1.
|
|
19
|
+
super(...arguments), this.type = "vstory-component-group", this.numberType = component_group_graphic_1.COMPONENT_NUMBER_TYPE;
|
|
20
20
|
}
|
|
21
21
|
draw(group, renderService, drawContext, params) {
|
|
22
22
|
const {context: context} = drawContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/story/character/component/character-group/component-group-graphic-render.ts"],"names":[],"mappings":";;;;;;;;;AAYA,+CAAyE;AACzE,
|
|
1
|
+
{"version":3,"sources":["../src/story/character/component/character-group/component-group-graphic-render.ts"],"names":[],"mappings":";;;;;;;;;AAYA,+CAAyE;AACzE,uEAAkE;AAClE,yDAAyD;AAE5C,QAAA,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;AACtD,QAAA,2BAA2B,GAAG,MAAM,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;AAGpF,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,kCAAwB;IAA3D;;QACL,SAAI,GAAQ,wBAAwB,CAAC;QACrC,eAAU,GAAW,+CAAqB,CAAC;IA+C7C,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C;gBACpB,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,GAAG,SAAS,GAAG,EAAE,CAAC;aAClC;iBAAM,IAAI,aAAa,KAAK,kBAAS,CAAC,aAAa,EAAE;gBACpD,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;gBACV,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;gBACV,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;gBACpB,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC;aAClC;YACD,OAAO,CAAC,IAAI,EAAE,CAAC;YACf,OAAO,CAAC,sBAAsB,EAAE,CAAC;YACjC,OAAO,CAAC,SAAS,EAAE,CAAC;YACpB,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;YACvC,OAAO,CAAC,IAAI,EAAE,CAAC;SAChB;QACD,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;QACtD,IAAI,QAAQ,EAAE;YACZ,OAAO,CAAC,OAAO,EAAE,CAAC;SACnB;IACH,CAAC;CACF,CAAA;AAjDY,oBAAoB;IADhC,IAAA,oBAAU,GAAE;GACA,oBAAoB,CAiDhC;AAjDY,oDAAoB","file":"component-group-graphic-render.js","sourcesContent":["import type {\n IContext2d,\n IDrawContext,\n IGraphicAttribute,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IMarkAttribute,\n IRenderService,\n IThemeAttribute,\n IGraphic,\n IGroup\n} from '@visactor/vrender';\nimport { injectable, DefaultCanvasGroupRender } from '@visactor/vrender';\nimport { COMPONENT_NUMBER_TYPE } from './component-group-graphic';\nimport { Direction } from '../../../../constants/config';\n\nexport const ComponentRender = Symbol.for('VStoryComponentRender');\nexport const ComponentRenderContribution = Symbol.for('VStoryComponentRenderContribution');\n\n@injectable()\nexport class ComponentGroupRender extends DefaultCanvasGroupRender implements IGraphicRender {\n type: any = 'vstory-component-group';\n numberType: number = COMPONENT_NUMBER_TYPE;\n\n draw(group: IGroup, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const { context } = drawContext;\n if (!context) {\n return;\n }\n const { wipeDirection, wipeRatio, wipeColor, wipeBlur } = group.attribute as any;\n const drawWipe = isFinite(wipeRatio);\n let x1;\n let y1;\n let x2;\n let y2;\n if (drawWipe) {\n const b = group.AABBBounds;\n if (wipeDirection === Direction.LEFT_TO_RIGHT) {\n x1 = b.x1;\n y1 = b.y1;\n x2 = x1 + b.width() * wipeRatio;\n y2 = b.height() + y1;\n } else if (wipeDirection === Direction.RIGHT_TO_LEFT) {\n x2 = b.x1;\n y1 = b.y1;\n x1 = x2 - b.width() * wipeRatio;\n y2 = b.height() + y1;\n } else if (wipeDirection === Direction.TOP_TO_BOTTOM) {\n x1 = b.x1;\n y1 = b.y1;\n x2 = x1 + b.width();\n y2 = b.height() * wipeRatio + y1;\n } else if (wipeDirection === Direction.BOTTOM_TO_TOP) {\n x1 = b.x1;\n y2 = b.y1;\n x2 = x1 + b.width();\n y1 = y2 - b.height() * wipeRatio;\n }\n context.save();\n context.setTransformForCurrent();\n context.beginPath();\n context.rect(x1, y1, x2 - x1, y2 - y1);\n context.clip();\n }\n super.draw(group, renderService, drawContext, params);\n if (drawWipe) {\n context.restore();\n }\n }\n}\n"]}
|
|
@@ -20,7 +20,7 @@ export interface IChartGraphicAttribute extends IGroupGraphicAttribute {
|
|
|
20
20
|
autoRender?: boolean;
|
|
21
21
|
chartInitOptions?: any;
|
|
22
22
|
}
|
|
23
|
-
export declare const
|
|
23
|
+
export declare const COMPONENT_NUMBER_TYPE: number;
|
|
24
24
|
export declare class ComponentGroup extends Group implements IVisactorGraphic {
|
|
25
25
|
type: GraphicType;
|
|
26
26
|
numberType: number;
|
|
@@ -2,21 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: !0
|
|
5
|
-
}), exports.ComponentGroup = exports.
|
|
5
|
+
}), exports.ComponentGroup = exports.COMPONENT_NUMBER_TYPE = void 0;
|
|
6
6
|
|
|
7
7
|
const vrender_1 = require("@visactor/vrender");
|
|
8
8
|
|
|
9
|
-
exports.
|
|
9
|
+
exports.COMPONENT_NUMBER_TYPE = (0, vrender_1.genNumberType)();
|
|
10
10
|
|
|
11
11
|
class ComponentGroup extends vrender_1.Group {
|
|
12
12
|
constructor(attrs) {
|
|
13
|
-
super(Object.assign({
|
|
13
|
+
super(Object.assign(Object.assign({
|
|
14
14
|
scaleX: 1,
|
|
15
15
|
scaleY: 1,
|
|
16
16
|
x: 0,
|
|
17
17
|
y: 0,
|
|
18
18
|
angle: 0
|
|
19
|
-
}, attrs)
|
|
19
|
+
}, attrs), {
|
|
20
|
+
pickable: !1
|
|
21
|
+
})), this.type = "vstory-component-group", this.numberType = exports.COMPONENT_NUMBER_TYPE;
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/story/character/component/character-group/component-group-graphic.ts"],"names":[],"mappings":";;;AAIA,+CAAyD;AAoB5C,QAAA,
|
|
1
|
+
{"version":3,"sources":["../src/story/character/component/character-group/component-group-graphic.ts"],"names":[],"mappings":";;;AAIA,+CAAyD;AAoB5C,QAAA,qBAAqB,GAAG,IAAA,uBAAa,GAAE,CAAC;AAGrD,MAAa,cAAe,SAAQ,eAAK;IAIvC,YAAY,KAA6B;QAEvC,KAAK,+BAAG,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,IAAK,KAAK,KAAE,QAAQ,EAAE,KAAK,IAAG,CAAC;QALnF,SAAI,GAAgB,wBAA+B,CAAC;QACpD,eAAU,GAAW,6BAAqB,CAAC;IAK3C,CAAC;CACF;AARD,wCAQC","file":"component-group-graphic.js","sourcesContent":["import type { IVisactorGraphic } from '../../visactor/interface';\nimport type { IBoundsLike } from '@visactor/vutils';\nimport type { ISpec, IVChart } from '@visactor/vchart';\nimport type { GraphicType, IGroupGraphicAttribute, ITicker } from '@visactor/vrender';\nimport { genNumberType, Group } from '@visactor/vrender';\n\nexport interface IChartGraphicAttribute extends IGroupGraphicAttribute {\n renderCanvas: HTMLCanvasElement;\n spec: any;\n ClassType: any;\n vchart: IVChart;\n mode: string;\n modeParams?: any;\n dpr: number;\n interactive: boolean;\n animation: boolean;\n disableTriggerEvent: boolean;\n disableDirtyBounds: boolean;\n viewBox: IBoundsLike;\n ticker?: ITicker;\n autoRender?: boolean;\n chartInitOptions?: any;\n}\n\nexport const COMPONENT_NUMBER_TYPE = genNumberType();\n\n// @ts-ignore\nexport class ComponentGroup extends Group implements IVisactorGraphic {\n type: GraphicType = 'vstory-component-group' as any;\n numberType: number = COMPONENT_NUMBER_TYPE;\n\n constructor(attrs: IGroupGraphicAttribute) {\n // vstory-component-group没有主题,必须都初始化,否则动画会找不到属性\n super({ scaleX: 1, scaleY: 1, x: 0, y: 0, angle: 0, ...attrs, pickable: false });\n }\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IBoundsLike } from '@visactor/vutils';
|
|
1
2
|
import type { IGroup } from '@visactor/vrender';
|
|
2
3
|
import { GraphicBaseText } from './graphic/graphic-base-text';
|
|
3
4
|
import type { IComponentCharacterSpec } from '../dsl-interface';
|
|
@@ -6,16 +7,18 @@ import type { Graphic } from './graphic/graphic';
|
|
|
6
7
|
import type { StoryEvent } from '../../interface/runtime-interface';
|
|
7
8
|
import type { ICharacterPickInfo } from '../runtime-interface';
|
|
8
9
|
export declare abstract class CharacterComponent extends CharacterBase {
|
|
10
|
+
visActorType: 'component';
|
|
9
11
|
protected _spec: IComponentCharacterSpec;
|
|
10
12
|
get spec(): IComponentCharacterSpec;
|
|
11
13
|
protected _text: GraphicBaseText;
|
|
12
14
|
get text(): GraphicBaseText;
|
|
15
|
+
get textGraphic(): import("@visactor/vrender").IRichText;
|
|
13
16
|
protected _group: IGroup;
|
|
14
17
|
get group(): IGroup;
|
|
15
18
|
readonly graphicType: string;
|
|
16
19
|
protected _parserSpec(): void;
|
|
17
20
|
protected _initGraphics(): void;
|
|
18
|
-
setAttributes(
|
|
21
|
+
setAttributes(updateAttr: Record<string, any>): void;
|
|
19
22
|
protected abstract _createGraphic(): Graphic;
|
|
20
23
|
protected _initRuntime(): void;
|
|
21
24
|
show(): void;
|
|
@@ -28,6 +31,7 @@ export declare abstract class CharacterComponent extends CharacterBase {
|
|
|
28
31
|
};
|
|
29
32
|
clearCharacter(): void;
|
|
30
33
|
getGraphicParent(): IGroup;
|
|
34
|
+
getLayoutBounds(): IBoundsLike;
|
|
31
35
|
checkEvent(event: StoryEvent): false | ICharacterPickInfo;
|
|
32
36
|
release(): void;
|
|
33
37
|
}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var __rest = this && this.__rest || function(s, e) {
|
|
4
|
+
var t = {};
|
|
5
|
+
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
|
|
6
|
+
if (null != s && "function" == typeof Object.getOwnPropertySymbols) {
|
|
7
|
+
var i = 0;
|
|
8
|
+
for (p = Object.getOwnPropertySymbols(s); i < p.length; i++) e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]) && (t[p[i]] = s[p[i]]);
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
|
|
3
13
|
Object.defineProperty(exports, "__esModule", {
|
|
4
14
|
value: !0
|
|
5
15
|
}), exports.CharacterComponent = void 0;
|
|
@@ -16,6 +26,9 @@ class CharacterComponent extends base_1.CharacterBase {
|
|
|
16
26
|
get text() {
|
|
17
27
|
return this._text;
|
|
18
28
|
}
|
|
29
|
+
get textGraphic() {
|
|
30
|
+
return this._text.graphic;
|
|
31
|
+
}
|
|
19
32
|
get group() {
|
|
20
33
|
return this._group;
|
|
21
34
|
}
|
|
@@ -31,7 +44,8 @@ class CharacterComponent extends base_1.CharacterBase {
|
|
|
31
44
|
this._text.applyGraphicAttribute(this._spec.options.text), this._graphic.applyLayoutData(this._spec.position),
|
|
32
45
|
this._text.applyLayoutData(this._spec.position), this.hide();
|
|
33
46
|
}
|
|
34
|
-
setAttributes(
|
|
47
|
+
setAttributes(updateAttr) {
|
|
48
|
+
const {position: position} = updateAttr, rest = __rest(updateAttr, [ "position" ]), attr = Object.assign(Object.assign({}, null != position ? position : {}), rest);
|
|
35
49
|
this.group.setAttributes(attr), this._graphic.setAttributes(Object.assign(Object.assign({}, attr), {
|
|
36
50
|
x: 0,
|
|
37
51
|
y: 0,
|
|
@@ -60,6 +74,9 @@ class CharacterComponent extends base_1.CharacterBase {
|
|
|
60
74
|
getGraphicParent() {
|
|
61
75
|
return this._group;
|
|
62
76
|
}
|
|
77
|
+
getLayoutBounds() {
|
|
78
|
+
return this._group.AABBBounds;
|
|
79
|
+
}
|
|
63
80
|
checkEvent(event) {
|
|
64
81
|
var _a;
|
|
65
82
|
return !!(null !== (_a = event.detailPath) && void 0 !== _a ? _a : event.path).some((g => g === this._group)) && {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/story/character/component/character.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/story/character/component/character.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,mEAA8D;AAE9D,uCAA6C;AAE7C,+CAAyD;AAGzD,uFAA2E;AAE3E,MAAsB,kBAAmB,SAAQ,oBAAa;IAA9D;;QAwBW,gBAAW,GAAW,MAAM,CAAC;IAkFxC,CAAC;IAvGC,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAMD,IAAI,IAAI;QACN,OAAO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M,CAAC,UAAyB,CAAC;IAC/C,CAAC;IAED,UAAU,CAAC,KAAiB;;QAC1B,IAAI,CAAC,CAAC,MAAA,KAAK,CAAC,UAAU,mCAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,EAAE;YAClE,OAAO,KAAK,CAAC;SACd;QACD,OAAO;YACL,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM;YACtF,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACrD,CAAC;CACF;AA1GD,gDA0GC","file":"character.js","sourcesContent":["import type { IBoundsLike } from '@visactor/vutils';\nimport type { IGroup } from '@visactor/vrender';\nimport { GraphicBaseText } from './graphic/graphic-base-text';\nimport type { IComponentCharacterSpec } from '../dsl-interface';\nimport { CharacterBase } from '../base/base';\nimport type { Graphic } from './graphic/graphic';\nimport { getLayoutFromWidget } from '../../utils/layout';\nimport type { StoryEvent } from '../../interface/runtime-interface';\nimport type { ICharacterPickInfo } from '../runtime-interface';\nimport { ComponentGroup } from './character-group/component-group-graphic';\n\nexport abstract class CharacterComponent extends CharacterBase {\n visActorType: 'component';\n protected declare _spec: IComponentCharacterSpec;\n get spec() {\n return this._spec;\n }\n // protected declare _graphic: Graphic;\n // get graphic() {\n // return this._graphic;\n // }\n protected declare _text: GraphicBaseText;\n get text() {\n return this._text;\n }\n\n get textGraphic() {\n return this._text.graphic;\n }\n\n protected declare _group: IGroup;\n get group() {\n return this._group;\n }\n\n readonly graphicType: string = 'rect';\n\n protected _parserSpec(): void {\n return;\n }\n\n protected _initGraphics(): void {\n this._group = new ComponentGroup({\n ...getLayoutFromWidget(this._spec.position),\n angle: this._spec.options.angle,\n zIndex: this._spec.zIndex\n });\n this.option.graphicParent.add(this._group);\n\n this._graphic = this._createGraphic();\n this._text = new GraphicBaseText(this);\n this._graphic.init();\n this._text.init();\n\n this._graphic.applyGraphicAttribute(this._spec.options.graphic);\n this._text.applyGraphicAttribute(this._spec.options.text);\n\n this._graphic.applyLayoutData(this._spec.position);\n this._text.applyLayoutData(this._spec.position);\n this.hide();\n }\n\n setAttributes(updateAttr: Record<string, any>): void {\n const { position, ...rest } = updateAttr;\n const attr = { ...(position ?? {}), ...rest };\n this.group.setAttributes(attr);\n this._graphic.setAttributes({ ...attr, x: 0, y: 0, angle: 0 });\n this._text.updateAttribute({});\n }\n\n protected abstract _createGraphic(): Graphic;\n\n protected _initRuntime(): void {\n return;\n }\n\n show(): void {\n this._group.setAttributes({ visible: true });\n this._text.show();\n this._graphic.show();\n }\n hide(): void {\n this._group.setAttributes({ visible: false });\n this._text.hide();\n this._graphic.hide();\n }\n\n getTextLayoutRatio(): { left: number; right: number; top: number; bottom: number } {\n return this._graphic.getTextLayoutRatio();\n }\n\n clearCharacter(): void {\n this._group?.parent.removeChild(this._group);\n this._group = null;\n }\n\n getGraphicParent() {\n return this._group;\n }\n\n getLayoutBounds() {\n return this._group.AABBBounds as IBoundsLike;\n }\n\n checkEvent(event: StoryEvent): false | ICharacterPickInfo {\n if (!(event.detailPath ?? event.path).some(g => g === this._group)) {\n return false;\n }\n return {\n part: event.path[event.path.length - 1] === this._graphic.graphic ? 'graphic' : 'text',\n graphicType: this.graphicType\n };\n }\n\n release() {\n this.option.graphicParent.removeChild(this._group);\n }\n}\n\n// export abstract class CharacterGraphicComponent extends CharacterBase {\n// protected declare _spec: IComponentCharacterSpec;\n\n// get spec() {\n// return this._spec;\n// }\n// protected declare _graphic: Graphic;\n// get graphic() {\n// return this._graphic;\n// }\n\n// protected declare _group: IGroup;\n// get group() {\n// return this._group;\n// }\n\n// protected abstract _createGraphic(): Graphic;\n\n// protected _initRuntime(): void {\n// return;\n// }\n\n// protected _parserSpec(): void {\n// return;\n// }\n\n// protected _initGraphics(): void {\n// this._group = createGroup({\n// ...getLayoutFromWidget(this._spec.position),\n// angle: this._spec.options.angle,\n// zIndex: this._spec.zIndex\n// });\n// this.option.graphicParent.add(this._group);\n\n// this._graphic = this._createGraphic();\n// this._graphic.init();\n\n// this._graphic.applyGraphicAttribute(this._spec.options.graphic);\n\n// this._graphic.applyLayoutData(this._spec.position);\n// this.hide();\n// }\n\n// show(): void {\n// this._graphic?.show();\n// }\n// hide(): void {\n// this._graphic?.hide();\n// }\n\n// getGraphicParent() {\n// return this._group;\n// }\n\n// clearCharacter(): void {\n// if (this._group) {\n// this._group.parent.removeChild(this._group);\n// this._graphic = null;\n// }\n// }\n// }\n"]}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { Graphic } from '../graphic/graphic';
|
|
2
2
|
import { CharacterComponent } from '../character';
|
|
3
|
+
import type { StoryEvent } from '../../../interface';
|
|
4
|
+
import type { ICharacterPickInfo } from '../../runtime-interface';
|
|
3
5
|
export declare class CharacterComponentImage extends CharacterComponent {
|
|
4
6
|
readonly graphicType: string;
|
|
5
7
|
protected _createGraphic(): Graphic;
|
|
8
|
+
checkEvent(event: StoryEvent): false | ICharacterPickInfo;
|
|
6
9
|
}
|
|
@@ -13,6 +13,10 @@ class CharacterComponentImage extends character_1.CharacterComponent {
|
|
|
13
13
|
_createGraphic() {
|
|
14
14
|
return new image_1.GraphicImage(character_2.StoryComponentType.IMAGE, this);
|
|
15
15
|
}
|
|
16
|
+
checkEvent(event) {
|
|
17
|
+
const info = super.checkEvent(event);
|
|
18
|
+
return (!info || event.path[event.path.length - 1] !== this._group) && info;
|
|
19
|
+
}
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
exports.CharacterComponentImage = CharacterComponentImage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/story/character/component/characters/character-image.ts"],"names":[],"mappings":";;;AACA,4CAAkD;AAClD,+DAAqE;AACrE,4CAAgD;
|
|
1
|
+
{"version":3,"sources":["../src/story/character/component/characters/character-image.ts"],"names":[],"mappings":";;;AACA,4CAAkD;AAClD,+DAAqE;AACrE,4CAAgD;AAIhD,MAAa,uBAAwB,SAAQ,8BAAkB;IAA/D;;QACW,gBAAW,GAAW,OAAO,CAAC;IAYzC,CAAC;IAXW,cAAc;QACtB,OAAO,IAAI,oBAAY,CAAC,8BAAkB,CAAC,KAAK,EAAE,IAAW,CAAC,CAAC;IACjE,CAAC;IAED,UAAU,CAAC,KAAiB;QAC1B,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACrC,IAAI,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,MAAM,EAAE;YAC7D,OAAO,KAAK,CAAC;SACd;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAbD,0DAaC","file":"character-image.js","sourcesContent":["import type { Graphic } from '../graphic/graphic';\nimport { CharacterComponent } from '../character';\nimport { StoryComponentType } from '../../../../constants/character';\nimport { GraphicImage } from '../graphic/image';\nimport type { StoryEvent } from '../../../interface';\nimport type { ICharacterPickInfo } from '../../runtime-interface';\n\nexport class CharacterComponentImage extends CharacterComponent {\n readonly graphicType: string = 'image';\n protected _createGraphic(): Graphic {\n return new GraphicImage(StoryComponentType.IMAGE, this as any);\n }\n\n checkEvent(event: StoryEvent): false | ICharacterPickInfo {\n const info = super.checkEvent(event);\n if (info && event.path[event.path.length - 1] === this._group) {\n return false;\n }\n return info;\n }\n}\n"]}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { Graphic } from '../graphic/graphic';
|
|
2
2
|
import { CharacterComponent } from '../character';
|
|
3
|
+
import type { StoryEvent } from '../../../interface';
|
|
4
|
+
import type { ICharacterPickInfo } from '../../runtime-interface';
|
|
3
5
|
export declare class CharacterComponentRect extends CharacterComponent {
|
|
4
6
|
readonly graphicType: string;
|
|
5
7
|
protected _createGraphic(): Graphic;
|
|
8
|
+
checkEvent(event: StoryEvent): false | ICharacterPickInfo;
|
|
6
9
|
}
|
|
@@ -13,6 +13,10 @@ class CharacterComponentRect extends character_1.CharacterComponent {
|
|
|
13
13
|
_createGraphic() {
|
|
14
14
|
return new rect_1.GraphicRect(character_2.StoryComponentType.RECT, this);
|
|
15
15
|
}
|
|
16
|
+
checkEvent(event) {
|
|
17
|
+
const info = super.checkEvent(event);
|
|
18
|
+
return (!info || event.path[event.path.length - 1] !== this._group) && info;
|
|
19
|
+
}
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
exports.CharacterComponentRect = CharacterComponentRect;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/story/character/component/characters/character-rect.ts"],"names":[],"mappings":";;;AACA,0CAA8C;AAC9C,4CAAkD;AAClD,+DAAqE;
|
|
1
|
+
{"version":3,"sources":["../src/story/character/component/characters/character-rect.ts"],"names":[],"mappings":";;;AACA,0CAA8C;AAC9C,4CAAkD;AAClD,+DAAqE;AAIrE,MAAa,sBAAuB,SAAQ,8BAAkB;IAA9D;;QACW,gBAAW,GAAW,MAAM,CAAC;IAYxC,CAAC;IAXW,cAAc;QACtB,OAAO,IAAI,kBAAW,CAAC,8BAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC;IAED,UAAU,CAAC,KAAiB;QAC1B,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACrC,IAAI,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,MAAM,EAAE;YAC7D,OAAO,KAAK,CAAC;SACd;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAbD,wDAaC","file":"character-rect.js","sourcesContent":["import type { Graphic } from '../graphic/graphic';\nimport { GraphicRect } from '../graphic/rect';\nimport { CharacterComponent } from '../character';\nimport { StoryComponentType } from '../../../../constants/character';\nimport type { StoryEvent } from '../../../interface';\nimport type { ICharacterPickInfo } from '../../runtime-interface';\n\nexport class CharacterComponentRect extends CharacterComponent {\n readonly graphicType: string = 'rect';\n protected _createGraphic(): Graphic {\n return new GraphicRect(StoryComponentType.RECT, this);\n }\n\n checkEvent(event: StoryEvent): false | ICharacterPickInfo {\n const info = super.checkEvent(event);\n if (info && event.path[event.path.length - 1] === this._group) {\n return false;\n }\n return info;\n }\n}\n"]}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { Graphic } from '../graphic/graphic';
|
|
2
2
|
import { CharacterComponent } from '../character';
|
|
3
|
+
import type { StoryEvent } from '../../../interface';
|
|
4
|
+
import type { ICharacterPickInfo } from '../../runtime-interface';
|
|
3
5
|
export declare class CharacterComponentShape extends CharacterComponent {
|
|
4
6
|
readonly graphicType: string;
|
|
5
7
|
protected _createGraphic(): Graphic;
|
|
8
|
+
setAttributes(attr: Record<string, any>): void;
|
|
9
|
+
checkEvent(event: StoryEvent): false | ICharacterPickInfo;
|
|
6
10
|
}
|
|
@@ -13,6 +13,21 @@ class CharacterComponentShape extends character_1.CharacterComponent {
|
|
|
13
13
|
_createGraphic() {
|
|
14
14
|
return new symbol_1.GraphicSymbol(character_2.StoryComponentType.SHAPE, this);
|
|
15
15
|
}
|
|
16
|
+
setAttributes(attr) {
|
|
17
|
+
this.group.setAttributes(Object.assign(Object.assign({}, attr), {
|
|
18
|
+
x: attr.x - attr.width / 2,
|
|
19
|
+
y: attr.y - attr.height / 2
|
|
20
|
+
})), this._graphic.setAttributes(Object.assign(Object.assign({}, attr), {
|
|
21
|
+
x: attr.width / 2,
|
|
22
|
+
y: attr.height / 2,
|
|
23
|
+
angle: 0,
|
|
24
|
+
size: Math.min(attr.width, attr.height)
|
|
25
|
+
})), this._text.updateAttribute({});
|
|
26
|
+
}
|
|
27
|
+
checkEvent(event) {
|
|
28
|
+
const info = super.checkEvent(event);
|
|
29
|
+
return (!info || event.path[event.path.length - 1] !== this._group) && info;
|
|
30
|
+
}
|
|
16
31
|
}
|
|
17
32
|
|
|
18
33
|
exports.CharacterComponentShape = CharacterComponentShape;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/story/character/component/characters/character-shape.ts"],"names":[],"mappings":";;;AACA,4CAAkD;AAClD,+DAAqE;AACrE,8CAAkD;
|
|
1
|
+
{"version":3,"sources":["../src/story/character/component/characters/character-shape.ts"],"names":[],"mappings":";;;AACA,4CAAkD;AAClD,+DAAqE;AACrE,8CAAkD;AAIlD,MAAa,uBAAwB,SAAQ,8BAAkB;IAA/D;;QACW,gBAAW,GAAW,OAAO,CAAC;IA4BzC,CAAC;IA3BW,cAAc;QACtB,OAAO,IAAI,sBAAa,CAAC,8BAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC3D,CAAC;IAED,aAAa,CAAC,IAAyB;QACrC,IAAI,CAAC,KAAK,CAAC,aAAa,iCACnB,IAAI,KACP,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,EAC1B,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,IAC3B,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,aAAa,iCACtB,IAAI,KACP,CAAC,EAAE,IAAI,CAAC,KAAK,GAAG,CAAC,EACjB,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,EAClB,KAAK,EAAE,CAAC,EACR,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,IACvC,CAAC;QACH,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC;IAED,UAAU,CAAC,KAAiB;QAC1B,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACrC,IAAI,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,MAAM,EAAE;YAC7D,OAAO,KAAK,CAAC;SACd;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA7BD,0DA6BC","file":"character-shape.js","sourcesContent":["import type { Graphic } from '../graphic/graphic';\nimport { CharacterComponent } from '../character';\nimport { StoryComponentType } from '../../../../constants/character';\nimport { GraphicSymbol } from '../graphic/symbol';\nimport type { StoryEvent } from '../../../interface';\nimport type { ICharacterPickInfo } from '../../runtime-interface';\n\nexport class CharacterComponentShape extends CharacterComponent {\n readonly graphicType: string = 'shape';\n protected _createGraphic(): Graphic {\n return new GraphicSymbol(StoryComponentType.SHAPE, this);\n }\n\n setAttributes(attr: Record<string, any>): void {\n this.group.setAttributes({\n ...attr,\n x: attr.x - attr.width / 2,\n y: attr.y - attr.height / 2\n });\n this._graphic.setAttributes({\n ...attr,\n x: attr.width / 2,\n y: attr.height / 2,\n angle: 0,\n size: Math.min(attr.width, attr.height)\n });\n this._text.updateAttribute({});\n }\n\n checkEvent(event: StoryEvent): false | ICharacterPickInfo {\n const info = super.checkEvent(event);\n if (info && event.path[event.path.length - 1] === this._group) {\n return false;\n }\n return info;\n }\n}\n"]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { IWidgetData } from '../../dsl-interface';
|
|
2
|
-
import type { IRichTextGraphicAttribute } from '@visactor/vrender';
|
|
2
|
+
import type { IRichText, IRichTextGraphicAttribute } from '@visactor/vrender';
|
|
3
3
|
import type { CharacterComponent } from '../character';
|
|
4
4
|
export declare const MAX_LAYOUT_SIZE = 999999;
|
|
5
5
|
export declare class GraphicBaseText {
|
|
6
6
|
private _character;
|
|
7
7
|
private _graphic;
|
|
8
|
+
get graphic(): IRichText;
|
|
8
9
|
constructor(graphicCharacter: CharacterComponent);
|
|
9
10
|
getInitialAttributes(): IRichTextGraphicAttribute & {
|
|
10
11
|
graphicAlign: string;
|
|
@@ -9,6 +9,9 @@ const layout_1 = require("../../../utils/layout"), vrender_1 = require("@visacto
|
|
|
9
9
|
exports.MAX_LAYOUT_SIZE = 999999;
|
|
10
10
|
|
|
11
11
|
class GraphicBaseText {
|
|
12
|
+
get graphic() {
|
|
13
|
+
return this._graphic;
|
|
14
|
+
}
|
|
12
15
|
constructor(graphicCharacter) {
|
|
13
16
|
this.updateAttribute = attribute => {
|
|
14
17
|
attribute && (this._graphic.setAttributes(this._transformTextAttributes(attribute)),
|
|
@@ -27,6 +30,8 @@ class GraphicBaseText {
|
|
|
27
30
|
graphicAlign: "center",
|
|
28
31
|
graphicBaseline: "middle",
|
|
29
32
|
ignoreBuf: !0,
|
|
33
|
+
height: 0,
|
|
34
|
+
width: 0,
|
|
30
35
|
maxLineWidth: exports.MAX_LAYOUT_SIZE,
|
|
31
36
|
heightLimit: exports.MAX_LAYOUT_SIZE
|
|
32
37
|
};
|
|
@@ -97,8 +102,8 @@ class GraphicBaseText {
|
|
|
97
102
|
this._graphic.setAttributes(this._transformTextAttributes({
|
|
98
103
|
x: x,
|
|
99
104
|
y: y,
|
|
100
|
-
textAlign:
|
|
101
|
-
textBaseline:
|
|
105
|
+
textAlign: graphicAlign,
|
|
106
|
+
textBaseline: graphicBaseline,
|
|
102
107
|
angle: layoutData.angle,
|
|
103
108
|
anchor: [ layoutData.width / 2, layoutData.height / 2 ],
|
|
104
109
|
scaleCenter: [ layoutData.width / 2, layoutData.height / 2 ],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/story/character/component/graphic/graphic-base-text.ts"],"names":[],"mappings":";;;AAAA,kDAA4D;AAG5D,+CAA+D;AAGlD,QAAA,eAAe,GAAG,MAAM,CAAC;AAEtC,MAAa,eAAe;IAG1B,YAAY,g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AC;gBACR,QAAQ,GAAG,KAAK,CAAC;gBACjB,MAAM;YACR,KAAK,QAAQ;gBACX,CAAC,GAAG,MAAM,CAAC;gBACX,QAAQ,GAAG,QAAQ,CAAC;gBACpB,MAAM;YACR,KAAK,QAAQ;gBACX,CAAC,GAAG,MAAM,CAAC;gBACX,QAAQ,GAAG,QAAQ,CAAC;gBACpB,MAAM;SACT;QAED,IAAI,CAAC,QAAQ,CAAC,aAAa,CACzB,IAAI,CAAC,wBAAwB,CAAC;YAC5B,CAAC;YACD,CAAC;YACD,SAAS,EAAE,YAAY;YACvB,YAAY,EAAE,eAAe;YAC7B,KAAK,EAAE,UAAU,CAAC,KAAK;YACvB,MAAM,EAAE,CAAC,UAAU,CAAC,KAAK,GAAG,CAAC,EAAE,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;YACrD,WAAW,EAAE,CAAC,UAAU,CAAC,KAAK,GAAG,CAAC,EAAE,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;YAC1D,QAAQ,EAAE,UAAU,CAAC,KAAK;YAC1B,SAAS,EAAE,UAAU,CAAC,MAAM;YAC5B,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,uBAAe;SACtG,CAAC,CACH,CAAC;IACJ,CAAC;IAEO,2BAA2B;QACjC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,SAAS,EAAE;YAQ5D,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;SACjE;IACH,CAAC;IAEO,wBAAwB,CAAC,UAAqC;QACpE,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAtKD,0CAsKC","file":"graphic-base-text.js","sourcesContent":["import { getLayoutFromWidget } from '../../../utils/layout';\nimport type { IWidgetData } from '../../dsl-interface';\nimport type { IRichText, IRichTextGraphicAttribute, TextAlignType, TextBaselineType } from '@visactor/vrender';\nimport { createRichText, createText } from '@visactor/vrender';\nimport type { CharacterComponent } from '../character';\n\nexport const MAX_LAYOUT_SIZE = 999999;\n\nexport class GraphicBaseText {\n private _character: CharacterComponent;\n private _graphic: IRichText;\n get graphic() {\n return this._graphic;\n }\n constructor(graphicCharacter: CharacterComponent) {\n this._character = graphicCharacter;\n }\n\n getInitialAttributes(): IRichTextGraphicAttribute & { graphicAlign: string; graphicBaseline: string } {\n return {\n visible: true,\n x: 0,\n y: 0,\n textAlign: 'center',\n textBaseline: 'middle',\n textConfig: [],\n fontSize: 16,\n // fill: '#000000',\n // whiteSpace: 'normal',\n graphicAlign: 'center',\n graphicBaseline: 'middle',\n // // compute real height without vrender buffer\n ignoreBuf: true,\n height: 0,\n width: 0,\n maxLineWidth: MAX_LAYOUT_SIZE,\n heightLimit: MAX_LAYOUT_SIZE\n };\n }\n\n show(): void {\n this._graphic.setAttributes({\n visible: true\n // visibleAll: true,\n });\n }\n hide(): void {\n this._graphic.setAttributes({\n visible: false\n // visibleAll: false,\n });\n }\n\n transformTextAttrsToRichTextConfig() {\n const textAttr = (this._character.spec.options?.text ?? {}) as IRichTextGraphicAttribute;\n let textConfig = textAttr.textConfig;\n\n // 如果是纯文本定义方式\n if (!(textConfig && textConfig.length) && textAttr.text) {\n const textList = Array.isArray(textAttr.text) ? textAttr.text : [textAttr.text];\n textConfig = textList.map((item, i) => {\n return {\n textAlign: 'center',\n textBaseline: 'middle',\n // ...((textAttr || {}) as any),\n text: item + (i < textList.length - 1 ? '\\n' : '')\n };\n });\n }\n\n return textConfig;\n }\n\n init() {\n this._graphic = createRichText(\n this._transformTextAttributes({\n ...this.getInitialAttributes(),\n textConfig: this.transformTextAttrsToRichTextConfig()\n } as any)\n );\n this._character.getGraphicParent().add(this._graphic);\n }\n\n applyGraphicAttribute(graphicAttribute: Partial<IRichTextGraphicAttribute>): void {\n this._graphic.setAttributes({ ...graphicAttribute });\n }\n\n getGraphicAttribute(): IRichTextGraphicAttribute {\n return this._graphic?.attribute;\n }\n\n updateAttribute = (attribute: Partial<IRichTextGraphicAttribute>): void => {\n if (attribute) {\n this._graphic.setAttributes(this._transformTextAttributes(attribute));\n this._updateGraphicCharacterSize();\n }\n };\n\n applyLayoutData(w: Partial<IWidgetData>): void {\n const layoutData = getLayoutFromWidget(w);\n const layoutRatio = this._character.getTextLayoutRatio();\n const graphicAlign = (this._graphic.attribute as any).graphicAlign;\n const graphicBaseline = (this._graphic.attribute as any).graphicBaseline;\n const left = layoutData.width * layoutRatio.left;\n const right = layoutData.width * layoutRatio.right;\n const center = (left + right) / 2;\n const top = layoutData.height * layoutRatio.top;\n const bottom = layoutData.height * layoutRatio.bottom;\n const middle = (top + bottom) / 2;\n let x = center;\n let align: TextAlignType = 'center';\n let y = middle;\n let baseline: TextBaselineType = 'middle';\n switch (graphicAlign) {\n case 'left':\n x = left;\n align = 'left';\n break;\n case 'center':\n x = center;\n align = 'center';\n break;\n case 'right':\n x = right;\n align = 'right';\n break;\n }\n switch (graphicBaseline) {\n case 'top':\n y = top;\n baseline = 'top';\n break;\n case 'middle':\n y = middle;\n baseline = 'middle';\n break;\n case 'bottom':\n y = bottom;\n baseline = 'bottom';\n break;\n }\n\n this._graphic.setAttributes(\n this._transformTextAttributes({\n x,\n y,\n textAlign: graphicAlign,\n textBaseline: graphicBaseline,\n angle: layoutData.angle,\n anchor: [layoutData.width / 2, layoutData.height / 2],\n scaleCenter: [layoutData.width / 2, layoutData.height / 2],\n maxWidth: layoutData.width,\n maxHeight: layoutData.height,\n heightLimit: this._character.graphic.getGraphicAttribute().isResized ? bottom - top : MAX_LAYOUT_SIZE\n })\n );\n }\n\n private _updateGraphicCharacterSize() {\n if (!this._character.graphic.getGraphicAttribute().isResized) {\n // const layoutRatio = this._character.graphic.getTextLayoutRatio();\n // const textHeight = this._graphic.AABBBounds.height();\n // const minGraphicHeight = this._character.graphic.getInitialAttributes().height;\n // const graphicHeight = Math.max(textHeight / (layoutRatio.bottom - layoutRatio.top), minGraphicHeight);\n // this._character.graphic.applyLayoutData({\n // height: graphicHeight\n // });\n this.applyLayoutData(this._character.graphic.getPositionData());\n }\n }\n\n private _transformTextAttributes(attributes: IRichTextGraphicAttribute): IRichTextGraphicAttribute {\n return attributes;\n }\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ISymbol } from '@visactor/vrender';
|
|
2
2
|
import type { IPointLike } from '@visactor/vutils';
|
|
3
3
|
import { Graphic } from './graphic';
|
|
4
|
+
import type { IWidgetData } from '../../dsl-interface';
|
|
4
5
|
export declare class GraphicSymbol extends Graphic {
|
|
5
6
|
protected _graphic: ISymbol;
|
|
6
7
|
getInitialAttributes(): {
|
|
@@ -16,4 +17,6 @@ export declare class GraphicSymbol extends Graphic {
|
|
|
16
17
|
symbolType: string;
|
|
17
18
|
};
|
|
18
19
|
init(): void;
|
|
20
|
+
applyLayoutData(layoutData: Partial<IWidgetData>): void;
|
|
21
|
+
protected _transformAttributes(attributes: any): any;
|
|
19
22
|
}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.GraphicSymbol = void 0;
|
|
6
6
|
|
|
7
|
-
const vrender_1 = require("@visactor/vrender"), graphic_1 = require("./graphic");
|
|
7
|
+
const vrender_1 = require("@visactor/vrender"), graphic_1 = require("./graphic"), layout_1 = require("../../../utils/layout");
|
|
8
8
|
|
|
9
9
|
class GraphicSymbol extends graphic_1.Graphic {
|
|
10
10
|
getInitialAttributes() {
|
|
@@ -23,8 +23,22 @@ class GraphicSymbol extends graphic_1.Graphic {
|
|
|
23
23
|
}
|
|
24
24
|
init() {
|
|
25
25
|
var _a, _b;
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
if (!this._graphic) {
|
|
27
|
+
const attributes = this._transformAttributes(Object.assign(Object.assign({}, this.getInitialAttributes()), null !== (_b = null === (_a = this._character.spec.options) || void 0 === _a ? void 0 : _a.graphic) && void 0 !== _b ? _b : {}));
|
|
28
|
+
this._graphic = (0, vrender_1.createSymbol)(attributes), this._graphic.name = `graphic-symbol-${this._character.id}`,
|
|
29
|
+
this._character.getGraphicParent().add(this._graphic);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
applyLayoutData(layoutData) {
|
|
33
|
+
const attributes = this._transformAttributes(Object.assign(Object.assign({}, (0,
|
|
34
|
+
layout_1.getLayoutFromWidget)(layoutData)), {
|
|
35
|
+
shapePoints: this._character.spec.options.shapePoints
|
|
36
|
+
}));
|
|
37
|
+
attributes.size = Math.min(attributes.width, attributes.height), this._graphic.setAttributes(attributes);
|
|
38
|
+
}
|
|
39
|
+
_transformAttributes(attributes) {
|
|
40
|
+
const data = super._transformAttributes(attributes), {width: width, height: height} = attributes;
|
|
41
|
+
return data.x = width / 2, data.y = height / 2, data;
|
|
28
42
|
}
|
|
29
43
|
}
|
|
30
44
|
|