@antv/g 5.0.14 → 5.0.17

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 (305) hide show
  1. package/es/AbstractRenderer.js +1 -3
  2. package/es/Canvas.d.ts +3 -0
  3. package/es/Canvas.js +10 -12
  4. package/es/DisplayObjectPool.js +1 -3
  5. package/es/camera/Camera.d.ts +3 -2
  6. package/es/camera/Camera.js +17 -11
  7. package/es/camera/Landmark.js +1 -3
  8. package/es/canvas-module.js +11 -17
  9. package/es/components/Cullable.js +1 -3
  10. package/es/components/Geometry.js +1 -3
  11. package/es/components/Renderable.js +1 -3
  12. package/es/components/Sortable.js +1 -3
  13. package/es/components/Transform.d.ts +0 -1
  14. package/es/components/Transform.js +1 -4
  15. package/es/display-objects/Circle.d.ts +4 -2
  16. package/es/display-objects/Circle.js +9 -6
  17. package/es/display-objects/CustomElement.d.ts +3 -2
  18. package/es/display-objects/CustomElement.js +10 -9
  19. package/es/display-objects/DisplayObject.d.ts +9 -3
  20. package/es/display-objects/DisplayObject.js +98 -50
  21. package/es/display-objects/Ellipse.d.ts +6 -3
  22. package/es/display-objects/Ellipse.js +9 -6
  23. package/es/display-objects/Group.d.ts +18 -2
  24. package/es/display-objects/Group.js +15 -12
  25. package/es/display-objects/HTML.d.ts +6 -1
  26. package/es/display-objects/HTML.js +8 -6
  27. package/es/display-objects/Image.d.ts +12 -7
  28. package/es/display-objects/Image.js +11 -6
  29. package/es/display-objects/Line.d.ts +1 -1
  30. package/es/display-objects/Line.js +13 -7
  31. package/es/display-objects/Path.d.ts +3 -2
  32. package/es/display-objects/Path.js +11 -8
  33. package/es/display-objects/Polygon.d.ts +1 -1
  34. package/es/display-objects/Polygon.js +10 -6
  35. package/es/display-objects/Polyline.d.ts +1 -1
  36. package/es/display-objects/Polyline.js +11 -8
  37. package/es/display-objects/Rect.d.ts +8 -5
  38. package/es/display-objects/Rect.js +10 -7
  39. package/es/display-objects/TSpan.d.ts +1 -0
  40. package/es/display-objects/TSpan.js +0 -0
  41. package/es/display-objects/Text.d.ts +32 -4
  42. package/es/display-objects/Text.js +71 -14
  43. package/es/dom/Animation.js +2 -4
  44. package/es/dom/AnimationEffectTiming.js +1 -3
  45. package/es/dom/AnimationEvent.js +1 -3
  46. package/es/dom/AnimationTimeline.js +2 -5
  47. package/es/dom/CustomElementRegistry.js +13 -15
  48. package/es/dom/CustomEvent.js +1 -3
  49. package/es/dom/Document.d.ts +2 -1
  50. package/es/dom/Document.js +23 -5
  51. package/es/dom/Element.d.ts +36 -9
  52. package/es/dom/Element.js +103 -15
  53. package/es/dom/EventTarget.d.ts +2 -2
  54. package/es/dom/EventTarget.js +3 -4
  55. package/es/dom/FederatedEvent.d.ts +5 -2
  56. package/es/dom/FederatedEvent.js +1 -3
  57. package/es/dom/FederatedMouseEvent.js +1 -3
  58. package/es/dom/FederatedPointerEvent.js +1 -3
  59. package/es/dom/FederatedWheelEvent.js +1 -3
  60. package/es/dom/KeyframeEffect.js +1 -3
  61. package/es/dom/MutationEvent.d.ts +15 -0
  62. package/es/dom/MutationEvent.js +27 -0
  63. package/es/dom/MutationObserver.d.ts +36 -0
  64. package/es/dom/MutationObserver.js +406 -0
  65. package/es/dom/MutationRecord.d.ts +14 -0
  66. package/es/dom/MutationRecord.js +29 -0
  67. package/es/dom/Node.d.ts +35 -3
  68. package/es/dom/Node.js +185 -20
  69. package/es/dom/index.d.ts +3 -0
  70. package/es/dom/index.js +3 -0
  71. package/es/dom/interfaces.d.ts +36 -8
  72. package/es/dom/interfaces.js +23 -5
  73. package/es/global-module.d.ts +4 -1
  74. package/es/global-module.js +36 -79
  75. package/es/index.d.ts +1 -0
  76. package/es/index.js +1 -0
  77. package/es/plugins/CullingPlugin.d.ts +0 -2
  78. package/es/plugins/CullingPlugin.js +4 -27
  79. package/es/plugins/DirtyCheckPlugin.js +3 -5
  80. package/es/plugins/EventPlugin.d.ts +2 -1
  81. package/es/plugins/EventPlugin.js +16 -8
  82. package/es/plugins/FrustumCullingStrategy.d.ts +1 -0
  83. package/es/plugins/FrustumCullingStrategy.js +40 -35
  84. package/es/plugins/PrepareRendererPlugin.js +22 -8
  85. package/es/property-handlers/aabb.js +22 -24
  86. package/es/property-handlers/anchor.js +2 -1
  87. package/es/property-handlers/color.js +3 -0
  88. package/es/property-handlers/dimension.d.ts +15 -2
  89. package/es/property-handlers/dimension.js +77 -8
  90. package/es/property-handlers/index.d.ts +3 -0
  91. package/es/property-handlers/index.js +4 -1
  92. package/es/property-handlers/inherit.d.ts +6 -0
  93. package/es/property-handlers/inherit.js +25 -0
  94. package/es/property-handlers/interfaces.d.ts +2 -2
  95. package/es/property-handlers/lineDash.d.ts +6 -1
  96. package/es/property-handlers/lineDash.js +23 -4
  97. package/es/property-handlers/offsetDistance.js +2 -2
  98. package/es/property-handlers/path.d.ts +1 -1
  99. package/es/property-handlers/text.d.ts +2 -0
  100. package/es/property-handlers/text.js +3 -0
  101. package/es/property-handlers/textTransform.d.ts +6 -0
  102. package/es/property-handlers/textTransform.js +19 -0
  103. package/es/services/EventService.js +2 -6
  104. package/es/services/RenderingContext.d.ts +5 -8
  105. package/es/services/RenderingContext.js +6 -7
  106. package/es/services/RenderingService.js +3 -11
  107. package/es/services/SceneGraphSelector.d.ts +3 -2
  108. package/es/services/SceneGraphSelector.js +9 -7
  109. package/es/services/SceneGraphService.d.ts +7 -14
  110. package/es/services/SceneGraphService.js +15 -85
  111. package/es/services/aabb/CircleUpdater.d.ts +2 -2
  112. package/es/services/aabb/CircleUpdater.js +22 -14
  113. package/es/services/aabb/EllipseUpdater.d.ts +2 -2
  114. package/es/services/aabb/EllipseUpdater.js +29 -16
  115. package/es/services/aabb/LineUpdater.js +3 -5
  116. package/es/services/aabb/PathUpdater.js +3 -5
  117. package/es/services/aabb/PolylineUpdater.js +4 -6
  118. package/es/services/aabb/RectUpdater.d.ts +2 -2
  119. package/es/services/aabb/RectUpdater.js +32 -21
  120. package/es/services/aabb/TextUpdater.js +20 -13
  121. package/es/services/text/OffscreenCanvasCreator.js +1 -3
  122. package/es/services/text/index.js +18 -22
  123. package/es/shapes/AABB.d.ts +1 -0
  124. package/es/shapes/AABB.js +9 -3
  125. package/es/shapes/BoundingSphere.js +1 -3
  126. package/es/shapes/Frustum.js +1 -3
  127. package/es/shapes/Plane.js +1 -3
  128. package/es/shapes/Point.js +1 -3
  129. package/es/shapes/Polygon.js +1 -3
  130. package/es/shapes/Ray.js +1 -3
  131. package/es/shapes/Rect.js +1 -3
  132. package/es/shapes/Rectangle.js +1 -3
  133. package/es/types.d.ts +48 -26
  134. package/es/types.js +50 -31
  135. package/es/utils/animation.js +1 -1
  136. package/es/utils/event.js +5 -3
  137. package/es/utils/index.d.ts +1 -0
  138. package/es/utils/index.js +2 -1
  139. package/es/utils/interpolation.d.ts +1 -0
  140. package/es/utils/interpolation.js +41 -8
  141. package/es/utils/path.d.ts +1 -1
  142. package/es/utils/path.js +13 -13
  143. package/es/utils/raf.d.ts +1 -1
  144. package/es/utils/raf.js +0 -2
  145. package/es/utils/string.d.ts +1 -0
  146. package/es/utils/string.js +9 -0
  147. package/es/utils/text.js +1 -1
  148. package/lib/AbstractRenderer.js +1 -3
  149. package/lib/Canvas.d.ts +3 -0
  150. package/lib/Canvas.js +9 -11
  151. package/lib/DisplayObjectPool.js +1 -3
  152. package/lib/camera/Camera.d.ts +3 -2
  153. package/lib/camera/Camera.js +21 -13
  154. package/lib/camera/Landmark.js +1 -3
  155. package/lib/canvas-module.js +10 -15
  156. package/lib/components/Cullable.js +2 -4
  157. package/lib/components/Geometry.js +1 -3
  158. package/lib/components/Renderable.js +1 -3
  159. package/lib/components/Sortable.js +1 -3
  160. package/lib/components/Transform.d.ts +0 -1
  161. package/lib/components/Transform.js +1 -4
  162. package/lib/display-objects/Circle.d.ts +4 -2
  163. package/lib/display-objects/Circle.js +8 -5
  164. package/lib/display-objects/CustomElement.d.ts +3 -2
  165. package/lib/display-objects/CustomElement.js +10 -9
  166. package/lib/display-objects/DisplayObject.d.ts +9 -3
  167. package/lib/display-objects/DisplayObject.js +98 -47
  168. package/lib/display-objects/Ellipse.d.ts +6 -3
  169. package/lib/display-objects/Ellipse.js +8 -5
  170. package/lib/display-objects/Group.d.ts +18 -2
  171. package/lib/display-objects/Group.js +14 -12
  172. package/lib/display-objects/HTML.d.ts +6 -1
  173. package/lib/display-objects/HTML.js +7 -5
  174. package/lib/display-objects/Image.d.ts +12 -7
  175. package/lib/display-objects/Image.js +10 -5
  176. package/lib/display-objects/Line.d.ts +1 -1
  177. package/lib/display-objects/Line.js +12 -6
  178. package/lib/display-objects/Path.d.ts +3 -2
  179. package/lib/display-objects/Path.js +10 -7
  180. package/lib/display-objects/Polygon.d.ts +1 -1
  181. package/lib/display-objects/Polygon.js +9 -5
  182. package/lib/display-objects/Polyline.d.ts +1 -1
  183. package/lib/display-objects/Polyline.js +10 -7
  184. package/lib/display-objects/Rect.d.ts +8 -5
  185. package/lib/display-objects/Rect.js +9 -6
  186. package/lib/display-objects/TSpan.d.ts +1 -0
  187. package/lib/display-objects/TSpan.js +1 -0
  188. package/lib/display-objects/Text.d.ts +32 -4
  189. package/lib/display-objects/Text.js +71 -13
  190. package/lib/dom/Animation.js +2 -4
  191. package/lib/dom/AnimationEffectTiming.js +1 -3
  192. package/lib/dom/AnimationEvent.js +1 -3
  193. package/lib/dom/AnimationTimeline.js +3 -6
  194. package/lib/dom/CustomElementRegistry.js +12 -14
  195. package/lib/dom/CustomEvent.js +1 -3
  196. package/lib/dom/Document.d.ts +2 -1
  197. package/lib/dom/Document.js +25 -6
  198. package/lib/dom/Element.d.ts +36 -9
  199. package/lib/dom/Element.js +105 -15
  200. package/lib/dom/EventTarget.d.ts +2 -2
  201. package/lib/dom/EventTarget.js +3 -4
  202. package/lib/dom/FederatedEvent.d.ts +5 -2
  203. package/lib/dom/FederatedEvent.js +1 -3
  204. package/lib/dom/FederatedMouseEvent.js +1 -3
  205. package/lib/dom/FederatedPointerEvent.js +1 -3
  206. package/lib/dom/FederatedWheelEvent.js +1 -3
  207. package/lib/dom/KeyframeEffect.js +2 -4
  208. package/lib/dom/MutationEvent.d.ts +15 -0
  209. package/lib/dom/MutationEvent.js +35 -0
  210. package/lib/dom/MutationObserver.d.ts +36 -0
  211. package/lib/dom/MutationObserver.js +417 -0
  212. package/lib/dom/MutationRecord.d.ts +14 -0
  213. package/lib/dom/MutationRecord.js +36 -0
  214. package/lib/dom/Node.d.ts +35 -3
  215. package/lib/dom/Node.js +186 -19
  216. package/lib/dom/index.d.ts +3 -0
  217. package/lib/dom/index.js +39 -0
  218. package/lib/dom/interfaces.d.ts +36 -8
  219. package/lib/dom/interfaces.js +23 -5
  220. package/lib/global-module.d.ts +4 -1
  221. package/lib/global-module.js +42 -76
  222. package/lib/index.d.ts +1 -0
  223. package/lib/index.js +2 -0
  224. package/lib/plugins/CullingPlugin.d.ts +0 -2
  225. package/lib/plugins/CullingPlugin.js +4 -27
  226. package/lib/plugins/DirtyCheckPlugin.js +2 -4
  227. package/lib/plugins/EventPlugin.d.ts +2 -1
  228. package/lib/plugins/EventPlugin.js +14 -8
  229. package/lib/plugins/FrustumCullingStrategy.d.ts +1 -0
  230. package/lib/plugins/FrustumCullingStrategy.js +41 -35
  231. package/lib/plugins/PrepareRendererPlugin.js +25 -7
  232. package/lib/property-handlers/aabb.js +21 -23
  233. package/lib/property-handlers/anchor.js +3 -1
  234. package/lib/property-handlers/color.js +5 -2
  235. package/lib/property-handlers/dimension.d.ts +15 -2
  236. package/lib/property-handlers/dimension.js +84 -12
  237. package/lib/property-handlers/index.d.ts +3 -0
  238. package/lib/property-handlers/index.js +39 -0
  239. package/lib/property-handlers/inherit.d.ts +6 -0
  240. package/lib/property-handlers/inherit.js +34 -0
  241. package/lib/property-handlers/interfaces.d.ts +2 -2
  242. package/lib/property-handlers/interfaces.js +1 -1
  243. package/lib/property-handlers/lineDash.d.ts +6 -1
  244. package/lib/property-handlers/lineDash.js +25 -4
  245. package/lib/property-handlers/numeric.js +3 -3
  246. package/lib/property-handlers/offsetDistance.js +1 -1
  247. package/lib/property-handlers/path.d.ts +1 -1
  248. package/lib/property-handlers/path.js +1 -1
  249. package/lib/property-handlers/text.d.ts +2 -0
  250. package/lib/property-handlers/text.js +10 -0
  251. package/lib/property-handlers/textTransform.d.ts +6 -0
  252. package/lib/property-handlers/textTransform.js +27 -0
  253. package/lib/property-handlers/transform.js +1 -1
  254. package/lib/services/EventService.js +2 -6
  255. package/lib/services/RenderingContext.d.ts +5 -8
  256. package/lib/services/RenderingContext.js +8 -9
  257. package/lib/services/RenderingService.js +2 -10
  258. package/lib/services/SceneGraphSelector.d.ts +3 -2
  259. package/lib/services/SceneGraphSelector.js +12 -7
  260. package/lib/services/SceneGraphService.d.ts +7 -14
  261. package/lib/services/SceneGraphService.js +18 -87
  262. package/lib/services/aabb/CircleUpdater.d.ts +2 -2
  263. package/lib/services/aabb/CircleUpdater.js +21 -13
  264. package/lib/services/aabb/EllipseUpdater.d.ts +2 -2
  265. package/lib/services/aabb/EllipseUpdater.js +28 -15
  266. package/lib/services/aabb/LineUpdater.js +2 -4
  267. package/lib/services/aabb/PathUpdater.js +2 -4
  268. package/lib/services/aabb/PolylineUpdater.js +3 -5
  269. package/lib/services/aabb/RectUpdater.d.ts +2 -2
  270. package/lib/services/aabb/RectUpdater.js +31 -20
  271. package/lib/services/aabb/TextUpdater.js +19 -12
  272. package/lib/services/aabb/index.js +10 -10
  273. package/lib/services/aabb/interfaces.js +1 -1
  274. package/lib/services/text/OffscreenCanvasCreator.js +1 -3
  275. package/lib/services/text/index.js +18 -22
  276. package/lib/shapes/AABB.d.ts +1 -0
  277. package/lib/shapes/AABB.js +9 -3
  278. package/lib/shapes/BoundingSphere.js +1 -3
  279. package/lib/shapes/Frustum.js +2 -4
  280. package/lib/shapes/Plane.js +1 -3
  281. package/lib/shapes/Point.js +1 -3
  282. package/lib/shapes/Polygon.js +1 -3
  283. package/lib/shapes/Ray.js +1 -3
  284. package/lib/shapes/Rect.js +1 -3
  285. package/lib/shapes/Rectangle.js +1 -3
  286. package/lib/types.d.ts +48 -26
  287. package/lib/types.js +56 -35
  288. package/lib/utils/animation.js +3 -4
  289. package/lib/utils/bezier-easing.js +1 -1
  290. package/lib/utils/custom-easing.js +1 -1
  291. package/lib/utils/event.js +7 -6
  292. package/lib/utils/index.d.ts +1 -0
  293. package/lib/utils/index.js +13 -0
  294. package/lib/utils/interpolation.d.ts +1 -0
  295. package/lib/utils/interpolation.js +43 -7
  296. package/lib/utils/math.js +5 -5
  297. package/lib/utils/path.d.ts +1 -1
  298. package/lib/utils/path.js +15 -15
  299. package/lib/utils/raf.d.ts +1 -1
  300. package/lib/utils/raf.js +1 -4
  301. package/lib/utils/string.d.ts +1 -0
  302. package/lib/utils/string.js +16 -0
  303. package/lib/utils/text.js +1 -1
  304. package/package.json +6 -4
  305. package/dist/index.umd.min.js +0 -15
