@antv/g 1.0.0-alpha.27 → 1.0.0-alpha.28

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.
Files changed (151) hide show
  1. package/dist/index.umd.js +4238 -0
  2. package/lib/index.js +222 -0
  3. package/package.json +11 -10
  4. package/dist/AbstractRenderer.d.ts +0 -26
  5. package/dist/Canvas.d.ts +0 -96
  6. package/dist/DisplayObjectPool.d.ts +0 -7
  7. package/dist/__tests__/canvas.spec.d.ts +0 -1
  8. package/dist/__tests__/custom-element.spec.d.ts +0 -3
  9. package/dist/__tests__/event.spec.d.ts +0 -1
  10. package/dist/camera/Camera.d.ts +0 -279
  11. package/dist/camera/Landmark.d.ts +0 -28
  12. package/dist/camera/__tests__/camera.spec.d.ts +0 -1
  13. package/dist/camera/__tests__/landmark.spec.d.ts +0 -1
  14. package/dist/camera/index.d.ts +0 -2
  15. package/dist/canvas-module.d.ts +0 -3
  16. package/dist/components/Cullable.d.ts +0 -15
  17. package/dist/components/Geometry.d.ts +0 -13
  18. package/dist/components/Renderable.d.ts +0 -25
  19. package/dist/components/Sortable.d.ts +0 -17
  20. package/dist/components/Transform.d.ts +0 -28
  21. package/dist/components/index.d.ts +0 -5
  22. package/dist/display-objects/Circle.d.ts +0 -12
  23. package/dist/display-objects/CustomElement.d.ts +0 -25
  24. package/dist/display-objects/DisplayObject.d.ts +0 -258
  25. package/dist/display-objects/Ellipse.d.ts +0 -14
  26. package/dist/display-objects/Group.d.ts +0 -6
  27. package/dist/display-objects/HTML.d.ts +0 -36
  28. package/dist/display-objects/Image.d.ts +0 -16
  29. package/dist/display-objects/Line.d.ts +0 -23
  30. package/dist/display-objects/Path.d.ts +0 -47
  31. package/dist/display-objects/Polygon.d.ts +0 -12
  32. package/dist/display-objects/Polyline.d.ts +0 -21
  33. package/dist/display-objects/Rect.d.ts +0 -16
  34. package/dist/display-objects/Text.d.ts +0 -65
  35. package/dist/display-objects/__tests__/circle.spec.d.ts +0 -1
  36. package/dist/display-objects/__tests__/display-object.bounds.spec.d.ts +0 -1
  37. package/dist/display-objects/__tests__/display-object.node.spec.d.ts +0 -1
  38. package/dist/display-objects/__tests__/display-object.transformable.spec.d.ts +0 -1
  39. package/dist/display-objects/__tests__/display-object.visible.spec.d.ts +0 -1
  40. package/dist/display-objects/__tests__/ellipse.spec.d.ts +0 -1
  41. package/dist/display-objects/__tests__/line.spec.d.ts +0 -1
  42. package/dist/display-objects/__tests__/path.spec.d.ts +0 -1
  43. package/dist/display-objects/__tests__/polygon.spec.d.ts +0 -1
  44. package/dist/display-objects/__tests__/polyline.spec.d.ts +0 -1
  45. package/dist/display-objects/__tests__/text.spec.d.ts +0 -1
  46. package/dist/display-objects/index.d.ts +0 -13
  47. package/dist/dom/Animation.d.ts +0 -132
  48. package/dist/dom/AnimationEffectTiming.d.ts +0 -59
  49. package/dist/dom/AnimationEvent.d.ts +0 -11
  50. package/dist/dom/AnimationTimeline.d.ts +0 -37
  51. package/dist/dom/CustomElementRegistry.d.ts +0 -15
  52. package/dist/dom/CustomEvent.d.ts +0 -16
  53. package/dist/dom/Document.d.ts +0 -59
  54. package/dist/dom/Element.d.ts +0 -143
  55. package/dist/dom/EventTarget.d.ts +0 -47
  56. package/dist/dom/FederatedEvent.d.ts +0 -146
  57. package/dist/dom/FederatedMouseEvent.d.ts +0 -52
  58. package/dist/dom/FederatedPointerEvent.d.ts +0 -69
  59. package/dist/dom/FederatedWheelEvent.d.ts +0 -20
  60. package/dist/dom/KeyframeEffect.d.ts +0 -48
  61. package/dist/dom/KeyframeList.d.ts +0 -2
  62. package/dist/dom/Node.d.ts +0 -106
  63. package/dist/dom/__tests__/animation.computed-timing.spec.d.ts +0 -1
  64. package/dist/dom/__tests__/animation.keyframe-effect.spec.d.ts +0 -1
  65. package/dist/dom/__tests__/animation.timeline.spec.d.ts +0 -1
  66. package/dist/dom/__tests__/document.spec.d.ts +0 -1
  67. package/dist/dom/__tests__/element.spec.d.ts +0 -1
  68. package/dist/dom/__tests__/event.spec.d.ts +0 -1
  69. package/dist/dom/__tests__/utils/easing.d.ts +0 -14
  70. package/dist/dom/__tests__/utils/keyframe.d.ts +0 -38
  71. package/dist/dom/index.d.ts +0 -17
  72. package/dist/dom/interfaces.d.ts +0 -327
  73. package/dist/global-module.d.ts +0 -1
  74. package/dist/index.d.ts +0 -15
  75. package/dist/index.esm.js +0 -13165
  76. package/dist/index.js +0 -13659
  77. package/dist/plugins/CullingPlugin.d.ts +0 -19
  78. package/dist/plugins/DirtyCheckPlugin.d.ts +0 -10
  79. package/dist/plugins/EventPlugin.d.ts +0 -26
  80. package/dist/plugins/FrustumCullingStrategy.d.ts +0 -21
  81. package/dist/plugins/PrepareRendererPlugin.d.ts +0 -6
  82. package/dist/property-handlers/__tests__/color.spec.d.ts +0 -1
  83. package/dist/property-handlers/__tests__/dimension.spec.d.ts +0 -1
  84. package/dist/property-handlers/__tests__/filter.spec.d.ts +0 -1
  85. package/dist/property-handlers/__tests__/transform.spec.d.ts +0 -1
  86. package/dist/property-handlers/aabb.d.ts +0 -2
  87. package/dist/property-handlers/anchor.d.ts +0 -3
  88. package/dist/property-handlers/clipPath.d.ts +0 -19
  89. package/dist/property-handlers/color.d.ts +0 -32
  90. package/dist/property-handlers/dimension.d.ts +0 -18
  91. package/dist/property-handlers/filter.d.ts +0 -9
  92. package/dist/property-handlers/index.d.ts +0 -17
  93. package/dist/property-handlers/interfaces.d.ts +0 -20
  94. package/dist/property-handlers/localPosition.d.ts +0 -2
  95. package/dist/property-handlers/numeric.d.ts +0 -5
  96. package/dist/property-handlers/offsetDistance.d.ts +0 -5
  97. package/dist/property-handlers/offsetPath.d.ts +0 -5
  98. package/dist/property-handlers/origin.d.ts +0 -11
  99. package/dist/property-handlers/path.d.ts +0 -5
  100. package/dist/property-handlers/points.d.ts +0 -6
  101. package/dist/property-handlers/transform.d.ts +0 -45
  102. package/dist/property-handlers/zIndex.d.ts +0 -2
  103. package/dist/services/ContextService.d.ts +0 -12
  104. package/dist/services/EventService.d.ts +0 -64
  105. package/dist/services/RenderingContext.d.ts +0 -28
  106. package/dist/services/RenderingService.d.ts +0 -51
  107. package/dist/services/SceneGraphSelector.d.ts +0 -20
  108. package/dist/services/SceneGraphService.d.ts +0 -146
  109. package/dist/services/aabb/CircleUpdater.d.ts +0 -10
  110. package/dist/services/aabb/EllipseUpdater.d.ts +0 -10
  111. package/dist/services/aabb/LineUpdater.d.ts +0 -10
  112. package/dist/services/aabb/PathUpdater.d.ts +0 -11
  113. package/dist/services/aabb/PolylineUpdater.d.ts +0 -10
  114. package/dist/services/aabb/RectUpdater.d.ts +0 -10
  115. package/dist/services/aabb/TextUpdater.d.ts +0 -13
  116. package/dist/services/aabb/index.d.ts +0 -8
  117. package/dist/services/aabb/interfaces.d.ts +0 -16
  118. package/dist/services/index.d.ts +0 -10
  119. package/dist/services/text/OffscreenCanvasCreator.d.ts +0 -6
  120. package/dist/services/text/index.d.ts +0 -35
  121. package/dist/shapes/AABB.d.ts +0 -33
  122. package/dist/shapes/BoundingSphere.d.ts +0 -8
  123. package/dist/shapes/Frustum.d.ts +0 -16
  124. package/dist/shapes/Plane.d.ts +0 -14
  125. package/dist/shapes/Point.d.ts +0 -11
  126. package/dist/shapes/Polygon.d.ts +0 -9
  127. package/dist/shapes/Ray.d.ts +0 -24
  128. package/dist/shapes/Rect.d.ts +0 -12
  129. package/dist/shapes/Rectangle.d.ts +0 -12
  130. package/dist/shapes/__tests__/aabb.spec.d.ts +0 -1
  131. package/dist/shapes/__tests__/boundingSphere.spec.d.ts +0 -1
  132. package/dist/shapes/__tests__/frustum.spec.d.ts +0 -1
  133. package/dist/shapes/__tests__/plane.spec.d.ts +0 -1
  134. package/dist/shapes/__tests__/ray.spec.d.ts +0 -1
  135. package/dist/shapes/index.d.ts +0 -8
  136. package/dist/types.d.ts +0 -219
  137. package/dist/utils/__tests__/event.spec.d.ts +0 -1
  138. package/dist/utils/__tests__/path.spec.d.ts +0 -1
  139. package/dist/utils/__tests__/raf.spec.d.ts +0 -1
  140. package/dist/utils/__tests__/text.spec.d.ts +0 -1
  141. package/dist/utils/animation.d.ts +0 -15
  142. package/dist/utils/bezier-easing.d.ts +0 -20
  143. package/dist/utils/canvas.d.ts +0 -5
  144. package/dist/utils/custom-easing.d.ts +0 -75
  145. package/dist/utils/event.d.ts +0 -11
  146. package/dist/utils/index.d.ts +0 -5
  147. package/dist/utils/interpolation.d.ts +0 -3
  148. package/dist/utils/math.d.ts +0 -22
  149. package/dist/utils/path.d.ts +0 -15
  150. package/dist/utils/raf.d.ts +0 -3
  151. package/dist/utils/text.d.ts +0 -2
