@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.js
CHANGED
|
@@ -3976,29 +3976,25 @@ function parseDimension(unitRegExp, string) {
|
|
|
3976
3976
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/length
|
|
3977
3977
|
* length with only absolute unit, eg. 1px
|
|
3978
3978
|
*/
|
|
3979
|
-
var
|
|
3979
|
+
var parseLengthUnmemoize = function (css) {
|
|
3980
3980
|
return parseDimension(new RegExp('px', 'g'), css);
|
|
3981
|
-
}
|
|
3981
|
+
};
|
|
3982
|
+
var parseLength = memoize(parseLengthUnmemoize);
|
|
3982
3983
|
/**
|
|
3983
3984
|
* <percentage>
|
|
3984
3985
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/percentage
|
|
3985
3986
|
*/
|
|
3986
|
-
|
|
3987
|
+
var parserPercentageUnmemoize = function (css) {
|
|
3987
3988
|
return parseDimension(new RegExp('%', 'g'), css);
|
|
3988
|
-
}
|
|
3989
|
+
};
|
|
3990
|
+
memoize(parserPercentageUnmemoize);
|
|
3989
3991
|
/**
|
|
3990
3992
|
* length with absolute or relative unit,
|
|
3991
3993
|
* eg. 1px, 0.7em, 50%, calc(100% - 200px);
|
|
3992
3994
|
*
|
|
3993
3995
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/length-percentage
|
|
3994
3996
|
*/
|
|
3995
|
-
|
|
3996
|
-
// if (isNumber(css) || isFinite(Number(css))) {
|
|
3997
|
-
// return getOrCreateUnitValue(Number(css), 'px');
|
|
3998
|
-
// }
|
|
3999
|
-
// return parseDimension(new RegExp('px|%|em|rem', 'g'), css) as CSSUnitValue;
|
|
4000
|
-
// });
|
|
4001
|
-
var parseLengthOrPercentage = function (css) {
|
|
3997
|
+
var parseLengthOrPercentageUnmemoize = function (css) {
|
|
4002
3998
|
if (util.isNumber(css) || isFinite(Number(css))) {
|
|
4003
3999
|
// Number(css) is NaN
|
|
4004
4000
|
return getOrCreateUnitValue(Number(css) || 0, 'px');
|
|
@@ -4006,9 +4002,11 @@ var parseLengthOrPercentage = function (css) {
|
|
|
4006
4002
|
}
|
|
4007
4003
|
return parseDimension(new RegExp('px|%|em|rem', 'g'), css);
|
|
4008
4004
|
};
|
|
4009
|
-
var
|
|
4005
|
+
var parseLengthOrPercentage = memoize(parseLengthOrPercentageUnmemoize);
|
|
4006
|
+
var parseAngleUnmemoize = function (css) {
|
|
4010
4007
|
return parseDimension(new RegExp('deg|rad|grad|turn', 'g'), css);
|
|
4011
|
-
}
|
|
4008
|
+
};
|
|
4009
|
+
var parseAngle = memoize(parseAngleUnmemoize);
|
|
4012
4010
|
/**
|
|
4013
4011
|
* merge CSSUnitValue
|
|
4014
4012
|
*
|
|
@@ -4201,7 +4199,7 @@ function numberToString(x) {
|
|
|
4201
4199
|
* * 0 -> CSSUnitValue(0)
|
|
4202
4200
|
* * '2' -> CSSUnitValue(2)
|
|
4203
4201
|
*/
|
|
4204
|
-
var
|
|
4202
|
+
var parseNumberUnmemoize = function (string) {
|
|
4205
4203
|
if (typeof string === 'number') {
|
|
4206
4204
|
return getOrCreateUnitValue(string);
|
|
4207
4205
|
}
|
|
@@ -4211,12 +4209,8 @@ var parseNumber = memoize(function (string) {
|
|
|
4211
4209
|
else {
|
|
4212
4210
|
return getOrCreateUnitValue(0);
|
|
4213
4211
|
}
|
|
4214
|
-
}
|
|
4215
|
-
|
|
4216
|
-
* separate string to array
|
|
4217
|
-
* eg.
|
|
4218
|
-
* * [0.5, 0.5] -> [CSSUnitValue, CSSUnitValue]
|
|
4219
|
-
*/
|
|
4212
|
+
};
|
|
4213
|
+
var parseNumber = memoize(parseNumberUnmemoize);
|
|
4220
4214
|
memoize(function (string) {
|
|
4221
4215
|
if (util.isString(string)) {
|
|
4222
4216
|
return string.split(' ').map(parseNumber);
|
|
@@ -5276,6 +5270,68 @@ function parseTransform(string) {
|
|
|
5276
5270
|
}
|
|
5277
5271
|
return [];
|
|
5278
5272
|
}
|
|
5273
|
+
function parseTransformUnmemoize(string) {
|
|
5274
|
+
string = (string || 'none').toLowerCase().trim();
|
|
5275
|
+
if (string === 'none') {
|
|
5276
|
+
return [];
|
|
5277
|
+
}
|
|
5278
|
+
var transformRegExp = /\s*(\w+)\(([^)]*)\)/g;
|
|
5279
|
+
var result = [];
|
|
5280
|
+
var match;
|
|
5281
|
+
var prevLastIndex = 0;
|
|
5282
|
+
while ((match = transformRegExp.exec(string))) {
|
|
5283
|
+
if (match.index !== prevLastIndex) {
|
|
5284
|
+
return [];
|
|
5285
|
+
}
|
|
5286
|
+
prevLastIndex = match.index + match[0].length;
|
|
5287
|
+
var functionName = match[1]; // scale
|
|
5288
|
+
var functionData = transformFunctions[functionName]; // scale(1, 2)
|
|
5289
|
+
if (!functionData) {
|
|
5290
|
+
// invalid, eg. scale()
|
|
5291
|
+
return [];
|
|
5292
|
+
}
|
|
5293
|
+
var args = match[2].split(','); // 1,2
|
|
5294
|
+
var argTypes = functionData[0]; // Nn
|
|
5295
|
+
if (argTypes.length < args.length) {
|
|
5296
|
+
// scale(N, n)
|
|
5297
|
+
return [];
|
|
5298
|
+
}
|
|
5299
|
+
var parsedArgs = [];
|
|
5300
|
+
for (var i = 0; i < argTypes.length; i++) {
|
|
5301
|
+
var arg = args[i];
|
|
5302
|
+
var type = argTypes[i];
|
|
5303
|
+
var parsedArg = void 0;
|
|
5304
|
+
if (!arg) {
|
|
5305
|
+
// @ts-ignore
|
|
5306
|
+
parsedArg = {
|
|
5307
|
+
a: Odeg,
|
|
5308
|
+
n: parsedArgs[0],
|
|
5309
|
+
t: Opx,
|
|
5310
|
+
}[type];
|
|
5311
|
+
}
|
|
5312
|
+
else {
|
|
5313
|
+
// @ts-ignore
|
|
5314
|
+
parsedArg = {
|
|
5315
|
+
A: function (s) {
|
|
5316
|
+
return s.trim() === '0' ? Odeg : parseAngleUnmemoize(s);
|
|
5317
|
+
},
|
|
5318
|
+
N: parseNumberUnmemoize,
|
|
5319
|
+
T: parseLengthOrPercentageUnmemoize,
|
|
5320
|
+
L: parseLengthUnmemoize,
|
|
5321
|
+
}[type.toUpperCase()](arg);
|
|
5322
|
+
}
|
|
5323
|
+
if (parsedArg === undefined) {
|
|
5324
|
+
return [];
|
|
5325
|
+
}
|
|
5326
|
+
parsedArgs.push(parsedArg);
|
|
5327
|
+
}
|
|
5328
|
+
result.push({ t: functionName, d: parsedArgs }); // { t: scale, d: [1, 2] }
|
|
5329
|
+
if (transformRegExp.lastIndex === string.length) {
|
|
5330
|
+
return result;
|
|
5331
|
+
}
|
|
5332
|
+
}
|
|
5333
|
+
return [];
|
|
5334
|
+
}
|
|
5279
5335
|
function convertItemToMatrix(item) {
|
|
5280
5336
|
var x;
|
|
5281
5337
|
var y;
|
|
@@ -5891,6 +5947,39 @@ var parseTransformOrigin = memoize(function (value) {
|
|
|
5891
5947
|
];
|
|
5892
5948
|
}
|
|
5893
5949
|
});
|
|
5950
|
+
var parseTransformOriginUnmemoize = function (value) {
|
|
5951
|
+
if (util.isString(value)) {
|
|
5952
|
+
if (value === 'text-anchor') {
|
|
5953
|
+
return [getOrCreateUnitValue(0, 'px'), getOrCreateUnitValue(0, 'px')];
|
|
5954
|
+
}
|
|
5955
|
+
var values = value.split(' ');
|
|
5956
|
+
if (values.length === 1) {
|
|
5957
|
+
if (values[0] === 'top' || values[0] === 'bottom') {
|
|
5958
|
+
// 'top' -> 'center top'
|
|
5959
|
+
values[1] = values[0];
|
|
5960
|
+
values[0] = 'center';
|
|
5961
|
+
}
|
|
5962
|
+
else {
|
|
5963
|
+
// '50px' -> '50px center'
|
|
5964
|
+
values[1] = 'center';
|
|
5965
|
+
}
|
|
5966
|
+
}
|
|
5967
|
+
if (values.length !== 2) {
|
|
5968
|
+
return null;
|
|
5969
|
+
}
|
|
5970
|
+
// eg. center bottom
|
|
5971
|
+
return [
|
|
5972
|
+
parseLengthOrPercentageUnmemoize(convertKeyword2Percent(values[0])),
|
|
5973
|
+
parseLengthOrPercentageUnmemoize(convertKeyword2Percent(values[1])),
|
|
5974
|
+
];
|
|
5975
|
+
}
|
|
5976
|
+
else {
|
|
5977
|
+
return [
|
|
5978
|
+
getOrCreateUnitValue(value[0] || 0, 'px'),
|
|
5979
|
+
getOrCreateUnitValue(value[1] || 0, 'px'),
|
|
5980
|
+
];
|
|
5981
|
+
}
|
|
5982
|
+
};
|
|
5894
5983
|
function convertKeyword2Percent(keyword) {
|
|
5895
5984
|
if (keyword === 'center') {
|
|
5896
5985
|
return '50%';
|
|
@@ -6543,6 +6632,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6543
6632
|
skipParse: false,
|
|
6544
6633
|
forceUpdateGeometry: false,
|
|
6545
6634
|
usedAttributes: [],
|
|
6635
|
+
memoize: true,
|
|
6546
6636
|
}; }
|
|
6547
6637
|
if (!this.runtime.enableCSSParsing) {
|
|
6548
6638
|
Object.assign(object.attributes, attributes);
|
|
@@ -6706,7 +6796,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6706
6796
|
}
|
|
6707
6797
|
return;
|
|
6708
6798
|
}
|
|
6709
|
-
var skipUpdateAttribute = options.skipUpdateAttribute, skipParse = options.skipParse, forceUpdateGeometry = options.forceUpdateGeometry, usedAttributes = options.usedAttributes;
|
|
6799
|
+
var skipUpdateAttribute = options.skipUpdateAttribute, skipParse = options.skipParse, forceUpdateGeometry = options.forceUpdateGeometry, usedAttributes = options.usedAttributes, memoize = options.memoize;
|
|
6710
6800
|
var needUpdateGeometry = forceUpdateGeometry;
|
|
6711
6801
|
var attributeNames = Object.keys(attributes);
|
|
6712
6802
|
attributeNames.forEach(function (attributeName) {
|
|
@@ -6720,7 +6810,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6720
6810
|
});
|
|
6721
6811
|
if (!skipParse) {
|
|
6722
6812
|
attributeNames.forEach(function (name) {
|
|
6723
|
-
object.computedStyle[name] = _this.parseProperty(name, object.attributes[name], object);
|
|
6813
|
+
object.computedStyle[name] = _this.parseProperty(name, object.attributes[name], object, memoize);
|
|
6724
6814
|
});
|
|
6725
6815
|
}
|
|
6726
6816
|
// let hasUnresolvedProperties = false;
|
|
@@ -6754,7 +6844,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6754
6844
|
attributeNames.forEach(function (name) {
|
|
6755
6845
|
// some style props maybe deleted after parsing such as `anchor` in Text
|
|
6756
6846
|
if (name in object.computedStyle) {
|
|
6757
|
-
object.parsedStyle[name] = _this.computeProperty(name, object.computedStyle[name], object);
|
|
6847
|
+
object.parsedStyle[name] = _this.computeProperty(name, object.computedStyle[name], object, memoize);
|
|
6758
6848
|
}
|
|
6759
6849
|
});
|
|
6760
6850
|
// if (hasUnresolvedProperties) {
|
|
@@ -6789,7 +6879,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6789
6879
|
/**
|
|
6790
6880
|
* string -> parsed value
|
|
6791
6881
|
*/
|
|
6792
|
-
DefaultStyleValueRegistry.prototype.parseProperty = function (name, value, object) {
|
|
6882
|
+
DefaultStyleValueRegistry.prototype.parseProperty = function (name, value, object, memoized) {
|
|
6793
6883
|
var metadata = propertyMetadataCache[name];
|
|
6794
6884
|
var computed = value;
|
|
6795
6885
|
if (value === '' || util.isNil(value)) {
|
|
@@ -6808,9 +6898,14 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6808
6898
|
// computed = new CSSKeywordValue(value);
|
|
6809
6899
|
computed = getOrCreateKeyword(value);
|
|
6810
6900
|
}
|
|
6811
|
-
else if (handler
|
|
6812
|
-
|
|
6813
|
-
|
|
6901
|
+
else if (handler) {
|
|
6902
|
+
if (!memoized && handler.parserUnmemoize) {
|
|
6903
|
+
computed = handler.parserUnmemoize(value, object);
|
|
6904
|
+
}
|
|
6905
|
+
else if (handler.parser) {
|
|
6906
|
+
// try to parse it to CSSStyleValue, eg. '10px' -> CSS.px(10)
|
|
6907
|
+
computed = handler.parser(value, object);
|
|
6908
|
+
}
|
|
6814
6909
|
}
|
|
6815
6910
|
}
|
|
6816
6911
|
}
|
|
@@ -6819,7 +6914,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6819
6914
|
/**
|
|
6820
6915
|
* computed value -> used value
|
|
6821
6916
|
*/
|
|
6822
|
-
DefaultStyleValueRegistry.prototype.computeProperty = function (name, computed, object) {
|
|
6917
|
+
DefaultStyleValueRegistry.prototype.computeProperty = function (name, computed, object, memoized) {
|
|
6823
6918
|
var metadata = propertyMetadataCache[name];
|
|
6824
6919
|
var isDocumentElement = object.id === 'g-root';
|
|
6825
6920
|
// let used: CSSStyleValue = computed instanceof CSSStyleValue ? computed.clone() : computed;
|
|
@@ -6844,7 +6939,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6844
6939
|
if (!util.isNil(defaultValue)) {
|
|
6845
6940
|
computed = this.parseProperty(name, isFunction(defaultValue)
|
|
6846
6941
|
? defaultValue(object.nodeName)
|
|
6847
|
-
: defaultValue, object);
|
|
6942
|
+
: defaultValue, object, memoized);
|
|
6848
6943
|
}
|
|
6849
6944
|
}
|
|
6850
6945
|
else if (value === 'inherit') {
|
|
@@ -7112,6 +7207,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
7112
7207
|
var CSSPropertyAngle = /** @class */ (function () {
|
|
7113
7208
|
function CSSPropertyAngle() {
|
|
7114
7209
|
this.parser = parseAngle;
|
|
7210
|
+
this.parserUnmemoize = parseAngleUnmemoize;
|
|
7115
7211
|
this.parserWithCSSDisabled = null;
|
|
7116
7212
|
this.mixer = mergeNumbers;
|
|
7117
7213
|
}
|
|
@@ -7186,6 +7282,7 @@ function getFontSize(object) {
|
|
|
7186
7282
|
var CSSPropertyLengthOrPercentage = /** @class */ (function () {
|
|
7187
7283
|
function CSSPropertyLengthOrPercentage() {
|
|
7188
7284
|
this.parser = parseLengthOrPercentage;
|
|
7285
|
+
this.parserUnmemoize = parseLengthOrPercentageUnmemoize;
|
|
7189
7286
|
this.parserWithCSSDisabled = null;
|
|
7190
7287
|
this.mixer = mergeNumbers;
|
|
7191
7288
|
}
|
|
@@ -7507,6 +7604,7 @@ var CSSPropertyNumber = /** @class */ (function () {
|
|
|
7507
7604
|
function CSSPropertyNumber() {
|
|
7508
7605
|
this.mixer = mergeNumbers;
|
|
7509
7606
|
this.parser = parseNumber;
|
|
7607
|
+
this.parserUnmemoize = parseNumberUnmemoize;
|
|
7510
7608
|
this.parserWithCSSDisabled = null;
|
|
7511
7609
|
}
|
|
7512
7610
|
CSSPropertyNumber.prototype.calculator = function (name, oldParsed, computed) {
|
|
@@ -7518,6 +7616,7 @@ var CSSPropertyNumber = /** @class */ (function () {
|
|
|
7518
7616
|
var CSSPropertyOffsetDistance = /** @class */ (function () {
|
|
7519
7617
|
function CSSPropertyOffsetDistance() {
|
|
7520
7618
|
this.parser = parseNumber;
|
|
7619
|
+
this.parserUnmemoize = parseNumberUnmemoize;
|
|
7521
7620
|
this.parserWithCSSDisabled = null;
|
|
7522
7621
|
this.mixer = clampedMergeNumbers(0, 1);
|
|
7523
7622
|
}
|
|
@@ -7551,6 +7650,7 @@ var CSSPropertyOffsetDistance = /** @class */ (function () {
|
|
|
7551
7650
|
var CSSPropertyOpacity = /** @class */ (function () {
|
|
7552
7651
|
function CSSPropertyOpacity() {
|
|
7553
7652
|
this.parser = parseNumber;
|
|
7653
|
+
this.parserUnmemoize = parseNumberUnmemoize;
|
|
7554
7654
|
this.parserWithCSSDisabled = null;
|
|
7555
7655
|
this.mixer = clampedMergeNumbers(0, 1);
|
|
7556
7656
|
}
|
|
@@ -7622,7 +7722,7 @@ var CSSPropertyPoints = /** @class */ (function () {
|
|
|
7622
7722
|
var CSSPropertyShadowBlur = /** @class */ (function (_super) {
|
|
7623
7723
|
tslib.__extends(CSSPropertyShadowBlur, _super);
|
|
7624
7724
|
function CSSPropertyShadowBlur() {
|
|
7625
|
-
var _this = _super
|
|
7725
|
+
var _this = _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments), false)) || this;
|
|
7626
7726
|
_this.mixer = clampedMergeNumbers(0, Infinity);
|
|
7627
7727
|
return _this;
|
|
7628
7728
|
}
|
|
@@ -8057,7 +8157,8 @@ function toFontString(attributes) {
|
|
|
8057
8157
|
var CSSPropertyTransform = /** @class */ (function () {
|
|
8058
8158
|
function CSSPropertyTransform() {
|
|
8059
8159
|
this.parser = parseTransform;
|
|
8060
|
-
this.
|
|
8160
|
+
this.parserUnmemoize = parseTransformUnmemoize;
|
|
8161
|
+
this.parserWithCSSDisabled = parseTransformUnmemoize;
|
|
8061
8162
|
this.mixer = mergeTransforms;
|
|
8062
8163
|
}
|
|
8063
8164
|
CSSPropertyTransform.prototype.calculator = function (name, oldParsed, parsed, object) {
|
|
@@ -8082,6 +8183,7 @@ var CSSPropertyTransform = /** @class */ (function () {
|
|
|
8082
8183
|
var CSSPropertyTransformOrigin = /** @class */ (function () {
|
|
8083
8184
|
function CSSPropertyTransformOrigin() {
|
|
8084
8185
|
this.parser = parseTransformOrigin;
|
|
8186
|
+
this.parserUnmemoize = parseTransformOriginUnmemoize;
|
|
8085
8187
|
// calculator(
|
|
8086
8188
|
// name: string,
|
|
8087
8189
|
// oldParsed: [CSSUnitValue, CSSUnitValue],
|
|
@@ -8099,6 +8201,7 @@ var CSSPropertyTransformOrigin = /** @class */ (function () {
|
|
|
8099
8201
|
var CSSPropertyZIndex = /** @class */ (function () {
|
|
8100
8202
|
function CSSPropertyZIndex() {
|
|
8101
8203
|
this.parser = parseNumber;
|
|
8204
|
+
this.parserUnmemoize = parseNumberUnmemoize;
|
|
8102
8205
|
}
|
|
8103
8206
|
CSSPropertyZIndex.prototype.calculator = function (name, oldParsed, computed, object) {
|
|
8104
8207
|
return computed.value;
|
|
@@ -8534,7 +8637,7 @@ var FederatedEvent = /** @class */ (function () {
|
|
|
8534
8637
|
var FederatedMouseEvent = /** @class */ (function (_super) {
|
|
8535
8638
|
tslib.__extends(FederatedMouseEvent, _super);
|
|
8536
8639
|
function FederatedMouseEvent() {
|
|
8537
|
-
var _this = _super
|
|
8640
|
+
var _this = _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments), false)) || this;
|
|
8538
8641
|
/**
|
|
8539
8642
|
* The coordinates of the mouse event relative to the canvas.
|
|
8540
8643
|
*/
|
|
@@ -8642,7 +8745,7 @@ var FederatedMouseEvent = /** @class */ (function (_super) {
|
|
|
8642
8745
|
var FederatedPointerEvent = /** @class */ (function (_super) {
|
|
8643
8746
|
tslib.__extends(FederatedPointerEvent, _super);
|
|
8644
8747
|
function FederatedPointerEvent() {
|
|
8645
|
-
var _this = _super
|
|
8748
|
+
var _this = _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments), false)) || this;
|
|
8646
8749
|
/**
|
|
8647
8750
|
* The width of the pointer's contact along the x-axis, measured in CSS pixels.
|
|
8648
8751
|
* radiusX of TouchEvents will be represented by this value.
|
|
@@ -8882,7 +8985,7 @@ var EventTarget = /** @class */ (function () {
|
|
|
8882
8985
|
var Node = /** @class */ (function (_super) {
|
|
8883
8986
|
tslib.__extends(Node, _super);
|
|
8884
8987
|
function Node() {
|
|
8885
|
-
var _this = _super
|
|
8988
|
+
var _this = _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments), false)) || this;
|
|
8886
8989
|
_this.shadow = false;
|
|
8887
8990
|
/**
|
|
8888
8991
|
* points to canvas.document
|
|
@@ -9210,6 +9313,10 @@ var EventService = /** @class */ (function () {
|
|
|
9210
9313
|
this.globalRuntime = globalRuntime;
|
|
9211
9314
|
this.context = context;
|
|
9212
9315
|
this.emitter = new EventEmitter();
|
|
9316
|
+
/**
|
|
9317
|
+
* Store HTML elements in current canvas.
|
|
9318
|
+
*/
|
|
9319
|
+
this.nativeHTMLMap = new WeakMap();
|
|
9213
9320
|
this.cursor = 'default';
|
|
9214
9321
|
this.mappingTable = {};
|
|
9215
9322
|
this.mappingState = {
|
|
@@ -9694,7 +9801,7 @@ var EventService = /** @class */ (function () {
|
|
|
9694
9801
|
try {
|
|
9695
9802
|
for (var _b = tslib.__values(event.nativeEvent.composedPath()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
9696
9803
|
var eventTarget = _c.value;
|
|
9697
|
-
var existed = this.
|
|
9804
|
+
var existed = this.nativeHTMLMap.get(eventTarget);
|
|
9698
9805
|
if (existed) {
|
|
9699
9806
|
return existed;
|
|
9700
9807
|
}
|
|
@@ -11158,23 +11265,23 @@ var TEXT_METRICS = {
|
|
|
11158
11265
|
BaselineMultiplier: 1.4,
|
|
11159
11266
|
HeightMultiplier: 2,
|
|
11160
11267
|
Newlines: [
|
|
11161
|
-
0x000a,
|
|
11268
|
+
0x000a, // line feed
|
|
11162
11269
|
0x000d, // carriage return
|
|
11163
11270
|
],
|
|
11164
11271
|
BreakingSpaces: [
|
|
11165
|
-
0x0009,
|
|
11166
|
-
0x0020,
|
|
11167
|
-
0x2000,
|
|
11168
|
-
0x2001,
|
|
11169
|
-
0x2002,
|
|
11170
|
-
0x2003,
|
|
11171
|
-
0x2004,
|
|
11172
|
-
0x2005,
|
|
11173
|
-
0x2006,
|
|
11174
|
-
0x2008,
|
|
11175
|
-
0x2009,
|
|
11176
|
-
0x200a,
|
|
11177
|
-
0x205f,
|
|
11272
|
+
0x0009, // character tabulation
|
|
11273
|
+
0x0020, // space
|
|
11274
|
+
0x2000, // en quad
|
|
11275
|
+
0x2001, // em quad
|
|
11276
|
+
0x2002, // en space
|
|
11277
|
+
0x2003, // em space
|
|
11278
|
+
0x2004, // three-per-em space
|
|
11279
|
+
0x2005, // four-per-em space
|
|
11280
|
+
0x2006, // six-per-em space
|
|
11281
|
+
0x2008, // punctuation space
|
|
11282
|
+
0x2009, // thin space
|
|
11283
|
+
0x200a, // hair space
|
|
11284
|
+
0x205f, // medium mathematical space
|
|
11178
11285
|
0x3000, // ideographic space
|
|
11179
11286
|
],
|
|
11180
11287
|
};
|
|
@@ -11637,7 +11744,6 @@ runtime.CameraContribution = Camera;
|
|
|
11637
11744
|
runtime.AnimationTimeline = null;
|
|
11638
11745
|
runtime.EasingFunction = null;
|
|
11639
11746
|
runtime.offscreenCanvasCreator = new OffscreenCanvasCreator();
|
|
11640
|
-
runtime.nativeHTMLMap = new WeakMap();
|
|
11641
11747
|
runtime.sceneGraphSelector = new DefaultSceneGraphSelector();
|
|
11642
11748
|
runtime.sceneGraphService = new DefaultSceneGraphService(runtime);
|
|
11643
11749
|
runtime.textService = new TextService(runtime);
|
|
@@ -11666,7 +11772,7 @@ var destroyEvent = new CustomEvent(exports.ElementEvent.DESTROY);
|
|
|
11666
11772
|
var Element = /** @class */ (function (_super) {
|
|
11667
11773
|
tslib.__extends(Element, _super);
|
|
11668
11774
|
function Element() {
|
|
11669
|
-
var _this = _super
|
|
11775
|
+
var _this = _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments), false)) || this;
|
|
11670
11776
|
/**
|
|
11671
11777
|
* Unique id.
|
|
11672
11778
|
*/
|
|
@@ -12504,15 +12610,16 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12504
12610
|
// redraw at next frame
|
|
12505
12611
|
renderable.dirty = true;
|
|
12506
12612
|
};
|
|
12507
|
-
DisplayObject.prototype.setAttribute = function (name, value, force) {
|
|
12613
|
+
DisplayObject.prototype.setAttribute = function (name, value, force, memoize) {
|
|
12508
12614
|
if (force === void 0) { force = false; }
|
|
12615
|
+
if (memoize === void 0) { memoize = true; }
|
|
12509
12616
|
var attributeName = formatAttributeName(name);
|
|
12510
12617
|
// ignore undefined value
|
|
12511
12618
|
if (util.isUndefined(value)) {
|
|
12512
12619
|
return;
|
|
12513
12620
|
}
|
|
12514
12621
|
if (force || value !== this.attributes[attributeName]) {
|
|
12515
|
-
this.internalSetAttribute(attributeName, value);
|
|
12622
|
+
this.internalSetAttribute(attributeName, value, { memoize: memoize });
|
|
12516
12623
|
_super.prototype.setAttribute.call(this, attributeName, value);
|
|
12517
12624
|
}
|
|
12518
12625
|
};
|
|
@@ -13138,8 +13245,8 @@ var CustomElement = /** @class */ (function (_super) {
|
|
|
13138
13245
|
tslib.__extends(CustomElement, _super);
|
|
13139
13246
|
// private shadowNodes: DisplayObject[] = [];
|
|
13140
13247
|
function CustomElement(_a) {
|
|
13141
|
-
var _this = this;
|
|
13142
13248
|
if (_a === void 0) { _a = {}; }
|
|
13249
|
+
var _this = this;
|
|
13143
13250
|
var style = _a.style, rest = tslib.__rest(_a, ["style"]);
|
|
13144
13251
|
_this = _super.call(this, tslib.__assign({ style: runtime.enableCSSParsing
|
|
13145
13252
|
? tslib.__assign({ x: '', y: '' }, style) : tslib.__assign({}, style) }, rest)) || this;
|
|
@@ -13196,8 +13303,8 @@ var Group = /** @class */ (function (_super) {
|
|
|
13196
13303
|
var HTML = /** @class */ (function (_super) {
|
|
13197
13304
|
tslib.__extends(HTML, _super);
|
|
13198
13305
|
function HTML(_a) {
|
|
13199
|
-
var _this = this;
|
|
13200
13306
|
if (_a === void 0) { _a = {}; }
|
|
13307
|
+
var _this = this;
|
|
13201
13308
|
var style = _a.style, rest = tslib.__rest(_a, ["style"]);
|
|
13202
13309
|
_this = _super.call(this, tslib.__assign({ type: exports.Shape.HTML, style: runtime.enableCSSParsing
|
|
13203
13310
|
? tslib.__assign({ x: '', y: '', width: 'auto', height: 'auto', innerHTML: '' }, style) : tslib.__assign({}, style) }, rest)) || this;
|
|
@@ -13275,8 +13382,8 @@ var Image = /** @class */ (function (_super) {
|
|
|
13275
13382
|
var Line = /** @class */ (function (_super) {
|
|
13276
13383
|
tslib.__extends(Line, _super);
|
|
13277
13384
|
function Line(_a) {
|
|
13278
|
-
var _this = this;
|
|
13279
13385
|
if (_a === void 0) { _a = {}; }
|
|
13386
|
+
var _this = this;
|
|
13280
13387
|
var style = _a.style, rest = tslib.__rest(_a, ["style"]);
|
|
13281
13388
|
_this = _super.call(this, tslib.__assign({ type: exports.Shape.LINE, style: tslib.__assign({ x1: 0, y1: 0, x2: 0, y2: 0, z1: 0, z2: 0 }, style) }, rest)) || this;
|
|
13282
13389
|
_this.markerStartAngle = 0;
|
|
@@ -13386,8 +13493,8 @@ var Line = /** @class */ (function (_super) {
|
|
|
13386
13493
|
var Path = /** @class */ (function (_super) {
|
|
13387
13494
|
tslib.__extends(Path, _super);
|
|
13388
13495
|
function Path(_a) {
|
|
13389
|
-
var _this = this;
|
|
13390
13496
|
if (_a === void 0) { _a = {}; }
|
|
13497
|
+
var _this = this;
|
|
13391
13498
|
var style = _a.style, rest = tslib.__rest(_a, ["style"]);
|
|
13392
13499
|
_this = _super.call(this, tslib.__assign({ type: exports.Shape.PATH, style: runtime.enableCSSParsing
|
|
13393
13500
|
? tslib.__assign({ path: '', miterLimit: '' }, style) : tslib.__assign({}, style), initialParsedStyle: runtime.enableCSSParsing
|
|
@@ -13587,8 +13694,8 @@ var Path = /** @class */ (function (_super) {
|
|
|
13587
13694
|
var Polygon = /** @class */ (function (_super) {
|
|
13588
13695
|
tslib.__extends(Polygon, _super);
|
|
13589
13696
|
function Polygon(_a) {
|
|
13590
|
-
var _this = this;
|
|
13591
13697
|
if (_a === void 0) { _a = {}; }
|
|
13698
|
+
var _this = this;
|
|
13592
13699
|
var style = _a.style, rest = tslib.__rest(_a, ["style"]);
|
|
13593
13700
|
_this = _super.call(this, tslib.__assign({ type: exports.Shape.POLYGON, style: runtime.enableCSSParsing
|
|
13594
13701
|
? tslib.__assign({ points: '', miterLimit: '', isClosed: true }, style) : tslib.__assign({}, style), initialParsedStyle: runtime.enableCSSParsing
|