@antv/g 5.0.23-alpha.13 → 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/CSS.js +1 -1
- package/es/css/CSSProperty.d.ts +1 -1
- package/es/css/StyleValueRegistry.d.ts +2 -1
- package/es/css/StyleValueRegistry.js +23 -22
- package/es/css/index.d.ts +1 -0
- package/es/css/index.js +1 -0
- package/es/css/interfaces.d.ts +6 -0
- package/es/css/interfaces.js +2 -0
- package/es/css/properties/CSSPropertyColor.d.ts +1 -1
- package/es/css/properties/CSSPropertyLengthOrPercentage.d.ts +1 -1
- package/es/display-objects/DisplayObject.d.ts +1 -2
- package/es/display-objects/DisplayObject.js +1 -1
- package/es/dom/Document.js +2 -2
- package/es/global-module.js +4 -8
- 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 +10 -6
- package/es/services/RenderingService.d.ts +17 -17
- package/es/services/RenderingService.js +25 -22
- package/es/services/SceneGraphService.js +3 -1
- package/es/utils/index.d.ts +0 -1
- package/es/utils/index.js +1 -2
- package/es/utils/interpolation.js +1 -1
- package/lib/css/CSS.js +2 -2
- package/lib/css/CSSProperty.d.ts +1 -1
- package/lib/css/StyleValueRegistry.d.ts +2 -1
- package/lib/css/StyleValueRegistry.js +25 -24
- package/lib/css/index.d.ts +1 -0
- package/lib/css/index.js +13 -0
- package/lib/css/interfaces.d.ts +6 -0
- package/lib/css/interfaces.js +12 -0
- package/lib/css/properties/CSSPropertyColor.d.ts +1 -1
- package/lib/css/properties/CSSPropertyLengthOrPercentage.d.ts +1 -1
- package/lib/display-objects/DisplayObject.d.ts +1 -2
- package/lib/display-objects/DisplayObject.js +2 -2
- package/lib/dom/Document.js +2 -2
- package/lib/global-module.js +2 -6
- 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 +9 -6
- package/lib/services/RenderingService.d.ts +17 -17
- package/lib/services/RenderingService.js +25 -22
- package/lib/services/SceneGraphService.js +3 -1
- package/lib/utils/index.d.ts +0 -1
- package/lib/utils/index.js +0 -13
- package/lib/utils/interpolation.js +2 -2
- package/package.json +4 -3
package/es/css/CSS.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GlobalContainer } from 'mana-syringe';
|
|
2
2
|
import { CSSUnitValue } from './cssom';
|
|
3
|
-
import { StyleValueRegistry } from './
|
|
3
|
+
import { StyleValueRegistry } from './interfaces';
|
|
4
4
|
/**
|
|
5
5
|
* holds useful CSS-related methods.
|
|
6
6
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS
|
package/es/css/CSSProperty.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IElement } from '../dom';
|
|
2
|
-
import type { StyleValueRegistry } from './
|
|
2
|
+
import type { StyleValueRegistry } from './interfaces';
|
|
3
3
|
export declare type Interpolatable = number | boolean | number[] | boolean[];
|
|
4
4
|
declare type CSSPropertyMixer<Parsed = any, T extends Interpolatable = any> = (left: Parsed, right: Parsed, displayObject: IElement | null) => [T, T, (i: T) => string | any] | undefined;
|
|
5
5
|
declare type CSSPropertyParser<Parsed> = (value: string | any) => Parsed;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DisplayObject } from '../display-objects';
|
|
2
2
|
import type { BaseStyleProps } from '../types';
|
|
3
3
|
import { CSSStyleValue } from './cssom';
|
|
4
|
+
import { StyleValueRegistry } from './interfaces';
|
|
4
5
|
export declare type CSSGlobalKeywords = 'unset' | 'initial' | 'inherit' | '';
|
|
5
6
|
export interface PropertyParseOptions {
|
|
6
7
|
skipUpdateAttribute: boolean;
|
|
@@ -65,7 +66,7 @@ export interface PropertyMetadata {
|
|
|
65
66
|
* Blink used them in code generation(css_properties.json5)
|
|
66
67
|
*/
|
|
67
68
|
export declare const BUILT_IN_PROPERTIES: PropertyMetadata[];
|
|
68
|
-
export declare class StyleValueRegistry {
|
|
69
|
+
export declare class DefaultStyleValueRegistry implements StyleValueRegistry {
|
|
69
70
|
/**
|
|
70
71
|
* need recalc later
|
|
71
72
|
*/
|
|
@@ -10,6 +10,7 @@ import { convertPercentUnit } from './parser';
|
|
|
10
10
|
import { CSSPropertyLocalPosition, CSSPropertyOpacity, CSSPropertyColor, CSSPropertyFilter, CSSPropertyLengthOrPercentage, CSSPropertyLineDash, CSSPropertyShadowBlur, CSSPropertyOffsetPath, CSSPropertyOffsetDistance, CSSPropertyAnchor, CSSPropertyZIndex, CSSPropertyTransform, CSSPropertyTransformOrigin, CSSPropertyPath, CSSPropertyClipPath, CSSPropertyPoints, CSSPropertyText, CSSPropertyTextTransform } from './properties';
|
|
11
11
|
import { formatAttribute } from '../utils';
|
|
12
12
|
import { AABB } from '../shapes';
|
|
13
|
+
import { StyleValueRegistry } from './interfaces';
|
|
13
14
|
export var PropertySyntax = {
|
|
14
15
|
COLOR: '<color>',
|
|
15
16
|
PAINT: '<paint>',
|
|
@@ -410,14 +411,12 @@ export var BUILT_IN_PROPERTIES = [{
|
|
|
410
411
|
}, {
|
|
411
412
|
name: 'whiteSpace',
|
|
412
413
|
layoutDependent: true
|
|
413
|
-
}];
|
|
414
|
-
// multiple: false,
|
|
415
|
-
// });
|
|
414
|
+
}];
|
|
416
415
|
|
|
417
|
-
var
|
|
416
|
+
var DefaultStyleValueRegistry =
|
|
418
417
|
/** @class */
|
|
419
418
|
function () {
|
|
420
|
-
function
|
|
419
|
+
function DefaultStyleValueRegistry() {
|
|
421
420
|
/**
|
|
422
421
|
* need recalc later
|
|
423
422
|
*/
|
|
@@ -453,7 +452,7 @@ function () {
|
|
|
453
452
|
// > = {};
|
|
454
453
|
|
|
455
454
|
|
|
456
|
-
|
|
455
|
+
DefaultStyleValueRegistry.prototype.init = function () {
|
|
457
456
|
var _this = this;
|
|
458
457
|
|
|
459
458
|
BUILT_IN_PROPERTIES.forEach(function (property) {
|
|
@@ -461,7 +460,7 @@ function () {
|
|
|
461
460
|
});
|
|
462
461
|
};
|
|
463
462
|
|
|
464
|
-
|
|
463
|
+
DefaultStyleValueRegistry.prototype.registerMetadata = function (metadata) {
|
|
465
464
|
var _this = this;
|
|
466
465
|
|
|
467
466
|
__spreadArray([metadata.name], __read(metadata.alias || []), false).forEach(function (name) {
|
|
@@ -469,7 +468,7 @@ function () {
|
|
|
469
468
|
});
|
|
470
469
|
};
|
|
471
470
|
|
|
472
|
-
|
|
471
|
+
DefaultStyleValueRegistry.prototype.getMetadata = function (name) {
|
|
473
472
|
return this.cache[name];
|
|
474
473
|
};
|
|
475
474
|
/**
|
|
@@ -483,7 +482,7 @@ function () {
|
|
|
483
482
|
*/
|
|
484
483
|
|
|
485
484
|
|
|
486
|
-
|
|
485
|
+
DefaultStyleValueRegistry.prototype.processProperties = function (object, attributes, options) {
|
|
487
486
|
var _this = this;
|
|
488
487
|
|
|
489
488
|
if (options === void 0) {
|
|
@@ -564,7 +563,7 @@ function () {
|
|
|
564
563
|
*/
|
|
565
564
|
|
|
566
565
|
|
|
567
|
-
|
|
566
|
+
DefaultStyleValueRegistry.prototype.parseProperty = function (name, value) {
|
|
568
567
|
var metadata = this.getMetadata(name);
|
|
569
568
|
var computed = value;
|
|
570
569
|
|
|
@@ -600,7 +599,7 @@ function () {
|
|
|
600
599
|
*/
|
|
601
600
|
|
|
602
601
|
|
|
603
|
-
|
|
602
|
+
DefaultStyleValueRegistry.prototype.computeProperty = function (name, computed, object) {
|
|
604
603
|
var metadata = this.getMetadata(name);
|
|
605
604
|
var isDocumentElement = object.id === 'g-root';
|
|
606
605
|
var used = computed instanceof CSSStyleValue ? computed.clone() : computed;
|
|
@@ -664,7 +663,7 @@ function () {
|
|
|
664
663
|
return false;
|
|
665
664
|
};
|
|
666
665
|
|
|
667
|
-
|
|
666
|
+
DefaultStyleValueRegistry.prototype.postProcessProperty = function (name, object) {
|
|
668
667
|
var metadata = this.getMetadata(name);
|
|
669
668
|
|
|
670
669
|
if (metadata && metadata.handler) {
|
|
@@ -676,7 +675,7 @@ function () {
|
|
|
676
675
|
}
|
|
677
676
|
};
|
|
678
677
|
|
|
679
|
-
|
|
678
|
+
DefaultStyleValueRegistry.prototype.isPropertyResolved = function (object, name) {
|
|
680
679
|
if (!this.unresolvedProperties[object.entity] || this.unresolvedProperties[object.entity].length === 0) {
|
|
681
680
|
return true;
|
|
682
681
|
}
|
|
@@ -688,7 +687,7 @@ function () {
|
|
|
688
687
|
*/
|
|
689
688
|
|
|
690
689
|
|
|
691
|
-
|
|
690
|
+
DefaultStyleValueRegistry.prototype.addUnresolveProperty = function (object, name) {
|
|
692
691
|
if (!this.unresolvedProperties[object.entity]) {
|
|
693
692
|
this.unresolvedProperties[object.entity] = [];
|
|
694
693
|
}
|
|
@@ -698,7 +697,7 @@ function () {
|
|
|
698
697
|
}
|
|
699
698
|
};
|
|
700
699
|
|
|
701
|
-
|
|
700
|
+
DefaultStyleValueRegistry.prototype.tryToResolveProperty = function (object, name, options) {
|
|
702
701
|
if (options === void 0) {
|
|
703
702
|
options = {};
|
|
704
703
|
}
|
|
@@ -722,7 +721,7 @@ function () {
|
|
|
722
721
|
return false;
|
|
723
722
|
};
|
|
724
723
|
|
|
725
|
-
|
|
724
|
+
DefaultStyleValueRegistry.prototype.recalc = function (object) {
|
|
726
725
|
var properties = this.unresolvedProperties[object.entity];
|
|
727
726
|
|
|
728
727
|
if (properties && properties.length) {
|
|
@@ -740,7 +739,7 @@ function () {
|
|
|
740
739
|
*/
|
|
741
740
|
|
|
742
741
|
|
|
743
|
-
|
|
742
|
+
DefaultStyleValueRegistry.prototype.updateGeometry = function (object) {
|
|
744
743
|
var _a;
|
|
745
744
|
|
|
746
745
|
var geometryUpdaterFactory = GlobalContainer.get(GeometryUpdaterFactory);
|
|
@@ -875,7 +874,7 @@ function () {
|
|
|
875
874
|
}
|
|
876
875
|
};
|
|
877
876
|
|
|
878
|
-
|
|
877
|
+
DefaultStyleValueRegistry.prototype.isPropertyInheritable = function (name) {
|
|
879
878
|
var metadata = this.getMetadata(name);
|
|
880
879
|
|
|
881
880
|
if (!metadata) {
|
|
@@ -885,10 +884,12 @@ function () {
|
|
|
885
884
|
return metadata.inherited;
|
|
886
885
|
};
|
|
887
886
|
|
|
888
|
-
__decorate([postConstruct(), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0)],
|
|
887
|
+
__decorate([postConstruct(), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0)], DefaultStyleValueRegistry.prototype, "init", null);
|
|
889
888
|
|
|
890
|
-
|
|
891
|
-
|
|
889
|
+
DefaultStyleValueRegistry = __decorate([singleton({
|
|
890
|
+
token: StyleValueRegistry
|
|
891
|
+
})], DefaultStyleValueRegistry);
|
|
892
|
+
return DefaultStyleValueRegistry;
|
|
892
893
|
}();
|
|
893
894
|
|
|
894
|
-
export {
|
|
895
|
+
export { DefaultStyleValueRegistry };
|
package/es/css/index.d.ts
CHANGED
package/es/css/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import type { DisplayObject } from '../../display-objects';
|
|
|
3
3
|
import { parseColor, mergeColors } from '../parser';
|
|
4
4
|
import type { CSSGradientValue } from '../cssom';
|
|
5
5
|
import { CSSKeywordValue, CSSRGB } from '../cssom';
|
|
6
|
-
import type { StyleValueRegistry } from '../
|
|
6
|
+
import type { StyleValueRegistry } from '../interfaces';
|
|
7
7
|
/**
|
|
8
8
|
* opacity
|
|
9
9
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSUnitValue } from '../cssom';
|
|
2
2
|
import { mergeDimensions } from '../parser';
|
|
3
|
-
import type { StyleValueRegistry } from '../
|
|
3
|
+
import type { StyleValueRegistry } from '../interfaces';
|
|
4
4
|
import type { DisplayObject } from '../../display-objects';
|
|
5
5
|
import type { CSSProperty } from '../CSSProperty';
|
|
6
6
|
/**
|
|
@@ -5,7 +5,6 @@ import { Element } from '../dom/Element';
|
|
|
5
5
|
import type { DisplayObjectConfig, IChildNode } from '../dom/interfaces';
|
|
6
6
|
import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
7
7
|
import type { PropertyParseOptions } from '../css/StyleValueRegistry';
|
|
8
|
-
import { StyleValueRegistry } from '../css/StyleValueRegistry';
|
|
9
8
|
/**
|
|
10
9
|
* prototype chains: DisplayObject -> Element -> Node -> EventTarget
|
|
11
10
|
*
|
|
@@ -29,7 +28,7 @@ export declare class DisplayObject<StyleProps extends BaseStyleProps = any, Pars
|
|
|
29
28
|
* contains style props in constructor's params, eg. fill, stroke...
|
|
30
29
|
*/
|
|
31
30
|
config: DisplayObjectConfig<StyleProps>;
|
|
32
|
-
styleValueRegistry:
|
|
31
|
+
styleValueRegistry: any;
|
|
33
32
|
/**
|
|
34
33
|
* push to active animations after calling `animate()`
|
|
35
34
|
*/
|
|
@@ -10,7 +10,7 @@ import { createVec3, decompose, formatAttribute, fromRotationTranslationScale, g
|
|
|
10
10
|
import { dirtifyToRoot } from '../services';
|
|
11
11
|
import { MutationEvent } from '../dom/MutationEvent';
|
|
12
12
|
import { Rectangle } from '../shapes';
|
|
13
|
-
import { StyleValueRegistry } from '../css/
|
|
13
|
+
import { StyleValueRegistry } from '../css/interfaces';
|
|
14
14
|
import { CSSUnitValue } from '../css';
|
|
15
15
|
var DEFAULT_STYLE_PROPS = {
|
|
16
16
|
x: '',
|
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,
|
package/es/global-module.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Module, injectable, decorate } from 'mana-syringe';
|
|
2
2
|
import { EventEmitter } from 'eventemitter3';
|
|
3
3
|
import { DisplayObjectPool } from './DisplayObjectPool';
|
|
4
|
-
import { CircleUpdater, EllipseUpdater, GeometryAABBUpdater, GeometryUpdaterFactory, LineUpdater, PathUpdater, PolylineUpdater, RectUpdater, TextUpdater, TextService, OffscreenCanvasCreator, DefaultSceneGraphService,
|
|
5
|
-
import { LayoutRegistry,
|
|
4
|
+
import { CircleUpdater, EllipseUpdater, GeometryAABBUpdater, GeometryUpdaterFactory, LineUpdater, PathUpdater, PolylineUpdater, RectUpdater, TextUpdater, TextService, OffscreenCanvasCreator, DefaultSceneGraphService, DefaultSceneGraphSelector, SceneGraphSelector, SceneGraphSelectorFactory } from './services';
|
|
5
|
+
import { LayoutRegistry, CSSPropertyLocalPosition, CSSPropertyLengthOrPercentage, CSSPropertyAnchor, CSSPropertyClipPath, CSSPropertyColor, CSSPropertyFilter, CSSPropertyLineDash, CSSPropertyOffsetDistance, CSSPropertyOffsetPath, CSSPropertyOpacity, CSSPropertyPath, CSSPropertyPoints, CSSPropertyText, CSSPropertyTextTransform, CSSPropertyTransform, CSSPropertyTransformOrigin, CSSPropertyZIndex, CSSPropertyShadowBlur, DefaultStyleValueRegistry } from './css';
|
|
6
6
|
export var containerModule = Module(function (register) {
|
|
7
7
|
decorate(injectable(), EventEmitter); // bind DisplayObject pool
|
|
8
8
|
|
|
@@ -18,10 +18,7 @@ export var containerModule = Module(function (register) {
|
|
|
18
18
|
}
|
|
19
19
|
}); // bind scenegraph service
|
|
20
20
|
|
|
21
|
-
register(
|
|
22
|
-
token: SceneGraphService,
|
|
23
|
-
useClass: DefaultSceneGraphService
|
|
24
|
-
}); // bind text service
|
|
21
|
+
register(DefaultSceneGraphService); // bind text service
|
|
25
22
|
|
|
26
23
|
register(OffscreenCanvasCreator);
|
|
27
24
|
register(TextService); // bind aabb updater
|
|
@@ -50,8 +47,7 @@ export var containerModule = Module(function (register) {
|
|
|
50
47
|
}); // bind CSS property handlers
|
|
51
48
|
|
|
52
49
|
register(LayoutRegistry);
|
|
53
|
-
register(
|
|
54
|
-
|
|
50
|
+
register(DefaultStyleValueRegistry);
|
|
55
51
|
register(CSSPropertyLengthOrPercentage);
|
|
56
52
|
register(CSSPropertyLocalPosition);
|
|
57
53
|
register(CSSPropertyOpacity);
|
|
@@ -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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __awaiter, __decorate, __generator, __metadata } from "tslib";
|
|
2
2
|
import { inject, singleton } from 'mana-syringe';
|
|
3
|
-
import { StyleValueRegistry } from '../css/
|
|
3
|
+
import { StyleValueRegistry } from '../css/interfaces';
|
|
4
4
|
import { ElementEvent } from '../dom';
|
|
5
5
|
import { RenderingContext, RenderingPluginContribution, dirtifyToRoot } from '../services';
|
|
6
6
|
|
|
@@ -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
|
|
|
@@ -28,7 +30,6 @@ function () {
|
|
|
28
30
|
|
|
29
31
|
_this.styleValueRegistry.recalc(object);
|
|
30
32
|
|
|
31
|
-
console.log(object);
|
|
32
33
|
dirtifyToRoot(object);
|
|
33
34
|
renderingService.dirtify();
|
|
34
35
|
};
|
|
@@ -38,7 +39,7 @@ function () {
|
|
|
38
39
|
renderingService.dirtify();
|
|
39
40
|
};
|
|
40
41
|
|
|
41
|
-
renderingService.hooks.init.tapPromise(function () {
|
|
42
|
+
renderingService.hooks.init.tapPromise(PrepareRendererPlugin_1.tag, function () {
|
|
42
43
|
return __awaiter(_this, void 0, void 0, function () {
|
|
43
44
|
return __generator(this, function (_a) {
|
|
44
45
|
this.renderingContext.root.addEventListener(ElementEvent.MOUNTED, handleMounted);
|
|
@@ -51,7 +52,7 @@ function () {
|
|
|
51
52
|
});
|
|
52
53
|
});
|
|
53
54
|
});
|
|
54
|
-
renderingService.hooks.destroy.tap(function () {
|
|
55
|
+
renderingService.hooks.destroy.tap(PrepareRendererPlugin_1.tag, function () {
|
|
55
56
|
_this.renderingContext.root.removeEventListener(ElementEvent.MOUNTED, handleMounted);
|
|
56
57
|
|
|
57
58
|
_this.renderingContext.root.removeEventListener(ElementEvent.UNMOUNTED, handleUnmounted);
|
|
@@ -62,11 +63,14 @@ function () {
|
|
|
62
63
|
});
|
|
63
64
|
};
|
|
64
65
|
|
|
66
|
+
var PrepareRendererPlugin_1;
|
|
67
|
+
PrepareRendererPlugin.tag = 'Prepare';
|
|
68
|
+
|
|
65
69
|
__decorate([inject(RenderingContext), __metadata("design:type", Object)], PrepareRendererPlugin.prototype, "renderingContext", void 0);
|
|
66
70
|
|
|
67
|
-
__decorate([inject(StyleValueRegistry), __metadata("design:type",
|
|
71
|
+
__decorate([inject(StyleValueRegistry), __metadata("design:type", Object)], PrepareRendererPlugin.prototype, "styleValueRegistry", void 0);
|
|
68
72
|
|
|
69
|
-
PrepareRendererPlugin = __decorate([singleton({
|
|
73
|
+
PrepareRendererPlugin = PrepareRendererPlugin_1 = __decorate([singleton({
|
|
70
74
|
contrib: RenderingPluginContribution
|
|
71
75
|
})], PrepareRendererPlugin);
|
|
72
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(): {
|