@@ -1,28 +0,0 @@
1
- import { vec3 } from 'gl-matrix';
2
- import type { Camera } from './Camera';
3
- /**
4
- * 保存相机状态,便于后续在多个 Landmark 间移动
5
- */
6
- export declare class Landmark {
7
- name: string;
8
- private matrix;
9
- private right;
10
- private up;
11
- private forward;
12
- private position;
13
- private focalPoint;
14
- private distanceVector;
15
- private distance;
16
- private dollyingStep;
17
- private azimuth;
18
- private elevation;
19
- private roll;
20
- private relAzimuth;
21
- private relElevation;
22
- private relRoll;
23
- constructor(name: string, c: Camera);
24
- getPosition(): vec3;
25
- getFocalPoint(): vec3;
26
- getRoll(): number;
27
- retrieve(c: Camera): void;
28
- }
@@ -1 +0,0 @@
1
- import 'reflect-metadata';
@@ -1 +0,0 @@
1
- import 'reflect-metadata';
@@ -1,2 +0,0 @@
1
- export * from './Camera';
2
- export * from './Landmark';
@@ -1,3 +0,0 @@
1
- import { Syringe } from 'mana-syringe';
2
- export declare const containerModule: import("mana-syringe").SyringeModule;
3
- export declare function unload(container: Syringe.Container): void;
@@ -1,15 +0,0 @@
1
- import { Component } from '@antv/g-ecs';
2
- /**
3
- * @see https://doc.babylonjs.com/how_to/optimizing_your_scene#changing-mesh-culling-strategy
4
- */
5
- export declare enum Strategy {
6
- Standard = 0
7
- }
8
- export declare class Cullable extends Component {
9
- static tag: string;
10
- strategy: Strategy;
11
- visibilityPlaneMask: number;
12
- visible: boolean;
13
- enable: boolean;
14
- isCulled(): boolean;
15
- }
@@ -1,13 +0,0 @@
1
- import { Component } from '@antv/g-ecs';
2
- import { AABB } from '../shapes';
3
- export declare class Geometry extends Component {
4
- static tag: string;
5
- /**
6
- * excluding all children
7
- */
8
- contentBounds: AABB | undefined;
9
- /**
10
- * including extra rendering effects, eg. shadowBlur filters(drop-shadow, blur)
11
- */
12
- renderBounds: AABB | undefined;
13
- }
@@ -1,25 +0,0 @@
1
- import { Component } from '@antv/g-ecs';
2
- import { AABB } from '../shapes';
3
- export declare class Renderable extends Component {
4
- static tag: string;
5
- /**
6
- * aabb 应该存在 Renderable 而非 Geometry 中,原因包括:
7
- * 1. 包围盒会受 transform 影响。例如每次 transform 之后应该重新计算包围盒(center 发生偏移)。
8
- * 2. 多个 Mesh 可以共享一个 Geometry,但可以各自拥有不同的 aabb
9
- */
10
- bounds: AABB | undefined;
11
- boundsDirty: boolean;
12
- /**
13
- * account for hierarchy, also including extra rendering effects
14
- */
15
- renderBounds: AABB | undefined;
16
- renderBoundsDirty: boolean;
17
- /**
18
- * dirty render bounds in last render frame
19
- */
20
- dirtyRenderBounds: AABB;
21
- /**
22
- * dirty rectangle flag
23
- */
24
- dirty: boolean;
25
- }
@@ -1,17 +0,0 @@
1
- import { Component } from '@antv/g-ecs';
2
- import type { INode } from '../dom/interfaces';
3
- export declare class Sortable extends Component {
4
- static tag: string;
5
- /**
6
- * need to re-sort
7
- */
8
- dirty: boolean;
9
- /**
10
- * sorted child entities
11
- */
12
- sorted: INode[];
13
- /**
14
- * index in parent's children
15
- */
16
- lastSortedIndex: number;
17
- }
@@ -1,28 +0,0 @@
1
- import { mat4, vec3 } from 'gl-matrix';
2
- import { Component } from '@antv/g-ecs';
3
- /**
4
- * do RTS transformation for 2D/3D
5
- */
6
- export declare class Transform extends Component {
7
- static tag: string;
8
- dirtyFlag: boolean;
9
- localDirtyFlag: boolean;
10
- /**
11
- * local space RTS
12
- */
13
- localPosition: vec3;
14
- localRotation: import("gl-matrix").vec4;
15
- localScale: vec3;
16
- localTransform: mat4;
17
- /**
18
- * world space RTS
19
- */
20
- position: vec3;
21
- rotation: import("gl-matrix").vec4;
22
- scaling: vec3;
23
- worldTransform: mat4;
24
- /**
25
- * the origin of scaling and rotation
26
- */
27
- origin: vec3;
28
- }
@@ -1,5 +0,0 @@
1
- export * from './Geometry';
2
- export * from './Renderable';
3
- export * from './Transform';
4
- export * from './Cullable';
5
- export * from './Sortable';
@@ -1,12 +0,0 @@
1
- import type { DisplayObjectConfig } from '../dom/interfaces';
2
- import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
3
- import { DisplayObject } from './DisplayObject';
4
- export interface CircleStyleProps extends BaseStyleProps {
5
- r: number;
6
- }
7
- export interface ParsedCircleStyleProps extends ParsedBaseStyleProps {
8
- r: number;
9
- }
10
- export declare class Circle extends DisplayObject<CircleStyleProps, ParsedCircleStyleProps> {
11
- constructor({ style, ...rest }: DisplayObjectConfig<CircleStyleProps>);
12
- }
@@ -1,25 +0,0 @@
1
- import { DisplayObject } from './DisplayObject';
2
- import type { DisplayObjectConfig } from '../dom/interfaces';
3
- export interface CustomElement<CustomElementStyleProps> {
4
- /**
5
- * fired after element insert into DOM tree
6
- */
7
- connectedCallback?(): void;
8
- /**
9
- * fired before element removed from DOM tree
10
- */
11
- disconnectedCallback?(): void;
12
- attributeChangedCallback?<Key extends keyof CustomElementStyleProps>(name: Key, oldValue: CustomElementStyleProps[Key], newValue: CustomElementStyleProps[Key]): void;
13
- }
14
- /**
15
- * shadow root
16
- * @see https://yuque.antfin-inc.com/antv/czqvg5/pgqipg
17
- */
18
- export declare abstract class CustomElement<CustomElementStyleProps> extends DisplayObject<CustomElementStyleProps> {
19
- private shadowNodes;
20
- constructor(config: DisplayObjectConfig<CustomElementStyleProps>);
21
- private handleMounted;
22
- private handleChildInserted;
23
- private handleChildRemoved;
24
- private handleAttributeChanged;
25
- }
@@ -1,258 +0,0 @@
1
- import { mat3, mat4, quat, vec2, vec3 } from 'gl-matrix';
2
- import { Animation } from '../dom/Animation';
3
- import { Element } from '../dom/Element';
4
- import type { DisplayObjectConfig, INode } from '../dom/interfaces';
5
- import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
6
- import { StylePropertyParser, StylePropertyUpdater } from '../property-handlers';
7
- /**
8
- * prototype chains: DisplayObject -> Element -> Node -> EventTarget
9
- *
10
- * mixins: Animatable, Transformable, Visible
11
- * @see https://github.com/tannerntannern/ts-mixer/blob/master/README.md#mixing-generic-classes
12
- *
13
- * Provide abilities in scene graph, such as:
14
- * * transform `translate/rotate/scale`
15
- * * add/remove child
16
- * * visibility and z-index
17
- *
18
- * Those abilities are implemented with those components: `Transform/Sortable/Visible`.
19
- *
20
- * Emit following events:
21
- * * init
22
- * * destroy
23
- * * attributeChanged
24
- */
25
- export declare class DisplayObject<StyleProps extends BaseStyleProps = any, ParsedStyleProps extends ParsedBaseStyleProps = any> extends Element<StyleProps, ParsedStyleProps> {
26
- /**
27
- * contains style props in constructor's params, eg. fill, stroke...
28
- */
29
- config: DisplayObjectConfig<StyleProps>;
30
- /**
31
- * push to active animations after calling `animate()`
32
- */
33
- private activeAnimations;
34
- stylePropertyUpdaterFactory: <Key extends keyof StyleProps>(stylePropertyName: Key) => StylePropertyUpdater<any>[];
35
- stylePropertyParserFactory: <Key extends keyof ParsedStyleProps>(stylePropertyName: Key) => StylePropertyParser<any, any>;
36
- constructor(config: DisplayObjectConfig<StyleProps>);
37
- destroy(): void;
38
- cloneNode(deep?: boolean): this;
39
- private initAttributes;
40
- setAttribute<Key extends keyof StyleProps>(attributeName: Key, value: StyleProps[Key], force?: boolean): void;
41
- /**
42
- * parse property, eg.
43
- * * fill: 'red' => [1, 0, 0, 1]
44
- * * translateX: '10px' => { unit: 'px', value: 10 }
45
- */
46
- private parseStyleProperty;
47
- private updateStyleProperty;
48
- /**
49
- * called when attributes get changed or initialized
50
- */
51
- private changeAttribute;
52
- setOrigin(position: vec3 | vec2 | number, y?: number, z?: number): this;
53
- getOrigin(): vec3;
54
- /**
55
- * set position in world space
56
- */
57
- setPosition(position: vec3 | vec2 | number, y?: number, z?: number): this;
58
- /**
59
- * set position in local space
60
- */
61
- setLocalPosition(position: vec3 | vec2 | number, y?: number, z?: number): this;
62
- /**
63
- * translate in world space
64
- */
65
- translate(position: vec3 | vec2 | number, y?: number, z?: number): this;
66
- /**
67
- * translate in local space
68
- */
69
- translateLocal(position: vec3 | vec2 | number, y?: number, z?: number): this;
70
- getPosition(): vec3;
71
- getLocalPosition(): vec3;
72
- /**
73
- * compatible with G 3.0
74
- *
75
- * scaling in local space
76
- * scale(10) = scale(10, 10, 10)
77
- *
78
- * we can't set scale in world space
79
- */
80
- scale(scaling: vec3 | vec2 | number, y?: number, z?: number): this;
81
- scaleLocal(scaling: vec3 | vec2 | number, y?: number, z?: number): this;
82
- /**
83
- * set scaling in local space
84
- */
85
- setLocalScale(scaling: vec3 | vec2 | number, y?: number, z?: number): this;
86
- /**
87
- * get scaling in local space
88
- */
89
- getLocalScale(): vec3;
90
- /**
91
- * get scaling in world space
92
- */
93
- getScale(): vec3;
94
- /**
95
- * only return degrees of Z axis in world space
96
- */
97
- getEulerAngles(): number;
98
- /**
99
- * only return degrees of Z axis in local space
100
- */
101
- getLocalEulerAngles(): number;
102
- /**
103
- * set euler angles(degrees) in world space
104
- */
105
- setEulerAngles(z: number): this;
106
- /**
107
- * set euler angles(degrees) in local space
108
- */
109
- setLocalEulerAngles(z: number): this;
110
- rotateLocal(x: number, y?: number, z?: number): this;
111
- rotate(x: number, y?: number, z?: number): this;
112
- getRotation(): quat;
113
- getLocalRotation(): quat;
114
- getLocalTransform(): mat4;
115
- getWorldTransform(): mat4;
116
- resetLocalTransform(): void;
117
- /**
118
- * sync style.x/y when local position changed
119
- *
120
- * Mixins may not declare private/protected properties
121
- * however, you can use ES2020 private fields
122
- */
123
- private syncLocalPosition;
124
- /**
125
- * returns an array of all Animation objects affecting this element
126
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAnimations
127
- */
128
- getAnimations(): Animation[];
129
- /**
130
- * create an animation with WAAPI
131
- * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/animate
132
- */
133
- animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions | undefined): Animation | null;
134
- /**
135
- * show group, which will also change visibility of its children in sceneGraphNode
136
- *
137
- * @see https://developer.mozilla.org/en-US/docs/Web/CSS/visibility
138
- */
139
- show(): void;
140
- /**
141
- * hide group, which will also change visibility of its children in sceneGraphNode
142
- */
143
- hide(): void;
144
- isVisible(): boolean;
145
- /**
146
- * bring to front in current group
147
- */
148
- toFront(): this;
149
- /**
150
- * send to back in current group
151
- */
152
- toBack(): this;
153
- /**
154
- * @deprecated
155
- * compatible with G 3.0
156
- * @deprecated
157
- */
158
- getCount(): number;
159
- /**
160
- * @deprecated
161
- * compatible with G 3.0
162
- * @deprecated
163
- */
164
- getParent(): DisplayObject | null;
165
- /**
166
- * @deprecated
167
- * compatible with G 3.0
168
- * @deprecated
169
- */
170
- getChildren(): DisplayObject[];
171
- /**
172
- * @deprecated
173
- * compatible with G 3.0
174
- * @deprecated
175
- */
176
- getFirst(): DisplayObject | null;
177
- /**
178
- * @deprecated
179
- * compatible with G 3.0
180
- * @deprecated
181
- * get last child group/shape
182
- */
183
- getLast(): DisplayObject | null;
184
- /**
185
- * @deprecated
186
- * compatible with G 3.0
187
- * @deprecated
188
- * get child group/shape by index
189
- */
190
- getChildByIndex(index: number): DisplayObject | null;
191
- /**
192
- * compatible with G 3.0
193
- * @deprecated
194
- */
195
- add<T extends INode>(child: T, index?: number): T;
196
- /**
197
- * @alias style.clipPath
198
- * @deprecated
199
- */
200
- setClip(clipPath: DisplayObject | null): void;
201
- /**
202
- * @alias style.clipPath
203
- * @deprecated
204
- */
205
- getClip(): DisplayObject<any, any>;
206
- /**
207
- * compatible with G 3.0
208
- * @deprecated
209
- */
210
- set<Key extends keyof DisplayObjectConfig<StyleProps>>(name: Key, value: DisplayObjectConfig<StyleProps>[Key]): void;
211
- /**
212
- * compatible with G 3.0
213
- * @deprecated
214
- */
215
- get(name: keyof DisplayObjectConfig<StyleProps>): string | number | boolean | StyleProps;
216
- /**
217
- * compatible with G 3.0
218
- * @alias object.config
219
- * @deprecated
220
- */
221
- getConfig(): DisplayObjectConfig<StyleProps>;
222
- /**
223
- * @alias style
224
- * @example
225
- * circle.style.r = 10;
226
- * const r = circle.style;
227
- * @deprecated
228
- */
229
- attr(): StyleProps;
230
- attr(name: Partial<StyleProps>): DisplayObject<StyleProps>;
231
- attr<Key extends keyof StyleProps>(name: Key): StyleProps[Key];
232
- attr<Key extends keyof StyleProps>(name: Key, value: StyleProps[Key]): DisplayObject<StyleProps>;
233
- /**
234
- * @alias setPosition
235
- * @deprecated
236
- */
237
- moveTo(position: vec3 | vec2 | number, y?: number, z?: number): this;
238
- /**
239
- * @alias setPosition
240
- * @deprecated
241
- */
242
- move(position: vec3 | vec2 | number, y?: number, z?: number): this;
243
- /**
244
- * @alias style.zIndex
245
- * @deprecated
246
- */
247
- setZIndex(zIndex: number): this;
248
- /**
249
- * return 3x3 matrix in world space
250
- * @deprecated
251
- */
252
- getMatrix(): mat3;
253
- /**
254
- * set 3x3 matrix in world space
255
- * @deprecated
256
- */
257
- setMatrix(mat: mat3): void;
258
- }
@@ -1,14 +0,0 @@
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
- }
@@ -1,6 +0,0 @@
1
- import type { BaseStyleProps } from '../types';
2
- import { DisplayObject } from './DisplayObject';
3
- import { DisplayObjectConfig } from '../dom';
4
- export declare class Group extends DisplayObject {
5
- constructor(config?: DisplayObjectConfig<BaseStyleProps>);
6
- }
@@ -1,36 +0,0 @@
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
- }
@@ -1,16 +0,0 @@
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
- }
@@ -1,23 +0,0 @@
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
- }
@@ -1,47 +0,0 @@
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
- }
@@ -1,12 +0,0 @@
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
- }
@@ -1,21 +0,0 @@
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
- }
@@ -1,16 +0,0 @@
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
- }