@antv/g-lite 1.2.19 → 1.2.21
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/css/CSSProperty.d.ts +7 -0
- package/dist/css/StyleValueRegistry.d.ts +2 -2
- package/dist/css/interfaces.d.ts +3 -2
- package/dist/css/parser/dimension.d.ts +9 -1
- package/dist/css/parser/numeric.d.ts +3 -0
- package/dist/css/parser/transform-origin.d.ts +2 -0
- package/dist/css/parser/transform.d.ts +1 -0
- package/dist/css/properties/CSSPropertyAngle.d.ts +1 -0
- package/dist/css/properties/CSSPropertyLengthOrPercentage.d.ts +5 -1
- package/dist/css/properties/CSSPropertyNumber.d.ts +1 -0
- package/dist/css/properties/CSSPropertyOffsetDistance.d.ts +1 -0
- package/dist/css/properties/CSSPropertyOpacity.d.ts +1 -0
- package/dist/css/properties/CSSPropertyTransform.d.ts +3 -2
- package/dist/css/properties/CSSPropertyTransformOrigin.d.ts +1 -0
- package/dist/css/properties/CSSPropertyZIndex.d.ts +1 -0
- package/dist/display-objects/DisplayObject.d.ts +1 -1
- package/dist/global-runtime.d.ts +0 -2
- package/dist/index.esm.js +165 -58
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +165 -58
- package/dist/index.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/services/EventService.d.ts +5 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -3955,29 +3955,25 @@ function parseDimension(unitRegExp, string) {
|
|
|
3955
3955
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/length
|
|
3956
3956
|
* length with only absolute unit, eg. 1px
|
|
3957
3957
|
*/
|
|
3958
|
-
var
|
|
3958
|
+
var parseLengthUnmemoize = function (css) {
|
|
3959
3959
|
return parseDimension(new RegExp('px', 'g'), css);
|
|
3960
|
-
}
|
|
3960
|
+
};
|
|
3961
|
+
var parseLength = memoize(parseLengthUnmemoize);
|
|
3961
3962
|
/**
|
|
3962
3963
|
* <percentage>
|
|
3963
3964
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/percentage
|
|
3964
3965
|
*/
|
|
3965
|
-
|
|
3966
|
+
var parserPercentageUnmemoize = function (css) {
|
|
3966
3967
|
return parseDimension(new RegExp('%', 'g'), css);
|
|
3967
|
-
}
|
|
3968
|
+
};
|
|
3969
|
+
memoize(parserPercentageUnmemoize);
|
|
3968
3970
|
/**
|
|
3969
3971
|
* length with absolute or relative unit,
|
|
3970
3972
|
* eg. 1px, 0.7em, 50%, calc(100% - 200px);
|
|
3971
3973
|
*
|
|
3972
3974
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/length-percentage
|
|
3973
3975
|
*/
|
|
3974
|
-
|
|
3975
|
-
// if (isNumber(css) || isFinite(Number(css))) {
|
|
3976
|
-
// return getOrCreateUnitValue(Number(css), 'px');
|
|
3977
|
-
// }
|
|
3978
|
-
// return parseDimension(new RegExp('px|%|em|rem', 'g'), css) as CSSUnitValue;
|
|
3979
|
-
// });
|
|
3980
|
-
var parseLengthOrPercentage = function (css) {
|
|
3976
|
+
var parseLengthOrPercentageUnmemoize = function (css) {
|
|
3981
3977
|
if (isNumber(css) || isFinite(Number(css))) {
|
|
3982
3978
|
// Number(css) is NaN
|
|
3983
3979
|
return getOrCreateUnitValue(Number(css) || 0, 'px');
|
|
@@ -3985,9 +3981,11 @@ var parseLengthOrPercentage = function (css) {
|
|
|
3985
3981
|
}
|
|
3986
3982
|
return parseDimension(new RegExp('px|%|em|rem', 'g'), css);
|
|
3987
3983
|
};
|
|
3988
|
-
var
|
|
3984
|
+
var parseLengthOrPercentage = memoize(parseLengthOrPercentageUnmemoize);
|
|
3985
|
+
var parseAngleUnmemoize = function (css) {
|
|
3989
3986
|
return parseDimension(new RegExp('deg|rad|grad|turn', 'g'), css);
|
|
3990
|
-
}
|
|
3987
|
+
};
|
|
3988
|
+
var parseAngle = memoize(parseAngleUnmemoize);
|
|
3991
3989
|
/**
|
|
3992
3990
|
* merge CSSUnitValue
|
|
3993
3991
|
*
|
|
@@ -4180,7 +4178,7 @@ function numberToString(x) {
|
|
|
4180
4178
|
* * 0 -> CSSUnitValue(0)
|
|
4181
4179
|
* * '2' -> CSSUnitValue(2)
|
|
4182
4180
|
*/
|
|
4183
|
-
var
|
|
4181
|
+
var parseNumberUnmemoize = function (string) {
|
|
4184
4182
|
if (typeof string === 'number') {
|
|
4185
4183
|
return getOrCreateUnitValue(string);
|
|
4186
4184
|
}
|
|
@@ -4190,12 +4188,8 @@ var parseNumber = memoize(function (string) {
|
|
|
4190
4188
|
else {
|
|
4191
4189
|
return getOrCreateUnitValue(0);
|
|
4192
4190
|
}
|
|
4193
|
-
}
|
|
4194
|
-
|
|
4195
|
-
* separate string to array
|
|
4196
|
-
* eg.
|
|
4197
|
-
* * [0.5, 0.5] -> [CSSUnitValue, CSSUnitValue]
|
|
4198
|
-
*/
|
|
4191
|
+
};
|
|
4192
|
+
var parseNumber = memoize(parseNumberUnmemoize);
|
|
4199
4193
|
memoize(function (string) {
|
|
4200
4194
|
if (isString(string)) {
|
|
4201
4195
|
return string.split(' ').map(parseNumber);
|
|
@@ -5255,6 +5249,68 @@ function parseTransform(string) {
|
|
|
5255
5249
|
}
|
|
5256
5250
|
return [];
|
|
5257
5251
|
}
|
|
5252
|
+
function parseTransformUnmemoize(string) {
|
|
5253
|
+
string = (string || 'none').toLowerCase().trim();
|
|
5254
|
+
if (string === 'none') {
|
|
5255
|
+
return [];
|
|
5256
|
+
}
|
|
5257
|
+
var transformRegExp = /\s*(\w+)\(([^)]*)\)/g;
|
|
5258
|
+
var result = [];
|
|
5259
|
+
var match;
|
|
5260
|
+
var prevLastIndex = 0;
|
|
5261
|
+
while ((match = transformRegExp.exec(string))) {
|
|
5262
|
+
if (match.index !== prevLastIndex) {
|
|
5263
|
+
return [];
|
|
5264
|
+
}
|
|
5265
|
+
prevLastIndex = match.index + match[0].length;
|
|
5266
|
+
var functionName = match[1]; // scale
|
|
5267
|
+
var functionData = transformFunctions[functionName]; // scale(1, 2)
|
|
5268
|
+
if (!functionData) {
|
|
5269
|
+
// invalid, eg. scale()
|
|
5270
|
+
return [];
|
|
5271
|
+
}
|
|
5272
|
+
var args = match[2].split(','); // 1,2
|
|
5273
|
+
var argTypes = functionData[0]; // Nn
|
|
5274
|
+
if (argTypes.length < args.length) {
|
|
5275
|
+
// scale(N, n)
|
|
5276
|
+
return [];
|
|
5277
|
+
}
|
|
5278
|
+
var parsedArgs = [];
|
|
5279
|
+
for (var i = 0; i < argTypes.length; i++) {
|
|
5280
|
+
var arg = args[i];
|
|
5281
|
+
var type = argTypes[i];
|
|
5282
|
+
var parsedArg = void 0;
|
|
5283
|
+
if (!arg) {
|
|
5284
|
+
// @ts-ignore
|
|
5285
|
+
parsedArg = {
|
|
5286
|
+
a: Odeg,
|
|
5287
|
+
n: parsedArgs[0],
|
|
5288
|
+
t: Opx,
|
|
5289
|
+
}[type];
|
|
5290
|
+
}
|
|
5291
|
+
else {
|
|
5292
|
+
// @ts-ignore
|
|
5293
|
+
parsedArg = {
|
|
5294
|
+
A: function (s) {
|
|
5295
|
+
return s.trim() === '0' ? Odeg : parseAngleUnmemoize(s);
|
|
5296
|
+
},
|
|
5297
|
+
N: parseNumberUnmemoize,
|
|
5298
|
+
T: parseLengthOrPercentageUnmemoize,
|
|
5299
|
+
L: parseLengthUnmemoize,
|
|
5300
|
+
}[type.toUpperCase()](arg);
|
|
5301
|
+
}
|
|
5302
|
+
if (parsedArg === undefined) {
|
|
5303
|
+
return [];
|
|
5304
|
+
}
|
|
5305
|
+
parsedArgs.push(parsedArg);
|
|
5306
|
+
}
|
|
5307
|
+
result.push({ t: functionName, d: parsedArgs }); // { t: scale, d: [1, 2] }
|
|
5308
|
+
if (transformRegExp.lastIndex === string.length) {
|
|
5309
|
+
return result;
|
|
5310
|
+
}
|
|
5311
|
+
}
|
|
5312
|
+
return [];
|
|
5313
|
+
}
|
|
5258
5314
|
function convertItemToMatrix(item) {
|
|
5259
5315
|
var x;
|
|
5260
5316
|
var y;
|
|
@@ -5870,6 +5926,39 @@ var parseTransformOrigin = memoize(function (value) {
|
|
|
5870
5926
|
];
|
|
5871
5927
|
}
|
|
5872
5928
|
});
|
|
5929
|
+
var parseTransformOriginUnmemoize = function (value) {
|
|
5930
|
+
if (isString(value)) {
|
|
5931
|
+
if (value === 'text-anchor') {
|
|
5932
|
+
return [getOrCreateUnitValue(0, 'px'), getOrCreateUnitValue(0, 'px')];
|
|
5933
|
+
}
|
|
5934
|
+
var values = value.split(' ');
|
|
5935
|
+
if (values.length === 1) {
|
|
5936
|
+
if (values[0] === 'top' || values[0] === 'bottom') {
|
|
5937
|
+
// 'top' -> 'center top'
|
|
5938
|
+
values[1] = values[0];
|
|
5939
|
+
values[0] = 'center';
|
|
5940
|
+
}
|
|
5941
|
+
else {
|
|
5942
|
+
// '50px' -> '50px center'
|
|
5943
|
+
values[1] = 'center';
|
|
5944
|
+
}
|
|
5945
|
+
}
|
|
5946
|
+
if (values.length !== 2) {
|
|
5947
|
+
return null;
|
|
5948
|
+
}
|
|
5949
|
+
// eg. center bottom
|
|
5950
|
+
return [
|
|
5951
|
+
parseLengthOrPercentageUnmemoize(convertKeyword2Percent(values[0])),
|
|
5952
|
+
parseLengthOrPercentageUnmemoize(convertKeyword2Percent(values[1])),
|
|
5953
|
+
];
|
|
5954
|
+
}
|
|
5955
|
+
else {
|
|
5956
|
+
return [
|
|
5957
|
+
getOrCreateUnitValue(value[0] || 0, 'px'),
|
|
5958
|
+
getOrCreateUnitValue(value[1] || 0, 'px'),
|
|
5959
|
+
];
|
|
5960
|
+
}
|
|
5961
|
+
};
|
|
5873
5962
|
function convertKeyword2Percent(keyword) {
|
|
5874
5963
|
if (keyword === 'center') {
|
|
5875
5964
|
return '50%';
|
|
@@ -6522,6 +6611,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6522
6611
|
skipParse: false,
|
|
6523
6612
|
forceUpdateGeometry: false,
|
|
6524
6613
|
usedAttributes: [],
|
|
6614
|
+
memoize: true,
|
|
6525
6615
|
}; }
|
|
6526
6616
|
if (!this.runtime.enableCSSParsing) {
|
|
6527
6617
|
Object.assign(object.attributes, attributes);
|
|
@@ -6685,7 +6775,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6685
6775
|
}
|
|
6686
6776
|
return;
|
|
6687
6777
|
}
|
|
6688
|
-
var skipUpdateAttribute = options.skipUpdateAttribute, skipParse = options.skipParse, forceUpdateGeometry = options.forceUpdateGeometry, usedAttributes = options.usedAttributes;
|
|
6778
|
+
var skipUpdateAttribute = options.skipUpdateAttribute, skipParse = options.skipParse, forceUpdateGeometry = options.forceUpdateGeometry, usedAttributes = options.usedAttributes, memoize = options.memoize;
|
|
6689
6779
|
var needUpdateGeometry = forceUpdateGeometry;
|
|
6690
6780
|
var attributeNames = Object.keys(attributes);
|
|
6691
6781
|
attributeNames.forEach(function (attributeName) {
|
|
@@ -6699,7 +6789,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6699
6789
|
});
|
|
6700
6790
|
if (!skipParse) {
|
|
6701
6791
|
attributeNames.forEach(function (name) {
|
|
6702
|
-
object.computedStyle[name] = _this.parseProperty(name, object.attributes[name], object);
|
|
6792
|
+
object.computedStyle[name] = _this.parseProperty(name, object.attributes[name], object, memoize);
|
|
6703
6793
|
});
|
|
6704
6794
|
}
|
|
6705
6795
|
// let hasUnresolvedProperties = false;
|
|
@@ -6733,7 +6823,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6733
6823
|
attributeNames.forEach(function (name) {
|
|
6734
6824
|
// some style props maybe deleted after parsing such as `anchor` in Text
|
|
6735
6825
|
if (name in object.computedStyle) {
|
|
6736
|
-
object.parsedStyle[name] = _this.computeProperty(name, object.computedStyle[name], object);
|
|
6826
|
+
object.parsedStyle[name] = _this.computeProperty(name, object.computedStyle[name], object, memoize);
|
|
6737
6827
|
}
|
|
6738
6828
|
});
|
|
6739
6829
|
// if (hasUnresolvedProperties) {
|
|
@@ -6768,7 +6858,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6768
6858
|
/**
|
|
6769
6859
|
* string -> parsed value
|
|
6770
6860
|
*/
|
|
6771
|
-
DefaultStyleValueRegistry.prototype.parseProperty = function (name, value, object) {
|
|
6861
|
+
DefaultStyleValueRegistry.prototype.parseProperty = function (name, value, object, memoized) {
|
|
6772
6862
|
var metadata = propertyMetadataCache[name];
|
|
6773
6863
|
var computed = value;
|
|
6774
6864
|
if (value === '' || isNil(value)) {
|
|
@@ -6787,9 +6877,14 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6787
6877
|
// computed = new CSSKeywordValue(value);
|
|
6788
6878
|
computed = getOrCreateKeyword(value);
|
|
6789
6879
|
}
|
|
6790
|
-
else if (handler
|
|
6791
|
-
|
|
6792
|
-
|
|
6880
|
+
else if (handler) {
|
|
6881
|
+
if (!memoized && handler.parserUnmemoize) {
|
|
6882
|
+
computed = handler.parserUnmemoize(value, object);
|
|
6883
|
+
}
|
|
6884
|
+
else if (handler.parser) {
|
|
6885
|
+
// try to parse it to CSSStyleValue, eg. '10px' -> CSS.px(10)
|
|
6886
|
+
computed = handler.parser(value, object);
|
|
6887
|
+
}
|
|
6793
6888
|
}
|
|
6794
6889
|
}
|
|
6795
6890
|
}
|
|
@@ -6798,7 +6893,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6798
6893
|
/**
|
|
6799
6894
|
* computed value -> used value
|
|
6800
6895
|
*/
|
|
6801
|
-
DefaultStyleValueRegistry.prototype.computeProperty = function (name, computed, object) {
|
|
6896
|
+
DefaultStyleValueRegistry.prototype.computeProperty = function (name, computed, object, memoized) {
|
|
6802
6897
|
var metadata = propertyMetadataCache[name];
|
|
6803
6898
|
var isDocumentElement = object.id === 'g-root';
|
|
6804
6899
|
// let used: CSSStyleValue = computed instanceof CSSStyleValue ? computed.clone() : computed;
|
|
@@ -6823,7 +6918,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6823
6918
|
if (!isNil(defaultValue)) {
|
|
6824
6919
|
computed = this.parseProperty(name, isFunction(defaultValue)
|
|
6825
6920
|
? defaultValue(object.nodeName)
|
|
6826
|
-
: defaultValue, object);
|
|
6921
|
+
: defaultValue, object, memoized);
|
|
6827
6922
|
}
|
|
6828
6923
|
}
|
|
6829
6924
|
else if (value === 'inherit') {
|
|
@@ -7091,6 +7186,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
7091
7186
|
var CSSPropertyAngle = /** @class */ (function () {
|
|
7092
7187
|
function CSSPropertyAngle() {
|
|
7093
7188
|
this.parser = parseAngle;
|
|
7189
|
+
this.parserUnmemoize = parseAngleUnmemoize;
|
|
7094
7190
|
this.parserWithCSSDisabled = null;
|
|
7095
7191
|
this.mixer = mergeNumbers;
|
|
7096
7192
|
}
|
|
@@ -7165,6 +7261,7 @@ function getFontSize(object) {
|
|
|
7165
7261
|
var CSSPropertyLengthOrPercentage = /** @class */ (function () {
|
|
7166
7262
|
function CSSPropertyLengthOrPercentage() {
|
|
7167
7263
|
this.parser = parseLengthOrPercentage;
|
|
7264
|
+
this.parserUnmemoize = parseLengthOrPercentageUnmemoize;
|
|
7168
7265
|
this.parserWithCSSDisabled = null;
|
|
7169
7266
|
this.mixer = mergeNumbers;
|
|
7170
7267
|
}
|
|
@@ -7486,6 +7583,7 @@ var CSSPropertyNumber = /** @class */ (function () {
|
|
|
7486
7583
|
function CSSPropertyNumber() {
|
|
7487
7584
|
this.mixer = mergeNumbers;
|
|
7488
7585
|
this.parser = parseNumber;
|
|
7586
|
+
this.parserUnmemoize = parseNumberUnmemoize;
|
|
7489
7587
|
this.parserWithCSSDisabled = null;
|
|
7490
7588
|
}
|
|
7491
7589
|
CSSPropertyNumber.prototype.calculator = function (name, oldParsed, computed) {
|
|
@@ -7497,6 +7595,7 @@ var CSSPropertyNumber = /** @class */ (function () {
|
|
|
7497
7595
|
var CSSPropertyOffsetDistance = /** @class */ (function () {
|
|
7498
7596
|
function CSSPropertyOffsetDistance() {
|
|
7499
7597
|
this.parser = parseNumber;
|
|
7598
|
+
this.parserUnmemoize = parseNumberUnmemoize;
|
|
7500
7599
|
this.parserWithCSSDisabled = null;
|
|
7501
7600
|
this.mixer = clampedMergeNumbers(0, 1);
|
|
7502
7601
|
}
|
|
@@ -7530,6 +7629,7 @@ var CSSPropertyOffsetDistance = /** @class */ (function () {
|
|
|
7530
7629
|
var CSSPropertyOpacity = /** @class */ (function () {
|
|
7531
7630
|
function CSSPropertyOpacity() {
|
|
7532
7631
|
this.parser = parseNumber;
|
|
7632
|
+
this.parserUnmemoize = parseNumberUnmemoize;
|
|
7533
7633
|
this.parserWithCSSDisabled = null;
|
|
7534
7634
|
this.mixer = clampedMergeNumbers(0, 1);
|
|
7535
7635
|
}
|
|
@@ -7601,7 +7701,7 @@ var CSSPropertyPoints = /** @class */ (function () {
|
|
|
7601
7701
|
var CSSPropertyShadowBlur = /** @class */ (function (_super) {
|
|
7602
7702
|
__extends(CSSPropertyShadowBlur, _super);
|
|
7603
7703
|
function CSSPropertyShadowBlur() {
|
|
7604
|
-
var _this = _super
|
|
7704
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
|
7605
7705
|
_this.mixer = clampedMergeNumbers(0, Infinity);
|
|
7606
7706
|
return _this;
|
|
7607
7707
|
}
|
|
@@ -8036,7 +8136,8 @@ function toFontString(attributes) {
|
|
|
8036
8136
|
var CSSPropertyTransform = /** @class */ (function () {
|
|
8037
8137
|
function CSSPropertyTransform() {
|
|
8038
8138
|
this.parser = parseTransform;
|
|
8039
|
-
this.
|
|
8139
|
+
this.parserUnmemoize = parseTransformUnmemoize;
|
|
8140
|
+
this.parserWithCSSDisabled = parseTransformUnmemoize;
|
|
8040
8141
|
this.mixer = mergeTransforms;
|
|
8041
8142
|
}
|
|
8042
8143
|
CSSPropertyTransform.prototype.calculator = function (name, oldParsed, parsed, object) {
|
|
@@ -8061,6 +8162,7 @@ var CSSPropertyTransform = /** @class */ (function () {
|
|
|
8061
8162
|
var CSSPropertyTransformOrigin = /** @class */ (function () {
|
|
8062
8163
|
function CSSPropertyTransformOrigin() {
|
|
8063
8164
|
this.parser = parseTransformOrigin;
|
|
8165
|
+
this.parserUnmemoize = parseTransformOriginUnmemoize;
|
|
8064
8166
|
// calculator(
|
|
8065
8167
|
// name: string,
|
|
8066
8168
|
// oldParsed: [CSSUnitValue, CSSUnitValue],
|
|
@@ -8078,6 +8180,7 @@ var CSSPropertyTransformOrigin = /** @class */ (function () {
|
|
|
8078
8180
|
var CSSPropertyZIndex = /** @class */ (function () {
|
|
8079
8181
|
function CSSPropertyZIndex() {
|
|
8080
8182
|
this.parser = parseNumber;
|
|
8183
|
+
this.parserUnmemoize = parseNumberUnmemoize;
|
|
8081
8184
|
}
|
|
8082
8185
|
CSSPropertyZIndex.prototype.calculator = function (name, oldParsed, computed, object) {
|
|
8083
8186
|
return computed.value;
|
|
@@ -8513,7 +8616,7 @@ var FederatedEvent = /** @class */ (function () {
|
|
|
8513
8616
|
var FederatedMouseEvent = /** @class */ (function (_super) {
|
|
8514
8617
|
__extends(FederatedMouseEvent, _super);
|
|
8515
8618
|
function FederatedMouseEvent() {
|
|
8516
|
-
var _this = _super
|
|
8619
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
|
8517
8620
|
/**
|
|
8518
8621
|
* The coordinates of the mouse event relative to the canvas.
|
|
8519
8622
|
*/
|
|
@@ -8621,7 +8724,7 @@ var FederatedMouseEvent = /** @class */ (function (_super) {
|
|
|
8621
8724
|
var FederatedPointerEvent = /** @class */ (function (_super) {
|
|
8622
8725
|
__extends(FederatedPointerEvent, _super);
|
|
8623
8726
|
function FederatedPointerEvent() {
|
|
8624
|
-
var _this = _super
|
|
8727
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
|
8625
8728
|
/**
|
|
8626
8729
|
* The width of the pointer's contact along the x-axis, measured in CSS pixels.
|
|
8627
8730
|
* radiusX of TouchEvents will be represented by this value.
|
|
@@ -8861,7 +8964,7 @@ var EventTarget = /** @class */ (function () {
|
|
|
8861
8964
|
var Node = /** @class */ (function (_super) {
|
|
8862
8965
|
__extends(Node, _super);
|
|
8863
8966
|
function Node() {
|
|
8864
|
-
var _this = _super
|
|
8967
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
|
8865
8968
|
_this.shadow = false;
|
|
8866
8969
|
/**
|
|
8867
8970
|
* points to canvas.document
|
|
@@ -9189,6 +9292,10 @@ var EventService = /** @class */ (function () {
|
|
|
9189
9292
|
this.globalRuntime = globalRuntime;
|
|
9190
9293
|
this.context = context;
|
|
9191
9294
|
this.emitter = new EventEmitter();
|
|
9295
|
+
/**
|
|
9296
|
+
* Store HTML elements in current canvas.
|
|
9297
|
+
*/
|
|
9298
|
+
this.nativeHTMLMap = new WeakMap();
|
|
9192
9299
|
this.cursor = 'default';
|
|
9193
9300
|
this.mappingTable = {};
|
|
9194
9301
|
this.mappingState = {
|
|
@@ -9673,7 +9780,7 @@ var EventService = /** @class */ (function () {
|
|
|
9673
9780
|
try {
|
|
9674
9781
|
for (var _b = __values(event.nativeEvent.composedPath()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
9675
9782
|
var eventTarget = _c.value;
|
|
9676
|
-
var existed = this.
|
|
9783
|
+
var existed = this.nativeHTMLMap.get(eventTarget);
|
|
9677
9784
|
if (existed) {
|
|
9678
9785
|
return existed;
|
|
9679
9786
|
}
|
|
@@ -11137,23 +11244,23 @@ var TEXT_METRICS = {
|
|
|
11137
11244
|
BaselineMultiplier: 1.4,
|
|
11138
11245
|
HeightMultiplier: 2,
|
|
11139
11246
|
Newlines: [
|
|
11140
|
-
0x000a,
|
|
11247
|
+
0x000a, // line feed
|
|
11141
11248
|
0x000d, // carriage return
|
|
11142
11249
|
],
|
|
11143
11250
|
BreakingSpaces: [
|
|
11144
|
-
0x0009,
|
|
11145
|
-
0x0020,
|
|
11146
|
-
0x2000,
|
|
11147
|
-
0x2001,
|
|
11148
|
-
0x2002,
|
|
11149
|
-
0x2003,
|
|
11150
|
-
0x2004,
|
|
11151
|
-
0x2005,
|
|
11152
|
-
0x2006,
|
|
11153
|
-
0x2008,
|
|
11154
|
-
0x2009,
|
|
11155
|
-
0x200a,
|
|
11156
|
-
0x205f,
|
|
11251
|
+
0x0009, // character tabulation
|
|
11252
|
+
0x0020, // space
|
|
11253
|
+
0x2000, // en quad
|
|
11254
|
+
0x2001, // em quad
|
|
11255
|
+
0x2002, // en space
|
|
11256
|
+
0x2003, // em space
|
|
11257
|
+
0x2004, // three-per-em space
|
|
11258
|
+
0x2005, // four-per-em space
|
|
11259
|
+
0x2006, // six-per-em space
|
|
11260
|
+
0x2008, // punctuation space
|
|
11261
|
+
0x2009, // thin space
|
|
11262
|
+
0x200a, // hair space
|
|
11263
|
+
0x205f, // medium mathematical space
|
|
11157
11264
|
0x3000, // ideographic space
|
|
11158
11265
|
],
|
|
11159
11266
|
};
|
|
@@ -11616,7 +11723,6 @@ runtime.CameraContribution = Camera;
|
|
|
11616
11723
|
runtime.AnimationTimeline = null;
|
|
11617
11724
|
runtime.EasingFunction = null;
|
|
11618
11725
|
runtime.offscreenCanvasCreator = new OffscreenCanvasCreator();
|
|
11619
|
-
runtime.nativeHTMLMap = new WeakMap();
|
|
11620
11726
|
runtime.sceneGraphSelector = new DefaultSceneGraphSelector();
|
|
11621
11727
|
runtime.sceneGraphService = new DefaultSceneGraphService(runtime);
|
|
11622
11728
|
runtime.textService = new TextService(runtime);
|
|
@@ -11645,7 +11751,7 @@ var destroyEvent = new CustomEvent(ElementEvent.DESTROY);
|
|
|
11645
11751
|
var Element = /** @class */ (function (_super) {
|
|
11646
11752
|
__extends(Element, _super);
|
|
11647
11753
|
function Element() {
|
|
11648
|
-
var _this = _super
|
|
11754
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
|
11649
11755
|
/**
|
|
11650
11756
|
* Unique id.
|
|
11651
11757
|
*/
|
|
@@ -12483,15 +12589,16 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12483
12589
|
// redraw at next frame
|
|
12484
12590
|
renderable.dirty = true;
|
|
12485
12591
|
};
|
|
12486
|
-
DisplayObject.prototype.setAttribute = function (name, value, force) {
|
|
12592
|
+
DisplayObject.prototype.setAttribute = function (name, value, force, memoize) {
|
|
12487
12593
|
if (force === void 0) { force = false; }
|
|
12594
|
+
if (memoize === void 0) { memoize = true; }
|
|
12488
12595
|
var attributeName = formatAttributeName(name);
|
|
12489
12596
|
// ignore undefined value
|
|
12490
12597
|
if (isUndefined(value)) {
|
|
12491
12598
|
return;
|
|
12492
12599
|
}
|
|
12493
12600
|
if (force || value !== this.attributes[attributeName]) {
|
|
12494
|
-
this.internalSetAttribute(attributeName, value);
|
|
12601
|
+
this.internalSetAttribute(attributeName, value, { memoize: memoize });
|
|
12495
12602
|
_super.prototype.setAttribute.call(this, attributeName, value);
|
|
12496
12603
|
}
|
|
12497
12604
|
};
|
|
@@ -13117,8 +13224,8 @@ var CustomElement = /** @class */ (function (_super) {
|
|
|
13117
13224
|
__extends(CustomElement, _super);
|
|
13118
13225
|
// private shadowNodes: DisplayObject[] = [];
|
|
13119
13226
|
function CustomElement(_a) {
|
|
13120
|
-
var _this = this;
|
|
13121
13227
|
if (_a === void 0) { _a = {}; }
|
|
13228
|
+
var _this = this;
|
|
13122
13229
|
var style = _a.style, rest = __rest(_a, ["style"]);
|
|
13123
13230
|
_this = _super.call(this, __assign({ style: runtime.enableCSSParsing
|
|
13124
13231
|
? __assign({ x: '', y: '' }, style) : __assign({}, style) }, rest)) || this;
|
|
@@ -13175,8 +13282,8 @@ var Group = /** @class */ (function (_super) {
|
|
|
13175
13282
|
var HTML = /** @class */ (function (_super) {
|
|
13176
13283
|
__extends(HTML, _super);
|
|
13177
13284
|
function HTML(_a) {
|
|
13178
|
-
var _this = this;
|
|
13179
13285
|
if (_a === void 0) { _a = {}; }
|
|
13286
|
+
var _this = this;
|
|
13180
13287
|
var style = _a.style, rest = __rest(_a, ["style"]);
|
|
13181
13288
|
_this = _super.call(this, __assign({ type: Shape.HTML, style: runtime.enableCSSParsing
|
|
13182
13289
|
? __assign({ x: '', y: '', width: 'auto', height: 'auto', innerHTML: '' }, style) : __assign({}, style) }, rest)) || this;
|
|
@@ -13254,8 +13361,8 @@ var Image = /** @class */ (function (_super) {
|
|
|
13254
13361
|
var Line = /** @class */ (function (_super) {
|
|
13255
13362
|
__extends(Line, _super);
|
|
13256
13363
|
function Line(_a) {
|
|
13257
|
-
var _this = this;
|
|
13258
13364
|
if (_a === void 0) { _a = {}; }
|
|
13365
|
+
var _this = this;
|
|
13259
13366
|
var style = _a.style, rest = __rest(_a, ["style"]);
|
|
13260
13367
|
_this = _super.call(this, __assign({ type: Shape.LINE, style: __assign({ x1: 0, y1: 0, x2: 0, y2: 0, z1: 0, z2: 0 }, style) }, rest)) || this;
|
|
13261
13368
|
_this.markerStartAngle = 0;
|
|
@@ -13365,8 +13472,8 @@ var Line = /** @class */ (function (_super) {
|
|
|
13365
13472
|
var Path = /** @class */ (function (_super) {
|
|
13366
13473
|
__extends(Path, _super);
|
|
13367
13474
|
function Path(_a) {
|
|
13368
|
-
var _this = this;
|
|
13369
13475
|
if (_a === void 0) { _a = {}; }
|
|
13476
|
+
var _this = this;
|
|
13370
13477
|
var style = _a.style, rest = __rest(_a, ["style"]);
|
|
13371
13478
|
_this = _super.call(this, __assign({ type: Shape.PATH, style: runtime.enableCSSParsing
|
|
13372
13479
|
? __assign({ path: '', miterLimit: '' }, style) : __assign({}, style), initialParsedStyle: runtime.enableCSSParsing
|
|
@@ -13566,8 +13673,8 @@ var Path = /** @class */ (function (_super) {
|
|
|
13566
13673
|
var Polygon = /** @class */ (function (_super) {
|
|
13567
13674
|
__extends(Polygon, _super);
|
|
13568
13675
|
function Polygon(_a) {
|
|
13569
|
-
var _this = this;
|
|
13570
13676
|
if (_a === void 0) { _a = {}; }
|
|
13677
|
+
var _this = this;
|
|
13571
13678
|
var style = _a.style, rest = __rest(_a, ["style"]);
|
|
13572
13679
|
_this = _super.call(this, __assign({ type: Shape.POLYGON, style: runtime.enableCSSParsing
|
|
13573
13680
|
? __assign({ points: '', miterLimit: '', isClosed: true }, style) : __assign({}, style), initialParsedStyle: runtime.enableCSSParsing
|