@antv/g 1.0.0-alpha.23 → 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 (63) hide show
  1. package/es/Canvas.d.ts +4 -2
  2. package/es/Canvas.js +14 -4
  3. package/es/components/Renderable.d.ts +0 -4
  4. package/es/components/Renderable.js +0 -5
  5. package/es/components/Sortable.d.ts +4 -0
  6. package/es/display-objects/Line.js +6 -2
  7. package/es/display-objects/Path.js +6 -2
  8. package/es/display-objects/Polyline.js +6 -2
  9. package/es/display-objects/Text.js +6 -2
  10. package/es/display-objects/index.d.ts +0 -1
  11. package/es/display-objects/index.js +0 -1
  12. package/es/dom/interfaces.d.ts +2 -0
  13. package/es/plugins/CullingPlugin.d.ts +1 -1
  14. package/es/plugins/CullingPlugin.js +8 -7
  15. package/es/plugins/DirtyCheckPlugin.d.ts +1 -1
  16. package/es/plugins/DirtyCheckPlugin.js +8 -7
  17. package/es/plugins/EventPlugin.js +17 -16
  18. package/es/plugins/FrustumCullingStrategy.js +1 -0
  19. package/es/plugins/PrepareRendererPlugin.js +4 -6
  20. package/es/services/EventService.d.ts +10 -10
  21. package/es/services/EventService.js +528 -383
  22. package/es/services/RenderingService.d.ts +21 -23
  23. package/es/services/RenderingService.js +63 -51
  24. package/es/services/SceneGraphService.js +16 -3
  25. package/es/shapes/Polygon.d.ts +9 -0
  26. package/es/shapes/Polygon.js +62 -0
  27. package/es/shapes/index.d.ts +1 -0
  28. package/es/shapes/index.js +2 -1
  29. package/es/types.d.ts +12 -2
  30. package/lib/Canvas.d.ts +4 -2
  31. package/lib/Canvas.js +14 -4
  32. package/lib/components/Renderable.d.ts +0 -4
  33. package/lib/components/Renderable.js +0 -5
  34. package/lib/components/Sortable.d.ts +4 -0
  35. package/lib/display-objects/Line.js +6 -2
  36. package/lib/display-objects/Path.js +6 -2
  37. package/lib/display-objects/Polyline.js +6 -2
  38. package/lib/display-objects/Text.js +6 -2
  39. package/lib/display-objects/index.d.ts +0 -1
  40. package/lib/display-objects/index.js +0 -13
  41. package/lib/dom/interfaces.d.ts +2 -0
  42. package/lib/plugins/CullingPlugin.d.ts +1 -1
  43. package/lib/plugins/CullingPlugin.js +9 -7
  44. package/lib/plugins/DirtyCheckPlugin.d.ts +1 -1
  45. package/lib/plugins/DirtyCheckPlugin.js +9 -7
  46. package/lib/plugins/EventPlugin.js +16 -15
  47. package/lib/plugins/FrustumCullingStrategy.js +1 -0
  48. package/lib/plugins/PrepareRendererPlugin.js +5 -6
  49. package/lib/services/EventService.d.ts +10 -10
  50. package/lib/services/EventService.js +527 -382
  51. package/lib/services/RenderingService.d.ts +21 -23
  52. package/lib/services/RenderingService.js +67 -54
  53. package/lib/services/SceneGraphService.js +16 -3
  54. package/lib/shapes/Polygon.d.ts +9 -0
  55. package/lib/shapes/Polygon.js +69 -0
  56. package/lib/shapes/index.d.ts +1 -0
  57. package/lib/shapes/index.js +13 -0
  58. package/lib/types.d.ts +12 -2
  59. package/package.json +4 -4
  60. package/es/display-objects/Batch.d.ts +0 -24
  61. package/es/display-objects/Batch.js +0 -82
  62. package/lib/display-objects/Batch.d.ts +0 -24
  63. package/lib/display-objects/Batch.js +0 -91
package/es/Canvas.d.ts CHANGED
@@ -11,6 +11,7 @@ import { Document, EventTarget } from './dom';
11
11
  import type { IElement, INode, ICanvas } from './dom/interfaces';