@@ -1,8 +1,6 @@
1
1
  import { __assign } from "tslib";
2
2
 
3
- var AbstractRenderer =
4
- /** @class */
5
- function () {
3
+ var AbstractRenderer = function () {
6
4
  function AbstractRenderer(config) {
7
5
  this.plugins = [];
8
6
  this.config = __assign({
package/es/Canvas.d.ts CHANGED
@@ -73,6 +73,9 @@ export declare class Canvas extends EventTarget implements ICanvas {
73
73
  total: number;
74
74
  rendered: number;
75
75
  };
76
+ /**
77
+ * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Window/getComputedStyle
78
+ */
76
79
  getComputedStyle(node: DisplayObject): any;
77
80
  get ready(): Promise<any>;
78
81
  destroy(destroyScenegraph?: boolean): void;
package/es/Canvas.js CHANGED
@@ -4,9 +4,9 @@ import { cleanExistedCanvas, isBrowser } from './utils/canvas';
4
4
  import { DisplayObject } from './display-objects/DisplayObject';
5
5
  import { ContextService } from './services';
6
6
  import { RenderingService } from './services/RenderingService';
7
- import { RenderingContext, RENDER_REASON } from './services/RenderingContext';
7
+ import { RenderingContext, RenderReason } from './services/RenderingContext';
8
8
  import { EventService } from './services/EventService';
9
- import { Camera, CAMERA_EVENT, CAMERA_PROJECTION_MODE, DefaultCamera } from './camera';
9
+ import { Camera, CameraEvent, CAMERA_PROJECTION_MODE, DefaultCamera } from './camera';
10
10
  import { containerModule as commonContainerModule } from './canvas-module';
11
11
  import { cancelAnimationFrame, requestAnimationFrame, patch } from './utils/raf';
12
12
  import { Document, EventTarget, ElementEvent } from './dom';
@@ -29,9 +29,7 @@ export var CanvasEvent;
29
29
  */
30
30
 
31
31
 
32
- var Canvas =
33
- /** @class */
34
- function (_super) {
32
+ var Canvas = function (_super) {
35
33
  __extends(Canvas, _super);
36
34
 
37
35
  function Canvas(config) {
@@ -109,11 +107,6 @@ function (_super) {
109
107
  * the root node in scene graph
110
108
  */
111
109
  root: this.document.documentElement,
112
-
113
- /**
114
- * removed render bounds
115
- */
116
- removedRenderBoundsList: [],
117
110
  renderReasons: new Set(),
118
111
  force: false,
119
112
  dirty: false
@@ -132,8 +125,8 @@ function (_super) {
132
125
  var camera = new Camera().setPosition(width / 2, height / 2, 500).setFocalPoint(width / 2, height / 2, 0).setOrthographic(width / -2, width / 2, height / 2, height / -2, 0.1, 1000); // redraw when camera changed
133
126
 
134
127
  var context = this.container.get(RenderingContext);
135
- camera.on(CAMERA_EVENT.Updated, function () {
136
- context.renderReasons.add(RENDER_REASON.CameraChanged);
128
+ camera.on(CameraEvent.UPDATED, function () {
129
+ context.renderReasons.add(RenderReason.CAMERA_CHANGED);
137
130
  }); // bind camera
138
131
 
139
132
  this.container.register({
@@ -186,6 +179,10 @@ function (_super) {
186
179
  Canvas.prototype.getStats = function () {
187
180
  return this.getRenderingService().getStats();
188
181
  };
182
+ /**
183
+ * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Window/getComputedStyle
184
+ */
185
+
189
186
 
190
187
  Canvas.prototype.getComputedStyle = function (node) {
191
188
  return node.parsedStyle;
@@ -367,6 +364,7 @@ function (_super) {
367
364
  };
368
365
 
369
366
  Canvas.prototype.loadCommonContainerModule = function () {
367
+ this.container.unload(commonContainerModule);
370
368
  this.container.load(commonContainerModule, true);
371
369
  };
372
370
 
@@ -1,9 +1,7 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { singleton } from 'mana-syringe';
3
3
 
4
- var DisplayObjectPool =
5
- /** @class */
6
- function () {
4
+ var DisplayObjectPool = function () {
7
5
  function DisplayObjectPool() {
8
6
  this.pool = {};
9
7
  }
@@ -18,8 +18,8 @@ export declare enum CAMERA_PROJECTION_MODE {
18
18
  ORTHOGRAPHIC = "ORTHOGRAPHIC",
19
19
  PERSPECTIVE = "PERSPECTIVE"
20
20
  }
21
- export declare const CAMERA_EVENT: {
22
- Updated: string;
21
+ export declare const CameraEvent: {
22
+ UPDATED: string;
23
23
  };
24
24
  /**
25
25
  * 参考「WebGL Insights - 23.Designing Cameras for WebGL Applications」,基于 Responsible Camera 思路设计
@@ -277,4 +277,5 @@ export declare class Camera extends EventEmitter {
277
277
  */
278
278
  private _getDistance;
279
279
  private _getOrthoMatrix;
280
+ private triggerUpdate;
280
281
  }
@@ -30,8 +30,8 @@ export var CAMERA_PROJECTION_MODE;
30
30
  CAMERA_PROJECTION_MODE["PERSPECTIVE"] = "PERSPECTIVE";
31
31
  })(CAMERA_PROJECTION_MODE || (CAMERA_PROJECTION_MODE = {}));
32
32
 
33
- export var CAMERA_EVENT = {
34
- Updated: 'updated'
33
+ export var CameraEvent = {
34
+ UPDATED: 'updated'
35
35
  };
36
36
  var DEG_2_RAD = Math.PI / 180;
37
37
  var RAD_2_DEG = 180 / Math.PI;
@@ -44,9 +44,7 @@ var RAD_2_DEG = 180 / Math.PI;
44
44
  * 4. 移动到 Landmark,具有平滑的动画效果,其间禁止其他用户交互
45
45
  */
46
46
 
47
- var Camera =
48
- /** @class */
49
- function (_super) {
47
+ var Camera = function (_super) {
50
48
  __extends(Camera, _super);
51
49
 
52
50
  function Camera() {
@@ -415,7 +413,7 @@ function (_super) {
415
413
 
416
414
  mat4.scale(this.projectionMatrix, this.projectionMatrix, vec3.fromValues(1, -1, 1));
417
415
  mat4.invert(this.projectionMatrixInverse, this.projectionMatrix);
418
- this.emit(CAMERA_EVENT.Updated);
416
+ this.triggerUpdate();
419
417
  return this;
420
418
  };
421
419
 
@@ -452,7 +450,7 @@ function (_super) {
452
450
 
453
451
  this._getOrthoMatrix();
454
452
 
455
- this.emit(CAMERA_EVENT.Updated);
453
+ this.triggerUpdate();
456
454
  return this;
457
455
  };
458
456
  /**
@@ -696,7 +694,7 @@ function (_super) {
696
694
 
697
695
  this._setPosition(pos);
698
696
 
699
- this.emit(CAMERA_EVENT.Updated);
697
+ this.triggerUpdate();
700
698
  return this;
701
699
  };
702
700
  /**
@@ -725,7 +723,7 @@ function (_super) {
725
723
  vec3.add(this.focalPoint, pos, this.distanceVector);
726
724
  }
727
725
 
728
- this.emit(CAMERA_EVENT.Updated);
726
+ this.triggerUpdate();
729
727
  return this;
730
728
  };
731
729
 
@@ -800,7 +798,7 @@ function (_super) {
800
798
 
801
799
  _this.computeMatrix();
802
800
 
803
- _this.emit(CAMERA_EVENT.Updated);
801
+ _this.triggerUpdate();
804
802
 
805
803
  var dist = vec3.dist(interFocalPoint, destFocalPoint_1) + vec3.dist(interPosition, destPosition_1);
806
804
 
@@ -842,7 +840,7 @@ function (_super) {
842
840
 
843
841
  this._getOrthoMatrix();
844
842
 
845
- this.emit(CAMERA_EVENT.Updated);
843
+ this.triggerUpdate();
846
844
  };
847
845
  /**
848
846
  * 计算相机矩阵
@@ -971,6 +969,14 @@ function (_super) {
971
969
  mat4.fromRotationTranslationScaleOrigin(this.orthoMatrix, rotZ, vec3.fromValues((this.rright - this.left) / 2 - position[0], (this.top - this.bottom) / 2 - position[1], 0), vec3.fromValues(this.zoom, this.zoom, 1), position);
972
970
  };
973
971
 
972
+ Camera.prototype.triggerUpdate = function () {
973
+ // update frustum
974
+ var viewMatrix = this.getViewTransform();
975
+ var vpMatrix = mat4.multiply(mat4.create(), this.getPerspective(), viewMatrix);
976
+ this.getFrustum().extractFromVPMatrix(vpMatrix);
977
+ this.emit(CameraEvent.UPDATED);
978
+ };
979
+
974
980
  Camera.ProjectionMode = {
975
981
  ORTHOGRAPHIC: 'ORTHOGRAPHIC',
976
982
  PERSPECTIVE: 'PERSPECTIVE'
@@ -3,9 +3,7 @@ import { mat4, vec3 } from 'gl-matrix';
3
3
  * 保存相机状态,便于后续在多个 Landmark 间移动
4
4
  */
5
5
 
6
- var Landmark =
7
- /** @class */
8
- function () {
6
+ var Landmark = function () {
9
7
  // private zoom = 1;
10
8
  function Landmark(name, c) {
11
9
  this.azimuth = 0;
@@ -1,32 +1,26 @@
1
1
  import { Module, Contribution } from 'mana-syringe';
2
2
  import { DirtyCheckPlugin } from './plugins/DirtyCheckPlugin';
3
3
  import { CullingPlugin, CullingStrategyContribution } from './plugins/CullingPlugin';
4
- import { PrepareRendererPlugin } from './plugins/PrepareRendererPlugin';
4
+ import { PrepareRendererPlugin } from './plugins/PrepareRendererPlugin'; // import { CSSCalculatorPlugin } from './plugins/CSSStyleCalculator';
5
+
5
6
  import { FrustumCullingStrategy } from './plugins/FrustumCullingStrategy';
6
7
  import { RenderingPluginContribution, RenderingService } from './services';
7
8
  import { EventPlugin } from './plugins/EventPlugin';
8
9
  import { EventService } from './services';
9
- export var containerModule = Module(function (register, context) {
10
- if (context.container.isBound(RenderingService)) {
11
- // remove rendering plugins
12
- context.container.remove(RenderingPluginContribution);
13
- context.container.remove(RenderingService);
14
- context.container.remove(FrustumCullingStrategy);
15
- } else {
16
- Contribution.register(register, RenderingPluginContribution, {
17
- cache: false
18
- }); // culling plugin
19
-
20
- Contribution.register(register, CullingStrategyContribution, {
21
- cache: false
22
- });
23
- } // register built-in rendering plugins
10
+ export var containerModule = Module(function (register) {
11
+ Contribution.register(register, RenderingPluginContribution, {
12
+ cache: false
13
+ }); // culling plugin
24
14
 
15
+ Contribution.register(register, CullingStrategyContribution, {
16
+ cache: false
17
+ }); // register built-in rendering plugins
25
18
 
26
19
  register(RenderingService);
27
20
  register(EventService);
28
21
  register(EventPlugin);
29
- register(PrepareRendererPlugin);
22
+ register(PrepareRendererPlugin); // register(CSSCalculatorPlugin);
23
+
30
24
  register(DirtyCheckPlugin);
31
25
  register(CullingPlugin);
32
26
  register(FrustumCullingStrategy);
@@ -7,9 +7,7 @@ export var Strategy;
7
7
  Strategy[Strategy["Standard"] = 0] = "Standard";
8
8
  })(Strategy || (Strategy = {}));
9
9
 
10
- var Cullable =
11
- /** @class */
12
- function () {
10
+ var Cullable = function () {
13
11
  function Cullable() {
14
12
  this.strategy = Strategy.Standard;
15
13
  this.visibilityPlaneMask = -1;
@@ -1,6 +1,4 @@
1
- var Geometry =
2
- /** @class */
3
- function () {
1
+ var Geometry = function () {
4
2
  function Geometry() {}
5
3
 
6
4
  Geometry.tag = 'c-geometry';
@@ -1,6 +1,4 @@
1
- var Renderable =
2
- /** @class */
3
- function () {
1
+ var Renderable = function () {
4
2
  function Renderable() {
5
3
  this.boundsDirty = true;
6
4
  this.renderBoundsDirty = true;
@@ -1,6 +1,4 @@
1
- var Sortable =
2
- /** @class */
3
- function () {
1
+ var Sortable = function () {
4
2
  function Sortable() {
5
3
  /**
6
4
  * need to re-sort
@@ -7,7 +7,6 @@ export declare class Transform {
7
7
  dirtyFlag: boolean;
8
8
  localDirtyFlag: boolean;
9
9
  frozen: boolean;
10
- graphDepth: number;
11
10
  /**
12
11
  * local space RTS
13
12
  */
@@ -3,14 +3,11 @@ import { mat4, quat, vec3 } from 'gl-matrix';
3
3
  * do RTS transformation for 2D/3D
4
4
  */
5
5
 
6
- var Transform =
7
- /** @class */
8
- function () {
6
+ var Transform = function () {
9
7
  function Transform() {
10
8
  this.dirtyFlag = false;
11
9
  this.localDirtyFlag = false;
12
10
  this.frozen = false;
13
- this.graphDepth = 0;
14
11
  /**
15
12
  * local space RTS
16
13
  */
@@ -1,12 +1,14 @@
1
1
  import type { DisplayObjectConfig } from '../dom/interfaces';
2
2
  import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
3
3
  import { DisplayObject } from './DisplayObject';
4
+ import type { ParsedElement } from '../property-handlers';
4
5
  export interface CircleStyleProps extends BaseStyleProps {
5
6
  r: number;
6
7
  }
7
8
  export interface ParsedCircleStyleProps extends ParsedBaseStyleProps {
8
- r: number;
9
+ r: ParsedElement;
10
+ rInPixels: number;
9
11
  }
10
12
  export declare class Circle extends DisplayObject<CircleStyleProps, ParsedCircleStyleProps> {
11
- constructor({ style, ...rest }: DisplayObjectConfig<CircleStyleProps>);
13
+ constructor({ style, ...rest }?: DisplayObjectConfig<CircleStyleProps>);
12
14
  }
@@ -1,21 +1,24 @@
1
1
  import { __assign, __extends, __rest } from "tslib";
2
- import { SHAPE } from '../types';
2
+ import { Shape } from '../types';
3
3
  import { DisplayObject } from './DisplayObject';
4
4
 
5
- var Circle =
6
- /** @class */
7
- function (_super) {
5
+ var Circle = function (_super) {
8
6
  __extends(Circle, _super);
9
7
 
10
8
  function Circle(_a) {
9
+ if (_a === void 0) {
10
+ _a = {};
11
+ }
12
+
11
13
  var style = _a.style,
12
14
  rest = __rest(_a, ["style"]);
13
15
 
14
16
  return _super.call(this, __assign({
15
- type: SHAPE.Circle,
17
+ type: Shape.CIRCLE,
16
18
  style: __assign({
17
19
  r: 0,
18
- anchor: [0.5, 0.5]
20
+ anchor: [0.5, 0.5],
21
+ lineWidth: 0
19
22
  }, style)
20
23
  }, rest)) || this;
21
24
  }
@@ -1,11 +1,12 @@
1
1
  import { DisplayObject } from './DisplayObject';
2
2
  import type { DisplayObjectConfig } from '../dom/interfaces';
3
+ import type { BaseStyleProps } from '../types';
3
4
  /**
4
5
  * shadow root
5
6
  * @see https://yuque.antfin-inc.com/antv/czqvg5/pgqipg
6
7
  */
7
- export declare abstract class CustomElement<CustomElementStyleProps> extends DisplayObject<CustomElementStyleProps> {
8
- constructor(config: DisplayObjectConfig<CustomElementStyleProps>);
8
+ export declare abstract class CustomElement<CustomElementStyleProps extends BaseStyleProps> extends DisplayObject<CustomElementStyleProps> {
9
+ constructor(config?: DisplayObjectConfig<CustomElementStyleProps>);
9
10
  /**
10
11
  * fired after element insert into DOM tree
11
12
  */
@@ -6,13 +6,15 @@ import { ElementEvent } from '../dom/interfaces';
6
6
  * @see https://yuque.antfin-inc.com/antv/czqvg5/pgqipg
7
7
  */
8
8
 
9
- var CustomElement =
10
- /** @class */
11
- function (_super) {
9
+ var CustomElement = function (_super) {
12
10
  __extends(CustomElement, _super); // private shadowNodes: DisplayObject[] = [];
13
11
 
14
12
 
15
13
  function CustomElement(config) {
14
+ if (config === void 0) {
15
+ config = {};
16
+ }
17
+
16
18
  var _this = _super.call(this, config) || this;
17
19
 
18
20
  _this.handleMounted = function (e) {
@@ -56,20 +58,19 @@ function (_super) {
56
58
  return;
57
59
  }
58
60
 
59
- var _a = e.detail,
60
- attributeName = _a.attributeName,
61
- oldValue = _a.oldValue,
62
- newValue = _a.newValue;
61
+ var attrName = e.attrName,
62
+ prevValue = e.prevValue,
63
+ newValue = e.newValue;
63
64
 
64
65
  if (_this.attributeChangedCallback) {
65
- _this.attributeChangedCallback(attributeName, oldValue, newValue);
66
+ _this.attributeChangedCallback(attrName, prevValue, newValue);
66
67
  }
67
68
  }; // this.addEventListener(ElementEvent.CHILD_INSERTED, this.handleChildInserted);
68
69
  // this.addEventListener(ElementEvent.CHILD_REMOVED, this.handleChildRemoved);
69
70
 
70
71
 
71
72
  if (_this.attributeChangedCallback) {
72
- _this.addEventListener(ElementEvent.ATTRIBUTE_CHANGED, _this.handleAttributeChanged);
73
+ _this.addEventListener(ElementEvent.ATTR_MODIFIED, _this.handleAttributeChanged);
73
74
  }
74
75
 
75
76
  if (_this.connectedCallback) {
@@ -35,18 +35,24 @@ export declare class DisplayObject<StyleProps extends BaseStyleProps = any, Pars
35
35
  destroy(): void;
36
36
  cloneNode(deep?: boolean): this;
37
37
  private initAttributes;
38
- setAttribute<Key extends keyof StyleProps>(attributeName: Key, value: StyleProps[Key], force?: boolean): void;
38
+ setAttribute<Key extends keyof StyleProps>(name: Key, value: StyleProps[Key], force?: boolean): void;
39
39
  /**
40
40
  * parse property, eg.
41
41
  * * fill: 'red' => [1, 0, 0, 1]
42
42
  * * translateX: '10px' => { unit: 'px', value: 10 }
43
+ * * fontSize: '2em' => { unit: 'px', value: 32 }
43
44
  */
44
- private parseStyleProperty;
45
- private updateStyleProperty;
45
+ parseStyleProperty<Key extends keyof ParsedStyleProps>(name: Key, value: ParsedStyleProps[Key]): void;
46
+ updateStyleProperty<Key extends keyof ParsedStyleProps>(name: Key, oldParsedValue: ParsedStyleProps[Key], newParsedValue: ParsedStyleProps[Key]): void;
46
47
  /**
47
48
  * called when attributes get changed or initialized
48
49
  */
49
50
  private changeAttribute;
51
+ /**
52
+ * returns different values than getBoundingClientRect(), as the latter returns value relative to the viewport
53
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/SVGGraphicsElement/getBBox
54
+ */
55
+ getBBox(): DOMRect;
50
56
  setOrigin(position: vec3 | vec2 | number, y?: number, z?: number): this;
51
57
  getOrigin(): vec3;
52
58
  /**