@antv/g 5.0.23-alpha.15 → 5.0.23-alpha.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.umd.min.js +3 -3
- package/es/css/interfaces.d.ts +1 -1
- package/es/dom/Document.js +2 -2
- package/es/plugins/CullingPlugin.d.ts +1 -0
- package/es/plugins/CullingPlugin.js +8 -3
- package/es/plugins/DirtyCheckPlugin.d.ts +1 -0
- package/es/plugins/DirtyCheckPlugin.js +7 -2
- package/es/plugins/EventPlugin.d.ts +1 -0
- package/es/plugins/EventPlugin.js +14 -9
- package/es/plugins/PrepareRendererPlugin.d.ts +1 -0
- package/es/plugins/PrepareRendererPlugin.js +8 -3
- package/es/services/RenderingService.d.ts +17 -17
- package/es/services/RenderingService.js +23 -20
- package/es/utils/index.d.ts +0 -1
- package/es/utils/index.js +1 -2
- package/lib/css/interfaces.d.ts +1 -1
- package/lib/dom/Document.js +2 -2
- package/lib/plugins/CullingPlugin.d.ts +1 -0
- package/lib/plugins/CullingPlugin.js +7 -3
- package/lib/plugins/DirtyCheckPlugin.d.ts +1 -0
- package/lib/plugins/DirtyCheckPlugin.js +6 -2
- package/lib/plugins/EventPlugin.d.ts +1 -0
- package/lib/plugins/EventPlugin.js +13 -9
- package/lib/plugins/PrepareRendererPlugin.d.ts +1 -0
- package/lib/plugins/PrepareRendererPlugin.js +7 -3
- package/lib/services/RenderingService.d.ts +17 -17
- package/lib/services/RenderingService.js +23 -20
- package/lib/utils/index.d.ts +0 -1
- package/lib/utils/index.js +0 -13
- package/package.json +4 -3
package/es/css/interfaces.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import { Syringe } from 'mana-syringe';
|
|
|
2
2
|
import type { DisplayObject } from '../display-objects';
|
|
3
3
|
export declare const StyleValueRegistry: Syringe.DefinedToken;
|
|
4
4
|
export interface StyleValueRegistry {
|
|
5
|
-
recalc(displayObject: DisplayObject)
|
|
5
|
+
recalc: (displayObject: DisplayObject) => void;
|
|
6
6
|
}
|
package/es/dom/Document.js
CHANGED
|
@@ -146,7 +146,7 @@ function (_super) {
|
|
|
146
146
|
}), clientX = _c.x, clientY = _c.y;
|
|
147
147
|
return [4
|
|
148
148
|
/*yield*/
|
|
149
|
-
, this.defaultView.getRenderingService().hooks.pick.
|
|
149
|
+
, this.defaultView.getRenderingService().hooks.pick.promise({
|
|
150
150
|
topmost: true,
|
|
151
151
|
position: {
|
|
152
152
|
x: x,
|
|
@@ -200,7 +200,7 @@ function (_super) {
|
|
|
200
200
|
}), clientX = _c.x, clientY = _c.y;
|
|
201
201
|
return [4
|
|
202
202
|
/*yield*/
|
|
203
|
-
, this.defaultView.getRenderingService().hooks.pick.
|
|
203
|
+
, this.defaultView.getRenderingService().hooks.pick.promise({
|
|
204
204
|
topmost: false,
|
|
205
205
|
position: {
|
|
206
206
|
x: x,
|
|
@@ -11,6 +11,7 @@ export interface CullingStrategyContribution {
|
|
|
11
11
|
* 2. other custom culling strategies, eg. frustum culling
|
|
12
12
|
*/
|
|
13
13
|
export declare class CullingPlugin implements RenderingPlugin {
|
|
14
|
+
static tag: string;
|
|
14
15
|
private strategyProvider;
|
|
15
16
|
apply(renderingService: RenderingService): void;
|
|
16
17
|
}
|
|
@@ -13,9 +13,11 @@ var CullingPlugin =
|
|
|
13
13
|
function () {
|
|
14
14
|
function CullingPlugin() {}
|
|
15
15
|
|
|
16
|
+
CullingPlugin_1 = CullingPlugin;
|
|
17
|
+
|
|
16
18
|
CullingPlugin.prototype.apply = function (renderingService) {
|
|
17
19
|
var strategies = this.strategyProvider.getContributions();
|
|
18
|
-
renderingService.hooks.cull.tap(function (object) {
|
|
20
|
+
renderingService.hooks.cull.tap(CullingPlugin_1.tag, function (object) {
|
|
19
21
|
if (object) {
|
|
20
22
|
var cullable = object.cullable;
|
|
21
23
|
|
|
@@ -37,14 +39,17 @@ function () {
|
|
|
37
39
|
|
|
38
40
|
return object;
|
|
39
41
|
});
|
|
40
|
-
renderingService.hooks.afterRender.tap(function (object) {
|
|
42
|
+
renderingService.hooks.afterRender.tap(CullingPlugin_1.tag, function (object) {
|
|
41
43
|
object.cullable.visibilityPlaneMask = -1;
|
|
42
44
|
});
|
|
43
45
|
};
|
|
44
46
|
|
|
47
|
+
var CullingPlugin_1;
|
|
48
|
+
CullingPlugin.tag = 'Culling';
|
|
49
|
+
|
|
45
50
|
__decorate([contrib(CullingStrategyContribution), __metadata("design:type", Object)], CullingPlugin.prototype, "strategyProvider", void 0);
|
|
46
51
|
|
|
47
|
-
CullingPlugin = __decorate([singleton({
|
|
52
|
+
CullingPlugin = CullingPlugin_1 = __decorate([singleton({
|
|
48
53
|
contrib: RenderingPluginContribution
|
|
49
54
|
})], CullingPlugin);
|
|
50
55
|
return CullingPlugin;
|
|
@@ -3,6 +3,7 @@ import type { RenderingService, RenderingPlugin } from '../services/RenderingSer
|
|
|
3
3
|
* Filter dirty renderables and calculate the "dirty rectangle" which will be clear when frame began
|
|
4
4
|
*/
|
|
5
5
|
export declare class DirtyCheckPlugin implements RenderingPlugin {
|
|
6
|
+
static tag: string;
|
|
6
7
|
private canvasConfig;
|
|
7
8
|
private renderingContext;
|
|
8
9
|
apply(renderingService: RenderingService): void;
|
|
@@ -12,10 +12,12 @@ var DirtyCheckPlugin =
|
|
|
12
12
|
function () {
|
|
13
13
|
function DirtyCheckPlugin() {}
|
|
14
14
|
|
|
15
|
+
DirtyCheckPlugin_1 = DirtyCheckPlugin;
|
|
16
|
+
|
|
15
17
|
DirtyCheckPlugin.prototype.apply = function (renderingService) {
|
|
16
18
|
var _this = this;
|
|
17
19
|
|
|
18
|
-
renderingService.hooks.dirtycheck.tap(function (object) {
|
|
20
|
+
renderingService.hooks.dirtycheck.tap(DirtyCheckPlugin_1.tag, function (object) {
|
|
19
21
|
if (object) {
|
|
20
22
|
var enableDirtyCheck = _this.canvasConfig.renderer.getConfig().enableDirtyCheck;
|
|
21
23
|
|
|
@@ -37,11 +39,14 @@ function () {
|
|
|
37
39
|
});
|
|
38
40
|
};
|
|
39
41
|
|
|
42
|
+
var DirtyCheckPlugin_1;
|
|
43
|
+
DirtyCheckPlugin.tag = 'DirtyCheck';
|
|
44
|
+
|
|
40
45
|
__decorate([inject(CanvasConfig), __metadata("design:type", Object)], DirtyCheckPlugin.prototype, "canvasConfig", void 0);
|
|
41
46
|
|
|
42
47
|
__decorate([inject(RenderingContext), __metadata("design:type", Object)], DirtyCheckPlugin.prototype, "renderingContext", void 0);
|
|
43
48
|
|
|
44
|
-
DirtyCheckPlugin = __decorate([singleton({
|
|
49
|
+
DirtyCheckPlugin = DirtyCheckPlugin_1 = __decorate([singleton({
|
|
45
50
|
contrib: RenderingPluginContribution
|
|
46
51
|
})], DirtyCheckPlugin);
|
|
47
52
|
return DirtyCheckPlugin;
|
|
@@ -7,6 +7,7 @@ import { RenderingService } from '../services';
|
|
|
7
7
|
* also provide some extra events such as `drag`
|
|
8
8
|
*/
|
|
9
9
|
export declare class EventPlugin implements RenderingPlugin {
|
|
10
|
+
static tag: string;
|
|
10
11
|
private canvasConfig;
|
|
11
12
|
private contextService;
|
|
12
13
|
private renderingService;
|
|
@@ -41,6 +41,8 @@ function () {
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
EventPlugin_1 = EventPlugin;
|
|
45
|
+
|
|
44
46
|
EventPlugin.prototype.apply = function (renderingService) {
|
|
45
47
|
var _this = this;
|
|
46
48
|
|
|
@@ -53,7 +55,7 @@ function () {
|
|
|
53
55
|
case 0:
|
|
54
56
|
return [4
|
|
55
57
|
/*yield*/
|
|
56
|
-
, this.renderingService.hooks.pick.
|
|
58
|
+
, this.renderingService.hooks.pick.promise({
|
|
57
59
|
position: position,
|
|
58
60
|
picked: [],
|
|
59
61
|
topmost: true // we only concern the topmost element
|
|
@@ -69,12 +71,12 @@ function () {
|
|
|
69
71
|
});
|
|
70
72
|
});
|
|
71
73
|
});
|
|
72
|
-
renderingService.hooks.pointerWheel.tap(function (nativeEvent) {
|
|
74
|
+
renderingService.hooks.pointerWheel.tap(EventPlugin_1.tag, function (nativeEvent) {
|
|
73
75
|
var wheelEvent = _this.normalizeWheelEvent(nativeEvent);
|
|
74
76
|
|
|
75
77
|
_this.eventService.mapEvent(wheelEvent);
|
|
76
78
|
});
|
|
77
|
-
renderingService.hooks.pointerDown.tap(function (nativeEvent) {
|
|
79
|
+
renderingService.hooks.pointerDown.tap(EventPlugin_1.tag, function (nativeEvent) {
|
|
78
80
|
if (canvas.supportTouchEvent && nativeEvent.pointerType === 'touch') {
|
|
79
81
|
return;
|
|
80
82
|
}
|
|
@@ -95,7 +97,7 @@ function () {
|
|
|
95
97
|
|
|
96
98
|
_this.setCursor(_this.eventService.cursor);
|
|
97
99
|
});
|
|
98
|
-
renderingService.hooks.pointerUp.tap(function (nativeEvent) {
|
|
100
|
+
renderingService.hooks.pointerUp.tap(EventPlugin_1.tag, function (nativeEvent) {
|
|
99
101
|
if (canvas.supportTouchEvent && nativeEvent.pointerType === 'touch') return; // account for element in SVG
|
|
100
102
|
|
|
101
103
|
var $element = _this.contextService.getDomElement();
|
|
@@ -114,10 +116,10 @@ function () {
|
|
|
114
116
|
|
|
115
117
|
_this.setCursor(_this.eventService.cursor);
|
|
116
118
|
});
|
|
117
|
-
renderingService.hooks.pointerMove.tap(this.onPointerMove);
|
|
118
|
-
renderingService.hooks.pointerOver.tap(this.onPointerMove);
|
|
119
|
-
renderingService.hooks.pointerOut.tap(this.onPointerMove);
|
|
120
|
-
renderingService.hooks.pointerCancel.tap(function (nativeEvent) {
|
|
119
|
+
renderingService.hooks.pointerMove.tap(EventPlugin_1.tag, this.onPointerMove);
|
|
120
|
+
renderingService.hooks.pointerOver.tap(EventPlugin_1.tag, this.onPointerMove);
|
|
121
|
+
renderingService.hooks.pointerOut.tap(EventPlugin_1.tag, this.onPointerMove);
|
|
122
|
+
renderingService.hooks.pointerCancel.tap(EventPlugin_1.tag, function (nativeEvent) {
|
|
121
123
|
if (canvas.supportTouchEvent && nativeEvent.pointerType === 'touch') {
|
|
122
124
|
return;
|
|
123
125
|
}
|
|
@@ -350,6 +352,9 @@ function () {
|
|
|
350
352
|
}
|
|
351
353
|
};
|
|
352
354
|
|
|
355
|
+
var EventPlugin_1;
|
|
356
|
+
EventPlugin.tag = 'Event';
|
|
357
|
+
|
|
353
358
|
__decorate([inject(CanvasConfig), __metadata("design:type", Object)], EventPlugin.prototype, "canvasConfig", void 0);
|
|
354
359
|
|
|
355
360
|
__decorate([inject(ContextService), __metadata("design:type", Object)], EventPlugin.prototype, "contextService", void 0);
|
|
@@ -360,7 +365,7 @@ function () {
|
|
|
360
365
|
|
|
361
366
|
__decorate([inject(EventService), __metadata("design:type", EventService)], EventPlugin.prototype, "eventService", void 0);
|
|
362
367
|
|
|
363
|
-
EventPlugin = __decorate([singleton({
|
|
368
|
+
EventPlugin = EventPlugin_1 = __decorate([singleton({
|
|
364
369
|
contrib: RenderingPluginContribution
|
|
365
370
|
})], EventPlugin);
|
|
366
371
|
return EventPlugin;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { RenderingService, RenderingPlugin } from '../services';
|
|
2
2
|
export declare class PrepareRendererPlugin implements RenderingPlugin {
|
|
3
|
+
static tag: string;
|
|
3
4
|
private renderingContext;
|
|
4
5
|
private styleValueRegistry;
|
|
5
6
|
apply(renderingService: RenderingService): void;
|
|
@@ -9,6 +9,8 @@ var PrepareRendererPlugin =
|
|
|
9
9
|
function () {
|
|
10
10
|
function PrepareRendererPlugin() {}
|
|
11
11
|
|
|
12
|
+
PrepareRendererPlugin_1 = PrepareRendererPlugin;
|
|
13
|
+
|
|
12
14
|
PrepareRendererPlugin.prototype.apply = function (renderingService) {
|
|
13
15
|
var _this = this;
|
|
14
16
|
|
|
@@ -37,7 +39,7 @@ function () {
|
|
|
37
39
|
renderingService.dirtify();
|
|
38
40
|
};
|
|
39
41
|
|
|
40
|
-
renderingService.hooks.init.tapPromise(function () {
|
|
42
|
+
renderingService.hooks.init.tapPromise(PrepareRendererPlugin_1.tag, function () {
|
|
41
43
|
return __awaiter(_this, void 0, void 0, function () {
|
|
42
44
|
return __generator(this, function (_a) {
|
|
43
45
|
this.renderingContext.root.addEventListener(ElementEvent.MOUNTED, handleMounted);
|
|
@@ -50,7 +52,7 @@ function () {
|
|
|
50
52
|
});
|
|
51
53
|
});
|
|
52
54
|
});
|
|
53
|
-
renderingService.hooks.destroy.tap(function () {
|
|
55
|
+
renderingService.hooks.destroy.tap(PrepareRendererPlugin_1.tag, function () {
|
|
54
56
|
_this.renderingContext.root.removeEventListener(ElementEvent.MOUNTED, handleMounted);
|
|
55
57
|
|
|
56
58
|
_this.renderingContext.root.removeEventListener(ElementEvent.UNMOUNTED, handleUnmounted);
|
|
@@ -61,11 +63,14 @@ function () {
|
|
|
61
63
|
});
|
|
62
64
|
};
|
|
63
65
|
|
|
66
|
+
var PrepareRendererPlugin_1;
|
|
67
|
+
PrepareRendererPlugin.tag = 'Prepare';
|
|
68
|
+
|
|
64
69
|
__decorate([inject(RenderingContext), __metadata("design:type", Object)], PrepareRendererPlugin.prototype, "renderingContext", void 0);
|
|
65
70
|
|
|
66
71
|
__decorate([inject(StyleValueRegistry), __metadata("design:type", Object)], PrepareRendererPlugin.prototype, "styleValueRegistry", void 0);
|
|
67
72
|
|
|
68
|
-
PrepareRendererPlugin = __decorate([singleton({
|
|
73
|
+
PrepareRendererPlugin = PrepareRendererPlugin_1 = __decorate([singleton({
|
|
69
74
|
contrib: RenderingPluginContribution
|
|
70
75
|
})], PrepareRendererPlugin);
|
|
71
76
|
return PrepareRendererPlugin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Syringe } from 'mana-syringe';
|
|
2
|
-
import { SyncHook, SyncWaterfallHook, AsyncParallelHook, AsyncSeriesWaterfallHook } from '
|
|
2
|
+
import { SyncHook, SyncWaterfallHook, AsyncParallelHook, AsyncSeriesWaterfallHook } from 'tapable';
|
|
3
3
|
import type { DisplayObject } from '../display-objects';
|
|
4
4
|
import type { CanvasConfig, EventPosition, InteractivePointerEvent } from '../types';
|
|
5
5
|
export interface RenderingPlugin {
|
|
@@ -38,33 +38,33 @@ export declare class RenderingService {
|
|
|
38
38
|
/**
|
|
39
39
|
* called before any frame rendered
|
|
40
40
|
*/
|
|
41
|
-
init: AsyncParallelHook<[],
|
|
41
|
+
init: AsyncParallelHook<[], import("tapable").UnsetAdditionalOptions>;
|
|
42
42
|
/**
|
|
43
43
|
* only dirty object which has sth changed will be rendered
|
|
44
44
|
*/
|
|
45
|
-
dirtycheck: SyncWaterfallHook<[DisplayObject<any, any>],
|
|
45
|
+
dirtycheck: SyncWaterfallHook<[DisplayObject<any, any>], import("tapable").UnsetAdditionalOptions>;
|
|
46
46
|
/**
|
|
47
47
|
* do culling
|
|
48
48
|
*/
|
|
49
|
-
cull: SyncWaterfallHook<[DisplayObject<any, any>],
|
|
49
|
+
cull: SyncWaterfallHook<[DisplayObject<any, any>], import("tapable").UnsetAdditionalOptions>;
|
|
50
50
|
/**
|
|
51
51
|
* called at beginning of each frame, won't get called if nothing to re-render
|
|
52
52
|
*/
|
|
53
|
-
beginFrame: SyncHook<[], void>;
|
|
53
|
+
beginFrame: SyncHook<[], void, import("tapable").UnsetAdditionalOptions>;
|
|
54
54
|
/**
|
|
55
55
|
* called before every dirty object get rendered
|
|
56
56
|
*/
|
|
57
|
-
beforeRender: SyncHook<[DisplayObject<any, any>], void>;
|
|
57
|
+
beforeRender: SyncHook<[DisplayObject<any, any>], void, import("tapable").UnsetAdditionalOptions>;
|
|
58
58
|
/**
|
|
59
59
|
* called when every dirty object rendering even it's culled
|
|
60
60
|
*/
|
|
61
|
-
render: SyncHook<[DisplayObject<any, any>], void>;
|
|
61
|
+
render: SyncHook<[DisplayObject<any, any>], void, import("tapable").UnsetAdditionalOptions>;
|
|
62
62
|
/**
|
|
63
63
|
* called after every dirty object get rendered
|
|
64
64
|
*/
|
|
65
|
-
afterRender: SyncHook<[DisplayObject<any, any>], void>;
|
|
66
|
-
endFrame: SyncHook<[], void>;
|
|
67
|
-
destroy: SyncHook<[], void>;
|
|
65
|
+
afterRender: SyncHook<[DisplayObject<any, any>], void, import("tapable").UnsetAdditionalOptions>;
|
|
66
|
+
endFrame: SyncHook<[], void, import("tapable").UnsetAdditionalOptions>;
|
|
67
|
+
destroy: SyncHook<[], void, import("tapable").UnsetAdditionalOptions>;
|
|
68
68
|
/**
|
|
69
69
|
* use async but faster method such as GPU-based picking in `g-plugin-webgl-renderer`
|
|
70
70
|
*/
|
|
@@ -72,13 +72,13 @@ export declare class RenderingService {
|
|
|
72
72
|
/**
|
|
73
73
|
* used in event system
|
|
74
74
|
*/
|
|
75
|
-
pointerDown: SyncHook<[InteractivePointerEvent], void>;
|
|
76
|
-
pointerUp: SyncHook<[InteractivePointerEvent], void>;
|
|
77
|
-
pointerMove: SyncHook<[InteractivePointerEvent], void>;
|
|
78
|
-
pointerOut: SyncHook<[InteractivePointerEvent], void>;
|
|
79
|
-
pointerOver: SyncHook<[InteractivePointerEvent], void>;
|
|
80
|
-
|
|
81
|
-
|
|
75
|
+
pointerDown: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
|
|
76
|
+
pointerUp: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
|
|
77
|
+
pointerMove: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
|
|
78
|
+
pointerOut: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
|
|
79
|
+
pointerOver: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
|
|
80
|
+
pointerWheel: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
|
|
81
|
+
pointerCancel: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
|
|
82
82
|
};
|
|
83
83
|
init(): Promise<void>;
|
|
84
84
|
getStats(): {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __awaiter, __decorate, __generator, __metadata } from "tslib";
|
|
2
|
-
import { inject, singleton, contrib, Syringe, Contribution } from 'mana-syringe';
|
|
3
|
-
|
|
2
|
+
import { inject, singleton, contrib, Syringe, Contribution } from 'mana-syringe'; // import { SyncHook, SyncWaterfallHook, AsyncParallelHook, AsyncSeriesWaterfallHook } from '../utils';
|
|
3
|
+
|
|
4
|
+
import { SyncHook, SyncWaterfallHook, AsyncParallelHook, AsyncSeriesWaterfallHook } from 'tapable';
|
|
4
5
|
import { StyleValueRegistry } from '../css/interfaces';
|
|
5
6
|
import { ElementEvent } from '../dom';
|
|
6
7
|
import { RenderingContext, RenderReason } from './RenderingContext';
|
|
@@ -47,50 +48,50 @@ function () {
|
|
|
47
48
|
/**
|
|
48
49
|
* only dirty object which has sth changed will be rendered
|
|
49
50
|
*/
|
|
50
|
-
dirtycheck: new SyncWaterfallHook(),
|
|
51
|
+
dirtycheck: new SyncWaterfallHook(['object']),
|
|
51
52
|
|
|
52
53
|
/**
|
|
53
54
|
* do culling
|
|
54
55
|
*/
|
|
55
|
-
cull: new SyncWaterfallHook(),
|
|
56
|
+
cull: new SyncWaterfallHook(['object']),
|
|
56
57
|
|
|
57
58
|
/**
|
|
58
59
|
* called at beginning of each frame, won't get called if nothing to re-render
|
|
59
60
|
*/
|
|
60
|
-
beginFrame: new SyncHook(),
|
|
61
|
+
beginFrame: new SyncHook([]),
|
|
61
62
|
|
|
62
63
|
/**
|
|
63
64
|
* called before every dirty object get rendered
|
|
64
65
|
*/
|
|
65
|
-
beforeRender: new SyncHook(),
|
|
66
|
+
beforeRender: new SyncHook(['objectToRender']),
|
|
66
67
|
|
|
67
68
|
/**
|
|
68
69
|
* called when every dirty object rendering even it's culled
|
|
69
70
|
*/
|
|
70
|
-
render: new SyncHook(),
|
|
71
|
+
render: new SyncHook(['objectToRender']),
|
|
71
72
|
|
|
72
73
|
/**
|
|
73
74
|
* called after every dirty object get rendered
|
|
74
75
|
*/
|
|
75
|
-
afterRender: new SyncHook(),
|
|
76
|
-
endFrame: new SyncHook(),
|
|
77
|
-
destroy: new SyncHook(),
|
|
76
|
+
afterRender: new SyncHook(['objectToRender']),
|
|
77
|
+
endFrame: new SyncHook([]),
|
|
78
|
+
destroy: new SyncHook([]),
|
|
78
79
|
|
|
79
80
|
/**
|
|
80
81
|
* use async but faster method such as GPU-based picking in `g-plugin-webgl-renderer`
|
|
81
82
|
*/
|
|
82
|
-
pick: new AsyncSeriesWaterfallHook(),
|
|
83
|
+
pick: new AsyncSeriesWaterfallHook(['result']),
|
|
83
84
|
|
|
84
85
|
/**
|
|
85
86
|
* used in event system
|
|
86
87
|
*/
|
|
87
|
-
pointerDown: new SyncHook(),
|
|
88
|
-
pointerUp: new SyncHook(),
|
|
89
|
-
pointerMove: new SyncHook(),
|
|
90
|
-
pointerOut: new SyncHook(),
|
|
91
|
-
pointerOver: new SyncHook(),
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
pointerDown: new SyncHook(['event']),
|
|
89
|
+
pointerUp: new SyncHook(['event']),
|
|
90
|
+
pointerMove: new SyncHook(['event']),
|
|
91
|
+
pointerOut: new SyncHook(['event']),
|
|
92
|
+
pointerOver: new SyncHook(['event']),
|
|
93
|
+
pointerWheel: new SyncHook(['event']),
|
|
94
|
+
pointerCancel: new SyncHook(['event'])
|
|
94
95
|
};
|
|
95
96
|
}
|
|
96
97
|
|
|
@@ -106,12 +107,14 @@ function () {
|
|
|
106
107
|
cache: false
|
|
107
108
|
}).forEach(function (plugin) {
|
|
108
109
|
plugin.apply(_this);
|
|
109
|
-
});
|
|
110
|
+
}); // await this.hooks.init.callPromise();
|
|
111
|
+
|
|
110
112
|
return [4
|
|
111
113
|
/*yield*/
|
|
112
|
-
, this.hooks.init.
|
|
114
|
+
, this.hooks.init.promise()];
|
|
113
115
|
|
|
114
116
|
case 1:
|
|
117
|
+
// await this.hooks.init.callPromise();
|
|
115
118
|
_a.sent();
|
|
116
119
|
|
|
117
120
|
this.inited = true;
|
package/es/utils/index.d.ts
CHANGED
package/es/utils/index.js
CHANGED
package/lib/css/interfaces.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import { Syringe } from 'mana-syringe';
|
|
|
2
2
|
import type { DisplayObject } from '../display-objects';
|
|
3
3
|
export declare const StyleValueRegistry: Syringe.DefinedToken;
|
|
4
4
|
export interface StyleValueRegistry {
|
|
5
|
-
recalc(displayObject: DisplayObject)
|
|
5
|
+
recalc: (displayObject: DisplayObject) => void;
|
|
6
6
|
}
|
package/lib/dom/Document.js
CHANGED
|
@@ -159,7 +159,7 @@ function (_super) {
|
|
|
159
159
|
}), clientX = _c.x, clientY = _c.y;
|
|
160
160
|
return [4
|
|
161
161
|
/*yield*/
|
|
162
|
-
, this.defaultView.getRenderingService().hooks.pick.
|
|
162
|
+
, this.defaultView.getRenderingService().hooks.pick.promise({
|
|
163
163
|
topmost: true,
|
|
164
164
|
position: {
|
|
165
165
|
x: x,
|
|
@@ -213,7 +213,7 @@ function (_super) {
|
|
|
213
213
|
}), clientX = _c.x, clientY = _c.y;
|
|
214
214
|
return [4
|
|
215
215
|
/*yield*/
|
|
216
|
-
, this.defaultView.getRenderingService().hooks.pick.
|
|
216
|
+
, this.defaultView.getRenderingService().hooks.pick.promise({
|
|
217
217
|
topmost: false,
|
|
218
218
|
position: {
|
|
219
219
|
x: x,
|
|
@@ -11,6 +11,7 @@ export interface CullingStrategyContribution {
|
|
|
11
11
|
* 2. other custom culling strategies, eg. frustum culling
|
|
12
12
|
*/
|
|
13
13
|
export declare class CullingPlugin implements RenderingPlugin {
|
|
14
|
+
static tag: string;
|
|
14
15
|
private strategyProvider;
|
|
15
16
|
apply(renderingService: RenderingService): void;
|
|
16
17
|
}
|
|
@@ -26,9 +26,11 @@ var CullingPlugin =
|
|
|
26
26
|
function () {
|
|
27
27
|
function CullingPlugin() {}
|
|
28
28
|
|
|
29
|
+
CullingPlugin_1 = CullingPlugin;
|
|
30
|
+
|
|
29
31
|
CullingPlugin.prototype.apply = function (renderingService) {
|
|
30
32
|
var strategies = this.strategyProvider.getContributions();
|
|
31
|
-
renderingService.hooks.cull.tap(function (object) {
|
|
33
|
+
renderingService.hooks.cull.tap(CullingPlugin_1.tag, function (object) {
|
|
32
34
|
if (object) {
|
|
33
35
|
var cullable = object.cullable;
|
|
34
36
|
|
|
@@ -50,13 +52,15 @@ function () {
|
|
|
50
52
|
|
|
51
53
|
return object;
|
|
52
54
|
});
|
|
53
|
-
renderingService.hooks.afterRender.tap(function (object) {
|
|
55
|
+
renderingService.hooks.afterRender.tap(CullingPlugin_1.tag, function (object) {
|
|
54
56
|
object.cullable.visibilityPlaneMask = -1;
|
|
55
57
|
});
|
|
56
58
|
};
|
|
57
59
|
|
|
60
|
+
var CullingPlugin_1;
|
|
61
|
+
CullingPlugin.tag = 'Culling';
|
|
58
62
|
(0, _tslib.__decorate)([(0, _manaSyringe.contrib)(CullingStrategyContribution), (0, _tslib.__metadata)("design:type", Object)], CullingPlugin.prototype, "strategyProvider", void 0);
|
|
59
|
-
CullingPlugin = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
|
|
63
|
+
CullingPlugin = CullingPlugin_1 = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
|
|
60
64
|
contrib: _RenderingService.RenderingPluginContribution
|
|
61
65
|
})], CullingPlugin);
|
|
62
66
|
return CullingPlugin;
|
|
@@ -3,6 +3,7 @@ import type { RenderingService, RenderingPlugin } from '../services/RenderingSer
|
|
|
3
3
|
* Filter dirty renderables and calculate the "dirty rectangle" which will be clear when frame began
|
|
4
4
|
*/
|
|
5
5
|
export declare class DirtyCheckPlugin implements RenderingPlugin {
|
|
6
|
+
static tag: string;
|
|
6
7
|
private canvasConfig;
|
|
7
8
|
private renderingContext;
|
|
8
9
|
apply(renderingService: RenderingService): void;
|
|
@@ -23,10 +23,12 @@ var DirtyCheckPlugin =
|
|
|
23
23
|
function () {
|
|
24
24
|
function DirtyCheckPlugin() {}
|
|
25
25
|
|
|
26
|
+
DirtyCheckPlugin_1 = DirtyCheckPlugin;
|
|
27
|
+
|
|
26
28
|
DirtyCheckPlugin.prototype.apply = function (renderingService) {
|
|
27
29
|
var _this = this;
|
|
28
30
|
|
|
29
|
-
renderingService.hooks.dirtycheck.tap(function (object) {
|
|
31
|
+
renderingService.hooks.dirtycheck.tap(DirtyCheckPlugin_1.tag, function (object) {
|
|
30
32
|
if (object) {
|
|
31
33
|
var enableDirtyCheck = _this.canvasConfig.renderer.getConfig().enableDirtyCheck;
|
|
32
34
|
|
|
@@ -48,9 +50,11 @@ function () {
|
|
|
48
50
|
});
|
|
49
51
|
};
|
|
50
52
|
|
|
53
|
+
var DirtyCheckPlugin_1;
|
|
54
|
+
DirtyCheckPlugin.tag = 'DirtyCheck';
|
|
51
55
|
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_types.CanvasConfig), (0, _tslib.__metadata)("design:type", Object)], DirtyCheckPlugin.prototype, "canvasConfig", void 0);
|
|
52
56
|
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_RenderingContext.RenderingContext), (0, _tslib.__metadata)("design:type", Object)], DirtyCheckPlugin.prototype, "renderingContext", void 0);
|
|
53
|
-
DirtyCheckPlugin = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
|
|
57
|
+
DirtyCheckPlugin = DirtyCheckPlugin_1 = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
|
|
54
58
|
contrib: _RenderingService.RenderingPluginContribution
|
|
55
59
|
})], DirtyCheckPlugin);
|
|
56
60
|
return DirtyCheckPlugin;
|
|
@@ -7,6 +7,7 @@ import { RenderingService } from '../services';
|
|
|
7
7
|
* also provide some extra events such as `drag`
|
|
8
8
|
*/
|
|
9
9
|
export declare class EventPlugin implements RenderingPlugin {
|
|
10
|
+
static tag: string;
|
|
10
11
|
private canvasConfig;
|
|
11
12
|
private contextService;
|
|
12
13
|
private renderingService;
|
|
@@ -55,6 +55,8 @@ function () {
|
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
EventPlugin_1 = EventPlugin;
|
|
59
|
+
|
|
58
60
|
EventPlugin.prototype.apply = function (renderingService) {
|
|
59
61
|
var _this = this;
|
|
60
62
|
|
|
@@ -67,7 +69,7 @@ function () {
|
|
|
67
69
|
case 0:
|
|
68
70
|
return [4
|
|
69
71
|
/*yield*/
|
|
70
|
-
, this.renderingService.hooks.pick.
|
|
72
|
+
, this.renderingService.hooks.pick.promise({
|
|
71
73
|
position: position,
|
|
72
74
|
picked: [],
|
|
73
75
|
topmost: true // we only concern the topmost element
|
|
@@ -83,12 +85,12 @@ function () {
|
|
|
83
85
|
});
|
|
84
86
|
});
|
|
85
87
|
});
|
|
86
|
-
renderingService.hooks.pointerWheel.tap(function (nativeEvent) {
|
|
88
|
+
renderingService.hooks.pointerWheel.tap(EventPlugin_1.tag, function (nativeEvent) {
|
|
87
89
|
var wheelEvent = _this.normalizeWheelEvent(nativeEvent);
|
|
88
90
|
|
|
89
91
|
_this.eventService.mapEvent(wheelEvent);
|
|
90
92
|
});
|
|
91
|
-
renderingService.hooks.pointerDown.tap(function (nativeEvent) {
|
|
93
|
+
renderingService.hooks.pointerDown.tap(EventPlugin_1.tag, function (nativeEvent) {
|
|
92
94
|
if (canvas.supportTouchEvent && nativeEvent.pointerType === 'touch') {
|
|
93
95
|
return;
|
|
94
96
|
}
|
|
@@ -109,7 +111,7 @@ function () {
|
|
|
109
111
|
|
|
110
112
|
_this.setCursor(_this.eventService.cursor);
|
|
111
113
|
});
|
|
112
|
-
renderingService.hooks.pointerUp.tap(function (nativeEvent) {
|
|
114
|
+
renderingService.hooks.pointerUp.tap(EventPlugin_1.tag, function (nativeEvent) {
|
|
113
115
|
if (canvas.supportTouchEvent && nativeEvent.pointerType === 'touch') return; // account for element in SVG
|
|
114
116
|
|
|
115
117
|
var $element = _this.contextService.getDomElement();
|
|
@@ -128,10 +130,10 @@ function () {
|
|
|
128
130
|
|
|
129
131
|
_this.setCursor(_this.eventService.cursor);
|
|
130
132
|
});
|
|
131
|
-
renderingService.hooks.pointerMove.tap(this.onPointerMove);
|
|
132
|
-
renderingService.hooks.pointerOver.tap(this.onPointerMove);
|
|
133
|
-
renderingService.hooks.pointerOut.tap(this.onPointerMove);
|
|
134
|
-
renderingService.hooks.pointerCancel.tap(function (nativeEvent) {
|
|
133
|
+
renderingService.hooks.pointerMove.tap(EventPlugin_1.tag, this.onPointerMove);
|
|
134
|
+
renderingService.hooks.pointerOver.tap(EventPlugin_1.tag, this.onPointerMove);
|
|
135
|
+
renderingService.hooks.pointerOut.tap(EventPlugin_1.tag, this.onPointerMove);
|
|
136
|
+
renderingService.hooks.pointerCancel.tap(EventPlugin_1.tag, function (nativeEvent) {
|
|
135
137
|
if (canvas.supportTouchEvent && nativeEvent.pointerType === 'touch') {
|
|
136
138
|
return;
|
|
137
139
|
}
|
|
@@ -364,12 +366,14 @@ function () {
|
|
|
364
366
|
}
|
|
365
367
|
};
|
|
366
368
|
|
|
369
|
+
var EventPlugin_1;
|
|
370
|
+
EventPlugin.tag = 'Event';
|
|
367
371
|
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_types.CanvasConfig), (0, _tslib.__metadata)("design:type", Object)], EventPlugin.prototype, "canvasConfig", void 0);
|
|
368
372
|
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_services.ContextService), (0, _tslib.__metadata)("design:type", Object)], EventPlugin.prototype, "contextService", void 0);
|
|
369
373
|
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_services.RenderingService), (0, _tslib.__metadata)("design:type", _services.RenderingService)], EventPlugin.prototype, "renderingService", void 0);
|
|
370
374
|
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_services.RenderingContext), (0, _tslib.__metadata)("design:type", Object)], EventPlugin.prototype, "renderingContext", void 0);
|
|
371
375
|
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_services.EventService), (0, _tslib.__metadata)("design:type", _services.EventService)], EventPlugin.prototype, "eventService", void 0);
|
|
372
|
-
EventPlugin = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
|
|
376
|
+
EventPlugin = EventPlugin_1 = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
|
|
373
377
|
contrib: _services.RenderingPluginContribution
|
|
374
378
|
})], EventPlugin);
|
|
375
379
|
return EventPlugin;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { RenderingService, RenderingPlugin } from '../services';
|
|
2
2
|
export declare class PrepareRendererPlugin implements RenderingPlugin {
|
|
3
|
+
static tag: string;
|
|
3
4
|
private renderingContext;
|
|
4
5
|
private styleValueRegistry;
|
|
5
6
|
apply(renderingService: RenderingService): void;
|
|
@@ -20,6 +20,8 @@ var PrepareRendererPlugin =
|
|
|
20
20
|
function () {
|
|
21
21
|
function PrepareRendererPlugin() {}
|
|
22
22
|
|
|
23
|
+
PrepareRendererPlugin_1 = PrepareRendererPlugin;
|
|
24
|
+
|
|
23
25
|
PrepareRendererPlugin.prototype.apply = function (renderingService) {
|
|
24
26
|
var _this = this;
|
|
25
27
|
|
|
@@ -48,7 +50,7 @@ function () {
|
|
|
48
50
|
renderingService.dirtify();
|
|
49
51
|
};
|
|
50
52
|
|
|
51
|
-
renderingService.hooks.init.tapPromise(function () {
|
|
53
|
+
renderingService.hooks.init.tapPromise(PrepareRendererPlugin_1.tag, function () {
|
|
52
54
|
return (0, _tslib.__awaiter)(_this, void 0, void 0, function () {
|
|
53
55
|
return (0, _tslib.__generator)(this, function (_a) {
|
|
54
56
|
this.renderingContext.root.addEventListener(_dom.ElementEvent.MOUNTED, handleMounted);
|
|
@@ -61,7 +63,7 @@ function () {
|
|
|
61
63
|
});
|
|
62
64
|
});
|
|
63
65
|
});
|
|
64
|
-
renderingService.hooks.destroy.tap(function () {
|
|
66
|
+
renderingService.hooks.destroy.tap(PrepareRendererPlugin_1.tag, function () {
|
|
65
67
|
_this.renderingContext.root.removeEventListener(_dom.ElementEvent.MOUNTED, handleMounted);
|
|
66
68
|
|
|
67
69
|
_this.renderingContext.root.removeEventListener(_dom.ElementEvent.UNMOUNTED, handleUnmounted);
|
|
@@ -72,9 +74,11 @@ function () {
|
|
|
72
74
|
});
|
|
73
75
|
};
|
|
74
76
|
|
|
77
|
+
var PrepareRendererPlugin_1;
|
|
78
|
+
PrepareRendererPlugin.tag = 'Prepare';
|
|
75
79
|
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_services.RenderingContext), (0, _tslib.__metadata)("design:type", Object)], PrepareRendererPlugin.prototype, "renderingContext", void 0);
|
|
76
80
|
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_interfaces.StyleValueRegistry), (0, _tslib.__metadata)("design:type", Object)], PrepareRendererPlugin.prototype, "styleValueRegistry", void 0);
|
|
77
|
-
PrepareRendererPlugin = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
|
|
81
|
+
PrepareRendererPlugin = PrepareRendererPlugin_1 = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
|
|
78
82
|
contrib: _services.RenderingPluginContribution
|
|
79
83
|
})], PrepareRendererPlugin);
|
|
80
84
|
return PrepareRendererPlugin;
|