12
12
  import { CustomElementRegistry } from './dom/CustomElementRegistry';
13
13
  export declare enum CanvasEvent {
14
+ READY = "ready",
14
15
  BEFORE_RENDER = "beforerender",
15
16
  AFTER_RENDER = "afterrender",
16
17
  BEFORE_DESTROY = "beforedestroy",
@@ -43,6 +44,7 @@ export declare class Canvas extends EventTarget implements ICanvas {
43
44
  private initRenderingContext;
44
45
  private initDefaultCamera;
45
46
  getConfig(): Partial<CanvasConfig>;
47
+ getContainer(): import("inversify/lib/container/container").Container;
46
48
  /**
47
49
  * get the root displayObject in scenegraph
48
50
  * @alias this.document.documentElement
@@ -83,12 +85,12 @@ export declare class Canvas extends EventTarget implements ICanvas {
83
85
  canvas2Viewport(canvas: PointLike): PointLike;
84
86
  /**
85
87
  * @deprecated
86
- * @alias client2Canvas
88
+ * @alias client2Viewport
87
89
  */
88
90
  getPointByClient(clientX: number, clientY: number): PointLike;
89
91
  /**
90
92
  * @deprecated
91
- * @alias canvas2Client
93
+ * @alias viewport2Client
92
94
  */
93
95
  getClientByPoint(x: number, y: number): PointLike;
94
96
  }
package/es/Canvas.js CHANGED
@@ -16,6 +16,7 @@ import { Renderable } from './components';
16
16
  export var CanvasEvent;
17
17
 
18
18
  (function (CanvasEvent) {
19
+ CanvasEvent["READY"] = "ready";
19
20
  CanvasEvent["BEFORE_RENDER"] = "beforerender";
20
21
  CanvasEvent["AFTER_RENDER"] = "afterrender";
21
22
  CanvasEvent["BEFORE_DESTROY"] = "beforedestroy";
@@ -101,6 +102,10 @@ var Canvas = function (_super) {
101
102
  Canvas.prototype.getConfig = function () {
102
103
  return this.container.get(CanvasConfig);
103
104
  };
105
+
106
+ Canvas.prototype.getContainer = function () {
107
+ return this.container;
108
+ };
104
109
  /**
105
110
  * get the root displayObject in scenegraph
106
111
  * @alias this.document.documentElement
@@ -219,7 +224,7 @@ var Canvas = function (_super) {
219
224
  };
220
225
 
221
226
  Canvas.prototype.render = function () {
222
- this.emit(CanvasEvent.BEFORE_DESTROY, {});
227
+ this.emit(CanvasEvent.BEFORE_RENDER, {});
223
228
 
224
229
  if (this.container.isBound(RenderingService)) {
225
230
  var renderingService = this.container.get(RenderingService);
@@ -242,6 +247,8 @@ var Canvas = function (_super) {
242
247
  };
243
248
 
244
249
  Canvas.prototype.initRenderer = function (renderer) {
250
+ var _this = this;
251
+
245
252
  if (!renderer) {
246
253
  throw new Error('Renderer is required.');
247
254
  }
@@ -253,7 +260,9 @@ var Canvas = function (_super) {
253
260
  var contextService = this.container.get(ContextService);
254
261
  var renderingService = this.container.get(RenderingService);
255
262
  contextService.init();
256
- renderingService.init();
263
+ renderingService.init().then(function () {
264
+ _this.emit(CanvasEvent.READY, {});
265
+ });
257
266
 
258
267
  if (renderer.getConfig().enableAutoRendering) {
259
268
  this.run();
@@ -330,6 +339,7 @@ var Canvas = function (_super) {
330
339
  if (!child.isConnected) {
331
340
  child.ownerDocument = _this.document;
332
341
  child.isConnected = true;
342
+ debugger;
333
343
  child.emit(ElementEvent.MOUNTED, {});
334
344
  }
335
345
  });
@@ -352,7 +362,7 @@ var Canvas = function (_super) {
352
362
  };
353
363
  /**
354
364
  * @deprecated
355
- * @alias client2Canvas
365
+ * @alias client2Viewport
356
366
  */
357
367
 
358
368
 
@@ -364,7 +374,7 @@ var Canvas = function (_super) {
364
374
  };
365
375
  /**
366
376
  * @deprecated
367
- * @alias canvas2Client
377
+ * @alias viewport2Client
368
378
  */
369
379
 
370
380
 
@@ -22,8 +22,4 @@ export declare class Renderable extends Component {
22
22
  * dirty rectangle flag
23
23
  */
24
24
  dirty: boolean;
25
- /**
26
- * is instanced
27
- */
28
- instanced: boolean;
29
25
  }
@@ -14,11 +14,6 @@ var Renderable = function (_super) {
14
14
  */
15
15
 
16
16
  _this.dirty = false;
17
- /**
18
- * is instanced
19
- */
20
-
21
- _this.instanced = false;
22
17
  return _this;
23
18
  }
24
19
 
@@ -10,4 +10,8 @@ export declare class Sortable extends Component {
10
10
  * sorted child entities
11
11
  */
12
12
  sorted: INode[];
13
+ /**
14
+ * index in parent's children
15
+ */
16
+ lastSortedIndex: number;
13
17
  }
@@ -18,8 +18,12 @@ var Line = function (_super) {
18
18
  y1: 0,
19
19
  x2: 0,
20
20
  y2: 0,
21
- lineJoin: 'miter',
22
- lineCap: 'butt',
21
+ lineJoin: "miter"
22
+ /* Miter */
23
+ ,
24
+ lineCap: "butt"
25
+ /* Butt */
26
+ ,
23
27
  lineWidth: 1
24
28
  }, style)
25
29
  }, rest)) || this;
