@visactor/vrender-core 0.20.0-alpha.0 → 0.20.0-alpha.2
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/allocator/matrix-allocate.d.ts +1 -1
- package/cjs/allocator/matrix-allocate.js +2 -4
- package/cjs/allocator/matrix-allocate.js.map +1 -1
- package/cjs/animate/Ticker/default-ticker.d.ts +2 -53
- package/cjs/animate/Ticker/default-ticker.js +17 -130
- package/cjs/animate/Ticker/default-ticker.js.map +1 -1
- package/cjs/animate/Ticker/index.d.ts +4 -0
- package/cjs/animate/Ticker/index.js +3 -1
- package/cjs/animate/Ticker/index.js.map +1 -1
- package/cjs/animate/Ticker/manual-ticker-handler.d.ts +15 -0
- package/cjs/animate/Ticker/manual-ticker-handler.js +36 -0
- package/cjs/animate/Ticker/manual-ticker-handler.js.map +1 -0
- package/cjs/animate/Ticker/manual-ticker.d.ts +19 -0
- package/cjs/animate/Ticker/manual-ticker.js +37 -0
- package/cjs/animate/Ticker/manual-ticker.js.map +1 -0
- package/cjs/animate/Ticker/raf-tick-handler.d.ts +9 -0
- package/cjs/animate/Ticker/raf-tick-handler.js +30 -0
- package/cjs/animate/Ticker/raf-tick-handler.js.map +1 -0
- package/cjs/animate/Ticker/timeout-tick-handler.d.ts +9 -0
- package/cjs/animate/Ticker/timeout-tick-handler.js +28 -0
- package/cjs/animate/Ticker/timeout-tick-handler.js.map +1 -0
- package/cjs/animate/Ticker/type.d.ts +6 -0
- package/cjs/animate/Ticker/type.js +11 -0
- package/cjs/animate/Ticker/type.js.map +1 -0
- package/cjs/animate/animate.js +4 -2
- package/cjs/animate/animate.js.map +1 -1
- package/cjs/animate/custom-animate.d.ts +5 -16
- package/cjs/animate/custom-animate.js +9 -62
- package/cjs/animate/custom-animate.js.map +1 -1
- package/cjs/animate/group-fade.d.ts +16 -0
- package/cjs/animate/group-fade.js +66 -0
- package/cjs/animate/group-fade.js.map +1 -0
- package/cjs/animate/index.d.ts +1 -0
- package/cjs/animate/index.js +2 -1
- package/cjs/animate/index.js.map +1 -1
- package/cjs/canvas/conical-gradient.js.map +1 -1
- package/cjs/canvas/contributions/base-canvas.js +4 -13
- package/cjs/canvas/contributions/base-canvas.js.map +1 -1
- package/cjs/canvas/util.d.ts +0 -1
- package/cjs/canvas/util.js +7 -17
- package/cjs/canvas/util.js.map +1 -1
- package/cjs/common/3d-interceptor.d.ts +3 -0
- package/cjs/common/3d-interceptor.js +50 -0
- package/cjs/common/3d-interceptor.js.map +1 -0
- package/cjs/common/bezier-utils.js +2 -1
- package/cjs/common/canvas-utils.d.ts +1 -1
- package/cjs/common/canvas-utils.js +15 -30
- package/cjs/common/canvas-utils.js.map +1 -1
- package/cjs/common/matrix.d.ts +11 -3
- package/cjs/common/matrix.js +97 -19
- package/cjs/common/matrix.js.map +1 -1
- package/cjs/common/render-command-list.js +1 -2
- package/cjs/common/render-curve.js +22 -32
- package/cjs/common/render-curve.js.map +1 -1
- package/cjs/common/render-utils.js +2 -1
- package/cjs/common/segment/catmull-rom-close.d.ts +41 -0
- package/cjs/common/segment/catmull-rom-close.js +81 -0
- package/cjs/common/segment/catmull-rom-close.js.map +1 -0
- package/cjs/common/segment/catmull-rom.d.ts +38 -0
- package/cjs/common/segment/catmull-rom.js +97 -0
- package/cjs/common/segment/catmull-rom.js.map +1 -0
- package/cjs/common/segment/index.d.ts +5 -2
- package/cjs/common/segment/index.js +8 -1
- package/cjs/common/segment/index.js.map +1 -1
- package/cjs/common/sort.js +15 -12
- package/cjs/common/sort.js.map +1 -1
- package/cjs/common/text.d.ts +0 -2
- package/cjs/common/text.js +8 -14
- package/cjs/common/text.js.map +1 -1
- package/cjs/common/utils.js +1 -1
- package/cjs/common/utils.js.map +1 -1
- package/cjs/core/camera.js +3 -3
- package/cjs/core/camera.js.map +1 -1
- package/cjs/core/contributions/layerHandler/modules.js +2 -5
- package/cjs/core/contributions/layerHandler/modules.js.map +1 -1
- package/cjs/core/stage.d.ts +2 -2
- package/cjs/core/stage.js +23 -11
- package/cjs/core/stage.js.map +1 -1
- package/cjs/event/federated-event/base-event.js +12 -2
- package/cjs/event/federated-event/base-event.js.map +1 -1
- package/cjs/graphic/arc.d.ts +6 -4
- package/cjs/graphic/arc.js +46 -17
- package/cjs/graphic/arc.js.map +1 -1
- package/cjs/graphic/arc3d.d.ts +2 -2
- package/cjs/graphic/arc3d.js +8 -9
- package/cjs/graphic/arc3d.js.map +1 -1
- package/cjs/graphic/area.d.ts +5 -3
- package/cjs/graphic/area.js +27 -12
- package/cjs/graphic/area.js.map +1 -1
- package/cjs/graphic/builtin-symbol/index.d.ts +1 -1
- package/cjs/graphic/builtin-symbol/thin-triangle.d.ts +2 -2
- package/cjs/graphic/builtin-symbol/thin-triangle.js +2 -2
- package/cjs/graphic/builtin-symbol/thin-triangle.js.map +1 -1
- package/cjs/graphic/builtin-symbol/triangle-down.d.ts +1 -2
- package/cjs/graphic/builtin-symbol/triangle-down.js +4 -9
- package/cjs/graphic/builtin-symbol/triangle-down.js.map +1 -1
- package/cjs/graphic/builtin-symbol/triangle-left.d.ts +0 -1
- package/cjs/graphic/builtin-symbol/triangle-left.js +3 -8
- package/cjs/graphic/builtin-symbol/triangle-left.js.map +1 -1
- package/cjs/graphic/builtin-symbol/triangle-right.d.ts +1 -2
- package/cjs/graphic/builtin-symbol/triangle-right.js +4 -9
- package/cjs/graphic/builtin-symbol/triangle-right.js.map +1 -1
- package/cjs/graphic/builtin-symbol/triangle-up.d.ts +1 -2
- package/cjs/graphic/builtin-symbol/triangle-up.js +4 -9
- package/cjs/graphic/builtin-symbol/triangle-up.js.map +1 -1
- package/cjs/graphic/builtin-symbol/triangle.d.ts +1 -2
- package/cjs/graphic/builtin-symbol/triangle.js +1 -3
- package/cjs/graphic/builtin-symbol/triangle.js.map +1 -1
- package/cjs/graphic/builtin-symbol/utils.js +1 -5
- package/cjs/graphic/builtin-symbol/utils.js.map +1 -1
- package/cjs/graphic/circle.d.ts +5 -3
- package/cjs/graphic/circle.js +20 -12
- package/cjs/graphic/circle.js.map +1 -1
- package/cjs/graphic/config.js +7 -3
- package/cjs/graphic/config.js.map +1 -1
- package/cjs/graphic/glyph.d.ts +4 -2
- package/cjs/graphic/glyph.js +9 -2
- package/cjs/graphic/glyph.js.map +1 -1
- package/cjs/graphic/graphic-creator.js.map +1 -1
- package/cjs/graphic/graphic-service/common-outer-boder-bounds.d.ts +3 -0
- package/cjs/graphic/graphic-service/common-outer-boder-bounds.js +17 -0
- package/cjs/graphic/graphic-service/common-outer-boder-bounds.js.map +1 -0
- package/cjs/graphic/graphic-service/graphic-service.d.ts +7 -42
- package/cjs/graphic/graphic-service/graphic-service.js +21 -396
- package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
- package/cjs/graphic/graphic-service/symbol-outer-border-bounds.d.ts +3 -0
- package/cjs/graphic/graphic-service/symbol-outer-border-bounds.js +17 -0
- package/cjs/graphic/graphic-service/symbol-outer-border-bounds.js.map +1 -0
- package/cjs/graphic/graphic.d.ts +12 -9
- package/cjs/graphic/graphic.js +17 -2
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/graphic/group.d.ts +7 -3
- package/cjs/graphic/group.js +34 -22
- package/cjs/graphic/group.js.map +1 -1
- package/cjs/graphic/image.d.ts +3 -2
- package/cjs/graphic/image.js +14 -9
- package/cjs/graphic/image.js.map +1 -1
- package/cjs/graphic/line.d.ts +5 -3
- package/cjs/graphic/line.js +24 -11
- package/cjs/graphic/line.js.map +1 -1
- package/cjs/graphic/node-tree.js.map +1 -1
- package/cjs/graphic/path.d.ts +3 -3
- package/cjs/graphic/path.js +17 -13
- package/cjs/graphic/path.js.map +1 -1
- package/cjs/graphic/polygon.d.ts +4 -3
- package/cjs/graphic/polygon.js +16 -11
- package/cjs/graphic/polygon.js.map +1 -1
- package/cjs/graphic/pyramid3d.d.ts +2 -2
- package/cjs/graphic/pyramid3d.js +10 -9
- package/cjs/graphic/pyramid3d.js.map +1 -1
- package/cjs/graphic/rect.d.ts +3 -3
- package/cjs/graphic/rect.js +16 -12
- package/cjs/graphic/rect.js.map +1 -1
- package/cjs/graphic/rect3d.js +2 -2
- package/cjs/graphic/rect3d.js.map +1 -1
- package/cjs/graphic/richtext/icon.d.ts +2 -2
- package/cjs/graphic/richtext/icon.js.map +1 -1
- package/cjs/graphic/richtext/utils.js +12 -21
- package/cjs/graphic/richtext/utils.js.map +1 -1
- package/cjs/graphic/richtext.d.ts +4 -4
- package/cjs/graphic/richtext.js +46 -14
- package/cjs/graphic/richtext.js.map +1 -1
- package/cjs/graphic/shadow-root.d.ts +2 -2
- package/cjs/graphic/shadow-root.js.map +1 -1
- package/cjs/graphic/symbol.d.ts +5 -3
- package/cjs/graphic/symbol.js +25 -12
- package/cjs/graphic/symbol.js.map +1 -1
- package/cjs/graphic/text.d.ts +10 -10
- package/cjs/graphic/text.js +27 -21
- package/cjs/graphic/text.js.map +1 -1
- package/cjs/graphic/theme.js.map +1 -1
- package/cjs/graphic/wrap-text.d.ts +1 -1
- package/cjs/graphic/wrap-text.js +2 -2
- package/cjs/graphic/wrap-text.js.map +1 -1
- package/cjs/index.d.ts +3 -0
- package/cjs/index.js +6 -4
- package/cjs/index.js.map +1 -1
- package/cjs/interface/graphic/arc.d.ts +2 -2
- package/cjs/interface/graphic/arc.js.map +1 -1
- package/cjs/interface/graphic/arc3d.d.ts +1 -1
- package/cjs/interface/graphic/arc3d.js.map +1 -1
- package/cjs/interface/graphic/area.d.ts +1 -0
- package/cjs/interface/graphic/area.js.map +1 -1
- package/cjs/interface/graphic/group.d.ts +1 -1
- package/cjs/interface/graphic/group.js.map +1 -1
- package/cjs/interface/graphic/line.d.ts +1 -0
- package/cjs/interface/graphic/line.js.map +1 -1
- package/cjs/interface/graphic/richText.d.ts +1 -0
- package/cjs/interface/graphic/richText.js.map +1 -1
- package/cjs/interface/graphic-service.d.ts +10 -17
- package/cjs/interface/graphic-service.js.map +1 -1
- package/cjs/interface/graphic.d.ts +2 -0
- package/cjs/interface/graphic.js.map +1 -1
- package/cjs/picker/pick-interceptor.d.ts +1 -1
- package/cjs/picker/pick-interceptor.js +6 -44
- package/cjs/picker/pick-interceptor.js.map +1 -1
- package/cjs/picker/picker-service.js +4 -5
- package/cjs/picker/picker-service.js.map +1 -1
- package/cjs/plugins/builtin-plugin/3dview-transform-plugin.d.ts +1 -0
- package/cjs/plugins/builtin-plugin/3dview-transform-plugin.js +8 -2
- package/cjs/plugins/builtin-plugin/3dview-transform-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/edit-module.d.ts +22 -0
- package/cjs/plugins/builtin-plugin/edit-module.js +94 -0
- package/cjs/plugins/builtin-plugin/edit-module.js.map +1 -0
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.d.ts +1 -0
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +8 -2
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.js +2 -2
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/react-attribute-plugin.d.ts +2 -1
- package/cjs/plugins/builtin-plugin/react-attribute-plugin.js +15 -7
- package/cjs/plugins/builtin-plugin/react-attribute-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin.d.ts +76 -0
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js +338 -0
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -0
- package/cjs/render/contributions/render/arc-render.js +12 -28
- package/cjs/render/contributions/render/arc-render.js.map +1 -1
- package/cjs/render/contributions/render/area-render.js +12 -7
- package/cjs/render/contributions/render/area-render.js.map +1 -1
- package/cjs/render/contributions/render/base-3d-render.d.ts +10 -0
- package/cjs/render/contributions/render/base-3d-render.js +63 -0
- package/cjs/render/contributions/render/base-3d-render.js.map +1 -0
- package/cjs/render/contributions/render/base-render.d.ts +1 -1
- package/cjs/render/contributions/render/base-render.js +5 -5
- package/cjs/render/contributions/render/base-render.js.map +1 -1
- package/cjs/render/contributions/render/draw-interceptor.js +7 -51
- package/cjs/render/contributions/render/draw-interceptor.js.map +1 -1
- package/cjs/render/contributions/render/group-render.js +4 -5
- package/cjs/render/contributions/render/group-render.js.map +1 -1
- package/cjs/render/contributions/render/index.d.ts +1 -0
- package/cjs/render/contributions/render/index.js +3 -3
- package/cjs/render/contributions/render/index.js.map +1 -1
- package/cjs/render/contributions/render/line-render.js +6 -3
- package/cjs/render/contributions/render/line-render.js.map +1 -1
- package/cjs/render/contributions/render/pyramid3d-render.d.ts +3 -5
- package/cjs/render/contributions/render/pyramid3d-render.js +4 -54
- package/cjs/render/contributions/render/pyramid3d-render.js.map +1 -1
- package/cjs/render/contributions/render/rect3d-render.d.ts +3 -5
- package/cjs/render/contributions/render/rect3d-render.js +4 -53
- package/cjs/render/contributions/render/rect3d-render.js.map +1 -1
- package/cjs/render/contributions/render/symbol-render.js +9 -18
- package/cjs/render/contributions/render/symbol-render.js.map +1 -1
- package/cjs/render/contributions/render/utils.d.ts +24 -0
- package/cjs/render/contributions/render/utils.js +51 -21
- package/cjs/render/contributions/render/utils.js.map +1 -1
- package/dist/index.es.js +9760 -9617
- package/es/allocator/matrix-allocate.d.ts +1 -1
- package/es/allocator/matrix-allocate.js +3 -3
- package/es/allocator/matrix-allocate.js.map +1 -1
- package/es/animate/Ticker/default-ticker.d.ts +2 -53
- package/es/animate/Ticker/default-ticker.js +3 -106
- package/es/animate/Ticker/default-ticker.js.map +1 -1
- package/es/animate/Ticker/index.d.ts +4 -0
- package/es/animate/Ticker/index.js +8 -0
- package/es/animate/Ticker/index.js.map +1 -1
- package/es/animate/Ticker/manual-ticker-handler.d.ts +15 -0
- package/es/animate/Ticker/manual-ticker-handler.js +28 -0
- package/es/animate/Ticker/manual-ticker-handler.js.map +1 -0
- package/es/animate/Ticker/manual-ticker.d.ts +19 -0
- package/es/animate/Ticker/manual-ticker.js +31 -0
- package/es/animate/Ticker/manual-ticker.js.map +1 -0
- package/es/animate/Ticker/raf-tick-handler.d.ts +9 -0
- package/es/animate/Ticker/raf-tick-handler.js +22 -0
- package/es/animate/Ticker/raf-tick-handler.js.map +1 -0
- package/es/animate/Ticker/timeout-tick-handler.d.ts +9 -0
- package/es/animate/Ticker/timeout-tick-handler.js +20 -0
- package/es/animate/Ticker/timeout-tick-handler.js.map +1 -0
- package/es/animate/Ticker/type.d.ts +6 -0
- package/es/animate/Ticker/type.js +7 -0
- package/es/animate/Ticker/type.js.map +1 -0
- package/es/animate/animate.js +4 -2
- package/es/animate/animate.js.map +1 -1
- package/es/animate/custom-animate.d.ts +5 -16
- package/es/animate/custom-animate.js +9 -58
- package/es/animate/custom-animate.js.map +1 -1
- package/es/animate/group-fade.d.ts +16 -0
- package/es/animate/group-fade.js +56 -0
- package/es/animate/group-fade.js.map +1 -0
- package/es/animate/index.d.ts +1 -0
- package/es/animate/index.js +2 -0
- package/es/animate/index.js.map +1 -1
- package/es/canvas/conical-gradient.js.map +1 -1
- package/es/canvas/contributions/base-canvas.js +3 -15
- package/es/canvas/contributions/base-canvas.js.map +1 -1
- package/es/canvas/util.d.ts +0 -1
- package/es/canvas/util.js +7 -17
- package/es/canvas/util.js.map +1 -1
- package/es/common/3d-interceptor.d.ts +3 -0
- package/es/common/3d-interceptor.js +46 -0
- package/es/common/3d-interceptor.js.map +1 -0
- package/es/common/bezier-utils.js +2 -1
- package/es/common/canvas-utils.d.ts +1 -1
- package/es/common/canvas-utils.js +15 -30
- package/es/common/canvas-utils.js.map +1 -1
- package/es/common/matrix.d.ts +11 -3
- package/es/common/matrix.js +90 -17
- package/es/common/matrix.js.map +1 -1
- package/es/common/render-command-list.js +1 -2
- package/es/common/render-curve.js +22 -32
- package/es/common/render-curve.js.map +1 -1
- package/es/common/render-utils.js +2 -1
- package/es/common/segment/catmull-rom-close.d.ts +41 -0
- package/es/common/segment/catmull-rom-close.js +74 -0
- package/es/common/segment/catmull-rom-close.js.map +1 -0
- package/es/common/segment/catmull-rom.d.ts +38 -0
- package/es/common/segment/catmull-rom.js +92 -0
- package/es/common/segment/catmull-rom.js.map +1 -0
- package/es/common/segment/index.d.ts +5 -2
- package/es/common/segment/index.js +11 -0
- package/es/common/segment/index.js.map +1 -1
- package/es/common/sort.js +15 -12
- package/es/common/sort.js.map +1 -1
- package/es/common/text.d.ts +0 -2
- package/es/common/text.js +6 -11
- package/es/common/text.js.map +1 -1
- package/es/common/utils.js +1 -1
- package/es/common/utils.js.map +1 -1
- package/es/core/camera.js +5 -3
- package/es/core/camera.js.map +1 -1
- package/es/core/contributions/layerHandler/modules.js +2 -9
- package/es/core/contributions/layerHandler/modules.js.map +1 -1
- package/es/core/stage.d.ts +2 -2
- package/es/core/stage.js +22 -14
- package/es/core/stage.js.map +1 -1
- package/es/event/federated-event/base-event.js +12 -2
- package/es/event/federated-event/base-event.js.map +1 -1
- package/es/graphic/arc.d.ts +6 -4
- package/es/graphic/arc.js +47 -16
- package/es/graphic/arc.js.map +1 -1
- package/es/graphic/arc3d.d.ts +2 -2
- package/es/graphic/arc3d.js +7 -10
- package/es/graphic/arc3d.js.map +1 -1
- package/es/graphic/area.d.ts +5 -3
- package/es/graphic/area.js +28 -11
- package/es/graphic/area.js.map +1 -1
- package/es/graphic/builtin-symbol/index.d.ts +1 -1
- package/es/graphic/builtin-symbol/thin-triangle.d.ts +2 -2
- package/es/graphic/builtin-symbol/thin-triangle.js +2 -2
- package/es/graphic/builtin-symbol/thin-triangle.js.map +1 -1
- package/es/graphic/builtin-symbol/triangle-down.d.ts +1 -2
- package/es/graphic/builtin-symbol/triangle-down.js +2 -7
- package/es/graphic/builtin-symbol/triangle-down.js.map +1 -1
- package/es/graphic/builtin-symbol/triangle-left.d.ts +0 -1
- package/es/graphic/builtin-symbol/triangle-left.js +1 -6
- package/es/graphic/builtin-symbol/triangle-left.js.map +1 -1
- package/es/graphic/builtin-symbol/triangle-right.d.ts +1 -2
- package/es/graphic/builtin-symbol/triangle-right.js +2 -7
- package/es/graphic/builtin-symbol/triangle-right.js.map +1 -1
- package/es/graphic/builtin-symbol/triangle-up.d.ts +1 -2
- package/es/graphic/builtin-symbol/triangle-up.js +2 -7
- package/es/graphic/builtin-symbol/triangle-up.js.map +1 -1
- package/es/graphic/builtin-symbol/triangle.d.ts +1 -2
- package/es/graphic/builtin-symbol/triangle.js +1 -3
- package/es/graphic/builtin-symbol/triangle.js.map +1 -1
- package/es/graphic/builtin-symbol/utils.js +1 -4
- package/es/graphic/builtin-symbol/utils.js.map +1 -1
- package/es/graphic/circle.d.ts +5 -3
- package/es/graphic/circle.js +23 -9
- package/es/graphic/circle.js.map +1 -1
- package/es/graphic/config.js +7 -3
- package/es/graphic/config.js.map +1 -1
- package/es/graphic/glyph.d.ts +4 -2
- package/es/graphic/glyph.js +9 -1
- package/es/graphic/glyph.js.map +1 -1
- package/es/graphic/graphic-creator.js.map +1 -1
- package/es/graphic/graphic-service/common-outer-boder-bounds.d.ts +3 -0
- package/es/graphic/graphic-service/common-outer-boder-bounds.js +9 -0
- package/es/graphic/graphic-service/common-outer-boder-bounds.js.map +1 -0
- package/es/graphic/graphic-service/graphic-service.d.ts +7 -42
- package/es/graphic/graphic-service/graphic-service.js +14 -388
- package/es/graphic/graphic-service/graphic-service.js.map +1 -1
- package/es/graphic/graphic-service/symbol-outer-border-bounds.d.ts +3 -0
- package/es/graphic/graphic-service/symbol-outer-border-bounds.js +11 -0
- package/es/graphic/graphic-service/symbol-outer-border-bounds.js.map +1 -0
- package/es/graphic/graphic.d.ts +12 -9
- package/es/graphic/graphic.js +20 -3
- package/es/graphic/graphic.js.map +1 -1
- package/es/graphic/group.d.ts +7 -3
- package/es/graphic/group.js +32 -22
- package/es/graphic/group.js.map +1 -1
- package/es/graphic/image.d.ts +3 -2
- package/es/graphic/image.js +15 -8
- package/es/graphic/image.js.map +1 -1
- package/es/graphic/line.d.ts +5 -3
- package/es/graphic/line.js +25 -10
- package/es/graphic/line.js.map +1 -1
- package/es/graphic/node-tree.js.map +1 -1
- package/es/graphic/path.d.ts +3 -3
- package/es/graphic/path.js +18 -12
- package/es/graphic/path.js.map +1 -1
- package/es/graphic/polygon.d.ts +4 -3
- package/es/graphic/polygon.js +17 -10
- package/es/graphic/polygon.js.map +1 -1
- package/es/graphic/pyramid3d.d.ts +2 -2
- package/es/graphic/pyramid3d.js +8 -10
- package/es/graphic/pyramid3d.js.map +1 -1
- package/es/graphic/rect.d.ts +3 -3
- package/es/graphic/rect.js +16 -10
- package/es/graphic/rect.js.map +1 -1
- package/es/graphic/rect3d.js +1 -3
- package/es/graphic/rect3d.js.map +1 -1
- package/es/graphic/richtext/icon.d.ts +2 -2
- package/es/graphic/richtext/icon.js.map +1 -1
- package/es/graphic/richtext/utils.js +9 -20
- package/es/graphic/richtext/utils.js.map +1 -1
- package/es/graphic/richtext.d.ts +4 -4
- package/es/graphic/richtext.js +45 -13
- package/es/graphic/richtext.js.map +1 -1
- package/es/graphic/shadow-root.d.ts +2 -2
- package/es/graphic/shadow-root.js.map +1 -1
- package/es/graphic/symbol.d.ts +5 -3
- package/es/graphic/symbol.js +26 -11
- package/es/graphic/symbol.js.map +1 -1
- package/es/graphic/text.d.ts +10 -10
- package/es/graphic/text.js +28 -23
- package/es/graphic/text.js.map +1 -1
- package/es/graphic/theme.js.map +1 -1
- package/es/graphic/wrap-text.d.ts +1 -1
- package/es/graphic/wrap-text.js +1 -3
- package/es/graphic/wrap-text.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/graphic/arc.d.ts +2 -2
- package/es/interface/graphic/arc.js.map +1 -1
- package/es/interface/graphic/arc3d.d.ts +1 -1
- package/es/interface/graphic/arc3d.js.map +1 -1
- package/es/interface/graphic/area.d.ts +1 -0
- package/es/interface/graphic/area.js.map +1 -1
- package/es/interface/graphic/group.d.ts +1 -1
- package/es/interface/graphic/group.js.map +1 -1
- package/es/interface/graphic/line.d.ts +1 -0
- package/es/interface/graphic/line.js.map +1 -1
- package/es/interface/graphic/richText.d.ts +1 -0
- package/es/interface/graphic/richText.js.map +1 -1
- package/es/interface/graphic-service.d.ts +10 -17
- package/es/interface/graphic-service.js.map +1 -1
- package/es/interface/graphic.d.ts +2 -0
- package/es/interface/graphic.js.map +1 -1
- package/es/picker/pick-interceptor.d.ts +1 -1
- package/es/picker/pick-interceptor.js +10 -46
- package/es/picker/pick-interceptor.js.map +1 -1
- package/es/picker/picker-service.js +1 -1
- package/es/picker/picker-service.js.map +1 -1
- package/es/plugins/builtin-plugin/3dview-transform-plugin.d.ts +1 -0
- package/es/plugins/builtin-plugin/3dview-transform-plugin.js +6 -0
- package/es/plugins/builtin-plugin/3dview-transform-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/edit-module.d.ts +22 -0
- package/es/plugins/builtin-plugin/edit-module.js +86 -0
- package/es/plugins/builtin-plugin/edit-module.js.map +1 -0
- package/es/plugins/builtin-plugin/flex-layout-plugin.d.ts +1 -0
- package/es/plugins/builtin-plugin/flex-layout-plugin.js +6 -0
- package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/html-attribute-plugin.js +2 -2
- package/es/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/react-attribute-plugin.d.ts +2 -1
- package/es/plugins/builtin-plugin/react-attribute-plugin.js +15 -7
- package/es/plugins/builtin-plugin/react-attribute-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/richtext-edit-plugin.d.ts +76 -0
- package/es/plugins/builtin-plugin/richtext-edit-plugin.js +334 -0
- package/es/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -0
- package/es/render/contributions/render/arc-render.js +7 -16
- package/es/render/contributions/render/arc-render.js.map +1 -1
- package/es/render/contributions/render/area-render.js +12 -6
- package/es/render/contributions/render/area-render.js.map +1 -1
- package/es/render/contributions/render/base-3d-render.d.ts +10 -0
- package/es/render/contributions/render/base-3d-render.js +57 -0
- package/es/render/contributions/render/base-3d-render.js.map +1 -0
- package/es/render/contributions/render/base-render.d.ts +1 -1
- package/es/render/contributions/render/base-render.js +3 -1
- package/es/render/contributions/render/base-render.js.map +1 -1
- package/es/render/contributions/render/draw-interceptor.js +7 -51
- package/es/render/contributions/render/draw-interceptor.js.map +1 -1
- package/es/render/contributions/render/group-render.js +3 -1
- package/es/render/contributions/render/group-render.js.map +1 -1
- package/es/render/contributions/render/index.d.ts +1 -0
- package/es/render/contributions/render/index.js +2 -0
- package/es/render/contributions/render/index.js.map +1 -1
- package/es/render/contributions/render/line-render.js +6 -3
- package/es/render/contributions/render/line-render.js.map +1 -1
- package/es/render/contributions/render/pyramid3d-render.d.ts +3 -5
- package/es/render/contributions/render/pyramid3d-render.js +4 -56
- package/es/render/contributions/render/pyramid3d-render.js.map +1 -1
- package/es/render/contributions/render/rect3d-render.d.ts +3 -5
- package/es/render/contributions/render/rect3d-render.js +4 -55
- package/es/render/contributions/render/rect3d-render.js.map +1 -1
- package/es/render/contributions/render/symbol-render.js +9 -18
- package/es/render/contributions/render/symbol-render.js.map +1 -1
- package/es/render/contributions/render/utils.d.ts +24 -0
- package/es/render/contributions/render/utils.js +41 -13
- package/es/render/contributions/render/utils.js.map +1 -1
- package/package.json +4 -4
- package/cjs/graphic/graphic-service/common-contribution.d.ts +0 -5
- package/cjs/graphic/graphic-service/common-contribution.js +0 -19
- package/cjs/graphic/graphic-service/common-contribution.js.map +0 -1
- package/cjs/graphic/graphic-service/symbol-contribution.d.ts +0 -6
- package/cjs/graphic/graphic-service/symbol-contribution.js +0 -21
- package/cjs/graphic/graphic-service/symbol-contribution.js.map +0 -1
- package/es/graphic/graphic-service/common-contribution.d.ts +0 -5
- package/es/graphic/graphic-service/common-contribution.js +0 -11
- package/es/graphic/graphic-service/common-contribution.js.map +0 -1
- package/es/graphic/graphic-service/symbol-contribution.d.ts +0 -6
- package/es/graphic/graphic-service/symbol-contribution.js +0 -15
- package/es/graphic/graphic-service/symbol-contribution.js.map +0 -1
package/es/graphic/path.js
CHANGED
|
@@ -2,8 +2,6 @@ import { isString, isNil } from "@visactor/vutils";
|
|
|
2
2
|
|
|
3
3
|
import { Graphic, GRAPHIC_UPDATE_TAG_KEY, NOWORK_ANIMATE_ATTR } from "./graphic";
|
|
4
4
|
|
|
5
|
-
import { parsePadding } from "../common/utils";
|
|
6
|
-
|
|
7
5
|
import { CustomPath2D } from "../common/custom-path2d";
|
|
8
6
|
|
|
9
7
|
import { getTheme } from "./theme";
|
|
@@ -12,6 +10,8 @@ import { application } from "../application";
|
|
|
12
10
|
|
|
13
11
|
import { PATH_NUMBER_TYPE } from "./constants";
|
|
14
12
|
|
|
13
|
+
import { updateBoundsOfCommonOuterBorder } from "./graphic-service/common-outer-boder-bounds";
|
|
14
|
+
|
|
15
15
|
const PATH_UPDATE_TAG_KEY = [ "path", "customPath", ...GRAPHIC_UPDATE_TAG_KEY ];
|
|
16
16
|
|
|
17
17
|
export class Path extends Graphic {
|
|
@@ -29,27 +29,33 @@ export class Path extends Graphic {
|
|
|
29
29
|
return null != path && "" !== path;
|
|
30
30
|
}
|
|
31
31
|
getParsedPathShape() {
|
|
32
|
-
const pathTheme =
|
|
32
|
+
const pathTheme = this.getGraphicTheme();
|
|
33
33
|
if (!this.valid) return pathTheme.path;
|
|
34
34
|
const attribute = this.attribute;
|
|
35
35
|
return attribute.path instanceof CustomPath2D ? attribute.path : (isNil(this.cache) && this.doUpdatePathShape(),
|
|
36
36
|
this.cache instanceof CustomPath2D ? this.cache : pathTheme.path);
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
getGraphicTheme() {
|
|
39
|
+
return getTheme(this).path;
|
|
40
|
+
}
|
|
41
|
+
updateAABBBounds(attribute, pathTheme, aabbBounds) {
|
|
42
|
+
if (!application.graphicService.validCheck(attribute, pathTheme, aabbBounds, this)) return aabbBounds;
|
|
43
|
+
if (!this.updatePathProxyAABBBounds(aabbBounds)) {
|
|
44
|
+
const pathShape = this.getParsedPathShape();
|
|
45
|
+
aabbBounds.union(pathShape.getBounds());
|
|
46
|
+
}
|
|
47
|
+
const {tb1: tb1, tb2: tb2} = application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
48
|
+
updateBoundsOfCommonOuterBorder(attribute, pathTheme, tb1), aabbBounds.union(tb1),
|
|
49
|
+
tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
|
|
50
|
+
const {lineJoin: lineJoin = pathTheme.lineJoin} = attribute;
|
|
51
|
+
return application.graphicService.transformAABBBounds(attribute, aabbBounds, pathTheme, "miter" === lineJoin, this),
|
|
52
|
+
aabbBounds;
|
|
44
53
|
}
|
|
45
54
|
doUpdatePathShape() {
|
|
46
55
|
const attribute = this.attribute;
|
|
47
56
|
isString(attribute.path, !0) ? this.cache = (new CustomPath2D).fromString(attribute.path) : attribute.customPath && (this.cache = new CustomPath2D,
|
|
48
57
|
attribute.customPath(this.cache, this));
|
|
49
58
|
}
|
|
50
|
-
getDefaultAttribute(name) {
|
|
51
|
-
return getTheme(this).path[name];
|
|
52
|
-
}
|
|
53
59
|
needUpdateTags(keys) {
|
|
54
60
|
return super.needUpdateTags(keys, PATH_UPDATE_TAG_KEY);
|
|
55
61
|
}
|
package/es/graphic/path.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graphic/path.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEjF,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"sources":["../src/graphic/path.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,sBAAsB,E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';\nimport { isString, isNil } from '@visactor/vutils';\nimport { Graphic, GRAPHIC_UPDATE_TAG_KEY, NOWORK_ANIMATE_ATTR } from './graphic';\nimport type { ICustomPath2D, IPath, IPathGraphicAttribute } from '../interface';\nimport { CustomPath2D } from '../common/custom-path2d';\nimport { getTheme } from './theme';\nimport { application } from '../application';\nimport { PATH_NUMBER_TYPE } from './constants';\nimport { updateBoundsOfCommonOuterBorder } from './graphic-service/common-outer-boder-bounds';\n\nconst PATH_UPDATE_TAG_KEY = ['path', 'customPath', ...GRAPHIC_UPDATE_TAG_KEY];\n\nexport class Path extends Graphic<IPathGraphicAttribute> implements IPath {\n type: 'path' = 'path';\n cache?: ICustomPath2D;\n\n static NOWORK_ANIMATE_ATTR = {\n path: 1,\n customPath: 1,\n ...NOWORK_ANIMATE_ATTR\n };\n\n constructor(params: IPathGraphicAttribute) {\n super(params);\n this.numberType = PATH_NUMBER_TYPE;\n }\n\n get pathShape(): ICustomPath2D {\n this.tryUpdateAABBBounds();\n return this.getParsedPathShape();\n }\n\n isValid(): boolean {\n return super.isValid() && this._isValid();\n }\n private _isValid(): boolean {\n const { path } = this.attribute;\n return path != null && path !== '';\n }\n\n getParsedPathShape(): CustomPath2D {\n const pathTheme = this.getGraphicTheme();\n if (!this.valid) {\n return pathTheme.path as CustomPath2D;\n }\n const attribute = this.attribute;\n if (attribute.path instanceof CustomPath2D) {\n return attribute.path;\n }\n\n if (isNil(this.cache)) {\n this.doUpdatePathShape();\n }\n\n if (this.cache instanceof CustomPath2D) {\n return this.cache;\n }\n return pathTheme.path as CustomPath2D;\n }\n\n getGraphicTheme(): Required<IPathGraphicAttribute> {\n return getTheme(this).path;\n }\n\n protected updateAABBBounds(\n attribute: IPathGraphicAttribute,\n pathTheme: Required<IPathGraphicAttribute>,\n aabbBounds: IAABBBounds\n ) {\n if (!application.graphicService.validCheck(attribute, pathTheme, aabbBounds, this)) {\n return aabbBounds;\n }\n if (!this.updatePathProxyAABBBounds(aabbBounds)) {\n const pathShape = this.getParsedPathShape();\n aabbBounds.union(pathShape.getBounds());\n }\n\n const { tb1, tb2 } = application.graphicService.updateTempAABBBounds(aabbBounds);\n\n updateBoundsOfCommonOuterBorder(attribute, pathTheme, tb1);\n aabbBounds.union(tb1);\n tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);\n const { lineJoin = pathTheme.lineJoin } = attribute;\n application.graphicService.transformAABBBounds(attribute, aabbBounds, pathTheme, lineJoin === 'miter', this);\n return aabbBounds;\n }\n\n protected doUpdatePathShape() {\n const attribute = this.attribute;\n if (isString(attribute.path, true)) {\n this.cache = new CustomPath2D().fromString(attribute.path as string);\n } else if (attribute.customPath) {\n this.cache = new CustomPath2D();\n attribute.customPath(this.cache, this);\n }\n }\n\n protected needUpdateTags(keys: string[]): boolean {\n return super.needUpdateTags(keys, PATH_UPDATE_TAG_KEY);\n }\n protected needUpdateTag(key: string): boolean {\n return super.needUpdateTag(key, PATH_UPDATE_TAG_KEY);\n }\n\n toCustomPath() {\n const x = 0;\n const y = 0;\n\n return new CustomPath2D().fromCustomPath2D(this.getParsedPathShape(), x, y);\n }\n\n clone() {\n return new Path({ ...this.attribute });\n }\n\n getNoWorkAnimateAttr(): Record<string, number> {\n return Path.NOWORK_ANIMATE_ATTR;\n }\n}\n\nexport function createPath(attributes: IPathGraphicAttribute): IPath {\n return new Path(attributes);\n}\n"]}
|
package/es/graphic/polygon.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IAABBBounds } from '@visactor/vutils';
|
|
2
2
|
import { Graphic } from './graphic';
|
|
3
3
|
import type { IPolygon, IPolygonGraphicAttribute } from '../interface/graphic/polygon';
|
|
4
4
|
import { CustomPath2D } from '../common/custom-path2d';
|
|
@@ -38,9 +38,10 @@ export declare class Polygon extends Graphic<IPolygonGraphicAttribute> implement
|
|
|
38
38
|
constructor(params: IPolygonGraphicAttribute);
|
|
39
39
|
isValid(): boolean;
|
|
40
40
|
protected _isValid(): boolean;
|
|
41
|
-
|
|
41
|
+
getGraphicTheme(): Required<IPolygonGraphicAttribute>;
|
|
42
|
+
protected updateAABBBounds(attribute: IPolygonGraphicAttribute, polygonTheme: Required<IPolygonGraphicAttribute>, aabbBounds: IAABBBounds): import("@visactor/vutils").IBounds;
|
|
43
|
+
protected updatePolygonAABBBoundsImprecise(attribute: IPolygonGraphicAttribute, polygonTheme: Required<IPolygonGraphicAttribute>, aabbBounds: IAABBBounds): IAABBBounds;
|
|
42
44
|
protected _interpolate(key: string, ratio: number, lastStepVal: any, nextStepVal: any, nextAttributes: any): void;
|
|
43
|
-
getDefaultAttribute(name: string): any;
|
|
44
45
|
protected needUpdateTags(keys: string[]): boolean;
|
|
45
46
|
protected needUpdateTag(key: string): boolean;
|
|
46
47
|
toCustomPath(): CustomPath2D;
|
package/es/graphic/polygon.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Graphic, GRAPHIC_UPDATE_TAG_KEY, NOWORK_ANIMATE_ATTR } from "./graphic"
|
|
|
2
2
|
|
|
3
3
|
import { getTheme } from "./theme";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { pointsInterpolation } from "../common/utils";
|
|
6
6
|
|
|
7
7
|
import { CustomPath2D } from "../common/custom-path2d";
|
|
8
8
|
|
|
@@ -23,19 +23,26 @@ export class Polygon extends Graphic {
|
|
|
23
23
|
const {points: points} = this.attribute;
|
|
24
24
|
return points && points.length >= 2;
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
this.
|
|
26
|
+
getGraphicTheme() {
|
|
27
|
+
return getTheme(this).polygon;
|
|
28
|
+
}
|
|
29
|
+
updateAABBBounds(attribute, polygonTheme, aabbBounds) {
|
|
30
|
+
if (!application.graphicService.validCheck(attribute, polygonTheme, aabbBounds, this)) return aabbBounds;
|
|
31
|
+
this.updatePathProxyAABBBounds(aabbBounds) || this.updatePolygonAABBBoundsImprecise(attribute, polygonTheme, aabbBounds),
|
|
32
|
+
application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
33
|
+
const {lineJoin: lineJoin = polygonTheme.lineJoin} = attribute;
|
|
34
|
+
return application.graphicService.transformAABBBounds(attribute, aabbBounds, polygonTheme, "miter" === lineJoin, this),
|
|
35
|
+
aabbBounds;
|
|
36
|
+
}
|
|
37
|
+
updatePolygonAABBBoundsImprecise(attribute, polygonTheme, aabbBounds) {
|
|
38
|
+
const {points: points = polygonTheme.points} = attribute;
|
|
39
|
+
return points.forEach((p => {
|
|
40
|
+
aabbBounds.add(p.x, p.y);
|
|
41
|
+
})), aabbBounds;
|
|
32
42
|
}
|
|
33
43
|
_interpolate(key, ratio, lastStepVal, nextStepVal, nextAttributes) {
|
|
34
44
|
"points" === key && (nextAttributes.points = pointsInterpolation(lastStepVal, nextStepVal, ratio));
|
|
35
45
|
}
|
|
36
|
-
getDefaultAttribute(name) {
|
|
37
|
-
return getTheme(this).polygon[name];
|
|
38
|
-
}
|
|
39
46
|
needUpdateTags(keys) {
|
|
40
47
|
return super.needUpdateTags(keys, POLYGON_UPDATE_TAG_KEY);
|
|
41
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graphic/polygon.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEjF,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"sources":["../src/graphic/polygon.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEjF,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC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AC,CAAC;aAC/B;QACH,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,SAAS,EAAE,CAAC;QAEjB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK;QACH,OAAO,IAAI,OAAO,mBAAM,IAAI,CAAC,SAAS,EAAG,CAAC;IAC5C,CAAC;IAED,oBAAoB;QAClB,OAAO,OAAO,CAAC,mBAAmB,CAAC;IACrC,CAAC;;AArFM,2BAAmB,GAAG,mBAAmB,CAAC;AAwFnD,MAAM,UAAU,aAAa,CAAC,UAAoC;IAChE,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;AACjC,CAAC","file":"polygon.js","sourcesContent":["import type { IAABBBounds } from '@visactor/vutils';\nimport { Graphic, GRAPHIC_UPDATE_TAG_KEY, NOWORK_ANIMATE_ATTR } from './graphic';\nimport type { IPolygon, IPolygonGraphicAttribute } from '../interface/graphic/polygon';\nimport { getTheme } from './theme';\nimport { pointsInterpolation } from '../common/utils';\nimport { CustomPath2D } from '../common/custom-path2d';\nimport { application } from '../application';\nimport type { GraphicType } from '../interface';\nimport { POLYGON_NUMBER_TYPE } from './constants';\n\nconst POLYGON_UPDATE_TAG_KEY = ['points', 'cornerRadius', ...GRAPHIC_UPDATE_TAG_KEY];\n\nexport class Polygon extends Graphic<IPolygonGraphicAttribute> implements IPolygon {\n type: GraphicType = 'polygon';\n\n static NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;\n\n constructor(params: IPolygonGraphicAttribute) {\n super(params);\n this.numberType = POLYGON_NUMBER_TYPE;\n }\n\n isValid(): boolean {\n return super.isValid() && this._isValid();\n }\n protected _isValid(): boolean {\n const { points } = this.attribute;\n return points && points.length >= 2;\n }\n\n getGraphicTheme(): Required<IPolygonGraphicAttribute> {\n return getTheme(this).polygon;\n }\n\n protected updateAABBBounds(\n attribute: IPolygonGraphicAttribute,\n polygonTheme: Required<IPolygonGraphicAttribute>,\n aabbBounds: IAABBBounds\n ) {\n if (!application.graphicService.validCheck(attribute, polygonTheme, aabbBounds, this)) {\n return aabbBounds;\n }\n if (!this.updatePathProxyAABBBounds(aabbBounds)) {\n this.updatePolygonAABBBoundsImprecise(attribute, polygonTheme, aabbBounds);\n }\n application.graphicService.updateTempAABBBounds(aabbBounds);\n\n const { lineJoin = polygonTheme.lineJoin } = attribute;\n application.graphicService.transformAABBBounds(attribute, aabbBounds, polygonTheme, lineJoin === 'miter', this);\n return aabbBounds;\n }\n\n protected updatePolygonAABBBoundsImprecise(\n attribute: IPolygonGraphicAttribute,\n polygonTheme: Required<IPolygonGraphicAttribute>,\n aabbBounds: IAABBBounds\n ): IAABBBounds {\n const { points = polygonTheme.points } = attribute;\n points.forEach(p => {\n aabbBounds.add(p.x, p.y);\n });\n\n return aabbBounds;\n }\n\n protected _interpolate(key: string, ratio: number, lastStepVal: any, nextStepVal: any, nextAttributes: any): void {\n if (key === 'points') {\n (nextAttributes as any).points = pointsInterpolation(lastStepVal, nextStepVal, ratio);\n }\n }\n\n protected needUpdateTags(keys: string[]): boolean {\n return super.needUpdateTags(keys, POLYGON_UPDATE_TAG_KEY);\n }\n protected needUpdateTag(key: string): boolean {\n return super.needUpdateTag(key, POLYGON_UPDATE_TAG_KEY);\n }\n\n toCustomPath() {\n const points = this.attribute.points;\n const path = new CustomPath2D();\n\n points.forEach((point, index) => {\n if (index === 0) {\n path.moveTo(point.x, point.y);\n } else {\n path.lineTo(point.x, point.y);\n }\n });\n path.closePath();\n\n return path;\n }\n\n clone() {\n return new Polygon({ ...this.attribute });\n }\n\n getNoWorkAnimateAttr(): Record<string, number> {\n return Polygon.NOWORK_ANIMATE_ATTR;\n }\n}\n\nexport function createPolygon(attributes: IPolygonGraphicAttribute): IPolygon {\n return new Polygon(attributes);\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IAABBBounds } from '@visactor/vutils';
|
|
2
2
|
import type { GraphicType, IPyramid3d, IPyramid3dGraphicAttribute } from '../interface';
|
|
3
3
|
import type { IFace3d } from '../interface/graphic/face3d';
|
|
4
4
|
import { Polygon } from './polygon';
|
|
@@ -36,7 +36,7 @@ export declare class Pyramid3d extends Polygon implements IPyramid3d {
|
|
|
36
36
|
html: number;
|
|
37
37
|
};
|
|
38
38
|
constructor(params: IPyramid3dGraphicAttribute);
|
|
39
|
-
protected
|
|
39
|
+
protected updateAABBBounds(attribute: IPyramid3dGraphicAttribute, polygonTheme: Required<IPyramid3dGraphicAttribute>, aabbBounds: IAABBBounds): import("@visactor/vutils").IBounds;
|
|
40
40
|
findFace(): IFace3d;
|
|
41
41
|
protected _isValid(): boolean;
|
|
42
42
|
getNoWorkAnimateAttr(): Record<string, number>;
|
package/es/graphic/pyramid3d.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { max, PointService } from "@visactor/vutils";
|
|
2
2
|
|
|
3
|
-
import { parsePadding } from "../common/utils";
|
|
4
|
-
|
|
5
3
|
import { application } from "../application";
|
|
6
4
|
|
|
7
5
|
import { Polygon } from "./polygon";
|
|
8
6
|
|
|
9
|
-
import { getTheme } from "./theme";
|
|
10
|
-
|
|
11
7
|
import { PYRAMID3D_NUMBER_TYPE } from "./constants";
|
|
12
8
|
|
|
13
9
|
import { NOWORK_ANIMATE_ATTR } from "./graphic";
|
|
@@ -16,12 +12,14 @@ export class Pyramid3d extends Polygon {
|
|
|
16
12
|
constructor(params) {
|
|
17
13
|
super(params), this.type = "pyramid3d", this.numberType = PYRAMID3D_NUMBER_TYPE;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
updateAABBBounds(attribute, polygonTheme, aabbBounds) {
|
|
16
|
+
const stage = this.stage;
|
|
17
|
+
if (!stage || !stage.camera) return aabbBounds;
|
|
18
|
+
return this.findFace().vertices.forEach((v => {
|
|
19
|
+
const x = v[0], y = v[1];
|
|
20
|
+
aabbBounds.add(x, y);
|
|
21
|
+
})), application.graphicService.updateTempAABBBounds(aabbBounds), application.graphicService.transformAABBBounds(attribute, aabbBounds, polygonTheme, !1, this),
|
|
22
|
+
aabbBounds;
|
|
25
23
|
}
|
|
26
24
|
findFace() {
|
|
27
25
|
const {points: points} = this.attribute, kList = points.map(((p, i) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graphic/pyramid3d.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/graphic/pyramid3d.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEhD,MAAM,OAAO,SAAU,SAAQ,OAAO;IAMpC,YAAY,MAAkC;QAC5C,KAAK,CAAC,MAAM,CAAC,CAAC;QANhB,SAAI,GAAgB,WAAW,CAAC;QAO9B,IAAI,CAAC,UAAU,GAAG,qBAAqB,CAAC;IAC1C,CAAC;IAES,gBAAgB,CACxB,SAAqC,EACrC,YAAkD,EAClD,UAAuB;QAEvB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;YAC3B,OAAO,UAAU,CAAC;SACnB;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE9B,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YACzB,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YACf,MAAM,CAAC,GAAG,CAAC,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MAAM,KAAK,CAAC,CAAC;IAChE,CAAC;IAED,oBAAoB;QAClB,OAAO,SAAS,CAAC,mBAAmB,CAAC;IACvC,CAAC;;AA3HM,6BAAmB,GAAG,mBAAmB,CAAC;AA8HnD,MAAM,UAAU,eAAe,CAAC,UAAsC;IACpE,OAAO,IAAI,SAAS,CAAC,UAAU,CAAC,CAAC;AACnC,CAAC","file":"pyramid3d.js","sourcesContent":["import type { IAABBBounds, IPointLike } from '@visactor/vutils';\nimport { max, PointService } from '@visactor/vutils';\nimport type { GraphicType, IPyramid3d, IPyramid3dGraphicAttribute } from '../interface';\nimport type { IFace3d } from '../interface/graphic/face3d';\nimport { application } from '../application';\nimport { Polygon } from './polygon';\nimport { PYRAMID3D_NUMBER_TYPE } from './constants';\nimport { NOWORK_ANIMATE_ATTR } from './graphic';\n\nexport class Pyramid3d extends Polygon implements IPyramid3d {\n type: GraphicType = 'pyramid3d';\n declare attribute: IPyramid3dGraphicAttribute;\n\n static NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;\n\n constructor(params: IPyramid3dGraphicAttribute) {\n super(params);\n this.numberType = PYRAMID3D_NUMBER_TYPE;\n }\n\n protected updateAABBBounds(\n attribute: IPyramid3dGraphicAttribute,\n polygonTheme: Required<IPyramid3dGraphicAttribute>,\n aabbBounds: IAABBBounds\n ) {\n const stage = this.stage;\n if (!stage || !stage.camera) {\n return aabbBounds;\n }\n\n const faces = this.findFace();\n // const outP = [0, 0, 0];\n faces.vertices.forEach(v => {\n const x = v[0];\n const y = v[1];\n aabbBounds.add(x, y);\n });\n application.graphicService.updateTempAABBBounds(aabbBounds);\n application.graphicService.transformAABBBounds(attribute, aabbBounds, polygonTheme, false, this);\n return aabbBounds;\n }\n\n findFace(): IFace3d {\n const { points } = this.attribute;\n // 找到斜率相同的两条边\n const kList = points.map((p, i) => {\n const p1 = i === 3 ? points[0] : points[i + 1];\n const dx = p.x - p1.x;\n if (dx === 0) {\n return 0;\n }\n return (p.y - p1.y) / dx;\n });\n\n const pointsMap: { p: IPointLike; d: number }[] = points.map(p => ({ p, d: 0 }));\n let find = false;\n let maxD = 0;\n for (let i = 0; i < kList.length - 1; i++) {\n for (let j = i + 1; j < kList.length; j++) {\n if (kList[i] === kList[j]) {\n find = true;\n const d1 = PointService.distancePP(pointsMap[i].p, pointsMap[i + 1].p);\n pointsMap[i].d = d1;\n pointsMap[i + 1].d = d1;\n maxD = max(maxD, d1);\n const d2 = PointService.distancePP(pointsMap[j].p, pointsMap[j + 1].p);\n pointsMap[j].d = d2;\n pointsMap[j + 1].d = d2;\n maxD = max(maxD, d2);\n }\n if (find) {\n break;\n }\n }\n if (find) {\n break;\n }\n }\n\n for (let i = points.length - 1; i >= 0; i--) {\n const p = points[i];\n pointsMap.unshift({\n p,\n d: 0\n });\n }\n\n for (let i = 0; i < points.length; i++) {\n const delta = (maxD - pointsMap[i + points.length].d) / 2;\n pointsMap[i].d += delta;\n pointsMap[i + points.length].d += delta;\n }\n\n const faces: IFace3d = { polygons: [], vertices: [], edges: [] };\n\n pointsMap.forEach(p => {\n faces.vertices.push([p.p.x, p.p.y, p.d]);\n });\n\n // 上\n faces.polygons.push({ polygon: [0, 4, 5, 1], normal: [0, -1, 0] });\n // 下\n faces.polygons.push({ polygon: [7, 6, 2, 3], normal: [0, 1, 0] });\n // 左\n faces.polygons.push({ polygon: [0, 4, 7, 3], normal: [-1, 0, 0] });\n // 右\n faces.polygons.push({ polygon: [1, 5, 6, 2], normal: [1, 0, 0] });\n // 前\n faces.polygons.push({ polygon: [0, 1, 2, 3], normal: [0, 0, -1] });\n // 后\n faces.polygons.push({ polygon: [4, 5, 6, 7], normal: [0, 0, 1] });\n\n faces.edges = [\n [0, 1],\n [1, 2],\n [2, 3],\n [3, 0],\n [4, 5],\n [5, 6],\n [6, 7],\n [7, 4],\n [0, 4],\n [3, 7],\n [1, 5],\n [2, 6]\n ];\n\n return faces;\n }\n\n protected _isValid(): boolean {\n return super._isValid() && this.attribute.points.length === 4;\n }\n\n getNoWorkAnimateAttr(): Record<string, number> {\n return Pyramid3d.NOWORK_ANIMATE_ATTR;\n }\n}\n\nexport function createPyramid3d(attributes: IPyramid3dGraphicAttribute): IPyramid3d {\n return new Pyramid3d(attributes);\n}\n"]}
|
package/es/graphic/rect.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IAABBBounds } from '@visactor/vutils';
|
|
2
2
|
import { Graphic } from './graphic';
|
|
3
3
|
import type { GraphicType, ICustomPath2D, IRect, IRectGraphicAttribute } from '../interface';
|
|
4
4
|
export declare class Rect extends Graphic<IRectGraphicAttribute> implements IRect {
|
|
@@ -36,8 +36,8 @@ export declare class Rect extends Graphic<IRectGraphicAttribute> implements IRec
|
|
|
36
36
|
constructor(params: IRectGraphicAttribute);
|
|
37
37
|
isValid(): boolean;
|
|
38
38
|
private _isValid;
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
getGraphicTheme(): Required<IRectGraphicAttribute>;
|
|
40
|
+
protected updateAABBBounds(attribute: IRectGraphicAttribute, rectTheme: Required<IRectGraphicAttribute>, aabbBounds: IAABBBounds): import("@visactor/vutils").IBounds;
|
|
41
41
|
protected needUpdateTags(keys: string[]): boolean;
|
|
42
42
|
protected needUpdateTag(key: string): boolean;
|
|
43
43
|
toCustomPath(): ICustomPath2D;
|
package/es/graphic/rect.js
CHANGED
|
@@ -2,8 +2,6 @@ import { Graphic, GRAPHIC_UPDATE_TAG_KEY, NOWORK_ANIMATE_ATTR } from "./graphic"
|
|
|
2
2
|
|
|
3
3
|
import { CustomPath2D } from "../common/custom-path2d";
|
|
4
4
|
|
|
5
|
-
import { parsePadding } from "../common/utils";
|
|
6
|
-
|
|
7
5
|
import { getTheme } from "./theme";
|
|
8
6
|
|
|
9
7
|
import { application } from "../application";
|
|
@@ -12,6 +10,8 @@ import { RECT_NUMBER_TYPE } from "./constants";
|
|
|
12
10
|
|
|
13
11
|
import { normalizeRectAttributes } from "../common/rect-utils";
|
|
14
12
|
|
|
13
|
+
import { updateBoundsOfCommonOuterBorder } from "./graphic-service/common-outer-boder-bounds";
|
|
14
|
+
|
|
15
15
|
const RECT_UPDATE_TAG_KEY = [ "width", "x1", "y1", "height", "cornerRadius", ...GRAPHIC_UPDATE_TAG_KEY ];
|
|
16
16
|
|
|
17
17
|
export class Rect extends Graphic {
|
|
@@ -24,15 +24,21 @@ export class Rect extends Graphic {
|
|
|
24
24
|
_isValid() {
|
|
25
25
|
return !0;
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
this._AABBBounds.clear();
|
|
30
|
-
const attribute = this.attribute, bounds = application.graphicService.updateRectAABBBounds(attribute, getTheme(this).rect, this._AABBBounds, this), {boundsPadding: boundsPadding = rectTheme.boundsPadding} = attribute, paddingArray = parsePadding(boundsPadding);
|
|
31
|
-
return paddingArray && bounds.expand(paddingArray), this.clearUpdateBoundTag(),
|
|
32
|
-
bounds;
|
|
27
|
+
getGraphicTheme() {
|
|
28
|
+
return getTheme(this).rect;
|
|
33
29
|
}
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
updateAABBBounds(attribute, rectTheme, aabbBounds) {
|
|
31
|
+
if (!application.graphicService.validCheck(attribute, rectTheme, aabbBounds, this)) return aabbBounds;
|
|
32
|
+
if (!this.updatePathProxyAABBBounds(aabbBounds)) {
|
|
33
|
+
let {width: width, height: height} = attribute;
|
|
34
|
+
const {x1: x1, y1: y1, x: x, y: y} = attribute;
|
|
35
|
+
width = null != width ? width : x1 - x, height = null != height ? height : y1 - y,
|
|
36
|
+
(isFinite(width) || isFinite(height) || isFinite(x) || isFinite(y)) && aabbBounds.set(0, 0, width || 0, height || 0);
|
|
37
|
+
}
|
|
38
|
+
const {tb1: tb1, tb2: tb2} = application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
39
|
+
return updateBoundsOfCommonOuterBorder(attribute, rectTheme, tb1), aabbBounds.union(tb1),
|
|
40
|
+
tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), application.graphicService.transformAABBBounds(attribute, aabbBounds, rectTheme, !1, this),
|
|
41
|
+
aabbBounds;
|
|
36
42
|
}
|
|
37
43
|
needUpdateTags(keys) {
|
|
38
44
|
return super.needUpdateTags(keys, RECT_UPDATE_TAG_KEY);
|
package/es/graphic/rect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graphic/rect.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEjF,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"sources":["../src/graphic/rect.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEjF,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,+BAA+B,EAAE,MAAM,6CAA6C,CAAC;AAE9F,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,sBAAsB,CAAC,CAAC;AAEvG,MAAM,OAAO,IAAK,SAAQ,OAA8B;IAKtD,YAAY,MAA6B;QACvC,KAAK,CAAC,MAAM,CAAC,CAAC;QALhB,SAAI,GAAgB,MAAM,CAAC;QAMzB,IAAI,CAAC,UAAU,GAAG,gBAAgB,CAAC;IACrC,CAAC;IAED,OAAO;QACL,OAAO,KAAK,CAAC,OAAO,EAAE,IAAI,I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IMATE_ATTR } from './graphic';\nimport type { GraphicType, ICustomPath2D, IRect, IRectGraphicAttribute } from '../interface';\nimport { CustomPath2D } from '../common/custom-path2d';\nimport { getTheme } from './theme';\nimport { application } from '../application';\nimport { RECT_NUMBER_TYPE } from './constants';\nimport { normalizeRectAttributes } from '../common/rect-utils';\nimport { updateBoundsOfCommonOuterBorder } from './graphic-service/common-outer-boder-bounds';\n\nconst RECT_UPDATE_TAG_KEY = ['width', 'x1', 'y1', 'height', 'cornerRadius', ...GRAPHIC_UPDATE_TAG_KEY];\n\nexport class Rect extends Graphic<IRectGraphicAttribute> implements IRect {\n type: GraphicType = 'rect';\n\n static NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;\n\n constructor(params: IRectGraphicAttribute) {\n super(params);\n this.numberType = RECT_NUMBER_TYPE;\n }\n\n isValid(): boolean {\n return super.isValid() && this._isValid();\n }\n private _isValid(): boolean {\n return true;\n // 暂时不判断,理论上认为都是合法的,节省性能耗时\n // const { width, x1, y1, height } = this.attribute;\n // return (this._validNumber(width) || this._validNumber(x1)) && (this._validNumber(height) || this._validNumber(y1));\n }\n\n getGraphicTheme(): Required<IRectGraphicAttribute> {\n return getTheme(this).rect;\n }\n\n protected updateAABBBounds(\n attribute: IRectGraphicAttribute,\n rectTheme: Required<IRectGraphicAttribute>,\n aabbBounds: IAABBBounds\n ) {\n if (!application.graphicService.validCheck(attribute, rectTheme, aabbBounds, this)) {\n return aabbBounds;\n }\n if (!this.updatePathProxyAABBBounds(aabbBounds)) {\n let { width, height } = attribute;\n const { x1, y1, x, y } = attribute;\n width = width ?? x1 - x;\n height = height ?? y1 - y;\n if (isFinite(width) || isFinite(height) || isFinite(x) || isFinite(y)) {\n aabbBounds.set(0, 0, width || 0, height || 0);\n }\n }\n\n const { tb1, tb2 } = application.graphicService.updateTempAABBBounds(aabbBounds);\n\n updateBoundsOfCommonOuterBorder(attribute, rectTheme, tb1);\n aabbBounds.union(tb1);\n tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);\n\n application.graphicService.transformAABBBounds(attribute, aabbBounds, rectTheme, false, this);\n return aabbBounds;\n }\n\n protected needUpdateTags(keys: string[]): boolean {\n return super.needUpdateTags(keys, RECT_UPDATE_TAG_KEY);\n }\n protected needUpdateTag(key: string): boolean {\n return super.needUpdateTag(key, RECT_UPDATE_TAG_KEY);\n }\n\n toCustomPath(): ICustomPath2D {\n // throw new Error('暂不支持');\n const attribute = this.attribute;\n const { x, y, width, height } = normalizeRectAttributes(attribute);\n\n const path = new CustomPath2D();\n path.moveTo(x, y);\n path.rect(x, y, width, height);\n\n return path;\n }\n\n clone() {\n return new Rect({ ...this.attribute });\n }\n\n getNoWorkAnimateAttr(): Record<string, number> {\n return Rect.NOWORK_ANIMATE_ATTR;\n }\n}\n\nexport function createRect(attributes: IRectGraphicAttribute): IRect {\n return new Rect(attributes);\n}\n"]}
|
package/es/graphic/rect3d.js
CHANGED
|
@@ -2,8 +2,6 @@ import { min } from "@visactor/vutils";
|
|
|
2
2
|
|
|
3
3
|
import { Rect } from "./rect";
|
|
4
4
|
|
|
5
|
-
import { getTheme } from "./theme";
|
|
6
|
-
|
|
7
5
|
import { RECT3D_NUMBER_TYPE } from "./constants";
|
|
8
6
|
|
|
9
7
|
import { NOWORK_ANIMATE_ATTR } from "./graphic";
|
|
@@ -19,7 +17,7 @@ export class Rect3d extends Rect {
|
|
|
19
17
|
polygons: [],
|
|
20
18
|
vertices: [],
|
|
21
19
|
edges: []
|
|
22
|
-
}, rectTheme =
|
|
20
|
+
}, rectTheme = this.getGraphicTheme(), {x1: x1, y1: y1, x: x, y: y, length: length = min(rectTheme.width, rectTheme.height)} = this.attribute;
|
|
23
21
|
let {width: width, height: height} = this.attribute;
|
|
24
22
|
width = null != width ? width : x1 - x, height = null != height ? height : y1 - y;
|
|
25
23
|
for (let i = 0; i < CUBE_VERTICES.length; i++) {
|
package/es/graphic/rect3d.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
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,mBAAmB,CAAC;AAuDnD,MAAM,UAAU,YAAY,CAAC,UAAmC;IAC9D,OAAO,IAAI,MAAM,CAAC,UAAU,CAAC,CAAC;AAChC,CAAC","file":"rect3d.js","sourcesContent":["import { min } from '@visactor/vutils';\nimport type { GraphicType, IFace3d, IRect3d, IRect3dGraphicAttribute } from '../interface';\nimport { Rect } from './rect';\nimport { getTheme } from './theme';\nimport { RECT3D_NUMBER_TYPE } from './constants';\nimport { NOWORK_ANIMATE_ATTR } from './graphic';\n\nconst CUBE_VERTICES = [\n [0, 0, 0],\n [1, 0, 0],\n [1, 1, 0],\n [0, 1, 0],\n [0, 0, 1],\n [1, 0, 1],\n [1, 1, 1],\n [0, 1, 1]\n];\n\nexport class Rect3d extends Rect implements IRect3d {\n type: GraphicType = 'rect3d';\n declare attribute: IRect3dGraphicAttribute;\n\n static NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;\n\n constructor(params: IRect3dGraphicAttribute) {\n super(params);\n this.numberType = RECT3D_NUMBER_TYPE;\n }\n\n findFace(): IFace3d {\n const faces: IFace3d = { polygons: [], vertices: [], edges: [] };\n const rectTheme = this.getGraphicTheme();\n const { x1, y1, x, y, length = min(rectTheme.width, rectTheme.height) } = this.attribute;\n let { width, height } = this.attribute;\n width = width ?? x1 - x;\n height = height ?? y1 - y;\n for (let i = 0; i < CUBE_VERTICES.length; i++) {\n const v = CUBE_VERTICES[i];\n faces.vertices.push([v[0] * width, v[1] * height, v[2] * length]);\n }\n\n // 上\n faces.polygons.push({ polygon: [0, 1, 5, 4], normal: [0, -1, 0] });\n // 下\n faces.polygons.push({ polygon: [2, 3, 7, 6], normal: [0, 1, 0] });\n // 左\n faces.polygons.push({ polygon: [4, 7, 3, 0], normal: [-1, 0, 0] });\n // 右\n faces.polygons.push({ polygon: [1, 2, 6, 5], normal: [1, 0, 0] });\n // 前\n faces.polygons.push({ polygon: [0, 1, 2, 3], normal: [0, 0, -1] });\n // 后\n faces.polygons.push({ polygon: [4, 5, 6, 7], normal: [0, 0, 1] });\n\n faces.edges = [\n [0, 1],\n [1, 2],\n [2, 3],\n [3, 0],\n [4, 5],\n [5, 6],\n [6, 7],\n [7, 4],\n [0, 4],\n [3, 7],\n [1, 5],\n [2, 6]\n ];\n\n return faces;\n }\n\n getNoWorkAnimateAttr(): Record<string, number> {\n return Rect3d.NOWORK_ANIMATE_ATTR;\n }\n}\n\nexport function createRect3d(attributes: IRect3dGraphicAttribute): IRect3d {\n return new Rect3d(attributes);\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IAABBBounds } from '@visactor/vutils';
|
|
2
2
|
import type { ICustomPath2D, IRichTextIcon, IRichTextIconGraphicAttribute } from '../../interface';
|
|
3
3
|
import { Image } from '../image';
|
|
4
4
|
export declare class RichTextIcon extends Image implements IRichTextIcon {
|
|
@@ -19,6 +19,6 @@ export declare class RichTextIcon extends Image implements IRichTextIcon {
|
|
|
19
19
|
toCustomPath?: (() => ICustomPath2D) | undefined;
|
|
20
20
|
get width(): number;
|
|
21
21
|
get height(): number;
|
|
22
|
-
protected tryUpdateAABBBounds():
|
|
22
|
+
protected tryUpdateAABBBounds(): IAABBBounds;
|
|
23
23
|
setHoverState(hovered: boolean): void;
|
|
24
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graphic/richtext/icon.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIlD,MAAM,OAAO,YAAa,SAAQ,KAAK;IAYrC,YAAY,MAAqC;QAC/C,KAAK,CAAC,MAAM,CAAC,CAAC;QANhB,OAAE,GAAW,CAAC,CAAC;QACf,OAAE,GAAW,CAAC,CA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,IAAI,IAAI,CAAC,QAAQ,KAAK,OAAO,EAAE;YAC9E,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;SACzB;IACH,CAAC;CACF","file":"icon.js","sourcesContent":["import type { IAABBBounds } from '@visactor/vutils';\nimport { isArray } from '@visactor/vutils';\nimport type { ICustomPath2D, IRichTextIcon, IRichTextIconGraphicAttribute } from '../../interface';\nimport { Image } from '../image';\nimport { DefaultImageAttribute } from '../config';\nimport { parsePadding } from '../../common/utils';\n\n// export const IMAGE_NUMBER_TYPE = genNumberType();\n\nexport class RichTextIcon extends Image implements IRichTextIcon {\n // type: 'richtext-icon' = 'richtext-icon';\n declare attribute: IRichTextIconGraphicAttribute;\n richtextId?: string;\n // 全局坐标,供外部用户pick后使用\n globalX?: number;\n globalY?: number;\n _x: number = 0;\n _y: number = 0;\n _hovered: boolean = false;\n _marginArray: [number, number, number, number] = [0, 0, 0, 0];\n\n constructor(params: IRichTextIconGraphicAttribute) {\n super(params);\n\n if (params.backgroundShowMode === 'always') {\n this._hovered = true;\n }\n\n if (params.margin) {\n const marginArray = parsePadding(params.margin);\n if (typeof marginArray === 'number') {\n this._marginArray = [marginArray, marginArray, marginArray, marginArray];\n } else {\n this._marginArray = marginArray;\n }\n }\n\n this.onBeforeAttributeUpdate = (val: any, attributes: any, key: null | string | string[]) => {\n if ((isArray(key) && key.indexOf('margin') !== -1) || key === 'margin') {\n if (attributes.margin) {\n const marginArray = parsePadding(attributes.margin);\n if (typeof marginArray === 'number') {\n this._marginArray = [marginArray, marginArray, marginArray, marginArray];\n } else {\n this._marginArray = marginArray;\n }\n } else {\n this._marginArray = [0, 0, 0, 0];\n }\n }\n return undefined;\n };\n }\n animationBackUps?: { from: Record<string, any>; to: Record<string, any> } | undefined;\n incrementalAt?: number | undefined;\n toCustomPath?: (() => ICustomPath2D) | undefined;\n\n get width(): number {\n return (this.attribute.width ?? 0) + this._marginArray[1] + this._marginArray[3];\n }\n\n get height(): number {\n return (this.attribute.height ?? 0) + this._marginArray[0] + this._marginArray[2];\n }\n\n protected tryUpdateAABBBounds(): IAABBBounds {\n if (!this.shouldUpdateAABBBounds()) {\n return this._AABBBounds;\n }\n\n this.doUpdateAABBBounds();\n\n // 扩大范围\n const { width = DefaultImageAttribute.width, height = DefaultImageAttribute.height } = this.attribute;\n const { backgroundWidth = width, backgroundHeight = height } = this.attribute;\n const expandX = (backgroundWidth - width) / 2;\n const expandY = (backgroundHeight - height) / 2;\n (this._AABBBounds as any).expand([0, expandX * 2, expandY * 2, 0]);\n\n return this._AABBBounds;\n }\n\n setHoverState(hovered: boolean) {\n if (this.attribute.backgroundShowMode === 'hover' && this._hovered !== hovered) {\n this._hovered = hovered;\n }\n }\n}\n"]}
|
|
@@ -40,11 +40,7 @@ const regPunctuation = /[.?!,;:/,。?!、;:]/;
|
|
|
40
40
|
|
|
41
41
|
export const regFirstSpace = /\S/;
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
const fillStyle = character && character.fill || defaultFormatting.fill;
|
|
45
|
-
if (!fillStyle) return void (ctx.globalAlpha = 0);
|
|
46
|
-
const {fillOpacity: fillOpacity = 1, opacity: opacity = 1} = character;
|
|
47
|
-
ctx.globalAlpha = fillOpacity * opacity, ctx.fillStyle = fillStyle;
|
|
43
|
+
const setTextStyle = (ctx, character) => {
|
|
48
44
|
let fontSize = character.fontSize || 16;
|
|
49
45
|
switch (character.script) {
|
|
50
46
|
case "super":
|
|
@@ -59,6 +55,13 @@ export function applyFillStyle(ctx, character) {
|
|
|
59
55
|
fontSize: fontSize,
|
|
60
56
|
fontFamily: character.fontFamily || "sans-serif"
|
|
61
57
|
});
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export function applyFillStyle(ctx, character) {
|
|
61
|
+
const fillStyle = character && character.fill || defaultFormatting.fill;
|
|
62
|
+
if (!fillStyle) return void (ctx.globalAlpha = 0);
|
|
63
|
+
const {fillOpacity: fillOpacity = 1, opacity: opacity = 1} = character;
|
|
64
|
+
ctx.globalAlpha = fillOpacity * opacity, ctx.fillStyle = fillStyle, setTextStyle(ctx, character);
|
|
62
65
|
}
|
|
63
66
|
|
|
64
67
|
export function applyStrokeStyle(ctx, character) {
|
|
@@ -66,21 +69,7 @@ export function applyStrokeStyle(ctx, character) {
|
|
|
66
69
|
if (!strokeStyle) return void (ctx.globalAlpha = 0);
|
|
67
70
|
const {strokeOpacity: strokeOpacity = 1, opacity: opacity = 1} = character;
|
|
68
71
|
ctx.globalAlpha = strokeOpacity * opacity, ctx.lineWidth = character && "number" == typeof character.lineWidth ? character.lineWidth : 1,
|
|
69
|
-
ctx.strokeStyle = strokeStyle;
|
|
70
|
-
let fontSize = character.fontSize || 16;
|
|
71
|
-
switch (character.script) {
|
|
72
|
-
case "super":
|
|
73
|
-
case "sub":
|
|
74
|
-
fontSize *= .8;
|
|
75
|
-
}
|
|
76
|
-
ctx.setTextStyle({
|
|
77
|
-
textAlign: "left",
|
|
78
|
-
textBaseline: character.textBaseline || "alphabetic",
|
|
79
|
-
fontStyle: character.fontStyle || "",
|
|
80
|
-
fontWeight: character.fontWeight || "",
|
|
81
|
-
fontSize: fontSize,
|
|
82
|
-
fontFamily: character.fontFamily || "sans-serif"
|
|
83
|
-
});
|
|
72
|
+
ctx.strokeStyle = strokeStyle, setTextStyle(ctx, character);
|
|
84
73
|
}
|
|
85
74
|
|
|
86
75
|
export function prepareContext(ctx) {
|