@antv/g 1.0.0-alpha.20 → 1.0.0-alpha.24

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 (293) hide show
  1. package/es/Canvas.d.ts +40 -18
  2. package/es/Canvas.js +121 -65
  3. package/es/DisplayObjectPool.d.ts +2 -1
  4. package/es/DisplayObjectPool.js +4 -0
  5. package/{lib → es/camera}/Camera.d.ts +6 -3
  6. package/es/{Camera.js → camera/Camera.js} +22 -16
  7. package/es/{Landmark.d.ts → camera/Landmark.d.ts} +2 -2
  8. package/es/{Landmark.js → camera/Landmark.js} +1 -1
  9. package/es/camera/index.d.ts +2 -0
  10. package/es/camera/index.js +2 -0
  11. package/es/components/Cullable.js +1 -1
  12. package/es/components/Geometry.d.ts +8 -1
  13. package/es/components/Renderable.d.ts +9 -8
  14. package/es/components/Renderable.js +2 -6
  15. package/es/components/Sortable.d.ts +6 -2
  16. package/es/display-objects/Circle.d.ts +2 -3
  17. package/es/display-objects/Circle.js +2 -5
  18. package/es/{CustomElement.d.ts → display-objects/CustomElement.d.ts} +1 -1
  19. package/es/{CustomElement.js → display-objects/CustomElement.js} +22 -12
  20. package/{lib → es/display-objects}/DisplayObject.d.ts +136 -141
  21. package/es/{DisplayObject.js → display-objects/DisplayObject.js} +408 -292
  22. package/es/display-objects/Ellipse.d.ts +2 -3
  23. package/es/display-objects/Ellipse.js +2 -5
  24. package/es/display-objects/Group.d.ts +2 -1
  25. package/es/display-objects/Group.js +13 -5
  26. package/es/display-objects/HTML.d.ts +2 -2
  27. package/es/display-objects/HTML.js +4 -7
  28. package/es/display-objects/Image.d.ts +2 -2
  29. package/es/display-objects/Image.js +2 -6
  30. package/es/display-objects/Line.d.ts +2 -2
  31. package/es/display-objects/Line.js +8 -8
  32. package/es/display-objects/Path.d.ts +3 -2
  33. package/es/display-objects/Path.js +8 -8
  34. package/es/display-objects/Polygon.d.ts +2 -2
  35. package/es/display-objects/Polygon.js +2 -6
  36. package/es/display-objects/Polyline.d.ts +2 -2
  37. package/es/display-objects/Polyline.js +8 -8
  38. package/es/display-objects/Rect.d.ts +2 -2
  39. package/es/display-objects/Rect.js +2 -6
  40. package/es/display-objects/Text.d.ts +2 -3
  41. package/es/display-objects/Text.js +8 -7
  42. package/es/display-objects/index.d.ts +2 -0
  43. package/es/display-objects/index.js +2 -0
  44. package/es/{Animation.d.ts → dom/Animation.d.ts} +3 -3
  45. package/es/{Animation.js → dom/Animation.js} +2 -3
  46. package/{lib → es/dom}/AnimationEffectTiming.d.ts +2 -0
  47. package/es/{AnimationEffectTiming.js → dom/AnimationEffectTiming.js} +3 -2
  48. package/es/{AnimationEvent.d.ts → dom/AnimationEvent.d.ts} +3 -2
  49. package/es/{AnimationEvent.js → dom/AnimationEvent.js} +1 -1
  50. package/es/{Timeline.d.ts → dom/AnimationTimeline.d.ts} +1 -1
  51. package/es/{Timeline.js → dom/AnimationTimeline.js} +1 -1
  52. package/es/dom/CustomElementRegistry.d.ts +15 -0
  53. package/es/dom/CustomElementRegistry.js +40 -0
  54. package/{lib → es/dom}/CustomEvent.d.ts +1 -1
  55. package/es/{CustomEvent.js → dom/CustomEvent.js} +1 -1
  56. package/es/dom/Document.d.ts +36 -17
  57. package/es/dom/Document.js +98 -14
  58. package/es/dom/Element.d.ts +71 -92
  59. package/es/dom/Element.js +179 -195
  60. package/es/dom/EventTarget.d.ts +11 -6
  61. package/es/dom/EventTarget.js +12 -4
  62. package/es/dom/FederatedEvent.d.ts +15 -7
  63. package/es/dom/FederatedEvent.js +33 -0
  64. package/es/dom/FederatedMouseEvent.d.ts +1 -1
  65. package/es/{KeyframeEffect.d.ts → dom/KeyframeEffect.d.ts} +16 -5
  66. package/es/{KeyframeEffect.js → dom/KeyframeEffect.js} +50 -4
  67. package/es/{KeyframeList.d.ts → dom/KeyframeList.d.ts} +1 -1
  68. package/es/{KeyframeList.js → dom/KeyframeList.js} +0 -0
  69. package/es/dom/Node.d.ts +38 -23
  70. package/es/dom/Node.js +37 -33
  71. package/es/dom/index.d.ts +15 -2
  72. package/es/dom/index.js +16 -3
  73. package/es/dom/interfaces.d.ts +301 -0
  74. package/es/dom/interfaces.js +1 -0
  75. package/es/global-module.d.ts +0 -2
  76. package/es/global-module.js +31 -29
  77. package/es/index.d.ts +7 -14
  78. package/es/index.js +8 -15
  79. package/es/plugins/CullingPlugin.d.ts +2 -2
  80. package/es/plugins/CullingPlugin.js +13 -16
  81. package/es/plugins/DirtyCheckPlugin.d.ts +1 -1
  82. package/es/plugins/DirtyCheckPlugin.js +8 -7
  83. package/es/plugins/EventPlugin.js +52 -31
  84. package/es/plugins/FrustumCullingStrategy.d.ts +1 -1
  85. package/es/plugins/FrustumCullingStrategy.js +5 -4
  86. package/es/plugins/PrepareRendererPlugin.d.ts +0 -1
  87. package/es/plugins/PrepareRendererPlugin.js +42 -38
  88. package/es/property-handlers/aabb.d.ts +2 -3
  89. package/es/property-handlers/aabb.js +29 -21
  90. package/es/property-handlers/anchor.d.ts +3 -0
  91. package/es/property-handlers/anchor.js +21 -0
  92. package/es/property-handlers/clipPath.d.ts +1 -1
  93. package/es/property-handlers/clipPath.js +3 -4
  94. package/es/property-handlers/color.d.ts +1 -1
  95. package/es/property-handlers/dimension.d.ts +1 -1
  96. package/es/property-handlers/dimension.js +6 -9
  97. package/es/property-handlers/filter.d.ts +1 -1
  98. package/es/property-handlers/index.d.ts +5 -4
  99. package/es/property-handlers/index.js +1 -0
  100. package/es/property-handlers/localPosition.d.ts +1 -1
  101. package/es/property-handlers/localPosition.js +1 -6
  102. package/es/property-handlers/offsetDistance.d.ts +1 -1
  103. package/es/property-handlers/offsetPath.d.ts +1 -1
  104. package/es/property-handlers/origin.d.ts +1 -1
  105. package/es/property-handlers/origin.js +9 -2
  106. package/es/property-handlers/path.d.ts +2 -2
  107. package/es/property-handlers/path.js +8 -4
  108. package/es/property-handlers/points.d.ts +1 -1
  109. package/es/property-handlers/transform.d.ts +1 -1
  110. package/es/property-handlers/zIndex.d.ts +1 -1
  111. package/es/services/ContextService.d.ts +3 -2
  112. package/es/services/EventService.d.ts +18 -13
  113. package/es/services/EventService.js +604 -384
  114. package/es/services/RenderingContext.d.ts +1 -1
  115. package/es/services/RenderingService.d.ts +23 -29
  116. package/es/services/RenderingService.js +63 -54
  117. package/es/services/SceneGraphSelector.d.ts +7 -7
  118. package/es/services/SceneGraphSelector.js +10 -6
  119. package/es/services/SceneGraphService.d.ts +73 -78
  120. package/es/services/SceneGraphService.js +165 -78
  121. package/es/services/aabb/PathUpdater.d.ts +1 -1
  122. package/es/services/aabb/RectUpdater.d.ts +2 -2
  123. package/es/services/aabb/interfaces.d.ts +1 -1
  124. package/es/shapes/Point.d.ts +4 -0
  125. package/es/shapes/Polygon.d.ts +9 -0
  126. package/es/shapes/Polygon.js +62 -0
  127. package/es/shapes/index.d.ts +1 -0
  128. package/es/shapes/index.js +2 -1
  129. package/es/types.d.ts +18 -6
  130. package/es/utils/animation.d.ts +1 -2
  131. package/es/utils/animation.js +5 -10
  132. package/es/utils/canvas.d.ts +1 -1
  133. package/es/utils/custom-easing.d.ts +3 -2
  134. package/es/utils/custom-easing.js +12 -6
  135. package/es/utils/event.js +1 -1
  136. package/es/utils/index.d.ts +1 -0
  137. package/es/utils/index.js +2 -1
  138. package/es/utils/interpolation.d.ts +3 -4
  139. package/es/utils/interpolation.js +0 -16
  140. package/es/utils/path.d.ts +2 -2
  141. package/lib/Canvas.d.ts +40 -18
  142. package/lib/Canvas.js +131 -74
  143. package/lib/DisplayObjectPool.d.ts +2 -1
  144. package/lib/DisplayObjectPool.js +4 -0
  145. package/{es → lib/camera}/Camera.d.ts +6 -3
  146. package/lib/{Camera.js → camera/Camera.js} +25 -20
  147. package/lib/{Landmark.d.ts → camera/Landmark.d.ts} +2 -2
  148. package/lib/{Landmark.js → camera/Landmark.js} +2 -3
  149. package/lib/camera/index.d.ts +2 -0
  150. package/lib/camera/index.js +31 -0
  151. package/lib/components/Cullable.js +1 -1
  152. package/lib/components/Geometry.d.ts +8 -1
  153. package/lib/components/Renderable.d.ts +9 -8
  154. package/lib/components/Renderable.js +2 -6
  155. package/lib/components/Sortable.d.ts +6 -2
  156. package/lib/display-objects/Circle.d.ts +2 -3
  157. package/lib/display-objects/Circle.js +3 -6
  158. package/lib/{CustomElement.d.ts → display-objects/CustomElement.d.ts} +1 -1
  159. package/lib/{CustomElement.js → display-objects/CustomElement.js} +22 -12
  160. package/{es → lib/display-objects}/DisplayObject.d.ts +136 -141
  161. package/lib/{DisplayObject.js → display-objects/DisplayObject.js} +418 -299
  162. package/lib/display-objects/Ellipse.d.ts +2 -3
  163. package/lib/display-objects/Ellipse.js +3 -6
  164. package/lib/display-objects/Group.d.ts +2 -1
  165. package/lib/display-objects/Group.js +12 -4
  166. package/lib/display-objects/HTML.d.ts +2 -2
  167. package/lib/display-objects/HTML.js +4 -7
  168. package/lib/display-objects/Image.d.ts +2 -2
  169. package/lib/display-objects/Image.js +2 -6
  170. package/lib/display-objects/Line.d.ts +2 -2
  171. package/lib/display-objects/Line.js +8 -8
  172. package/lib/display-objects/Path.d.ts +3 -2
  173. package/lib/display-objects/Path.js +8 -8
  174. package/lib/display-objects/Polygon.d.ts +2 -2
  175. package/lib/display-objects/Polygon.js +2 -6
  176. package/lib/display-objects/Polyline.d.ts +2 -2
  177. package/lib/display-objects/Polyline.js +8 -8
  178. package/lib/display-objects/Rect.d.ts +2 -2
  179. package/lib/display-objects/Rect.js +2 -6
  180. package/lib/display-objects/Text.d.ts +2 -3
  181. package/lib/display-objects/Text.js +9 -8
  182. package/lib/display-objects/index.d.ts +2 -0
  183. package/lib/display-objects/index.js +26 -0
  184. package/lib/{Animation.d.ts → dom/Animation.d.ts} +3 -3
  185. package/lib/{Animation.js → dom/Animation.js} +2 -3
  186. package/{es → lib/dom}/AnimationEffectTiming.d.ts +2 -0
  187. package/lib/{AnimationEffectTiming.js → dom/AnimationEffectTiming.js} +3 -3
  188. package/lib/{AnimationEvent.d.ts → dom/AnimationEvent.d.ts} +3 -2
  189. package/lib/{AnimationEvent.js → dom/AnimationEvent.js} +1 -1
  190. package/lib/{Timeline.d.ts → dom/AnimationTimeline.d.ts} +1 -1
  191. package/lib/{Timeline.js → dom/AnimationTimeline.js} +1 -1
  192. package/lib/dom/CustomElementRegistry.d.ts +15 -0
  193. package/lib/dom/CustomElementRegistry.js +48 -0
  194. package/{es → lib/dom}/CustomEvent.d.ts +1 -1
  195. package/lib/{CustomEvent.js → dom/CustomEvent.js} +1 -1
  196. package/lib/dom/Document.d.ts +36 -17
  197. package/lib/dom/Document.js +99 -15
  198. package/lib/dom/Element.d.ts +71 -92
  199. package/lib/dom/Element.js +180 -198
  200. package/lib/dom/EventTarget.d.ts +11 -6
  201. package/lib/dom/EventTarget.js +20 -10
  202. package/lib/dom/FederatedEvent.d.ts +15 -7
  203. package/lib/dom/FederatedEvent.js +33 -0
  204. package/lib/dom/FederatedMouseEvent.d.ts +1 -1
  205. package/lib/{KeyframeEffect.d.ts → dom/KeyframeEffect.d.ts} +16 -5
  206. package/lib/{KeyframeEffect.js → dom/KeyframeEffect.js} +50 -4
  207. package/lib/{KeyframeList.d.ts → dom/KeyframeList.d.ts} +1 -1
  208. package/lib/{KeyframeList.js → dom/KeyframeList.js} +0 -0
  209. package/lib/dom/Node.d.ts +38 -23
  210. package/lib/dom/Node.js +37 -33
  211. package/lib/dom/index.d.ts +15 -2
  212. package/lib/dom/index.js +177 -8
  213. package/lib/dom/interfaces.d.ts +301 -0
  214. package/lib/dom/interfaces.js +5 -0
  215. package/lib/global-module.d.ts +0 -2
  216. package/lib/global-module.js +30 -30
  217. package/lib/index.d.ts +7 -14
  218. package/lib/index.js +44 -135
  219. package/lib/plugins/CullingPlugin.d.ts +2 -2
  220. package/lib/plugins/CullingPlugin.js +14 -16
  221. package/lib/plugins/DirtyCheckPlugin.d.ts +1 -1
  222. package/lib/plugins/DirtyCheckPlugin.js +9 -7
  223. package/lib/plugins/EventPlugin.js +52 -30
  224. package/lib/plugins/FrustumCullingStrategy.d.ts +1 -1
  225. package/lib/plugins/FrustumCullingStrategy.js +5 -4
  226. package/lib/plugins/PrepareRendererPlugin.d.ts +0 -1
  227. package/lib/plugins/PrepareRendererPlugin.js +41 -37
  228. package/lib/property-handlers/aabb.d.ts +2 -3
  229. package/lib/property-handlers/aabb.js +28 -22
  230. package/lib/property-handlers/anchor.d.ts +3 -0
  231. package/lib/property-handlers/anchor.js +34 -0
  232. package/lib/property-handlers/clipPath.d.ts +1 -1
  233. package/lib/property-handlers/clipPath.js +3 -4
  234. package/lib/property-handlers/color.d.ts +1 -1
  235. package/lib/property-handlers/dimension.d.ts +1 -1
  236. package/lib/property-handlers/dimension.js +6 -9
  237. package/lib/property-handlers/filter.d.ts +1 -1
  238. package/lib/property-handlers/index.d.ts +5 -4
  239. package/lib/property-handlers/index.js +14 -0
  240. package/lib/property-handlers/localPosition.d.ts +1 -1
  241. package/lib/property-handlers/localPosition.js +1 -7
  242. package/lib/property-handlers/offsetDistance.d.ts +1 -1
  243. package/lib/property-handlers/offsetPath.d.ts +1 -1
  244. package/lib/property-handlers/origin.d.ts +1 -1
  245. package/lib/property-handlers/origin.js +10 -2
  246. package/lib/property-handlers/path.d.ts +2 -2
  247. package/lib/property-handlers/path.js +8 -4
  248. package/lib/property-handlers/points.d.ts +1 -1
  249. package/lib/property-handlers/transform.d.ts +1 -1
  250. package/lib/property-handlers/zIndex.d.ts +1 -1
  251. package/lib/services/ContextService.d.ts +3 -2
  252. package/lib/services/EventService.d.ts +18 -13
  253. package/lib/services/EventService.js +616 -385
  254. package/lib/services/RenderingContext.d.ts +1 -1
  255. package/lib/services/RenderingService.d.ts +23 -29
  256. package/lib/services/RenderingService.js +66 -56
  257. package/lib/services/SceneGraphSelector.d.ts +7 -7
  258. package/lib/services/SceneGraphSelector.js +10 -6
  259. package/lib/services/SceneGraphService.d.ts +73 -78
  260. package/lib/services/SceneGraphService.js +166 -79
  261. package/lib/services/aabb/PathUpdater.d.ts +1 -1
  262. package/lib/services/aabb/RectUpdater.d.ts +2 -2
  263. package/lib/services/aabb/interfaces.d.ts +1 -1
  264. package/lib/shapes/Point.d.ts +4 -0
  265. package/lib/shapes/Polygon.d.ts +9 -0
  266. package/lib/shapes/Polygon.js +69 -0
  267. package/lib/shapes/index.d.ts +1 -0
  268. package/lib/shapes/index.js +13 -0
  269. package/lib/types.d.ts +18 -6
  270. package/lib/utils/animation.d.ts +1 -2
  271. package/lib/utils/animation.js +8 -16
  272. package/lib/utils/canvas.d.ts +1 -1
  273. package/lib/utils/custom-easing.d.ts +3 -2
  274. package/lib/utils/custom-easing.js +16 -8
  275. package/lib/utils/event.js +1 -1
  276. package/lib/utils/index.d.ts +1 -0
  277. package/lib/utils/index.js +13 -0
  278. package/lib/utils/interpolation.d.ts +3 -4
  279. package/lib/utils/interpolation.js +0 -17
  280. package/lib/utils/path.d.ts +2 -2
  281. package/package.json +6 -6
  282. package/es/Batch.d.ts +0 -25
  283. package/es/Batch.js +0 -82
  284. package/es/shapes-type.d.ts +0 -175
  285. package/es/shapes-type.js +0 -18
  286. package/es/utils/matrix-decompose.d.ts +0 -3
  287. package/es/utils/matrix-decompose.js +0 -404
  288. package/lib/Batch.d.ts +0 -25
  289. package/lib/Batch.js +0 -91
  290. package/lib/shapes-type.d.ts +0 -175
  291. package/lib/shapes-type.js +0 -41
  292. package/lib/utils/matrix-decompose.d.ts +0 -3
  293. package/lib/utils/matrix-decompose.js +0 -414