@@ -16,8 +16,12 @@ var Path = function (_super) {
16
16
  type: SHAPE.Path,
17
17
  style: __assign({
18
18
  path: '',
19
- lineJoin: 'miter',
20
- lineCap: 'butt',
19
+ lineJoin: "miter"
20
+ /* Miter */
21
+ ,
22
+ lineCap: "butt"
23
+ /* Butt */
24
+ ,
21
25
  lineWidth: 1
22
26
  }, style)
23
27
  }, rest)) || this;
@@ -15,8 +15,12 @@ var Polyline = function (_super) {
15
15
  type: SHAPE.Polyline,
16
16
  style: __assign({
17
17
  points: [],
18
- lineJoin: 'miter',
19
- lineCap: 'butt',
18
+ lineJoin: "miter"
19
+ /* Miter */
20
+ ,
21
+ lineCap: "butt"
22
+ /* Butt */
23
+ ,
20
24
  lineWidth: 1
21
25
  }, style)
22
26
  }, rest)) || this;
@@ -29,8 +29,12 @@ var Text = function (_super) {
29
29
  fill: '#000',
30
30
  letterSpacing: 0,
31
31
  lineHeight: 0,
32
- lineJoin: 'miter',
33
- lineCap: 'butt',
32
+ lineJoin: "miter"
33
+ /* Miter */
34
+ ,
35
+ lineCap: "butt"
36
+ /* Butt */
37
+ ,
34
38
  lineWidth: 0,
35
39
  miterLimit: 10,
36
40
  padding: 0,
@@ -1,6 +1,5 @@
1
1
  export * from './DisplayObject';
2
2
  export * from './CustomElement';
3
- export * from './Batch';
4
3
  export * from './Circle';
5
4
  export * from './Ellipse';
6
5
  export * from './Group';
@@ -1,6 +1,5 @@
1
1
  export * from './DisplayObject';
2
2
  export * from './CustomElement';
3
- export * from './Batch';
4
3
  export * from './Circle';
5
4
  export * from './Ellipse';
6
5
  export * from './Group';
@@ -7,6 +7,7 @@ import { CustomElementRegistry } from './CustomElementRegistry';
7
7
  import { DisplayObject } from '..';
8
8
  import type { PointLike } from '../shapes';
9
9
  import type { Camera } from '../camera';
10
+ import { ContextService } from '../services';
10
11
  export interface IEventTarget {
11
12
  entity: Entity;
12
13
  getEntity(): Entity;
@@ -292,6 +293,7 @@ export interface ICanvas extends IEventTarget {
292
293
  destroy(destroyScenegraph?: boolean): void;
293
294
  resize(width: number, height: number): void;
294
295
  getCamera(): Camera;
296
+ getContextService(): ContextService<unknown>;
295
297
  client2Viewport(client: PointLike): PointLike;
296
298
  viewport2Client(viewport: PointLike): PointLike;
297
299
  canvas2Viewport(canvas: PointLike): PointLike;
@@ -14,5 +14,5 @@ export declare class CullingPlugin implements RenderingPlugin {
14
14
  private canvasConfig;
15
15
  private strategies;
16
16
  private renderingContext;
17
- apply(renderer: RenderingService): void;
17
+ apply(renderingService: RenderingService): void;
18
18
  }
@@ -2,6 +2,7 @@ import { __decorate, __metadata } from "tslib";
2
2
  import { inject, injectable, named } from 'inversify';
3
3
  import { Cullable } from '../components';
4
4
  import { ContributionProvider } from '../contribution-provider';
5
+ import { RenderingServiceEvent } from '../services/RenderingService';
5
6
  import { RenderingContext, RENDER_REASON } from '../services/RenderingContext';
6
7
  import { CanvasConfig } from '../types';
7
8
  export var CullingStrategy = 'CullingStrategy';
@@ -14,12 +15,10 @@ export var CullingStrategy = 'CullingStrategy';
14
15
  var CullingPlugin = function () {
15
16
  function CullingPlugin() {}
16
17
 
17
- CullingPlugin_1 = CullingPlugin;
18
-
19
- CullingPlugin.prototype.apply = function (renderer) {
18
+ CullingPlugin.prototype.apply = function (renderingService) {
20
19
  var _this = this;
21
20
 
22
- renderer.hooks.prepare.tap(CullingPlugin_1.tag, function (object) {
21
+ renderingService.emitter.on(RenderingServiceEvent.Prepare, function (object, next) {
23
22
  if (object) {
24
23
  var cullable = object.entity.getComponent(Cullable);
25
24
 
@@ -33,6 +32,7 @@ var CullingPlugin = function () {
33
32
  }
34
33
 
35
34
  if (object.isVisible()) {
35
+ next(object);
36
36
  return object;
37
37
  } else {
38
38
  // Those invisible objects which get renderred in last frame should be saved for later use.
@@ -48,18 +48,19 @@ var CullingPlugin = function () {
48
48
  }
49
49
  }
50
50
 
51
+ next(null);
51
52
  return null;
52
53
  }
53
54
  }
54
55
 
56
+ next(object);
55
57
  return object;
56
58
  });
57
- renderer.hooks.afterRender.tap(CullingPlugin_1.tag, function (object) {
59
+ renderingService.emitter.on(RenderingServiceEvent.AfterRender, function (object) {
58
60
  object.entity.getComponent(Cullable).visibilityPlaneMask = -1;
59
61
  });
60
62
  };
61
63
 
62
- var CullingPlugin_1;
63
64
  CullingPlugin.tag = 'CullingPlugin';
64
65
 
65
66
  __decorate([inject(CanvasConfig), __metadata("design:type", Object)], CullingPlugin.prototype, "canvasConfig", void 0);
@@ -68,7 +69,7 @@ var CullingPlugin = function () {
68
69
 
69
70
  __decorate([inject(RenderingContext), __metadata("design:type", Object)], CullingPlugin.prototype, "renderingContext", void 0);
70
71
 
71
- CullingPlugin = CullingPlugin_1 = __decorate([injectable()], CullingPlugin);
72
+ CullingPlugin = __decorate([injectable()], CullingPlugin);
72
73
  return CullingPlugin;
73
74
  }();
74
75
 
@@ -6,5 +6,5 @@ export declare class DirtyCheckPlugin implements RenderingPlugin {
6
6
  static tag: string;
7
7
  private canvasConfig;
8
8
  private renderingContext;
9
- apply(renderer: RenderingService): void;
9
+ apply(renderingService: RenderingService): void;
10
10
  }
@@ -2,6 +2,7 @@ import { __decorate, __metadata } from "tslib";
2
2
  import { inject, injectable } from 'inversify';
3
3
  import { Renderable } from '../components';
4
4
  import { CanvasConfig } from '../types';
5
+ import { RenderingServiceEvent } from '../services/RenderingService';
5
6
  import { RenderingContext, RENDER_REASON } from '../services/RenderingContext';
6
7
  /**
7
8
  * Filter dirty renderables and calculate the "dirty rectangle" which will be clear when frame began
@@ -10,12 +11,10 @@ import { RenderingContext, RENDER_REASON } from '../services/RenderingContext';
10
11
  var DirtyCheckPlugin = function () {
11
12
  function DirtyCheckPlugin() {}
12
13
 
13
- DirtyCheckPlugin_1 = DirtyCheckPlugin;
14
-
15
- DirtyCheckPlugin.prototype.apply = function (renderer) {
14
+ DirtyCheckPlugin.prototype.apply = function (renderingService) {
16
15
  var _this = this;
17
16
 
18
- renderer.hooks.prepare.tap(DirtyCheckPlugin_1.tag, function (object) {
17
+ renderingService.emitter.on(RenderingServiceEvent.Prepare, function (object, next) {
19
18
  if (object) {
20
19
  var enableDirtyRectangleRendering = _this.canvasConfig.renderer.getConfig().enableDirtyRectangleRendering;
21
20
 
@@ -23,25 +22,27 @@ var DirtyCheckPlugin = function () {
23
22
 
24
23
  var isDirty = renderable.dirty || _this.renderingContext.renderReasons.has(RENDER_REASON.CameraChanged);
25
24
 
26
- if (isDirty || !enableDirtyRectangleRendering && !renderable.instanced) {
25
+ if (isDirty || !enableDirtyRectangleRendering) {
26
+ next(object);
27
27
  return object;
28
28
  } else {
29
+ next(null);
29
30
  return null;
30
31
  }
31
32
  }
32
33
 
34
+ next(object);
33
35
  return object;
34
36
  });
35
37
  };
36
38
 
37
- var DirtyCheckPlugin_1;
38
39
  DirtyCheckPlugin.tag = 'DirtyCheckPlugin';
39
40
 
40
41
  __decorate([inject(CanvasConfig), __metadata("design:type", Object)], DirtyCheckPlugin.prototype, "canvasConfig", void 0);
41
42
 
42
43
  __decorate([inject(RenderingContext), __metadata("design:type", Object)], DirtyCheckPlugin.prototype, "renderingContext", void 0);
43
44
 
44
- DirtyCheckPlugin = DirtyCheckPlugin_1 = __decorate([injectable()], DirtyCheckPlugin);
45
+ DirtyCheckPlugin = __decorate([injectable()], DirtyCheckPlugin);
45
46
  return DirtyCheckPlugin;
46
47
  }();
47
48
 
@@ -2,7 +2,7 @@ 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
6
  import { Point } from '../shapes';
7
7
  import { CanvasConfig } from '../types';
8
8
  import { normalizeToPointerEvent, supportsTouchEvents, TOUCH_TO_POINTER } from '../utils/event';
@@ -51,25 +51,27 @@ var EventPlugin = function () {
51
51
  };
52
52
  }
53
53
 
54
- EventPlugin_1 = EventPlugin;
55
-
56
54
  EventPlugin.prototype.apply = function (renderingService) {
57
55
  var _this = this;
58
56
 
59
57
  this.eventService.setPickHandler(function (position) {
60
- var picked = _this.renderingService.hooks.pick.call({
61
- position: position,
62
- picked: null
63
- }).picked;
58
+ return new Promise(function (resolve, reject) {
59
+ var result = {
60
+ position: position,
61
+ picked: null
62
+ };
64
63
 
65
- return picked;
64
+ _this.renderingService.emitter.emit(RenderingServiceEvent.Picking, result, function () {
65
+ resolve(result.picked);
66
+ });
67
+ });
66
68
  });
67
- renderingService.hooks.pointerWheel.tap(EventPlugin_1.tag, function (nativeEvent) {
69
+ renderingService.emitter.on(RenderingServiceEvent.PointerWheel, function (nativeEvent) {
68
70
  var wheelEvent = _this.normalizeWheelEvent(nativeEvent);
69
71
 
70
72
  _this.eventService.mapEvent(wheelEvent);
71
73
  });
72
- renderingService.hooks.pointerDown.tap(EventPlugin_1.tag, function (nativeEvent) {
74
+ renderingService.emitter.on(RenderingServiceEvent.PointerDown, function (nativeEvent) {
73
75
  var e_2, _a;
74
76
 
75
77
  if (supportsTouchEvents && nativeEvent.pointerType === 'touch') {
@@ -108,7 +110,7 @@ var EventPlugin = function () {
108
110
 
109
111
  _this.setCursor(_this.eventService.cursor);
110
112
  });
111
- renderingService.hooks.pointerUp.tap(EventPlugin_1.tag, function (nativeEvent) {
113
+ renderingService.emitter.on(RenderingServiceEvent.PointerUp, function (nativeEvent) {
112
114
  var e_3, _a;
113
115
 
114
116
  if (supportsTouchEvents && nativeEvent.pointerType === 'touch') return; // account for element in SVG
@@ -143,9 +145,9 @@ var EventPlugin = function () {
143
145
 
144
146
  _this.setCursor(_this.eventService.cursor);
145
147
  });
146
- renderingService.hooks.pointerMove.tap(EventPlugin_1.tag, this.onPointerMove);
147
- renderingService.hooks.pointerOver.tap(EventPlugin_1.tag, this.onPointerMove);
148
- 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);
149
151
  };
150
152
 
151
153
  EventPlugin.prototype.bootstrapEvent = function (event, nativeEvent) {
@@ -252,7 +254,6 @@ var EventPlugin = function () {
252
254
  this.contextService.applyCursorStyle(cursor || this.canvasConfig.cursor || 'default');
253
255
  };
254
256
 
255
- var EventPlugin_1;
256
257
  EventPlugin.tag = 'EventPlugin';
257
258
 
258
259
  __decorate([inject(CanvasConfig), __metadata("design:type", Object)], EventPlugin.prototype, "canvasConfig", void 0);
@@ -263,7 +264,7 @@ var EventPlugin = function () {
263
264
 
264
265
  __decorate([inject(EventService), __metadata("design:type", EventService)], EventPlugin.prototype, "eventService", void 0);
265
266
 
266
- EventPlugin = EventPlugin_1 = __decorate([injectable()], EventPlugin);
267
+ EventPlugin = __decorate([injectable()], EventPlugin);
267
268
  return EventPlugin;
268
269
  }();
269
270
 
@@ -13,6 +13,7 @@ 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;
@@ -2,12 +2,11 @@ import { __decorate, __metadata } from "tslib";
2
2
  import { inject, injectable } from 'inversify';
3
3
  import { ElementEvent } from '../dom';
4
4
  import { dirtifyRenderable, RenderingContext, RENDER_REASON } from '../services';
5
+ import { RenderingServiceEvent } from '../services/RenderingService';
5
6
 
6
7
  var PrepareRendererPlugin = function () {
7
8
  function PrepareRendererPlugin() {}
8
9
 
9
- PrepareRendererPlugin_1 = PrepareRendererPlugin;
10
-
11
10
  PrepareRendererPlugin.prototype.apply = function (renderingService) {
12
11
  var _this = this;
13
12
 
@@ -44,7 +43,7 @@ var PrepareRendererPlugin = function () {
44
43
  dirtifyToRoot(e);
45
44
  };
46
45
 
47
- renderingService.hooks.init.tap(PrepareRendererPlugin_1.tag, function () {
46
+ renderingService.emitter.on(RenderingServiceEvent.Init, function () {
48
47
  _this.renderingContext.root.addEventListener(ElementEvent.MOUNTED, handleMounted);
49
48
 
50
49
  _this.renderingContext.root.addEventListener(ElementEvent.UNMOUNTED, handleUnmounted);
@@ -53,7 +52,7 @@ var PrepareRendererPlugin = function () {
53
52
 
54
53
  _this.renderingContext.root.addEventListener(ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
55
54
  });
56
- renderingService.hooks.destroy.tap(PrepareRendererPlugin_1.tag, function () {
55
+ renderingService.emitter.on(RenderingServiceEvent.Destroy, function () {
57
56
  _this.renderingContext.root.removeEventListener(ElementEvent.MOUNTED, handleMounted);
58
57
 
59
58
  _this.renderingContext.root.removeEventListener(ElementEvent.UNMOUNTED, handleUnmounted);
@@ -64,12 +63,11 @@ var PrepareRendererPlugin = function () {
64
63
  });
65
64
  };
66
65
 
67
- var PrepareRendererPlugin_1;
68
66
  PrepareRendererPlugin.tag = 'PrepareRendererPlugin';
69
67
 
70
68
  __decorate([inject(RenderingContext), __metadata("design:type", Object)], PrepareRendererPlugin.prototype, "renderingContext", void 0);
71
69
 
72
- PrepareRendererPlugin = PrepareRendererPlugin_1 = __decorate([injectable()], PrepareRendererPlugin);
70
+ PrepareRendererPlugin = __decorate([injectable()], PrepareRendererPlugin);
73
71
  return PrepareRendererPlugin;
74
72
  }();
75
73
 
@@ -4,7 +4,7 @@ import { CanvasConfig } from '../types';
4
4
  import type { FederatedEvent } from '../dom/FederatedEvent';
5
5
  import { IEventTarget } from '../dom/interfaces';
6
6
  import { PointLike } from '../shapes';
7
- declare type Picker = (position: EventPosition) => IEventTarget | null;
7
+ declare type Picker = (position: EventPosition) => Promise<IEventTarget | null>;
8
8
  export declare class EventService extends EventEmitter {
9
9
  private renderingContext;
10
10
  private contextService;
@@ -21,19 +21,19 @@ export declare class EventService extends EventEmitter {
21
21
  viewport2Canvas({ x, y }: PointLike): PointLike;
22
22
  canvas2Viewport(canvasP: PointLike): PointLike;
23
23
  setPickHandler(pickHandler: Picker): void;
24
- addEventMapping(type: string, fn: (e: FederatedEvent) => void): void;
24
+ addEventMapping(type: string, fn: (e: FederatedEvent) => Promise<void>): void;
25
25
  mapEvent(e: FederatedEvent): void;
26
- onPointerDown: (from: FederatedEvent) => void;
27
- onPointerUp: (from: FederatedEvent) => void;
28
- onPointerMove: (from: FederatedEvent) => void;
29
- onPointerOut: (from: FederatedEvent) => void;
30
- onPointerOver: (from: FederatedEvent) => void;
31
- onPointerUpOutside: (from: FederatedEvent) => void;
32
- onWheel: (from: FederatedEvent) => void;
26
+ onPointerDown: (from: FederatedEvent) => Promise<void>;
27
+ onPointerUp: (from: FederatedEvent) => Promise<void>;
28
+ onPointerMove: (from: FederatedEvent) => Promise<void>;
29
+ onPointerOut: (from: FederatedEvent) => Promise<void>;
30
+ onPointerOver: (from: FederatedEvent) => Promise<void>;
31
+ onPointerUpOutside: (from: FederatedEvent) => Promise<void>;
32
+ onWheel: (from: FederatedEvent) => Promise<void>;
33
33
  dispatchEvent(e: FederatedEvent, type?: string): void;
34
34
  propagate(e: FederatedEvent, type?: string): void;
35
35
  propagationPath(target: IEventTarget): IEventTarget[];
36
- hitTest(position: EventPosition): IEventTarget | null;
36
+ hitTest(position: EventPosition): Promise<IEventTarget | null>;
37
37
  private createPointerEvent;
38
38
  private createWheelEvent;
39
39
  private trackingData;