@antv/g 1.0.0-alpha.28 → 1.0.0-alpha.32
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/dist/index.umd.js +30 -4238
- package/es/AbstractRenderer.d.ts +26 -0
- package/es/AbstractRenderer.js +42 -0
- package/es/Canvas.d.ts +96 -0
- package/es/Canvas.js +401 -0
- package/es/DisplayObjectPool.d.ts +7 -0
- package/es/DisplayObjectPool.js +27 -0
- package/es/camera/Camera.d.ts +279 -0
- package/es/camera/Camera.js +963 -0
- package/es/camera/Landmark.d.ts +28 -0
- package/es/camera/Landmark.js +68 -0
- package/es/camera/index.d.ts +2 -0
- package/es/camera/index.js +2 -0
- package/es/canvas-module.d.ts +1 -0
- package/es/canvas-module.js +33 -0
- package/es/components/Cullable.d.ts +15 -0
- package/es/components/Cullable.js +36 -0
- package/es/components/Geometry.d.ts +13 -0
- package/es/components/Geometry.js +17 -0
- package/es/components/Renderable.d.ts +25 -0
- package/es/components/Renderable.js +26 -0
- package/es/components/Sortable.d.ts +17 -0
- package/es/components/Sortable.js +24 -0
- package/es/components/Transform.d.ts +28 -0
- package/es/components/Transform.js +70 -0
- package/es/components/index.d.ts +5 -0
- package/es/components/index.js +5 -0
- package/es/display-objects/Circle.d.ts +12 -0
- package/es/display-objects/Circle.js +26 -0
- package/es/display-objects/CustomElement.d.ts +25 -0
- package/es/display-objects/CustomElement.js +82 -0
- package/es/display-objects/DisplayObject.d.ts +258 -0
- package/es/display-objects/DisplayObject.js +857 -0
- package/es/display-objects/Ellipse.d.ts +14 -0
- package/es/display-objects/Ellipse.js +27 -0
- package/es/display-objects/Group.d.ts +6 -0
- package/es/display-objects/Group.js +27 -0
- package/es/display-objects/HTML.d.ts +36 -0
- package/es/display-objects/HTML.js +96 -0
- package/es/display-objects/Image.d.ts +16 -0
- package/es/display-objects/Image.js +25 -0
- package/es/display-objects/Line.d.ts +23 -0
- package/es/display-objects/Line.js +56 -0
- package/es/display-objects/Path.d.ts +47 -0
- package/es/display-objects/Path.js +132 -0
- package/es/display-objects/Polygon.d.ts +12 -0
- package/es/display-objects/Polygon.js +25 -0
- package/es/display-objects/Polyline.d.ts +21 -0
- package/es/display-objects/Polyline.js +75 -0
- package/es/display-objects/Rect.d.ts +16 -0
- package/es/display-objects/Rect.js +26 -0
- package/es/display-objects/Text.d.ts +65 -0
- package/es/display-objects/Text.js +61 -0
- package/es/display-objects/index.d.ts +13 -0
- package/es/display-objects/index.js +13 -0
- package/es/dom/Animation.d.ts +132 -0
- package/es/dom/Animation.js +498 -0
- package/es/dom/AnimationEffectTiming.d.ts +59 -0
- package/es/dom/AnimationEffectTiming.js +68 -0
- package/es/dom/AnimationEvent.d.ts +11 -0
- package/es/dom/AnimationEvent.js +34 -0
- package/es/dom/AnimationTimeline.d.ts +37 -0
- package/es/dom/AnimationTimeline.js +217 -0
- package/es/dom/CustomElementRegistry.d.ts +15 -0
- package/es/dom/CustomElementRegistry.js +42 -0
- package/es/dom/CustomEvent.d.ts +16 -0
- package/es/dom/CustomEvent.js +34 -0
- package/es/dom/Document.d.ts +59 -0
- package/es/dom/Document.js +167 -0
- package/es/dom/Element.d.ts +143 -0
- package/es/dom/Element.js +492 -0
- package/es/dom/EventTarget.d.ts +43 -0
- package/es/dom/EventTarget.js +161 -0
- package/es/dom/FederatedEvent.d.ts +146 -0
- package/es/dom/FederatedEvent.js +232 -0
- package/es/dom/FederatedMouseEvent.d.ts +52 -0
- package/es/dom/FederatedMouseEvent.js +124 -0
- package/es/dom/FederatedPointerEvent.d.ts +69 -0
- package/es/dom/FederatedPointerEvent.js +53 -0
- package/es/dom/FederatedWheelEvent.d.ts +20 -0
- package/es/dom/FederatedWheelEvent.js +27 -0
- package/es/dom/KeyframeEffect.d.ts +48 -0
- package/es/dom/KeyframeEffect.js +174 -0
- package/es/dom/KeyframeList.d.ts +2 -0
- package/es/dom/KeyframeList.js +176 -0
- package/es/dom/Node.d.ts +106 -0
- package/es/dom/Node.js +213 -0
- package/es/dom/index.d.ts +17 -0
- package/es/dom/index.js +17 -0
- package/es/dom/interfaces.d.ts +326 -0
- package/es/dom/interfaces.js +32 -0
- package/es/global-module.d.ts +2 -0
- package/es/global-module.js +159 -0
- package/es/index.d.ts +18 -0
- package/es/index.js +25 -0
- package/es/plugins/CullingPlugin.d.ts +19 -0
- package/es/plugins/CullingPlugin.js +80 -0
- package/es/plugins/DirtyCheckPlugin.d.ts +10 -0
- package/es/plugins/DirtyCheckPlugin.js +53 -0
- package/es/plugins/EventPlugin.d.ts +26 -0
- package/es/plugins/EventPlugin.js +288 -0
- package/es/plugins/FrustumCullingStrategy.d.ts +21 -0
- package/es/plugins/FrustumCullingStrategy.js +102 -0
- package/es/plugins/PrepareRendererPlugin.d.ts +6 -0
- package/es/plugins/PrepareRendererPlugin.js +80 -0
- package/es/property-handlers/aabb.d.ts +2 -0
- package/es/property-handlers/aabb.js +135 -0
- package/es/property-handlers/anchor.d.ts +3 -0
- package/es/property-handlers/anchor.js +21 -0
- package/es/property-handlers/clipPath.d.ts +19 -0
- package/es/property-handlers/clipPath.js +36 -0
- package/es/property-handlers/color.d.ts +32 -0
- package/es/property-handlers/color.js +250 -0
- package/es/property-handlers/dimension.d.ts +18 -0
- package/es/property-handlers/dimension.js +123 -0
- package/es/property-handlers/filter.d.ts +9 -0
- package/es/property-handlers/filter.js +43 -0
- package/es/property-handlers/index.d.ts +17 -0
- package/es/property-handlers/index.js +17 -0
- package/es/property-handlers/interfaces.d.ts +20 -0
- package/es/property-handlers/interfaces.js +6 -0
- package/es/property-handlers/localPosition.d.ts +2 -0
- package/es/property-handlers/localPosition.js +9 -0
- package/es/property-handlers/numeric.d.ts +5 -0
- package/es/property-handlers/numeric.js +34 -0
- package/es/property-handlers/offsetDistance.d.ts +5 -0
- package/es/property-handlers/offsetDistance.js +20 -0
- package/es/property-handlers/offsetPath.d.ts +5 -0
- package/es/property-handlers/offsetPath.js +18 -0
- package/es/property-handlers/origin.d.ts +11 -0
- package/es/property-handlers/origin.js +68 -0
- package/es/property-handlers/path.d.ts +5 -0
- package/es/property-handlers/path.js +200 -0
- package/es/property-handlers/points.d.ts +6 -0
- package/es/property-handlers/points.js +23 -0
- package/es/property-handlers/transform.d.ts +45 -0
- package/es/property-handlers/transform.js +416 -0
- package/es/property-handlers/zIndex.d.ts +2 -0
- package/es/property-handlers/zIndex.js +17 -0
- package/es/services/ContextService.d.ts +12 -0
- package/es/services/ContextService.js +5 -0
- package/es/services/EventService.d.ts +64 -0
- package/es/services/EventService.js +937 -0
- package/es/services/RenderingContext.d.ts +28 -0
- package/es/services/RenderingContext.js +13 -0
- package/es/services/RenderingService.d.ts +51 -0
- package/es/services/RenderingService.js +145 -0
- package/es/services/SceneGraphSelector.d.ts +20 -0
- package/es/services/SceneGraphSelector.js +64 -0
- package/es/services/SceneGraphService.d.ts +146 -0
- package/es/services/SceneGraphService.js +805 -0
- package/es/services/aabb/CircleUpdater.d.ts +10 -0
- package/es/services/aabb/CircleUpdater.js +35 -0
- package/es/services/aabb/EllipseUpdater.d.ts +10 -0
- package/es/services/aabb/EllipseUpdater.js +37 -0
- package/es/services/aabb/LineUpdater.d.ts +10 -0
- package/es/services/aabb/LineUpdater.js +39 -0
- package/es/services/aabb/PathUpdater.d.ts +11 -0
- package/es/services/aabb/PathUpdater.js +172 -0
- package/es/services/aabb/PolylineUpdater.d.ts +10 -0
- package/es/services/aabb/PolylineUpdater.js +48 -0
- package/es/services/aabb/RectUpdater.d.ts +10 -0
- package/es/services/aabb/RectUpdater.js +55 -0
- package/es/services/aabb/TextUpdater.d.ts +13 -0
- package/es/services/aabb/TextUpdater.js +81 -0
- package/es/services/aabb/index.d.ts +8 -0
- package/es/services/aabb/index.js +8 -0
- package/es/services/aabb/interfaces.d.ts +16 -0
- package/es/services/aabb/interfaces.js +2 -0
- package/es/services/index.d.ts +10 -0
- package/es/services/index.js +10 -0
- package/es/services/text/OffscreenCanvasCreator.d.ts +6 -0
- package/es/services/text/OffscreenCanvasCreator.js +47 -0
- package/es/services/text/index.d.ts +35 -0
- package/es/services/text/index.js +355 -0
- package/es/shapes/AABB.d.ts +33 -0
- package/es/shapes/AABB.js +217 -0
- package/es/shapes/BoundingSphere.d.ts +8 -0
- package/es/shapes/BoundingSphere.js +31 -0
- package/es/shapes/Frustum.d.ts +16 -0
- package/es/shapes/Frustum.js +79 -0
- package/es/shapes/Plane.d.ts +14 -0
- package/es/shapes/Plane.js +42 -0
- package/es/shapes/Point.d.ts +11 -0
- package/es/shapes/Point.js +31 -0
- package/es/shapes/Polygon.d.ts +9 -0
- package/es/shapes/Polygon.js +64 -0
- package/es/shapes/Ray.d.ts +24 -0
- package/es/shapes/Ray.js +138 -0
- package/es/shapes/Rect.d.ts +12 -0
- package/es/shapes/Rect.js +24 -0
- package/es/shapes/Rectangle.d.ts +12 -0
- package/es/shapes/Rectangle.js +20 -0
- package/es/shapes/index.d.ts +8 -0
- package/es/shapes/index.js +8 -0
- package/es/types.d.ts +219 -0
- package/es/types.js +17 -0
- package/es/utils/animation.d.ts +15 -0
- package/es/utils/animation.js +251 -0
- package/es/utils/bezier-easing.d.ts +20 -0
- package/es/utils/bezier-easing.js +90 -0
- package/es/utils/canvas.d.ts +5 -0
- package/es/utils/canvas.js +15 -0
- package/es/utils/custom-easing.d.ts +75 -0
- package/es/utils/custom-easing.js +332 -0
- package/es/utils/event.d.ts +11 -0
- package/es/utils/event.js +69 -0
- package/es/utils/index.d.ts +5 -0
- package/es/utils/index.js +5 -0
- package/es/utils/interpolation.d.ts +3 -0
- package/es/utils/interpolation.js +182 -0
- package/es/utils/math.d.ts +22 -0
- package/es/utils/math.js +141 -0
- package/es/utils/path.d.ts +15 -0
- package/es/utils/path.js +333 -0
- package/es/utils/raf.d.ts +3 -0
- package/es/utils/raf.js +15 -0
- package/es/utils/text.d.ts +2 -0
- package/es/utils/text.js +32 -0
- package/lib/AbstractRenderer.d.ts +26 -0
- package/lib/AbstractRenderer.js +49 -0
- package/lib/Canvas.d.ts +96 -0
- package/lib/Canvas.js +423 -0
- package/lib/DisplayObjectPool.d.ts +7 -0
- package/lib/DisplayObjectPool.js +35 -0
- package/lib/camera/Camera.d.ts +279 -0
- package/lib/camera/Camera.js +1035 -0
- package/lib/camera/Landmark.d.ts +28 -0
- package/lib/camera/Landmark.js +75 -0
- package/lib/camera/index.d.ts +2 -0
- package/lib/camera/index.js +31 -0
- package/lib/canvas-module.d.ts +1 -0
- package/lib/canvas-module.js +48 -0
- package/lib/components/Cullable.d.ts +15 -0
- package/lib/components/Cullable.js +45 -0
- package/lib/components/Geometry.d.ts +13 -0
- package/lib/components/Geometry.js +25 -0
- package/lib/components/Renderable.d.ts +25 -0
- package/lib/components/Renderable.js +34 -0
- package/lib/components/Sortable.d.ts +17 -0
- package/lib/components/Sortable.js +32 -0
- package/lib/components/Transform.d.ts +28 -0
- package/lib/components/Transform.js +79 -0
- package/lib/components/index.d.ts +5 -0
- package/lib/components/index.js +70 -0
- package/lib/display-objects/Circle.d.ts +12 -0
- package/lib/display-objects/Circle.js +34 -0
- package/lib/display-objects/CustomElement.d.ts +25 -0
- package/lib/display-objects/CustomElement.js +91 -0
- package/lib/display-objects/DisplayObject.d.ts +258 -0
- package/lib/display-objects/DisplayObject.js +879 -0
- package/lib/display-objects/Ellipse.d.ts +14 -0
- package/lib/display-objects/Ellipse.js +35 -0
- package/lib/display-objects/Group.d.ts +6 -0
- package/lib/display-objects/Group.js +36 -0
- package/lib/display-objects/HTML.d.ts +36 -0
- package/lib/display-objects/HTML.js +109 -0
- package/lib/display-objects/Image.d.ts +16 -0
- package/lib/display-objects/Image.js +33 -0
- package/lib/display-objects/Line.d.ts +23 -0
- package/lib/display-objects/Line.js +68 -0
- package/lib/display-objects/Path.d.ts +47 -0
- package/lib/display-objects/Path.js +143 -0
- package/lib/display-objects/Polygon.d.ts +12 -0
- package/lib/display-objects/Polygon.js +33 -0
- package/lib/display-objects/Polyline.d.ts +21 -0
- package/lib/display-objects/Polyline.js +85 -0
- package/lib/display-objects/Rect.d.ts +16 -0
- package/lib/display-objects/Rect.js +34 -0
- package/lib/display-objects/Text.d.ts +65 -0
- package/lib/display-objects/Text.js +69 -0
- package/lib/display-objects/index.d.ts +13 -0
- package/lib/display-objects/index.js +174 -0
- package/lib/dom/Animation.d.ts +132 -0
- package/lib/dom/Animation.js +506 -0
- package/lib/dom/AnimationEffectTiming.d.ts +59 -0
- package/lib/dom/AnimationEffectTiming.js +75 -0
- package/lib/dom/AnimationEvent.d.ts +11 -0
- package/lib/dom/AnimationEvent.js +42 -0
- package/lib/dom/AnimationTimeline.d.ts +37 -0
- package/lib/dom/AnimationTimeline.js +229 -0
- package/lib/dom/CustomElementRegistry.d.ts +15 -0
- package/lib/dom/CustomElementRegistry.js +50 -0
- package/lib/dom/CustomEvent.d.ts +16 -0
- package/lib/dom/CustomEvent.js +42 -0
- package/lib/dom/Document.d.ts +59 -0
- package/lib/dom/Document.js +177 -0
- package/lib/dom/Element.d.ts +143 -0
- package/lib/dom/Element.js +505 -0
- package/lib/dom/EventTarget.d.ts +43 -0
- package/lib/dom/EventTarget.js +179 -0
- package/lib/dom/FederatedEvent.d.ts +146 -0
- package/lib/dom/FederatedEvent.js +239 -0
- package/lib/dom/FederatedMouseEvent.d.ts +52 -0
- package/lib/dom/FederatedMouseEvent.js +133 -0
- package/lib/dom/FederatedPointerEvent.d.ts +69 -0
- package/lib/dom/FederatedPointerEvent.js +61 -0
- package/lib/dom/FederatedWheelEvent.d.ts +20 -0
- package/lib/dom/FederatedWheelEvent.js +35 -0
- package/lib/dom/KeyframeEffect.d.ts +48 -0
- package/lib/dom/KeyframeEffect.js +192 -0
- package/lib/dom/KeyframeList.d.ts +2 -0
- package/lib/dom/KeyframeList.js +183 -0
- package/lib/dom/Node.d.ts +106 -0
- package/lib/dom/Node.js +221 -0
- package/lib/dom/__tests__/utils/easing.d.ts +14 -0
- package/lib/dom/__tests__/utils/keyframe.d.ts +38 -0
- package/lib/dom/index.d.ts +17 -0
- package/lib/dom/index.js +226 -0
- package/lib/dom/interfaces.d.ts +326 -0
- package/lib/dom/interfaces.js +40 -0
- package/lib/global-module.d.ts +2 -0
- package/lib/global-module.js +177 -0
- package/lib/index.d.ts +18 -0
- package/lib/index.js +1 -1
- package/lib/plugins/CullingPlugin.d.ts +19 -0
- package/lib/plugins/CullingPlugin.js +92 -0
- package/lib/plugins/DirtyCheckPlugin.d.ts +10 -0
- package/lib/plugins/DirtyCheckPlugin.js +62 -0
- package/lib/plugins/EventPlugin.d.ts +26 -0
- package/lib/plugins/EventPlugin.js +297 -0
- package/lib/plugins/FrustumCullingStrategy.d.ts +21 -0
- package/lib/plugins/FrustumCullingStrategy.js +116 -0
- package/lib/plugins/PrepareRendererPlugin.d.ts +6 -0
- package/lib/plugins/PrepareRendererPlugin.js +88 -0
- package/lib/property-handlers/aabb.d.ts +2 -0
- package/lib/property-handlers/aabb.js +152 -0
- package/lib/property-handlers/anchor.d.ts +3 -0
- package/lib/property-handlers/anchor.js +34 -0
- package/lib/property-handlers/clipPath.d.ts +19 -0
- package/lib/property-handlers/clipPath.js +43 -0
- package/lib/property-handlers/color.d.ts +32 -0
- package/lib/property-handlers/color.js +271 -0
- package/lib/property-handlers/dimension.d.ts +18 -0
- package/lib/property-handlers/dimension.js +144 -0
- package/lib/property-handlers/filter.d.ts +9 -0
- package/lib/property-handlers/filter.js +56 -0
- package/lib/property-handlers/index.d.ts +17 -0
- package/lib/property-handlers/index.js +213 -0
- package/lib/property-handlers/interfaces.d.ts +20 -0
- package/lib/property-handlers/interfaces.js +18 -0
- package/lib/property-handlers/localPosition.d.ts +2 -0
- package/lib/property-handlers/localPosition.js +16 -0
- package/lib/property-handlers/numeric.d.ts +5 -0
- package/lib/property-handlers/numeric.js +50 -0
- package/lib/property-handlers/offsetDistance.d.ts +5 -0
- package/lib/property-handlers/offsetDistance.js +27 -0
- package/lib/property-handlers/offsetPath.d.ts +5 -0
- package/lib/property-handlers/offsetPath.js +25 -0
- package/lib/property-handlers/origin.d.ts +11 -0
- package/lib/property-handlers/origin.js +79 -0
- package/lib/property-handlers/path.d.ts +5 -0
- package/lib/property-handlers/path.js +214 -0
- package/lib/property-handlers/points.d.ts +6 -0
- package/lib/property-handlers/points.js +33 -0
- package/lib/property-handlers/transform.d.ts +45 -0
- package/lib/property-handlers/transform.js +430 -0
- package/lib/property-handlers/zIndex.d.ts +2 -0
- package/lib/property-handlers/zIndex.js +25 -0
- package/lib/services/ContextService.d.ts +12 -0
- package/lib/services/ContextService.js +15 -0
- package/lib/services/EventService.d.ts +64 -0
- package/lib/services/EventService.js +961 -0
- package/lib/services/RenderingContext.d.ts +28 -0
- package/lib/services/RenderingContext.js +22 -0
- package/lib/services/RenderingService.d.ts +51 -0
- package/lib/services/RenderingService.js +159 -0
- package/lib/services/SceneGraphSelector.d.ts +20 -0
- package/lib/services/SceneGraphSelector.js +76 -0
- package/lib/services/SceneGraphService.d.ts +146 -0
- package/lib/services/SceneGraphService.js +854 -0
- package/lib/services/aabb/CircleUpdater.d.ts +10 -0
- package/lib/services/aabb/CircleUpdater.js +45 -0
- package/lib/services/aabb/EllipseUpdater.d.ts +10 -0
- package/lib/services/aabb/EllipseUpdater.js +47 -0
- package/lib/services/aabb/LineUpdater.d.ts +10 -0
- package/lib/services/aabb/LineUpdater.js +49 -0
- package/lib/services/aabb/PathUpdater.d.ts +11 -0
- package/lib/services/aabb/PathUpdater.js +183 -0
- package/lib/services/aabb/PolylineUpdater.d.ts +10 -0
- package/lib/services/aabb/PolylineUpdater.js +58 -0
- package/lib/services/aabb/RectUpdater.d.ts +10 -0
- package/lib/services/aabb/RectUpdater.js +66 -0
- package/lib/services/aabb/TextUpdater.d.ts +13 -0
- package/lib/services/aabb/TextUpdater.js +93 -0
- package/lib/services/aabb/index.d.ts +8 -0
- package/lib/services/aabb/index.js +84 -0
- package/lib/services/aabb/interfaces.d.ts +16 -0
- package/lib/services/aabb/interfaces.js +10 -0
- package/lib/services/index.d.ts +10 -0
- package/lib/services/index.js +122 -0
- package/lib/services/text/OffscreenCanvasCreator.d.ts +6 -0
- package/lib/services/text/OffscreenCanvasCreator.js +55 -0
- package/lib/services/text/index.d.ts +35 -0
- package/lib/services/text/index.js +364 -0
- package/lib/shapes/AABB.d.ts +33 -0
- package/lib/shapes/AABB.js +235 -0
- package/lib/shapes/BoundingSphere.d.ts +8 -0
- package/lib/shapes/BoundingSphere.js +41 -0
- package/lib/shapes/Frustum.d.ts +16 -0
- package/lib/shapes/Frustum.js +96 -0
- package/lib/shapes/Plane.d.ts +14 -0
- package/lib/shapes/Plane.js +51 -0
- package/lib/shapes/Point.d.ts +11 -0
- package/lib/shapes/Point.js +38 -0
- package/lib/shapes/Polygon.d.ts +9 -0
- package/lib/shapes/Polygon.js +71 -0
- package/lib/shapes/Ray.d.ts +24 -0
- package/lib/shapes/Ray.js +169 -0
- package/lib/shapes/Rect.d.ts +12 -0
- package/lib/shapes/Rect.js +31 -0
- package/lib/shapes/Rectangle.d.ts +12 -0
- package/lib/shapes/Rectangle.js +27 -0
- package/lib/shapes/index.d.ts +8 -0
- package/lib/shapes/index.js +109 -0
- package/lib/types.d.ts +219 -0
- package/lib/types.js +25 -0
- package/lib/utils/animation.d.ts +15 -0
- package/lib/utils/animation.js +275 -0
- package/lib/utils/bezier-easing.d.ts +20 -0
- package/lib/utils/bezier-easing.js +128 -0
- package/lib/utils/canvas.d.ts +5 -0
- package/lib/utils/canvas.js +21 -0
- package/lib/utils/custom-easing.d.ts +75 -0
- package/lib/utils/custom-easing.js +415 -0
- package/lib/utils/event.d.ts +11 -0
- package/lib/utils/event.js +88 -0
- package/lib/utils/index.d.ts +5 -0
- package/lib/utils/index.js +70 -0
- package/lib/utils/interpolation.d.ts +3 -0
- package/lib/utils/interpolation.js +197 -0
- package/lib/utils/math.d.ts +22 -0
- package/lib/utils/math.js +166 -0
- package/lib/utils/path.d.ts +15 -0
- package/lib/utils/path.js +359 -0
- package/lib/utils/raf.d.ts +3 -0
- package/lib/utils/raf.js +21 -0
- package/lib/utils/text.d.ts +2 -0
- package/lib/utils/text.js +41 -0
- package/package.json +9 -5
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DisplayObjectConfig } from '../dom/interfaces';
|
|
2
|
+
import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
3
|
+
import { DisplayObject } from './DisplayObject';
|
|
4
|
+
export interface EllipseStyleProps extends BaseStyleProps {
|
|
5
|
+
rx: number;
|
|
6
|
+
ry: number;
|
|
7
|
+
}
|
|
8
|
+
export interface ParsedEllipseStyleProps extends ParsedBaseStyleProps {
|
|
9
|
+
rx: number;
|
|
10
|
+
ry: number;
|
|
11
|
+
}
|
|
12
|
+
export declare class Ellipse extends DisplayObject<EllipseStyleProps, ParsedEllipseStyleProps> {
|
|
13
|
+
constructor({ style, ...rest }: DisplayObjectConfig<EllipseStyleProps>);
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { __assign, __extends, __rest } from "tslib";
|
|
2
|
+
import { SHAPE } from '../types';
|
|
3
|
+
import { DisplayObject } from './DisplayObject';
|
|
4
|
+
|
|
5
|
+
var Ellipse =
|
|
6
|
+
/** @class */
|
|
7
|
+
function (_super) {
|
|
8
|
+
__extends(Ellipse, _super);
|
|
9
|
+
|
|
10
|
+
function Ellipse(_a) {
|
|
11
|
+
var style = _a.style,
|
|
12
|
+
rest = __rest(_a, ["style"]);
|
|
13
|
+
|
|
14
|
+
return _super.call(this, __assign({
|
|
15
|
+
type: SHAPE.Ellipse,
|
|
16
|
+
style: __assign({
|
|
17
|
+
rx: 0,
|
|
18
|
+
ry: 0,
|
|
19
|
+
anchor: [0.5, 0.5]
|
|
20
|
+
}, style)
|
|
21
|
+
}, rest)) || this;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return Ellipse;
|
|
25
|
+
}(DisplayObject);
|
|
26
|
+
|
|
27
|
+
export { Ellipse };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { __assign, __extends, __rest } from "tslib";
|
|
2
|
+
import { SHAPE } from '../types';
|
|
3
|
+
import { DisplayObject } from './DisplayObject';
|
|
4
|
+
|
|
5
|
+
var Group =
|
|
6
|
+
/** @class */
|
|
7
|
+
function (_super) {
|
|
8
|
+
__extends(Group, _super);
|
|
9
|
+
|
|
10
|
+
function Group(config) {
|
|
11
|
+
var _this = this;
|
|
12
|
+
|
|
13
|
+
var _a = config || {},
|
|
14
|
+
style = _a.style,
|
|
15
|
+
rest = __rest(_a, ["style"]);
|
|
16
|
+
|
|
17
|
+
_this = _super.call(this, __assign({
|
|
18
|
+
type: SHAPE.Group,
|
|
19
|
+
style: __assign({}, style)
|
|
20
|
+
}, rest)) || this;
|
|
21
|
+
return _this;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return Group;
|
|
25
|
+
}(DisplayObject);
|
|
26
|
+
|
|
27
|
+
export { Group };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
2
|
+
import { DisplayObject } from './DisplayObject';
|
|
3
|
+
import { DisplayObjectConfig } from '../dom';
|
|
4
|
+
import { AABB } from '../shapes';
|
|
5
|
+
export interface HTMLStyleProps extends BaseStyleProps {
|
|
6
|
+
innerHTML: string | HTMLElement;
|
|
7
|
+
className?: string | string[];
|
|
8
|
+
style?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ParsedHTMLStyleProps extends ParsedBaseStyleProps {
|
|
11
|
+
$el: HTMLElement;
|
|
12
|
+
innerHTML: string | HTMLElement;
|
|
13
|
+
className?: string | string[];
|
|
14
|
+
style?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* HTML container
|
|
18
|
+
* @see https://github.com/pmndrs/drei#html
|
|
19
|
+
*/
|
|
20
|
+
export declare class HTML extends DisplayObject<HTMLStyleProps, ParsedHTMLStyleProps> {
|
|
21
|
+
constructor({ style, ...rest }: DisplayObjectConfig<HTMLStyleProps>);
|
|
22
|
+
/**
|
|
23
|
+
* return wrapper HTMLElement
|
|
24
|
+
* * <div> in g-webgl/canvas
|
|
25
|
+
* * <foreignObject> in g-svg
|
|
26
|
+
*/
|
|
27
|
+
getDomElement(): HTMLElement;
|
|
28
|
+
/**
|
|
29
|
+
* override with $el.getBoundingClientRect
|
|
30
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/getBoundingClientRect
|
|
31
|
+
*/
|
|
32
|
+
getBoundingClientRect(): DOMRect;
|
|
33
|
+
getClientRects(): DOMRect[];
|
|
34
|
+
getBounds(): AABB;
|
|
35
|
+
getLocalBounds(): AABB;
|
|
36
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { __assign, __extends, __rest } from "tslib";
|
|
2
|
+
import { SHAPE } from '../types';
|
|
3
|
+
import { DisplayObject } from './DisplayObject';
|
|
4
|
+
import { Cullable } from '../components';
|
|
5
|
+
import { AABB } from '../shapes';
|
|
6
|
+
import { mat4, vec3 } from 'gl-matrix';
|
|
7
|
+
/**
|
|
8
|
+
* HTML container
|
|
9
|
+
* @see https://github.com/pmndrs/drei#html
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
var HTML =
|
|
13
|
+
/** @class */
|
|
14
|
+
function (_super) {
|
|
15
|
+
__extends(HTML, _super);
|
|
16
|
+
|
|
17
|
+
function HTML(_a) {
|
|
18
|
+
var style = _a.style,
|
|
19
|
+
rest = __rest(_a, ["style"]);
|
|
20
|
+
|
|
21
|
+
var _this = _super.call(this, __assign({
|
|
22
|
+
type: SHAPE.HTML,
|
|
23
|
+
style: __assign({
|
|
24
|
+
innerHTML: '',
|
|
25
|
+
className: '',
|
|
26
|
+
style: ''
|
|
27
|
+
}, style)
|
|
28
|
+
}, rest)) || this;
|
|
29
|
+
|
|
30
|
+
var cullable = _this.entity.getComponent(Cullable);
|
|
31
|
+
|
|
32
|
+
cullable.enable = false;
|
|
33
|
+
return _this;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* return wrapper HTMLElement
|
|
37
|
+
* * <div> in g-webgl/canvas
|
|
38
|
+
* * <foreignObject> in g-svg
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
HTML.prototype.getDomElement = function () {
|
|
43
|
+
return this.parsedStyle.$el;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* override with $el.getBoundingClientRect
|
|
47
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/getBoundingClientRect
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
HTML.prototype.getBoundingClientRect = function () {
|
|
52
|
+
return this.parsedStyle.$el.getBoundingClientRect();
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
HTML.prototype.getClientRects = function () {
|
|
56
|
+
return [this.getBoundingClientRect()];
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
HTML.prototype.getBounds = function () {
|
|
60
|
+
var _a, _b;
|
|
61
|
+
|
|
62
|
+
var clientRect = this.getBoundingClientRect(); // calc context's offset
|
|
63
|
+
// @ts-ignore
|
|
64
|
+
|
|
65
|
+
var canvasRect = (_b = (_a = this.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) === null || _b === void 0 ? void 0 : _b.getContextService().getBoundingClientRect();
|
|
66
|
+
|
|
67
|
+
if (canvasRect) {
|
|
68
|
+
var minX = clientRect.left - canvasRect.left;
|
|
69
|
+
var minY = clientRect.top - canvasRect.top;
|
|
70
|
+
var aabb = new AABB();
|
|
71
|
+
aabb.setMinMax(vec3.fromValues(minX, minY, 0), vec3.fromValues(minX + clientRect.width, minY + clientRect.height, 0));
|
|
72
|
+
return aabb;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return null;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
HTML.prototype.getLocalBounds = function () {
|
|
79
|
+
if (this.parentNode) {
|
|
80
|
+
var parentInvert = mat4.invert(mat4.create(), this.parentNode.getWorldTransform());
|
|
81
|
+
var bounds = this.getBounds();
|
|
82
|
+
|
|
83
|
+
if (bounds) {
|
|
84
|
+
var localBounds = new AABB();
|
|
85
|
+
localBounds.setFromTransformedAABB(bounds, parentInvert);
|
|
86
|
+
return localBounds;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return this.getBounds();
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
return HTML;
|
|
94
|
+
}(DisplayObject);
|
|
95
|
+
|
|
96
|
+
export { HTML };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
2
|
+
import { DisplayObject } from './DisplayObject';
|
|
3
|
+
import { DisplayObjectConfig } from '../dom';
|
|
4
|
+
export interface ImageStyleProps extends BaseStyleProps {
|
|
5
|
+
img: string | HTMLImageElement;
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface ParsedImageStyleProps extends ParsedBaseStyleProps {
|
|
10
|
+
img: string | HTMLImageElement;
|
|
11
|
+
width?: number;
|
|
12
|
+
height?: number;
|
|
13
|
+
}
|
|
14
|
+
export declare class Image extends DisplayObject<ImageStyleProps, ParsedImageStyleProps> {
|
|
15
|
+
constructor({ style, ...rest }: DisplayObjectConfig<ImageStyleProps>);
|
|
16
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { __assign, __extends, __rest } from "tslib";
|
|
2
|
+
import { SHAPE } from '../types';
|
|
3
|
+
import { DisplayObject } from './DisplayObject';
|
|
4
|
+
|
|
5
|
+
var Image =
|
|
6
|
+
/** @class */
|
|
7
|
+
function (_super) {
|
|
8
|
+
__extends(Image, _super);
|
|
9
|
+
|
|
10
|
+
function Image(_a) {
|
|
11
|
+
var style = _a.style,
|
|
12
|
+
rest = __rest(_a, ["style"]);
|
|
13
|
+
|
|
14
|
+
return _super.call(this, __assign({
|
|
15
|
+
type: SHAPE.Image,
|
|
16
|
+
style: __assign({
|
|
17
|
+
img: ''
|
|
18
|
+
}, style)
|
|
19
|
+
}, rest)) || this;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return Image;
|
|
23
|
+
}(DisplayObject);
|
|
24
|
+
|
|
25
|
+
export { Image };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
2
|
+
import { DisplayObject } from './DisplayObject';
|
|
3
|
+
import type { DisplayObjectConfig } from '../dom';
|
|
4
|
+
import { Point } from '../shapes';
|
|
5
|
+
export interface LineStyleProps extends BaseStyleProps {
|
|
6
|
+
x1: number;
|
|
7
|
+
y1: number;
|
|
8
|
+
x2: number;
|
|
9
|
+
y2: number;
|
|
10
|
+
}
|
|
11
|
+
export interface ParsedLineStyleProps extends ParsedBaseStyleProps {
|
|
12
|
+
x1: number;
|
|
13
|
+
y1: number;
|
|
14
|
+
x2: number;
|
|
15
|
+
y2: number;
|
|
16
|
+
defX: number;
|
|
17
|
+
defY: number;
|
|
18
|
+
}
|
|
19
|
+
export declare class Line extends DisplayObject<LineStyleProps, ParsedLineStyleProps> {
|
|
20
|
+
constructor({ style, ...rest }: DisplayObjectConfig<LineStyleProps>);
|
|
21
|
+
getPoint(ratio: number): Point;
|
|
22
|
+
getTotalLength(): number;
|
|
23
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { __assign, __extends, __rest } from "tslib";
|
|
2
|
+
import { Line as LineUtil } from '@antv/g-math';
|
|
3
|
+
import { SHAPE } from '../types';
|
|
4
|
+
import { DisplayObject } from './DisplayObject';
|
|
5
|
+
import { Point } from '../shapes';
|
|
6
|
+
|
|
7
|
+
var Line =
|
|
8
|
+
/** @class */
|
|
9
|
+
function (_super) {
|
|
10
|
+
__extends(Line, _super);
|
|
11
|
+
|
|
12
|
+
function Line(_a) {
|
|
13
|
+
var style = _a.style,
|
|
14
|
+
rest = __rest(_a, ["style"]);
|
|
15
|
+
|
|
16
|
+
return _super.call(this, __assign({
|
|
17
|
+
type: SHAPE.Line,
|
|
18
|
+
style: __assign({
|
|
19
|
+
x1: 0,
|
|
20
|
+
y1: 0,
|
|
21
|
+
x2: 0,
|
|
22
|
+
y2: 0,
|
|
23
|
+
lineJoin: "miter"
|
|
24
|
+
/* Miter */
|
|
25
|
+
,
|
|
26
|
+
lineCap: "butt"
|
|
27
|
+
/* Butt */
|
|
28
|
+
,
|
|
29
|
+
lineWidth: 1
|
|
30
|
+
}, style)
|
|
31
|
+
}, rest)) || this;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
Line.prototype.getPoint = function (ratio) {
|
|
35
|
+
var _a = this.parsedStyle,
|
|
36
|
+
x1 = _a.x1,
|
|
37
|
+
y1 = _a.y1,
|
|
38
|
+
x2 = _a.x2,
|
|
39
|
+
y2 = _a.y2;
|
|
40
|
+
var point = LineUtil.pointAt(x1, y1, x2, y2, ratio);
|
|
41
|
+
return new Point(point.x, point.y);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
Line.prototype.getTotalLength = function () {
|
|
45
|
+
var _a = this.parsedStyle,
|
|
46
|
+
x1 = _a.x1,
|
|
47
|
+
y1 = _a.y1,
|
|
48
|
+
x2 = _a.x2,
|
|
49
|
+
y2 = _a.y2;
|
|
50
|
+
return LineUtil.length(x1, y1, x2, y2);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
return Line;
|
|
54
|
+
}(DisplayObject);
|
|
55
|
+
|
|
56
|
+
export { Line };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { BaseStyleProps, PathCommand } from '../types';
|
|
2
|
+
import { DisplayObject } from './DisplayObject';
|
|
3
|
+
import { DisplayObjectConfig } from '../dom';
|
|
4
|
+
import { Point } from '../shapes';
|
|
5
|
+
import type { Rect } from '../shapes/Rect';
|
|
6
|
+
export interface PathStyleProps extends BaseStyleProps {
|
|
7
|
+
path: string | PathCommand[];
|
|
8
|
+
}
|
|
9
|
+
export interface PathSegment {
|
|
10
|
+
command: PathCommand[0];
|
|
11
|
+
currentPoint: [number, number];
|
|
12
|
+
prePoint: [number, number] | null;
|
|
13
|
+
nextPoint: [number, number] | null;
|
|
14
|
+
startTangent: [number, number] | null;
|
|
15
|
+
endTangent: [number, number] | null;
|
|
16
|
+
params: PathCommand;
|
|
17
|
+
}
|
|
18
|
+
export interface ParsedPathStyleProps {
|
|
19
|
+
absolutePath: PathCommand[];
|
|
20
|
+
hasArc: boolean;
|
|
21
|
+
segments: PathSegment[];
|
|
22
|
+
polygons: [number, number][][];
|
|
23
|
+
polylines: [number, number][][];
|
|
24
|
+
curve: PathCommand[];
|
|
25
|
+
totalLength: number;
|
|
26
|
+
curveSegments: number[][];
|
|
27
|
+
zCommandIndexes: number[];
|
|
28
|
+
rect: Rect;
|
|
29
|
+
}
|
|
30
|
+
export declare class Path extends DisplayObject<PathStyleProps, {
|
|
31
|
+
path: ParsedPathStyleProps;
|
|
32
|
+
}> {
|
|
33
|
+
constructor({ style, ...rest }: DisplayObjectConfig<PathStyleProps>);
|
|
34
|
+
getTotalLength(): number;
|
|
35
|
+
/**
|
|
36
|
+
* Get point according to ratio
|
|
37
|
+
*/
|
|
38
|
+
getPoint(ratio: number): Point | null;
|
|
39
|
+
/**
|
|
40
|
+
* Get start tangent vector
|
|
41
|
+
*/
|
|
42
|
+
getStartTangent(): number[][];
|
|
43
|
+
/**
|
|
44
|
+
* Get end tangent vector
|
|
45
|
+
*/
|
|
46
|
+
getEndTangent(): number[][];
|
|
47
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { __assign, __extends, __rest } from "tslib";
|
|
2
|
+
import { SHAPE } from '../types';
|
|
3
|
+
import { DisplayObject } from './DisplayObject';
|
|
4
|
+
import { Point } from '../shapes';
|
|
5
|
+
import { Cubic as CubicUtil } from '@antv/g-math';
|
|
6
|
+
import { isNil } from '@antv/util';
|
|
7
|
+
|
|
8
|
+
var Path =
|
|
9
|
+
/** @class */
|
|
10
|
+
function (_super) {
|
|
11
|
+
__extends(Path, _super);
|
|
12
|
+
|
|
13
|
+
function Path(_a) {
|
|
14
|
+
var style = _a.style,
|
|
15
|
+
rest = __rest(_a, ["style"]);
|
|
16
|
+
|
|
17
|
+
return _super.call(this, __assign({
|
|
18
|
+
type: SHAPE.Path,
|
|
19
|
+
style: __assign({
|
|
20
|
+
path: '',
|
|
21
|
+
lineJoin: "miter"
|
|
22
|
+
/* Miter */
|
|
23
|
+
,
|
|
24
|
+
lineCap: "butt"
|
|
25
|
+
/* Butt */
|
|
26
|
+
,
|
|
27
|
+
lineWidth: 1
|
|
28
|
+
}, style)
|
|
29
|
+
}, rest)) || this;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
Path.prototype.getTotalLength = function () {
|
|
33
|
+
return this.parsedStyle.path.totalLength;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Get point according to ratio
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
Path.prototype.getPoint = function (ratio) {
|
|
41
|
+
var subt = 0;
|
|
42
|
+
var index = 0;
|
|
43
|
+
var curve = this.parsedStyle.path.curve;
|
|
44
|
+
|
|
45
|
+
if (!this.parsedStyle.path.curveSegments.length) {
|
|
46
|
+
if (curve) {
|
|
47
|
+
return new Point(curve[0][1], curve[0][2]);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
this.parsedStyle.path.curveSegments.forEach(function (v, i) {
|
|
54
|
+
if (ratio >= v[0] && ratio <= v[1]) {
|
|
55
|
+
subt = (ratio - v[0]) / (v[1] - v[0]);
|
|
56
|
+
index = i;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
var seg = curve[index];
|
|
60
|
+
|
|
61
|
+
if (isNil(seg) || isNil(index)) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
var l = seg.length;
|
|
66
|
+
var nextSeg = curve[index + 1];
|
|
67
|
+
|
|
68
|
+
var _a = CubicUtil.pointAt( // @ts-ignore
|
|
69
|
+
seg[l - 2], seg[l - 1], nextSeg[1], nextSeg[2], nextSeg[3], nextSeg[4], nextSeg[5], nextSeg[6], subt),
|
|
70
|
+
x = _a.x,
|
|
71
|
+
y = _a.y;
|
|
72
|
+
|
|
73
|
+
return new Point(x, y);
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Get start tangent vector
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
Path.prototype.getStartTangent = function () {
|
|
81
|
+
var segments = this.parsedStyle.path.segments;
|
|
82
|
+
var result = [];
|
|
83
|
+
|
|
84
|
+
if (segments.length > 1) {
|
|
85
|
+
var startPoint = segments[0].currentPoint;
|
|
86
|
+
var endPoint = segments[1].currentPoint;
|
|
87
|
+
var tangent = segments[1].startTangent;
|
|
88
|
+
result = [];
|
|
89
|
+
|
|
90
|
+
if (tangent) {
|
|
91
|
+
result.push([startPoint[0] - tangent[0], startPoint[1] - tangent[1]]);
|
|
92
|
+
result.push([startPoint[0], startPoint[1]]);
|
|
93
|
+
} else {
|
|
94
|
+
result.push([endPoint[0], endPoint[1]]);
|
|
95
|
+
result.push([startPoint[0], startPoint[1]]);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return result;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Get end tangent vector
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
Path.prototype.getEndTangent = function () {
|
|
107
|
+
var segments = this.parsedStyle.path.segments;
|
|
108
|
+
var length = segments.length;
|
|
109
|
+
var result = [];
|
|
110
|
+
|
|
111
|
+
if (length > 1) {
|
|
112
|
+
var startPoint = segments[length - 2].currentPoint;
|
|
113
|
+
var endPoint = segments[length - 1].currentPoint;
|
|
114
|
+
var tangent = segments[length - 1].endTangent;
|
|
115
|
+
result = [];
|
|
116
|
+
|
|
117
|
+
if (tangent) {
|
|
118
|
+
result.push([endPoint[0] - tangent[0], endPoint[1] - tangent[1]]);
|
|
119
|
+
result.push([endPoint[0], endPoint[1]]);
|
|
120
|
+
} else {
|
|
121
|
+
result.push([startPoint[0], startPoint[1]]);
|
|
122
|
+
result.push([endPoint[0], endPoint[1]]);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return result;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
return Path;
|
|
130
|
+
}(DisplayObject);
|
|
131
|
+
|
|
132
|
+
export { Path };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BaseStyleProps } from '../types';
|
|
2
|
+
import { DisplayObject } from './DisplayObject';
|
|
3
|
+
import { DisplayObjectConfig } from '../dom';
|
|
4
|
+
import type { ParsedPolylineStyleProps } from './Polyline';
|
|
5
|
+
export interface PolygonStyleProps extends BaseStyleProps {
|
|
6
|
+
points: [number, number][];
|
|
7
|
+
}
|
|
8
|
+
export declare class Polygon extends DisplayObject<PolygonStyleProps, {
|
|
9
|
+
points: ParsedPolylineStyleProps;
|
|
10
|
+
}> {
|
|
11
|
+
constructor({ style, ...rest }: DisplayObjectConfig<PolygonStyleProps>);
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { __assign, __extends, __rest } from "tslib";
|
|
2
|
+
import { SHAPE } from '../types';
|
|
3
|
+
import { DisplayObject } from './DisplayObject';
|
|
4
|
+
|
|
5
|
+
var Polygon =
|
|
6
|
+
/** @class */
|
|
7
|
+
function (_super) {
|
|
8
|
+
__extends(Polygon, _super);
|
|
9
|
+
|
|
10
|
+
function Polygon(_a) {
|
|
11
|
+
var style = _a.style,
|
|
12
|
+
rest = __rest(_a, ["style"]);
|
|
13
|
+
|
|
14
|
+
return _super.call(this, __assign({
|
|
15
|
+
type: SHAPE.Polygon,
|
|
16
|
+
style: __assign({
|
|
17
|
+
points: []
|
|
18
|
+
}, style)
|
|
19
|
+
}, rest)) || this;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return Polygon;
|
|
23
|
+
}(DisplayObject);
|
|
24
|
+
|
|
25
|
+
export { Polygon };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BaseStyleProps } from '../types';
|
|
2
|
+
import { DisplayObject } from './DisplayObject';
|
|
3
|
+
import { DisplayObjectConfig } from '../dom';
|
|
4
|
+
import { Point } from '../shapes';
|
|
5
|
+
export interface PolylineStyleProps extends BaseStyleProps {
|
|
6
|
+
points: [number, number][];
|
|
7
|
+
}
|
|
8
|
+
export interface ParsedPolylineStyleProps {
|
|
9
|
+
points: [number, number][];
|
|
10
|
+
segments: [number, number][];
|
|
11
|
+
totalLength: number;
|
|
12
|
+
}
|
|
13
|
+
export declare class Polyline extends DisplayObject<PolylineStyleProps, {
|
|
14
|
+
points: ParsedPolylineStyleProps;
|
|
15
|
+
}> {
|
|
16
|
+
constructor({ style, ...rest }: DisplayObjectConfig<PolylineStyleProps>);
|
|
17
|
+
getTotalLength(): number;
|
|
18
|
+
getPoint(ratio: number): Point;
|
|
19
|
+
getStartTangent(): number[][];
|
|
20
|
+
getEndTangent(): number[][];
|
|
21
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { __assign, __extends, __rest } from "tslib";
|
|
2
|
+
import { SHAPE } from '../types';
|
|
3
|
+
import { DisplayObject } from './DisplayObject';
|
|
4
|
+
import { Line as LineUtil } from '@antv/g-math';
|
|
5
|
+
import { Point } from '../shapes';
|
|
6
|
+
|
|
7
|
+
var Polyline =
|
|
8
|
+
/** @class */
|
|
9
|
+
function (_super) {
|
|
10
|
+
__extends(Polyline, _super);
|
|
11
|
+
|
|
12
|
+
function Polyline(_a) {
|
|
13
|
+
var style = _a.style,
|
|
14
|
+
rest = __rest(_a, ["style"]);
|
|
15
|
+
|
|
16
|
+
return _super.call(this, __assign({
|
|
17
|
+
type: SHAPE.Polyline,
|
|
18
|
+
style: __assign({
|
|
19
|
+
points: [],
|
|
20
|
+
lineJoin: "miter"
|
|
21
|
+
/* Miter */
|
|
22
|
+
,
|
|
23
|
+
lineCap: "butt"
|
|
24
|
+
/* Butt */
|
|
25
|
+
,
|
|
26
|
+
lineWidth: 1
|
|
27
|
+
}, style)
|
|
28
|
+
}, rest)) || this;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
Polyline.prototype.getTotalLength = function () {
|
|
32
|
+
return this.parsedStyle.points.totalLength;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
Polyline.prototype.getPoint = function (ratio) {
|
|
36
|
+
var _a = this.parsedStyle.points,
|
|
37
|
+
points = _a.points,
|
|
38
|
+
segments = _a.segments;
|
|
39
|
+
var subt = 0;
|
|
40
|
+
var index = 0;
|
|
41
|
+
segments.forEach(function (v, i) {
|
|
42
|
+
if (ratio >= v[0] && ratio <= v[1]) {
|
|
43
|
+
subt = (ratio - v[0]) / (v[1] - v[0]);
|
|
44
|
+
index = i;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
var _b = LineUtil.pointAt(points[index][0], points[index][1], points[index + 1][0], points[index + 1][1], subt),
|
|
49
|
+
x = _b.x,
|
|
50
|
+
y = _b.y;
|
|
51
|
+
|
|
52
|
+
return new Point(x, y);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
Polyline.prototype.getStartTangent = function () {
|
|
56
|
+
var points = this.parsedStyle.points.points;
|
|
57
|
+
var result = [];
|
|
58
|
+
result.push([points[1][0], points[1][1]]);
|
|
59
|
+
result.push([points[0][0], points[0][1]]);
|
|
60
|
+
return result;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
Polyline.prototype.getEndTangent = function () {
|
|
64
|
+
var points = this.parsedStyle.points.points;
|
|
65
|
+
var l = points.length - 1;
|
|
66
|
+
var result = [];
|
|
67
|
+
result.push([points[l - 1][0], points[l - 1][1]]);
|
|
68
|
+
result.push([points[l][0], points[l][1]]);
|
|
69
|
+
return result;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
return Polyline;
|
|
73
|
+
}(DisplayObject);
|
|
74
|
+
|
|
75
|
+
export { Polyline };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
2
|
+
import { DisplayObject } from './DisplayObject';
|
|
3
|
+
import type { DisplayObjectConfig } from '../dom';
|
|
4
|
+
export interface RectStyleProps extends BaseStyleProps {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
radius?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface ParsedRectStyleProps extends ParsedBaseStyleProps {
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
radius?: number;
|
|
13
|
+
}
|
|
14
|
+
export declare class Rect extends DisplayObject<RectStyleProps, ParsedRectStyleProps> {
|
|
15
|
+
constructor({ style, ...rest }: DisplayObjectConfig<RectStyleProps>);
|
|
16
|
+
}
|