@@ -2,7 +2,8 @@ import { __decorate, __metadata, __values } from "tslib";
2
2
  import { inject, injectable } from 'inversify';
3
3
  import { FederatedPointerEvent } from '../dom/FederatedPointerEvent';
4
4
  import { FederatedWheelEvent } from '../dom/FederatedWheelEvent';
5
- import { ContextService, RenderingService, EventService } from '../services';
5
+ import { ContextService, RenderingService, EventService, RenderingServiceEvent } from '../services';
6
+ import { Point } from '../shapes';
6
7
  import { CanvasConfig } from '../types';
7
8
  import { normalizeToPointerEvent, supportsTouchEvents, TOUCH_TO_POINTER } from '../utils/event';
8
9
  /**
@@ -50,25 +51,27 @@ var EventPlugin = function () {
50
51
  };
51
52
  }
52
53
 
53
- EventPlugin_1 = EventPlugin;
54
-
55
54
  EventPlugin.prototype.apply = function (renderingService) {
56
55
  var _this = this;
57
56
 
58
57
  this.eventService.setPickHandler(function (position) {
59
- var picked = _this.renderingService.hooks.pick.call({
60
- position: position,
61
- picked: null
62
- }).picked;
58
+ return new Promise(function (resolve, reject) {
59
+ var result = {
60
+ position: position,
61
+ picked: null
62
+ };
63
63
 
64
- return picked;
64
+ _this.renderingService.emitter.emit(RenderingServiceEvent.Picking, result, function () {
65
+ resolve(result.picked);
66
+ });
67
+ });
65
68
  });
66
- renderingService.hooks.pointerWheel.tap(EventPlugin_1.tag, function (nativeEvent) {
69
+ renderingService.emitter.on(RenderingServiceEvent.PointerWheel, function (nativeEvent) {
67
70
  var wheelEvent = _this.normalizeWheelEvent(nativeEvent);
68
71
 
69
72
  _this.eventService.mapEvent(wheelEvent);
70
73
  });
71
- renderingService.hooks.pointerDown.tap(EventPlugin_1.tag, function (nativeEvent) {
74
+ renderingService.emitter.on(RenderingServiceEvent.PointerDown, function (nativeEvent) {
72
75
  var e_2, _a;
73
76
 
74
77
  if (supportsTouchEvents && nativeEvent.pointerType === 'touch') {
@@ -107,7 +110,7 @@ var EventPlugin = function () {
107
110
 
108
111
  _this.setCursor(_this.eventService.cursor);
109
112
  });
110
- renderingService.hooks.pointerUp.tap(EventPlugin_1.tag, function (nativeEvent) {
113
+ renderingService.emitter.on(RenderingServiceEvent.PointerUp, function (nativeEvent) {
111
114
  var e_3, _a;
112
115
 
113
116
  if (supportsTouchEvents && nativeEvent.pointerType === 'touch') return; // account for element in SVG
@@ -142,9 +145,9 @@ var EventPlugin = function () {
142
145
 
143
146
  _this.setCursor(_this.eventService.cursor);
144
147
  });
145
- renderingService.hooks.pointerMove.tap(EventPlugin_1.tag, this.onPointerMove);
146
- renderingService.hooks.pointerOver.tap(EventPlugin_1.tag, this.onPointerMove);
147
- renderingService.hooks.pointerOut.tap(EventPlugin_1.tag, this.onPointerMove);
148
+ renderingService.emitter.on(RenderingServiceEvent.PointerMove, this.onPointerMove);
149
+ renderingService.emitter.on(RenderingServiceEvent.PointerOver, this.onPointerMove);
150
+ renderingService.emitter.on(RenderingServiceEvent.PointerOut, this.onPointerMove);
148
151
  };
149
152
 
150
153
  EventPlugin.prototype.bootstrapEvent = function (event, nativeEvent) {
@@ -161,15 +164,23 @@ var EventPlugin = function () {
161
164
  event.tiltX = nativeEvent.tiltX;
162
165
  event.tiltY = nativeEvent.tiltY;
163
166
  event.twist = nativeEvent.twist;
164
- this.transferMouseData(event, nativeEvent); // calc position
167
+ this.transferMouseData(event, nativeEvent);
168
+
169
+ var _a = this.eventService.client2Viewport(new Point(nativeEvent.clientX, nativeEvent.clientY)),
170
+ x = _a.x,
171
+ y = _a.y;
172
+
173
+ event.viewport.x = x;
174
+ event.viewport.y = y;
165
175
 
166
- var bbox = this.contextService.getBoundingClientRect(); // relative to canvas
176
+ var _b = this.eventService.viewport2Canvas(event.viewport),
177
+ canvasX = _b.x,
178
+ canvasY = _b.y;
167
179
 
168
- event.canvas.x = nativeEvent.clientX - (bbox && bbox.left || 0);
169
- event.canvas.y = nativeEvent.clientY - (bbox && bbox.top || 0);
170
- event.screen.copyFrom(event.canvas);
171
- event.global.copyFrom(event.screen);
172
- event.offset.copyFrom(event.screen);
180
+ event.canvas.x = canvasX;
181
+ event.canvas.y = canvasY;
182
+ event.global.copyFrom(event.canvas);
183
+ event.offset.copyFrom(event.canvas);
173
184
  event.isTrusted = nativeEvent.isTrusted;
174
185
 
175
186
  if (event.type === 'pointerleave') {
@@ -193,14 +204,23 @@ var EventPlugin = function () {
193
204
  event.deltaMode = nativeEvent.deltaMode;
194
205
  event.deltaX = nativeEvent.deltaX;
195
206
  event.deltaY = nativeEvent.deltaY;
196
- event.deltaZ = nativeEvent.deltaZ; // calc position
197
-
198
- var bbox = this.contextService.getBoundingClientRect();
199
- event.canvas.x = nativeEvent.clientX - (bbox && bbox.left || 0);
200
- event.canvas.y = nativeEvent.clientY - (bbox && bbox.top || 0);
201
- event.screen.copyFrom(event.canvas);
202
- event.global.copyFrom(event.screen);
203
- event.offset.copyFrom(event.screen);
207
+ event.deltaZ = nativeEvent.deltaZ;
208
+
209
+ var _a = this.eventService.client2Viewport(new Point(nativeEvent.clientX, nativeEvent.clientY)),
210
+ x = _a.x,
211
+ y = _a.y;
212
+
213
+ event.viewport.x = x;
214
+ event.viewport.y = y;
215
+
216
+ var _b = this.eventService.viewport2Canvas(event.viewport),
217
+ canvasX = _b.x,
218
+ canvasY = _b.y;
219
+
220
+ event.canvas.x = canvasX;
221
+ event.canvas.y = canvasY;
222
+ event.global.copyFrom(event.canvas);
223
+ event.offset.copyFrom(event.canvas);
204
224
  event.nativeEvent = nativeEvent;
205
225
  event.type = nativeEvent.type;
206
226
  return event;
@@ -225,6 +245,8 @@ var EventPlugin = function () {
225
245
  event.movement.y = nativeEvent.movementY;
226
246
  event.page.x = nativeEvent.pageX;
227
247
  event.page.y = nativeEvent.pageY;
248
+ event.screen.x = nativeEvent.screenX;
249
+ event.screen.y = nativeEvent.screenY;
228
250
  event.relatedTarget = null;
229
251
  };
230
252
 
@@ -232,7 +254,6 @@ var EventPlugin = function () {
232
254
  this.contextService.applyCursorStyle(cursor || this.canvasConfig.cursor || 'default');
233
255
  };
234
256
 
235
- var EventPlugin_1;
236
257
  EventPlugin.tag = 'EventPlugin';
237
258
 
238
259
  __decorate([inject(CanvasConfig), __metadata("design:type", Object)], EventPlugin.prototype, "canvasConfig", void 0);
@@ -243,7 +264,7 @@ var EventPlugin = function () {
243
264
 
244
265
  __decorate([inject(EventService), __metadata("design:type", EventService)], EventPlugin.prototype, "eventService", void 0);
245
266
 
246
- EventPlugin = EventPlugin_1 = __decorate([injectable()], EventPlugin);
267
+ EventPlugin = __decorate([injectable()], EventPlugin);
247
268
  return EventPlugin;
248
269
  }();
249
270
 
@@ -1,5 +1,5 @@
1
1
  import { CullingStrategy } from './CullingPlugin';
2
- import { DisplayObject } from '../DisplayObject';
2
+ import { DisplayObject } from '../display-objects/DisplayObject';
3
3
  export declare class FrustumCullingStrategy implements CullingStrategy {
4
4
  private camera;
5
5
  isVisible(object: DisplayObject): boolean;
@@ -3,7 +3,7 @@ import { mat4, vec3 } from 'gl-matrix';
3
3
  import { inject, injectable } from 'inversify';
4
4
  import { Cullable } from '../components';
5
5
  import { Mask } from '../shapes';
6
- import { DefaultCamera, Camera } from '../Camera';
6
+ import { DefaultCamera, Camera } from '../camera/Camera';
7
7
 
8
8
  var FrustumCullingStrategy = function () {
9
9
  function FrustumCullingStrategy() {}
@@ -13,14 +13,15 @@ var FrustumCullingStrategy = function () {
13
13
 
14
14
  var entity = object.getEntity();
15
15
  var cullable = entity.getComponent(Cullable);
16
+ return true;
16
17
 
17
18
  if (!cullable.enable) {
18
19
  return true;
19
20
  }
20
21
 
21
- var aabb = object.getBounds();
22
+ var renderBounds = object.getRenderBounds();
22
23
 
23
- if (!aabb) {
24
+ if (!renderBounds) {
24
25
  return false;
25
26
  }
26
27
 
@@ -29,7 +30,7 @@ var FrustumCullingStrategy = function () {
29
30
 
30
31
  this.camera.getFrustum().extractFromVPMatrix(vpMatrix);
31
32
  var parentVisibilityPlaneMask = (_b = (_a = object.parentNode) === null || _a === void 0 ? void 0 : _a.getEntity().getComponent(Cullable)) === null || _b === void 0 ? void 0 : _b.visibilityPlaneMask;
32
- cullable.visibilityPlaneMask = this.computeVisibilityWithPlaneMask(aabb, parentVisibilityPlaneMask || Mask.INDETERMINATE, this.camera.getFrustum().planes);
33
+ cullable.visibilityPlaneMask = this.computeVisibilityWithPlaneMask(renderBounds, parentVisibilityPlaneMask || Mask.INDETERMINATE, this.camera.getFrustum().planes);
33
34
  cullable.visible = cullable.visibilityPlaneMask !== Mask.OUTSIDE;
34
35
  return cullable.visible;
35
36
  };
@@ -1,7 +1,6 @@
1
1
  import { RenderingService, RenderingPlugin } from '../services/RenderingService';
2
2
  export declare class PrepareRendererPlugin implements RenderingPlugin {
3
3
  static tag: string;
4
- private sceneGraphService;
5
4
  private renderingContext;
6
5
  apply(renderingService: RenderingService): void;
7
6
  }
@@ -1,69 +1,73 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
2
  import { inject, injectable } from 'inversify';
3
- import { Renderable } from '../components';
4
- import { DISPLAY_OBJECT_EVENT } from '../dom/Element';
5
- import { RenderingContext, RENDER_REASON } from '../services';
6
- import { SceneGraphService, SCENE_GRAPH_EVENT } from '../services/SceneGraphService';
3
+ import { ElementEvent } from '../dom';
4
+ import { dirtifyRenderable, RenderingContext, RENDER_REASON } from '../services';
5
+ import { RenderingServiceEvent } from '../services/RenderingService';
7
6
 
8
7
  var PrepareRendererPlugin = function () {
9
8
  function PrepareRendererPlugin() {}
10
9
 
11
- PrepareRendererPlugin_1 = PrepareRendererPlugin;
12
-
13
10
  PrepareRendererPlugin.prototype.apply = function (renderingService) {
14
11
  var _this = this;
15
12
 
16
- var handleAttributeChanged = function handleAttributeChanged(name, oldValue, value, object) {
17
- // need re-render
18
- _this.renderingContext.renderReasons.add(RENDER_REASON.DisplayObjectChanged); // trigger hooks
13
+ var handleAttributeChanged = function handleAttributeChanged(e) {
14
+ _this.renderingContext.renderReasons.add(RENDER_REASON.DisplayObjectChanged);
15
+ };
19
16
 
17
+ var dirtifyToRoot = function dirtifyToRoot(e) {
18
+ dirtifyRenderable(e.target, true);
19
+ renderingService.dirtify();
20
+ };
20
21
 
21
- renderingService.hooks.attributeChanged.call(object, name, value);
22
+ var handleBoundsChanged = function handleBoundsChanged(e) {
23
+ // const path = e.composedPath().slice(0, -2);
24
+ // path.forEach((node: DisplayObject) => {
25
+ // const parent = node.parentElement as DisplayObject;
26
+ // if (parent && parent.style && parent.style.transformOrigin) {
27
+ // updateTransformOrigin(
28
+ // parent.style.transformOrigin,
29
+ // parent.style.transformOrigin,
30
+ // parent,
31
+ // true,
32
+ // );
33
+ // }
34
+ // });
35
+ renderingService.dirtify();
22
36
  };
23
37
 
24
- var handleAABBChanged = function handleAABBChanged() {
25
- // need re-render
26
- _this.renderingContext.renderReasons.add(RENDER_REASON.DisplayObjectChanged);
38
+ var handleMounted = function handleMounted(e) {
39
+ dirtifyToRoot(e);
27
40
  };
28
41
 
29
- renderingService.hooks.init.tap(PrepareRendererPlugin_1.tag, function () {
30
- _this.sceneGraphService.on(SCENE_GRAPH_EVENT.AABBChanged, handleAABBChanged);
31
- });
32
- renderingService.hooks.destroy.tap(PrepareRendererPlugin_1.tag, function () {
33
- _this.sceneGraphService.off(SCENE_GRAPH_EVENT.AABBChanged, handleAABBChanged);
34
- });
35
- renderingService.hooks.mounted.tap(PrepareRendererPlugin_1.tag, function (object) {
36
- var entity = object.getEntity(); // delegate attribute-changed handler
42
+ var handleUnmounted = function handleUnmounted(e) {
43
+ dirtifyToRoot(e);
44
+ };
37
45
 
38
- object.on(DISPLAY_OBJECT_EVENT.AttributeChanged, handleAttributeChanged);
39
- var renderable = entity.getComponent(Renderable);
40
- renderable.dirty = true; // need re-render
46
+ renderingService.emitter.on(RenderingServiceEvent.Init, function () {
47
+ _this.renderingContext.root.addEventListener(ElementEvent.MOUNTED, handleMounted);
41
48
 
42
- _this.renderingContext.renderReasons.add(RENDER_REASON.DisplayObjectChanged);
49
+ _this.renderingContext.root.addEventListener(ElementEvent.UNMOUNTED, handleUnmounted);
50
+
51
+ _this.renderingContext.root.addEventListener(ElementEvent.ATTRIBUTE_CHANGED, handleAttributeChanged);
52
+
53
+ _this.renderingContext.root.addEventListener(ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
43
54
  });
44
- renderingService.hooks.unmounted.tap(PrepareRendererPlugin_1.tag, function (object) {
45
- // console.log('unmounted', object);
46
- object.off(DISPLAY_OBJECT_EVENT.AttributeChanged, handleAttributeChanged);
47
- var entity = object.getEntity();
48
- var renderable = entity.getComponent(Renderable);
55
+ renderingService.emitter.on(RenderingServiceEvent.Destroy, function () {
56
+ _this.renderingContext.root.removeEventListener(ElementEvent.MOUNTED, handleMounted);
49
57
 
50
- if (renderable.aabb) {
51
- _this.renderingContext.removedAABBs.push(renderable.aabb);
52
- } // need re-render
58
+ _this.renderingContext.root.removeEventListener(ElementEvent.UNMOUNTED, handleUnmounted);
53
59
 
60
+ _this.renderingContext.root.removeEventListener(ElementEvent.ATTRIBUTE_CHANGED, handleAttributeChanged);
54
61
 
55
- _this.renderingContext.renderReasons.add(RENDER_REASON.DisplayObjectChanged);
62
+ _this.renderingContext.root.removeEventListener(ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
56
63
  });
57
64
  };
58
65
 
59
- var PrepareRendererPlugin_1;
60
66
  PrepareRendererPlugin.tag = 'PrepareRendererPlugin';
61
67
 
62
- __decorate([inject(SceneGraphService), __metadata("design:type", Object)], PrepareRendererPlugin.prototype, "sceneGraphService", void 0);
63
-
64
68
  __decorate([inject(RenderingContext), __metadata("design:type", Object)], PrepareRendererPlugin.prototype, "renderingContext", void 0);
65
69
 
66
- PrepareRendererPlugin = PrepareRendererPlugin_1 = __decorate([injectable()], PrepareRendererPlugin);
70
+ PrepareRendererPlugin = __decorate([injectable()], PrepareRendererPlugin);
67
71
  return PrepareRendererPlugin;
68
72
  }();
69
73
 
@@ -1,3 +1,2 @@
1
- import type { DisplayObject } from '../DisplayObject';
2
- import { SceneGraphService } from '../services';
3
- export declare function updateGeometry(oldValue: number, newValue: number, object: DisplayObject, sceneGraphService: SceneGraphService): void;
1
+ import type { DisplayObject } from '../display-objects/DisplayObject';
2
+ export declare function updateGeometry(oldValue: number, newValue: number, object: DisplayObject): void;
@@ -2,18 +2,22 @@ import { vec3 } from 'gl-matrix';
2
2
  import { Geometry } from '../components';
3
3
  import { AABB } from '../shapes';
4
4
  import { container } from '../inversify.config';
5
- import { GeometryUpdaterFactory } from '../services';
5
+ import { dirtifyRenderable, GeometryUpdaterFactory } from '../services';
6
6
  import { SHAPE } from '../types';
7
7
  import { PARSED_COLOR_TYPE } from './color';
8
- export function updateGeometry(oldValue, newValue, object, sceneGraphService) {
8
+ export function updateGeometry(oldValue, newValue, object) {
9
9
  var geometryUpdaterFactory = container.get(GeometryUpdaterFactory);
10
10
  var geometryUpdater = geometryUpdaterFactory(object.nodeName);
11
11
 
12
12
  if (geometryUpdater) {
13
- var geometry_1 = object.getEntity().getComponent(Geometry);
13
+ var geometry_1 = object.entity.getComponent(Geometry);
14
14
 
15
- if (!geometry_1.aabb) {
16
- geometry_1.aabb = new AABB();
15
+ if (!geometry_1.contentBounds) {
16
+ geometry_1.contentBounds = new AABB();
17
+ }
18
+
19
+ if (!geometry_1.renderBounds) {
20
+ geometry_1.renderBounds = new AABB();
17
21
  }
18
22
 
19
23
  var _a = geometryUpdater.update(object.parsedStyle, object),
@@ -55,26 +59,31 @@ export function updateGeometry(oldValue, newValue, object, sceneGraphService) {
55
59
  var _h = object.parsedStyle,
56
60
  _j = _h.lineWidth,
57
61
  lineWidth = _j === void 0 ? 0 : _j,
58
- _k = _h.lineAppendWidth,
59
- lineAppendWidth = _k === void 0 ? 0 : _k,
62
+ _k = _h.padding,
63
+ padding = _k === void 0 ? [] : _k,
60
64
  _l = _h.anchor,
61
- anchor = _l === void 0 ? [0.5, 0.5] : _l,
65
+ anchor = _l === void 0 ? [0, 0] : _l,
62
66
  shadowColor = _h.shadowColor,
63
67
  _m = _h.filter,
64
- filter = _m === void 0 ? [] : _m;
65
- var center = vec3.fromValues((1 - anchor[0] * 2) * halfExtents[0] + offsetX, (1 - anchor[1] * 2) * halfExtents[1] + offsetY, (1 - (anchor[2] || 0) * 2) * halfExtents[2] + offsetZ); // <Text> use textAlign & textBaseline instead of anchor
68
+ filter = _m === void 0 ? [] : _m; // <Text> use textAlign & textBaseline instead of anchor
66
69
 
67
70
  if (object.nodeName === SHAPE.Text) {
68
71
  delete object.parsedStyle.anchor;
69
- } // append border
72
+ }
70
73
 
74
+ var center = vec3.fromValues((1 - anchor[0] * 2) * halfExtents[0] + offsetX, (1 - anchor[1] * 2) * halfExtents[1] + offsetY, (1 - (anchor[2] || 0) * 2) * halfExtents[2] + offsetZ); // update geometry's AABB
71
75
 
72
- vec3.add(halfExtents, halfExtents, vec3.fromValues(lineWidth + lineAppendWidth, lineWidth + lineAppendWidth, 0)); // update geometry's AABB
76
+ geometry_1.contentBounds.update(center, halfExtents);
73
77
 
74
- geometry_1.aabb.update(center, halfExtents); // account for shadow, only support constant value now
78
+ if (lineWidth) {
79
+ // append border
80
+ vec3.add(halfExtents, halfExtents, vec3.fromValues(lineWidth / 2, lineWidth / 2, 0));
81
+ }
82
+
83
+ geometry_1.renderBounds.update(center, halfExtents); // account for shadow, only support constant value now
75
84
 
76
85
  if (shadowColor && shadowColor.type === PARSED_COLOR_TYPE.Constant) {
77
- var _o = geometry_1.aabb,
86
+ var _o = geometry_1.renderBounds,
78
87
  min = _o.min,
79
88
  max = _o.max;
80
89
  var _p = object.parsedStyle,
@@ -92,7 +101,7 @@ export function updateGeometry(oldValue, newValue, object, sceneGraphService) {
92
101
  max[0] = Math.max(max[0], shadowRight);
93
102
  min[1] = Math.min(min[1], shadowTop);
94
103
  max[1] = Math.max(max[1], shadowBottom);
95
- geometry_1.aabb.setMinMax(min, max);
104
+ geometry_1.renderBounds.setMinMax(min, max);
96
105
  } // account for filter, eg. blur(5px), drop-shadow()
97
106
 
98
107
 
@@ -102,12 +111,12 @@ export function updateGeometry(oldValue, newValue, object, sceneGraphService) {
102
111
 
103
112
  if (name === 'blur') {
104
113
  var blurRadius = params[0].value;
105
- geometry_1.aabb.update(geometry_1.aabb.center, vec3.add(geometry_1.aabb.halfExtents, geometry_1.aabb.halfExtents, vec3.fromValues(blurRadius, blurRadius, 0)));
114
+ geometry_1.renderBounds.update(geometry_1.renderBounds.center, vec3.add(geometry_1.renderBounds.halfExtents, geometry_1.renderBounds.halfExtents, vec3.fromValues(blurRadius, blurRadius, 0)));
106
115
  } else if (name === 'drop-shadow') {
107
116
  var shadowOffsetX = params[0].value;
108
117
  var shadowOffsetY = params[1].value;
109
118
  var shadowBlur = params[2].value;
110
- var _b = geometry_1.aabb,
119
+ var _b = geometry_1.renderBounds,
111
120
  min = _b.min,
112
121
  max = _b.max;
113
122
  var shadowLeft = min[0] - shadowBlur + shadowOffsetX;
@@ -118,10 +127,9 @@ export function updateGeometry(oldValue, newValue, object, sceneGraphService) {
118
127
  max[0] = Math.max(max[0], shadowRight);
119
128
  min[1] = Math.min(min[1], shadowTop);
120
129
  max[1] = Math.max(max[1], shadowBottom);
121
- geometry_1.aabb.setMinMax(min, max);
130
+ geometry_1.renderBounds.setMinMax(min, max);
122
131
  }
123
- }); // dirtify renderable's AABB
124
-
125
- sceneGraphService.dirtifyAABBToRoot(object);
132
+ });
133
+ dirtifyRenderable(object);
126
134
  }
127
135
  }
@@ -0,0 +1,3 @@
1
+ import { vec2, vec3 } from 'gl-matrix';
2
+ import type { DisplayObject } from '../display-objects/DisplayObject';
3
+ export declare function updateAnchor(oldValue: vec2 | vec3, newValue: vec2 | vec3, object: DisplayObject): void;
@@ -0,0 +1,21 @@
1
+ import { __read, __spreadArray } from "tslib";
2
+ import { vec3 } from 'gl-matrix';
3
+ import { Geometry } from '../components';
4
+ import { dirtifyRenderable } from '../services';
5
+ import { createVec3 } from '../utils';
6
+ export function updateAnchor(oldValue, newValue, object) {
7
+ var bounds = object.getGeometryBounds();
8
+
9
+ if (bounds) {
10
+ var geometry = object.entity.getComponent(Geometry);
11
+
12
+ if (geometry && geometry.contentBounds) {
13
+ var offset = vec3.multiply(vec3.create(), vec3.fromValues.apply(vec3, __spreadArray([], __read(bounds.halfExtents.map(function (n) {
14
+ return n * 2;
15
+ })))), vec3.subtract(vec3.create(), createVec3(newValue || vec3.create()), createVec3(oldValue || vec3.create())));
16
+ geometry.contentBounds.update(vec3.subtract(geometry.contentBounds.center, geometry.contentBounds.center, offset), geometry.contentBounds.halfExtents);
17
+ geometry.renderBounds.update(vec3.subtract(geometry.renderBounds.center, geometry.renderBounds.center, offset), geometry.renderBounds.halfExtents);
18
+ dirtifyRenderable(object);
19
+ }
20
+ }
21
+ }
@@ -1,4 +1,4 @@
1
- import type { DisplayObject } from '../DisplayObject';
1
+ import type { DisplayObject } from '../display-objects/DisplayObject';
2
2
  /**
3
3
  * @see /zh/docs/api/basic/display-object#clippath
4
4
  * @example
@@ -1,4 +1,4 @@
1
- import { Renderable } from '../components/Renderable';
1
+ import { dirtifyRenderable } from '../services';
2
2
  /**
3
3
  * @see /zh/docs/api/basic/display-object#clippath
4
4
  * @example
@@ -30,8 +30,7 @@ export function updateClipPath(oldClipPath, newClipPath, object) {
30
30
  }
31
31
 
32
32
  newClipPath.style.clipPathTargets.push(object);
33
- } // re-calc target's AABB
34
-
33
+ }
35
34
 
36
- object.getEntity().getComponent(Renderable).aabbDirty = true;
35
+ dirtifyRenderable(object);
37
36
  }
@@ -1,4 +1,4 @@
1
- import type { DisplayObject } from '../DisplayObject';
1
+ import type { DisplayObject } from '../display-objects/DisplayObject';
2
2
  import type { Tuple4Number } from '../types';
3
3
  import { ParsedStyleProperty } from '.';
4
4
  export interface LinearGradient {
@@ -1,4 +1,4 @@
1
- import type { DisplayObject } from '../DisplayObject';
1
+ import type { DisplayObject } from '../display-objects/DisplayObject';
2
2
  export declare type LengthUnit = 'px' | '%';
3
3
  export declare type AngleUnit = 'deg' | 'rad' | 'turn';
4
4
  export declare type Unit = LengthUnit | AngleUnit | '';
@@ -95,17 +95,14 @@ export function convertPercentUnit(valueWithUnit, vec3Index, target) {
95
95
  if (valueWithUnit.unit === 'px') {
96
96
  return Number(valueWithUnit.value);
97
97
  } else if (valueWithUnit.unit === '%' && target) {
98
- var _a = target.parsedStyle,
99
- width = _a.width,
100
- height = _a.height; // const bounds = target.getEntity().getComponent(Geometry).aabb;
101
- // can't use bounds
102
- // const bounds = target.getLocalBounds();
98
+ // use bounds
99
+ var bounds = target.getBounds();
100
+ var size = 0;
103
101
 
104
- var size = 0; // if (bounds) {
105
- // size = bounds.halfExtents[vec3Index] * 2;
106
- // }
102
+ if (bounds) {
103
+ size = bounds.halfExtents[vec3Index] * 2;
104
+ }
107
105
 
108
- size = vec3Index === 0 ? width : height;
109
106
  return Number(valueWithUnit.value) / 100 * size;
110
107
  }
111
108
 
@@ -1,4 +1,4 @@
1
- import type { DisplayObject } from '../DisplayObject';
1
+ import type { DisplayObject } from '../display-objects/DisplayObject';
2
2
  import { ParsedColorStyleProperty } from './color';
3
3
  import { ParsedElement } from './dimension';
4
4
  export interface ParsedFilterStyleProperty {
@@ -1,8 +1,8 @@
1
1
  /** handle props in keyframe */
