@visactor/vrender 0.15.0-alpha.16 → 0.15.0-alpha.17
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/animate.d.ts +1 -0
- package/cjs/animate/animate.js +3 -0
- package/cjs/animate/animate.js.map +1 -1
- package/cjs/animate/timeline.d.ts +1 -1
- package/cjs/animate/timeline.js +2 -2
- package/cjs/animate/timeline.js.map +1 -1
- package/cjs/canvas/contributions/browser/context.d.ts +1 -0
- package/cjs/common/contribution-provider.d.ts +1 -0
- package/cjs/common/contribution-provider.js +7 -2
- package/cjs/common/contribution-provider.js.map +1 -1
- package/cjs/common/enums.d.ts +4 -2
- package/cjs/common/enums.js +3 -2
- package/cjs/common/enums.js.map +1 -1
- package/cjs/core/contributions/env/base-contribution.d.ts +11 -1
- package/cjs/core/contributions/env/base-contribution.js +22 -1
- package/cjs/core/contributions/env/base-contribution.js.map +1 -1
- package/cjs/core/contributions/env/browser-contribution.d.ts +11 -2
- package/cjs/core/contributions/env/browser-contribution.js +66 -0
- package/cjs/core/contributions/env/browser-contribution.js.map +1 -1
- package/cjs/core/contributions/textMeasure/layout.js +1 -1
- package/cjs/core/contributions/textMeasure/layout.js.map +1 -1
- package/cjs/core/contributions/window/base-contribution.d.ts +11 -5
- package/cjs/core/contributions/window/base-contribution.js +10 -0
- package/cjs/core/contributions/window/base-contribution.js.map +1 -1
- package/cjs/core/contributions/window/browser-contribution.d.ts +11 -0
- package/cjs/core/contributions/window/browser-contribution.js +33 -2
- package/cjs/core/contributions/window/browser-contribution.js.map +1 -1
- package/cjs/core/global.d.ts +11 -1
- package/cjs/core/global.js +18 -0
- package/cjs/core/global.js.map +1 -1
- package/cjs/core/graphic-utils.d.ts +2 -0
- package/cjs/core/graphic-utils.js +13 -0
- package/cjs/core/graphic-utils.js.map +1 -1
- package/cjs/core/layer.js +6 -6
- package/cjs/core/layer.js.map +1 -1
- package/cjs/core/stage.d.ts +13 -4
- package/cjs/core/stage.js +54 -25
- package/cjs/core/stage.js.map +1 -1
- package/cjs/core/window.d.ts +6 -0
- package/cjs/core/window.js +10 -1
- package/cjs/core/window.js.map +1 -1
- package/cjs/event/event-manager.js +8 -8
- package/cjs/event/event-manager.js.map +1 -1
- package/cjs/event/event-system.js.map +1 -1
- package/cjs/event/federated-event/pointer-event.d.ts +1 -0
- package/cjs/event/federated-event/pointer-event.js.map +1 -1
- package/cjs/graphic/builtin-symbol/arrow2-down.d.ts +12 -0
- package/cjs/graphic/builtin-symbol/arrow2-down.js +30 -0
- package/cjs/graphic/builtin-symbol/arrow2-down.js.map +1 -0
- package/cjs/graphic/builtin-symbol/arrow2-left.js +1 -1
- package/cjs/graphic/builtin-symbol/arrow2-left.js.map +1 -1
- package/cjs/graphic/builtin-symbol/arrow2-right.js +1 -1
- package/cjs/graphic/builtin-symbol/arrow2-right.js.map +1 -1
- package/cjs/graphic/builtin-symbol/arrow2-up.d.ts +12 -0
- package/cjs/graphic/builtin-symbol/arrow2-up.js +30 -0
- package/cjs/graphic/builtin-symbol/arrow2-up.js.map +1 -0
- package/cjs/graphic/builtin-symbol/close.d.ts +13 -0
- package/cjs/graphic/builtin-symbol/close.js +33 -0
- package/cjs/graphic/builtin-symbol/close.js.map +1 -0
- package/cjs/graphic/builtin-symbol/index.d.ts +1 -1
- package/cjs/graphic/builtin-symbol/index.js +2 -2
- package/cjs/graphic/builtin-symbol/index.js.map +1 -1
- package/cjs/graphic/builtin-symbol/line-h.d.ts +13 -0
- package/cjs/graphic/builtin-symbol/line-h.js +32 -0
- package/cjs/graphic/builtin-symbol/line-h.js.map +1 -0
- package/cjs/graphic/builtin-symbol/line-v.d.ts +13 -0
- package/cjs/graphic/builtin-symbol/line-v.js +32 -0
- package/cjs/graphic/builtin-symbol/line-v.js.map +1 -0
- package/cjs/graphic/builtin-symbol/utils.d.ts +13 -5
- package/cjs/graphic/builtin-symbol/utils.js +23 -9
- package/cjs/graphic/builtin-symbol/utils.js.map +1 -1
- package/cjs/graphic/config.js +8 -4
- package/cjs/graphic/config.js.map +1 -1
- package/cjs/graphic/constants.d.ts +22 -0
- package/cjs/graphic/constants.js +20 -2
- package/cjs/graphic/constants.js.map +1 -1
- package/cjs/graphic/graphic.d.ts +4 -1
- package/cjs/graphic/graphic.js +49 -21
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/graphic/group.js +1 -1
- package/cjs/graphic/group.js.map +1 -1
- package/cjs/graphic/index.d.ts +1 -0
- package/cjs/graphic/index.js +13 -13
- package/cjs/graphic/index.js.map +1 -1
- package/cjs/graphic/richtext/utils.d.ts +1 -1
- package/cjs/graphic/richtext/utils.js +1 -1
- package/cjs/graphic/richtext/utils.js.map +1 -1
- package/cjs/graphic/symbol.d.ts +2 -1
- package/cjs/graphic/symbol.js +27 -4
- package/cjs/graphic/symbol.js.map +1 -1
- package/cjs/graphic/text.js +33 -23
- package/cjs/graphic/text.js.map +1 -1
- package/cjs/graphic/tools.d.ts +3 -2
- package/cjs/graphic/tools.js +58 -3
- package/cjs/graphic/tools.js.map +1 -1
- package/cjs/graphic/wrap-text.js +10 -8
- package/cjs/graphic/wrap-text.js.map +1 -1
- package/cjs/index.d.ts +3 -1
- package/cjs/index.js +3 -3
- package/cjs/index.js.map +1 -1
- package/cjs/interface/animate.d.ts +3 -1
- package/cjs/interface/animate.js.map +1 -1
- package/cjs/interface/core.d.ts +1 -0
- package/cjs/interface/core.js.map +1 -1
- package/cjs/interface/global.d.ts +25 -1
- package/cjs/interface/global.js.map +1 -1
- package/cjs/interface/graphic/image.d.ts +1 -0
- package/cjs/interface/graphic/image.js.map +1 -1
- package/cjs/interface/graphic/symbol.d.ts +3 -2
- package/cjs/interface/graphic/symbol.js.map +1 -1
- package/cjs/interface/graphic/text.d.ts +1 -0
- package/cjs/interface/graphic/text.js.map +1 -1
- package/cjs/interface/graphic.d.ts +27 -3
- package/cjs/interface/graphic.js.map +1 -1
- package/cjs/interface/picker.d.ts +9 -1
- package/cjs/interface/picker.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 +10 -3
- package/cjs/interface/stage.js.map +1 -1
- package/cjs/interface/window.d.ts +12 -0
- package/cjs/interface/window.js.map +1 -1
- package/cjs/jsx/graphicType.d.ts +172 -0
- package/cjs/jsx/graphicType.js +133 -0
- package/cjs/jsx/graphicType.js.map +1 -0
- package/cjs/jsx/index.d.ts +2 -0
- package/cjs/jsx/index.js +21 -0
- package/cjs/jsx/index.js.map +1 -0
- package/cjs/jsx/jsx-classic.d.ts +3 -0
- package/cjs/jsx/jsx-classic.js +58 -0
- package/cjs/jsx/jsx-classic.js.map +1 -0
- package/cjs/picker/canvas-picker-service.d.ts +2 -2
- package/cjs/picker/canvas-picker-service.js +20 -3
- package/cjs/picker/canvas-picker-service.js.map +1 -1
- package/cjs/picker/contributions/canvas-picker/glyph-picker.js +1 -1
- package/cjs/picker/contributions/canvas-picker/glyph-picker.js.map +1 -1
- package/cjs/picker/contributions/canvas-picker/group-picker.d.ts +7 -0
- package/cjs/picker/contributions/canvas-picker/group-picker.js +26 -0
- package/cjs/picker/contributions/canvas-picker/group-picker.js.map +1 -0
- package/cjs/picker/contributions/canvas-picker/module.js +3 -1
- package/cjs/picker/contributions/canvas-picker/module.js.map +1 -1
- package/cjs/picker/contributions/canvas-picker/symbol-picker.js +4 -2
- package/cjs/picker/contributions/canvas-picker/symbol-picker.js.map +1 -1
- package/cjs/picker/contributions/constants.d.ts +1 -0
- package/cjs/picker/contributions/constants.js +9 -8
- package/cjs/picker/contributions/constants.js.map +1 -1
- package/cjs/picker/contributions/math-picker/glyph-picker.js +1 -1
- package/cjs/picker/contributions/math-picker/glyph-picker.js.map +1 -1
- package/cjs/picker/global-picker-service.d.ts +1 -1
- package/cjs/picker/global-picker-service.js +12 -5
- package/cjs/picker/global-picker-service.js.map +1 -1
- package/cjs/picker/math-picker-service.d.ts +2 -2
- package/cjs/picker/math-picker-service.js +1 -1
- package/cjs/picker/math-picker-service.js.map +1 -1
- package/cjs/picker/pick-interceptor.d.ts +12 -0
- package/cjs/picker/pick-interceptor.js +32 -5
- package/cjs/picker/pick-interceptor.js.map +1 -1
- package/cjs/picker/pick-modules.js +2 -0
- package/cjs/picker/pick-modules.js.map +1 -1
- package/cjs/picker/picker-service.d.ts +1 -1
- package/cjs/picker/picker-service.js +15 -6
- package/cjs/picker/picker-service.js.map +1 -1
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.d.ts +2 -0
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +42 -21
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.d.ts +13 -0
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.js +79 -0
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -0
- package/cjs/plugins/plugin-modules.js +1 -1
- package/cjs/plugins/plugin-modules.js.map +1 -1
- package/cjs/render/contributions/render/contributions/image-contribution-render.js +23 -1
- package/cjs/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/draw-contribution.d.ts +3 -1
- package/cjs/render/contributions/render/draw-contribution.js +3 -1
- package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
- package/cjs/render/contributions/render/draw-interceptor.d.ts +2 -0
- package/cjs/render/contributions/render/draw-interceptor.js +8 -0
- package/cjs/render/contributions/render/draw-interceptor.js.map +1 -1
- package/cjs/render/contributions/render/image-render.js +7 -3
- package/cjs/render/contributions/render/image-render.js.map +1 -1
- package/cjs/render/contributions/render/symbol-render.js +12 -5
- package/cjs/render/contributions/render/symbol-render.js.map +1 -1
- package/cjs/render/contributions/render/utils.d.ts +2 -2
- package/cjs/render/contributions/render/utils.js.map +1 -1
- package/cjs/render/render-service.js +3 -1
- package/cjs/render/render-service.js.map +1 -1
- package/dist/index.js +3686 -428
- package/dist/index.min.js +1 -1
- package/es/animate/animate.d.ts +1 -0
- package/es/animate/animate.js +3 -0
- package/es/animate/animate.js.map +1 -1
- package/es/animate/timeline.d.ts +1 -1
- package/es/animate/timeline.js +2 -2
- package/es/animate/timeline.js.map +1 -1
- package/es/canvas/contributions/browser/context.d.ts +1 -0
- package/es/common/contribution-provider.d.ts +1 -0
- package/es/common/contribution-provider.js +4 -0
- package/es/common/contribution-provider.js.map +1 -1
- package/es/common/enums.d.ts +4 -2
- package/es/common/enums.js +3 -2
- package/es/common/enums.js.map +1 -1
- package/es/core/contributions/env/base-contribution.d.ts +11 -1
- package/es/core/contributions/env/base-contribution.js +23 -0
- package/es/core/contributions/env/base-contribution.js.map +1 -1
- package/es/core/contributions/env/browser-contribution.d.ts +11 -2
- package/es/core/contributions/env/browser-contribution.js +67 -1
- package/es/core/contributions/env/browser-contribution.js.map +1 -1
- package/es/core/contributions/textMeasure/layout.js +1 -1
- package/es/core/contributions/textMeasure/layout.js.map +1 -1
- package/es/core/contributions/window/base-contribution.d.ts +11 -5
- package/es/core/contributions/window/base-contribution.js +10 -0
- package/es/core/contributions/window/base-contribution.js.map +1 -1
- package/es/core/contributions/window/browser-contribution.d.ts +11 -0
- package/es/core/contributions/window/browser-contribution.js +33 -2
- package/es/core/contributions/window/browser-contribution.js.map +1 -1
- package/es/core/global.d.ts +11 -1
- package/es/core/global.js +18 -0
- package/es/core/global.js.map +1 -1
- package/es/core/graphic-utils.d.ts +2 -0
- package/es/core/graphic-utils.js +13 -0
- package/es/core/graphic-utils.js.map +1 -1
- package/es/core/layer.js +6 -6
- package/es/core/layer.js.map +1 -1
- package/es/core/stage.d.ts +13 -4
- package/es/core/stage.js +57 -24
- package/es/core/stage.js.map +1 -1
- package/es/core/window.d.ts +6 -0
- package/es/core/window.js +10 -1
- package/es/core/window.js.map +1 -1
- package/es/event/event-manager.js +8 -8
- package/es/event/event-manager.js.map +1 -1
- package/es/event/event-system.js.map +1 -1
- package/es/event/federated-event/pointer-event.d.ts +1 -0
- package/es/event/federated-event/pointer-event.js.map +1 -1
- package/es/graphic/builtin-symbol/arrow2-down.d.ts +12 -0
- package/es/graphic/builtin-symbol/arrow2-down.js +24 -0
- package/es/graphic/builtin-symbol/arrow2-down.js.map +1 -0
- package/es/graphic/builtin-symbol/arrow2-left.js +1 -1
- package/es/graphic/builtin-symbol/arrow2-left.js.map +1 -1
- package/es/graphic/builtin-symbol/arrow2-right.js +1 -1
- package/es/graphic/builtin-symbol/arrow2-right.js.map +1 -1
- package/es/graphic/builtin-symbol/arrow2-up.d.ts +12 -0
- package/es/graphic/builtin-symbol/arrow2-up.js +24 -0
- package/es/graphic/builtin-symbol/arrow2-up.js.map +1 -0
- package/es/graphic/builtin-symbol/close.d.ts +13 -0
- package/es/graphic/builtin-symbol/close.js +27 -0
- package/es/graphic/builtin-symbol/close.js.map +1 -0
- package/es/graphic/builtin-symbol/index.d.ts +1 -1
- package/es/graphic/builtin-symbol/index.js +11 -1
- package/es/graphic/builtin-symbol/index.js.map +1 -1
- package/es/graphic/builtin-symbol/line-h.d.ts +13 -0
- package/es/graphic/builtin-symbol/line-h.js +26 -0
- package/es/graphic/builtin-symbol/line-h.js.map +1 -0
- package/es/graphic/builtin-symbol/line-v.d.ts +13 -0
- package/es/graphic/builtin-symbol/line-v.js +26 -0
- package/es/graphic/builtin-symbol/line-v.js.map +1 -0
- package/es/graphic/builtin-symbol/utils.d.ts +13 -5
- package/es/graphic/builtin-symbol/utils.js +25 -7
- package/es/graphic/builtin-symbol/utils.js.map +1 -1
- package/es/graphic/config.js +8 -4
- package/es/graphic/config.js.map +1 -1
- package/es/graphic/constants.d.ts +22 -0
- package/es/graphic/constants.js +26 -0
- package/es/graphic/constants.js.map +1 -1
- package/es/graphic/graphic.d.ts +4 -1
- package/es/graphic/graphic.js +48 -21
- package/es/graphic/graphic.js.map +1 -1
- package/es/graphic/group.js +1 -1
- package/es/graphic/group.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/richtext/utils.d.ts +1 -1
- package/es/graphic/richtext/utils.js +1 -1
- package/es/graphic/richtext/utils.js.map +1 -1
- package/es/graphic/symbol.d.ts +2 -1
- package/es/graphic/symbol.js +28 -1
- package/es/graphic/symbol.js.map +1 -1
- package/es/graphic/text.js +33 -23
- package/es/graphic/text.js.map +1 -1
- package/es/graphic/tools.d.ts +3 -2
- package/es/graphic/tools.js +59 -0
- package/es/graphic/tools.js.map +1 -1
- package/es/graphic/wrap-text.js +10 -8
- package/es/graphic/wrap-text.js.map +1 -1
- package/es/index.d.ts +3 -1
- package/es/index.js +5 -1
- package/es/index.js.map +1 -1
- package/es/interface/animate.d.ts +3 -1
- package/es/interface/animate.js.map +1 -1
- package/es/interface/core.d.ts +1 -0
- package/es/interface/core.js.map +1 -1
- package/es/interface/global.d.ts +25 -1
- package/es/interface/global.js.map +1 -1
- package/es/interface/graphic/image.d.ts +1 -0
- package/es/interface/graphic/image.js.map +1 -1
- package/es/interface/graphic/symbol.d.ts +3 -2
- package/es/interface/graphic/symbol.js.map +1 -1
- package/es/interface/graphic/text.d.ts +1 -0
- package/es/interface/graphic/text.js.map +1 -1
- package/es/interface/graphic.d.ts +27 -3
- package/es/interface/graphic.js.map +1 -1
- package/es/interface/picker.d.ts +9 -1
- package/es/interface/picker.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 +10 -3
- package/es/interface/stage.js.map +1 -1
- package/es/interface/window.d.ts +12 -0
- package/es/interface/window.js.map +1 -1
- package/es/jsx/graphicType.d.ts +172 -0
- package/es/jsx/graphicType.js +126 -0
- package/es/jsx/graphicType.js.map +1 -0
- package/es/jsx/index.d.ts +2 -0
- package/es/jsx/index.js +4 -0
- package/es/jsx/index.js.map +1 -0
- package/es/jsx/jsx-classic.d.ts +3 -0
- package/es/jsx/jsx-classic.js +56 -0
- package/es/jsx/jsx-classic.js.map +1 -0
- package/es/picker/canvas-picker-service.d.ts +2 -2
- package/es/picker/canvas-picker-service.js +20 -3
- package/es/picker/canvas-picker-service.js.map +1 -1
- package/es/picker/contributions/canvas-picker/glyph-picker.js +1 -1
- package/es/picker/contributions/canvas-picker/glyph-picker.js.map +1 -1
- package/es/picker/contributions/canvas-picker/group-picker.d.ts +7 -0
- package/es/picker/contributions/canvas-picker/group-picker.js +23 -0
- package/es/picker/contributions/canvas-picker/group-picker.js.map +1 -0
- package/es/picker/contributions/canvas-picker/module.js +6 -2
- package/es/picker/contributions/canvas-picker/module.js.map +1 -1
- package/es/picker/contributions/canvas-picker/symbol-picker.js +6 -1
- package/es/picker/contributions/canvas-picker/symbol-picker.js.map +1 -1
- package/es/picker/contributions/constants.d.ts +1 -0
- package/es/picker/contributions/constants.js +2 -0
- package/es/picker/contributions/constants.js.map +1 -1
- package/es/picker/contributions/math-picker/glyph-picker.js +1 -1
- package/es/picker/contributions/math-picker/glyph-picker.js.map +1 -1
- package/es/picker/global-picker-service.d.ts +1 -1
- package/es/picker/global-picker-service.js +12 -5
- package/es/picker/global-picker-service.js.map +1 -1
- package/es/picker/math-picker-service.d.ts +2 -2
- package/es/picker/math-picker-service.js +1 -1
- package/es/picker/math-picker-service.js.map +1 -1
- package/es/picker/pick-interceptor.d.ts +12 -0
- package/es/picker/pick-interceptor.js +34 -4
- package/es/picker/pick-interceptor.js.map +1 -1
- package/es/picker/pick-modules.js +4 -2
- package/es/picker/pick-modules.js.map +1 -1
- package/es/picker/picker-service.d.ts +1 -1
- package/es/picker/picker-service.js +15 -6
- package/es/picker/picker-service.js.map +1 -1
- package/es/plugins/builtin-plugin/flex-layout-plugin.d.ts +2 -0
- package/es/plugins/builtin-plugin/flex-layout-plugin.js +47 -20
- package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/html-attribute-plugin.d.ts +13 -0
- package/es/plugins/builtin-plugin/html-attribute-plugin.js +75 -0
- package/es/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -0
- package/es/plugins/plugin-modules.js +2 -2
- package/es/plugins/plugin-modules.js.map +1 -1
- package/es/render/contributions/render/contributions/image-contribution-render.js +27 -0
- package/es/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
- package/es/render/contributions/render/draw-contribution.d.ts +3 -1
- package/es/render/contributions/render/draw-contribution.js +4 -0
- package/es/render/contributions/render/draw-contribution.js.map +1 -1
- package/es/render/contributions/render/draw-interceptor.d.ts +2 -0
- package/es/render/contributions/render/draw-interceptor.js +8 -0
- package/es/render/contributions/render/draw-interceptor.js.map +1 -1
- package/es/render/contributions/render/image-render.js +10 -2
- package/es/render/contributions/render/image-render.js.map +1 -1
- package/es/render/contributions/render/symbol-render.js +12 -5
- package/es/render/contributions/render/symbol-render.js.map +1 -1
- package/es/render/contributions/render/utils.d.ts +2 -2
- package/es/render/contributions/render/utils.js.map +1 -1
- package/es/render/render-service.js +3 -1
- package/es/render/render-service.js.map +1 -1
- package/package.json +11 -14
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { IContext2d, ICustomPath2D, ISymbolClass } from '../../interface';
|
|
1
|
+
import { type IBounds } from '@visactor/vutils';
|
|
2
|
+
import type { IContext2d, ICustomPath2D, IGraphicAttribute, ISymbolClass } from '../../interface';
|
|
3
3
|
export declare class CustomSymbolClass implements ISymbolClass {
|
|
4
4
|
type: string;
|
|
5
5
|
path: ICustomPath2D;
|
|
6
6
|
pathStr: string;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
isSvg: boolean;
|
|
8
|
+
svgCache?: {
|
|
9
|
+
path: ICustomPath2D;
|
|
10
|
+
attribute: Partial<IGraphicAttribute>;
|
|
11
|
+
}[];
|
|
12
|
+
constructor(type: string, path: ICustomPath2D | {
|
|
13
|
+
path: ICustomPath2D;
|
|
14
|
+
attribute: Partial<IGraphicAttribute>;
|
|
15
|
+
}[], isSvg?: boolean);
|
|
16
|
+
drawOffset(ctx: IContext2d, size: number, x: number, y: number, offset: number, z?: number, cb?: (path: ICustomPath2D, attribute?: Record<string, any>) => void): boolean;
|
|
17
|
+
draw(ctx: IContext2d, size: number, x: number, y: number, z?: number, cb?: (path: ICustomPath2D, attribute?: Record<string, any>) => void): boolean;
|
|
10
18
|
bounds(size: number, bounds: IBounds): void;
|
|
11
19
|
}
|
|
@@ -4,21 +4,35 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.CustomSymbolClass = void 0;
|
|
6
6
|
|
|
7
|
-
const render_command_list_1 = require("../../common/render-command-list");
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), render_command_list_1 = require("../../common/render-command-list"), tempBounds = new vutils_1.AABBBounds;
|
|
8
8
|
|
|
9
9
|
class CustomSymbolClass {
|
|
10
|
-
constructor(type, path) {
|
|
11
|
-
this.pathStr = "", this.type = type, this.path = path
|
|
10
|
+
constructor(type, path, isSvg = !1) {
|
|
11
|
+
this.pathStr = "", this.type = type, (0, vutils_1.isArray)(path) ? this.svgCache = path : this.path = path,
|
|
12
|
+
this.isSvg = isSvg;
|
|
12
13
|
}
|
|
13
|
-
drawOffset(ctx, size, x, y, offset) {
|
|
14
|
-
return
|
|
15
|
-
|
|
14
|
+
drawOffset(ctx, size, x, y, offset, z, cb) {
|
|
15
|
+
return this.isSvg ? !!this.svgCache && (this.svgCache.forEach((item => {
|
|
16
|
+
ctx.beginPath(), (0, render_command_list_1.renderCommandList)(item.path.commandList, ctx, x, y, size, size),
|
|
17
|
+
cb && cb(item.path, item.attribute);
|
|
18
|
+
})), !1) : ((0, render_command_list_1.renderCommandList)(this.path.commandList, ctx, x, y, size + offset, size + offset),
|
|
19
|
+
!1);
|
|
16
20
|
}
|
|
17
|
-
draw(ctx, size, x, y) {
|
|
18
|
-
return
|
|
19
|
-
|
|
21
|
+
draw(ctx, size, x, y, z, cb) {
|
|
22
|
+
return this.isSvg ? !!this.svgCache && (this.svgCache.forEach((item => {
|
|
23
|
+
ctx.beginPath(), (0, render_command_list_1.renderCommandList)(item.path.commandList, ctx, x, y, size, size),
|
|
24
|
+
cb && cb(item.path, item.attribute);
|
|
25
|
+
})), !1) : ((0, render_command_list_1.renderCommandList)(this.path.commandList, ctx, x, y, size, size),
|
|
26
|
+
!1);
|
|
20
27
|
}
|
|
21
28
|
bounds(size, bounds) {
|
|
29
|
+
if (this.isSvg) {
|
|
30
|
+
if (!this.svgCache) return;
|
|
31
|
+
return bounds.clear(), void this.svgCache.forEach((({path: path}) => {
|
|
32
|
+
tempBounds.x1 = path.bounds.x1 * size, tempBounds.y1 = path.bounds.y1 * size, tempBounds.x2 = path.bounds.x2 * size,
|
|
33
|
+
tempBounds.y2 = path.bounds.y2 * size, bounds.union(tempBounds);
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
22
36
|
this.path.bounds && (bounds.x1 = this.path.bounds.x1 * size, bounds.y1 = this.path.bounds.y1 * size,
|
|
23
37
|
bounds.x2 = this.path.bounds.x2 * size, bounds.y2 = this.path.bounds.y2 * size);
|
|
24
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graphic/builtin-symbol/utils.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../src/graphic/builtin-symbol/utils.ts"],"names":[],"mappings":";;;AAAA,6CAAqE;AACrE,0EAAqE;AAGrE,MAAM,UAAU,GAAG,IAAI,mBAAU,EAAE,CAAC;AACpC,MAAa,iBAAiB;IAO5B,YACE,IAAY,EACZ,IAAsF,EACtF,QAAiB,KAAK;QAPxB,YAAO,GAAW,EAAE,CAAC;QASnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,IAAA,gBAAO,EAAC,IAAI,CAAC,EAAE;YACjB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;SACtB;aAAM;YACL,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;SAClB;QACD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,UAAU,CACR,GA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GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC;IACzC,CAAC;CACF;AA3FD,8CA2FC","file":"utils.js","sourcesContent":["import { isArray, type IBounds, AABBBounds } from '@visactor/vutils';\nimport { renderCommandList } from '../../common/render-command-list';\nimport type { IContext2d, ICustomPath2D, IGraphicAttribute, ISymbolClass } from '../../interface';\n\nconst tempBounds = new AABBBounds();\nexport class CustomSymbolClass implements ISymbolClass {\n type: string;\n path: ICustomPath2D;\n pathStr: string = '';\n isSvg: boolean;\n svgCache?: { path: ICustomPath2D; attribute: Partial<IGraphicAttribute> }[];\n\n constructor(\n type: string,\n path: ICustomPath2D | { path: ICustomPath2D; attribute: Partial<IGraphicAttribute> }[],\n isSvg: boolean = false\n ) {\n this.type = type;\n if (isArray(path)) {\n this.svgCache = path;\n } else {\n this.path = path;\n }\n this.isSvg = isSvg;\n }\n\n drawOffset(\n ctx: IContext2d,\n size: number,\n x: number,\n y: number,\n offset: number,\n z?: number,\n cb?: (path: ICustomPath2D, attribute?: Record<string, any>) => void\n ) {\n if (this.isSvg) {\n if (!this.svgCache) {\n return false;\n }\n this.svgCache.forEach(item => {\n ctx.beginPath();\n renderCommandList(item.path.commandList, ctx, x, y, size, size);\n cb && cb(item.path, item.attribute);\n });\n return false;\n }\n renderCommandList(this.path.commandList, ctx, x, y, size + offset, size + offset);\n return false;\n }\n\n draw(\n ctx: IContext2d,\n size: number,\n x: number,\n y: number,\n z?: number,\n cb?: (path: ICustomPath2D, attribute?: Record<string, any>) => void\n ) {\n if (this.isSvg) {\n if (!this.svgCache) {\n return false;\n }\n this.svgCache.forEach(item => {\n ctx.beginPath();\n renderCommandList(item.path.commandList, ctx, x, y, size, size);\n cb && cb(item.path, item.attribute);\n });\n return false;\n }\n renderCommandList(this.path.commandList, ctx, x, y, size, size);\n return false;\n }\n\n bounds(size: number, bounds: IBounds) {\n if (this.isSvg) {\n if (!this.svgCache) {\n return;\n }\n bounds.clear();\n this.svgCache.forEach(({ path }) => {\n tempBounds.x1 = path.bounds.x1 * size;\n tempBounds.y1 = path.bounds.y1 * size;\n tempBounds.x2 = path.bounds.x2 * size;\n tempBounds.y2 = path.bounds.y2 * size;\n bounds.union(tempBounds);\n });\n return;\n }\n if (!this.path.bounds) {\n return;\n }\n bounds.x1 = this.path.bounds.x1 * size;\n bounds.y1 = this.path.bounds.y1 * size;\n bounds.x2 = this.path.bounds.x2 * size;\n bounds.y2 = this.path.bounds.y2 * size;\n }\n}\n\n// export function CustomSymbol(): ISymbolClass {\n\n// }\n"]}
|
package/cjs/graphic/config.js
CHANGED
|
@@ -81,7 +81,8 @@ exports.DefaultStrokeStyle = Object.assign({
|
|
|
81
81
|
lineThrough: 0,
|
|
82
82
|
scaleIn3d: !1,
|
|
83
83
|
direction: "horizontal",
|
|
84
|
-
wordBreak: "break-all"
|
|
84
|
+
wordBreak: "break-all",
|
|
85
|
+
ignoreBuf: !1
|
|
85
86
|
}, exports.DefaultStyle = Object.assign(Object.assign(Object.assign({
|
|
86
87
|
opacity: 1,
|
|
87
88
|
background: null,
|
|
@@ -91,7 +92,8 @@ exports.DefaultStrokeStyle = Object.assign({
|
|
|
91
92
|
texturePadding: 2,
|
|
92
93
|
backgroundMode: 0,
|
|
93
94
|
blur: 0,
|
|
94
|
-
cursor: null
|
|
95
|
+
cursor: null,
|
|
96
|
+
html: null
|
|
95
97
|
}, exports.DefaultFillStyle), exports.DefaultStrokeStyle), exports.DefaultLayout),
|
|
96
98
|
exports.DefaultConnectAttribute = {
|
|
97
99
|
connectedType: "none",
|
|
@@ -109,7 +111,8 @@ exports.DefaultConnectAttribute = {
|
|
|
109
111
|
pickMode: "accurate",
|
|
110
112
|
customPickShape: null,
|
|
111
113
|
boundsMode: "accurate",
|
|
112
|
-
keepDirIn3d: !0
|
|
114
|
+
keepDirIn3d: !0,
|
|
115
|
+
shadowRootIdx: 1
|
|
113
116
|
}, exports.DefaultStyle), exports.DefaultTransform), exports.addAttributeToPrototype = addAttributeToPrototype,
|
|
114
117
|
exports.rewriteProto = rewriteProto, exports.DefaultArcAttribute = Object.assign(Object.assign({}, exports.DefaultAttribute), {
|
|
115
118
|
startAngle: 0,
|
|
@@ -201,7 +204,8 @@ exports.rewriteProto = rewriteProto, exports.DefaultArcAttribute = Object.assign
|
|
|
201
204
|
width: 0,
|
|
202
205
|
height: 0
|
|
203
206
|
}, exports.DefaultAttribute), {
|
|
204
|
-
fill: !0
|
|
207
|
+
fill: !0,
|
|
208
|
+
cornerRadius: 0
|
|
205
209
|
}), exports.DefaultRichTextIconAttribute = Object.assign(Object.assign({}, exports.DefaultImageAttribute), {
|
|
206
210
|
backgroundShowMode: "never",
|
|
207
211
|
backgroundWidth: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graphic/config.ts"],"names":[],"mappings":";;;AACA,6CAA+C;AAC/C,2DAAuD;AA+B1C,QAAA,aAAa,GAAY;IACpC,SAAS,EAAE,MAAM;CAClB,CAAC;AAEW,QAAA,gBAAgB,GAAe;IAC1C,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACnB,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACd,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAChB,UAAU,EAAE,IAAI,eAAM,EAAE;CACzB,CAAC;AAEW,QAAA,gBAAgB,GAAe;IAC1C,WAAW,EAAE,CAAC;IACd,IAAI,EAAE,KA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AAE,CAAC,EACnB,OAAO,EAAE,CAAC,IACV","file":"config.js","sourcesContent":["// 存放公共属性\nimport { Matrix, pi2 } from '@visactor/vutils';\nimport { CustomPath2D } from '../common/custom-path2d';\nimport type {\n IArcGraphicAttribute,\n IAreaGraphicAttribute,\n IGraphicAttribute,\n ICircleGraphicAttribute,\n IFillStyle,\n IGlyphGraphicAttribute,\n IGroupGraphicAttribute,\n IImageGraphicAttribute,\n ILineGraphicAttribute,\n IPathGraphicAttribute,\n IPolygonGraphicAttribute,\n IRect3dGraphicAttribute,\n IRectGraphicAttribute,\n IStrokeStyle,\n IGraphicStyle,\n ISymbolGraphicAttribute,\n ITextAttribute,\n ITextGraphicAttribute,\n IRichTextGraphicAttribute,\n ITransform,\n RichTextWordBreak,\n RichTextVerticalDirection,\n RichTextGlobalAlignType,\n RichTextGlobalBaselineType,\n IRichTextIconGraphicAttribute,\n IConnectedStyle,\n ILayout\n} from '../interface';\n\nexport const DefaultLayout: ILayout = {\n alignSelf: 'auto'\n};\n\nexport const DefaultTransform: ITransform = {\n x: 0,\n y: 0,\n z: 0,\n dx: 0,\n dy: 0,\n dz: 0,\n scrollX: 0,\n scrollY: 0,\n scaleX: 1,\n scaleY: 1,\n scaleZ: 1,\n angle: 0,\n alpha: 0,\n beta: 0,\n scaleCenter: [0, 0],\n anchor: [0, 0],\n anchor3d: [0, 0],\n postMatrix: new Matrix()\n};\n\nexport const DefaultFillStyle: IFillStyle = {\n fillOpacity: 1,\n fill: false,\n shadowBlur: 0,\n shadowColor: 'black',\n shadowOffsetX: 0,\n shadowOffsetY: 0\n};\n\nconst commonStroke: Omit<IStrokeStyle, 'outerBorder' | 'innerBorder'> = {\n strokeOpacity: 1,\n lineDash: [],\n lineDashOffset: 0,\n lineWidth: 1,\n lineCap: 'butt',\n lineJoin: 'miter',\n miterLimit: 10,\n strokeBoundsBuffer: 2,\n stroke: false\n};\n\nexport const DefaultStrokeStyle: IStrokeStyle = {\n outerBorder: { ...commonStroke, distance: 0 },\n innerBorder: { ...commonStroke, distance: 0 },\n ...commonStroke\n};\n\nexport const DefaultTextStyle: Required<ITextAttribute> = {\n text: '',\n maxLineWidth: Infinity,\n textAlign: 'left',\n textBaseline: 'alphabetic',\n fontSize: 16,\n // @ts-ignore\n fontFamily: `PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,\n Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol`,\n fontWeight: '',\n ellipsis: '…',\n fontVariant: '',\n fontStyle: '',\n lineHeight: undefined,\n underline: 0,\n lineThrough: 0,\n scaleIn3d: false,\n direction: 'horizontal',\n wordBreak: 'break-all'\n};\n\nexport const DefaultStyle: IGraphicStyle = {\n opacity: 1,\n background: null,\n texture: null,\n textureColor: 'black',\n textureSize: 10,\n texturePadding: 2,\n backgroundMode: 0,\n blur: 0,\n cursor: null,\n ...DefaultFillStyle,\n ...DefaultStrokeStyle,\n ...DefaultLayout\n};\n\nexport const DefaultConnectAttribute: Required<IConnectedStyle> = {\n connectedType: 'none',\n // connectedStyle: {\n // stroke: DefaultStrokeStyle.stroke,\n // strokeOpacity: DefaultStrokeStyle.strokeOpacity,\n // lineDash: DefaultStrokeStyle.lineDash,\n // lineDashOffset: DefaultStrokeStyle.lineDashOffset,\n // lineCap: DefaultStrokeStyle.lineCap,\n // lineJoin: DefaultStrokeStyle.lineJoin,\n // lineWidth: DefaultStrokeStyle.lineWidth,\n // fill: DefaultFillStyle.fill,\n // fillOpacity: DefaultFillStyle.fillOpacity\n // },\n connectedStyle: {}, // 默认全都继承父属性\n connectedX: NaN,\n connectedY: NaN\n} as IConnectedStyle;\n\nexport const DefaultAttribute: Required<IGraphicAttribute> = {\n strokeSeg: null,\n pickable: true,\n childrenPickable: true,\n visible: true,\n zIndex: 0,\n layout: null,\n boundsPadding: 0,\n pickMode: 'accurate',\n customPickShape: null,\n boundsMode: 'accurate',\n keepDirIn3d: true,\n ...DefaultStyle,\n ...DefaultTransform\n};\n\nexport function addAttributeToPrototype(obj: Record<string, any>, c: any, keys: string[]) {\n keys.forEach(key => {\n c.prototype[key] = obj[key];\n });\n}\nexport function rewriteProto(obj: Record<string, any>, c: Record<string, any>) {\n Object.setPrototypeOf(obj, c);\n}\n\nexport const DefaultArcAttribute: Required<IArcGraphicAttribute> = {\n ...DefaultAttribute,\n startAngle: 0,\n endAngle: pi2,\n innerRadius: 0,\n outerRadius: 1,\n cornerRadius: 0,\n padRadius: 0,\n padAngle: 0,\n cap: false,\n forceShowCap: false\n};\n\nexport const DefaultAreaAttribute: Required<IAreaGraphicAttribute> = {\n ...DefaultAttribute,\n ...DefaultConnectAttribute,\n points: [],\n segments: [],\n curveType: 'linear',\n clipRange: 1\n};\n\nexport const DefaultCircleAttribute: Required<ICircleGraphicAttribute> = {\n ...DefaultAttribute,\n radius: 1,\n startAngle: 0,\n endAngle: pi2\n};\n\nexport const DefaultGroupAttribute: Required<IGroupGraphicAttribute> = {\n ...DefaultAttribute,\n width: 0,\n height: 0,\n cornerRadius: 0,\n path: [],\n clip: false,\n visibleAll: true,\n display: 'relative',\n flexDirection: 'row',\n flexWrap: 'wrap',\n justifyContent: 'flex-start',\n alignItems: 'flex-start',\n alignContent: 'flex-start'\n};\n\nexport const DefaultGlyphAttribute: Required<IGlyphGraphicAttribute> = {\n ...DefaultAttribute,\n path: '',\n width: 0,\n height: 0,\n cornerRadius: 0,\n clip: false\n};\n\nexport const DefaultLineAttribute: Required<ILineGraphicAttribute> = {\n ...DefaultAttribute,\n ...DefaultConnectAttribute,\n points: [],\n segments: [],\n curveType: 'linear',\n clipRange: 1,\n clipRangeByDimension: 'default',\n closePath: false\n};\n\nexport const DefaultPathAttribute: Required<IPathGraphicAttribute> = {\n ...DefaultAttribute,\n path: new CustomPath2D(),\n customPath: () => {\n console.warn('空函数');\n }\n};\n\nexport const DefaultPolygonAttribute: Required<IPolygonGraphicAttribute> = {\n ...DefaultAttribute,\n points: [],\n cornerRadius: 0\n};\n\nexport const DefaultRectAttribute: Required<IRectGraphicAttribute> = {\n ...DefaultAttribute,\n width: 0,\n height: 0,\n strokeBoundsBuffer: 0,\n cornerRadius: 0\n};\n\nexport const DefaultRect3dAttribute: Required<IRect3dGraphicAttribute> = {\n ...DefaultAttribute,\n width: 0,\n height: 0,\n cornerRadius: 0,\n length: 0\n};\n\nexport const DefaultSymbolAttribute: Required<ISymbolGraphicAttribute> = {\n ...DefaultAttribute,\n symbolType: 'circle',\n size: 10, // 外接**正方形**的边长\n keepDirIn3d: true\n};\n\nexport const DefaultTextAttribute: Required<ITextGraphicAttribute> = {\n ...DefaultAttribute,\n ...DefaultTextStyle,\n strokeBoundsBuffer: 0,\n keepDirIn3d: true\n};\n\nexport const DefaultRichTextAttribute: Required<IRichTextGraphicAttribute> = {\n ...DefaultAttribute,\n width: 300,\n height: 300,\n ellipsis: true,\n wordBreak: 'break-word' as RichTextWordBreak,\n verticalDirection: 'top' as RichTextVerticalDirection,\n textAlign: 'left' as RichTextGlobalAlignType,\n textBaseline: 'top' as RichTextGlobalBaselineType,\n layoutDirection: 'horizontal',\n textConfig: [],\n maxHeight: undefined,\n maxWidth: undefined,\n singleLine: false\n};\n\nexport const DefaultImageAttribute: Required<IImageGraphicAttribute> = {\n repeatX: 'no-repeat',\n repeatY: 'no-repeat',\n image: '',\n width: 0,\n height: 0,\n ...DefaultAttribute,\n fill: true\n};\n\nexport const DefaultRichTextIconAttribute: Required<IRichTextIconGraphicAttribute> = {\n ...DefaultImageAttribute,\n backgroundShowMode: 'never',\n backgroundWidth: 0,\n backgroundHeight: 0,\n textAlign: 'left',\n textBaseline: 'middle',\n direction: 'horizontal',\n margin: 0,\n id: '',\n\n width: 20,\n height: 20,\n backgroundFill: 'rgba(101, 117, 168, 0.1)',\n backgroundFillOpacity: 1,\n backgroundStroke: false,\n backgroundStrokeOpacity: 1,\n backgroundRadius: 4,\n opacity: 1\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/graphic/config.ts"],"names":[],"mappings":";;;AACA,6CAA+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C,EACrD,SAAS,EAAE,MAAiC,EAC5C,YAAY,EAAE,KAAmC,EACjD,eAAe,EAAE,YAAY,EAC7B,UAAU,EAAE,EAAE,EACd,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,SAAS,EACnB,UAAU,EAAE,KAAK,IACjB;AAEW,QAAA,qBAAqB,iCAChC,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,WAAW,EACpB,KAAK,EAAE,EAAE,EACT,KAAK,EAAE,CAAC,EACR,MAAM,EAAE,CAAC,IACN,wBAAgB,KACnB,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,CAAC,IACf;AAEW,QAAA,4BAA4B,mCACpC,6BAAqB,KACxB,kBAAkB,EAAE,OAAO,EAC3B,eAAe,EAAE,CAAC,EAClB,gBAAgB,EAAE,CAAC,EACnB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,QAAQ,EACtB,SAAS,EAAE,YAAY,EACvB,MAAM,EAAE,CAAC,EACT,EAAE,EAAE,EAAE,EAEN,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE,EACV,cAAc,EAAE,0BAA0B,EAC1C,qBAAqB,EAAE,CAAC,EACxB,gBAAgB,EAAE,KAAK,EACvB,uBAAuB,EAAE,CAAC,EAC1B,gBAAgB,EAAE,CAAC,EACnB,OAAO,EAAE,CAAC,IACV","file":"config.js","sourcesContent":["// 存放公共属性\nimport { Matrix, pi2 } from '@visactor/vutils';\nimport { CustomPath2D } from '../common/custom-path2d';\nimport type {\n IArcGraphicAttribute,\n IAreaGraphicAttribute,\n IGraphicAttribute,\n ICircleGraphicAttribute,\n IFillStyle,\n IGlyphGraphicAttribute,\n IGroupGraphicAttribute,\n IImageGraphicAttribute,\n ILineGraphicAttribute,\n IPathGraphicAttribute,\n IPolygonGraphicAttribute,\n IRect3dGraphicAttribute,\n IRectGraphicAttribute,\n IStrokeStyle,\n IGraphicStyle,\n ISymbolGraphicAttribute,\n ITextAttribute,\n ITextGraphicAttribute,\n IRichTextGraphicAttribute,\n ITransform,\n RichTextWordBreak,\n RichTextVerticalDirection,\n RichTextGlobalAlignType,\n RichTextGlobalBaselineType,\n IRichTextIconGraphicAttribute,\n IConnectedStyle,\n ILayout\n} from '../interface';\n\nexport const DefaultLayout: ILayout = {\n alignSelf: 'auto'\n};\n\nexport const DefaultTransform: ITransform = {\n x: 0,\n y: 0,\n z: 0,\n dx: 0,\n dy: 0,\n dz: 0,\n scrollX: 0,\n scrollY: 0,\n scaleX: 1,\n scaleY: 1,\n scaleZ: 1,\n angle: 0,\n alpha: 0,\n beta: 0,\n scaleCenter: [0, 0],\n anchor: [0, 0],\n anchor3d: [0, 0],\n postMatrix: new Matrix()\n};\n\nexport const DefaultFillStyle: IFillStyle = {\n fillOpacity: 1,\n fill: false,\n shadowBlur: 0,\n shadowColor: 'black',\n shadowOffsetX: 0,\n shadowOffsetY: 0\n};\n\nconst commonStroke: Omit<IStrokeStyle, 'outerBorder' | 'innerBorder'> = {\n strokeOpacity: 1,\n lineDash: [],\n lineDashOffset: 0,\n lineWidth: 1,\n lineCap: 'butt',\n lineJoin: 'miter',\n miterLimit: 10,\n strokeBoundsBuffer: 2,\n stroke: false\n};\n\nexport const DefaultStrokeStyle: IStrokeStyle = {\n outerBorder: { ...commonStroke, distance: 0 },\n innerBorder: { ...commonStroke, distance: 0 },\n ...commonStroke\n};\n\nexport const DefaultTextStyle: Required<ITextAttribute> = {\n text: '',\n maxLineWidth: Infinity,\n textAlign: 'left',\n textBaseline: 'alphabetic',\n fontSize: 16,\n // @ts-ignore\n fontFamily: `PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,\n Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol`,\n fontWeight: '',\n ellipsis: '…',\n fontVariant: '',\n fontStyle: '',\n lineHeight: undefined,\n underline: 0,\n lineThrough: 0,\n scaleIn3d: false,\n direction: 'horizontal',\n wordBreak: 'break-all',\n ignoreBuf: false\n};\n\nexport const DefaultStyle: IGraphicStyle = {\n opacity: 1,\n background: null,\n texture: null,\n textureColor: 'black',\n textureSize: 10,\n texturePadding: 2,\n backgroundMode: 0,\n blur: 0,\n cursor: null,\n html: null,\n ...DefaultFillStyle,\n ...DefaultStrokeStyle,\n ...DefaultLayout\n};\n\nexport const DefaultConnectAttribute: Required<IConnectedStyle> = {\n connectedType: 'none',\n // connectedStyle: {\n // stroke: DefaultStrokeStyle.stroke,\n // strokeOpacity: DefaultStrokeStyle.strokeOpacity,\n // lineDash: DefaultStrokeStyle.lineDash,\n // lineDashOffset: DefaultStrokeStyle.lineDashOffset,\n // lineCap: DefaultStrokeStyle.lineCap,\n // lineJoin: DefaultStrokeStyle.lineJoin,\n // lineWidth: DefaultStrokeStyle.lineWidth,\n // fill: DefaultFillStyle.fill,\n // fillOpacity: DefaultFillStyle.fillOpacity\n // },\n connectedStyle: {}, // 默认全都继承父属性\n connectedX: NaN,\n connectedY: NaN\n} as IConnectedStyle;\n\nexport const DefaultAttribute: Required<IGraphicAttribute> = {\n strokeSeg: null,\n pickable: true,\n childrenPickable: true,\n visible: true,\n zIndex: 0,\n layout: null,\n boundsPadding: 0,\n pickMode: 'accurate',\n customPickShape: null,\n boundsMode: 'accurate',\n keepDirIn3d: true,\n shadowRootIdx: 1,\n ...DefaultStyle,\n ...DefaultTransform\n};\n\nexport function addAttributeToPrototype(obj: Record<string, any>, c: any, keys: string[]) {\n keys.forEach(key => {\n c.prototype[key] = obj[key];\n });\n}\nexport function rewriteProto(obj: Record<string, any>, c: Record<string, any>) {\n Object.setPrototypeOf(obj, c);\n}\n\nexport const DefaultArcAttribute: Required<IArcGraphicAttribute> = {\n ...DefaultAttribute,\n startAngle: 0,\n endAngle: pi2,\n innerRadius: 0,\n outerRadius: 1,\n cornerRadius: 0,\n padRadius: 0,\n padAngle: 0,\n cap: false,\n forceShowCap: false\n};\n\nexport const DefaultAreaAttribute: Required<IAreaGraphicAttribute> = {\n ...DefaultAttribute,\n ...DefaultConnectAttribute,\n points: [],\n segments: [],\n curveType: 'linear',\n clipRange: 1\n};\n\nexport const DefaultCircleAttribute: Required<ICircleGraphicAttribute> = {\n ...DefaultAttribute,\n radius: 1,\n startAngle: 0,\n endAngle: pi2\n};\n\nexport const DefaultGroupAttribute: Required<IGroupGraphicAttribute> = {\n ...DefaultAttribute,\n width: 0,\n height: 0,\n cornerRadius: 0,\n path: [],\n clip: false,\n visibleAll: true,\n display: 'relative',\n flexDirection: 'row',\n flexWrap: 'wrap',\n justifyContent: 'flex-start',\n alignItems: 'flex-start',\n alignContent: 'flex-start'\n};\n\nexport const DefaultGlyphAttribute: Required<IGlyphGraphicAttribute> = {\n ...DefaultAttribute,\n path: '',\n width: 0,\n height: 0,\n cornerRadius: 0,\n clip: false\n};\n\nexport const DefaultLineAttribute: Required<ILineGraphicAttribute> = {\n ...DefaultAttribute,\n ...DefaultConnectAttribute,\n points: [],\n segments: [],\n curveType: 'linear',\n clipRange: 1,\n clipRangeByDimension: 'default',\n closePath: false\n};\n\nexport const DefaultPathAttribute: Required<IPathGraphicAttribute> = {\n ...DefaultAttribute,\n path: new CustomPath2D(),\n customPath: () => {\n console.warn('空函数');\n }\n};\n\nexport const DefaultPolygonAttribute: Required<IPolygonGraphicAttribute> = {\n ...DefaultAttribute,\n points: [],\n cornerRadius: 0\n};\n\nexport const DefaultRectAttribute: Required<IRectGraphicAttribute> = {\n ...DefaultAttribute,\n width: 0,\n height: 0,\n strokeBoundsBuffer: 0,\n cornerRadius: 0\n};\n\nexport const DefaultRect3dAttribute: Required<IRect3dGraphicAttribute> = {\n ...DefaultAttribute,\n width: 0,\n height: 0,\n cornerRadius: 0,\n length: 0\n};\n\nexport const DefaultSymbolAttribute: Required<ISymbolGraphicAttribute> = {\n ...DefaultAttribute,\n symbolType: 'circle',\n size: 10, // 外接**正方形**的边长\n keepDirIn3d: true\n};\n\nexport const DefaultTextAttribute: Required<ITextGraphicAttribute> = {\n ...DefaultAttribute,\n ...DefaultTextStyle,\n strokeBoundsBuffer: 0,\n keepDirIn3d: true\n};\n\nexport const DefaultRichTextAttribute: Required<IRichTextGraphicAttribute> = {\n ...DefaultAttribute,\n width: 300,\n height: 300,\n ellipsis: true,\n wordBreak: 'break-word' as RichTextWordBreak,\n verticalDirection: 'top' as RichTextVerticalDirection,\n textAlign: 'left' as RichTextGlobalAlignType,\n textBaseline: 'top' as RichTextGlobalBaselineType,\n layoutDirection: 'horizontal',\n textConfig: [],\n maxHeight: undefined,\n maxWidth: undefined,\n singleLine: false\n};\n\nexport const DefaultImageAttribute: Required<IImageGraphicAttribute> = {\n repeatX: 'no-repeat',\n repeatY: 'no-repeat',\n image: '',\n width: 0,\n height: 0,\n ...DefaultAttribute,\n fill: true,\n cornerRadius: 0\n};\n\nexport const DefaultRichTextIconAttribute: Required<IRichTextIconGraphicAttribute> = {\n ...DefaultImageAttribute,\n backgroundShowMode: 'never',\n backgroundWidth: 0,\n backgroundHeight: 0,\n textAlign: 'left',\n textBaseline: 'middle',\n direction: 'horizontal',\n margin: 0,\n id: '',\n\n width: 20,\n height: 20,\n backgroundFill: 'rgba(101, 117, 168, 0.1)',\n backgroundFillOpacity: 1,\n backgroundStroke: false,\n backgroundStrokeOpacity: 1,\n backgroundRadius: 4,\n opacity: 1\n};\n"]}
|
|
@@ -16,3 +16,25 @@ export declare const SYMBOL_NUMBER_TYPE: number;
|
|
|
16
16
|
export declare const TEXT_NUMBER_TYPE: number;
|
|
17
17
|
export declare const GraphicService: unique symbol;
|
|
18
18
|
export declare const GraphicCreator: unique symbol;
|
|
19
|
+
export declare const SVG_ATTRIBUTE_MAP: {
|
|
20
|
+
'stroke-linecap': string;
|
|
21
|
+
'stroke-linejoin': string;
|
|
22
|
+
'stroke-dasharray': string;
|
|
23
|
+
'stroke-dashoffset': string;
|
|
24
|
+
'stroke-width': string;
|
|
25
|
+
'fill-opacity': string;
|
|
26
|
+
'stroke-opacity': string;
|
|
27
|
+
};
|
|
28
|
+
export declare const SVG_ATTRIBUTE_MAP_KEYS: string[];
|
|
29
|
+
export declare const SVG_PARSE_ATTRIBUTE_MAP: {
|
|
30
|
+
'@_stroke-linecap': string;
|
|
31
|
+
'@_stroke-linejoin': string;
|
|
32
|
+
'@_stroke-dasharray': string;
|
|
33
|
+
'@_stroke-dashoffset': string;
|
|
34
|
+
'@_stroke-width': string;
|
|
35
|
+
'@_fill-opacity': string;
|
|
36
|
+
'@_stroke-opacity': string;
|
|
37
|
+
'@_stroke': string;
|
|
38
|
+
'@_fill': string;
|
|
39
|
+
};
|
|
40
|
+
export declare const SVG_PARSE_ATTRIBUTE_MAP_KEYS: string[];
|
package/cjs/graphic/constants.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: !0
|
|
5
|
-
}), exports.GraphicCreator = exports.GraphicService = exports.TEXT_NUMBER_TYPE = exports.SYMBOL_NUMBER_TYPE = exports.RICHTEXT_NUMBER_TYPE = exports.RECT3D_NUMBER_TYPE = exports.RECT_NUMBER_TYPE = exports.PYRAMID3D_NUMBER_TYPE = exports.POLYGON_NUMBER_TYPE = exports.PATH_NUMBER_TYPE = exports.LINE_NUMBER_TYPE = exports.IMAGE_NUMBER_TYPE = exports.GROUP_NUMBER_TYPE = exports.GLYPH_NUMBER_TYPE = exports.CIRCLE_NUMBER_TYPE = exports.AREA_NUMBER_TYPE = exports.ARC3D_NUMBER_TYPE = exports.ARC_NUMBER_TYPE = void 0;
|
|
5
|
+
}), exports.SVG_PARSE_ATTRIBUTE_MAP_KEYS = exports.SVG_PARSE_ATTRIBUTE_MAP = exports.SVG_ATTRIBUTE_MAP_KEYS = exports.SVG_ATTRIBUTE_MAP = exports.GraphicCreator = exports.GraphicService = exports.TEXT_NUMBER_TYPE = exports.SYMBOL_NUMBER_TYPE = exports.RICHTEXT_NUMBER_TYPE = exports.RECT3D_NUMBER_TYPE = exports.RECT_NUMBER_TYPE = exports.PYRAMID3D_NUMBER_TYPE = exports.POLYGON_NUMBER_TYPE = exports.PATH_NUMBER_TYPE = exports.LINE_NUMBER_TYPE = exports.IMAGE_NUMBER_TYPE = exports.GROUP_NUMBER_TYPE = exports.GLYPH_NUMBER_TYPE = exports.CIRCLE_NUMBER_TYPE = exports.AREA_NUMBER_TYPE = exports.ARC3D_NUMBER_TYPE = exports.ARC_NUMBER_TYPE = void 0;
|
|
6
6
|
|
|
7
7
|
const tools_1 = require("./tools");
|
|
8
8
|
|
|
@@ -17,5 +17,23 @@ tools_1.genNumberType)(), exports.RECT_NUMBER_TYPE = (0, tools_1.genNumberType)(
|
|
|
17
17
|
exports.RECT3D_NUMBER_TYPE = (0, tools_1.genNumberType)(), exports.RICHTEXT_NUMBER_TYPE = (0,
|
|
18
18
|
tools_1.genNumberType)(), exports.SYMBOL_NUMBER_TYPE = (0, tools_1.genNumberType)(),
|
|
19
19
|
exports.TEXT_NUMBER_TYPE = (0, tools_1.genNumberType)(), exports.GraphicService = Symbol.for("GraphicService"),
|
|
20
|
-
exports.GraphicCreator = Symbol.for("GraphicCreator")
|
|
20
|
+
exports.GraphicCreator = Symbol.for("GraphicCreator"), exports.SVG_ATTRIBUTE_MAP = {
|
|
21
|
+
"stroke-linecap": "lineCap",
|
|
22
|
+
"stroke-linejoin": "lineJoin",
|
|
23
|
+
"stroke-dasharray": "lineDash",
|
|
24
|
+
"stroke-dashoffset": "lineDashOffset",
|
|
25
|
+
"stroke-width": "lineWidth",
|
|
26
|
+
"fill-opacity": "fillOpacity",
|
|
27
|
+
"stroke-opacity": "strokeOpacity"
|
|
28
|
+
}, exports.SVG_ATTRIBUTE_MAP_KEYS = Object.keys(exports.SVG_ATTRIBUTE_MAP), exports.SVG_PARSE_ATTRIBUTE_MAP = {
|
|
29
|
+
"@_stroke-linecap": "lineCap",
|
|
30
|
+
"@_stroke-linejoin": "lineJoin",
|
|
31
|
+
"@_stroke-dasharray": "lineDash",
|
|
32
|
+
"@_stroke-dashoffset": "lineDashOffset",
|
|
33
|
+
"@_stroke-width": "lineWidth",
|
|
34
|
+
"@_fill-opacity": "fillOpacity",
|
|
35
|
+
"@_stroke-opacity": "strokeOpacity",
|
|
36
|
+
"@_stroke": "stroke",
|
|
37
|
+
"@_fill": "fill"
|
|
38
|
+
}, exports.SVG_PARSE_ATTRIBUTE_MAP_KEYS = Object.keys(exports.SVG_PARSE_ATTRIBUTE_MAP);
|
|
21
39
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graphic/constants.ts"],"names":[],"mappings":";;;AAAA,mCAAwC;AAE3B,QAAA,eAAe,GAAG,IAAA,qBAAa,GAAE,CAAC;AAClC,QAAA,iBAAiB,GAAG,IAAA,qBAAa,GAAE,CAAC;AACpC,QAAA,gBAAgB,GAAG,IAAA,qBAAa,GAAE,CAAC;AACnC,QAAA,kBAAkB,GAAG,IAAA,qBAAa,GAAE,CAAC;AACrC,QAAA,iBAAiB,GAAG,IAAA,qBAAa,GAAE,CAAC;AACpC,QAAA,iBAAiB,GAAG,IAAA,qBAAa,GAAE,CAAC;AACpC,QAAA,iBAAiB,GAAG,IAAA,qBAAa,GAAE,CAAC;AACpC,QAAA,gBAAgB,GAAG,IAAA,qBAAa,GAAE,CAAC;AACnC,QAAA,gBAAgB,GAAG,IAAA,qBAAa,GAAE,CAAC;AACnC,QAAA,mBAAmB,GAAG,IAAA,qBAAa,GAAE,CAAC;AACtC,QAAA,qBAAqB,GAAG,IAAA,qBAAa,GAAE,CAAC;AACxC,QAAA,gBAAgB,GAAG,IAAA,qBAAa,GAAE,CAAC;AACnC,QAAA,kBAAkB,GAAG,IAAA,qBAAa,GAAE,CAAC;AACrC,QAAA,oBAAoB,GAAG,IAAA,qBAAa,GAAE,CAAC;AACvC,QAAA,kBAAkB,GAAG,IAAA,qBAAa,GAAE,CAAC;AACrC,QAAA,gBAAgB,GAAG,IAAA,qBAAa,GAAE,CAAC;AAEnC,QAAA,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;AAC9C,QAAA,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC","file":"constants.js","sourcesContent":["import { genNumberType } from './tools';\n\nexport const ARC_NUMBER_TYPE = genNumberType();\nexport const ARC3D_NUMBER_TYPE = genNumberType();\nexport const AREA_NUMBER_TYPE = genNumberType();\nexport const CIRCLE_NUMBER_TYPE = genNumberType();\nexport const GLYPH_NUMBER_TYPE = genNumberType();\nexport const GROUP_NUMBER_TYPE = genNumberType();\nexport const IMAGE_NUMBER_TYPE = genNumberType();\nexport const LINE_NUMBER_TYPE = genNumberType();\nexport const PATH_NUMBER_TYPE = genNumberType();\nexport const POLYGON_NUMBER_TYPE = genNumberType();\nexport const PYRAMID3D_NUMBER_TYPE = genNumberType();\nexport const RECT_NUMBER_TYPE = genNumberType();\nexport const RECT3D_NUMBER_TYPE = genNumberType();\nexport const RICHTEXT_NUMBER_TYPE = genNumberType();\nexport const SYMBOL_NUMBER_TYPE = genNumberType();\nexport const TEXT_NUMBER_TYPE = genNumberType();\n\nexport const GraphicService = Symbol.for('GraphicService');\nexport const GraphicCreator = Symbol.for('GraphicCreator');\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/graphic/constants.ts"],"names":[],"mappings":";;;AAAA,mCAAwC;AAE3B,QAAA,eAAe,GAAG,IAAA,qBAAa,GAAE,CAAC;AAClC,QAAA,iBAAiB,GAAG,IAAA,qBAAa,GAAE,CAAC;AACpC,QAAA,gBAAgB,GAAG,IAAA,qBAAa,GAAE,CAAC;AACnC,QAAA,kBAAkB,GAAG,IAAA,qBAAa,GAAE,CAAC;AACrC,QAAA,iBAAiB,GAAG,IAAA,qBAAa,GAAE,CAAC;AACpC,QAAA,iBAAiB,GAAG,IAAA,qBAAa,GAAE,CAAC;AACpC,QAAA,iBAAiB,GAAG,IAAA,qBAAa,GAAE,CAAC;AACpC,QAAA,gBAAgB,GAAG,IAAA,qBAAa,GAAE,CAAC;AACnC,QAAA,gBAAgB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ARC_NUMBER_TYPE = genNumberType();\nexport const ARC3D_NUMBER_TYPE = genNumberType();\nexport const AREA_NUMBER_TYPE = genNumberType();\nexport const CIRCLE_NUMBER_TYPE = genNumberType();\nexport const GLYPH_NUMBER_TYPE = genNumberType();\nexport const GROUP_NUMBER_TYPE = genNumberType();\nexport const IMAGE_NUMBER_TYPE = genNumberType();\nexport const LINE_NUMBER_TYPE = genNumberType();\nexport const PATH_NUMBER_TYPE = genNumberType();\nexport const POLYGON_NUMBER_TYPE = genNumberType();\nexport const PYRAMID3D_NUMBER_TYPE = genNumberType();\nexport const RECT_NUMBER_TYPE = genNumberType();\nexport const RECT3D_NUMBER_TYPE = genNumberType();\nexport const RICHTEXT_NUMBER_TYPE = genNumberType();\nexport const SYMBOL_NUMBER_TYPE = genNumberType();\nexport const TEXT_NUMBER_TYPE = genNumberType();\n\nexport const GraphicService = Symbol.for('GraphicService');\nexport const GraphicCreator = Symbol.for('GraphicCreator');\n\nexport const SVG_ATTRIBUTE_MAP = {\n 'stroke-linecap': 'lineCap',\n 'stroke-linejoin': 'lineJoin',\n 'stroke-dasharray': 'lineDash',\n 'stroke-dashoffset': 'lineDashOffset',\n 'stroke-width': 'lineWidth',\n 'fill-opacity': 'fillOpacity',\n 'stroke-opacity': 'strokeOpacity'\n};\n\nexport const SVG_ATTRIBUTE_MAP_KEYS = Object.keys(SVG_ATTRIBUTE_MAP);\n\nexport const SVG_PARSE_ATTRIBUTE_MAP = {\n '@_stroke-linecap': 'lineCap',\n '@_stroke-linejoin': 'lineJoin',\n '@_stroke-dasharray': 'lineDash',\n '@_stroke-dashoffset': 'lineDashOffset',\n '@_stroke-width': 'lineWidth',\n '@_fill-opacity': 'fillOpacity',\n '@_stroke-opacity': 'strokeOpacity',\n '@_stroke': 'stroke',\n '@_fill': 'fill'\n};\n\nexport const SVG_PARSE_ATTRIBUTE_MAP_KEYS = Object.keys(SVG_PARSE_ATTRIBUTE_MAP);\n"]}
|
package/cjs/graphic/graphic.d.ts
CHANGED
|
@@ -86,7 +86,7 @@ export declare abstract class Graphic<T extends Partial<IGraphicAttribute> = Par
|
|
|
86
86
|
translateTo(x: number, y: number): this;
|
|
87
87
|
scale(scaleX: number, scaleY: number, scaleCenter?: IPointLike): this;
|
|
88
88
|
scaleTo(scaleX: number, scaleY: number): this;
|
|
89
|
-
rotate(angle: number): this;
|
|
89
|
+
rotate(angle: number, rotateCenter?: IPointLike): this;
|
|
90
90
|
rotateTo(angle: number): this;
|
|
91
91
|
skewTo(b: number, c: number): this;
|
|
92
92
|
animate(params?: IGraphicAnimateParams): Animate;
|
|
@@ -114,6 +114,9 @@ export declare abstract class Graphic<T extends Partial<IGraphicAttribute> = Par
|
|
|
114
114
|
addUpdateGlobalPositionTag(): void;
|
|
115
115
|
protected clearUpdateLocalPositionTag(): void;
|
|
116
116
|
protected clearUpdateGlobalPositionTag(): void;
|
|
117
|
+
addUpdateLayoutTag(): void;
|
|
118
|
+
protected clearUpdateLayoutTag(): void;
|
|
119
|
+
protected needUpdateLayout(): boolean;
|
|
117
120
|
protected doUpdateLocalMatrix(): void;
|
|
118
121
|
protected doUpdateGlobalMatrix(): void;
|
|
119
122
|
setStage(stage?: IStage, layer?: ILayer): void;
|
package/cjs/graphic/graphic.js
CHANGED
|
@@ -63,7 +63,7 @@ class Graphic extends node_tree_1.Node {
|
|
|
63
63
|
if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
|
|
64
64
|
application_1.application.graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
|
|
65
65
|
const bounds = this.doUpdateAABBBounds(full);
|
|
66
|
-
return application_1.application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0),
|
|
66
|
+
return this.addUpdateLayoutTag(), application_1.application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0),
|
|
67
67
|
bounds;
|
|
68
68
|
}
|
|
69
69
|
combindShadowAABBBounds(bounds) {
|
|
@@ -139,7 +139,7 @@ class Graphic extends node_tree_1.Node {
|
|
|
139
139
|
this.attribute[key] = params[key];
|
|
140
140
|
}
|
|
141
141
|
this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTags(keys) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(),
|
|
142
|
-
this.addUpdatePositionTag(), this.onAttributeUpdate(context);
|
|
142
|
+
this.addUpdatePositionTag(), this.addUpdateLayoutTag(), this.onAttributeUpdate(context);
|
|
143
143
|
}
|
|
144
144
|
setAttribute(key, value, forceUpdateTag, context) {
|
|
145
145
|
var _a;
|
|
@@ -148,7 +148,7 @@ class Graphic extends node_tree_1.Node {
|
|
|
148
148
|
}, this.attribute, key, context);
|
|
149
149
|
params ? this._setAttributes(params, forceUpdateTag, context) : (0, vutils_1.isNil)(null === (_a = this.normalAttrs) || void 0 === _a ? void 0 : _a[key]) ? (this.attribute[key] = value,
|
|
150
150
|
this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(),
|
|
151
|
-
this.addUpdatePositionTag(), this.onAttributeUpdate(context)) : this.normalAttrs[key] = value,
|
|
151
|
+
this.addUpdatePositionTag(), this.addUpdateLayoutTag(), this.onAttributeUpdate(context)) : this.normalAttrs[key] = value,
|
|
152
152
|
"background" === key && this.loadImage(value, !0);
|
|
153
153
|
}
|
|
154
154
|
needUpdateTags(keys) {
|
|
@@ -185,8 +185,8 @@ class Graphic extends node_tree_1.Node {
|
|
|
185
185
|
const attribute = this.attribute, postMatrix = attribute.postMatrix;
|
|
186
186
|
return postMatrix ? application_1.application.transformUtil.fromMatrix(postMatrix, postMatrix).translate(x, y) : (attribute.x = (null !== (_a = attribute.x) && void 0 !== _a ? _a : config_1.DefaultTransform.x) + x,
|
|
187
187
|
attribute.y = (null !== (_b = attribute.y) && void 0 !== _b ? _b : config_1.DefaultTransform.y) + y),
|
|
188
|
-
this.addUpdatePositionTag(), this.addUpdateBoundTag(), this.
|
|
189
|
-
this;
|
|
188
|
+
this.addUpdatePositionTag(), this.addUpdateBoundTag(), this.addUpdateLayoutTag(),
|
|
189
|
+
this.onAttributeUpdate(context), this;
|
|
190
190
|
}
|
|
191
191
|
translateTo(x, y) {
|
|
192
192
|
const attribute = this.attribute;
|
|
@@ -198,8 +198,8 @@ class Graphic extends node_tree_1.Node {
|
|
|
198
198
|
y: y
|
|
199
199
|
}, this.attribute, tempConstantXYKey, context);
|
|
200
200
|
return params ? (this._setAttributes(params, !1, context), this) : (attribute.x = x,
|
|
201
|
-
attribute.y = y, this.addUpdatePositionTag(), this.addUpdateBoundTag(), this.
|
|
202
|
-
this);
|
|
201
|
+
attribute.y = y, this.addUpdatePositionTag(), this.addUpdateBoundTag(), this.addUpdateLayoutTag(),
|
|
202
|
+
this.onAttributeUpdate(context), this);
|
|
203
203
|
}
|
|
204
204
|
scale(scaleX, scaleY, scaleCenter) {
|
|
205
205
|
var _a, _b;
|
|
@@ -220,8 +220,8 @@ class Graphic extends node_tree_1.Node {
|
|
|
220
220
|
application_1.application.transformUtil.fromMatrix(postMatrix, postMatrix).scale(scaleX, scaleY, scaleCenter);
|
|
221
221
|
} else attribute.scaleX = (null !== (_a = attribute.scaleX) && void 0 !== _a ? _a : config_1.DefaultTransform.scaleX) * scaleX,
|
|
222
222
|
attribute.scaleY = (null !== (_b = attribute.scaleY) && void 0 !== _b ? _b : config_1.DefaultTransform.scaleY) * scaleY;
|
|
223
|
-
return this.addUpdatePositionTag(), this.addUpdateBoundTag(), this.
|
|
224
|
-
this;
|
|
223
|
+
return this.addUpdatePositionTag(), this.addUpdateBoundTag(), this.addUpdateLayoutTag(),
|
|
224
|
+
this.onAttributeUpdate(context), this;
|
|
225
225
|
}
|
|
226
226
|
scaleTo(scaleX, scaleY) {
|
|
227
227
|
const attribute = this.attribute;
|
|
@@ -234,19 +234,26 @@ class Graphic extends node_tree_1.Node {
|
|
|
234
234
|
}, this.attribute, tempConstantScaleXYKey, context);
|
|
235
235
|
return params ? (this._setAttributes(params, !1, context), this) : (attribute.scaleX = scaleX,
|
|
236
236
|
attribute.scaleY = scaleY, this.addUpdatePositionTag(), this.addUpdateBoundTag(),
|
|
237
|
-
this.onAttributeUpdate(context), this);
|
|
237
|
+
this.addUpdateLayoutTag(), this.onAttributeUpdate(context), this);
|
|
238
238
|
}
|
|
239
|
-
rotate(angle) {
|
|
239
|
+
rotate(angle, rotateCenter) {
|
|
240
240
|
var _a;
|
|
241
241
|
if (0 === angle) return this;
|
|
242
242
|
const context = {
|
|
243
243
|
type: enums_1.AttributeUpdateType.ROTATE
|
|
244
|
-
}, params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(
|
|
245
|
-
|
|
244
|
+
}, params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
|
|
245
|
+
angle: angle,
|
|
246
|
+
rotateCenter: rotateCenter
|
|
247
|
+
}, this.attribute, tempConstantAngleKey, context);
|
|
248
|
+
params && (delete params.angle, this._setAttributes(params, !1, context));
|
|
246
249
|
const attribute = this.attribute;
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
+
if (rotateCenter) {
|
|
251
|
+
let {postMatrix: postMatrix} = this.attribute;
|
|
252
|
+
postMatrix || (postMatrix = new vutils_1.Matrix, attribute.postMatrix = postMatrix),
|
|
253
|
+
application_1.application.transformUtil.fromMatrix(postMatrix, postMatrix).rotate(angle, rotateCenter);
|
|
254
|
+
} else attribute.angle = (null !== (_a = attribute.angle) && void 0 !== _a ? _a : config_1.DefaultTransform.angle) + angle;
|
|
255
|
+
return this.addUpdatePositionTag(), this.addUpdateBoundTag(), this.addUpdateLayoutTag(),
|
|
256
|
+
this.onAttributeUpdate(context), this;
|
|
250
257
|
}
|
|
251
258
|
rotateTo(angle) {
|
|
252
259
|
const attribute = this.attribute;
|
|
@@ -255,8 +262,8 @@ class Graphic extends node_tree_1.Node {
|
|
|
255
262
|
type: enums_1.AttributeUpdateType.ROTATE_TO
|
|
256
263
|
}, params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(angle, this.attribute, tempConstantAngleKey, context);
|
|
257
264
|
return params ? (this._setAttributes(params, !1, context), this) : (attribute.angle = angle,
|
|
258
|
-
this.addUpdatePositionTag(), this.addUpdateBoundTag(), this.
|
|
259
|
-
this);
|
|
265
|
+
this.addUpdatePositionTag(), this.addUpdateBoundTag(), this.addUpdateLayoutTag(),
|
|
266
|
+
this.onAttributeUpdate(context), this);
|
|
260
267
|
}
|
|
261
268
|
skewTo(b, c) {
|
|
262
269
|
return this;
|
|
@@ -382,6 +389,15 @@ class Graphic extends node_tree_1.Node {
|
|
|
382
389
|
clearUpdateGlobalPositionTag() {
|
|
383
390
|
this._updateTag &= enums_1.UpdateTag.CLEAR_GLOBAL_MATRIX;
|
|
384
391
|
}
|
|
392
|
+
addUpdateLayoutTag() {
|
|
393
|
+
this._updateTag |= enums_1.UpdateTag.UPDATE_LAYOUT;
|
|
394
|
+
}
|
|
395
|
+
clearUpdateLayoutTag() {
|
|
396
|
+
this._updateTag &= enums_1.UpdateTag.CLEAR_LAYOUT;
|
|
397
|
+
}
|
|
398
|
+
needUpdateLayout() {
|
|
399
|
+
return !!(this._updateTag & enums_1.UpdateTag.UPDATE_LAYOUT);
|
|
400
|
+
}
|
|
385
401
|
doUpdateLocalMatrix() {
|
|
386
402
|
const {x: x = config_1.DefaultTransform.x, y: y = config_1.DefaultTransform.y, scaleX: scaleX = config_1.DefaultTransform.scaleX, scaleY: scaleY = config_1.DefaultTransform.scaleY, angle: angle = config_1.DefaultTransform.angle, scaleCenter: scaleCenter, anchor: anchor, postMatrix: postMatrix} = this.attribute, _anchor = [ 0, 0 ];
|
|
387
403
|
if (anchor) {
|
|
@@ -416,8 +432,16 @@ class Graphic extends node_tree_1.Node {
|
|
|
416
432
|
}
|
|
417
433
|
}
|
|
418
434
|
setStage(stage, layer) {
|
|
419
|
-
|
|
420
|
-
|
|
435
|
+
if (this.stage !== stage) {
|
|
436
|
+
if (this.stage = stage, this.layer = layer, this.setStageToShadowRoot(stage, layer),
|
|
437
|
+
this.animates && this.animates.size) {
|
|
438
|
+
const timeline = stage.getTimeline();
|
|
439
|
+
this.animates.forEach((a => {
|
|
440
|
+
a.setTimeline(timeline);
|
|
441
|
+
}));
|
|
442
|
+
}
|
|
443
|
+
this._onSetStage && this._onSetStage(this, stage, layer), application_1.application.graphicService.onSetStage(this, stage);
|
|
444
|
+
}
|
|
421
445
|
}
|
|
422
446
|
setStageToShadowRoot(stage, layer) {
|
|
423
447
|
this.shadowRoot && this.shadowRoot.setStage(stage, layer);
|
|
@@ -515,7 +539,7 @@ class Graphic extends node_tree_1.Node {
|
|
|
515
539
|
this.pathProxy;
|
|
516
540
|
}
|
|
517
541
|
loadImage(image, background = !1) {
|
|
518
|
-
if (!image) return;
|
|
542
|
+
if (!image || background && backgroundNotImage(image)) return;
|
|
519
543
|
const url = image;
|
|
520
544
|
this.resources || (this.resources = new Map);
|
|
521
545
|
const cache = {
|
|
@@ -563,5 +587,9 @@ class Graphic extends node_tree_1.Node {
|
|
|
563
587
|
}
|
|
564
588
|
}
|
|
565
589
|
|
|
590
|
+
function backgroundNotImage(image) {
|
|
591
|
+
return !(!image.fill && !image.stroke);
|
|
592
|
+
}
|
|
593
|
+
|
|
566
594
|
exports.Graphic = Graphic, Graphic.mixin(event_1.EventTarget);
|
|
567
595
|
//# sourceMappingURL=graphic.js.map
|