@visactor/vrender-core 0.23.0-alpha.3 → 1.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/animate/config.d.ts +0 -1
- package/cjs/animate/config.js +1 -5
- package/cjs/animate/config.js.map +1 -1
- package/cjs/application.d.ts +2 -1
- package/cjs/application.js.map +1 -1
- package/cjs/color-string/interpolate.js +5 -2
- package/cjs/color-string/interpolate.js.map +1 -1
- package/cjs/common/canvas-utils.js +6 -3
- package/cjs/common/canvas-utils.js.map +1 -1
- package/cjs/common/custom-path2d.js +2 -2
- package/cjs/common/custom-path2d.js.map +1 -1
- package/cjs/common/diff.d.ts +1 -0
- package/cjs/common/diff.js +19 -0
- package/cjs/common/diff.js.map +1 -0
- package/cjs/common/enums.d.ts +0 -16
- package/cjs/common/enums.js +4 -12
- package/cjs/common/enums.js.map +1 -1
- package/cjs/common/morphing-utils.js +32 -124
- package/cjs/common/morphing-utils.js.map +1 -1
- package/cjs/common/segment/index.d.ts +1 -0
- package/cjs/common/segment/index.js +4 -1
- package/cjs/common/segment/index.js.map +1 -1
- package/cjs/common/segment/step.d.ts +6 -0
- package/cjs/common/segment/step.js +19 -2
- package/cjs/common/segment/step.js.map +1 -1
- package/cjs/common/shape/arc.d.ts +1 -1
- package/cjs/common/shape/arc.js +7 -3
- package/cjs/common/shape/arc.js.map +1 -1
- package/cjs/common/split-path.js +2 -3
- package/cjs/common/split-path.js.map +1 -1
- package/cjs/common/store.js +2 -1
- package/cjs/common/utils.d.ts +0 -2
- package/cjs/common/utils.js +4 -8
- package/cjs/common/utils.js.map +1 -1
- package/cjs/core/global-module.js +2 -0
- package/cjs/core/stage.d.ts +5 -2
- package/cjs/core/stage.js +19 -10
- package/cjs/core/stage.js.map +1 -1
- package/cjs/event/event-system.js +6 -7
- package/cjs/event/event-system.js.map +1 -1
- package/cjs/event/federated-event/base-event.js +1 -1
- package/cjs/event/federated-event/base-event.js.map +1 -1
- package/cjs/graphic/arc.d.ts +1 -2
- package/cjs/graphic/arc.js +4 -3
- package/cjs/graphic/arc.js.map +1 -1
- package/cjs/graphic/area.d.ts +1 -2
- package/cjs/graphic/area.js +5 -2
- package/cjs/graphic/area.js.map +1 -1
- package/cjs/graphic/circle.d.ts +1 -2
- package/cjs/graphic/circle.js +7 -3
- package/cjs/graphic/circle.js.map +1 -1
- package/cjs/graphic/config.d.ts +2 -1
- package/cjs/graphic/config.js +10 -3
- package/cjs/graphic/config.js.map +1 -1
- package/cjs/graphic/constants.d.ts +1 -0
- package/cjs/graphic/constants.js +4 -3
- package/cjs/graphic/constants.js.map +1 -1
- package/cjs/graphic/graphic-service/graphic-module.js +1 -2
- package/cjs/graphic/graphic-service/graphic-module.js.map +1 -1
- package/cjs/graphic/graphic.d.ts +10 -10
- package/cjs/graphic/graphic.js +42 -98
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/graphic/group.js +14 -7
- package/cjs/graphic/group.js.map +1 -1
- package/cjs/graphic/image.js +2 -1
- package/cjs/graphic/image.js.map +1 -1
- package/cjs/graphic/index.d.ts +1 -0
- package/cjs/graphic/index.js +8 -8
- package/cjs/graphic/index.js.map +1 -1
- package/cjs/graphic/line.d.ts +1 -2
- package/cjs/graphic/line.js +7 -2
- package/cjs/graphic/line.js.map +1 -1
- package/cjs/graphic/path.js +2 -1
- package/cjs/graphic/path.js.map +1 -1
- package/cjs/graphic/polygon.js +2 -1
- package/cjs/graphic/polygon.js.map +1 -1
- package/cjs/graphic/rect.js +7 -3
- package/cjs/graphic/rect.js.map +1 -1
- package/cjs/graphic/richtext/icon.d.ts +1 -1
- package/cjs/graphic/richtext/icon.js.map +1 -1
- package/cjs/graphic/richtext/paragraph.d.ts +3 -0
- package/cjs/graphic/richtext/paragraph.js +14 -10
- package/cjs/graphic/richtext/paragraph.js.map +1 -1
- package/cjs/graphic/richtext/utils.js +12 -2
- package/cjs/graphic/richtext/utils.js.map +1 -1
- package/cjs/graphic/richtext.d.ts +3 -0
- package/cjs/graphic/richtext.js +3 -2
- package/cjs/graphic/richtext.js.map +1 -1
- package/cjs/graphic/star.d.ts +52 -0
- package/cjs/graphic/star.js +78 -0
- package/cjs/graphic/star.js.map +1 -0
- package/cjs/graphic/symbol.js +3 -1
- package/cjs/graphic/symbol.js.map +1 -1
- package/cjs/graphic/text.js +1 -0
- package/cjs/graphic/text.js.map +1 -1
- package/cjs/graphic/theme.js +2 -0
- package/cjs/graphic/theme.js.map +1 -1
- package/cjs/index.d.ts +3 -0
- package/cjs/index.js +14 -12
- package/cjs/index.js.map +1 -1
- package/cjs/interface/animate.d.ts +1 -165
- package/cjs/interface/animate.js +1 -4
- package/cjs/interface/animate.js.map +1 -1
- package/cjs/interface/animation/animate.d.ts +117 -0
- package/cjs/interface/animation/animate.js +10 -0
- package/cjs/interface/animation/animate.js.map +1 -0
- package/cjs/interface/animation/easing.d.ts +3 -0
- package/cjs/interface/animation/easing.js +6 -0
- package/cjs/interface/animation/easing.js.map +1 -0
- package/cjs/interface/animation/index.d.ts +5 -0
- package/cjs/interface/animation/index.js +23 -0
- package/cjs/interface/animation/index.js.map +1 -0
- package/cjs/interface/animation/ticker.d.ts +39 -0
- package/cjs/interface/animation/ticker.js +11 -0
- package/cjs/interface/animation/ticker.js.map +1 -0
- package/cjs/interface/animation/timeline.d.ts +17 -0
- package/cjs/interface/animation/timeline.js +6 -0
- package/cjs/interface/animation/timeline.js.map +1 -0
- package/cjs/interface/animation/type.d.ts +13 -0
- package/cjs/interface/animation/type.js +15 -0
- package/cjs/interface/animation/type.js.map +1 -0
- package/cjs/interface/common.d.ts +1 -1
- package/cjs/interface/common.js.map +1 -1
- package/cjs/interface/contribution.d.ts +2 -0
- package/cjs/interface/contribution.js.map +1 -1
- package/cjs/interface/graphic/index.d.ts +1 -0
- package/cjs/interface/graphic/index.js +3 -2
- package/cjs/interface/graphic/index.js.map +1 -1
- package/cjs/interface/graphic/richText.d.ts +3 -0
- package/cjs/interface/graphic/richText.js.map +1 -1
- package/cjs/interface/graphic/star.d.ts +12 -0
- package/cjs/interface/graphic/star.js +6 -0
- package/cjs/interface/graphic/star.js.map +1 -0
- package/cjs/interface/graphic/theme.d.ts +3 -0
- package/cjs/interface/graphic/theme.js.map +1 -1
- package/cjs/interface/graphic.d.ts +12 -1
- package/cjs/interface/graphic.js.map +1 -1
- package/cjs/interface/index.d.ts +1 -1
- package/cjs/interface/index.js +1 -1
- package/cjs/interface/index.js.map +1 -1
- package/cjs/interface/render.d.ts +1 -0
- package/cjs/interface/render.js.map +1 -1
- package/cjs/interface/stage.d.ts +3 -1
- package/cjs/interface/stage.js.map +1 -1
- package/cjs/modules.d.ts +2 -1
- package/cjs/modules.js +4 -3
- package/cjs/modules.js.map +1 -1
- package/cjs/plugins/builtin-plugin/auto-render-plugin.js +9 -8
- package/cjs/plugins/builtin-plugin/auto-render-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js +14 -11
- package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/edit-module.js +11 -8
- package/cjs/plugins/builtin-plugin/edit-module.js.map +1 -1
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +13 -10
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.js +0 -1
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/incremental-auto-render-plugin.js +8 -5
- package/cjs/plugins/builtin-plugin/incremental-auto-render-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js +1 -1
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
- package/cjs/register/register-star.d.ts +1 -0
- package/cjs/register/register-star.js +14 -0
- package/cjs/register/register-star.js.map +1 -0
- package/cjs/render/contributions/render/area-render.js +2 -2
- package/cjs/render/contributions/render/area-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/constants.d.ts +1 -0
- package/cjs/render/contributions/render/contributions/constants.js +3 -2
- package/cjs/render/contributions/render/contributions/constants.js.map +1 -1
- package/cjs/render/contributions/render/contributions/index.d.ts +1 -0
- package/cjs/render/contributions/render/contributions/index.js +2 -2
- package/cjs/render/contributions/render/contributions/index.js.map +1 -1
- package/cjs/render/contributions/render/contributions/star-contribution-render.d.ts +2 -0
- package/cjs/render/contributions/render/contributions/star-contribution-render.js +11 -0
- package/cjs/render/contributions/render/contributions/star-contribution-render.js.map +1 -0
- package/cjs/render/contributions/render/draw-contribution.js +1 -1
- package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
- package/cjs/render/contributions/render/line-render.js +1 -1
- package/cjs/render/contributions/render/line-render.js.map +1 -1
- package/cjs/render/contributions/render/star-module.d.ts +2 -0
- package/cjs/render/contributions/render/star-module.js +15 -0
- package/cjs/render/contributions/render/star-module.js.map +1 -0
- package/cjs/render/contributions/render/star-render.d.ts +10 -0
- package/cjs/render/contributions/render/star-render.js +54 -0
- package/cjs/render/contributions/render/star-render.js.map +1 -0
- package/cjs/render/contributions/render/symbol.d.ts +1 -0
- package/cjs/render/contributions/render/symbol.js +2 -2
- package/cjs/render/contributions/render/symbol.js.map +1 -1
- package/cjs/render/render-service.d.ts +1 -1
- package/cjs/render/render-service.js.map +1 -1
- package/dist/index.es.js +12578 -12435
- package/es/animate/config.d.ts +0 -1
- package/es/animate/config.js +0 -5
- package/es/animate/config.js.map +1 -1
- package/es/application.d.ts +2 -1
- package/es/application.js.map +1 -1
- package/es/color-string/interpolate.js +4 -1
- package/es/color-string/interpolate.js.map +1 -1
- package/es/common/canvas-utils.js +6 -3
- package/es/common/canvas-utils.js.map +1 -1
- package/es/common/custom-path2d.js +2 -2
- package/es/common/custom-path2d.js.map +1 -1
- package/es/common/diff.d.ts +1 -0
- package/es/common/diff.js +11 -0
- package/es/common/diff.js.map +1 -0
- package/es/common/enums.d.ts +0 -16
- package/es/common/enums.js +2 -21
- package/es/common/enums.js.map +1 -1
- package/es/common/morphing-utils.js +29 -124
- package/es/common/morphing-utils.js.map +1 -1
- package/es/common/segment/index.d.ts +1 -0
- package/es/common/segment/index.js +6 -1
- package/es/common/segment/index.js.map +1 -1
- package/es/common/segment/step.d.ts +6 -0
- package/es/common/segment/step.js +13 -0
- package/es/common/segment/step.js.map +1 -1
- package/es/common/shape/arc.d.ts +1 -1
- package/es/common/shape/arc.js +7 -3
- package/es/common/shape/arc.js.map +1 -1
- package/es/common/split-path.js +2 -3
- package/es/common/split-path.js.map +1 -1
- package/es/common/store.js +2 -1
- package/es/common/utils.d.ts +0 -2
- package/es/common/utils.js +0 -4
- package/es/common/utils.js.map +1 -1
- package/es/core/global-module.js +2 -0
- package/es/core/stage.d.ts +5 -2
- package/es/core/stage.js +20 -9
- package/es/core/stage.js.map +1 -1
- package/es/event/event-system.js +6 -7
- package/es/event/event-system.js.map +1 -1
- package/es/event/federated-event/base-event.js +1 -1
- package/es/event/federated-event/base-event.js.map +1 -1
- package/es/graphic/arc.d.ts +1 -2
- package/es/graphic/arc.js +4 -3
- package/es/graphic/arc.js.map +1 -1
- package/es/graphic/area.d.ts +1 -2
- package/es/graphic/area.js +5 -2
- package/es/graphic/area.js.map +1 -1
- package/es/graphic/circle.d.ts +1 -2
- package/es/graphic/circle.js +6 -3
- package/es/graphic/circle.js.map +1 -1
- package/es/graphic/config.d.ts +2 -1
- package/es/graphic/config.js +11 -2
- package/es/graphic/config.js.map +1 -1
- package/es/graphic/constants.d.ts +1 -0
- package/es/graphic/constants.js +2 -0
- package/es/graphic/constants.js.map +1 -1
- package/es/graphic/graphic-service/graphic-module.js +1 -1
- package/es/graphic/graphic-service/graphic-module.js.map +1 -1
- package/es/graphic/graphic.d.ts +10 -10
- package/es/graphic/graphic.js +44 -100
- package/es/graphic/graphic.js.map +1 -1
- package/es/graphic/group.js +15 -8
- package/es/graphic/group.js.map +1 -1
- package/es/graphic/image.js +2 -1
- package/es/graphic/image.js.map +1 -1
- package/es/graphic/index.d.ts +1 -0
- package/es/graphic/index.js +2 -0
- package/es/graphic/index.js.map +1 -1
- package/es/graphic/line.d.ts +1 -2
- package/es/graphic/line.js +7 -2
- package/es/graphic/line.js.map +1 -1
- package/es/graphic/path.js +2 -1
- package/es/graphic/path.js.map +1 -1
- package/es/graphic/polygon.js +2 -1
- package/es/graphic/polygon.js.map +1 -1
- package/es/graphic/rect.js +7 -3
- package/es/graphic/rect.js.map +1 -1
- package/es/graphic/richtext/icon.d.ts +1 -1
- package/es/graphic/richtext/icon.js.map +1 -1
- package/es/graphic/richtext/paragraph.d.ts +3 -0
- package/es/graphic/richtext/paragraph.js +14 -10
- package/es/graphic/richtext/paragraph.js.map +1 -1
- package/es/graphic/richtext/utils.js +12 -2
- package/es/graphic/richtext/utils.js.map +1 -1
- package/es/graphic/richtext.d.ts +3 -0
- package/es/graphic/richtext.js +3 -2
- package/es/graphic/richtext.js.map +1 -1
- package/es/graphic/star.d.ts +52 -0
- package/es/graphic/star.js +82 -0
- package/es/graphic/star.js.map +1 -0
- package/es/graphic/symbol.js +3 -1
- package/es/graphic/symbol.js.map +1 -1
- package/es/graphic/text.js +1 -0
- package/es/graphic/text.js.map +1 -1
- package/es/graphic/theme.js +3 -1
- package/es/graphic/theme.js.map +1 -1
- package/es/index.d.ts +3 -0
- package/es/index.js +6 -0
- package/es/index.js.map +1 -1
- package/es/interface/animate.d.ts +1 -165
- package/es/interface/animate.js +2 -1
- package/es/interface/animate.js.map +1 -1
- package/es/interface/animation/animate.d.ts +117 -0
- package/es/interface/animation/animate.js +6 -0
- package/es/interface/animation/animate.js.map +1 -0
- package/es/interface/animation/easing.d.ts +3 -0
- package/es/interface/animation/easing.js +2 -0
- package/es/interface/animation/easing.js.map +1 -0
- package/es/interface/animation/index.d.ts +5 -0
- package/es/interface/animation/index.js +10 -0
- package/es/interface/animation/index.js.map +1 -0
- package/es/interface/animation/ticker.d.ts +39 -0
- package/es/interface/animation/ticker.js +7 -0
- package/es/interface/animation/ticker.js.map +1 -0
- package/es/interface/animation/timeline.d.ts +17 -0
- package/es/interface/animation/timeline.js +2 -0
- package/es/interface/animation/timeline.js.map +1 -0
- package/es/interface/animation/type.d.ts +13 -0
- package/es/interface/animation/type.js +14 -0
- package/es/interface/animation/type.js.map +1 -0
- package/es/interface/common.d.ts +1 -1
- package/es/interface/common.js.map +1 -1
- package/es/interface/contribution.d.ts +2 -0
- package/es/interface/contribution.js.map +1 -1
- package/es/interface/graphic/index.d.ts +1 -0
- package/es/interface/graphic/index.js +2 -0
- package/es/interface/graphic/index.js.map +1 -1
- package/es/interface/graphic/richText.d.ts +3 -0
- package/es/interface/graphic/richText.js.map +1 -1
- package/es/interface/graphic/star.d.ts +12 -0
- package/es/interface/graphic/star.js +2 -0
- package/es/interface/graphic/star.js.map +1 -0
- package/es/interface/graphic/theme.d.ts +3 -0
- package/es/interface/graphic/theme.js.map +1 -1
- package/es/interface/graphic.d.ts +12 -1
- package/es/interface/graphic.js.map +1 -1
- package/es/interface/index.d.ts +1 -1
- package/es/interface/index.js +1 -1
- package/es/interface/index.js.map +1 -1
- package/es/interface/render.d.ts +1 -0
- package/es/interface/render.js.map +1 -1
- package/es/interface/stage.d.ts +3 -1
- package/es/interface/stage.js.map +1 -1
- package/es/modules.d.ts +2 -1
- package/es/modules.js +6 -0
- package/es/modules.js.map +1 -1
- package/es/plugins/builtin-plugin/auto-render-plugin.js +8 -8
- package/es/plugins/builtin-plugin/auto-render-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/dirty-bounds-plugin.js +13 -12
- package/es/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/edit-module.js +11 -8
- package/es/plugins/builtin-plugin/edit-module.js.map +1 -1
- package/es/plugins/builtin-plugin/flex-layout-plugin.js +12 -11
- package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/html-attribute-plugin.js +0 -1
- package/es/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/incremental-auto-render-plugin.js +8 -5
- package/es/plugins/builtin-plugin/incremental-auto-render-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/richtext-edit-plugin.js +1 -1
- package/es/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
- package/es/register/register-star.d.ts +1 -0
- package/es/register/register-star.js +8 -0
- package/es/register/register-star.js.map +1 -0
- package/es/render/contributions/render/area-render.js +2 -2
- package/es/render/contributions/render/area-render.js.map +1 -1
- package/es/render/contributions/render/contributions/constants.d.ts +1 -0
- package/es/render/contributions/render/contributions/constants.js +2 -0
- package/es/render/contributions/render/contributions/constants.js.map +1 -1
- package/es/render/contributions/render/contributions/index.d.ts +1 -0
- package/es/render/contributions/render/contributions/index.js +2 -0
- package/es/render/contributions/render/contributions/index.js.map +1 -1
- package/es/render/contributions/render/contributions/star-contribution-render.d.ts +2 -0
- package/es/render/contributions/render/contributions/star-contribution-render.js +8 -0
- package/es/render/contributions/render/contributions/star-contribution-render.js.map +1 -0
- package/es/render/contributions/render/draw-contribution.js +1 -1
- package/es/render/contributions/render/draw-contribution.js.map +1 -1
- package/es/render/contributions/render/line-render.js +1 -1
- package/es/render/contributions/render/line-render.js.map +1 -1
- package/es/render/contributions/render/star-module.d.ts +2 -0
- package/es/render/contributions/render/star-module.js +13 -0
- package/es/render/contributions/render/star-module.js.map +1 -0
- package/es/render/contributions/render/star-render.d.ts +10 -0
- package/es/render/contributions/render/star-render.js +59 -0
- package/es/render/contributions/render/star-render.js.map +1 -0
- package/es/render/contributions/render/symbol.d.ts +1 -0
- package/es/render/contributions/render/symbol.js +2 -0
- package/es/render/contributions/render/symbol.js.map +1 -1
- package/es/render/render-service.d.ts +1 -1
- package/es/render/render-service.js.map +1 -1
- package/package.json +2 -2
package/es/graphic/graphic.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { Dict, IPointLike, IAABBBounds, IOBBBounds } from '@visactor/vutils
|
|
|
3
3
|
import { Matrix, Point } from '@visactor/vutils';
|
|
4
4
|
import type { GraphicType, IAnimateConfig, IGraphicAttribute, IGraphic, IGraphicJson, ISetAttributeContext, ITransform, GraphicReleaseStatus } from '../interface/graphic';
|
|
5
5
|
import { Node } from './node-tree';
|
|
6
|
-
import type { IAnimate, IAnimateTarget, IGlyphGraphicAttribute, ILayer, IPickerService, IShadowRoot, IStage, IStep,
|
|
6
|
+
import type { IAnimate, IAnimateTarget, IGlyphGraphicAttribute, ILayer, IPickerService, IShadowRoot, IStage, IStep, ISymbolClass } from '../interface';
|
|
7
7
|
import { IContainPointMode } from '../common/enums';
|
|
8
8
|
import { CustomSymbolClass } from './builtin-symbol';
|
|
9
9
|
export declare const PURE_STYLE_KEY: string[];
|
|
@@ -61,6 +61,10 @@ export declare abstract class Graphic<T extends Partial<IGraphicAttribute> = Par
|
|
|
61
61
|
glyphHost?: IGraphic<IGlyphGraphicAttribute>;
|
|
62
62
|
_onSetStage?: (g: IGraphic, stage: IStage, layer: ILayer) => void;
|
|
63
63
|
in3dMode?: boolean;
|
|
64
|
+
widthWithoutTransform?: number;
|
|
65
|
+
heightWithoutTransform?: number;
|
|
66
|
+
x1WithoutTransform?: number;
|
|
67
|
+
y1WithoutTransform?: number;
|
|
64
68
|
protected _AABBBounds: IAABBBounds;
|
|
65
69
|
get AABBBounds(): IAABBBounds;
|
|
66
70
|
protected _OBBBounds?: IOBBBounds;
|
|
@@ -83,9 +87,6 @@ export declare abstract class Graphic<T extends Partial<IGraphicAttribute> = Par
|
|
|
83
87
|
stateProxy?: (stateName: string, targetStates?: string[]) => T;
|
|
84
88
|
animates: Map<string | number, IAnimate>;
|
|
85
89
|
animate?: () => IAnimate;
|
|
86
|
-
nextAttrs?: T;
|
|
87
|
-
prevAttrs?: T;
|
|
88
|
-
finalAttrs?: T;
|
|
89
90
|
pathProxy?: ICustomPath2D;
|
|
90
91
|
attachedThemeGraphic?: IGraphic;
|
|
91
92
|
protected updateAABBBoundsStamp: number;
|
|
@@ -97,7 +98,7 @@ export declare abstract class Graphic<T extends Partial<IGraphicAttribute> = Par
|
|
|
97
98
|
set3dMode(): void;
|
|
98
99
|
set2dMode(): void;
|
|
99
100
|
getOffsetXY(attr?: ITransform, includeScroll?: boolean): Point;
|
|
100
|
-
onAnimateBind(animate: IAnimate
|
|
101
|
+
onAnimateBind(animate: IAnimate): void;
|
|
101
102
|
protected tryUpdateAABBBounds(): IAABBBounds;
|
|
102
103
|
protected tryUpdateOBBBounds(): IOBBBounds;
|
|
103
104
|
protected combindShadowAABBBounds(bounds: IAABBBounds): void;
|
|
@@ -120,6 +121,8 @@ export declare abstract class Graphic<T extends Partial<IGraphicAttribute> = Par
|
|
|
120
121
|
shouldUpdateShape(): boolean;
|
|
121
122
|
clearUpdateShapeTag(): void;
|
|
122
123
|
containsPoint(x: number, y: number, mode: IContainPointMode, picker?: IPickerService): boolean;
|
|
124
|
+
protected setWidthHeightWithoutTransform(aabbBounds: IAABBBounds): void;
|
|
125
|
+
setAttributesAndPreventAnimate(params: Partial<T>, forceUpdateTag?: boolean, context?: ISetAttributeContext): void;
|
|
123
126
|
setAttributes(params: Partial<T>, forceUpdateTag?: boolean, context?: ISetAttributeContext): void;
|
|
124
127
|
_setAttributes(params: Partial<T>, forceUpdateTag?: boolean, context?: ISetAttributeContext): void;
|
|
125
128
|
setAttribute(key: string, value: any, forceUpdateTag?: boolean, context?: ISetAttributeContext): void;
|
|
@@ -163,17 +166,13 @@ export declare abstract class Graphic<T extends Partial<IGraphicAttribute> = Par
|
|
|
163
166
|
protected needUpdateLayout(): boolean;
|
|
164
167
|
protected getAnchor(anchor: [string | number, string | number], params: {
|
|
165
168
|
b?: IAABBBounds;
|
|
166
|
-
}): [number, number];
|
|
169
|
+
}, resetScale?: boolean): [number, number];
|
|
167
170
|
protected doUpdateLocalMatrix(): void;
|
|
168
171
|
protected doUpdateGlobalMatrix(): void;
|
|
169
172
|
setStage(stage?: IStage, layer?: ILayer): void;
|
|
170
173
|
setStageToShadowRoot(stage?: IStage, layer?: ILayer): void;
|
|
171
174
|
onAddStep(step: IStep): void;
|
|
172
175
|
onStop(props?: Partial<T>): void;
|
|
173
|
-
onStep(subAnimate: ISubAnimate, animate: IAnimate, step: IStep, ratio: number, end: boolean): void;
|
|
174
|
-
stepInterpolate(subAnimate: ISubAnimate, animate: IAnimate, nextAttributes: Record<string, any>, step: IStep, ratio: number, end: boolean, nextProps: Record<string, any>, lastProps?: Record<string, any>, nextParsedProps?: any, propKeys?: string[]): void;
|
|
175
|
-
defaultInterpolate(nextStepVal: any, lastStepVal: any, key: string, nextAttributes: Record<string, any>, nextParsedProps: any, ratio: number): boolean;
|
|
176
|
-
protected _interpolate(key: string, ratio: number, lastStepVal: any, nextStepVal: any, nextAttributes: any): void;
|
|
177
176
|
getDefaultAttribute(name: string): any;
|
|
178
177
|
getComputedAttribute(name: string): any;
|
|
179
178
|
onSetStage(cb: (g: IGraphic, stage: IStage) => void, immediate?: boolean): void;
|
|
@@ -191,4 +190,5 @@ export declare abstract class Graphic<T extends Partial<IGraphicAttribute> = Par
|
|
|
191
190
|
protected _emitCustomEvent(type: string, context?: any): void;
|
|
192
191
|
abstract getNoWorkAnimateAttr(): Record<string, number>;
|
|
193
192
|
abstract clone(): IGraphic<any>;
|
|
193
|
+
toCustomPath(): ICustomPath2D;
|
|
194
194
|
}
|
package/es/graphic/graphic.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isArray, max, OBBBounds } from "@visactor/vutils";
|
|
2
2
|
|
|
3
|
-
import { AABBBounds, Matrix, normalTransform, Point, isNil,
|
|
3
|
+
import { AABBBounds, Matrix, normalTransform, Point, isNil, isString, isValidUrl, isBase64, isObject } from "@visactor/vutils";
|
|
4
4
|
|
|
5
5
|
import { Node } from "./node-tree";
|
|
6
6
|
|
|
@@ -10,8 +10,6 @@ import { DefaultTransform } from "./config";
|
|
|
10
10
|
|
|
11
11
|
import { application } from "../application";
|
|
12
12
|
|
|
13
|
-
import { interpolateColor } from "../color-string/interpolate";
|
|
14
|
-
|
|
15
13
|
import { CustomPath2D } from "../common/custom-path2d";
|
|
16
14
|
|
|
17
15
|
import { ResourceLoader } from "../resource-loader/loader";
|
|
@@ -32,6 +30,8 @@ import { SVG_PARSE_ATTRIBUTE_MAP, SVG_PARSE_ATTRIBUTE_MAP_KEYS } from "./constan
|
|
|
32
30
|
|
|
33
31
|
import { DefaultStateAnimateConfig } from "../animate/config";
|
|
34
32
|
|
|
33
|
+
import { EmptyContext2d } from "../canvas";
|
|
34
|
+
|
|
35
35
|
const _tempBounds = new AABBBounds, tempMatrix = new Matrix, tempBounds = new AABBBounds;
|
|
36
36
|
|
|
37
37
|
export const PURE_STYLE_KEY = [ "stroke", "opacity", "strokeOpacity", "lineDash", "lineDashOffset", "lineCap", "lineJoin", "miterLimit", "fill", "fillOpacity" ];
|
|
@@ -124,12 +124,13 @@ export class Graphic extends Node {
|
|
|
124
124
|
this._emitCustomEvent("animate-bind", animate);
|
|
125
125
|
}
|
|
126
126
|
tryUpdateAABBBounds() {
|
|
127
|
+
var _a, _b;
|
|
127
128
|
const full = "imprecise" === this.attribute.boundsMode;
|
|
128
129
|
if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
|
|
129
130
|
if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
|
|
130
|
-
|
|
131
|
+
null === (_a = this.stage) || void 0 === _a || _a.graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
|
|
131
132
|
const bounds = this.doUpdateAABBBounds(full);
|
|
132
|
-
return
|
|
133
|
+
return null === (_b = this.stage) || void 0 === _b || _b.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0),
|
|
133
134
|
"empty" === this.attribute.boundsMode && bounds.clear(), bounds;
|
|
134
135
|
}
|
|
135
136
|
tryUpdateOBBBounds() {
|
|
@@ -259,6 +260,16 @@ export class Graphic extends Node {
|
|
|
259
260
|
y: y
|
|
260
261
|
});
|
|
261
262
|
}
|
|
263
|
+
setWidthHeightWithoutTransform(aabbBounds) {
|
|
264
|
+
this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
|
|
265
|
+
}
|
|
266
|
+
setAttributesAndPreventAnimate(params, forceUpdateTag = !1, context) {
|
|
267
|
+
this.setAttributes(params, forceUpdateTag, context), this.animates && this.animates.forEach((animate => {
|
|
268
|
+
Object.keys(params).forEach((key => {
|
|
269
|
+
animate.preventAttr(key);
|
|
270
|
+
}));
|
|
271
|
+
}));
|
|
272
|
+
}
|
|
262
273
|
setAttributes(params, forceUpdateTag = !1, context) {
|
|
263
274
|
(params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic),
|
|
264
275
|
this._setAttributes(params, forceUpdateTag, context);
|
|
@@ -398,7 +409,8 @@ export class Graphic extends Node {
|
|
|
398
409
|
return this;
|
|
399
410
|
}
|
|
400
411
|
onAttributeUpdate(context) {
|
|
401
|
-
|
|
412
|
+
var _a;
|
|
413
|
+
context && context.skipUpdateCallback || (null === (_a = this.stage) || void 0 === _a || _a.graphicService.onAttributeUpdate(this),
|
|
402
414
|
this._emitCustomEvent("afterAttributeUpdate", context));
|
|
403
415
|
}
|
|
404
416
|
update(d) {
|
|
@@ -420,7 +432,7 @@ export class Graphic extends Node {
|
|
|
420
432
|
keys.forEach((key => {
|
|
421
433
|
noWorkAttrs[key] ? (noAnimateAttrs || (noAnimateAttrs = {}), noAnimateAttrs[key] = attrs[key]) : animateAttrs[key] = isClear && void 0 === attrs[key] ? this.getDefaultAttribute(key) : attrs[key];
|
|
422
434
|
}));
|
|
423
|
-
const stateAnimateConfig = null !== (_b = null !== (_a = this.context.stateAnimateConfig) && void 0 !== _a ? _a : this.stateAnimateConfig) && void 0 !== _b ? _b : DefaultStateAnimateConfig;
|
|
435
|
+
const stateAnimateConfig = null !== (_b = null !== (_a = this.context && this.context.stateAnimateConfig) && void 0 !== _a ? _a : this.stateAnimateConfig) && void 0 !== _b ? _b : DefaultStateAnimateConfig;
|
|
424
436
|
this.applyAnimationState([ "state" ], [ {
|
|
425
437
|
name: "state",
|
|
426
438
|
animation: {
|
|
@@ -429,10 +441,13 @@ export class Graphic extends Node {
|
|
|
429
441
|
duration: stateAnimateConfig.duration,
|
|
430
442
|
easing: stateAnimateConfig.easing
|
|
431
443
|
}
|
|
432
|
-
} ]), noAnimateAttrs && this.
|
|
444
|
+
} ]), noAnimateAttrs && this.setAttributesAndPreventAnimate(noAnimateAttrs, !1, {
|
|
433
445
|
type: AttributeUpdateType.STATE
|
|
434
446
|
});
|
|
435
|
-
} else this.stopStateAnimates(), this.
|
|
447
|
+
} else this.stopStateAnimates(), this.setAttributesAndPreventAnimate(attrs, !1, {
|
|
448
|
+
type: AttributeUpdateType.STATE
|
|
449
|
+
});
|
|
450
|
+
this._emitCustomEvent("afterStateUpdate", {
|
|
436
451
|
type: AttributeUpdateType.STATE
|
|
437
452
|
});
|
|
438
453
|
}
|
|
@@ -452,13 +467,9 @@ export class Graphic extends Node {
|
|
|
452
467
|
}));
|
|
453
468
|
}
|
|
454
469
|
getNormalAttribute(key) {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
const endProps = animate.getEndProps();
|
|
459
|
-
has(endProps, key) && (value = endProps[key]);
|
|
460
|
-
}
|
|
461
|
-
})), value;
|
|
470
|
+
var _a, _b;
|
|
471
|
+
const value = this.attribute[key];
|
|
472
|
+
return this.animates ? null === (_a = this.finalAttribute) || void 0 === _a ? void 0 : _a[key] : null != value ? value : null === (_b = this.finalAttribute) || void 0 === _b ? void 0 : _b[key];
|
|
462
473
|
}
|
|
463
474
|
clearStates(hasAnimation) {
|
|
464
475
|
this.hasState() && this.normalAttrs ? (this.currentStates = [], this.applyStateAttrs(this.normalAttrs, this.currentStates, hasAnimation, !0)) : this.currentStates = [],
|
|
@@ -533,19 +544,12 @@ export class Graphic extends Node {
|
|
|
533
544
|
needUpdateLayout() {
|
|
534
545
|
return !!(this._updateTag & UpdateTag.UPDATE_LAYOUT);
|
|
535
546
|
}
|
|
536
|
-
getAnchor(anchor, params) {
|
|
547
|
+
getAnchor(anchor, params, resetScale) {
|
|
537
548
|
const _anchor = [ 0, 0 ], getBounds = () => {
|
|
538
549
|
if (params.b) return params.b;
|
|
539
|
-
const
|
|
540
|
-
return
|
|
541
|
-
|
|
542
|
-
scaleY: 1,
|
|
543
|
-
angle: 0
|
|
544
|
-
}), params.b = this.AABBBounds.clone(), this._AABBBounds.copy(tempBounds), this.setAttributes({
|
|
545
|
-
scaleX: scaleX,
|
|
546
|
-
scaleY: scaleY,
|
|
547
|
-
angle: angle
|
|
548
|
-
}), params.b;
|
|
550
|
+
const graphic = this.clone();
|
|
551
|
+
return graphic.attribute.angle = 0, graphic.attribute.scaleCenter = null, resetScale && (graphic.attribute.scaleX = 1,
|
|
552
|
+
graphic.attribute.scaleY = 1), params.b = graphic.AABBBounds, params.b;
|
|
549
553
|
};
|
|
550
554
|
if ("string" == typeof anchor[0]) {
|
|
551
555
|
const ratio = parseFloat(anchor[0]) / 100, bounds = getBounds();
|
|
@@ -561,10 +565,10 @@ export class Graphic extends Node {
|
|
|
561
565
|
const {x: x = DefaultTransform.x, y: y = DefaultTransform.y, scaleX: scaleX = DefaultTransform.scaleX, scaleY: scaleY = DefaultTransform.scaleY, angle: angle = DefaultTransform.angle, scaleCenter: scaleCenter, anchor: anchor, postMatrix: postMatrix} = this.attribute;
|
|
562
566
|
let _anchor = [ 0, 0 ];
|
|
563
567
|
const params = {};
|
|
564
|
-
if (anchor && (_anchor = this.getAnchor(anchor, params)), !scaleCenter || 1 === scaleX && 1 === scaleY) normalTransform(this._transMatrix, this._transMatrix.reset(), x, y, scaleX, scaleY, angle, anchor && _anchor); else {
|
|
568
|
+
if (anchor && angle && (_anchor = this.getAnchor(anchor, params)), !scaleCenter || 1 === scaleX && 1 === scaleY) normalTransform(this._transMatrix, this._transMatrix.reset(), x, y, scaleX, scaleY, angle, anchor && _anchor); else {
|
|
565
569
|
const m = this._transMatrix;
|
|
566
570
|
m.reset(), m.translate(_anchor[0], _anchor[1]), m.rotate(angle), m.translate(-_anchor[0], -_anchor[1]),
|
|
567
|
-
m.translate(x, y), _anchor = this.getAnchor(scaleCenter, params), application.transformUtil.fromMatrix(m, m).scale(scaleX, scaleY, {
|
|
571
|
+
m.translate(x, y), _anchor = this.getAnchor(scaleCenter, params, !0), application.transformUtil.fromMatrix(m, m).scale(scaleX, scaleY, {
|
|
568
572
|
x: _anchor[0],
|
|
569
573
|
y: _anchor[1]
|
|
570
574
|
});
|
|
@@ -583,6 +587,7 @@ export class Graphic extends Node {
|
|
|
583
587
|
}
|
|
584
588
|
}
|
|
585
589
|
setStage(stage, layer) {
|
|
590
|
+
var _a;
|
|
586
591
|
if (this.stage !== stage) {
|
|
587
592
|
if (this.stage = stage, this.layer = layer, this.setStageToShadowRoot(stage, layer),
|
|
588
593
|
this.animates && this.animates.size) {
|
|
@@ -591,7 +596,7 @@ export class Graphic extends Node {
|
|
|
591
596
|
a.timeline.isGlobal && (a.setTimeline(timeline), timeline.addAnimate(a));
|
|
592
597
|
}));
|
|
593
598
|
}
|
|
594
|
-
this._onSetStage && this._onSetStage(this, stage, layer),
|
|
599
|
+
this._onSetStage && this._onSetStage(this, stage, layer), null === (_a = this.stage) || void 0 === _a || _a.graphicService.onSetStage(this, stage);
|
|
595
600
|
}
|
|
596
601
|
}
|
|
597
602
|
setStageToShadowRoot(stage, layer) {
|
|
@@ -603,76 +608,6 @@ export class Graphic extends Node {
|
|
|
603
608
|
type: AttributeUpdateType.ANIMATE_END
|
|
604
609
|
});
|
|
605
610
|
}
|
|
606
|
-
onStep(subAnimate, animate, step, ratio, end) {
|
|
607
|
-
const nextAttributes = {};
|
|
608
|
-
if (step.customAnimate) step.customAnimate.update(end, ratio, nextAttributes); else {
|
|
609
|
-
const nextProps = step.props, nextParsedProps = step.parsedProps, propKeys = step.propKeys;
|
|
610
|
-
this.stepInterpolate(subAnimate, animate, nextAttributes, step, ratio, end, nextProps, void 0, nextParsedProps, propKeys);
|
|
611
|
-
}
|
|
612
|
-
this.setAttributes(nextAttributes, !1, {
|
|
613
|
-
type: AttributeUpdateType.ANIMATE_UPDATE,
|
|
614
|
-
animationState: {
|
|
615
|
-
ratio: ratio,
|
|
616
|
-
end: end,
|
|
617
|
-
step: step,
|
|
618
|
-
isFirstFrameOfStep: subAnimate.getLastStep() !== step
|
|
619
|
-
}
|
|
620
|
-
}), this.stage && this.stage.renderNextFrame();
|
|
621
|
-
}
|
|
622
|
-
stepInterpolate(subAnimate, animate, nextAttributes, step, ratio, end, nextProps, lastProps, nextParsedProps, propKeys) {
|
|
623
|
-
propKeys || (propKeys = Object.keys(nextProps), step.propKeys = propKeys), end ? step.propKeys.forEach((key => {
|
|
624
|
-
animate.validAttr(key) && (nextAttributes[key] = nextProps[key]);
|
|
625
|
-
})) : propKeys.forEach((key => {
|
|
626
|
-
var _a;
|
|
627
|
-
if (!animate.validAttr(key)) return;
|
|
628
|
-
const nextStepVal = nextProps[key], lastStepVal = null !== (_a = lastProps && lastProps[key]) && void 0 !== _a ? _a : subAnimate.getLastPropByName(key, step);
|
|
629
|
-
if (null == nextStepVal || null == lastStepVal || nextStepVal === lastStepVal) return void (nextAttributes[key] = nextStepVal);
|
|
630
|
-
let match;
|
|
631
|
-
match = animate.interpolateFunc && animate.interpolateFunc(key, ratio, lastStepVal, nextStepVal, nextAttributes),
|
|
632
|
-
match || (match = animate.customInterpolate(key, ratio, lastStepVal, nextStepVal, this, nextAttributes),
|
|
633
|
-
match || this.defaultInterpolate(nextStepVal, lastStepVal, key, nextAttributes, nextParsedProps, ratio) || this._interpolate(key, ratio, lastStepVal, nextStepVal, nextAttributes));
|
|
634
|
-
})), step.parsedProps = nextParsedProps;
|
|
635
|
-
}
|
|
636
|
-
defaultInterpolate(nextStepVal, lastStepVal, key, nextAttributes, nextParsedProps, ratio) {
|
|
637
|
-
if (Number.isFinite(nextStepVal) && Number.isFinite(lastStepVal)) return nextAttributes[key] = lastStepVal + (nextStepVal - lastStepVal) * ratio,
|
|
638
|
-
!0;
|
|
639
|
-
if ("fill" === key) {
|
|
640
|
-
nextParsedProps || (nextParsedProps = {});
|
|
641
|
-
const fillColorArray = nextParsedProps.fillColorArray, color = interpolateColor(lastStepVal, null != fillColorArray ? fillColorArray : nextStepVal, ratio, !1, ((fArray, tArray) => {
|
|
642
|
-
nextParsedProps.fillColorArray = tArray;
|
|
643
|
-
}));
|
|
644
|
-
return color && (nextAttributes[key] = color), !0;
|
|
645
|
-
}
|
|
646
|
-
if ("stroke" === key) {
|
|
647
|
-
nextParsedProps || (nextParsedProps = {});
|
|
648
|
-
const strokeColorArray = nextParsedProps.strokeColorArray, color = interpolateColor(lastStepVal, null != strokeColorArray ? strokeColorArray : nextStepVal, ratio, !1, ((fArray, tArray) => {
|
|
649
|
-
nextParsedProps.strokeColorArray = tArray;
|
|
650
|
-
}));
|
|
651
|
-
return color && (nextAttributes[key] = color), !0;
|
|
652
|
-
}
|
|
653
|
-
if ("shadowColor" === key) {
|
|
654
|
-
nextParsedProps || (nextParsedProps = {});
|
|
655
|
-
const shadowColorArray = nextParsedProps.shadowColorArray, color = interpolateColor(lastStepVal, null != shadowColorArray ? shadowColorArray : nextStepVal, ratio, !0, ((fArray, tArray) => {
|
|
656
|
-
nextParsedProps.shadowColorArray = tArray;
|
|
657
|
-
}));
|
|
658
|
-
return color && (nextAttributes[key] = color), !0;
|
|
659
|
-
}
|
|
660
|
-
if (Array.isArray(nextStepVal) && nextStepVal.length === lastStepVal.length) {
|
|
661
|
-
const nextList = [];
|
|
662
|
-
let valid = !0;
|
|
663
|
-
for (let i = 0; i < nextStepVal.length; i++) {
|
|
664
|
-
const v = lastStepVal[i], val = v + (nextStepVal[i] - v) * ratio;
|
|
665
|
-
if (!Number.isFinite(val)) {
|
|
666
|
-
valid = !1;
|
|
667
|
-
break;
|
|
668
|
-
}
|
|
669
|
-
nextList.push(val);
|
|
670
|
-
}
|
|
671
|
-
valid && (nextAttributes[key] = nextList);
|
|
672
|
-
}
|
|
673
|
-
return !1;
|
|
674
|
-
}
|
|
675
|
-
_interpolate(key, ratio, lastStepVal, nextStepVal, nextAttributes) {}
|
|
676
611
|
getDefaultAttribute(name) {
|
|
677
612
|
return this.getGraphicTheme()[name];
|
|
678
613
|
}
|
|
@@ -754,6 +689,15 @@ export class Graphic extends Node {
|
|
|
754
689
|
this.dispatchEvent(changeEvent);
|
|
755
690
|
}
|
|
756
691
|
}
|
|
692
|
+
toCustomPath() {
|
|
693
|
+
var _a, _b, _c;
|
|
694
|
+
const renderer = null === (_c = null === (_b = (null === (_a = this.stage) || void 0 === _a ? void 0 : _a.renderService) || application.renderService) || void 0 === _b ? void 0 : _b.drawContribution) || void 0 === _c ? void 0 : _c.getRenderContribution(this);
|
|
695
|
+
if (renderer) {
|
|
696
|
+
const context = new EmptyContext2d(null, 1);
|
|
697
|
+
return renderer.drawShape(this, context, 0, 0, {}, {}), context.path;
|
|
698
|
+
}
|
|
699
|
+
return null;
|
|
700
|
+
}
|
|
757
701
|
}
|
|
758
702
|
|
|
759
703
|
function backgroundNotImage(image) {
|