2
- import type { DisplayObject } from '../DisplayObject';
2
+ import type { IElement } from '../dom';
3
3
  import { SceneGraphService } from '../services';
4
4
  export declare const StylePropertyParser = "StylePropertyParser";
5
- export declare type StylePropertyParser<Original, Parsed> = (value: Original, displayObject: DisplayObject | null) => Parsed;
5
+ export declare type StylePropertyParser<Original, Parsed> = (value: Original, displayObject: IElement | null) => Parsed;
6
6
  export declare const StylePropertyParserFactory = "StylePropertyParserFactory";
7
7
  export declare type StylePropertyParserFactory = <Original, Parsed>(name: string) => StylePropertyParser<Original, Parsed>;
8
8
  export interface ParsedStyleProperty<T, V, Formatted = string> {
@@ -12,13 +12,14 @@ export interface ParsedStyleProperty<T, V, Formatted = string> {
12
12
  }
13
13
  export declare type Interpolatable = number | boolean | number[] | boolean[];
14
14
  export declare const StylePropertyUpdater = "StylePropertyUpdater";
15
- export declare type StylePropertyUpdater<Original> = (oldValue: Original, newValue: Original, displayObject: DisplayObject, sceneGraphService: SceneGraphService) => void;
15
+ export declare type StylePropertyUpdater<Original> = (oldValue: Original, newValue: Original, displayObject: IElement, sceneGraphService: SceneGraphService) => void;
16
16
  export declare const StylePropertyUpdaterFactory = "StylePropertyUpdaterFactory";
17
17
  export declare type StylePropertyUpdaterFactory = <Original>(name: string) => StylePropertyUpdater<Original>;
18
18
  export declare const StylePropertyMerger = "StylePropertyMerger";
19
- export declare type StylePropertyMerger<Parsed, T extends Interpolatable = number> = (left: Parsed, right: Parsed, displayObject: DisplayObject | null) => [T, T, (i: T) => string] | undefined;
19
+ export declare type StylePropertyMerger<Parsed, T extends Interpolatable = number> = (left: Parsed, right: Parsed, displayObject: IElement | null) => [T, T, (i: T) => string] | undefined;
20
20
  export declare const StylePropertyMergerFactory = "StylePropertyMergerFactory";
21
21
  export declare type StylePropertyMergerFactory = <Parsed>(name: string) => StylePropertyMerger<Parsed>;
22
+ export * from './anchor';
22
23
  export * from './aabb';
23
24
  export * from './localPosition';
24
25
  export * from './numeric';
@@ -4,6 +4,7 @@ export var StylePropertyUpdater = 'StylePropertyUpdater';
4
4
  export var StylePropertyUpdaterFactory = 'StylePropertyUpdaterFactory';
5
5
  export var StylePropertyMerger = 'StylePropertyMerger';
6
6
  export var StylePropertyMergerFactory = 'StylePropertyMergerFactory';
7
+ export * from './anchor';
7
8
  export * from './aabb';
8
9
  export * from './localPosition';
9
10
  export * from './numeric';
@@ -1,2 +1,2 @@
1
- import type { DisplayObject } from '../DisplayObject';
1
+ import type { DisplayObject } from '../display-objects';
2
2
  export declare function updateLocalPosition(oldValue: number, newValue: number, object: DisplayObject): void;
@@ -1,14 +1,9 @@
1
- import { Renderable } from '../components';
2
1
  export function updateLocalPosition(oldValue, newValue, object) {
3
- var renderable = object.getEntity().getComponent(Renderable);
4
2
  var _a = object.parsedStyle,
5
3
  _b = _a.x,
6
4
  x = _b === void 0 ? 0 : _b,
7
5
  _c = _a.y,
8
6
  y = _c === void 0 ? 0 : _c; // update local position when x/y changed
9
7
 
10
- object.setLocalPosition(x, y); // dirtify renderable's AABB
11
-
12
- renderable.aabbDirty = true;
13
- renderable.dirty = true;
8
+ object.setLocalPosition(x, y);
14
9
  }
@@ -1,4 +1,4 @@
1
- import type { DisplayObject } from '../DisplayObject';
1
+ import type { DisplayObject } from '../display-objects/DisplayObject';
2
2
  /**
3
3
  * @see /zh/docs/api/animation#%E8%B7%AF%E5%BE%84%E5%8A%A8%E7%94%BB
4
4
  */
@@ -1,4 +1,4 @@
1
- import type { DisplayObject } from '../DisplayObject';
1
+ import type { DisplayObject } from '../display-objects/DisplayObject';
2
2
  /**
3
3
  * @see /zh/docs/api/animation#%E8%B7%AF%E5%BE%84%E5%8A%A8%E7%94%BB
4
4
  */
@@ -1,5 +1,5 @@
1
- import type { DisplayObject } from '../DisplayObject';
2
1
  import type { vec2, vec3 } from 'gl-matrix';
2
+ import type { DisplayObject } from '../display-objects/DisplayObject';
3
3
  /**
4
4
  * @see /zh/docs/api/animation#%E8%B7%AF%E5%BE%84%E5%8A%A8%E7%94%BB
5
5
  */
@@ -1,5 +1,6 @@
1
- import { convertPercentUnit, parseLengthOrPercent } from './dimension';
2
1
  import { isNil } from '@antv/util';
2
+ import { convertPercentUnit, parseLengthOrPercent } from './dimension'; // import { Transform } from '../components';
3
+
3
4
  /**
4
5
  * @see /zh/docs/api/animation#%E8%B7%AF%E5%BE%84%E5%8A%A8%E7%94%BB
5
6
  */
@@ -43,8 +44,14 @@ export function updateTransformOrigin(oldValue, value, object) {
43
44
  }
44
45
 
45
46
  if (!isNil(originX) && !isNil(originY)) {
47
+ // if (silent) {
48
+ // const transform = object.entity.getComponent(Transform);
49
+ // const originVec = transform.origin;
50
+ // originVec[0] = originX;
51
+ // originVec[1] = originY;
52
+ // } else {
46
53
  // relative to local bounds
47
- object.setOrigin(originX, originY);
54
+ object.setOrigin([originX, originY]); // }
48
55
  }
49
56
  }
50
57