@visactor/vrender-core 0.19.19 → 0.20.0-alpha.1
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/bounds-allocate.js.map +1 -1
- 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/config.js +2 -1
- package/cjs/animate/custom-animate.d.ts +0 -14
- package/cjs/animate/custom-animate.js +2 -61
- 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/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 +51 -0
- package/cjs/common/3d-interceptor.js.map +1 -0
- package/cjs/common/Reflect-metadata.js +2 -1
- package/cjs/common/bounds-context.js +1 -2
- 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/morphing-utils.js +1 -1
- package/cjs/common/path-svg.js +1 -1
- package/cjs/common/polygon.js +2 -2
- package/cjs/common/rect-utils.js +1 -1
- package/cjs/common/render-area.js +1 -1
- package/cjs/common/render-command-list.js +1 -1
- package/cjs/common/render-curve.js +24 -33
- package/cjs/common/render-curve.js.map +1 -1
- package/cjs/common/render-utils.js +1 -1
- package/cjs/common/seg-context.js +1 -1
- package/cjs/common/seg-context.js.map +1 -1
- package/cjs/common/segment/index.d.ts +2 -4
- package/cjs/common/segment/index.js.map +1 -1
- package/cjs/common/simplify.js +1 -1
- package/cjs/common/sort.js +16 -13
- package/cjs/common/sort.js.map +1 -1
- package/cjs/common/split-path.js +1 -1
- package/cjs/common/store.js +1 -1
- package/cjs/common/text.d.ts +0 -2
- package/cjs/common/text.js +4 -11
- package/cjs/common/text.js.map +1 -1
- package/cjs/core/application.js +1 -2
- package/cjs/core/camera.d.ts +1 -0
- package/cjs/core/camera.js +11 -5
- package/cjs/core/camera.js.map +1 -1
- package/cjs/core/constants.js +1 -1
- package/cjs/core/core-modules.js +1 -1
- package/cjs/core/global-module.js +0 -2
- package/cjs/core/global.js +1 -1
- package/cjs/core/graphic-utils.js +1 -1
- package/cjs/core/graphic-utils.js.map +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/layer-service.js +1 -1
- package/cjs/core/layer.js +1 -1
- package/cjs/core/light.d.ts +1 -0
- package/cjs/core/light.js +9 -3
- package/cjs/core/light.js.map +1 -1
- package/cjs/core/stage.d.ts +1 -1
- package/cjs/core/stage.js +17 -8
- package/cjs/core/stage.js.map +1 -1
- package/cjs/core/window.js +1 -1
- package/cjs/factory.d.ts +5 -0
- package/cjs/factory.js +17 -0
- package/cjs/factory.js.map +1 -0
- package/cjs/graphic/arc.d.ts +1 -2
- package/cjs/graphic/arc.js +0 -3
- package/cjs/graphic/arc.js.map +1 -1
- package/cjs/graphic/area.d.ts +1 -2
- package/cjs/graphic/area.js +0 -3
- package/cjs/graphic/area.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 +1 -2
- package/cjs/graphic/circle.js +0 -3
- package/cjs/graphic/circle.js.map +1 -1
- package/cjs/graphic/glyph.d.ts +1 -2
- package/cjs/graphic/glyph.js +0 -3
- package/cjs/graphic/glyph.js.map +1 -1
- package/cjs/graphic/graphic-service/graphic-service.d.ts +2 -8
- package/cjs/graphic/graphic-service/graphic-service.js +11 -101
- package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
- package/cjs/graphic/graphic.d.ts +1 -4
- package/cjs/graphic/graphic.js +0 -3
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/graphic/group.d.ts +1 -2
- package/cjs/graphic/group.js +0 -3
- package/cjs/graphic/group.js.map +1 -1
- package/cjs/graphic/image.d.ts +1 -2
- package/cjs/graphic/image.js +0 -3
- package/cjs/graphic/image.js.map +1 -1
- package/cjs/graphic/index.js.map +1 -1
- package/cjs/graphic/line.d.ts +1 -2
- package/cjs/graphic/line.js +0 -3
- package/cjs/graphic/line.js.map +1 -1
- package/cjs/graphic/path.d.ts +1 -2
- package/cjs/graphic/path.js +0 -3
- package/cjs/graphic/path.js.map +1 -1
- package/cjs/graphic/polygon.d.ts +1 -2
- package/cjs/graphic/polygon.js +0 -3
- package/cjs/graphic/polygon.js.map +1 -1
- package/cjs/graphic/rect.d.ts +1 -2
- package/cjs/graphic/rect.js +0 -3
- package/cjs/graphic/rect.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 +1 -2
- package/cjs/graphic/richtext.js +0 -3
- package/cjs/graphic/richtext.js.map +1 -1
- package/cjs/graphic/symbol.d.ts +0 -2
- package/cjs/graphic/symbol.js +0 -3
- package/cjs/graphic/symbol.js.map +1 -1
- package/cjs/graphic/text.d.ts +1 -2
- package/cjs/graphic/text.js +1 -4
- package/cjs/graphic/text.js.map +1 -1
- package/cjs/index.d.ts +4 -1
- package/cjs/index.js +16 -15
- package/cjs/index.js.map +1 -1
- package/cjs/interface/graphic.d.ts +1 -2
- package/cjs/interface/graphic.js.map +1 -1
- package/cjs/picker/pick-interceptor.d.ts +1 -1
- package/cjs/picker/pick-interceptor.js +2 -42
- package/cjs/picker/pick-interceptor.js.map +1 -1
- package/cjs/picker/picker-service.js +7 -7
- package/cjs/picker/picker-service.js.map +1 -1
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +2 -2
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.d.ts +1 -0
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.js +11 -5
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/react-attribute-plugin.d.ts +1 -0
- package/cjs/plugins/builtin-plugin/react-attribute-plugin.js +8 -2
- package/cjs/plugins/builtin-plugin/react-attribute-plugin.js.map +1 -1
- package/cjs/render/contributions/render/arc-render.js +1 -4
- package/cjs/render/contributions/render/arc-render.js.map +1 -1
- package/cjs/render/contributions/render/area-render.js +4 -32
- 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.js +5 -5
- package/cjs/render/contributions/render/base-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/arc-contribution-render.js +14 -30
- package/cjs/render/contributions/render/contributions/arc-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/base-contribution-render.js +2 -2
- package/cjs/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/circle-contribution-render.js +11 -22
- package/cjs/render/contributions/render/contributions/circle-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/image-contribution-render.js +2 -2
- package/cjs/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/rect-contribution-render.js +11 -24
- package/cjs/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/symbol-contribution-render.js +10 -21
- package/cjs/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/text-contribution-render.js +2 -2
- package/cjs/render/contributions/render/contributions/text-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/draw-contribution.js +4 -4
- package/cjs/render/contributions/render/draw-contribution.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 +6 -6
- package/cjs/render/contributions/render/group-render.js.map +1 -1
- package/cjs/render/contributions/render/incremental-draw-contribution.js +4 -4
- package/cjs/render/contributions/render/incremental-draw-contribution.js.map +1 -1
- 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/text-render.d.ts +3 -2
- package/cjs/render/contributions/render/text-render.js +13 -32
- package/cjs/render/contributions/render/text-render.js.map +1 -1
- package/cjs/render/contributions/render/utils.js +2 -5
- package/cjs/render/contributions/render/utils.js.map +1 -1
- package/dist/index.es.js +11316 -11831
- package/es/allocator/bounds-allocate.js.map +1 -1
- 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/config.js +2 -1
- package/es/animate/custom-animate.d.ts +0 -14
- package/es/animate/custom-animate.js +1 -56
- 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/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 +47 -0
- package/es/common/3d-interceptor.js.map +1 -0
- package/es/common/Reflect-metadata.js +2 -1
- package/es/common/bounds-context.js +1 -2
- 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/morphing-utils.js +1 -1
- package/es/common/path-svg.js +1 -1
- package/es/common/polygon.js +1 -1
- package/es/common/rect-utils.js +1 -1
- package/es/common/render-area.js +1 -1
- package/es/common/render-command-list.js +1 -1
- package/es/common/render-curve.js +24 -33
- package/es/common/render-curve.js.map +1 -1
- package/es/common/render-utils.js +1 -1
- package/es/common/seg-context.js +1 -1
- package/es/common/seg-context.js.map +1 -1
- package/es/common/segment/index.d.ts +2 -4
- package/es/common/segment/index.js.map +1 -1
- package/es/common/simplify.js +1 -1
- package/es/common/sort.js +16 -13
- package/es/common/sort.js.map +1 -1
- package/es/common/split-path.js +1 -1
- package/es/common/store.js +1 -1
- package/es/common/text.d.ts +0 -2
- package/es/common/text.js +1 -7
- package/es/common/text.js.map +1 -1
- package/es/core/application.js +1 -2
- package/es/core/camera.d.ts +1 -0
- package/es/core/camera.js +12 -4
- package/es/core/camera.js.map +1 -1
- package/es/core/constants.js +1 -1
- package/es/core/core-modules.js +1 -1
- package/es/core/global-module.js +0 -2
- package/es/core/global.js +1 -1
- package/es/core/graphic-utils.js +1 -1
- package/es/core/graphic-utils.js.map +1 -1
- package/es/core/index.js +1 -1
- package/es/core/layer-service.js +1 -1
- package/es/core/layer.js +1 -1
- package/es/core/light.d.ts +1 -0
- package/es/core/light.js +7 -1
- package/es/core/light.js.map +1 -1
- package/es/core/stage.d.ts +1 -1
- package/es/core/stage.js +18 -13
- package/es/core/stage.js.map +1 -1
- package/es/core/window.js +1 -1
- package/es/factory.d.ts +5 -0
- package/es/factory.js +11 -0
- package/es/factory.js.map +1 -0
- package/es/graphic/arc.d.ts +1 -2
- package/es/graphic/arc.js +0 -3
- package/es/graphic/arc.js.map +1 -1
- package/es/graphic/area.d.ts +1 -2
- package/es/graphic/area.js +0 -3
- package/es/graphic/area.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 +1 -2
- package/es/graphic/circle.js +0 -3
- package/es/graphic/circle.js.map +1 -1
- package/es/graphic/glyph.d.ts +1 -2
- package/es/graphic/glyph.js +0 -3
- package/es/graphic/glyph.js.map +1 -1
- package/es/graphic/graphic-service/graphic-service.d.ts +2 -8
- package/es/graphic/graphic-service/graphic-service.js +3 -91
- package/es/graphic/graphic-service/graphic-service.js.map +1 -1
- package/es/graphic/graphic.d.ts +1 -4
- package/es/graphic/graphic.js +0 -3
- package/es/graphic/graphic.js.map +1 -1
- package/es/graphic/group.d.ts +1 -2
- package/es/graphic/group.js +0 -3
- package/es/graphic/group.js.map +1 -1
- package/es/graphic/image.d.ts +1 -2
- package/es/graphic/image.js +0 -3
- package/es/graphic/image.js.map +1 -1
- package/es/graphic/index.js.map +1 -1
- package/es/graphic/line.d.ts +1 -2
- package/es/graphic/line.js +0 -3
- package/es/graphic/line.js.map +1 -1
- package/es/graphic/path.d.ts +1 -2
- package/es/graphic/path.js +0 -3
- package/es/graphic/path.js.map +1 -1
- package/es/graphic/polygon.d.ts +1 -2
- package/es/graphic/polygon.js +0 -3
- package/es/graphic/polygon.js.map +1 -1
- package/es/graphic/rect.d.ts +1 -2
- package/es/graphic/rect.js +0 -3
- package/es/graphic/rect.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 +1 -2
- package/es/graphic/richtext.js +0 -3
- package/es/graphic/richtext.js.map +1 -1
- package/es/graphic/symbol.d.ts +0 -2
- package/es/graphic/symbol.js +0 -3
- package/es/graphic/symbol.js.map +1 -1
- package/es/graphic/text.d.ts +1 -2
- package/es/graphic/text.js +2 -5
- package/es/graphic/text.js.map +1 -1
- package/es/index.d.ts +4 -1
- package/es/index.js +8 -2
- package/es/index.js.map +1 -1
- package/es/interface/graphic.d.ts +1 -2
- package/es/interface/graphic.js.map +1 -1
- package/es/picker/pick-interceptor.d.ts +1 -1
- package/es/picker/pick-interceptor.js +4 -44
- package/es/picker/pick-interceptor.js.map +1 -1
- package/es/picker/picker-service.js +5 -1
- package/es/picker/picker-service.js.map +1 -1
- package/es/plugins/builtin-plugin/flex-layout-plugin.js +1 -1
- package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/html-attribute-plugin.d.ts +1 -0
- package/es/plugins/builtin-plugin/html-attribute-plugin.js +9 -1
- package/es/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/react-attribute-plugin.d.ts +1 -0
- package/es/plugins/builtin-plugin/react-attribute-plugin.js +6 -0
- package/es/plugins/builtin-plugin/react-attribute-plugin.js.map +1 -1
- package/es/render/contributions/render/arc-render.js +1 -4
- package/es/render/contributions/render/arc-render.js.map +1 -1
- package/es/render/contributions/render/area-render.js +1 -30
- 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.js +3 -1
- package/es/render/contributions/render/base-render.js.map +1 -1
- package/es/render/contributions/render/contributions/arc-contribution-render.js +13 -28
- package/es/render/contributions/render/contributions/arc-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/base-contribution-render.js +1 -1
- package/es/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/circle-contribution-render.js +10 -20
- package/es/render/contributions/render/contributions/circle-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/image-contribution-render.js +1 -1
- package/es/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/rect-contribution-render.js +10 -20
- package/es/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/symbol-contribution-render.js +9 -19
- package/es/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/text-contribution-render.js +1 -1
- package/es/render/contributions/render/contributions/text-contribution-render.js.map +1 -1
- package/es/render/contributions/render/draw-contribution.js +1 -1
- package/es/render/contributions/render/draw-contribution.js.map +1 -1
- package/es/render/contributions/render/draw-interceptor.js +7 -49
- package/es/render/contributions/render/draw-interceptor.js.map +1 -1
- package/es/render/contributions/render/group-render.js +5 -1
- package/es/render/contributions/render/group-render.js.map +1 -1
- package/es/render/contributions/render/incremental-draw-contribution.js +1 -1
- package/es/render/contributions/render/incremental-draw-contribution.js.map +1 -1
- 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/text-render.d.ts +3 -2
- package/es/render/contributions/render/text-render.js +11 -30
- package/es/render/contributions/render/text-render.js.map +1 -1
- package/es/render/contributions/render/utils.js +2 -5
- package/es/render/contributions/render/utils.js.map +1 -1
- package/package.json +4 -4
- package/cjs/allocator/allocator-modules.d.ts +0 -1
- package/cjs/allocator/allocator-modules.js +0 -1
- package/cjs/allocator/allocator-modules.js.map +0 -1
- package/cjs/allocator/point-allocate.d.ts +0 -1
- package/cjs/allocator/point-allocate.js +0 -1
- package/cjs/allocator/point-allocate.js.map +0 -1
- package/cjs/graphic/graphic-service/arc-contribution.d.ts +0 -1
- package/cjs/graphic/graphic-service/arc-contribution.js +0 -3
- package/cjs/graphic/graphic-service/arc-contribution.js.map +0 -1
- package/cjs/graphic/graphic-service/area-contribution.d.ts +0 -1
- package/cjs/graphic/graphic-service/area-contribution.js +0 -3
- package/cjs/graphic/graphic-service/area-contribution.js.map +0 -1
- package/cjs/graphic/graphic-service/circle-contribution.d.ts +0 -1
- package/cjs/graphic/graphic-service/circle-contribution.js +0 -3
- package/cjs/graphic/graphic-service/circle-contribution.js.map +0 -1
- package/cjs/graphic/graphic-service/default-theme.d.ts +0 -1
- package/cjs/graphic/graphic-service/default-theme.js +0 -3
- package/cjs/graphic/graphic-service/default-theme.js.map +0 -1
- package/cjs/graphic/graphic-service/path-contribution.d.ts +0 -1
- package/cjs/graphic/graphic-service/path-contribution.js +0 -3
- package/cjs/graphic/graphic-service/path-contribution.js.map +0 -1
- package/cjs/graphic/graphic-service/rect-contribution.d.ts +0 -1
- package/cjs/graphic/graphic-service/rect-contribution.js +0 -3
- package/cjs/graphic/graphic-service/rect-contribution.js.map +0 -1
- package/cjs/interface/util.d.ts +0 -1
- package/cjs/interface/util.js +0 -3
- package/cjs/interface/util.js.map +0 -1
- package/es/allocator/allocator-modules.d.ts +0 -1
- package/es/allocator/allocator-modules.js +0 -1
- package/es/allocator/allocator-modules.js.map +0 -1
- package/es/allocator/point-allocate.d.ts +0 -1
- package/es/allocator/point-allocate.js +0 -1
- package/es/allocator/point-allocate.js.map +0 -1
- package/es/graphic/graphic-service/arc-contribution.d.ts +0 -1
- package/es/graphic/graphic-service/arc-contribution.js +0 -3
- package/es/graphic/graphic-service/arc-contribution.js.map +0 -1
- package/es/graphic/graphic-service/area-contribution.d.ts +0 -1
- package/es/graphic/graphic-service/area-contribution.js +0 -3
- package/es/graphic/graphic-service/area-contribution.js.map +0 -1
- package/es/graphic/graphic-service/circle-contribution.d.ts +0 -1
- package/es/graphic/graphic-service/circle-contribution.js +0 -3
- package/es/graphic/graphic-service/circle-contribution.js.map +0 -1
- package/es/graphic/graphic-service/default-theme.d.ts +0 -1
- package/es/graphic/graphic-service/default-theme.js +0 -3
- package/es/graphic/graphic-service/default-theme.js.map +0 -1
- package/es/graphic/graphic-service/path-contribution.d.ts +0 -1
- package/es/graphic/graphic-service/path-contribution.js +0 -3
- package/es/graphic/graphic-service/path-contribution.js.map +0 -1
- package/es/graphic/graphic-service/rect-contribution.d.ts +0 -1
- package/es/graphic/graphic-service/rect-contribution.js +0 -3
- package/es/graphic/graphic-service/rect-contribution.js.map +0 -1
- package/es/interface/util.d.ts +0 -1
- package/es/interface/util.js +0 -3
- package/es/interface/util.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common/canvas-utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAW,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,UAAU,eAAe,CAAC,OAAmB,EAAE,KAAa,EAAE,GAAW;IAC7E,IAAI,WAAW,GAAG,KAAK,CAAC;IACxB,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC;IAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IACvD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAEvD,IAAI,MAAM,GAAG,MAAM,KAAK,CAAC,EAAE;QACzB,OAAO,CAAC,C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AAC;QACZ,CAAC,IAAI,MAAM,CAAC;QACZ,CAAC,IAAI,MAAM,CAAC;QACZ,CAAC,IAAI,MAAM,CAAC;KACb;IAED,MAAM,cAAc,GAAG,OAAO,CAAC,mBAAmB,CAChD,CAAC,GAAG,CAAC,MAAA,KAAK,CAAC,CAAC,mCAAI,CAAC,CAAC,GAAG,CAAC,EACtB,CAAC,GAAG,CAAC,MAAA,KAAK,CAAC,CAAC,mCAAI,CAAC,CAAC,GAAG,CAAC,EACtB,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,QAAQ,CACf,CAAC;IACF,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACzB,cAAc,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IAEH,IAAI,UAAU,CAAC;IACf,OAAQ,cAAsB,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,CAAC;AACtE,CAAC","file":"canvas-utils.js","sourcesContent":["import type { IColor, IConicalGradient, ILinearGradient, IRadialGradient } from '../interface/color';\nimport type { IContext2d, ITransform } from '../interface';\nimport { ICommonStyleParams } from '../interface';\nimport type { IBoundsLike } from '@visactor/vutils';\nimport { IMatrix, isArray } from '@visactor/vutils';\nimport { GradientParser } from './color-utils';\n\nexport function getScaledStroke(context: IContext2d, width: number, dpr: number) {\n let strokeWidth = width;\n const { a, b, c, d } = context.currentMatrix;\n const scaleX = Math.sign(a) * Math.sqrt(a * a + b * b);\n const scaleY = Math.sign(d) * Math.sqrt(c * c + d * d);\n // 如果没有scaleX和scaleY,那么认为什么都不用绘制\n if (scaleX + scaleY === 0) {\n return 0;\n }\n strokeWidth = (strokeWidth / Math.abs(scaleX + scaleY)) * 2 * dpr;\n return strokeWidth;\n}\n\nexport function createColor(\n context: IContext2d,\n c: string | IColor | Array<string | IColor> | boolean,\n params: { AABBBounds?: IBoundsLike; attribute?: Partial<ITransform> },\n offsetX: number,\n offsetY: number\n): string | CanvasGradient {\n if (!c || c === true) {\n return 'black';\n }\n let result: string | CanvasGradient | undefined;\n let color: string | IColor;\n if (isArray(c)) {\n for (let i = 0; i < c.length; i++) {\n color = c[i];\n if (color) {\n break;\n }\n }\n } else {\n color = c;\n }\n color = GradientParser.Parse(color);\n if (typeof color === 'string') {\n return color;\n }\n // TODO 不同scaleCenter有问题\n if (color.gradient === 'linear') {\n result = createLinearGradient(context, color, params, offsetX, offsetY);\n } else if (color.gradient === 'conical') {\n result = createConicGradient(context, color, params, offsetX, offsetY);\n } else if (color.gradient === 'radial') {\n result = createRadialGradient(context, color, params, offsetX, offsetY);\n }\n return result || 'orange';\n}\n\nfunction createLinearGradient(\n context: IContext2d,\n color: ILinearGradient,\n params: { AABBBounds?: IBoundsLike; attribute?: Partial<ITransform> },\n offsetX: number = 0,\n offsetY: number = 0\n) {\n const bounds = params.AABBBounds;\n if (!bounds) {\n return;\n }\n let w = bounds.x2 - bounds.x1;\n let h = bounds.y2 - bounds.y1;\n let x = bounds.x1 - offsetX;\n let y = bounds.y1 - offsetY;\n if (params.attribute) {\n const { scaleX = 1, scaleY = 1 } = params.attribute;\n if (scaleX * scaleY === 0) {\n return;\n }\n w /= scaleX;\n h /= scaleY;\n x /= scaleX;\n y /= scaleY;\n }\n\n const canvasGradient = context.createLinearGradient(\n x + (color.x0 ?? 0) * w,\n y + (color.y0 ?? 0) * h,\n x + (color.x1 ?? 1) * w,\n y + (color.y1 ?? 0) * h\n );\n color.stops.forEach(stop => {\n canvasGradient.addColorStop(stop.offset, stop.color);\n });\n return canvasGradient;\n}\n\nfunction createRadialGradient(\n context: IContext2d,\n color: IRadialGradient,\n params: { AABBBounds?: IBoundsLike; attribute?: Partial<ITransform> },\n offsetX: number = 0,\n offsetY: number = 0\n) {\n const bounds = params.AABBBounds;\n if (!bounds) {\n return;\n }\n let w = bounds.x2 - bounds.x1;\n let h = bounds.y2 - bounds.y1;\n let x = bounds.x1 - offsetX;\n let y = bounds.y1 - offsetY;\n if (params.attribute) {\n const { scaleX = 1, scaleY = 1 } = params.attribute;\n if (scaleX * scaleY === 0) {\n return;\n }\n x /= scaleX;\n y /= scaleY;\n w /= scaleX;\n h /= scaleY;\n }\n const canvasGradient = context.createRadialGradient(\n x + (color.x0 ?? 0.5) * w,\n y + (color.y0 ?? 0.5) * h,\n Math.max(w, h) * (color.r0 ?? 0),\n x + (color.x1 ?? 0.5) * w,\n y + (color.y1 ?? 0.5) * h,\n Math.max(w, h) * (color.r1 ?? 0.5)\n );\n color.stops.forEach(stop => {\n canvasGradient.addColorStop(stop.offset, stop.color);\n });\n return canvasGradient;\n}\n\nfunction createConicGradient(\n context: IContext2d,\n color: IConicalGradient,\n params: { AABBBounds?: IBoundsLike; attribute?: Partial<ITransform> },\n offsetX: number = 0,\n offsetY: number = 0\n) {\n const bounds = params.AABBBounds;\n if (!bounds) {\n return;\n }\n let w = bounds.x2 - bounds.x1;\n let h = bounds.y2 - bounds.y1;\n let x = bounds.x1 - offsetX;\n let y = bounds.y1 - offsetY;\n if (params.attribute) {\n const { scaleX = 1, scaleY = 1 } = params.attribute;\n if (scaleX * scaleY === 0) {\n return;\n }\n w /= scaleX;\n h /= scaleY;\n x /= scaleX;\n y /= scaleY;\n }\n\n const canvasGradient = context.createConicGradient(\n x + (color.x ?? 0) * w,\n y + (color.y ?? 0) * h,\n color.startAngle,\n color.endAngle\n );\n color.stops.forEach(stop => {\n canvasGradient.addColorStop(stop.offset, stop.color);\n });\n\n let deltaAngle;\n return (canvasGradient as any).GetPattern(w + x, h + y, deltaAngle);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/common/canvas-utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,UAAU,eAAe,CAAC,OAAmB,E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I,CAAC,CAAC,EAChC,CAAC,GAAG,CAAC,MAAA,KAAK,CAAC,EAAE,mCAAI,GAAG,CAAC,GAAG,CAAC,EACzB,CAAC,GAAG,CAAC,MAAA,KAAK,CAAC,EAAE,mCAAI,GAAG,CAAC,GAAG,CAAC,EACzB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,MAAA,KAAK,CAAC,EAAE,mCAAI,GAAG,CAAC,CACnC,CAAC;IACF,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACzB,cAAc,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IACH,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,SAAS,mBAAmB,CAAC,OAAmB,EAAE,KAAuB,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS;;IACnH,MAAM,cAAc,GAAG,OAAO,CAAC,mBAAmB,CAChD,CAAC,GAAG,CAAC,MAAA,KAAK,CAAC,CAAC,mCAAI,CAAC,CAAC,GAAG,CAAC,EACtB,CAAC,GAAG,CAAC,MAAA,KAAK,CAAC,CAAC,mCAAI,CAAC,CAAC,GAAG,CAAC,EACtB,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,QAAQ,CACf,CAAC;IACF,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACzB,cAAc,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IAEH,IAAI,UAAU,CAAC;IACf,OAAQ,cAAsB,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,CAAC;AACtE,CAAC","file":"canvas-utils.js","sourcesContent":["import type { IColor, IConicalGradient, ILinearGradient, IRadialGradient } from '../interface/color';\nimport type { IContext2d, ITransform } from '../interface';\nimport type { IBoundsLike } from '@visactor/vutils';\nimport { isArray } from '@visactor/vutils';\nimport { GradientParser } from './color-utils';\n\nexport function getScaledStroke(context: IContext2d, width: number, dpr: number) {\n let strokeWidth = width;\n const { a, b, c, d } = context.currentMatrix;\n const scaleX = Math.sign(a) * Math.sqrt(a * a + b * b);\n const scaleY = Math.sign(d) * Math.sqrt(c * c + d * d);\n // 如果没有scaleX和scaleY,那么认为什么都不用绘制\n if (scaleX + scaleY === 0) {\n return 0;\n }\n strokeWidth = (strokeWidth / Math.abs(scaleX + scaleY)) * 2 * dpr;\n return strokeWidth;\n}\n\nexport function createColor(\n context: IContext2d,\n c: string | IColor | Array<string | IColor> | boolean,\n params: { AABBBounds?: IBoundsLike; attribute?: Partial<ITransform> },\n offsetX: number = 0,\n offsetY: number = 0\n): string | CanvasGradient {\n if (!c || c === true) {\n return 'black';\n }\n let result: string | CanvasGradient | undefined;\n let color: string | IColor;\n if (isArray(c)) {\n for (let i = 0; i < c.length; i++) {\n color = c[i];\n if (color) {\n break;\n }\n }\n } else {\n color = c;\n }\n color = GradientParser.Parse(color);\n if (typeof color === 'string') {\n return color;\n }\n if (params.AABBBounds && (!params.attribute || params.attribute.scaleX !== 0 || params.attribute.scaleY !== 0)) {\n const bounds = params.AABBBounds;\n let w = bounds.x2 - bounds.x1;\n let h = bounds.y2 - bounds.y1;\n let x = bounds.x1 - offsetX;\n let y = bounds.y1 - offsetY;\n if (params.attribute) {\n const { scaleX = 1, scaleY = 1 } = params.attribute;\n w /= scaleX;\n h /= scaleY;\n x /= scaleX;\n y /= scaleY;\n }\n // TODO 不同scaleCenter有问题\n if (color.gradient === 'linear') {\n result = createLinearGradient(context, color, x, y, w, h);\n } else if (color.gradient === 'conical') {\n result = createConicGradient(context, color, x, y, w, h);\n } else if (color.gradient === 'radial') {\n result = createRadialGradient(context, color, x, y, w, h);\n }\n }\n return result || 'orange';\n}\n\nfunction createLinearGradient(context: IContext2d, color: ILinearGradient, x: number, y: number, w: number, h: number) {\n const canvasGradient = context.createLinearGradient(\n x + (color.x0 ?? 0) * w,\n y + (color.y0 ?? 0) * h,\n x + (color.x1 ?? 1) * w,\n y + (color.y1 ?? 0) * h\n );\n color.stops.forEach(stop => {\n canvasGradient.addColorStop(stop.offset, stop.color);\n });\n return canvasGradient;\n}\n\nfunction createRadialGradient(context: IContext2d, color: IRadialGradient, x: number, y: number, w: number, h: number) {\n const canvasGradient = context.createRadialGradient(\n x + (color.x0 ?? 0.5) * w,\n y + (color.y0 ?? 0.5) * h,\n Math.max(w, h) * (color.r0 ?? 0),\n x + (color.x1 ?? 0.5) * w,\n y + (color.y1 ?? 0.5) * h,\n Math.max(w, h) * (color.r1 ?? 0.5)\n );\n color.stops.forEach(stop => {\n canvasGradient.addColorStop(stop.offset, stop.color);\n });\n return canvasGradient;\n}\n\nfunction createConicGradient(context: IContext2d, color: IConicalGradient, x: number, y: number, w: number, h: number) {\n const canvasGradient = context.createConicGradient(\n x + (color.x ?? 0) * w,\n y + (color.y ?? 0) * h,\n color.startAngle,\n color.endAngle\n );\n color.stops.forEach(stop => {\n canvasGradient.addColorStop(stop.offset, stop.color);\n });\n\n let deltaAngle;\n return (canvasGradient as any).GetPattern(w + x, h + y, deltaAngle);\n}\n"]}
|
package/es/common/matrix.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import type { mat4, vec3 } from '@visactor/vutils';
|
|
2
|
-
export declare function
|
|
1
|
+
import type { IMatrix, mat4, vec3 } from '@visactor/vutils';
|
|
2
|
+
export declare function identityMat4(out: mat4): mat4;
|
|
3
|
+
export declare function rotateX(out: mat4, a: mat4, rad: number): mat4;
|
|
4
|
+
export declare function rotateY(out: mat4, a: mat4, rad: number): mat4;
|
|
5
|
+
export declare function rotateZ(out: mat4, a: mat4, rad: number): mat4;
|
|
6
|
+
export declare function translate(out: mat4, a: mat4, v: vec3): mat4;
|
|
7
|
+
export declare function mat3Tomat4(out: mat4, b: IMatrix): void;
|
|
8
|
+
export declare function multiplyMat4Mat3(out: mat4, a: mat4, b: IMatrix): mat4;
|
|
9
|
+
export declare function scaleMat4(out: mat4, a: mat4, v: vec3): mat4;
|
|
10
|
+
export declare function multiplyMat4Mat4(out: mat4, a: mat4, b: mat4): mat4;
|
|
11
|
+
export declare function lookAt(out: mat4, eye: vec3, center: vec3, up: vec3): mat4;
|
|
3
12
|
export declare function ortho(out: mat4, left: number, right: number, bottom: number, top: number, near: number, far: number): mat4;
|
|
4
|
-
export declare function multiply(out: mat4, a: mat4, b: mat4): mat4;
|
|
5
13
|
export declare function transformMat4(out: vec3, a: vec3, m: mat4): vec3;
|
package/es/common/matrix.js
CHANGED
|
@@ -1,11 +1,99 @@
|
|
|
1
1
|
import { epsilon } from "@visactor/vutils";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export function identityMat4(out) {
|
|
4
|
+
return out[0] = 1, out[1] = 0, out[2] = 0, out[3] = 0, out[4] = 0, out[5] = 1, out[6] = 0,
|
|
5
|
+
out[7] = 0, out[8] = 0, out[9] = 0, out[10] = 1, out[11] = 0, out[12] = 0, out[13] = 0,
|
|
6
|
+
out[14] = 0, out[15] = 1, out;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function rotateX(out, a, rad) {
|
|
10
|
+
const s = Math.sin(rad), c = Math.cos(rad), a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11];
|
|
11
|
+
return a !== out && (out[0] = a[0], out[1] = a[1], out[2] = a[2], out[3] = a[3],
|
|
12
|
+
out[12] = a[12], out[13] = a[13], out[14] = a[14], out[15] = a[15]), out[4] = a10 * c + a20 * s,
|
|
13
|
+
out[5] = a11 * c + a21 * s, out[6] = a12 * c + a22 * s, out[7] = a13 * c + a23 * s,
|
|
14
|
+
out[8] = a20 * c - a10 * s, out[9] = a21 * c - a11 * s, out[10] = a22 * c - a12 * s,
|
|
15
|
+
out[11] = a23 * c - a13 * s, out;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function rotateY(out, a, rad) {
|
|
19
|
+
const s = Math.sin(rad), c = Math.cos(rad), a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11];
|
|
20
|
+
return a !== out && (out[4] = a[4], out[5] = a[5], out[6] = a[6], out[7] = a[7],
|
|
21
|
+
out[12] = a[12], out[13] = a[13], out[14] = a[14], out[15] = a[15]), out[0] = a00 * c - a20 * s,
|
|
22
|
+
out[1] = a01 * c - a21 * s, out[2] = a02 * c - a22 * s, out[3] = a03 * c - a23 * s,
|
|
23
|
+
out[8] = a00 * s + a20 * c, out[9] = a01 * s + a21 * c, out[10] = a02 * s + a22 * c,
|
|
24
|
+
out[11] = a03 * s + a23 * c, out;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function rotateZ(out, a, rad) {
|
|
28
|
+
const s = Math.sin(rad), c = Math.cos(rad), a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7];
|
|
29
|
+
return a !== out && (out[8] = a[8], out[9] = a[9], out[10] = a[10], out[11] = a[11],
|
|
30
|
+
out[12] = a[12], out[13] = a[13], out[14] = a[14], out[15] = a[15]), out[0] = a00 * c + a10 * s,
|
|
31
|
+
out[1] = a01 * c + a11 * s, out[2] = a02 * c + a12 * s, out[3] = a03 * c + a13 * s,
|
|
32
|
+
out[4] = a10 * c - a00 * s, out[5] = a11 * c - a01 * s, out[6] = a12 * c - a02 * s,
|
|
33
|
+
out[7] = a13 * c - a03 * s, out;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function translate(out, a, v) {
|
|
37
|
+
const x = v[0], y = v[1], z = v[2];
|
|
38
|
+
let a00, a01, a02, a03, a10, a11, a12, a13, a20, a21, a22, a23;
|
|
39
|
+
return a === out ? (out[12] = a[0] * x + a[4] * y + a[8] * z + a[12], out[13] = a[1] * x + a[5] * y + a[9] * z + a[13],
|
|
40
|
+
out[14] = a[2] * x + a[6] * y + a[10] * z + a[14], out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]) : (a00 = a[0],
|
|
41
|
+
a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],
|
|
42
|
+
a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], out[0] = a00, out[1] = a01, out[2] = a02,
|
|
43
|
+
out[3] = a03, out[4] = a10, out[5] = a11, out[6] = a12, out[7] = a13, out[8] = a20,
|
|
44
|
+
out[9] = a21, out[10] = a22, out[11] = a23, out[12] = a00 * x + a10 * y + a20 * z + a[12],
|
|
45
|
+
out[13] = a01 * x + a11 * y + a21 * z + a[13], out[14] = a02 * x + a12 * y + a22 * z + a[14],
|
|
46
|
+
out[15] = a03 * x + a13 * y + a23 * z + a[15]), out;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function mat3Tomat4(out, b) {
|
|
50
|
+
out[0] = b.a, out[1] = b.b, out[2] = 0, out[3] = 0, out[4] = b.c, out[5] = b.d,
|
|
51
|
+
out[6] = 0, out[7] = 0, out[8] = 0, out[9] = 0, out[10] = 1, out[11] = 0, out[12] = b.e,
|
|
52
|
+
out[13] = b.f, out[14] = 0, out[15] = 1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function multiplyMat4Mat3(out, a, b) {
|
|
56
|
+
const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];
|
|
57
|
+
let b0 = b.a, b1 = b.b, b2 = 0, b3 = 0;
|
|
58
|
+
return out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30, out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31,
|
|
59
|
+
out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32, out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33,
|
|
60
|
+
b0 = b.c, b1 = b.d, b2 = 0, b3 = 0, out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30,
|
|
61
|
+
out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31, out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32,
|
|
62
|
+
out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33, b0 = 0, b1 = 0, b2 = 1, b3 = 0,
|
|
63
|
+
out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30, out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31,
|
|
64
|
+
out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32, out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33,
|
|
65
|
+
b0 = b.e, b1 = b.f, b2 = 0, b3 = 1, out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30,
|
|
66
|
+
out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31, out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32,
|
|
67
|
+
out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33, out;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function scaleMat4(out, a, v) {
|
|
71
|
+
const x = v[0], y = v[1], z = v[2];
|
|
72
|
+
return out[0] = a[0] * x, out[1] = a[1] * x, out[2] = a[2] * x, out[3] = a[3] * x,
|
|
73
|
+
out[4] = a[4] * y, out[5] = a[5] * y, out[6] = a[6] * y, out[7] = a[7] * y, out[8] = a[8] * z,
|
|
74
|
+
out[9] = a[9] * z, out[10] = a[10] * z, out[11] = a[11] * z, out[12] = a[12], out[13] = a[13],
|
|
75
|
+
out[14] = a[14], out[15] = a[15], out;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function multiplyMat4Mat4(out, a, b) {
|
|
79
|
+
const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];
|
|
80
|
+
let b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3];
|
|
81
|
+
return out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30, out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31,
|
|
82
|
+
out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32, out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33,
|
|
83
|
+
b0 = b[4], b1 = b[5], b2 = b[6], b3 = b[7], out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30,
|
|
84
|
+
out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31, out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32,
|
|
85
|
+
out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33, b0 = b[8], b1 = b[9], b2 = b[10],
|
|
86
|
+
b3 = b[11], out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30, out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31,
|
|
87
|
+
out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32, out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33,
|
|
88
|
+
b0 = b[12], b1 = b[13], b2 = b[14], b3 = b[15], out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30,
|
|
89
|
+
out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31, out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32,
|
|
90
|
+
out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33, out;
|
|
91
|
+
}
|
|
4
92
|
|
|
5
93
|
export function lookAt(out, eye, center, up) {
|
|
6
94
|
let x0, x1, x2, y0, y1, y2, z0, z1, z2, len;
|
|
7
95
|
const eyex = eye[0], eyey = eye[1], eyez = eye[2], upx = up[0], upy = up[1], upz = up[2], centerx = center[0], centery = center[1], centerz = center[2];
|
|
8
|
-
return Math.abs(eyex - centerx) < epsilon && Math.abs(eyey - centery) < epsilon && Math.abs(eyez - centerz) < epsilon ?
|
|
96
|
+
return Math.abs(eyex - centerx) < epsilon && Math.abs(eyey - centery) < epsilon && Math.abs(eyez - centerz) < epsilon ? identityMat4(out) : (z0 = eyex - centerx,
|
|
9
97
|
z1 = eyey - centery, z2 = eyez - centerz, len = 1 / Math.hypot(z0, z1, z2), z0 *= len,
|
|
10
98
|
z1 *= len, z2 *= len, x0 = upy * z2 - upz * z1, x1 = upz * z0 - upx * z2, x2 = upx * z1 - upy * z0,
|
|
11
99
|
len = Math.hypot(x0, x1, x2), len ? (len = 1 / len, x0 *= len, x1 *= len, x2 *= len) : (x0 = 0,
|
|
@@ -24,21 +112,6 @@ export function ortho(out, left, right, bottom, top, near, far) {
|
|
|
24
112
|
out[13] = (top + bottom) * bt, out[14] = (far + near) * nf, out[15] = 1, out;
|
|
25
113
|
}
|
|
26
114
|
|
|
27
|
-
export function multiply(out, a, b) {
|
|
28
|
-
const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];
|
|
29
|
-
let b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3];
|
|
30
|
-
return out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30, out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31,
|
|
31
|
-
out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32, out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33,
|
|
32
|
-
b0 = b[4], b1 = b[5], b2 = b[6], b3 = b[7], out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30,
|
|
33
|
-
out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31, out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32,
|
|
34
|
-
out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33, b0 = b[8], b1 = b[9], b2 = b[10],
|
|
35
|
-
b3 = b[11], out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30, out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31,
|
|
36
|
-
out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32, out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33,
|
|
37
|
-
b0 = b[12], b1 = b[13], b2 = b[14], b3 = b[15], out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30,
|
|
38
|
-
out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31, out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32,
|
|
39
|
-
out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33, out;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
115
|
export function transformMat4(out, a, m) {
|
|
43
116
|
const x = a[0], y = a[1], z = a[2];
|
|
44
117
|
let w = m[3] * x + m[7] * y + m[11] * z + m[15];
|
package/es/common/matrix.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common/matrix.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AA+TnE,MAAM,UAAU,MAAM,CAAC,GAAS,EAAE,GAAS,EAAE,MAAY,EAAE,EAAQ;IACjE,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP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C,CAAC,CAAC;IACf,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACf,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;IAChD,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC;IACb,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;IACtD,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;IACtD,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;IACvD,OAAO,GAAG,CAAC;AACb,CAAC","file":"matrix.js","sourcesContent":["// import { abs, cos, epsilon, sin } from '@visactor/vutils';\n// import { IMatrix } from '../interface/matrix';\n// import { IBounds, IPoint } from '../interface/util';\n\nimport type { mat4, vec3 } from '@visactor/vutils';\nimport { epsilon } from '@visactor/vutils';\nimport { DefaultMat4Allocate } from '../allocator/matrix-allocate';\n\n// export type vec2 = [number, number] | Float32Array;\n// export type vec3 = [number, number, number] | Float32Array;\n// export type vec4 = [number, number, number, number] | Float32Array;\n// export type mat4 =\n// | [\n// number,\n// number,\n// number,\n// number,\n// number,\n// number,\n// number,\n// number,\n// number,\n// number,\n// number,\n// number,\n// number,\n// number,\n// number,\n// number\n// ]\n// | Float32Array;\n\n// export class Matrix implements IMatrix {\n// /**\n// * scale x\n// */\n// a: number;\n// /**\n// * skew y\n// */\n// b: number;\n// /**\n// * skewx\n// */\n// c: number;\n// /**\n// * scale y\n// */\n// d: number;\n// /**\n// * translate x\n// */\n// e: number;\n// /**\n// * translate y\n// */\n// f: number;\n\n// // todo setScale需要sx,sy初始值为1\n// constructor(a?: number, b?: number, c?: number, d?: number, e?: number, f?: number) {\n// // 暂时不需要初始化\n// this.a = a ?? 1;\n// this.b = b ?? 0;\n// this.c = c ?? 0;\n// this.d = d ?? 1;\n// this.e = e ?? 0;\n// this.f = f ?? 0;\n// }\n\n// setValue(a: number, b: number, c: number, d: number, e: number, f: number) {\n// this.a = a;\n// this.b = b;\n// this.c = c;\n// this.d = d;\n// this.e = e;\n// this.f = f;\n// return this;\n// }\n\n// reset(): this {\n// this.a = 1;\n// this.b = 0;\n// this.c = 0;\n// this.d = 1;\n// this.e = 0;\n// this.f = 0;\n// return this;\n// }\n\n// /**\n// * 获取当前矩阵的逆矩阵\n// */\n// getInverse() {\n// const a = this.a;\n// const b = this.b;\n// const c = this.c;\n// const d = this.d;\n// const e = this.e;\n// const f = this.f;\n// const m = new Matrix();\n// const dt = a * d - b * c;\n\n// m.a = d / dt;\n// m.b = -b / dt;\n// m.c = -c / dt;\n// m.d = a / dt;\n// m.e = (c * f - d * e) / dt;\n// m.f = -(a * f - b * e) / dt;\n\n// return m;\n// }\n\n// rotate(rad: number) {\n// const c = Math.cos(rad);\n// const s = Math.sin(rad);\n// const m11 = this.a * c + this.c * s;\n// const m12 = this.b * c + this.d * s;\n// const m21 = this.a * -s + this.c * c;\n// const m22 = this.b * -s + this.d * c;\n// this.a = m11;\n// this.b = m12;\n// this.c = m21;\n// this.d = m22;\n// return this;\n// }\n\n// scale(sx: number, sy: number) {\n// this.a *= sx;\n// this.b *= sx;\n// this.c *= sy;\n// this.d *= sy;\n// return this;\n// }\n\n// setScale(sx: number, sy: number) {\n// this.b = (this.b / this.a) * sx;\n// this.c = (this.c / this.d) * sy;\n// this.a = sx;\n// this.d = sy;\n// return this;\n// }\n\n// transform(a: number, b: number, c: number, d: number, e: number, f: number) {\n// this.multiply(a, b, c, d, e, f);\n// return this;\n// }\n// translate(x: number, y: number) {\n// this.e += this.a * x + this.c * y;\n// this.f += this.b * x + this.d * y;\n// return this;\n// }\n// /**\n// * 矩阵相乘\n// * @param matrix\n// */\n// multiply(a2: number, b2: number, c2: number, d2: number, e2: number, f2: number) {\n// const a1 = this.a;\n// const b1 = this.b;\n// const c1 = this.c;\n// const d1 = this.d;\n// const e1 = this.e;\n// const f1 = this.f;\n\n// const m11 = a1 * a2 + c1 * b2;\n// const m12 = b1 * a2 + d1 * b2;\n// const m21 = a1 * c2 + c1 * d2;\n// const m22 = b1 * c2 + d1 * d2;\n// const dx = a1 * e2 + c1 * f2 + e1;\n// const dy = b1 * e2 + d1 * f2 + f1;\n\n// this.a = m11;\n// this.b = m12;\n// this.c = m21;\n// this.d = m22;\n// this.e = dx;\n// this.f = dy;\n// return this;\n// }\n// /**\n// * 插值计算\n// * @param m2\n// * @param t\n// */\n// interpolate(m2: Matrix, t: number) {\n// const m = new Matrix();\n\n// m.a = this.a + (m2.a - this.a) * t;\n// m.b = this.b + (m2.b - this.b) * t;\n// m.c = this.c + (m2.c - this.c) * t;\n// m.d = this.d + (m2.d - this.d) * t;\n// m.e = this.e + (m2.e - this.e) * t;\n// m.f = this.f + (m2.f - this.f) * t;\n\n// return m;\n// }\n\n// /**\n// * 将point转到当前矩阵的坐标空间中\n// * @param source\n// * @param target\n// */\n// transformPoint(source: IPoint, target: IPoint) {\n// const { a, b, c, d, e, f } = this;\n// const dt = a * d - b * c;\n\n// const nextA = d / dt;\n// const nextB = -b / dt;\n// const nextC = -c / dt;\n// const nextD = a / dt;\n// const nextE = (c * f - d * e) / dt;\n// const nextF = -(a * f - b * e) / dt;\n\n// const { x, y } = source;\n// target.x = x * nextA + y * nextC + nextE;\n// target.y = x * nextB + y * nextD + nextF;\n// }\n\n// // 只有translate\n// onlyTranslate(): boolean {\n// return this.a === 1 && this.b === 0 && this.c === 0 && this.d === 1;\n// }\n\n// clone(): Matrix {\n// return new Matrix(this.a, this.b, this.c, this.d, this.e, this.f);\n// }\n// }\n\n// /**\n// * 依据graphic的属性对bounds进行变换\n// * @param bounds\n// * @param x\n// * @param y\n// * @param scaleX\n// * @param scaleY\n// * @param angle\n// * @param rotateCenter\n// */\n// export function transformBounds(\n// bounds: IBounds,\n// x: number,\n// y: number,\n// scaleX: number,\n// scaleY: number,\n// angle: number,\n// rotateCenter?: [number, number]\n// ) {\n// if (abs(scaleX) <= epsilon || abs(scaleY) <= epsilon) {\n// return;\n// }\n\n// scaleX !== 1 && bounds.scaleX(scaleX);\n// scaleY !== 1 && bounds.scaleY(scaleY);\n\n// if (isFinite(angle) && Math.abs(angle) > epsilon) {\n// let rx = 0;\n// let ry = 0;\n// if (rotateCenter !== undefined) {\n// rx = rotateCenter[0];\n// ry = rotateCenter[1];\n// }\n// bounds.rotate(angle, rx, ry);\n// }\n\n// bounds.translate(x, y);\n// }\n// export function transformBoundsWithMatrix(bounds: IBounds, matrix: IMatrix): IBounds {\n// const { x1, y1, x2, y2 } = bounds;\n// // 如果没有旋转和缩放,那就直接translate\n// if (matrix.onlyTranslate()) {\n// bounds.translate(matrix.e, matrix.f);\n// return bounds;\n// }\n// bounds.x1 = matrix.a * x1 + matrix.c * y1 + matrix.e;\n// bounds.y1 = matrix.b * x1 + matrix.d * y1 + matrix.f;\n// bounds.x2 = matrix.a * x2 + matrix.c * y2 + matrix.e;\n// bounds.y2 = matrix.b * x2 + matrix.d * y2 + matrix.f;\n// bounds.clear();\n// bounds.add(x1, y1);\n// bounds.add(x2, y2);\n// return bounds;\n// }\n\n// export function normalTransform(\n// out: Matrix,\n// origin: Matrix,\n// x: number,\n// y: number,\n// scaleX: number,\n// scaleY: number,\n// angle: number,\n// rotateCenter?: vec2\n// ) {\n// const oa = origin.a;\n// const ob = origin.b;\n// const oc = origin.c;\n// const od = origin.d;\n// const oe = origin.e;\n// const of = origin.f;\n// const cosTheta = cos(angle);\n// const sinTheta = sin(angle);\n// let rotateCenterX: number;\n// let rotateCenterY: number;\n// if (rotateCenter) {\n// rotateCenterX = rotateCenter[0];\n// rotateCenterY = rotateCenter[1];\n// } else {\n// rotateCenterX = x;\n// rotateCenterY = y;\n// }\n// const offsetX = rotateCenterX - x;\n// const offsetY = rotateCenterY - y;\n\n// const a1 = oa * cosTheta + oc * sinTheta;\n// const b1 = ob * cosTheta + od * sinTheta;\n// const c1 = oc * cosTheta - oa * sinTheta;\n// const d1 = od * cosTheta - ob * sinTheta;\n// out.a = scaleX * a1;\n// out.b = scaleX * b1;\n// out.c = scaleY * c1;\n// out.d = scaleY * d1;\n\n// out.e = oe + oa * rotateCenterX + oc * rotateCenterY - a1 * offsetX - c1 * offsetY;\n// out.f = of + ob * rotateCenterX + od * rotateCenterY - b1 * offsetX - d1 * offsetY;\n// }\n// 代码来自gl-matrix https://github.com/toji/gl-matrix\nexport function lookAt(out: mat4, eye: vec3, center: vec3, up: vec3) {\n let x0;\n let x1;\n let x2;\n let y0;\n let y1;\n let y2;\n let z0;\n let z1;\n let z2;\n let len;\n const eyex = eye[0];\n const eyey = eye[1];\n const eyez = eye[2];\n const upx = up[0];\n const upy = up[1];\n const upz = up[2];\n const centerx = center[0];\n const centery = center[1];\n const centerz = center[2];\n\n if (Math.abs(eyex - centerx) < epsilon && Math.abs(eyey - centery) < epsilon && Math.abs(eyez - centerz) < epsilon) {\n return DefaultMat4Allocate.identity(out);\n }\n\n z0 = eyex - centerx;\n z1 = eyey - centery;\n z2 = eyez - centerz;\n len = 1 / Math.hypot(z0, z1, z2);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n x0 = upy * z2 - upz * z1;\n x1 = upz * z0 - upx * z2;\n x2 = upx * z1 - upy * z0;\n len = Math.hypot(x0, x1, x2);\n\n if (!len) {\n x0 = 0;\n x1 = 0;\n x2 = 0;\n } else {\n len = 1 / len;\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n y0 = z1 * x2 - z2 * x1;\n y1 = z2 * x0 - z0 * x2;\n y2 = z0 * x1 - z1 * x0;\n len = Math.hypot(y0, y1, y2);\n\n if (!len) {\n y0 = 0;\n y1 = 0;\n y2 = 0;\n } else {\n len = 1 / len;\n y0 *= len;\n y1 *= len;\n y2 *= len;\n }\n\n out[0] = x0;\n out[1] = y0;\n out[2] = z0;\n out[3] = 0;\n out[4] = x1;\n out[5] = y1;\n out[6] = z1;\n out[7] = 0;\n out[8] = x2;\n out[9] = y2;\n out[10] = z2;\n out[11] = 0;\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n out[15] = 1;\n return out;\n}\n\n/**\n * 代码来自gl-matrix https://github.com/toji/gl-matrix\n * Generates a orthogonal projection matrix with the given bounds\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} left Left bound of the frustum\n * @param {number} right Right bound of the frustum\n * @param {number} bottom Bottom bound of the frustum\n * @param {number} top Top bound of the frustum\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\n\nexport function ortho(out: mat4, left: number, right: number, bottom: number, top: number, near: number, far: number) {\n const lr = 1 / (left - right);\n const bt = 1 / (bottom - top);\n const nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n}\n\n/**\n * 代码来自gl-matrix https://github.com/toji/gl-matrix\n * Multiplies two mat4s\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @returns {mat4} out\n */\n\nexport function multiply(out: mat4, a: mat4, b: mat4) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[4];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n const a30 = a[12];\n const a31 = a[13];\n const a32 = a[14];\n const a33 = a[15]; // Cache only the current line of the second matrix\n\n let b0 = b[0];\n let b1 = b[1];\n let b2 = b[2];\n let b3 = b[3];\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[4];\n b1 = b[5];\n b2 = b[6];\n b3 = b[7];\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[8];\n b1 = b[9];\n b2 = b[10];\n b3 = b[11];\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[12];\n b1 = b[13];\n b2 = b[14];\n b3 = b[15];\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n return out;\n}\n\n/**\n * 代码来自gl-matrix https://github.com/toji/gl-matrix\n * Transforms the vec3 with a mat4.\n * 4th vector component is implicitly '1'\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to transform\n * @param {ReadonlyMat4} m matrix to transform with\n * @returns {vec3} out\n */\n\nexport function transformMat4(out: vec3, a: vec3, m: mat4) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n let w = m[3] * x + m[7] * y + m[11] * z + m[15];\n w = w || 1.0;\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n return out;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/common/matrix.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AA0B3C,MAAM,UAAU,YAAY,CAAC,GAAS;IACpC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACX,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACX,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACX,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACX,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACX,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACX,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACX,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACX,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACX,GAAG,CAAC,CA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AAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;IACvD,OAAO,GAAG,CAAC;AACb,CAAC","file":"matrix.js","sourcesContent":["// import { abs, cos, epsilon, sin } from '@visactor/vutils';\n// import { IMatrix } from '../interface/matrix';\n// import { IBounds, IPoint } from '../interface/util';\n\nimport type { IMatrix, mat4, vec3 } from '@visactor/vutils';\nimport { epsilon } from '@visactor/vutils';\n\n/**\n * 部分代码参考 https://github.com/toji/gl-matrix\n * Copyright (c) 2015-2021, Brandon Jones, Colin MacKenzie IV.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n */\n\n// 代码来自gl-matrix https://github.com/toji/gl-matrix\nexport function identityMat4(out: mat4) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n\n/**\n * 代码来自gl-matrix https://github.com/toji/gl-matrix\n * Rotates a matrix by the given angle around the X axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nexport function rotateX(out: mat4, a: mat4, rad: number) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n const a10 = a[4];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n // Perform axis-specific matrix multiplication\n out[4] = a10 * c + a20 * s;\n out[5] = a11 * c + a21 * s;\n out[6] = a12 * c + a22 * s;\n out[7] = a13 * c + a23 * s;\n out[8] = a20 * c - a10 * s;\n out[9] = a21 * c - a11 * s;\n out[10] = a22 * c - a12 * s;\n out[11] = a23 * c - a13 * s;\n return out;\n}\n\n/**\n * 代码来自gl-matrix https://github.com/toji/gl-matrix\n * Rotates a matrix by the given angle around the Y axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nexport function rotateY(out: mat4, a: mat4, rad: number) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n // Perform axis-specific matrix multiplication\n out[0] = a00 * c - a20 * s;\n out[1] = a01 * c - a21 * s;\n out[2] = a02 * c - a22 * s;\n out[3] = a03 * c - a23 * s;\n out[8] = a00 * s + a20 * c;\n out[9] = a01 * s + a21 * c;\n out[10] = a02 * s + a22 * c;\n out[11] = a03 * s + a23 * c;\n return out;\n}\n\n/**\n * 代码来自gl-matrix https://github.com/toji/gl-matrix\n * Rotates a matrix by the given angle around the Z axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nexport function rotateZ(out: mat4, a: mat4, rad: number) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[4];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n out[0] = a00 * c + a10 * s;\n out[1] = a01 * c + a11 * s;\n out[2] = a02 * c + a12 * s;\n out[3] = a03 * c + a13 * s;\n out[4] = a10 * c - a00 * s;\n out[5] = a11 * c - a01 * s;\n out[6] = a12 * c - a02 * s;\n out[7] = a13 * c - a03 * s;\n return out;\n}\n\n// 代码来自gl-matrix https://github.com/toji/gl-matrix\nexport function translate(out: mat4, a: mat4, v: vec3) {\n const x = v[0];\n const y = v[1];\n const z = v[2];\n let a00;\n let a01;\n let a02;\n let a03;\n let a10;\n let a11;\n let a12;\n let a13;\n let a20;\n let a21;\n let a22;\n let a23;\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a03;\n out[4] = a10;\n out[5] = a11;\n out[6] = a12;\n out[7] = a13;\n out[8] = a20;\n out[9] = a21;\n out[10] = a22;\n out[11] = a23;\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n return out;\n}\n\nexport function mat3Tomat4(out: mat4, b: IMatrix) {\n out[0] = b.a;\n out[1] = b.b;\n out[2] = 0;\n out[3] = 0;\n out[4] = b.c;\n out[5] = b.d;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = b.e;\n out[13] = b.f;\n out[14] = 0;\n out[15] = 1;\n}\n\n/**\n * 代码来自gl-matrix https://github.com/toji/gl-matrix\n * Multiplies two mat4s\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @returns {mat4} out\n */\n\nexport function multiplyMat4Mat3(out: mat4, a: mat4, b: IMatrix) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[4];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n const a30 = a[12];\n const a31 = a[13];\n const a32 = a[14];\n const a33 = a[15]; // Cache only the current line of the second matrix\n\n let b0 = b.a;\n let b1 = b.b;\n let b2 = 0;\n let b3 = 0;\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b.c;\n b1 = b.d;\n b2 = 0;\n b3 = 0;\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = 0;\n b1 = 0;\n b2 = 1;\n b3 = 0;\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b.e;\n b1 = b.f;\n b2 = 0;\n b3 = 1;\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n return out;\n}\n\n/**\n * 代码来自gl-matrix https://github.com/toji/gl-matrix\n * Scales the mat4 by the dimensions in the given vec3 not using vectorization\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to scale\n * @param {ReadonlyVec3} v the vec3 to scale the matrix by\n * @returns {mat4} out\n **/\nexport function scaleMat4(out: mat4, a: mat4, v: vec3) {\n const x = v[0];\n const y = v[1];\n const z = v[2];\n out[0] = a[0] * x;\n out[1] = a[1] * x;\n out[2] = a[2] * x;\n out[3] = a[3] * x;\n out[4] = a[4] * y;\n out[5] = a[5] * y;\n out[6] = a[6] * y;\n out[7] = a[7] * y;\n out[8] = a[8] * z;\n out[9] = a[9] * z;\n out[10] = a[10] * z;\n out[11] = a[11] * z;\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n\n/**\n * 代码来自gl-matrix https://github.com/toji/gl-matrix\n * Multiplies two mat4s\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @returns {mat4} out\n */\nexport function multiplyMat4Mat4(out: mat4, a: mat4, b: mat4) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[4];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n const a30 = a[12];\n const a31 = a[13];\n const a32 = a[14];\n const a33 = a[15]; // Cache only the current line of the second matrix\n\n let b0 = b[0];\n let b1 = b[1];\n let b2 = b[2];\n let b3 = b[3];\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[4];\n b1 = b[5];\n b2 = b[6];\n b3 = b[7];\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[8];\n b1 = b[9];\n b2 = b[10];\n b3 = b[11];\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[12];\n b1 = b[13];\n b2 = b[14];\n b3 = b[15];\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n return out;\n}\n\n// 代码来自gl-matrix https://github.com/toji/gl-matrix\nexport function lookAt(out: mat4, eye: vec3, center: vec3, up: vec3) {\n let x0;\n let x1;\n let x2;\n let y0;\n let y1;\n let y2;\n let z0;\n let z1;\n let z2;\n let len;\n const eyex = eye[0];\n const eyey = eye[1];\n const eyez = eye[2];\n const upx = up[0];\n const upy = up[1];\n const upz = up[2];\n const centerx = center[0];\n const centery = center[1];\n const centerz = center[2];\n\n if (Math.abs(eyex - centerx) < epsilon && Math.abs(eyey - centery) < epsilon && Math.abs(eyez - centerz) < epsilon) {\n return identityMat4(out);\n }\n\n z0 = eyex - centerx;\n z1 = eyey - centery;\n z2 = eyez - centerz;\n len = 1 / Math.hypot(z0, z1, z2);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n x0 = upy * z2 - upz * z1;\n x1 = upz * z0 - upx * z2;\n x2 = upx * z1 - upy * z0;\n len = Math.hypot(x0, x1, x2);\n\n if (!len) {\n x0 = 0;\n x1 = 0;\n x2 = 0;\n } else {\n len = 1 / len;\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n y0 = z1 * x2 - z2 * x1;\n y1 = z2 * x0 - z0 * x2;\n y2 = z0 * x1 - z1 * x0;\n len = Math.hypot(y0, y1, y2);\n\n if (!len) {\n y0 = 0;\n y1 = 0;\n y2 = 0;\n } else {\n len = 1 / len;\n y0 *= len;\n y1 *= len;\n y2 *= len;\n }\n\n out[0] = x0;\n out[1] = y0;\n out[2] = z0;\n out[3] = 0;\n out[4] = x1;\n out[5] = y1;\n out[6] = z1;\n out[7] = 0;\n out[8] = x2;\n out[9] = y2;\n out[10] = z2;\n out[11] = 0;\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n out[15] = 1;\n return out;\n}\n\n/**\n * 代码来自gl-matrix https://github.com/toji/gl-matrix\n * Generates a orthogonal projection matrix with the given bounds\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} left Left bound of the frustum\n * @param {number} right Right bound of the frustum\n * @param {number} bottom Bottom bound of the frustum\n * @param {number} top Top bound of the frustum\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\n\nexport function ortho(out: mat4, left: number, right: number, bottom: number, top: number, near: number, far: number) {\n const lr = 1 / (left - right);\n const bt = 1 / (bottom - top);\n const nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n}\n/**\n * 代码来自gl-matrix https://github.com/toji/gl-matrix\n * Transforms the vec3 with a mat4.\n * 4th vector component is implicitly '1'\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to transform\n * @param {ReadonlyMat4} m matrix to transform with\n * @returns {vec3} out\n */\n\nexport function transformMat4(out: vec3, a: vec3, m: mat4) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n let w = m[3] * x + m[7] * y + m[11] * z + m[15];\n w = w || 1.0;\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n return out;\n}\n"]}
|
package/es/common/path-svg.js
CHANGED
package/es/common/polygon.js
CHANGED
package/es/common/rect-utils.js
CHANGED
package/es/common/render-area.js
CHANGED
|
@@ -4,9 +4,26 @@ import { Direction } from "./enums";
|
|
|
4
4
|
|
|
5
5
|
import { drawSegItem } from "./render-utils";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
function drawEachCurve(path, curve, lastCurve, defined0, offsetX, offsetY, offsetZ) {
|
|
8
8
|
var _a;
|
|
9
|
-
|
|
9
|
+
let p0 = curve.p0, newDefined0 = defined0;
|
|
10
|
+
if (lastCurve && lastCurve.originP1 === lastCurve.originP2 && (p0 = lastCurve.p0),
|
|
11
|
+
curve.defined) defined0 || (path.lineTo(p0.x + offsetX, p0.y + offsetY, offsetZ),
|
|
12
|
+
newDefined0 = !defined0); else {
|
|
13
|
+
const {originP1: originP1, originP2: originP2} = curve;
|
|
14
|
+
let validP;
|
|
15
|
+
if (originP1 && !1 !== originP1.defined ? validP = p0 : originP1 && !1 !== originP2.defined && (validP = null !== (_a = curve.p3) && void 0 !== _a ? _a : curve.p1),
|
|
16
|
+
defined0) {
|
|
17
|
+
newDefined0 = !defined0;
|
|
18
|
+
const x = validP ? validP.x : curve.p0.x, y = validP ? validP.y : curve.p0.y;
|
|
19
|
+
path.moveTo(x + offsetX, y + offsetY, offsetZ);
|
|
20
|
+
} else validP && (newDefined0 = !defined0, path.lineTo(validP.x + offsetX, validP.y + offsetY, offsetZ));
|
|
21
|
+
}
|
|
22
|
+
return newDefined0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function drawSegments(path, segPath, percent, clipRangeByDimension, params) {
|
|
26
|
+
const {offsetX: offsetX = 0, offsetY: offsetY = 0, offsetZ: offsetZ = 0, mode: mode = "none", drawConnect: drawConnect = !1} = params || {};
|
|
10
27
|
if (drawConnect && "none" === mode) return;
|
|
11
28
|
if (!segPath) return;
|
|
12
29
|
let needMoveTo = !0;
|
|
@@ -15,23 +32,8 @@ export function drawSegments(path, segPath, percent, clipRangeByDimension, param
|
|
|
15
32
|
if (drawConnect) {
|
|
16
33
|
let lastCurve, defined0 = !0;
|
|
17
34
|
curves.forEach(((curve, i) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (curve.originP1 !== curve.originP2) {
|
|
21
|
-
if (lastCurve && lastCurve.originP1 === lastCurve.originP2 && (p0 = lastCurve.p0),
|
|
22
|
-
curve.defined) defined0 || (path.lineTo(p0.x + offsetX, p0.y + offsetY, offsetZ),
|
|
23
|
-
defined0 = !defined0); else {
|
|
24
|
-
const {originP1: originP1, originP2: originP2} = curve;
|
|
25
|
-
let validP;
|
|
26
|
-
if (originP1 && !1 !== originP1.defined ? validP = p0 : originP1 && !1 !== originP2.defined && (validP = null !== (_a = curve.p3) && void 0 !== _a ? _a : curve.p1),
|
|
27
|
-
defined0) {
|
|
28
|
-
defined0 = !defined0;
|
|
29
|
-
const x = validP ? validP.x : curve.p0.x, y = validP ? validP.y : curve.p0.y;
|
|
30
|
-
path.moveTo(x + offsetX, y + offsetY, offsetZ);
|
|
31
|
-
} else validP && (defined0 = !defined0, path.lineTo(validP.x + offsetX, validP.y + offsetY, offsetZ));
|
|
32
|
-
}
|
|
33
|
-
lastCurve = curve;
|
|
34
|
-
} else lastCurve = curve;
|
|
35
|
+
curve.originP1 !== curve.originP2 ? (defined0 = drawEachCurve(path, curve, lastCurve, defined0, offsetX, offsetY, offsetZ),
|
|
36
|
+
lastCurve = curve) : lastCurve = curve;
|
|
35
37
|
}));
|
|
36
38
|
} else curves.forEach((curve => {
|
|
37
39
|
curve.defined ? (needMoveTo && path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ),
|
|
@@ -48,23 +50,11 @@ export function drawSegments(path, segPath, percent, clipRangeByDimension, param
|
|
|
48
50
|
const curve = curves[i], curCurveLength = curve.getLength(direction), _p = (totalDrawLength - drawedLengthUntilLast) / curCurveLength;
|
|
49
51
|
if (drawedLengthUntilLast += curCurveLength, _p < 0) break;
|
|
50
52
|
if (drawConnect) {
|
|
51
|
-
let p0 = curve.p0;
|
|
52
53
|
if (curve.originP1 === curve.originP2) {
|
|
53
54
|
lastCurve = curve;
|
|
54
55
|
continue;
|
|
55
56
|
}
|
|
56
|
-
|
|
57
|
-
curve.defined) defined0 || (path.lineTo(p0.x + offsetX, p0.y + offsetY, offsetZ),
|
|
58
|
-
defined0 = !defined0); else {
|
|
59
|
-
const {originP1: originP1, originP2: originP2} = curve;
|
|
60
|
-
let validP;
|
|
61
|
-
if (originP1 && !1 !== originP1.defined ? validP = p0 : originP1 && !1 !== originP2.defined && (validP = null !== (_a = curve.p3) && void 0 !== _a ? _a : curve.p1),
|
|
62
|
-
defined0) {
|
|
63
|
-
defined0 = !defined0;
|
|
64
|
-
const x = validP ? validP.x : curve.p0.x, y = validP ? validP.y : curve.p0.y;
|
|
65
|
-
path.moveTo(x + offsetX, y + offsetY, offsetZ);
|
|
66
|
-
} else validP && (defined0 = !defined0, path.lineTo(validP.x + offsetX, validP.y + offsetY, offsetZ));
|
|
67
|
-
}
|
|
57
|
+
defined0 = drawEachCurve(path, curve, lastCurve, defined0, offsetX, offsetY, offsetZ),
|
|
68
58
|
lastCurve = curve;
|
|
69
59
|
} else {
|
|
70
60
|
if (!curve.defined) {
|
|
@@ -102,4 +92,5 @@ export function drawIncrementalAreaSegments(path, lastSeg, segments, params) {
|
|
|
102
92
|
path.lineTo(null !== (_c = startP.x1) && void 0 !== _c ? _c : startP.x, null !== (_d = startP.y1) && void 0 !== _d ? _d : startP.y),
|
|
103
93
|
path.closePath();
|
|
104
94
|
}));
|
|
105
|
-
}
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=render-curve.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common/render-curve.ts"],"names":[],"mappings":"AACA,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CAAC;AACL,CAAC","file":"render-curve.js","sourcesContent":["import type { IPoint, IPointLike } from '@visactor/vutils';\nimport { min } from '@visactor/vutils';\nimport type {\n IAreaSegment,\n IClipRangeByDimensionType,\n ICurve,\n IDirection,\n IPath2D,\n ISegment,\n ISegPath2D\n} from '../interface';\nimport { Direction } from './enums';\nimport { drawSegItem } from './render-utils';\n\n/**\n * 绘制连续的线段\n * 绘制长度为总长度percent的path,drawDirection为绘制的方向,也就是percent的方向\n * @param path\n * @param segPath\n * @param percent\n * @param drawDirection 绘制的方向,用于使用percent绘制\n * @param line 用于获取line相关属性\n */\nexport function drawSegments(\n path: IPath2D,\n segPath: ISegPath2D,\n percent: number,\n clipRangeByDimension: IClipRangeByDimensionType,\n params?: {\n offsetX?: number;\n offsetY?: number;\n offsetZ?: number;\n drawConnect?: boolean; // 是否是绘制connect区域的效果\n mode?: 'none' | 'connect' | 'zero';\n zeroX?: number;\n zeroY?: number;\n }\n) {\n const {\n offsetX = 0,\n offsetY = 0,\n offsetZ = 0,\n mode = 'none',\n drawConnect = false,\n zeroX = 0,\n zeroY = 0\n } = params || {};\n // none的connect不需要draw\n if (drawConnect && mode === 'none') {\n return;\n }\n if (!segPath) {\n return;\n }\n let needMoveTo: boolean = true;\n const { curves } = segPath;\n if (percent >= 1) {\n if (drawConnect) {\n // return;\n let defined0 = true;\n let lastCurve: ICurve<IPoint>;\n curves.forEach((curve, i) => {\n // step的逻辑\n let p0 = curve.p0;\n if (curve.originP1 === curve.originP2) {\n lastCurve = curve;\n return;\n }\n if (lastCurve && lastCurve.originP1 === lastCurve.originP2) {\n p0 = lastCurve.p0;\n }\n if (curve.defined) {\n // 非法变合法需要lineTo,合法变非法需要moveTo,初始非法需要moveTo\n if (!defined0) {\n path.lineTo(p0.x + offsetX, p0.y + offsetY, offsetZ);\n defined0 = !defined0;\n }\n } else {\n // 找到合法的点\n const { originP1, originP2 } = curve;\n let validP: IPointLike;\n if (originP1 && originP1.defined !== false) {\n validP = p0;\n } else if (originP1 && originP2.defined !== false) {\n validP = curve.p3 ?? curve.p1;\n }\n // 合法/(初始)变非法,moveTo\n if (defined0) {\n defined0 = !defined0;\n const x = validP ? validP.x : curve.p0.x;\n const y = validP ? validP.y : curve.p0.y;\n path.moveTo(x + offsetX, y + offsetY, offsetZ);\n } else {\n // 非法变非法/合法,看情况要不要lineTo\n if (validP) {\n // 非法变合法,需要lineTo\n defined0 = !defined0;\n path.lineTo(validP.x + offsetX, validP.y + offsetY, offsetZ);\n }\n }\n }\n\n lastCurve = curve;\n });\n } else {\n curves.forEach(curve => {\n // 跳过这个点\n if (!curve.defined) {\n needMoveTo = true;\n return;\n }\n if (needMoveTo) {\n path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ);\n }\n drawSegItem(path, curve, 1, params);\n needMoveTo = false;\n });\n }\n\n return;\n }\n if (percent <= 0) {\n return;\n }\n\n let direction: IDirection | undefined;\n\n if (clipRangeByDimension === 'x') {\n direction = Direction.ROW;\n } else if (clipRangeByDimension === 'y') {\n direction = Direction.COLUMN;\n } else if (clipRangeByDimension === 'auto') {\n direction = segPath.direction;\n }\n\n // 整个线段的总长度\n const totalLength = segPath.tryUpdateLength(direction);\n // 总需要绘制的长度\n const totalDrawLength = percent * totalLength;\n // 直到上次绘制的长度\n let drawedLengthUntilLast = 0;\n let defined0 = true;\n let lastCurve: ICurve<IPoint> = null;\n for (let i = 0, n = curves.length; i < n; i++) {\n const curve = curves[i];\n const curCurveLength = curve.getLength(direction);\n const _p = (totalDrawLength - drawedLengthUntilLast) / curCurveLength;\n drawedLengthUntilLast += curCurveLength;\n if (_p < 0) {\n break;\n }\n\n if (drawConnect) {\n // step的逻辑\n let p0 = curve.p0;\n if (curve.originP1 === curve.originP2) {\n lastCurve = curve;\n continue;\n }\n if (lastCurve && lastCurve.originP1 === lastCurve.originP2) {\n p0 = lastCurve.p0;\n }\n if (curve.defined) {\n // 非法变合法需要lineTo,合法变非法需要moveTo,初始非法需要moveTo\n if (!defined0) {\n path.lineTo(p0.x + offsetX, p0.y + offsetY, offsetZ);\n defined0 = !defined0;\n }\n } else {\n // 找到合法的点\n const { originP1, originP2 } = curve;\n let validP: IPointLike;\n if (originP1 && originP1.defined !== false) {\n validP = p0;\n } else if (originP1 && originP2.defined !== false) {\n validP = curve.p3 ?? curve.p1;\n }\n // 合法/(初始)变非法,moveTo\n if (defined0) {\n defined0 = !defined0;\n const x = validP ? validP.x : curve.p0.x;\n const y = validP ? validP.y : curve.p0.y;\n path.moveTo(x + offsetX, y + offsetY, offsetZ);\n } else {\n // 非法变非法/合法,看情况要不要lineTo\n if (validP) {\n // 非法变合法,需要lineTo\n defined0 = !defined0;\n path.lineTo(validP.x + offsetX, validP.y + offsetY, offsetZ);\n }\n }\n }\n\n lastCurve = curve;\n } else {\n // 跳过这个点\n if (!curve.defined) {\n needMoveTo = true;\n continue;\n }\n if (needMoveTo) {\n path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ);\n }\n drawSegItem(path, curve, min(_p, 1), params);\n needMoveTo = false;\n }\n }\n}\n\nexport function drawIncrementalSegments(\n path: IPath2D,\n lastSeg: ISegment,\n segments: ISegment,\n params?: {\n offsetX?: number;\n offsetY?: number;\n }\n) {\n const { offsetX = 0, offsetY = 0 } = params || {};\n const startP = lastSeg ? lastSeg.points[lastSeg.points.length - 1] : segments.points[0];\n path.moveTo(startP.x + offsetX, startP.y + offsetY);\n segments.points.forEach(p => {\n if (p.defined === false) {\n path.moveTo(p.x + offsetX, p.y + offsetY);\n return;\n }\n path.lineTo(p.x + offsetX, p.y + offsetY);\n });\n}\n\nexport function drawIncrementalAreaSegments(\n path: IPath2D,\n lastSeg: IAreaSegment,\n segments: IAreaSegment,\n params?: {\n offsetX?: number;\n offsetY?: number;\n }\n) {\n const { offsetX = 0, offsetY = 0 } = params || {};\n const { points } = segments;\n // 分段\n const definedPointsList: IPointLike[][] = [];\n let lastIdx = 0;\n for (let i = 0; i < points.length; i++) {\n if (points[i].defined === false) {\n if (lastIdx + 1 !== i) {\n definedPointsList.slice(lastIdx, i);\n }\n lastIdx = i;\n }\n }\n definedPointsList.length === 0;\n definedPointsList.push(points);\n definedPointsList.forEach((points, i) => {\n const startP = lastSeg && i === 0 ? lastSeg.points[lastSeg.points.length - 1] : points[0];\n path.moveTo(startP.x + offsetX, startP.y + offsetY);\n // 绘制上层\n points.forEach(p => {\n if (p.defined === false) {\n path.moveTo(p.x + offsetX, p.y + offsetY);\n return;\n }\n path.lineTo(p.x + offsetX, p.y + offsetY);\n });\n // 绘制下层\n for (let i = points.length - 1; i >= 0; i--) {\n const p = points[i];\n path.lineTo(p.x1 ?? p.x, p.y1 ?? p.y);\n }\n path.lineTo(startP.x1 ?? startP.x, startP.y1 ?? startP.y);\n path.closePath();\n });\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/common/render-curve.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAUvC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,SAAS,aAAa,CACpB,IAAa,EACb,KAAqB,EACrB,SAAyB,EACzB,QAAiB,EACjB,OAAe,EACf,OAAe,EACf,OAAe;;IAEf,IAAI,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;IAClB,IAAI,WAAW,GAAG,QAAQ,CAAC;IAE3B,IAAI,SAAS,IAAI,SAAS,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ,EAAE;QAC1D,EAAE,GAAG,SAAS,CAAC,EAAE,CAAC;KACnB;IACD,IAAI,KAAK,CAAC,OAAO,EAAE;QAEjB,IAAI,CAAC,QAAQ,EAAE;YACb,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,EAAE,EAAE,CAAC,CAAC,GAAG,OAAO,EAAE,OAAO,CAAC,CAAC;YACrD,WAAW,GAAG,CAAC,QAAQ,CA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C,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC;gBAC1C,OAAO;aACR;YACD,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;QAEH,KAAK,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;YAC3C,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YACpB,IAAI,CAAC,MAAM,CAAC,MAAA,CAAC,CAAC,EAAE,mCAAI,CAAC,CAAC,CAAC,EAAE,MAAA,CAAC,CAAC,EAAE,mCAAI,CAAC,CAAC,CAAC,CAAC,CAAC;SACvC;QACD,IAAI,CAAC,MAAM,CAAC,MAAA,MAAM,CAAC,EAAE,mCAAI,MAAM,CAAC,CAAC,EAAE,MAAA,MAAM,CAAC,EAAE,mCAAI,MAAM,CAAC,CAAC,CAAC,CAAC;QAC1D,IAAI,CAAC,SAAS,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC","file":"render-curve.js","sourcesContent":["import type { IPoint, IPointLike } from '@visactor/vutils';\nimport { min } from '@visactor/vutils';\nimport type {\n IAreaSegment,\n IClipRangeByDimensionType,\n ICurve,\n IDirection,\n IPath2D,\n ISegment,\n ISegPath2D\n} from '../interface';\nimport { Direction } from './enums';\nimport { drawSegItem } from './render-utils';\n\nfunction drawEachCurve(\n path: IPath2D,\n curve: ICurve<IPoint>,\n lastCurve: ICurve<IPoint>,\n defined0: boolean,\n offsetX: number,\n offsetY: number,\n offsetZ: number\n) {\n let p0 = curve.p0;\n let newDefined0 = defined0;\n\n if (lastCurve && lastCurve.originP1 === lastCurve.originP2) {\n p0 = lastCurve.p0;\n }\n if (curve.defined) {\n // 非法变合法需要lineTo,合法变非法需要moveTo,初始非法需要moveTo\n if (!defined0) {\n path.lineTo(p0.x + offsetX, p0.y + offsetY, offsetZ);\n newDefined0 = !defined0;\n }\n } else {\n // 找到合法的点\n const { originP1, originP2 } = curve;\n let validP: IPointLike;\n if (originP1 && originP1.defined !== false) {\n validP = p0;\n } else if (originP1 && originP2.defined !== false) {\n validP = curve.p3 ?? curve.p1;\n }\n // 合法/(初始)变非法,moveTo\n if (defined0) {\n newDefined0 = !defined0;\n const x = validP ? validP.x : curve.p0.x;\n const y = validP ? validP.y : curve.p0.y;\n path.moveTo(x + offsetX, y + offsetY, offsetZ);\n } else {\n // 非法变非法/合法,看情况要不要lineTo\n if (validP) {\n // 非法变合法,需要lineTo\n newDefined0 = !defined0;\n path.lineTo(validP.x + offsetX, validP.y + offsetY, offsetZ);\n }\n }\n }\n\n return newDefined0;\n}\n\n/**\n * 绘制连续的线段\n * 绘制长度为总长度percent的path,drawDirection为绘制的方向,也就是percent的方向\n * @param path\n * @param segPath\n * @param percent\n * @param drawDirection 绘制的方向,用于使用percent绘制\n * @param line 用于获取line相关属性\n */\nexport function drawSegments(\n path: IPath2D,\n segPath: ISegPath2D,\n percent: number,\n clipRangeByDimension: IClipRangeByDimensionType,\n params?: {\n offsetX?: number;\n offsetY?: number;\n offsetZ?: number;\n drawConnect?: boolean; // 是否是绘制connect区域的效果\n mode?: 'none' | 'connect' | 'zero';\n zeroX?: number;\n zeroY?: number;\n }\n) {\n const { offsetX = 0, offsetY = 0, offsetZ = 0, mode = 'none', drawConnect = false } = params || {};\n // none的connect不需要draw\n if (drawConnect && mode === 'none') {\n return;\n }\n if (!segPath) {\n return;\n }\n let needMoveTo: boolean = true;\n const { curves } = segPath;\n if (percent >= 1) {\n if (drawConnect) {\n // return;\n let defined0 = true;\n let lastCurve: ICurve<IPoint>;\n curves.forEach((curve, i) => {\n // step的逻辑\n if (curve.originP1 === curve.originP2) {\n lastCurve = curve;\n return;\n }\n defined0 = drawEachCurve(path, curve, lastCurve, defined0, offsetX, offsetY, offsetZ);\n\n lastCurve = curve;\n });\n } else {\n curves.forEach(curve => {\n // 跳过这个点\n if (!curve.defined) {\n needMoveTo = true;\n return;\n }\n if (needMoveTo) {\n path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ);\n }\n drawSegItem(path, curve, 1, params);\n needMoveTo = false;\n });\n }\n\n return;\n }\n if (percent <= 0) {\n return;\n }\n\n let direction: IDirection | undefined;\n\n if (clipRangeByDimension === 'x') {\n direction = Direction.ROW;\n } else if (clipRangeByDimension === 'y') {\n direction = Direction.COLUMN;\n } else if (clipRangeByDimension === 'auto') {\n direction = segPath.direction;\n }\n\n // 整个线段的总长度\n const totalLength = segPath.tryUpdateLength(direction);\n // 总需要绘制的长度\n const totalDrawLength = percent * totalLength;\n // 直到上次绘制的长度\n let drawedLengthUntilLast = 0;\n let defined0 = true;\n let lastCurve: ICurve<IPoint> = null;\n for (let i = 0, n = curves.length; i < n; i++) {\n const curve = curves[i];\n const curCurveLength = curve.getLength(direction);\n const _p = (totalDrawLength - drawedLengthUntilLast) / curCurveLength;\n drawedLengthUntilLast += curCurveLength;\n if (_p < 0) {\n break;\n }\n\n if (drawConnect) {\n // step的逻辑\n if (curve.originP1 === curve.originP2) {\n lastCurve = curve;\n continue;\n }\n defined0 = drawEachCurve(path, curve, lastCurve, defined0, offsetX, offsetY, offsetZ);\n\n lastCurve = curve;\n } else {\n // 跳过这个点\n if (!curve.defined) {\n needMoveTo = true;\n continue;\n }\n if (needMoveTo) {\n path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ);\n }\n drawSegItem(path, curve, min(_p, 1), params);\n needMoveTo = false;\n }\n }\n}\n\nexport function drawIncrementalSegments(\n path: IPath2D,\n lastSeg: ISegment,\n segments: ISegment,\n params?: {\n offsetX?: number;\n offsetY?: number;\n }\n) {\n const { offsetX = 0, offsetY = 0 } = params || {};\n const startP = lastSeg ? lastSeg.points[lastSeg.points.length - 1] : segments.points[0];\n path.moveTo(startP.x + offsetX, startP.y + offsetY);\n segments.points.forEach(p => {\n if (p.defined === false) {\n path.moveTo(p.x + offsetX, p.y + offsetY);\n return;\n }\n path.lineTo(p.x + offsetX, p.y + offsetY);\n });\n}\n\nexport function drawIncrementalAreaSegments(\n path: IPath2D,\n lastSeg: IAreaSegment,\n segments: IAreaSegment,\n params?: {\n offsetX?: number;\n offsetY?: number;\n }\n) {\n const { offsetX = 0, offsetY = 0 } = params || {};\n const { points } = segments;\n // 分段\n const definedPointsList: IPointLike[][] = [];\n let lastIdx = 0;\n for (let i = 0; i < points.length; i++) {\n if (points[i].defined === false) {\n if (lastIdx + 1 !== i) {\n definedPointsList.slice(lastIdx, i);\n }\n lastIdx = i;\n }\n }\n definedPointsList.length === 0;\n definedPointsList.push(points);\n definedPointsList.forEach((points, i) => {\n const startP = lastSeg && i === 0 ? lastSeg.points[lastSeg.points.length - 1] : points[0];\n path.moveTo(startP.x + offsetX, startP.y + offsetY);\n // 绘制上层\n points.forEach(p => {\n if (p.defined === false) {\n path.moveTo(p.x + offsetX, p.y + offsetY);\n return;\n }\n path.lineTo(p.x + offsetX, p.y + offsetY);\n });\n // 绘制下层\n for (let i = points.length - 1; i >= 0; i--) {\n const p = points[i];\n path.lineTo(p.x1 ?? p.x, p.y1 ?? p.y);\n }\n path.lineTo(startP.x1 ?? startP.x, startP.y1 ?? startP.y);\n path.closePath();\n });\n}\n"]}
|
package/es/common/seg-context.js
CHANGED