@antv/g-lite 1.2.20 → 1.2.22
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/Canvas.d.ts +2 -1
- package/dist/css/CSSProperty.d.ts +7 -0
- package/dist/css/StyleValueRegistry.d.ts +3 -2
- package/dist/css/interfaces.d.ts +4 -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/display-objects/Ellipse.d.ts +2 -0
- package/dist/display-objects/Polygon.d.ts +2 -0
- package/dist/display-objects/Rect.d.ts +2 -0
- package/dist/global-runtime.d.ts +1 -0
- package/dist/index.esm.js +177 -33
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +177 -33
- 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/types.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -662,7 +662,7 @@ var AbstractRenderer = /** @class */ (function () {
|
|
|
662
662
|
/**
|
|
663
663
|
* enable dirty rectangle rendering by default
|
|
664
664
|
*/
|
|
665
|
-
enableDirtyRectangleRendering: true, enableDirtyRectangleRenderingDebug: false }, config);
|
|
665
|
+
enableDirtyRectangleRendering: true, enableDirtyRectangleRenderingDebug: false, enableSizeAttenuation: true }, config);
|
|
666
666
|
}
|
|
667
667
|
AbstractRenderer.prototype.registerPlugin = function (plugin) {
|
|
668
668
|
var index = this.plugins.findIndex(function (p) { return p === plugin; });
|
|
@@ -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') {
|
|
@@ -7099,6 +7194,32 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
7099
7194
|
this.runtime.sceneGraphService.dirtifyToRoot(object);
|
|
7100
7195
|
}
|
|
7101
7196
|
};
|
|
7197
|
+
DefaultStyleValueRegistry.prototype.updateSizeAttenuation = function (node, zoom) {
|
|
7198
|
+
if (node.style.isSizeAttenuation) {
|
|
7199
|
+
if (!node.style.rawLineWidth) {
|
|
7200
|
+
node.style.rawLineWidth = node.style.lineWidth;
|
|
7201
|
+
}
|
|
7202
|
+
node.style.lineWidth = node.style.rawLineWidth / zoom;
|
|
7203
|
+
if (node.nodeName === exports.Shape.CIRCLE) {
|
|
7204
|
+
if (!node.style.rawR) {
|
|
7205
|
+
node.style.rawR = node.style.r;
|
|
7206
|
+
}
|
|
7207
|
+
node.style.r = node.style.rawR / zoom;
|
|
7208
|
+
}
|
|
7209
|
+
}
|
|
7210
|
+
else {
|
|
7211
|
+
if (node.style.rawLineWidth) {
|
|
7212
|
+
node.style.lineWidth = node.style.rawLineWidth;
|
|
7213
|
+
delete node.style.rawLineWidth;
|
|
7214
|
+
}
|
|
7215
|
+
if (node.nodeName === exports.Shape.CIRCLE) {
|
|
7216
|
+
if (node.style.rawR) {
|
|
7217
|
+
node.style.r = node.style.rawR;
|
|
7218
|
+
delete node.style.rawR;
|
|
7219
|
+
}
|
|
7220
|
+
}
|
|
7221
|
+
}
|
|
7222
|
+
};
|
|
7102
7223
|
DefaultStyleValueRegistry.prototype.isPropertyInheritable = function (name) {
|
|
7103
7224
|
var metadata = propertyMetadataCache[name];
|
|
7104
7225
|
if (!metadata) {
|
|
@@ -7112,6 +7233,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
7112
7233
|
var CSSPropertyAngle = /** @class */ (function () {
|
|
7113
7234
|
function CSSPropertyAngle() {
|
|
7114
7235
|
this.parser = parseAngle;
|
|
7236
|
+
this.parserUnmemoize = parseAngleUnmemoize;
|
|
7115
7237
|
this.parserWithCSSDisabled = null;
|
|
7116
7238
|
this.mixer = mergeNumbers;
|
|
7117
7239
|
}
|
|
@@ -7186,6 +7308,7 @@ function getFontSize(object) {
|
|
|
7186
7308
|
var CSSPropertyLengthOrPercentage = /** @class */ (function () {
|
|
7187
7309
|
function CSSPropertyLengthOrPercentage() {
|
|
7188
7310
|
this.parser = parseLengthOrPercentage;
|
|
7311
|
+
this.parserUnmemoize = parseLengthOrPercentageUnmemoize;
|
|
7189
7312
|
this.parserWithCSSDisabled = null;
|
|
7190
7313
|
this.mixer = mergeNumbers;
|
|
7191
7314
|
}
|
|
@@ -7507,6 +7630,7 @@ var CSSPropertyNumber = /** @class */ (function () {
|
|
|
7507
7630
|
function CSSPropertyNumber() {
|
|
7508
7631
|
this.mixer = mergeNumbers;
|
|
7509
7632
|
this.parser = parseNumber;
|
|
7633
|
+
this.parserUnmemoize = parseNumberUnmemoize;
|
|
7510
7634
|
this.parserWithCSSDisabled = null;
|
|
7511
7635
|
}
|
|
7512
7636
|
CSSPropertyNumber.prototype.calculator = function (name, oldParsed, computed) {
|
|
@@ -7518,6 +7642,7 @@ var CSSPropertyNumber = /** @class */ (function () {
|
|
|
7518
7642
|
var CSSPropertyOffsetDistance = /** @class */ (function () {
|
|
7519
7643
|
function CSSPropertyOffsetDistance() {
|
|
7520
7644
|
this.parser = parseNumber;
|
|
7645
|
+
this.parserUnmemoize = parseNumberUnmemoize;
|
|
7521
7646
|
this.parserWithCSSDisabled = null;
|
|
7522
7647
|
this.mixer = clampedMergeNumbers(0, 1);
|
|
7523
7648
|
}
|
|
@@ -7551,6 +7676,7 @@ var CSSPropertyOffsetDistance = /** @class */ (function () {
|
|
|
7551
7676
|
var CSSPropertyOpacity = /** @class */ (function () {
|
|
7552
7677
|
function CSSPropertyOpacity() {
|
|
7553
7678
|
this.parser = parseNumber;
|
|
7679
|
+
this.parserUnmemoize = parseNumberUnmemoize;
|
|
7554
7680
|
this.parserWithCSSDisabled = null;
|
|
7555
7681
|
this.mixer = clampedMergeNumbers(0, 1);
|
|
7556
7682
|
}
|
|
@@ -8057,7 +8183,8 @@ function toFontString(attributes) {
|
|
|
8057
8183
|
var CSSPropertyTransform = /** @class */ (function () {
|
|
8058
8184
|
function CSSPropertyTransform() {
|
|
8059
8185
|
this.parser = parseTransform;
|
|
8060
|
-
this.
|
|
8186
|
+
this.parserUnmemoize = parseTransformUnmemoize;
|
|
8187
|
+
this.parserWithCSSDisabled = parseTransformUnmemoize;
|
|
8061
8188
|
this.mixer = mergeTransforms;
|
|
8062
8189
|
}
|
|
8063
8190
|
CSSPropertyTransform.prototype.calculator = function (name, oldParsed, parsed, object) {
|
|
@@ -8082,6 +8209,7 @@ var CSSPropertyTransform = /** @class */ (function () {
|
|
|
8082
8209
|
var CSSPropertyTransformOrigin = /** @class */ (function () {
|
|
8083
8210
|
function CSSPropertyTransformOrigin() {
|
|
8084
8211
|
this.parser = parseTransformOrigin;
|
|
8212
|
+
this.parserUnmemoize = parseTransformOriginUnmemoize;
|
|
8085
8213
|
// calculator(
|
|
8086
8214
|
// name: string,
|
|
8087
8215
|
// oldParsed: [CSSUnitValue, CSSUnitValue],
|
|
@@ -8099,6 +8227,7 @@ var CSSPropertyTransformOrigin = /** @class */ (function () {
|
|
|
8099
8227
|
var CSSPropertyZIndex = /** @class */ (function () {
|
|
8100
8228
|
function CSSPropertyZIndex() {
|
|
8101
8229
|
this.parser = parseNumber;
|
|
8230
|
+
this.parserUnmemoize = parseNumberUnmemoize;
|
|
8102
8231
|
}
|
|
8103
8232
|
CSSPropertyZIndex.prototype.calculator = function (name, oldParsed, computed, object) {
|
|
8104
8233
|
return computed.value;
|
|
@@ -11652,6 +11781,7 @@ runtime.globalThis = getGlobalThis();
|
|
|
11652
11781
|
runtime.enableCSSParsing = true;
|
|
11653
11782
|
runtime.enableDataset = false;
|
|
11654
11783
|
runtime.enableStyleSyntax = true;
|
|
11784
|
+
runtime.enableSizeAttenuation = false;
|
|
11655
11785
|
|
|
11656
11786
|
var entityCounter = 0;
|
|
11657
11787
|
function resetEntityCounter() {
|
|
@@ -12507,15 +12637,16 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12507
12637
|
// redraw at next frame
|
|
12508
12638
|
renderable.dirty = true;
|
|
12509
12639
|
};
|
|
12510
|
-
DisplayObject.prototype.setAttribute = function (name, value, force) {
|
|
12640
|
+
DisplayObject.prototype.setAttribute = function (name, value, force, memoize) {
|
|
12511
12641
|
if (force === void 0) { force = false; }
|
|
12642
|
+
if (memoize === void 0) { memoize = true; }
|
|
12512
12643
|
var attributeName = formatAttributeName(name);
|
|
12513
12644
|
// ignore undefined value
|
|
12514
12645
|
if (util.isUndefined(value)) {
|
|
12515
12646
|
return;
|
|
12516
12647
|
}
|
|
12517
12648
|
if (force || value !== this.attributes[attributeName]) {
|
|
12518
|
-
this.internalSetAttribute(attributeName, value);
|
|
12649
|
+
this.internalSetAttribute(attributeName, value, { memoize: memoize });
|
|
12519
12650
|
_super.prototype.setAttribute.call(this, attributeName, value);
|
|
12520
12651
|
}
|
|
12521
12652
|
};
|
|
@@ -14790,6 +14921,9 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14790
14921
|
};
|
|
14791
14922
|
var handleMounted = function (e) {
|
|
14792
14923
|
var object = e.target;
|
|
14924
|
+
if (runtime.enableSizeAttenuation) {
|
|
14925
|
+
runtime.styleValueRegistry.updateSizeAttenuation(object, canvas.getCamera().getZoom());
|
|
14926
|
+
}
|
|
14793
14927
|
if (runtime.enableCSSParsing) {
|
|
14794
14928
|
// recalc style values
|
|
14795
14929
|
runtime.styleValueRegistry.recalc(object);
|
|
@@ -15032,10 +15166,20 @@ var Canvas = /** @class */ (function (_super) {
|
|
|
15032
15166
|
// redraw when camera changed
|
|
15033
15167
|
camera.eventEmitter.on(CameraEvent.UPDATED, function () {
|
|
15034
15168
|
_this.context.renderingContext.renderReasons.add(exports.RenderReason.CAMERA_CHANGED);
|
|
15169
|
+
if (runtime.enableSizeAttenuation &&
|
|
15170
|
+
_this.getConfig().renderer.getConfig().enableSizeAttenuation) {
|
|
15171
|
+
_this.updateSizeAttenuation();
|
|
15172
|
+
}
|
|
15035
15173
|
});
|
|
15036
15174
|
// bind camera
|
|
15037
15175
|
this.context.camera = camera;
|
|
15038
15176
|
};
|
|
15177
|
+
Canvas.prototype.updateSizeAttenuation = function () {
|
|
15178
|
+
var zoom = this.getCamera().getZoom();
|
|
15179
|
+
this.document.documentElement.forEach(function (node) {
|
|
15180
|
+
runtime.styleValueRegistry.updateSizeAttenuation(node, zoom);
|
|
15181
|
+
});
|
|
15182
|
+
};
|
|
15039
15183
|
Canvas.prototype.getConfig = function () {
|
|
15040
15184
|
return this.context.config;
|
|
15041
15185
|
};
|