@antv/g 5.0.23-alpha.7 → 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/parser/numeric.d.ts +1 -1
- package/es/css/parser/numeric.js +1 -1
- package/es/css/parser/transform-origin.d.ts +1 -1
- package/es/css/parser/transform-origin.js +1 -1
- package/es/css/parser/transform.d.ts +1 -1
- package/es/css/parser/transform.js +7 -5
- 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/parser/numeric.d.ts +1 -1
- package/lib/css/parser/numeric.js +4 -4
- package/lib/css/parser/transform-origin.d.ts +1 -1
- package/lib/css/parser/transform-origin.js +2 -2
- package/lib/css/parser/transform.d.ts +1 -1
- package/lib/css/parser/transform.js +19 -15
- 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;
|
|
@@ -12,7 +12,7 @@ exports.parseNumberList = parseNumberList;
|
|
|
12
12
|
|
|
13
13
|
var _utils = require("../../utils");
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _CSSNumericValue = require("../cssom/CSSNumericValue");
|
|
16
16
|
|
|
17
17
|
function numberToString(x) {
|
|
18
18
|
// scale(0.00000001) -> scale(0)
|
|
@@ -30,13 +30,13 @@ function numberToString(x) {
|
|
|
30
30
|
|
|
31
31
|
function parseNumber(string) {
|
|
32
32
|
if (typeof string === 'number') {
|
|
33
|
-
return new
|
|
33
|
+
return new _CSSNumericValue.CSSUnitValue(string);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
if (/^\s*[-+]?(\d*\.)?\d+\s*$/.test(string)) {
|
|
37
|
-
return new
|
|
37
|
+
return new _CSSNumericValue.CSSUnitValue(Number(string));
|
|
38
38
|
} else {
|
|
39
|
-
return new
|
|
39
|
+
return new _CSSNumericValue.CSSUnitValue(0);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
@@ -7,7 +7,7 @@ exports.parseTransformOrigin = parseTransformOrigin;
|
|
|
7
7
|
|
|
8
8
|
var _utils = require("../../utils");
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _CSSNumericValue = require("../cssom/CSSNumericValue");
|
|
11
11
|
|
|
12
12
|
var _dimension = require("./dimension");
|
|
13
13
|
|
|
@@ -37,7 +37,7 @@ function parseTransformOrigin(value) {
|
|
|
37
37
|
|
|
38
38
|
return [(0, _dimension.parseLengthOrPercentage)(convertKeyword2Percent(values[0])), (0, _dimension.parseLengthOrPercentage)(convertKeyword2Percent(values[1]))];
|
|
39
39
|
} else {
|
|
40
|
-
return [new
|
|
40
|
+
return [new _CSSNumericValue.CSSUnitValue(value[0] || 0, 'px'), new _CSSNumericValue.CSSUnitValue(value[1] || 0, 'px')];
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -6,12 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.mergeTransforms = mergeTransforms;
|
|
7
7
|
exports.parseTransform = parseTransform;
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _types = require("../cssom/types");
|
|
10
|
+
|
|
11
|
+
var _CSSNumericValue = require("../cssom/CSSNumericValue");
|
|
10
12
|
|
|
11
13
|
var _dimension = require("./dimension");
|
|
12
14
|
|
|
13
15
|
var _numeric = require("./numeric");
|
|
14
16
|
|
|
17
|
+
var _CSS = require("../CSS");
|
|
18
|
+
|
|
15
19
|
var _ = null;
|
|
16
20
|
|
|
17
21
|
function cast(pattern) {
|
|
@@ -38,18 +42,18 @@ var transformFunctions = {
|
|
|
38
42
|
rotatez: ['A'],
|
|
39
43
|
rotate3d: ['NNNA'],
|
|
40
44
|
// perspective: ['L'],
|
|
41
|
-
scale: ['Nn', cast([_, _,
|
|
42
|
-
scalex: ['N', cast([_,
|
|
43
|
-
scaley: ['N', cast([
|
|
44
|
-
scalez: ['N', cast([
|
|
45
|
+
scale: ['Nn', cast([_, _, _CSS.CSS.number(1)]), id],
|
|
46
|
+
scalex: ['N', cast([_, _CSS.CSS.number(1), _CSS.CSS.number(1)]), cast([_, _CSS.CSS.number(1)])],
|
|
47
|
+
scaley: ['N', cast([_CSS.CSS.number(1), _, _CSS.CSS.number(1)]), cast([_CSS.CSS.number(1), _])],
|
|
48
|
+
scalez: ['N', cast([_CSS.CSS.number(1), _CSS.CSS.number(1), _])],
|
|
45
49
|
scale3d: ['NNN', id],
|
|
46
50
|
// skew: ['Aa', null, id],
|
|
47
51
|
// skewx: ['A', null, cast([_, Odeg])],
|
|
48
52
|
// skewy: ['A', null, cast([Odeg, _])],
|
|
49
|
-
translate: ['Tt', cast([_, _,
|
|
50
|
-
translatex: ['T', cast([_,
|
|
51
|
-
translatey: ['T', cast([
|
|
52
|
-
translatez: ['L', cast([
|
|
53
|
+
translate: ['Tt', cast([_, _, _CSSNumericValue.Opx]), id],
|
|
54
|
+
translatex: ['T', cast([_, _CSSNumericValue.Opx, _CSSNumericValue.Opx]), cast([_, _CSSNumericValue.Opx])],
|
|
55
|
+
translatey: ['T', cast([_CSSNumericValue.Opx, _, _CSSNumericValue.Opx]), cast([_CSSNumericValue.Opx, _])],
|
|
56
|
+
translatez: ['L', cast([_CSSNumericValue.Opx, _CSSNumericValue.Opx, _])],
|
|
53
57
|
translate3d: ['TTL', id]
|
|
54
58
|
};
|
|
55
59
|
/**
|
|
@@ -104,15 +108,15 @@ function parseTransform(string) {
|
|
|
104
108
|
if (!arg) {
|
|
105
109
|
// @ts-ignore
|
|
106
110
|
parsedArg = {
|
|
107
|
-
a:
|
|
111
|
+
a: _CSSNumericValue.Odeg,
|
|
108
112
|
n: parsedArgs[0],
|
|
109
|
-
t:
|
|
113
|
+
t: _CSSNumericValue.Opx
|
|
110
114
|
}[type];
|
|
111
115
|
} else {
|
|
112
116
|
// @ts-ignore
|
|
113
117
|
parsedArg = {
|
|
114
118
|
A: function A(s) {
|
|
115
|
-
return s.trim() === '0' ?
|
|
119
|
+
return s.trim() === '0' ? _CSSNumericValue.Odeg : (0, _dimension.parseAngle)(s);
|
|
116
120
|
},
|
|
117
121
|
N: _numeric.parseNumber,
|
|
118
122
|
T: _dimension.parseLengthOrPercentage,
|
|
@@ -200,10 +204,10 @@ function mergeTransforms(left, right, target) {
|
|
|
200
204
|
t: type,
|
|
201
205
|
d: args.map(function (arg) {
|
|
202
206
|
if (typeof arg === 'number') {
|
|
203
|
-
return new
|
|
207
|
+
return new _CSSNumericValue.CSSUnitValue(defaultValue);
|
|
204
208
|
}
|
|
205
209
|
|
|
206
|
-
return new
|
|
210
|
+
return new _CSSNumericValue.CSSUnitValue(defaultValue, arg.unit); // {
|
|
207
211
|
// unit: arg.unit,
|
|
208
212
|
// value: defaultValue,
|
|
209
213
|
// };
|
|
@@ -267,7 +271,7 @@ function mergeTransforms(left, right, target) {
|
|
|
267
271
|
var stringConversions = [];
|
|
268
272
|
|
|
269
273
|
for (var j = 0; j < leftArgs.length; j++) {
|
|
270
|
-
var merge = leftArgs[j].unit ===
|
|
274
|
+
var merge = leftArgs[j].unit === _types.UnitType.kNumber ? _numeric.mergeNumbers : _dimension.mergeDimensions; // @ts-ignore
|
|
271
275
|
|
|
272
276
|
var merged = merge(leftArgs[j], rightArgs[j], target, false, j);
|
|
273
277
|
leftArgsCopy[j] = merged[0];
|
|
@@ -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;
|