@antv/g 5.0.23-alpha.9 → 5.0.23
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/components/Geometry.d.ts +4 -0
- 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 +43 -21
- package/es/css/cssom/CSSNumericValue.js +1 -1
- 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 +2 -1
- package/es/dom/Document.js +2 -2
- package/es/global-module.js +4 -7
- 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 -5
- package/es/services/EventService.js +4 -8
- package/es/services/RenderingService.d.ts +17 -17
- package/es/services/RenderingService.js +25 -22
- package/es/services/SceneGraphService.js +3 -1
- package/es/types.d.ts +6 -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/components/Geometry.d.ts +4 -0
- 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 +50 -24
- package/lib/css/cssom/CSSNumericValue.js +17 -17
- 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 +3 -2
- package/lib/dom/Document.js +2 -2
- package/lib/global-module.js +2 -5
- 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 -5
- package/lib/services/EventService.js +4 -8
- package/lib/services/RenderingService.d.ts +17 -17
- package/lib/services/RenderingService.js +25 -22
- package/lib/services/SceneGraphService.js +3 -1
- package/lib/types.d.ts +6 -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/utils/hooks.d.ts +0 -280
- package/es/utils/hooks.js +0 -753
- package/lib/utils/hooks.d.ts +0 -280
- package/lib/utils/hooks.js +0 -759
|
@@ -10,7 +10,7 @@ exports.unitTypeToBaseType = unitTypeToBaseType;
|
|
|
10
10
|
|
|
11
11
|
var _tslib = require("tslib");
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _assert = require("../../utils/assert");
|
|
14
14
|
|
|
15
15
|
var _CSSMathOperator = require("./CSSMathOperator");
|
|
16
16
|
|
|
@@ -34,7 +34,7 @@ exports.BaseType = BaseType;
|
|
|
34
34
|
})(BaseType || (exports.BaseType = BaseType = {}));
|
|
35
35
|
|
|
36
36
|
function unitTypeToBaseType(unit) {
|
|
37
|
-
(0,
|
|
37
|
+
(0, _assert.DCHECK_NE)(unit, _types.UnitType.kNumber);
|
|
38
38
|
|
|
39
39
|
switch (unit) {
|
|
40
40
|
case _types.UnitType.kEms:
|
|
@@ -165,7 +165,7 @@ function () {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
CSSNumericValueType.prototype.applyPercentHint = function (hint) {
|
|
168
|
-
(0,
|
|
168
|
+
(0, _assert.DCHECK_NE)(hint, BaseType.kPercent);
|
|
169
169
|
this.setExponent(hint, this.exponent(hint) + this.exponent(BaseType.kPercent));
|
|
170
170
|
this.setExponent(BaseType.kPercent, 0);
|
|
171
171
|
this.percentHint = hint;
|
|
@@ -177,7 +177,7 @@ function () {
|
|
|
177
177
|
};
|
|
178
178
|
|
|
179
179
|
CSSNumericValueType.prototype.isOnlyNonZeroEntry = function (baseType, value) {
|
|
180
|
-
(0,
|
|
180
|
+
(0, _assert.DCHECK_NE)(value, 0);
|
|
181
181
|
return this.numNonZeroEntries === 1 && this.exponent(baseType) === value;
|
|
182
182
|
};
|
|
183
183
|
|
|
@@ -205,7 +205,7 @@ function () {
|
|
|
205
205
|
};
|
|
206
206
|
|
|
207
207
|
CSSNumericValueType.prototype.matchesBaseType = function (baseType) {
|
|
208
|
-
(0,
|
|
208
|
+
(0, _assert.DCHECK_NE)(baseType, BaseType.kPercent);
|
|
209
209
|
return this.isOnlyNonZeroEntry(baseType, 1) && !this.hasPercentHint;
|
|
210
210
|
};
|
|
211
211
|
|
|
@@ -214,7 +214,7 @@ function () {
|
|
|
214
214
|
};
|
|
215
215
|
|
|
216
216
|
CSSNumericValueType.prototype.matchesBaseTypePercentage = function (baseType) {
|
|
217
|
-
(0,
|
|
217
|
+
(0, _assert.DCHECK_NE)(baseType, BaseType.kPercent);
|
|
218
218
|
return this.isOnlyNonZeroEntry(baseType, 1) || this.isOnlyNonZeroEntry(BaseType.kPercent, 1);
|
|
219
219
|
};
|
|
220
220
|
|
|
@@ -233,7 +233,7 @@ function () {
|
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
if (type1.hasPercentHint) type2.applyPercentHint(type1.percentHint);else if (type2.hasPercentHint) type1.applyPercentHint(type2.percentHint);
|
|
236
|
-
(0,
|
|
236
|
+
(0, _assert.DCHECK_EQ)(type1.percentHint, type2.percentHint); // Match up base types. Try to use the percent hint to match up any
|
|
237
237
|
// differences.
|
|
238
238
|
|
|
239
239
|
for (var i = 0; i < BaseType.kNumBaseTypes; ++i) {
|
|
@@ -567,7 +567,7 @@ function (_super) {
|
|
|
567
567
|
}); // We got 'values' from a sum value, so it must be a valid CSSMathSum.
|
|
568
568
|
|
|
569
569
|
var result_1 = CSSMathSum.create(values);
|
|
570
|
-
(0,
|
|
570
|
+
(0, _assert.DCHECK)(!!result_1);
|
|
571
571
|
return result_1;
|
|
572
572
|
}
|
|
573
573
|
|
|
@@ -575,7 +575,7 @@ function (_super) {
|
|
|
575
575
|
|
|
576
576
|
var _loop_1 = function _loop_1(unit_string) {
|
|
577
577
|
var target_unit = CSSNumericValue.unitFromName(unit_string);
|
|
578
|
-
(0,
|
|
578
|
+
(0, _assert.DCHECK)(CSSNumericValue.isValidUnit(target_unit)); // Collect all the terms that are compatible with this unit.
|
|
579
579
|
// We mark used terms as null so we don't use them again.
|
|
580
580
|
|
|
581
581
|
var total_value = values.reduce(function (cur_sum, value, i) {
|
|
@@ -710,7 +710,7 @@ function cssNumberishesToNumericValues(values) {
|
|
|
710
710
|
}
|
|
711
711
|
|
|
712
712
|
function prependValueForArithmetic(type, values, value) {
|
|
713
|
-
(0,
|
|
713
|
+
(0, _assert.DCHECK)(!!value);
|
|
714
714
|
|
|
715
715
|
if (value.getType() === type) {
|
|
716
716
|
values.unshift.apply(values, (0, _tslib.__spreadArray)([], (0, _tslib.__read)(value.numericValues()), false));
|
|
@@ -732,7 +732,7 @@ function cssNumericSumValueEntryToUnitValue(term) {
|
|
|
732
732
|
}
|
|
733
733
|
|
|
734
734
|
function maybeSimplifyAsUnitValue(values, operator) {
|
|
735
|
-
(0,
|
|
735
|
+
(0, _assert.DCHECK)(!!values.length);
|
|
736
736
|
var first_unit_value = values[0] instanceof CSSUnitValue ? values[0] : null;
|
|
737
737
|
if (!first_unit_value) return null;
|
|
738
738
|
var final_value = first_unit_value.value;
|
|
@@ -754,7 +754,7 @@ function maybeSimplifyAsUnitValue(values, operator) {
|
|
|
754
754
|
}
|
|
755
755
|
|
|
756
756
|
function maybeMultiplyAsUnitValue(values) {
|
|
757
|
-
(0,
|
|
757
|
+
(0, _assert.DCHECK)(!!values.length); // We are allowed one unit value with type other than kNumber.
|
|
758
758
|
|
|
759
759
|
var unit_other_than_number = _types.UnitType.kNumber;
|
|
760
760
|
var final_value = 1.0;
|
|
@@ -800,7 +800,7 @@ function (_super) {
|
|
|
800
800
|
unit = unitOrName;
|
|
801
801
|
}
|
|
802
802
|
|
|
803
|
-
(0,
|
|
803
|
+
(0, _assert.DCHECK)(CSSUnitValue.isValidUnit(unit));
|
|
804
804
|
_this = _super.call(this, new CSSNumericValueType(unit)) || this;
|
|
805
805
|
_this.unit = unit;
|
|
806
806
|
_this.value = value;
|
|
@@ -833,7 +833,7 @@ function (_super) {
|
|
|
833
833
|
if (!Number.isFinite(number)) {
|
|
834
834
|
if (number > 0) result = 'infinity';else result = '-infinity';
|
|
835
835
|
} else {
|
|
836
|
-
(0,
|
|
836
|
+
(0, _assert.DCHECK)(Number.isNaN(number));
|
|
837
837
|
result = 'NaN';
|
|
838
838
|
}
|
|
839
839
|
|
|
@@ -1490,7 +1490,7 @@ function (_super) {
|
|
|
1490
1490
|
var exp = units[key];
|
|
1491
1491
|
var error = false;
|
|
1492
1492
|
type = CSSNumericValueType.multiply(type, new CSSNumericValueType(Number(key), exp), error);
|
|
1493
|
-
(0,
|
|
1493
|
+
(0, _assert.DCHECK)(!error);
|
|
1494
1494
|
});
|
|
1495
1495
|
return type;
|
|
1496
1496
|
};
|
|
@@ -1498,7 +1498,7 @@ function (_super) {
|
|
|
1498
1498
|
CSSMathSum.canCreateNumericTypeFromSumValue = function (sum) {
|
|
1499
1499
|
var _this = this;
|
|
1500
1500
|
|
|
1501
|
-
(0,
|
|
1501
|
+
(0, _assert.DCHECK)(!!sum.length);
|
|
1502
1502
|
var first_type = this.numericTypeFromUnitMap(sum[0].units);
|
|
1503
1503
|
return sum.every(function (term) {
|
|
1504
1504
|
var error = false;
|
|
@@ -1599,7 +1599,7 @@ function (_super) {
|
|
|
1599
1599
|
|
|
1600
1600
|
CSSMathProduct.multiplyUnitMaps = function (a, b) {
|
|
1601
1601
|
Object.keys(b).forEach(function (key) {
|
|
1602
|
-
(0,
|
|
1602
|
+
(0, _assert.DCHECK_NE)(b[key].value, 0);
|
|
1603
1603
|
var old_value = key in a ? a[key].value : 0;
|
|
1604
1604
|
|
|
1605
1605
|
if (old_value + b[key].value === 0) {
|
package/lib/css/index.d.ts
CHANGED
package/lib/css/index.js
CHANGED
|
@@ -4,6 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
+
var _interfaces = require("./interfaces");
|
|
8
|
+
|
|
9
|
+
Object.keys(_interfaces).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _interfaces[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _interfaces[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
7
20
|
var _cssom = require("./cssom");
|
|
8
21
|
|
|
9
22
|
Object.keys(_cssom).forEach(function (key) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyleValueRegistry = void 0;
|
|
7
|
+
|
|
8
|
+
var _manaSyringe = require("mana-syringe");
|
|
9
|
+
|
|
10
|
+
var StyleValueRegistry = _manaSyringe.Syringe.defineToken('StyleValueRegistry');
|
|
11
|
+
|
|
12
|
+
exports.StyleValueRegistry = StyleValueRegistry;
|
|
@@ -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
|
*/
|
|
@@ -29,7 +29,7 @@ var _MutationEvent = require("../dom/MutationEvent");
|
|
|
29
29
|
|
|
30
30
|
var _shapes = require("../shapes");
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _interfaces2 = require("../css/interfaces");
|
|
33
33
|
|
|
34
34
|
var _css = require("../css");
|
|
35
35
|
|
|
@@ -48,6 +48,7 @@ var DEFAULT_STYLE_PROPS = {
|
|
|
48
48
|
pointerEvents: '',
|
|
49
49
|
lineCap: '',
|
|
50
50
|
lineJoin: '',
|
|
51
|
+
increasedLineWidthForHitTesting: '0',
|
|
51
52
|
fontSize: '',
|
|
52
53
|
fontFamily: '',
|
|
53
54
|
fontStyle: '',
|
|
@@ -87,7 +88,7 @@ function (_super) {
|
|
|
87
88
|
var _a, _b, _c;
|
|
88
89
|
|
|
89
90
|
_this = _super.call(this) || this;
|
|
90
|
-
_this.styleValueRegistry = _manaSyringe.GlobalContainer.get(
|
|
91
|
+
_this.styleValueRegistry = _manaSyringe.GlobalContainer.get(_interfaces2.StyleValueRegistry);
|
|
91
92
|
/**
|
|
92
93
|
* push to active animations after calling `animate()`
|
|
93
94
|
*/
|
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,
|
package/lib/global-module.js
CHANGED
|
@@ -30,10 +30,7 @@ var containerModule = (0, _manaSyringe.Module)(function (register) {
|
|
|
30
30
|
}
|
|
31
31
|
}); // bind scenegraph service
|
|
32
32
|
|
|
33
|
-
register(
|
|
34
|
-
token: _services.SceneGraphService,
|
|
35
|
-
useClass: _services.DefaultSceneGraphService
|
|
36
|
-
}); // bind text service
|
|
33
|
+
register(_services.DefaultSceneGraphService); // bind text service
|
|
37
34
|
|
|
38
35
|
register(_services.OffscreenCanvasCreator);
|
|
39
36
|
register(_services.TextService); // bind aabb updater
|
|
@@ -62,7 +59,7 @@ var containerModule = (0, _manaSyringe.Module)(function (register) {
|
|
|
62
59
|
}); // bind CSS property handlers
|
|
63
60
|
|
|
64
61
|
register(_css.LayoutRegistry);
|
|
65
|
-
register(_css.
|
|
62
|
+
register(_css.DefaultStyleValueRegistry);
|
|
66
63
|
register(_css.CSSPropertyLengthOrPercentage);
|
|
67
64
|
register(_css.CSSPropertyLocalPosition);
|
|
68
65
|
register(_css.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
|
}
|
|
@@ -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;
|
|
@@ -9,7 +9,7 @@ var _tslib = require("tslib");
|
|
|
9
9
|
|
|
10
10
|
var _manaSyringe = require("mana-syringe");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _interfaces = require("../css/interfaces");
|
|
13
13
|
|
|
14
14
|
var _dom = require("../dom");
|
|
15
15
|
|
|
@@ -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
|
-
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(
|
|
77
|
-
PrepareRendererPlugin = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
|
|
80
|
+
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_interfaces.StyleValueRegistry), (0, _tslib.__metadata)("design:type", Object)], PrepareRendererPlugin.prototype, "styleValueRegistry", void 0);
|
|
81
|
+
PrepareRendererPlugin = PrepareRendererPlugin_1 = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
|
|
78
82
|
contrib: _services.RenderingPluginContribution
|
|
79
83
|
})], PrepareRendererPlugin);
|
|
80
84
|
return PrepareRendererPlugin;
|
|
@@ -212,8 +212,7 @@ function (_super) {
|
|
|
212
212
|
e = _a.sent();
|
|
213
213
|
this.dispatchEvent(e, 'pointerdown');
|
|
214
214
|
|
|
215
|
-
if (e.pointerType === 'touch') {
|
|
216
|
-
this.dispatchEvent(e, 'touchstart');
|
|
215
|
+
if (e.pointerType === 'touch') {// this.dispatchEvent(e, 'touchstart');
|
|
217
216
|
} else if (e.pointerType === 'mouse' || e.pointerType === 'pen') {
|
|
218
217
|
isRightButton = e.button === 2;
|
|
219
218
|
this.dispatchEvent(e, isRightButton ? 'rightdown' : 'mousedown');
|
|
@@ -251,8 +250,7 @@ function (_super) {
|
|
|
251
250
|
e = _a.sent();
|
|
252
251
|
this.dispatchEvent(e, 'pointerup');
|
|
253
252
|
|
|
254
|
-
if (e.pointerType === 'touch') {
|
|
255
|
-
this.dispatchEvent(e, 'touchend');
|
|
253
|
+
if (e.pointerType === 'touch') {// this.dispatchEvent(e, 'touchend');
|
|
256
254
|
} else if (e.pointerType === 'mouse' || e.pointerType === 'pen') {
|
|
257
255
|
isRightButton = e.button === 2;
|
|
258
256
|
this.dispatchEvent(e, isRightButton ? 'rightup' : 'mouseup');
|
|
@@ -429,8 +427,7 @@ function (_super) {
|
|
|
429
427
|
} // Then pointermove
|
|
430
428
|
|
|
431
429
|
|
|
432
|
-
this.dispatchEvent(e, 'pointermove');
|
|
433
|
-
if (e.pointerType === 'touch') this.dispatchEvent(e, 'touchmove');
|
|
430
|
+
this.dispatchEvent(e, 'pointermove'); // if (e.pointerType === 'touch') this.dispatchEvent(e, 'touchmove');
|
|
434
431
|
|
|
435
432
|
if (isMouse) {
|
|
436
433
|
this.dispatchEvent(e, 'mousemove');
|
|
@@ -586,8 +583,7 @@ function (_super) {
|
|
|
586
583
|
e.currentTarget = currentTarget;
|
|
587
584
|
this.notifyTarget(e, 'pointerupoutside');
|
|
588
585
|
|
|
589
|
-
if (e.pointerType === 'touch') {
|
|
590
|
-
this.notifyTarget(e, 'touchendoutside');
|
|
586
|
+
if (e.pointerType === 'touch') {// this.notifyTarget(e, 'touchendoutside');
|
|
591
587
|
} else if (e.pointerType === 'mouse' || e.pointerType === 'pen') {
|
|
592
588
|
this.notifyTarget(e, e.button === 2 ? 'rightupoutside' : 'mouseupoutside');
|
|
593
589
|
}
|
|
@@ -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(): {
|