@visactor/vrender-core 0.20.0-alpha.1 → 0.20.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/animate/Ticker/default-ticker.d.ts +2 -53
- package/cjs/animate/Ticker/default-ticker.js +17 -130
- package/cjs/animate/Ticker/default-ticker.js.map +1 -1
- package/cjs/animate/Ticker/index.d.ts +4 -0
- package/cjs/animate/Ticker/index.js +3 -1
- package/cjs/animate/Ticker/index.js.map +1 -1
- package/cjs/animate/Ticker/manual-ticker-handler.d.ts +15 -0
- package/cjs/animate/Ticker/manual-ticker-handler.js +36 -0
- package/cjs/animate/Ticker/manual-ticker-handler.js.map +1 -0
- package/cjs/animate/Ticker/manual-ticker.d.ts +19 -0
- package/cjs/animate/Ticker/manual-ticker.js +37 -0
- package/cjs/animate/Ticker/manual-ticker.js.map +1 -0
- package/cjs/animate/Ticker/raf-tick-handler.d.ts +9 -0
- package/cjs/animate/Ticker/raf-tick-handler.js +30 -0
- package/cjs/animate/Ticker/raf-tick-handler.js.map +1 -0
- package/cjs/animate/Ticker/timeout-tick-handler.d.ts +9 -0
- package/cjs/animate/Ticker/timeout-tick-handler.js +28 -0
- package/cjs/animate/Ticker/timeout-tick-handler.js.map +1 -0
- package/cjs/animate/Ticker/type.d.ts +6 -0
- package/cjs/animate/Ticker/type.js +11 -0
- package/cjs/animate/Ticker/type.js.map +1 -0
- package/cjs/canvas/conical-gradient.js.map +1 -1
- package/cjs/canvas/contributions/base-canvas.js +4 -13
- package/cjs/canvas/contributions/base-canvas.js.map +1 -1
- package/cjs/common/3d-interceptor.js +1 -2
- package/cjs/common/bounds-context.js +2 -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 -2
- package/cjs/common/render-curve.js +1 -1
- package/cjs/common/render-utils.js +1 -1
- package/cjs/common/seg-context.js +1 -1
- package/cjs/common/segment/catmull-rom-close.d.ts +41 -0
- package/cjs/common/segment/catmull-rom-close.js +81 -0
- package/cjs/common/segment/catmull-rom-close.js.map +1 -0
- package/cjs/common/segment/catmull-rom.d.ts +38 -0
- package/cjs/common/segment/catmull-rom.js +97 -0
- package/cjs/common/segment/catmull-rom.js.map +1 -0
- package/cjs/common/segment/index.d.ts +5 -2
- package/cjs/common/segment/index.js +8 -1
- package/cjs/common/segment/index.js.map +1 -1
- package/cjs/common/simplify.js +1 -1
- package/cjs/common/sort.js +1 -1
- package/cjs/common/split-path.js +1 -1
- package/cjs/common/store.js +1 -1
- package/cjs/common/text.js +4 -3
- package/cjs/common/text.js.map +1 -1
- package/cjs/core/application.js +2 -1
- package/cjs/core/camera.js +1 -1
- package/cjs/core/constants.js +1 -1
- package/cjs/core/contributions/layerHandler/modules.js +2 -5
- package/cjs/core/contributions/layerHandler/modules.js.map +1 -1
- package/cjs/core/core-modules.js +1 -1
- package/cjs/core/global-module.js +2 -0
- package/cjs/core/global.js +1 -1
- package/cjs/core/graphic-utils.js +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.js +1 -1
- package/cjs/core/stage.d.ts +2 -2
- package/cjs/core/stage.js +10 -4
- package/cjs/core/stage.js.map +1 -1
- package/cjs/core/window.js +1 -1
- package/cjs/event/federated-event/base-event.js +12 -2
- package/cjs/event/federated-event/base-event.js.map +1 -1
- package/cjs/graphic/arc.d.ts +6 -4
- package/cjs/graphic/arc.js +46 -17
- package/cjs/graphic/arc.js.map +1 -1
- package/cjs/graphic/arc3d.d.ts +2 -2
- package/cjs/graphic/arc3d.js +8 -9
- package/cjs/graphic/arc3d.js.map +1 -1
- package/cjs/graphic/area.d.ts +5 -3
- package/cjs/graphic/area.js +27 -12
- package/cjs/graphic/area.js.map +1 -1
- package/cjs/graphic/builtin-symbol/index.d.ts +1 -1
- package/cjs/graphic/builtin-symbol/thin-triangle.d.ts +2 -2
- package/cjs/graphic/builtin-symbol/thin-triangle.js +2 -2
- package/cjs/graphic/builtin-symbol/thin-triangle.js.map +1 -1
- package/cjs/graphic/builtin-symbol/triangle-down.d.ts +1 -2
- package/cjs/graphic/builtin-symbol/triangle-down.js +4 -9
- package/cjs/graphic/builtin-symbol/triangle-down.js.map +1 -1
- package/cjs/graphic/builtin-symbol/triangle-left.d.ts +0 -1
- package/cjs/graphic/builtin-symbol/triangle-left.js +3 -8
- package/cjs/graphic/builtin-symbol/triangle-left.js.map +1 -1
- package/cjs/graphic/builtin-symbol/triangle-right.d.ts +1 -2
- package/cjs/graphic/builtin-symbol/triangle-right.js +4 -9
- package/cjs/graphic/builtin-symbol/triangle-right.js.map +1 -1
- package/cjs/graphic/builtin-symbol/triangle-up.d.ts +1 -2
- package/cjs/graphic/builtin-symbol/triangle-up.js +4 -9
- package/cjs/graphic/builtin-symbol/triangle-up.js.map +1 -1
- package/cjs/graphic/builtin-symbol/triangle.d.ts +1 -2
- package/cjs/graphic/builtin-symbol/triangle.js +1 -3
- package/cjs/graphic/builtin-symbol/triangle.js.map +1 -1
- package/cjs/graphic/circle.d.ts +5 -3
- package/cjs/graphic/circle.js +20 -12
- package/cjs/graphic/circle.js.map +1 -1
- package/cjs/graphic/config.js +6 -3
- package/cjs/graphic/config.js.map +1 -1
- package/cjs/graphic/glyph.d.ts +4 -2
- package/cjs/graphic/glyph.js +9 -2
- package/cjs/graphic/glyph.js.map +1 -1
- package/cjs/graphic/graphic-creator.js.map +1 -1
- package/cjs/graphic/graphic-service/common-outer-boder-bounds.d.ts +3 -0
- package/cjs/graphic/graphic-service/common-outer-boder-bounds.js +17 -0
- package/cjs/graphic/graphic-service/common-outer-boder-bounds.js.map +1 -0
- package/cjs/graphic/graphic-service/graphic-service.d.ts +7 -36
- package/cjs/graphic/graphic-service/graphic-service.js +11 -296
- package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
- package/cjs/graphic/graphic-service/symbol-outer-border-bounds.d.ts +3 -0
- package/cjs/graphic/graphic-service/symbol-outer-border-bounds.js +17 -0
- package/cjs/graphic/graphic-service/symbol-outer-border-bounds.js.map +1 -0
- package/cjs/graphic/graphic.d.ts +12 -9
- package/cjs/graphic/graphic.js +17 -2
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/graphic/group.d.ts +7 -3
- package/cjs/graphic/group.js +34 -22
- package/cjs/graphic/group.js.map +1 -1
- package/cjs/graphic/image.d.ts +3 -2
- package/cjs/graphic/image.js +14 -9
- package/cjs/graphic/image.js.map +1 -1
- package/cjs/graphic/line.d.ts +5 -3
- package/cjs/graphic/line.js +24 -11
- package/cjs/graphic/line.js.map +1 -1
- package/cjs/graphic/node-tree.js.map +1 -1
- package/cjs/graphic/path.d.ts +3 -3
- package/cjs/graphic/path.js +17 -13
- package/cjs/graphic/path.js.map +1 -1
- package/cjs/graphic/polygon.d.ts +4 -3
- package/cjs/graphic/polygon.js +16 -11
- package/cjs/graphic/polygon.js.map +1 -1
- package/cjs/graphic/pyramid3d.d.ts +2 -2
- package/cjs/graphic/pyramid3d.js +10 -9
- package/cjs/graphic/pyramid3d.js.map +1 -1
- package/cjs/graphic/rect.d.ts +3 -3
- package/cjs/graphic/rect.js +16 -12
- package/cjs/graphic/rect.js.map +1 -1
- package/cjs/graphic/rect3d.js +2 -2
- package/cjs/graphic/rect3d.js.map +1 -1
- package/cjs/graphic/richtext/icon.d.ts +2 -2
- package/cjs/graphic/richtext/icon.js.map +1 -1
- package/cjs/graphic/richtext.d.ts +3 -3
- package/cjs/graphic/richtext.js +44 -12
- package/cjs/graphic/richtext.js.map +1 -1
- package/cjs/graphic/shadow-root.d.ts +2 -2
- package/cjs/graphic/shadow-root.js.map +1 -1
- package/cjs/graphic/symbol.d.ts +5 -3
- package/cjs/graphic/symbol.js +25 -12
- package/cjs/graphic/symbol.js.map +1 -1
- package/cjs/graphic/text.d.ts +10 -10
- package/cjs/graphic/text.js +26 -20
- package/cjs/graphic/text.js.map +1 -1
- package/cjs/graphic/theme.js.map +1 -1
- package/cjs/graphic/wrap-text.d.ts +1 -1
- package/cjs/graphic/wrap-text.js +2 -2
- package/cjs/graphic/wrap-text.js.map +1 -1
- package/cjs/index.d.ts +2 -0
- package/cjs/index.js +3 -1
- package/cjs/index.js.map +1 -1
- package/cjs/interface/graphic/arc.d.ts +2 -2
- package/cjs/interface/graphic/arc.js.map +1 -1
- package/cjs/interface/graphic/arc3d.d.ts +1 -1
- package/cjs/interface/graphic/arc3d.js.map +1 -1
- package/cjs/interface/graphic/area.d.ts +1 -0
- package/cjs/interface/graphic/area.js.map +1 -1
- package/cjs/interface/graphic/line.d.ts +1 -0
- package/cjs/interface/graphic/line.js.map +1 -1
- package/cjs/interface/graphic-service.d.ts +10 -17
- package/cjs/interface/graphic-service.js.map +1 -1
- package/cjs/interface/graphic.d.ts +2 -0
- package/cjs/interface/graphic.js.map +1 -1
- package/cjs/picker/pick-interceptor.js +5 -3
- package/cjs/picker/pick-interceptor.js.map +1 -1
- package/cjs/plugins/builtin-plugin/3dview-transform-plugin.d.ts +1 -0
- package/cjs/plugins/builtin-plugin/3dview-transform-plugin.js +8 -2
- package/cjs/plugins/builtin-plugin/3dview-transform-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/auto-render-plugin.d.ts +2 -1
- package/cjs/plugins/builtin-plugin/auto-render-plugin.js +10 -8
- package/cjs/plugins/builtin-plugin/auto-render-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.d.ts +1 -0
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +8 -2
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.js +1 -1
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
- package/cjs/render/contributions/render/arc-render.js +15 -28
- package/cjs/render/contributions/render/arc-render.js.map +1 -1
- package/cjs/render/contributions/render/area-render.js +11 -6
- package/cjs/render/contributions/render/area-render.js.map +1 -1
- package/cjs/render/contributions/render/base-render.d.ts +1 -1
- package/cjs/render/contributions/render/base-render.js.map +1 -1
- package/cjs/render/contributions/render/index.d.ts +1 -0
- package/cjs/render/contributions/render/index.js +3 -3
- package/cjs/render/contributions/render/index.js.map +1 -1
- package/cjs/render/contributions/render/line-render.js +6 -3
- package/cjs/render/contributions/render/line-render.js.map +1 -1
- package/cjs/render/contributions/render/symbol-render.js +1 -1
- package/cjs/render/contributions/render/symbol-render.js.map +1 -1
- package/cjs/render/contributions/render/utils.d.ts +24 -0
- package/cjs/render/contributions/render/utils.js +56 -23
- package/cjs/render/contributions/render/utils.js.map +1 -1
- package/dist/index.es.js +6911 -7082
- package/es/animate/Ticker/default-ticker.d.ts +2 -53
- package/es/animate/Ticker/default-ticker.js +3 -106
- package/es/animate/Ticker/default-ticker.js.map +1 -1
- package/es/animate/Ticker/index.d.ts +4 -0
- package/es/animate/Ticker/index.js +8 -0
- package/es/animate/Ticker/index.js.map +1 -1
- package/es/animate/Ticker/manual-ticker-handler.d.ts +15 -0
- package/es/animate/Ticker/manual-ticker-handler.js +28 -0
- package/es/animate/Ticker/manual-ticker-handler.js.map +1 -0
- package/es/animate/Ticker/manual-ticker.d.ts +19 -0
- package/es/animate/Ticker/manual-ticker.js +31 -0
- package/es/animate/Ticker/manual-ticker.js.map +1 -0
- package/es/animate/Ticker/raf-tick-handler.d.ts +9 -0
- package/es/animate/Ticker/raf-tick-handler.js +22 -0
- package/es/animate/Ticker/raf-tick-handler.js.map +1 -0
- package/es/animate/Ticker/timeout-tick-handler.d.ts +9 -0
- package/es/animate/Ticker/timeout-tick-handler.js +20 -0
- package/es/animate/Ticker/timeout-tick-handler.js.map +1 -0
- package/es/animate/Ticker/type.d.ts +6 -0
- package/es/animate/Ticker/type.js +7 -0
- package/es/animate/Ticker/type.js.map +1 -0
- package/es/canvas/conical-gradient.js.map +1 -1
- package/es/canvas/contributions/base-canvas.js +3 -15
- package/es/canvas/contributions/base-canvas.js.map +1 -1
- package/es/common/3d-interceptor.js +1 -2
- package/es/common/bounds-context.js +2 -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 -2
- package/es/common/render-curve.js +1 -1
- package/es/common/render-utils.js +1 -1
- package/es/common/seg-context.js +1 -1
- package/es/common/segment/catmull-rom-close.d.ts +41 -0
- package/es/common/segment/catmull-rom-close.js +74 -0
- package/es/common/segment/catmull-rom-close.js.map +1 -0
- package/es/common/segment/catmull-rom.d.ts +38 -0
- package/es/common/segment/catmull-rom.js +92 -0
- package/es/common/segment/catmull-rom.js.map +1 -0
- package/es/common/segment/index.d.ts +5 -2
- package/es/common/segment/index.js +11 -0
- package/es/common/segment/index.js.map +1 -1
- package/es/common/simplify.js +1 -1
- package/es/common/sort.js +1 -1
- package/es/common/split-path.js +1 -1
- package/es/common/store.js +1 -1
- package/es/common/text.js +5 -4
- package/es/common/text.js.map +1 -1
- package/es/core/application.js +2 -1
- package/es/core/camera.js +1 -1
- package/es/core/constants.js +1 -1
- package/es/core/contributions/layerHandler/modules.js +2 -9
- package/es/core/contributions/layerHandler/modules.js.map +1 -1
- package/es/core/core-modules.js +1 -1
- package/es/core/global-module.js +2 -0
- package/es/core/global.js +1 -1
- package/es/core/graphic-utils.js +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.js +1 -1
- package/es/core/stage.d.ts +2 -2
- package/es/core/stage.js +9 -7
- package/es/core/stage.js.map +1 -1
- package/es/core/window.js +1 -1
- package/es/event/federated-event/base-event.js +12 -2
- package/es/event/federated-event/base-event.js.map +1 -1
- package/es/graphic/arc.d.ts +6 -4
- package/es/graphic/arc.js +47 -16
- package/es/graphic/arc.js.map +1 -1
- package/es/graphic/arc3d.d.ts +2 -2
- package/es/graphic/arc3d.js +7 -10
- package/es/graphic/arc3d.js.map +1 -1
- package/es/graphic/area.d.ts +5 -3
- package/es/graphic/area.js +28 -11
- package/es/graphic/area.js.map +1 -1
- package/es/graphic/builtin-symbol/index.d.ts +1 -1
- package/es/graphic/builtin-symbol/thin-triangle.d.ts +2 -2
- package/es/graphic/builtin-symbol/thin-triangle.js +2 -2
- package/es/graphic/builtin-symbol/thin-triangle.js.map +1 -1
- package/es/graphic/builtin-symbol/triangle-down.d.ts +1 -2
- package/es/graphic/builtin-symbol/triangle-down.js +2 -7
- package/es/graphic/builtin-symbol/triangle-down.js.map +1 -1
- package/es/graphic/builtin-symbol/triangle-left.d.ts +0 -1
- package/es/graphic/builtin-symbol/triangle-left.js +1 -6
- package/es/graphic/builtin-symbol/triangle-left.js.map +1 -1
- package/es/graphic/builtin-symbol/triangle-right.d.ts +1 -2
- package/es/graphic/builtin-symbol/triangle-right.js +2 -7
- package/es/graphic/builtin-symbol/triangle-right.js.map +1 -1
- package/es/graphic/builtin-symbol/triangle-up.d.ts +1 -2
- package/es/graphic/builtin-symbol/triangle-up.js +2 -7
- package/es/graphic/builtin-symbol/triangle-up.js.map +1 -1
- package/es/graphic/builtin-symbol/triangle.d.ts +1 -2
- package/es/graphic/builtin-symbol/triangle.js +1 -3
- package/es/graphic/builtin-symbol/triangle.js.map +1 -1
- package/es/graphic/circle.d.ts +5 -3
- package/es/graphic/circle.js +23 -9
- package/es/graphic/circle.js.map +1 -1
- package/es/graphic/config.js +6 -3
- package/es/graphic/config.js.map +1 -1
- package/es/graphic/glyph.d.ts +4 -2
- package/es/graphic/glyph.js +9 -1
- package/es/graphic/glyph.js.map +1 -1
- package/es/graphic/graphic-creator.js.map +1 -1
- package/es/graphic/graphic-service/common-outer-boder-bounds.d.ts +3 -0
- package/es/graphic/graphic-service/common-outer-boder-bounds.js +9 -0
- package/es/graphic/graphic-service/common-outer-boder-bounds.js.map +1 -0
- package/es/graphic/graphic-service/graphic-service.d.ts +7 -36
- package/es/graphic/graphic-service/graphic-service.js +11 -297
- package/es/graphic/graphic-service/graphic-service.js.map +1 -1
- package/es/graphic/graphic-service/symbol-outer-border-bounds.d.ts +3 -0
- package/es/graphic/graphic-service/symbol-outer-border-bounds.js +11 -0
- package/es/graphic/graphic-service/symbol-outer-border-bounds.js.map +1 -0
- package/es/graphic/graphic.d.ts +12 -9
- package/es/graphic/graphic.js +20 -3
- package/es/graphic/graphic.js.map +1 -1
- package/es/graphic/group.d.ts +7 -3
- package/es/graphic/group.js +32 -22
- package/es/graphic/group.js.map +1 -1
- package/es/graphic/image.d.ts +3 -2
- package/es/graphic/image.js +15 -8
- package/es/graphic/image.js.map +1 -1
- package/es/graphic/line.d.ts +5 -3
- package/es/graphic/line.js +25 -10
- package/es/graphic/line.js.map +1 -1
- package/es/graphic/node-tree.js.map +1 -1
- package/es/graphic/path.d.ts +3 -3
- package/es/graphic/path.js +18 -12
- package/es/graphic/path.js.map +1 -1
- package/es/graphic/polygon.d.ts +4 -3
- package/es/graphic/polygon.js +17 -10
- package/es/graphic/polygon.js.map +1 -1
- package/es/graphic/pyramid3d.d.ts +2 -2
- package/es/graphic/pyramid3d.js +8 -10
- package/es/graphic/pyramid3d.js.map +1 -1
- package/es/graphic/rect.d.ts +3 -3
- package/es/graphic/rect.js +16 -10
- package/es/graphic/rect.js.map +1 -1
- package/es/graphic/rect3d.js +1 -3
- package/es/graphic/rect3d.js.map +1 -1
- package/es/graphic/richtext/icon.d.ts +2 -2
- package/es/graphic/richtext/icon.js.map +1 -1
- package/es/graphic/richtext.d.ts +3 -3
- package/es/graphic/richtext.js +43 -11
- package/es/graphic/richtext.js.map +1 -1
- package/es/graphic/shadow-root.d.ts +2 -2
- package/es/graphic/shadow-root.js.map +1 -1
- package/es/graphic/symbol.d.ts +5 -3
- package/es/graphic/symbol.js +26 -11
- package/es/graphic/symbol.js.map +1 -1
- package/es/graphic/text.d.ts +10 -10
- package/es/graphic/text.js +27 -22
- package/es/graphic/text.js.map +1 -1
- package/es/graphic/theme.js.map +1 -1
- package/es/graphic/wrap-text.d.ts +1 -1
- package/es/graphic/wrap-text.js +1 -3
- package/es/graphic/wrap-text.js.map +1 -1
- package/es/index.d.ts +2 -0
- package/es/index.js +4 -0
- package/es/index.js.map +1 -1
- package/es/interface/graphic/arc.d.ts +2 -2
- package/es/interface/graphic/arc.js.map +1 -1
- package/es/interface/graphic/arc3d.d.ts +1 -1
- package/es/interface/graphic/arc3d.js.map +1 -1
- package/es/interface/graphic/area.d.ts +1 -0
- package/es/interface/graphic/area.js.map +1 -1
- package/es/interface/graphic/line.d.ts +1 -0
- package/es/interface/graphic/line.js.map +1 -1
- package/es/interface/graphic-service.d.ts +10 -17
- package/es/interface/graphic-service.js.map +1 -1
- package/es/interface/graphic.d.ts +2 -0
- package/es/interface/graphic.js.map +1 -1
- package/es/picker/pick-interceptor.js +6 -2
- package/es/picker/pick-interceptor.js.map +1 -1
- package/es/plugins/builtin-plugin/3dview-transform-plugin.d.ts +1 -0
- package/es/plugins/builtin-plugin/3dview-transform-plugin.js +6 -0
- package/es/plugins/builtin-plugin/3dview-transform-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/auto-render-plugin.d.ts +2 -1
- package/es/plugins/builtin-plugin/auto-render-plugin.js +9 -8
- package/es/plugins/builtin-plugin/auto-render-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/flex-layout-plugin.d.ts +1 -0
- package/es/plugins/builtin-plugin/flex-layout-plugin.js +6 -0
- package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/html-attribute-plugin.js +1 -1
- package/es/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
- package/es/render/contributions/render/arc-render.js +10 -16
- package/es/render/contributions/render/arc-render.js.map +1 -1
- package/es/render/contributions/render/area-render.js +11 -5
- package/es/render/contributions/render/area-render.js.map +1 -1
- package/es/render/contributions/render/base-render.d.ts +1 -1
- package/es/render/contributions/render/base-render.js.map +1 -1
- package/es/render/contributions/render/index.d.ts +1 -0
- package/es/render/contributions/render/index.js +2 -0
- package/es/render/contributions/render/index.js.map +1 -1
- package/es/render/contributions/render/line-render.js +6 -3
- package/es/render/contributions/render/line-render.js.map +1 -1
- package/es/render/contributions/render/symbol-render.js +1 -1
- package/es/render/contributions/render/symbol-render.js.map +1 -1
- package/es/render/contributions/render/utils.d.ts +24 -0
- package/es/render/contributions/render/utils.js +46 -15
- package/es/render/contributions/render/utils.js.map +1 -1
- package/package.json +2 -2
- package/cjs/graphic/graphic-service/common-contribution.d.ts +0 -5
- package/cjs/graphic/graphic-service/common-contribution.js +0 -19
- package/cjs/graphic/graphic-service/common-contribution.js.map +0 -1
- package/cjs/graphic/graphic-service/symbol-contribution.d.ts +0 -6
- package/cjs/graphic/graphic-service/symbol-contribution.js +0 -21
- package/cjs/graphic/graphic-service/symbol-contribution.js.map +0 -1
- package/es/graphic/graphic-service/common-contribution.d.ts +0 -5
- package/es/graphic/graphic-service/common-contribution.js +0 -11
- package/es/graphic/graphic-service/common-contribution.js.map +0 -1
- package/es/graphic/graphic-service/symbol-contribution.d.ts +0 -6
- package/es/graphic/graphic-service/symbol-contribution.js +0 -15
- package/es/graphic/graphic-service/symbol-contribution.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/canvas/contributions/base-canvas.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/canvas/contributions/base-canvas.ts"],"names":[],"mappings":"AAEA,MAAM,aAAa,GAAG;IACpB,KAAK,EAAE,GAAG;IACV,MAAM,EAAE,GAAG;IACX,GAAG,EAAE,CAAC;CACP,CAAC;AAEF,MAAM,OAAgB,UAAU;IAoB9B,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC;IACtC,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,IAAI,CA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AAC;SACtB;QAED,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpB,CAAC;IAED,eAAe;QACb,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IACD,IAAI;QACF,OAAO;IACT,CAAC;IACD,IAAI;QACF,OAAO;IACT,CAAC;IAID,aAAa;QACX,OAAO;IACT,CAAC;IAED,UAAU,CAAC,MAAiC;QAC1C,OAAO;IACT,CAAC;IAOD,MAAM,CAAC,KAAa,EAAE,MAAc;QAClC,OAAO;IACT,CAAC;IAKD,SAAS,CAAC,QAAiB,EAAE,OAAgB;QAC3C,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,UAAU,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS;QACnD,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,aAAa,CAAC,OAAiF;QAC7F,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;IAED,qBAAqB;QACnB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;IAED,OAAO,CAAC,GAAG,MAAW;QACpB,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,IAAI,CAAC,aAAa,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;SACtG;IACH,CAAC;;AA9KM,cAAG,GAAY,SAAS,CAAC","file":"base-canvas.js","sourcesContent":["import type { CanvasConfigType, ICanvas, IContext2d, EnvType } from '../../interface';\n\nconst DefaultConfig = {\n WIDTH: 500,\n HEIGHT: 500,\n DPR: 1\n};\n\nexport abstract class BaseCanvas implements ICanvas {\n static env: EnvType = 'browser';\n // 显示的宽高,如果是离屏canvas,就是pixelWidth / pixelRatio\n protected _displayWidth: number; // 显示的宽度\n protected _displayHeight: number; // 显示的高度\n protected _id: number | string;\n // 像素宽高\n protected _pixelWidth: number; // 像素宽度\n protected _pixelHeight: number; // 像素高度\n\n protected _x: number;\n protected _y: number;\n protected _dpr: number;\n\n protected _container?: HTMLElement | null;\n protected _nativeCanvas: HTMLCanvasElement;\n protected _context: IContext2d;\n protected _visiable: boolean;\n protected controled: boolean;\n\n get displayWidth(): number {\n return this._pixelWidth / this._dpr;\n }\n\n get displayHeight(): number {\n return this._pixelHeight / this._dpr;\n }\n /**\n * TODO\n * get\\set 方法看看是否可以删掉\n */\n get id(): number | string {\n return this._id;\n }\n get x(): number {\n return this._x;\n }\n set x(_x: number) {\n this._x = _x;\n }\n get y(): number {\n return this._y;\n }\n set y(_y: number) {\n this._y = _y;\n }\n get nativeCanvas(): HTMLCanvasElement {\n return this._nativeCanvas;\n }\n\n get width(): number {\n return this._pixelWidth;\n }\n set width(width: number) {\n this._pixelWidth = width;\n this._displayWidth = width / (this._dpr || 1);\n }\n\n get height(): number {\n return this._pixelHeight;\n }\n set height(height: number) {\n this._pixelHeight = height;\n this._displayHeight = height / (this._dpr || 1);\n }\n getContext(str?: string): IContext2d {\n return this._context;\n }\n\n get visiable(): boolean {\n return this._visiable;\n }\n set visiable(visiable: boolean) {\n this._visiable = visiable;\n visiable ? this.show() : this.hide();\n }\n\n get dpr(): number {\n return this._dpr;\n }\n set dpr(dpr: number) {\n // this._lastPixelRatio = this._pixelRatio;\n this._dpr = dpr;\n this.resize(this._displayWidth, this._displayHeight);\n }\n\n /**\n * 通过canvas生成一个wrap对象,初始化时不会再设置canvas的属性\n * @param params\n */\n constructor(params: CanvasConfigType) {\n const {\n nativeCanvas,\n width = DefaultConfig.WIDTH,\n height = DefaultConfig.HEIGHT,\n dpr = DefaultConfig.DPR,\n x,\n y,\n id,\n canvasControled = true\n } = params;\n const offsetX = 0;\n const offsetY = 0;\n this._x = x ?? offsetX;\n this._y = y ?? offsetY;\n this._pixelWidth = width * dpr;\n this._pixelHeight = height * dpr;\n this._visiable = params.visiable !== false;\n this.controled = canvasControled;\n\n // 离屏canvas\n this._displayWidth = width;\n this._displayHeight = height;\n this._dpr = dpr;\n this._nativeCanvas = nativeCanvas;\n this._id = nativeCanvas.id ?? id;\n if (id) {\n nativeCanvas.id = id;\n }\n\n this.init(params);\n }\n\n getNativeCanvas(): HTMLCanvasElement {\n return this._nativeCanvas;\n }\n hide() {\n return;\n }\n show() {\n return;\n }\n\n abstract init(params: CanvasConfigType): void;\n\n applyPosition(): void {\n return;\n }\n\n resetStyle(params: Partial<CanvasConfigType>): void {\n return;\n }\n\n /**\n * 设置canvas的size大小,设置context的scale\n * @param width\n * @param height\n */\n resize(width: number, height: number): void {\n return;\n }\n\n toDataURL(): string;\n toDataURL(mimeType: 'image/png'): string;\n toDataURL(mimeType: 'image/jpeg', quality: number): string;\n toDataURL(mimeType?: string, quality?: number) {\n return '';\n }\n\n readPixels(x: number, y: number, w: number, h: number): ImageData | Promise<ImageData> {\n return this._context.getImageData(x, y, w, h);\n }\n\n convertToBlob(options?: { type?: string | undefined; quality?: number | undefined } | undefined): Promise<Blob> {\n throw new Error('暂未实现');\n }\n\n transferToImageBitmap(): ImageBitmap {\n throw new Error('暂未实现');\n }\n\n release(...params: any): void {\n if (this.controled) {\n this._nativeCanvas.parentElement && this._nativeCanvas.parentElement.removeChild(this._nativeCanvas);\n }\n }\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
package/es/common/seg-context.js
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type IPointLike } from '@visactor/vutils';
|
|
2
|
+
import type { ICurvedSegment, IGenSegmentParams, ISegPath2D } from '../../interface/curve';
|
|
3
|
+
export declare class CatmullRomClosed implements ICurvedSegment {
|
|
4
|
+
private _lastDefined1?;
|
|
5
|
+
private _lastDefined2?;
|
|
6
|
+
context: ISegPath2D;
|
|
7
|
+
protected startPoint?: IPointLike;
|
|
8
|
+
lastPoint0?: IPointLike;
|
|
9
|
+
lastPoint1?: IPointLike;
|
|
10
|
+
constructor(context: ISegPath2D, alpha?: number, startPoint?: IPointLike);
|
|
11
|
+
_alpha: number;
|
|
12
|
+
_x: number;
|
|
13
|
+
_y: number;
|
|
14
|
+
_x0: number;
|
|
15
|
+
_x1: number;
|
|
16
|
+
_y0: number;
|
|
17
|
+
_y1: number;
|
|
18
|
+
_x2: number;
|
|
19
|
+
_y2: number;
|
|
20
|
+
_x3: number;
|
|
21
|
+
_y3: number;
|
|
22
|
+
_x4: number;
|
|
23
|
+
_y4: number;
|
|
24
|
+
_x5: number;
|
|
25
|
+
_y5: number;
|
|
26
|
+
_line: number;
|
|
27
|
+
_point: number;
|
|
28
|
+
_l01_a: number;
|
|
29
|
+
_l12_a: number;
|
|
30
|
+
_l23_a: number;
|
|
31
|
+
_l01_2a: number;
|
|
32
|
+
_l12_2a: number;
|
|
33
|
+
_l23_2a: number;
|
|
34
|
+
areaStart(): void;
|
|
35
|
+
areaEnd(): void;
|
|
36
|
+
lineStart(): void;
|
|
37
|
+
lineEnd(): void;
|
|
38
|
+
point(p: IPointLike): void;
|
|
39
|
+
tryUpdateLength(): number;
|
|
40
|
+
}
|
|
41
|
+
export declare const genCatmullRomClosedSegments: (points: IPointLike[], alpha: number, params?: IGenSegmentParams) => ISegPath2D;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { commonGenCatmullRomSegments, point } from "./catmull-rom";
|
|
2
|
+
|
|
3
|
+
export class CatmullRomClosed {
|
|
4
|
+
constructor(context, alpha = .5, startPoint) {
|
|
5
|
+
this.context = context, this.startPoint = startPoint, this._alpha = alpha;
|
|
6
|
+
}
|
|
7
|
+
areaStart() {
|
|
8
|
+
this._line = 0;
|
|
9
|
+
}
|
|
10
|
+
areaEnd() {
|
|
11
|
+
this._line = NaN;
|
|
12
|
+
}
|
|
13
|
+
lineStart() {
|
|
14
|
+
this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN,
|
|
15
|
+
this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
|
|
16
|
+
}
|
|
17
|
+
lineEnd() {
|
|
18
|
+
switch (this._point) {
|
|
19
|
+
case 1:
|
|
20
|
+
this.context.moveTo(this._x3, this._y3, this.lastPoint1), this.context.closePath();
|
|
21
|
+
break;
|
|
22
|
+
|
|
23
|
+
case 2:
|
|
24
|
+
this.context.lineTo(this._x3, this._y3, !1 !== this._lastDefined1 && !1 !== this._lastDefined2, this.lastPoint1),
|
|
25
|
+
this.context.closePath();
|
|
26
|
+
break;
|
|
27
|
+
|
|
28
|
+
case 3:
|
|
29
|
+
this.point({
|
|
30
|
+
x: this._x3,
|
|
31
|
+
y: this._y3
|
|
32
|
+
}), this.point({
|
|
33
|
+
x: this._x4,
|
|
34
|
+
y: this._y4
|
|
35
|
+
}), this.point({
|
|
36
|
+
x: this._x5,
|
|
37
|
+
y: this._y5
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
point(p) {
|
|
42
|
+
const {x: x, y: y} = p;
|
|
43
|
+
if (this._point) {
|
|
44
|
+
const x23 = this._x2 - x, y23 = this._y2 - y;
|
|
45
|
+
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
|
|
46
|
+
}
|
|
47
|
+
switch (this._point) {
|
|
48
|
+
case 0:
|
|
49
|
+
this._point = 1, this._x3 = x, this._y3 = y;
|
|
50
|
+
break;
|
|
51
|
+
|
|
52
|
+
case 1:
|
|
53
|
+
this._point = 2, this.context.moveTo(this._x4 = x, this._y4 = y, p);
|
|
54
|
+
break;
|
|
55
|
+
|
|
56
|
+
case 2:
|
|
57
|
+
this._point = 3, this._x5 = x, this._y5 = y;
|
|
58
|
+
break;
|
|
59
|
+
|
|
60
|
+
default:
|
|
61
|
+
point(this, x, y, !1 !== this._lastDefined1 && !1 !== this._lastDefined2, p);
|
|
62
|
+
}
|
|
63
|
+
this._l01_a = this._l12_a, this._l12_a = this._l23_a, this._l01_2a = this._l12_2a,
|
|
64
|
+
this._l12_2a = this._l23_2a, this._x0 = this._x1, this._x1 = this._x2, this._x2 = x,
|
|
65
|
+
this._y0 = this._y1, this._y1 = this._y2, this._y2 = y, this._lastDefined1 = this._lastDefined2,
|
|
66
|
+
this._lastDefined2 = p.defined, this.lastPoint0 = this.lastPoint1, this.lastPoint1 = p;
|
|
67
|
+
}
|
|
68
|
+
tryUpdateLength() {
|
|
69
|
+
return this.context.tryUpdateLength();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export const genCatmullRomClosedSegments = commonGenCatmullRomSegments("catmullRomClosed", CatmullRomClosed);
|
|
74
|
+
//# sourceMappingURL=catmull-rom-close.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/common/segment/catmull-rom-close.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,2BAA2B,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEnE,MAAM,OAAO,gBAAgB;IAS3B,YAAY,OAAmB,EAAE,QAAgB,GAAG,EAAE,UAAuB;QAC3E,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAyBD,SAAS;QACP,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IACjB,CAAC;IACD,OAAO;QACL,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;IACnB,CAAC;IACD,SAAS;QACP,IAAI,CAAC,GAAG;YACN,IAAI,CAAC,GAAG;gBACR,IAAI,CAAC,GAAG;oBACR,IAAI,CAAC,GAAG;wBACR,IAAI,CAAC,GAAG;4BACR,IAAI,CAAC,GAAG;gCACR,IAAI,CAAC,GAAG;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KAAK,IAAI,IAAI,CAAC,aAAa,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC;gBAC1F,MAAM;SACT;QAED,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;QACzD,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7D,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QAC7D,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QAE7D,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;QACxC,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;IACtB,CAAC;IAED,eAAe;QACb,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC;IACxC,CAAC;CACF;AAMD,MAAM,CAAC,MAAM,2BAA2B,GAAG,2BAA2B,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAC","file":"catmull-rom-close.js","sourcesContent":["import { epsilon, type IPointLike } from '@visactor/vutils';\nimport { genLinearSegments } from './linear';\nimport { genCurveSegments, genSegContext } from './common';\nimport type { ICurvedSegment, IGenSegmentParams, ILinearSegment, ISegPath2D } from '../../interface/curve';\nimport { commonGenCatmullRomSegments, point } from './catmull-rom';\n\nexport class CatmullRomClosed implements ICurvedSegment {\n private _lastDefined1?: boolean;\n private _lastDefined2?: boolean;\n declare context: ISegPath2D;\n\n protected startPoint?: IPointLike;\n lastPoint0?: IPointLike;\n lastPoint1?: IPointLike;\n\n constructor(context: ISegPath2D, alpha: number = 0.5, startPoint?: IPointLike) {\n this.context = context;\n this.startPoint = startPoint;\n this._alpha = alpha;\n }\n _alpha: number;\n _x: number;\n _y: number;\n _x0: number;\n _x1: number;\n _y0: number;\n _y1: number;\n _x2: number;\n _y2: number;\n _x3: number;\n _y3: number;\n _x4: number;\n _y4: number;\n _x5: number;\n _y5: number;\n _line: number;\n _point: number;\n _l01_a: number;\n _l12_a: number;\n _l23_a: number;\n _l01_2a: number;\n _l12_2a: number;\n _l23_2a: number;\n\n areaStart() {\n this._line = 0;\n }\n areaEnd() {\n this._line = NaN;\n }\n lineStart() {\n this._x0 =\n this._x1 =\n this._x2 =\n this._x3 =\n this._x4 =\n this._x5 =\n this._y0 =\n this._y1 =\n this._y2 =\n this._y3 =\n this._y4 =\n this._y5 =\n NaN;\n this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;\n }\n lineEnd() {\n switch (this._point) {\n case 1: {\n this.context.moveTo(this._x3, this._y3, this.lastPoint1);\n this.context.closePath();\n break;\n }\n case 2: {\n this.context.lineTo(\n this._x3,\n this._y3,\n this._lastDefined1 !== false && this._lastDefined2 !== false,\n this.lastPoint1\n );\n this.context.closePath();\n break;\n }\n case 3: {\n this.point({ x: this._x3, y: this._y3 });\n this.point({ x: this._x4, y: this._y4 });\n this.point({ x: this._x5, y: this._y5 });\n break;\n }\n }\n }\n point(p: IPointLike): void {\n const { x, y } = p;\n\n if (this._point) {\n const x23 = this._x2 - x;\n const y23 = this._y2 - y;\n this._l23_a = Math.sqrt((this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)));\n }\n\n switch (this._point) {\n case 0:\n this._point = 1;\n (this._x3 = x), (this._y3 = y);\n break;\n case 1:\n this._point = 2;\n this.context.moveTo((this._x4 = x), (this._y4 = y), p);\n break;\n case 2:\n this._point = 3;\n (this._x5 = x), (this._y5 = y);\n break;\n default:\n point(this as any, x, y, this._lastDefined1 !== false && this._lastDefined2 !== false, p);\n break;\n }\n\n (this._l01_a = this._l12_a), (this._l12_a = this._l23_a);\n (this._l01_2a = this._l12_2a), (this._l12_2a = this._l23_2a);\n (this._x0 = this._x1), (this._x1 = this._x2), (this._x2 = x);\n (this._y0 = this._y1), (this._y1 = this._y2), (this._y2 = y);\n\n this._lastDefined1 = this._lastDefined2;\n this._lastDefined2 = p.defined;\n this.lastPoint0 = this.lastPoint1;\n this.lastPoint1 = p;\n }\n\n tryUpdateLength(): number {\n return this.context.tryUpdateLength();\n }\n}\n\n// export function genCatmullRomClosedTypeSegments(path: ILinearSegment, points: IPointLike[]): void {\n// return genCurveSegments(path, points, 2);\n// }\n\nexport const genCatmullRomClosedSegments = commonGenCatmullRomSegments('catmullRomClosed', CatmullRomClosed);\n\n// export function genCatmullRomClosedSegments(\n// points: IPointLike[],\n// alpha: number,\n// params: IGenSegmentParams = {}\n// ): ISegPath2D | null {\n// const { direction, startPoint } = params;\n// if (points.length < 2 - Number(!!startPoint)) {\n// return null;\n// }\n// if (points.length < 3 - Number(!!startPoint)) {\n// return genLinearSegments(points, params);\n// }\n\n// const segContext = genSegContext('catmullRom', direction, points);\n\n// const gatmullRom = new CatmullRomClosed(segContext, alpha, startPoint);\n\n// genCatmullRomClosedTypeSegments(gatmullRom, points);\n\n// return segContext;\n// }\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type IPointLike } from '@visactor/vutils';
|
|
2
|
+
import type { ICurvedSegment, IGenSegmentParams, ISegPath2D } from '../../interface/curve';
|
|
3
|
+
import type { ICurveType } from '../../interface';
|
|
4
|
+
export declare function point(curveClass: CatmullRom, x: number, y: number, defined: boolean, p: IPointLike): void;
|
|
5
|
+
export declare class CatmullRom implements ICurvedSegment {
|
|
6
|
+
private _lastDefined1?;
|
|
7
|
+
private _lastDefined2?;
|
|
8
|
+
context: ISegPath2D;
|
|
9
|
+
protected startPoint?: IPointLike;
|
|
10
|
+
lastPoint0?: IPointLike;
|
|
11
|
+
lastPoint1?: IPointLike;
|
|
12
|
+
constructor(context: ISegPath2D, alpha?: number, startPoint?: IPointLike);
|
|
13
|
+
_alpha: number;
|
|
14
|
+
_x: number;
|
|
15
|
+
_y: number;
|
|
16
|
+
_x0: number;
|
|
17
|
+
_x1: number;
|
|
18
|
+
_y0: number;
|
|
19
|
+
_y1: number;
|
|
20
|
+
_x2: number;
|
|
21
|
+
_y2: number;
|
|
22
|
+
_line: number;
|
|
23
|
+
_point: number;
|
|
24
|
+
_l01_a: number;
|
|
25
|
+
_l12_a: number;
|
|
26
|
+
_l23_a: number;
|
|
27
|
+
_l01_2a: number;
|
|
28
|
+
_l12_2a: number;
|
|
29
|
+
_l23_2a: number;
|
|
30
|
+
areaStart(): void;
|
|
31
|
+
areaEnd(): void;
|
|
32
|
+
lineStart(): void;
|
|
33
|
+
lineEnd(): void;
|
|
34
|
+
point(p: IPointLike): void;
|
|
35
|
+
tryUpdateLength(): number;
|
|
36
|
+
}
|
|
37
|
+
export declare function commonGenCatmullRomSegments(type: ICurveType, cons: any): (points: IPointLike[], alpha: number, params?: IGenSegmentParams) => ISegPath2D | null;
|
|
38
|
+
export declare const genCatmullRomSegments: (points: IPointLike[], alpha: number, params?: IGenSegmentParams) => ISegPath2D | null;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { epsilon } from "@visactor/vutils";
|
|
2
|
+
|
|
3
|
+
import { genLinearSegments } from "./linear";
|
|
4
|
+
|
|
5
|
+
import { genCurveSegments, genSegContext } from "./common";
|
|
6
|
+
|
|
7
|
+
export function point(curveClass, x, y, defined, p) {
|
|
8
|
+
let x1 = curveClass._x1, y1 = curveClass._y1, x2 = curveClass._x2, y2 = curveClass._y2;
|
|
9
|
+
if (curveClass._l01_a > epsilon) {
|
|
10
|
+
const a = 2 * curveClass._l01_2a + 3 * curveClass._l01_a * curveClass._l12_a + curveClass._l12_2a, n = 3 * curveClass._l01_a * (curveClass._l01_a + curveClass._l12_a);
|
|
11
|
+
x1 = (x1 * a - curveClass._x0 * curveClass._l12_2a + curveClass._x2 * curveClass._l01_2a) / n,
|
|
12
|
+
y1 = (y1 * a - curveClass._y0 * curveClass._l12_2a + curveClass._y2 * curveClass._l01_2a) / n;
|
|
13
|
+
}
|
|
14
|
+
if (curveClass._l23_a > epsilon) {
|
|
15
|
+
const b = 2 * curveClass._l23_2a + 3 * curveClass._l23_a * curveClass._l12_a + curveClass._l12_2a, m = 3 * curveClass._l23_a * (curveClass._l23_a + curveClass._l12_a);
|
|
16
|
+
x2 = (x2 * b + curveClass._x1 * curveClass._l23_2a - x * curveClass._l12_2a) / m,
|
|
17
|
+
y2 = (y2 * b + curveClass._y1 * curveClass._l23_2a - y * curveClass._l12_2a) / m;
|
|
18
|
+
}
|
|
19
|
+
curveClass.context.bezierCurveTo(x1, y1, x2, y2, curveClass._x2, curveClass._y2, defined, curveClass.lastPoint1);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class CatmullRom {
|
|
23
|
+
constructor(context, alpha = .5, startPoint) {
|
|
24
|
+
this.context = context, this.startPoint = startPoint, this._alpha = alpha;
|
|
25
|
+
}
|
|
26
|
+
areaStart() {
|
|
27
|
+
this._line = 0;
|
|
28
|
+
}
|
|
29
|
+
areaEnd() {
|
|
30
|
+
this._line = NaN;
|
|
31
|
+
}
|
|
32
|
+
lineStart() {
|
|
33
|
+
this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
|
|
34
|
+
}
|
|
35
|
+
lineEnd() {
|
|
36
|
+
switch (this._point) {
|
|
37
|
+
case 2:
|
|
38
|
+
this.context.lineTo(this._x2, this._y2, !1 !== this._lastDefined1 && !1 !== this._lastDefined2, this.lastPoint1);
|
|
39
|
+
break;
|
|
40
|
+
|
|
41
|
+
case 3:
|
|
42
|
+
this.point({
|
|
43
|
+
x: this._x2,
|
|
44
|
+
y: this._y2
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
(this._line || 0 !== this._line && 1 === this._point) && this.context.closePath(),
|
|
48
|
+
this._line = 1 - this._line;
|
|
49
|
+
}
|
|
50
|
+
point(p) {
|
|
51
|
+
const {x: x, y: y} = p;
|
|
52
|
+
if (this._point) {
|
|
53
|
+
const x23 = this._x2 - x, y23 = this._y2 - y;
|
|
54
|
+
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
|
|
55
|
+
}
|
|
56
|
+
switch (this._point) {
|
|
57
|
+
case 0:
|
|
58
|
+
this._point = 1, this._line ? this.context.lineTo(x, y, !1 !== this._lastDefined1 && !1 !== this._lastDefined2) : this.context.moveTo(x, y);
|
|
59
|
+
break;
|
|
60
|
+
|
|
61
|
+
case 1:
|
|
62
|
+
this._point = 2;
|
|
63
|
+
break;
|
|
64
|
+
|
|
65
|
+
case 2:
|
|
66
|
+
this._point = 3;
|
|
67
|
+
|
|
68
|
+
default:
|
|
69
|
+
point(this, x, y, !1 !== this._lastDefined1 && !1 !== this._lastDefined2, p);
|
|
70
|
+
}
|
|
71
|
+
this._l01_a = this._l12_a, this._l12_a = this._l23_a, this._l01_2a = this._l12_2a,
|
|
72
|
+
this._l12_2a = this._l23_2a, this._x0 = this._x1, this._x1 = this._x2, this._x2 = x,
|
|
73
|
+
this._y0 = this._y1, this._y1 = this._y2, this._y2 = y, this._lastDefined1 = this._lastDefined2,
|
|
74
|
+
this._lastDefined2 = p.defined, this.lastPoint0 = this.lastPoint1, this.lastPoint1 = p;
|
|
75
|
+
}
|
|
76
|
+
tryUpdateLength() {
|
|
77
|
+
return this.context.tryUpdateLength();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function commonGenCatmullRomSegments(type, cons) {
|
|
82
|
+
return function(points, alpha, params = {}) {
|
|
83
|
+
const {direction: direction, startPoint: startPoint} = params;
|
|
84
|
+
if (points.length < 2 - Number(!!startPoint)) return null;
|
|
85
|
+
if (points.length < 3 - Number(!!startPoint)) return genLinearSegments(points, params);
|
|
86
|
+
const segContext = genSegContext(type, direction, points), gatmullRom = new cons(segContext, alpha, startPoint);
|
|
87
|
+
return genCurveSegments(gatmullRom, points, 2), segContext;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export const genCatmullRomSegments = commonGenCatmullRomSegments("catmullRom", CatmullRom);
|
|
92
|
+
//# sourceMappingURL=catmull-rom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/common/segment/catmull-rom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAmB,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAuB3D,MAAM,UAAU,KAAK,CAAC,UAAsB,EAAE,CAAS,EAAE,CAAS,EAAE,OAAgB,EAAE,CAAa;IACjG,IAAI,EAAE,GAAG,UAAU,CAAC,GAAG,CAAC;IACxB,IAAI,EAAE,GAAG,UAAU,CAAC,GAAG,CAAC;IACxB,IAAI,EAAE,GAAG,UAAU,CAAC,GAAG,CAAC;IACxB,IAAI,EAAE,GAAG,UAAU,CAAC,GAAG,CAAC;IAExB,IAAI,UAAU,CAAC,MAAM,GAAG,OAAO,EAAE;QAC/B,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,OAAO,GAAG,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,GAAG,UAAU,CAAC,OAAO,CAAC;QAClG,MAAM,CAAC,G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C,EAAE;YAC5C,OAAO,IAAI,CAAC;SACb;QACD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE;YAC5C,OAAO,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;SAC1C;QAED,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAE1D,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;QAE3D,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;QAGxC,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,2BAA2B,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC","file":"catmull-rom.js","sourcesContent":["import { epsilon, type IPointLike } from '@visactor/vutils';\nimport { genLinearSegments } from './linear';\nimport { genCurveSegments, genSegContext } from './common';\nimport type { ICurvedSegment, IGenSegmentParams, ILinearSegment, ISegPath2D } from '../../interface/curve';\nimport type { ICurveType } from '../../interface';\n\n/**\n * 部分源码参考 https://github.com/d3/d3-shape/\n * Copyright 2010-2022 Mike Bostock\n\n Permission to use, copy, modify, and/or distribute this software for any purpose\n with or without fee is hereby granted, provided that the above copyright notice\n and this permission notice appear in all copies.\n\n THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS\n OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER\n TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF\n THIS SOFTWARE.\n */\n\n// 基于d3-shape重构\n// https://github.com/d3/d3-shape/blob/main/src/curve/basis.js\nexport function point(curveClass: CatmullRom, x: number, y: number, defined: boolean, p: IPointLike) {\n let x1 = curveClass._x1;\n let y1 = curveClass._y1;\n let x2 = curveClass._x2;\n let y2 = curveClass._y2;\n\n if (curveClass._l01_a > epsilon) {\n const a = 2 * curveClass._l01_2a + 3 * curveClass._l01_a * curveClass._l12_a + curveClass._l12_2a;\n const n = 3 * curveClass._l01_a * (curveClass._l01_a + curveClass._l12_a);\n x1 = (x1 * a - curveClass._x0 * curveClass._l12_2a + curveClass._x2 * curveClass._l01_2a) / n;\n y1 = (y1 * a - curveClass._y0 * curveClass._l12_2a + curveClass._y2 * curveClass._l01_2a) / n;\n }\n\n if (curveClass._l23_a > epsilon) {\n const b = 2 * curveClass._l23_2a + 3 * curveClass._l23_a * curveClass._l12_a + curveClass._l12_2a;\n const m = 3 * curveClass._l23_a * (curveClass._l23_a + curveClass._l12_a);\n x2 = (x2 * b + curveClass._x1 * curveClass._l23_2a - x * curveClass._l12_2a) / m;\n y2 = (y2 * b + curveClass._y1 * curveClass._l23_2a - y * curveClass._l12_2a) / m;\n }\n\n curveClass.context.bezierCurveTo(x1, y1, x2, y2, curveClass._x2, curveClass._y2, defined, curveClass.lastPoint1);\n}\n\nexport class CatmullRom implements ICurvedSegment {\n private _lastDefined1?: boolean;\n private _lastDefined2?: boolean;\n declare context: ISegPath2D;\n\n protected startPoint?: IPointLike;\n lastPoint0?: IPointLike;\n lastPoint1?: IPointLike;\n\n constructor(context: ISegPath2D, alpha: number = 0.5, startPoint?: IPointLike) {\n this.context = context;\n this.startPoint = startPoint;\n this._alpha = alpha;\n }\n _alpha: number;\n _x: number;\n _y: number;\n _x0: number;\n _x1: number;\n _y0: number;\n _y1: number;\n _x2: number;\n _y2: number;\n _line: number;\n _point: number;\n _l01_a: number;\n _l12_a: number;\n _l23_a: number;\n _l01_2a: number;\n _l12_2a: number;\n _l23_2a: number;\n\n areaStart() {\n this._line = 0;\n }\n areaEnd() {\n this._line = NaN;\n }\n lineStart() {\n this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN;\n this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;\n }\n lineEnd() {\n switch (this._point) {\n case 2:\n this.context.lineTo(\n this._x2,\n this._y2,\n this._lastDefined1 !== false && this._lastDefined2 !== false,\n this.lastPoint1\n );\n break;\n case 3:\n this.point({ x: this._x2, y: this._y2 });\n break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) {\n this.context.closePath();\n }\n this._line = 1 - this._line;\n }\n point(p: IPointLike): void {\n const { x, y } = p;\n\n if (this._point) {\n const x23 = this._x2 - x;\n const y23 = this._y2 - y;\n this._l23_a = Math.sqrt((this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)));\n }\n\n switch (this._point) {\n case 0:\n this._point = 1;\n this._line\n ? this.context.lineTo(x, y, this._lastDefined1 !== false && this._lastDefined2 !== false)\n : this.context.moveTo(x, y);\n break;\n case 1:\n this._point = 2;\n break;\n case 2:\n this._point = 3; // falls through\n default:\n point(this, x, y, this._lastDefined1 !== false && this._lastDefined2 !== false, p);\n break;\n }\n\n (this._l01_a = this._l12_a), (this._l12_a = this._l23_a);\n (this._l01_2a = this._l12_2a), (this._l12_2a = this._l23_2a);\n (this._x0 = this._x1), (this._x1 = this._x2), (this._x2 = x);\n (this._y0 = this._y1), (this._y1 = this._y2), (this._y2 = y);\n\n this._lastDefined1 = this._lastDefined2;\n this._lastDefined2 = p.defined;\n this.lastPoint0 = this.lastPoint1;\n this.lastPoint1 = p;\n }\n\n tryUpdateLength(): number {\n return this.context.tryUpdateLength();\n }\n}\n\n// export function genCatmullRomTypeSegments(path: ILinearSegment, points: IPointLike[]): void {\n// return genCurveSegments(path, points, 2);\n// }\n\nexport function commonGenCatmullRomSegments(type: ICurveType, cons: any) {\n return function genCatmullRomSegments(\n points: IPointLike[],\n alpha: number,\n params: IGenSegmentParams = {}\n ): ISegPath2D | null {\n const { direction, startPoint } = params;\n if (points.length < 2 - Number(!!startPoint)) {\n return null;\n }\n if (points.length < 3 - Number(!!startPoint)) {\n return genLinearSegments(points, params);\n }\n\n const segContext = genSegContext(type, direction, points);\n\n const gatmullRom = new cons(segContext, alpha, startPoint);\n\n genCurveSegments(gatmullRom, points, 2);\n // genCatmullRomTypeSegments(gatmullRom, points);\n\n return segContext;\n };\n}\n\nexport const genCatmullRomSegments = commonGenCatmullRomSegments('catmullRom', CatmullRom);\n\n// export function genCatmullRomSegments(\n// points: IPointLike[],\n// alpha: number,\n// params: IGenSegmentParams = {}\n// ): ISegPath2D | null {\n// const { direction, startPoint } = params;\n// if (points.length < 2 - Number(!!startPoint)) {\n// return null;\n// }\n// if (points.length < 3 - Number(!!startPoint)) {\n// return genLinearSegments(points, params);\n// }\n\n// const segContext = genSegContext('catmullRom', direction, points);\n\n// const gatmullRom = new CatmullRom(segContext, alpha, startPoint);\n\n// genCatmullRomTypeSegments(gatmullRom, points);\n\n// return segContext;\n// }\n"]}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { IPointLike } from '@visactor/vutils';
|
|
2
|
-
import type { ICurveType,
|
|
2
|
+
import type { ICurveType, ISegPath2D } from '../../interface';
|
|
3
3
|
export * from './linear';
|
|
4
4
|
export * from './linear-closed';
|
|
5
5
|
export * from './basis';
|
|
6
6
|
export * from './monotone';
|
|
7
7
|
export * from './step';
|
|
8
8
|
export * from './curve/curve-context';
|
|
9
|
-
export declare function calcLineCache(points: IPointLike[], curveType: ICurveType, params?:
|
|
9
|
+
export declare function calcLineCache(points: IPointLike[], curveType: ICurveType, params?: {
|
|
10
|
+
startPoint?: IPointLike;
|
|
11
|
+
curveTension?: number;
|
|
12
|
+
}): ISegPath2D | null;
|
|
@@ -8,6 +8,10 @@ import { genStepSegments } from "./step";
|
|
|
8
8
|
|
|
9
9
|
import { genLinearClosedSegments } from "./linear-closed";
|
|
10
10
|
|
|
11
|
+
import { genCatmullRomSegments } from "./catmull-rom";
|
|
12
|
+
|
|
13
|
+
import { genCatmullRomClosedSegments } from "./catmull-rom-close";
|
|
14
|
+
|
|
11
15
|
export * from "./linear";
|
|
12
16
|
|
|
13
17
|
export * from "./linear-closed";
|
|
@@ -21,6 +25,7 @@ export * from "./step";
|
|
|
21
25
|
export * from "./curve/curve-context";
|
|
22
26
|
|
|
23
27
|
export function calcLineCache(points, curveType, params) {
|
|
28
|
+
var _a, _b;
|
|
24
29
|
switch (curveType) {
|
|
25
30
|
case "linear":
|
|
26
31
|
default:
|
|
@@ -44,6 +49,12 @@ export function calcLineCache(points, curveType, params) {
|
|
|
44
49
|
case "stepAfter":
|
|
45
50
|
return genStepSegments(points, 1, params);
|
|
46
51
|
|
|
52
|
+
case "catmullRom":
|
|
53
|
+
return genCatmullRomSegments(points, null !== (_a = null == params ? void 0 : params.curveTension) && void 0 !== _a ? _a : .5, params);
|
|
54
|
+
|
|
55
|
+
case "catmullRomClosed":
|
|
56
|
+
return genCatmullRomClosedSegments(points, null !== (_b = null == params ? void 0 : params.curveTension) && void 0 !== _b ? _b : .5, params);
|
|
57
|
+
|
|
47
58
|
case "linearClosed":
|
|
48
59
|
return genLinearClosedSegments(points, params);
|
|
49
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common/segment/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":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f,OAAO,qBAAqB,CAAC,MAAM,EAAE,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,YAAY,mCAAI,GAAG,EAAE,MAAM,CAAC,CAAC;QAC5E,KAAK,kBAAkB;YACrB,OAAO,2BAA2B,CAAC,MAAM,EAAE,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,YAAY,mCAAI,GAAG,EAAE,MAAM,CAAC,CAAC;QAClF,KAAK,cAAc;YACjB,OAAO,uBAAuB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjD;YACE,OAAO,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC5C;AACH,CAAC","file":"index.js","sourcesContent":["import type { IPointLike } from '@visactor/vutils';\nimport type { ICurveType, IGenSegmentParams, ISegPath2D } from '../../interface';\nimport { genLinearSegments } from './linear';\nimport { genBasisSegments } from './basis';\nimport { genMonotoneXSegments, genMonotoneYSegments } from './monotone';\nimport { genStepSegments } from './step';\nimport { genLinearClosedSegments } from './linear-closed';\nimport { genCatmullRomSegments } from './catmull-rom';\nimport { genCatmullRomClosedSegments } from './catmull-rom-close';\n\nexport * from './linear';\nexport * from './linear-closed';\nexport * from './basis';\nexport * from './monotone';\nexport * from './step';\nexport * from './curve/curve-context';\n\nexport function calcLineCache(\n points: IPointLike[],\n curveType: ICurveType,\n params?: { startPoint?: IPointLike; curveTension?: number }\n): ISegPath2D | null {\n switch (curveType) {\n case 'linear':\n return genLinearSegments(points, params);\n case 'basis':\n return genBasisSegments(points, params);\n case 'monotoneX':\n return genMonotoneXSegments(points, params);\n case 'monotoneY':\n return genMonotoneYSegments(points, params);\n case 'step':\n return genStepSegments(points, 0.5, params);\n case 'stepBefore':\n return genStepSegments(points, 0, params);\n case 'stepAfter':\n return genStepSegments(points, 1, params);\n case 'catmullRom':\n return genCatmullRomSegments(points, params?.curveTension ?? 0.5, params);\n case 'catmullRomClosed':\n return genCatmullRomClosedSegments(points, params?.curveTension ?? 0.5, params);\n case 'linearClosed':\n return genLinearClosedSegments(points, params);\n default:\n return genLinearSegments(points, params);\n }\n}\n"]}
|
package/es/common/simplify.js
CHANGED
|
@@ -31,4 +31,4 @@ export function flatten_simplify(points, tolerance, highestQuality) {
|
|
|
31
31
|
const sqTolerance = void 0 !== tolerance ? tolerance * tolerance : 1;
|
|
32
32
|
return points = simplifyDouglasPeucker(points = highestQuality ? points : simplifyRadialDist(points, sqTolerance), sqTolerance);
|
|
33
33
|
}
|
|
34
|
-
//# sourceMappingURL=simplify.js.map
|
|
34
|
+
//# sourceMappingURL=simplify.js.map
|
package/es/common/sort.js
CHANGED
package/es/common/split-path.js
CHANGED
package/es/common/store.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
class StageStore {}
|
|
2
|
-
//# sourceMappingURL=store.js.map
|
|
2
|
+
//# sourceMappingURL=store.js.map
|
package/es/common/text.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isNil, isString, lowerCamelCaseToMiddle } from "@visactor/vutils";
|
|
1
|
+
import { isNil, isString, isValid, lowerCamelCaseToMiddle } from "@visactor/vutils";
|
|
2
2
|
|
|
3
3
|
export function textDrawOffsetY(baseline, h) {
|
|
4
4
|
return "top" === baseline ? Math.ceil(.79 * h) : "middle" === baseline ? Math.round(.3 * h) : "bottom" === baseline ? Math.round(-.21 * h) : 0;
|
|
@@ -14,13 +14,14 @@ export function textLayoutOffsetY(baseline, lineHeight, fontSize, buf = 0) {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export function textAttributesToStyle(attrs) {
|
|
17
|
-
const style = {}
|
|
17
|
+
const style = {}, parsePxValue = value => /^\d+(\.\d+)?$/.test(`${value}`) ? `${value}px` : `${value}`;
|
|
18
18
|
return [ "textAlign", "fontFamily", "fontVariant", "fontStyle", "fontWeight" ].forEach((key => {
|
|
19
19
|
attrs[key] && (style[lowerCamelCaseToMiddle(key)] = attrs[key]);
|
|
20
20
|
})), [ "fontSize", "lineHeight" ].forEach((key => {
|
|
21
21
|
const styleKey = lowerCamelCaseToMiddle(key);
|
|
22
|
-
isNil(attrs[key]) || (style[styleKey] =
|
|
23
|
-
})), attrs.
|
|
22
|
+
isNil(attrs[key]) || (style[styleKey] = parsePxValue(attrs[key]));
|
|
23
|
+
})), isValid(attrs.maxLineWidth) && (style["max-width"] = parsePxValue(attrs.maxLineWidth)),
|
|
24
|
+
attrs.underline ? style["text-decoration"] = "underline" : attrs.lineThrough && (style["text-decoration"] = "line-through"),
|
|
24
25
|
attrs.fill && isString(attrs.fill) && (style.color = attrs.fill), style;
|
|
25
26
|
}
|
|
26
27
|
//# sourceMappingURL=text.js.map
|
package/es/common/text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common/text.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/common/text.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAWpF,MAAM,UAAU,eAAe,CAAC,QAA0B,EAAE,CAAS;IACnE,MAAM,MAAM,GACV,QAAQ,KAAK,KAAK;QAChB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QACrB,CAAC,CAAC,QAAQ,KAAK,QAAQ;YACvB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC;YACrB,CAAC,CAAC,QAAQ,KAAK,QAAQ;gBACvB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;gBACvB,CAAC,CAAC,CAAC,CAAC;IACR,OAAO,MAAM,CAAC;AAChB,CAAC;AAQD,MAAM,UAAU,eAAe,CAAC,SAAwB,EAAE,KAAa;IACrE,IAAI,S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OAAO,CAAC,GAAG,CAAC,EAAE;QACxB,IAAI,KAAK,CAAC,GAAG,CAAC,EAAE;YACd,KAAK,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;SACjD;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QACnB,MAAM,QAAQ,GAAG,sBAAsB,CAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE;YACtB,KAAK,CAAC,QAAQ,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;SAC5C;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE;QAC/B,KAAK,CAAC,WAAW,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;KACvD;IAED,IAAI,KAAK,CAAC,SAAS,EAAE;QACnB,KAAK,CAAC,iBAAiB,CAAC,GAAG,WAAW,CAAC;KACxC;SAAM,IAAI,KAAK,CAAC,WAAW,EAAE;QAC5B,KAAK,CAAC,iBAAiB,CAAC,GAAG,cAAc,CAAC;KAC3C;IAED,IAAI,KAAK,CAAC,IAAI,EAAE;QACd,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;YACxB,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC;SAC1B;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC","file":"text.js","sourcesContent":["// 存放一些公共方法,公共配置\n\nimport { isNil, isString, isValid, lowerCamelCaseToMiddle } from '@visactor/vutils';\nimport type { ITextGraphicAttribute, TextAlignType, TextBaselineType } from '../interface';\n\n// TODO: 更好的方案\n/**\n * 用于绘制的时候偏移\n * 经验值,来源于 https://github.com/vega/vega/blob/b45cf431cd6c0d0c0e1567f087f9b3b55bc236fa/packages/vega-scenegraph/src/util/text.js\n * @param baseline\n * @param h\n * @returns\n */\nexport function textDrawOffsetY(baseline: TextBaselineType, h: number): number {\n const offset =\n baseline === 'top'\n ? Math.ceil(0.79 * h)\n : baseline === 'middle'\n ? Math.round(0.3 * h)\n : baseline === 'bottom'\n ? Math.round(-0.21 * h)\n : 0;\n return offset;\n}\n\n/**\n * 用于绘制的时候偏移\n * @param textAlign\n * @param width\n * @returns\n */\nexport function textDrawOffsetX(textAlign: TextAlignType, width: number): number {\n if (textAlign === 'end' || textAlign === 'right') {\n return -width;\n } else if (textAlign === 'center') {\n return -width / 2;\n }\n return 0;\n}\n\n/**\n * 用于计算布局的偏移\n * 经验值,来源于 https://github.com/vega/vega/blob/b45cf431cd6c0d0c0e1567f087f9b3b55bc236fa/packages/vega-scenegraph/src/util/text.js\n * @param baseline\n * @param lineHeight\n * @returns\n */\nexport function textLayoutOffsetY(\n baseline: TextBaselineType,\n lineHeight: number,\n fontSize: number,\n buf: number = 0\n): number {\n if (baseline === 'middle') {\n return -lineHeight / 2;\n }\n if (baseline === 'top') {\n return 0;\n }\n if (baseline === 'bottom') {\n return buf - lineHeight;\n }\n if (!baseline || baseline === 'alphabetic') {\n if (!fontSize) {\n fontSize = lineHeight;\n }\n return -(lineHeight - fontSize) / 2 - 0.79 * fontSize;\n }\n return 0;\n}\n\nexport function textAttributesToStyle(attrs: ITextGraphicAttribute) {\n const stringTypes = ['textAlign', 'fontFamily', 'fontVariant', 'fontStyle', 'fontWeight'];\n const pxKeys = ['fontSize', 'lineHeight'];\n const style: any = {};\n const parsePxValue = (value: string | number) => {\n return /^\\d+(\\.\\d+)?$/.test(`${value}`) ? `${value}px` : `${value}`;\n };\n\n stringTypes.forEach(key => {\n if (attrs[key]) {\n style[lowerCamelCaseToMiddle(key)] = attrs[key];\n }\n });\n\n pxKeys.forEach(key => {\n const styleKey = lowerCamelCaseToMiddle(key);\n if (!isNil(attrs[key])) {\n style[styleKey] = parsePxValue(attrs[key]);\n }\n });\n\n if (isValid(attrs.maxLineWidth)) {\n style['max-width'] = parsePxValue(attrs.maxLineWidth);\n }\n\n if (attrs.underline) {\n style['text-decoration'] = 'underline';\n } else if (attrs.lineThrough) {\n style['text-decoration'] = 'line-through';\n }\n\n if (attrs.fill) {\n if (isString(attrs.fill)) {\n style.color = attrs.fill;\n }\n }\n\n return style;\n}\n"]}
|
package/es/core/application.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export const ApplicationContribution = Symbol("ApplicationContribution");
|
|
1
|
+
export const ApplicationContribution = Symbol("ApplicationContribution");
|
|
2
|
+
//# sourceMappingURL=application.js.map
|
package/es/core/camera.js
CHANGED
package/es/core/constants.js
CHANGED
|
@@ -9,4 +9,4 @@ export const StaticLayerHandlerContribution = Symbol.for("StaticLayerHandlerCont
|
|
|
9
9
|
export const DynamicLayerHandlerContribution = Symbol.for("DynamicLayerHandlerContribution");
|
|
10
10
|
|
|
11
11
|
export const VirtualLayerHandlerContribution = Symbol.for("VirtualLayerHandlerContribution");
|
|
12
|
-
//# sourceMappingURL=constants.js.map
|
|
12
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import { ContainerModule } from "../../../common/inversify-lite";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { StaticLayerHandlerContribution } from "../../constants";
|
|
4
4
|
|
|
5
5
|
import { CanvasLayerHandlerContribution } from "./canvas2d-contribution";
|
|
6
6
|
|
|
7
|
-
import { EmptyLayerHandlerContribution } from "./empty-contribution";
|
|
8
|
-
|
|
9
|
-
import { OffscreenLayerHandlerContribution } from "./offscreen2d-contribution";
|
|
10
|
-
|
|
11
7
|
export default new ContainerModule((bind => {
|
|
12
|
-
bind(CanvasLayerHandlerContribution).toSelf(), bind(
|
|
13
|
-
bind(EmptyLayerHandlerContribution).toSelf(), bind(StaticLayerHandlerContribution).toService(CanvasLayerHandlerContribution),
|
|
14
|
-
bind(DynamicLayerHandlerContribution).toService(OffscreenLayerHandlerContribution),
|
|
15
|
-
bind(VirtualLayerHandlerContribution).toService(EmptyLayerHandlerContribution);
|
|
8
|
+
bind(CanvasLayerHandlerContribution).toSelf(), bind(StaticLayerHandlerContribution).toService(CanvasLayerHandlerContribution);
|
|
16
9
|
}));
|
|
17
10
|
//# sourceMappingURL=modules.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/contributions/layerHandler/modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,
|
|
1
|
+
{"version":3,"sources":["../src/core/contributions/layerHandler/modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAEL,8BAA8B,EAE/B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AAIzE,eAAe,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE;IACxC,IAAI,CAAC,8BAA8B,CAAC,CAAC,MAAM,EAAE,CAAC;IAG9C,IAAI,CAAC,8BAA8B,CAAC,CAAC,SAAS,CAAC,8BAA8B,CAAC,CAAC;AAUjF,CAAC,CAAC,CAAC","file":"modules.js","sourcesContent":["import { ContainerModule } from '../../../common/inversify-lite';\nimport {\n // DynamicLayerHandlerContribution,\n StaticLayerHandlerContribution\n // VirtualLayerHandlerContribution\n} from '../../constants';\nimport { CanvasLayerHandlerContribution } from './canvas2d-contribution';\n// import { EmptyLayerHandlerContribution } from './empty-contribution';\n// import { OffscreenLayerHandlerContribution } from './offscreen2d-contribution';\n\nexport default new ContainerModule(bind => {\n bind(CanvasLayerHandlerContribution).toSelf();\n // bind(OffscreenLayerHandlerContribution).toSelf();\n // bind(EmptyLayerHandlerContribution).toSelf();\n bind(StaticLayerHandlerContribution).toService(CanvasLayerHandlerContribution);\n // bind(DynamicLayerHandlerContribution).toService(OffscreenLayerHandlerContribution);\n // bind(VirtualLayerHandlerContribution).toService(EmptyLayerHandlerContribution);\n // try {\n // if (typeof OffscreenCanvas === 'function') {\n // bind(LayerHandlerContribution).toService(OffscreenLayerHandlerContribution);\n // }\n // } catch (err) {\n // bind(LayerHandlerContribution).toService(CanvasLayerHandlerContribution);\n // }\n});\n"]}
|