@antv/g-lite 1.3.0-next.9 → 2.0.1
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/StyleValueRegistry.d.ts +1 -0
- package/dist/css/cssom/CSSStyleValue.d.ts +1 -1
- package/dist/css/interfaces.d.ts +1 -0
- package/dist/css/parser/dimension.d.ts +1 -1
- package/dist/css/parser/path.d.ts +2 -2
- package/dist/css/parser/points.d.ts +1 -1
- package/dist/css/properties/CSSPropertyOffsetDistance.d.ts +1 -1
- package/dist/css/properties/CSSPropertyPath.d.ts +2 -2
- package/dist/css/properties/CSSPropertyTransformOrigin.d.ts +3 -1
- package/dist/display-objects/Circle.d.ts +1 -1
- package/dist/display-objects/DisplayObject.d.ts +0 -10
- package/dist/display-objects/Ellipse.d.ts +3 -1
- package/dist/display-objects/Group.d.ts +1 -1
- package/dist/display-objects/Image.d.ts +1 -3
- package/dist/display-objects/Path.d.ts +1 -12
- package/dist/display-objects/Polygon.d.ts +2 -0
- package/dist/display-objects/Rect.d.ts +3 -1
- package/dist/global-runtime.d.ts +7 -0
- package/dist/index.esm.js +492 -444
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +490 -442
- 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/plugins/PrepareRendererPlugin.d.ts +3 -0
- package/dist/services/EventService.d.ts +2 -2
- package/dist/types.d.ts +5 -1
- package/dist/utils/path.d.ts +1 -0
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __assign, __read, __extends, __spreadArray, __awaiter, __generator, __values, __rest } from 'tslib';
|
|
2
2
|
import EventEmitter from 'eventemitter3';
|
|
3
3
|
import { mat4, vec4, vec3, mat3, quat as quat$1, vec2 } from 'gl-matrix';
|
|
4
|
-
import { isNumber, distanceSquareRoot, isString, isNil, clamp, getTotalLength, min, max, isNumberEqual, mod, normalizePath, path2Curve, equalizeSegments, getDrawDirection, reverseCurve, clonePath, getRotatedCurve, isArray, isBoolean, isObject,
|
|
4
|
+
import { isNumber, distanceSquareRoot, isString, isNil, clamp, getTotalLength, min, max, isNumberEqual, mod, normalizePath, path2Curve, equalizeSegments, getDrawDirection, reverseCurve, clonePath, getRotatedCurve, isUndefined, isArray, isBoolean, isObject, getPointAtLength } from '@antv/util';
|
|
5
5
|
import * as d3 from 'd3-color';
|
|
6
|
-
import { arcBox, cubicBox, quadBox,
|
|
6
|
+
import { polylineLength, arcBox, cubicBox, quadBox, linePointAt, lineLength } from '@antv/g-math';
|
|
7
7
|
|
|
8
8
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
9
9
|
|
|
@@ -641,7 +641,7 @@ var AbstractRenderer = /** @class */ (function () {
|
|
|
641
641
|
/**
|
|
642
642
|
* enable dirty rectangle rendering by default
|
|
643
643
|
*/
|
|
644
|
-
enableDirtyRectangleRendering: true, enableDirtyRectangleRenderingDebug: false }, config);
|
|
644
|
+
enableDirtyRectangleRendering: true, enableDirtyRectangleRenderingDebug: false, enableSizeAttenuation: true }, config);
|
|
645
645
|
}
|
|
646
646
|
AbstractRenderer.prototype.registerPlugin = function (plugin) {
|
|
647
647
|
var index = this.plugins.findIndex(function (p) { return p === plugin; });
|
|
@@ -3165,7 +3165,7 @@ var getOrCreateUnitValue = function (value, unitOrName) {
|
|
|
3165
3165
|
if (unitOrName === void 0) { unitOrName = UnitType.kNumber; }
|
|
3166
3166
|
return new CSSUnitValue(value, unitOrName);
|
|
3167
3167
|
};
|
|
3168
|
-
|
|
3168
|
+
new CSSUnitValue(50, '%');
|
|
3169
3169
|
|
|
3170
3170
|
/**
|
|
3171
3171
|
* @see https://doc.babylonjs.com/how_to/optimizing_your_scene#changing-mesh-culling-strategy
|
|
@@ -3888,6 +3888,9 @@ var parseColor = memoize(function (colorStr) {
|
|
|
3888
3888
|
// @see https://github.com/adobe-webplatform/Snap.svg/issues/526
|
|
3889
3889
|
colorStr = 'black';
|
|
3890
3890
|
}
|
|
3891
|
+
else if (colorStr === 'none') {
|
|
3892
|
+
return noneColor;
|
|
3893
|
+
}
|
|
3891
3894
|
// support CSS gradient syntax
|
|
3892
3895
|
var g = parseGradient(colorStr);
|
|
3893
3896
|
if (g) {
|
|
@@ -4107,10 +4110,8 @@ function parseDimensionArray(string) {
|
|
|
4107
4110
|
// },
|
|
4108
4111
|
// ];
|
|
4109
4112
|
// }
|
|
4110
|
-
function convertPercentUnit(valueWithUnit, vec3Index, target) {
|
|
4111
|
-
if (
|
|
4112
|
-
return 0;
|
|
4113
|
-
}
|
|
4113
|
+
function convertPercentUnit(valueWithUnit, vec3Index, target, useMin) {
|
|
4114
|
+
if (useMin === void 0) { useMin = false; }
|
|
4114
4115
|
if (valueWithUnit.unit === UnitType.kPixels) {
|
|
4115
4116
|
return Number(valueWithUnit.value);
|
|
4116
4117
|
}
|
|
@@ -4118,7 +4119,8 @@ function convertPercentUnit(valueWithUnit, vec3Index, target) {
|
|
|
4118
4119
|
var bounds = target.nodeName === Shape.GROUP
|
|
4119
4120
|
? target.getLocalBounds()
|
|
4120
4121
|
: target.getGeometryBounds();
|
|
4121
|
-
return (
|
|
4122
|
+
return ((useMin ? bounds.min[vec3Index] : 0) +
|
|
4123
|
+
(valueWithUnit.value / 100) * bounds.halfExtents[vec3Index] * 2);
|
|
4122
4124
|
}
|
|
4123
4125
|
return 0;
|
|
4124
4126
|
}
|
|
@@ -4221,10 +4223,16 @@ function mergeNumberLists(left, right) {
|
|
|
4221
4223
|
}
|
|
4222
4224
|
|
|
4223
4225
|
function getOrCalculatePathTotalLength(path) {
|
|
4224
|
-
if (path.parsedStyle.
|
|
4225
|
-
path.parsedStyle.
|
|
4226
|
+
if (path.parsedStyle.d.totalLength === 0) {
|
|
4227
|
+
path.parsedStyle.d.totalLength = getTotalLength(path.parsedStyle.d.absolutePath);
|
|
4226
4228
|
}
|
|
4227
|
-
return path.parsedStyle.
|
|
4229
|
+
return path.parsedStyle.d.totalLength;
|
|
4230
|
+
}
|
|
4231
|
+
function getOrCalculatePolylineTotalLength(polyline) {
|
|
4232
|
+
if (polyline.parsedStyle.points.totalLength === 0) {
|
|
4233
|
+
polyline.parsedStyle.points.totalLength = polylineLength(polyline.parsedStyle.points.points);
|
|
4234
|
+
}
|
|
4235
|
+
return polyline.parsedStyle.points.totalLength;
|
|
4228
4236
|
}
|
|
4229
4237
|
function removeRedundantMCommand(path) {
|
|
4230
4238
|
for (var i = 0; i < path.length; i++) {
|
|
@@ -4934,7 +4942,7 @@ function convertToPath(object, transform) {
|
|
|
4934
4942
|
}));
|
|
4935
4943
|
break;
|
|
4936
4944
|
case Shape.PATH:
|
|
4937
|
-
var absolutePath = object.parsedStyle.
|
|
4945
|
+
var absolutePath = object.parsedStyle.d.absolutePath;
|
|
4938
4946
|
commands = __spreadArray([], __read(absolutePath), false);
|
|
4939
4947
|
break;
|
|
4940
4948
|
}
|
|
@@ -5096,27 +5104,10 @@ function parsePoints(pointsOrStr, object) {
|
|
|
5096
5104
|
else {
|
|
5097
5105
|
points = pointsOrStr;
|
|
5098
5106
|
}
|
|
5099
|
-
var segments = [];
|
|
5100
|
-
var tempLength = 0;
|
|
5101
|
-
var segmentT;
|
|
5102
|
-
var segmentL;
|
|
5103
|
-
var totalLength = polylineLength(points);
|
|
5104
|
-
points.forEach(function (p, i) {
|
|
5105
|
-
if (points[i + 1]) {
|
|
5106
|
-
segmentT = [0, 0];
|
|
5107
|
-
segmentT[0] = tempLength / totalLength;
|
|
5108
|
-
segmentL = lineLength(p[0], p[1], points[i + 1][0], points[i + 1][1]);
|
|
5109
|
-
tempLength += segmentL;
|
|
5110
|
-
segmentT[1] = tempLength / totalLength;
|
|
5111
|
-
segments.push(segmentT);
|
|
5112
|
-
}
|
|
5113
|
-
});
|
|
5114
|
-
// const minX = Math.min(...points.map((point) => point[0]));
|
|
5115
|
-
// const minY = Math.min(...points.map((point) => point[1]));
|
|
5116
5107
|
return {
|
|
5117
5108
|
points: points,
|
|
5118
|
-
totalLength:
|
|
5119
|
-
segments:
|
|
5109
|
+
totalLength: 0,
|
|
5110
|
+
segments: [],
|
|
5120
5111
|
};
|
|
5121
5112
|
}
|
|
5122
5113
|
function mergePoints(left, right) {
|
|
@@ -5957,7 +5948,7 @@ function convertKeyword2Percent(keyword) {
|
|
|
5957
5948
|
return '50%';
|
|
5958
5949
|
}
|
|
5959
5950
|
else if (keyword === 'left' || keyword === 'top') {
|
|
5960
|
-
return '0';
|
|
5951
|
+
return '0%';
|
|
5961
5952
|
}
|
|
5962
5953
|
else if (keyword === 'right' || keyword === 'bottom') {
|
|
5963
5954
|
return '100%';
|
|
@@ -6225,16 +6216,17 @@ var BUILT_IN_PROPERTIES = [
|
|
|
6225
6216
|
{
|
|
6226
6217
|
n: 'transformOrigin',
|
|
6227
6218
|
p: 100,
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6219
|
+
d: '0 0',
|
|
6220
|
+
// // int: true,
|
|
6221
|
+
// d: (nodeName: string) => {
|
|
6222
|
+
// if (nodeName === Shape.CIRCLE || nodeName === Shape.ELLIPSE) {
|
|
6223
|
+
// return 'center';
|
|
6224
|
+
// }
|
|
6225
|
+
// if (nodeName === Shape.TEXT) {
|
|
6226
|
+
// return 'text-anchor';
|
|
6227
|
+
// }
|
|
6228
|
+
// return 'left top';
|
|
6229
|
+
// },
|
|
6238
6230
|
l: true,
|
|
6239
6231
|
syntax: PropertySyntax.TRANSFORM_ORIGIN,
|
|
6240
6232
|
},
|
|
@@ -6373,11 +6365,10 @@ var BUILT_IN_PROPERTIES = [
|
|
|
6373
6365
|
},
|
|
6374
6366
|
// Path
|
|
6375
6367
|
{
|
|
6376
|
-
n: '
|
|
6368
|
+
n: 'd',
|
|
6377
6369
|
int: true,
|
|
6378
6370
|
l: true,
|
|
6379
6371
|
d: '',
|
|
6380
|
-
a: ['d'],
|
|
6381
6372
|
syntax: PropertySyntax.PATH,
|
|
6382
6373
|
p: 50,
|
|
6383
6374
|
},
|
|
@@ -6601,16 +6592,16 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6601
6592
|
}; }
|
|
6602
6593
|
if (!this.runtime.enableCSSParsing) {
|
|
6603
6594
|
Object.assign(object.attributes, attributes);
|
|
6604
|
-
var
|
|
6595
|
+
var attributeNames = Object.keys(attributes);
|
|
6605
6596
|
// clipPath
|
|
6606
6597
|
var oldClipPath = object.parsedStyle.clipPath;
|
|
6607
6598
|
var oldOffsetPath = object.parsedStyle.offsetPath;
|
|
6608
6599
|
object.parsedStyle = Object.assign(object.parsedStyle, attributes);
|
|
6609
|
-
var
|
|
6610
|
-
if (!
|
|
6600
|
+
var needUpdateGeometry = !!options.forceUpdateGeometry;
|
|
6601
|
+
if (!needUpdateGeometry) {
|
|
6611
6602
|
for (var i = 0; i < GEOMETRY_ATTRIBUTE_NAMES.length; i++) {
|
|
6612
6603
|
if (GEOMETRY_ATTRIBUTE_NAMES[i] in attributes) {
|
|
6613
|
-
|
|
6604
|
+
needUpdateGeometry = true;
|
|
6614
6605
|
break;
|
|
6615
6606
|
}
|
|
6616
6607
|
}
|
|
@@ -6646,20 +6637,20 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6646
6637
|
}
|
|
6647
6638
|
// Path
|
|
6648
6639
|
// @ts-ignore
|
|
6649
|
-
if (attributes.
|
|
6650
|
-
object.parsedStyle.
|
|
6640
|
+
if (attributes.d === '') {
|
|
6641
|
+
object.parsedStyle.d = __assign({}, EMPTY_PARSED_PATH);
|
|
6651
6642
|
}
|
|
6652
6643
|
// @ts-ignore
|
|
6653
|
-
if (attributes.
|
|
6654
|
-
object.parsedStyle.
|
|
6644
|
+
if (attributes.d) {
|
|
6645
|
+
object.parsedStyle.d = parsePath(
|
|
6655
6646
|
// @ts-ignore
|
|
6656
|
-
attributes.
|
|
6647
|
+
attributes.d);
|
|
6657
6648
|
}
|
|
6658
6649
|
// Text
|
|
6659
6650
|
if (attributes.textTransform) {
|
|
6660
6651
|
this.runtime.CSSPropertySyntaxFactory['<text-transform>'].calculator(null, null, { value: attributes.textTransform }, object, null);
|
|
6661
6652
|
}
|
|
6662
|
-
if (attributes.clipPath) {
|
|
6653
|
+
if (!isUndefined(attributes.clipPath)) {
|
|
6663
6654
|
this.runtime.CSSPropertySyntaxFactory['<defined-path>'].calculator('clipPath', oldClipPath, attributes.clipPath, object, this.runtime);
|
|
6664
6655
|
}
|
|
6665
6656
|
if (attributes.offsetPath) {
|
|
@@ -6697,97 +6688,107 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6697
6688
|
attributes.markerMid, null, null);
|
|
6698
6689
|
}
|
|
6699
6690
|
if (!isNil(attributes.zIndex)) {
|
|
6700
|
-
this.runtime.CSSPropertySyntaxFactory['<z-index>'].postProcessor(object,
|
|
6691
|
+
this.runtime.CSSPropertySyntaxFactory['<z-index>'].postProcessor(object, attributeNames);
|
|
6701
6692
|
}
|
|
6702
6693
|
if (!isNil(attributes.offsetDistance)) {
|
|
6703
|
-
this.runtime.CSSPropertySyntaxFactory['<offset-distance>'].postProcessor(object,
|
|
6694
|
+
this.runtime.CSSPropertySyntaxFactory['<offset-distance>'].postProcessor(object, attributeNames);
|
|
6704
6695
|
}
|
|
6705
6696
|
if (attributes.transform) {
|
|
6706
|
-
this.runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object,
|
|
6697
|
+
this.runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object, attributeNames);
|
|
6707
6698
|
}
|
|
6708
|
-
if (
|
|
6699
|
+
if (attributes.transformOrigin) {
|
|
6700
|
+
this.runtime.CSSPropertySyntaxFactory['<transform-origin>'].postProcessor(object, attributeNames);
|
|
6701
|
+
}
|
|
6702
|
+
if (needUpdateGeometry) {
|
|
6709
6703
|
object.geometry.dirty = true;
|
|
6710
|
-
|
|
6711
|
-
|
|
6704
|
+
object.renderable.boundsDirty = true;
|
|
6705
|
+
object.renderable.renderBoundsDirty = true;
|
|
6706
|
+
if (!options.forceUpdateGeometry) {
|
|
6707
|
+
this.runtime.sceneGraphService.dirtifyToRoot(object);
|
|
6708
|
+
}
|
|
6712
6709
|
}
|
|
6713
|
-
return;
|
|
6714
6710
|
}
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
if (!skipParse) {
|
|
6728
|
-
attributeNames.forEach(function (name) {
|
|
6729
|
-
object.computedStyle[name] = _this.parseProperty(name, object.attributes[name], object, memoize);
|
|
6711
|
+
else {
|
|
6712
|
+
var skipUpdateAttribute_1 = options.skipUpdateAttribute, skipParse = options.skipParse, forceUpdateGeometry = options.forceUpdateGeometry, usedAttributes = options.usedAttributes, memoize_1 = options.memoize;
|
|
6713
|
+
var needUpdateGeometry_1 = forceUpdateGeometry;
|
|
6714
|
+
var attributeNames_1 = Object.keys(attributes);
|
|
6715
|
+
attributeNames_1.forEach(function (attributeName) {
|
|
6716
|
+
var _a;
|
|
6717
|
+
if (!skipUpdateAttribute_1) {
|
|
6718
|
+
object.attributes[attributeName] = attributes[attributeName];
|
|
6719
|
+
}
|
|
6720
|
+
if (!needUpdateGeometry_1 && ((_a = propertyMetadataCache[attributeName]) === null || _a === void 0 ? void 0 : _a.l)) {
|
|
6721
|
+
needUpdateGeometry_1 = true;
|
|
6722
|
+
}
|
|
6730
6723
|
});
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
// points 50
|
|
6736
|
-
// text 50
|
|
6737
|
-
// textTransform 51
|
|
6738
|
-
// transform 100
|
|
6739
|
-
// transformOrigin 100
|
|
6740
|
-
if (usedAttributes === null || usedAttributes === void 0 ? void 0 : usedAttributes.length) {
|
|
6741
|
-
// uniqueAttributeSet.clear();
|
|
6742
|
-
attributeNames = Array.from(new Set(attributeNames.concat(usedAttributes)));
|
|
6743
|
-
}
|
|
6744
|
-
// [
|
|
6745
|
-
// 'path',
|
|
6746
|
-
// 'points',
|
|
6747
|
-
// 'text',
|
|
6748
|
-
// 'textTransform',
|
|
6749
|
-
// 'transform',
|
|
6750
|
-
// 'transformOrigin',
|
|
6751
|
-
// ].forEach((name) => {
|
|
6752
|
-
// const index = attributeNames.indexOf(name);
|
|
6753
|
-
// if (index > -1) {
|
|
6754
|
-
// attributeNames.splice(index, 1);
|
|
6755
|
-
// attributeNames.push(name);
|
|
6756
|
-
// }
|
|
6757
|
-
// });
|
|
6758
|
-
attributeNames.forEach(function (name) {
|
|
6759
|
-
// some style props maybe deleted after parsing such as `anchor` in Text
|
|
6760
|
-
if (name in object.computedStyle) {
|
|
6761
|
-
object.parsedStyle[name] = _this.computeProperty(name, object.computedStyle[name], object, memoize);
|
|
6724
|
+
if (!skipParse) {
|
|
6725
|
+
attributeNames_1.forEach(function (name) {
|
|
6726
|
+
object.computedStyle[name] = _this.parseProperty(name, object.attributes[name], object, memoize_1);
|
|
6727
|
+
});
|
|
6762
6728
|
}
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
|
|
6769
|
-
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
|
|
6729
|
+
// let hasUnresolvedProperties = false;
|
|
6730
|
+
// parse according to priority
|
|
6731
|
+
// path 50
|
|
6732
|
+
// points 50
|
|
6733
|
+
// text 50
|
|
6734
|
+
// textTransform 51
|
|
6735
|
+
// transform 100
|
|
6736
|
+
// transformOrigin 100
|
|
6737
|
+
if (usedAttributes === null || usedAttributes === void 0 ? void 0 : usedAttributes.length) {
|
|
6738
|
+
// uniqueAttributeSet.clear();
|
|
6739
|
+
attributeNames_1 = Array.from(new Set(attributeNames_1.concat(usedAttributes)));
|
|
6740
|
+
}
|
|
6741
|
+
// [
|
|
6742
|
+
// 'path',
|
|
6743
|
+
// 'points',
|
|
6744
|
+
// 'text',
|
|
6745
|
+
// 'textTransform',
|
|
6746
|
+
// 'transform',
|
|
6747
|
+
// 'transformOrigin',
|
|
6748
|
+
// ].forEach((name) => {
|
|
6749
|
+
// const index = attributeNames.indexOf(name);
|
|
6750
|
+
// if (index > -1) {
|
|
6751
|
+
// attributeNames.splice(index, 1);
|
|
6752
|
+
// attributeNames.push(name);
|
|
6753
|
+
// }
|
|
6754
|
+
// });
|
|
6755
|
+
attributeNames_1.forEach(function (name) {
|
|
6756
|
+
// some style props maybe deleted after parsing such as `anchor` in Text
|
|
6757
|
+
if (name in object.computedStyle) {
|
|
6758
|
+
object.parsedStyle[name] = _this.computeProperty(name, object.computedStyle[name], object, memoize_1);
|
|
6759
|
+
}
|
|
6760
|
+
});
|
|
6761
|
+
// if (hasUnresolvedProperties) {
|
|
6762
|
+
// this.dirty = true;
|
|
6763
|
+
// return;
|
|
6764
|
+
// }
|
|
6765
|
+
// update geometry
|
|
6766
|
+
if (needUpdateGeometry_1) {
|
|
6767
|
+
object.geometry.dirty = true;
|
|
6768
|
+
object.renderable.boundsDirty = true;
|
|
6769
|
+
object.renderable.renderBoundsDirty = true;
|
|
6770
|
+
if (!options.forceUpdateGeometry) {
|
|
6771
|
+
this.runtime.sceneGraphService.dirtifyToRoot(object);
|
|
6772
|
+
}
|
|
6777
6773
|
}
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
if (name in object.parsedStyle && _this.isPropertyInheritable(name)) {
|
|
6782
|
-
// update children's inheritable
|
|
6783
|
-
object.children.forEach(function (child) {
|
|
6784
|
-
child.internalSetAttribute(name, null, {
|
|
6785
|
-
skipUpdateAttribute: true,
|
|
6786
|
-
skipParse: true,
|
|
6787
|
-
});
|
|
6788
|
-
});
|
|
6774
|
+
attributeNames_1.forEach(function (name) {
|
|
6775
|
+
if (name in object.parsedStyle) {
|
|
6776
|
+
_this.postProcessProperty(name, object, attributeNames_1);
|
|
6789
6777
|
}
|
|
6790
6778
|
});
|
|
6779
|
+
if (this.runtime.enableCSSParsing && object.children.length) {
|
|
6780
|
+
attributeNames_1.forEach(function (name) {
|
|
6781
|
+
if (name in object.parsedStyle && _this.isPropertyInheritable(name)) {
|
|
6782
|
+
// update children's inheritable
|
|
6783
|
+
object.children.forEach(function (child) {
|
|
6784
|
+
child.internalSetAttribute(name, null, {
|
|
6785
|
+
skipUpdateAttribute: true,
|
|
6786
|
+
skipParse: true,
|
|
6787
|
+
});
|
|
6788
|
+
});
|
|
6789
|
+
}
|
|
6790
|
+
});
|
|
6791
|
+
}
|
|
6791
6792
|
}
|
|
6792
6793
|
};
|
|
6793
6794
|
/**
|
|
@@ -6980,11 +6981,15 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6980
6981
|
// depth / 2,
|
|
6981
6982
|
// );
|
|
6982
6983
|
// anchor is center by default, don't account for lineWidth here
|
|
6983
|
-
var _h = parsedStyle, stroke = _h.stroke,
|
|
6984
|
+
var _h = parsedStyle, stroke = _h.stroke, _j = _h.lineWidth, lineWidth = _j === void 0 ? 1 : _j,
|
|
6984
6985
|
// lineCap,
|
|
6985
6986
|
// lineJoin,
|
|
6986
6987
|
// miterLimit,
|
|
6987
|
-
|
|
6988
|
+
_k = _h.increasedLineWidthForHitTesting,
|
|
6989
|
+
// lineCap,
|
|
6990
|
+
// lineJoin,
|
|
6991
|
+
// miterLimit,
|
|
6992
|
+
increasedLineWidthForHitTesting = _k === void 0 ? 0 : _k, _l = _h.shadowType, shadowType = _l === void 0 ? 'outer' : _l, shadowColor = _h.shadowColor, _m = _h.filter, filter = _m === void 0 ? [] : _m, transformOrigin = _h.transformOrigin;
|
|
6988
6993
|
var center = [cx, cy, cz];
|
|
6989
6994
|
// update geometry's AABB
|
|
6990
6995
|
geometry_1.contentBounds.update(center, halfExtents);
|
|
@@ -7018,8 +7023,8 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
7018
7023
|
geometry_1.renderBounds.update(center, halfExtents);
|
|
7019
7024
|
// account for shadow, only support constant value now
|
|
7020
7025
|
if (shadowColor && shadowType && shadowType !== 'inner') {
|
|
7021
|
-
var
|
|
7022
|
-
var
|
|
7026
|
+
var _o = geometry_1.renderBounds, min = _o.min, max = _o.max;
|
|
7027
|
+
var _p = parsedStyle, shadowBlur = _p.shadowBlur, shadowOffsetX = _p.shadowOffsetX, shadowOffsetY = _p.shadowOffsetY;
|
|
7023
7028
|
var shadowBlurInPixels = shadowBlur || 0;
|
|
7024
7029
|
var shadowOffsetXInPixels = shadowOffsetX || 0;
|
|
7025
7030
|
var shadowOffsetYInPixels = shadowOffsetY || 0;
|
|
@@ -7057,23 +7062,47 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
7057
7062
|
}
|
|
7058
7063
|
});
|
|
7059
7064
|
object.geometry.dirty = false;
|
|
7060
|
-
// if (nodeName === Shape.RECT) {
|
|
7061
|
-
// account for negative width / height of Rect
|
|
7062
7065
|
// @see https://github.com/antvis/g/issues/957
|
|
7063
7066
|
var flipY = hwidth < 0;
|
|
7064
7067
|
var flipX = hheight < 0;
|
|
7065
|
-
// } else {
|
|
7066
|
-
// }
|
|
7067
7068
|
// set transform origin
|
|
7068
7069
|
var usedOriginXValue = (flipY ? -1 : 1) *
|
|
7069
7070
|
(transformOrigin
|
|
7070
|
-
? convertPercentUnit(transformOrigin[0], 0, object)
|
|
7071
|
+
? convertPercentUnit(transformOrigin[0], 0, object, true)
|
|
7071
7072
|
: 0);
|
|
7072
7073
|
var usedOriginYValue = (flipX ? -1 : 1) *
|
|
7073
7074
|
(transformOrigin
|
|
7074
|
-
? convertPercentUnit(transformOrigin[1], 1, object)
|
|
7075
|
+
? convertPercentUnit(transformOrigin[1], 1, object, true)
|
|
7075
7076
|
: 0);
|
|
7076
|
-
|
|
7077
|
+
if (usedOriginXValue || usedOriginYValue) {
|
|
7078
|
+
object.setOrigin(usedOriginXValue, usedOriginYValue);
|
|
7079
|
+
}
|
|
7080
|
+
}
|
|
7081
|
+
};
|
|
7082
|
+
DefaultStyleValueRegistry.prototype.updateSizeAttenuation = function (node, zoom) {
|
|
7083
|
+
if (node.style.isSizeAttenuation) {
|
|
7084
|
+
if (!node.style.rawLineWidth) {
|
|
7085
|
+
node.style.rawLineWidth = node.style.lineWidth;
|
|
7086
|
+
}
|
|
7087
|
+
node.style.lineWidth = (node.style.rawLineWidth || 1) / zoom;
|
|
7088
|
+
if (node.nodeName === Shape.CIRCLE) {
|
|
7089
|
+
if (!node.style.rawR) {
|
|
7090
|
+
node.style.rawR = node.style.r;
|
|
7091
|
+
}
|
|
7092
|
+
node.style.r = (node.style.rawR || 1) / zoom;
|
|
7093
|
+
}
|
|
7094
|
+
}
|
|
7095
|
+
else {
|
|
7096
|
+
if (node.style.rawLineWidth) {
|
|
7097
|
+
node.style.lineWidth = node.style.rawLineWidth;
|
|
7098
|
+
delete node.style.rawLineWidth;
|
|
7099
|
+
}
|
|
7100
|
+
if (node.nodeName === Shape.CIRCLE) {
|
|
7101
|
+
if (node.style.rawR) {
|
|
7102
|
+
node.style.r = node.style.rawR;
|
|
7103
|
+
delete node.style.rawR;
|
|
7104
|
+
}
|
|
7105
|
+
}
|
|
7077
7106
|
}
|
|
7078
7107
|
};
|
|
7079
7108
|
DefaultStyleValueRegistry.prototype.isPropertyInheritable = function (name) {
|
|
@@ -7499,8 +7528,8 @@ function sortedIndex(array, value) {
|
|
|
7499
7528
|
return low;
|
|
7500
7529
|
}
|
|
7501
7530
|
function sortByZIndex(o1, o2) {
|
|
7502
|
-
var zIndex1 = Number(o1.parsedStyle.zIndex);
|
|
7503
|
-
var zIndex2 = Number(o2.parsedStyle.zIndex);
|
|
7531
|
+
var zIndex1 = Number(o1.parsedStyle.zIndex || 0);
|
|
7532
|
+
var zIndex2 = Number(o2.parsedStyle.zIndex || 0);
|
|
7504
7533
|
if (zIndex1 === zIndex2) {
|
|
7505
7534
|
var parent_1 = o1.parentNode;
|
|
7506
7535
|
if (parent_1) {
|
|
@@ -7564,6 +7593,7 @@ var clock = typeof performance === 'object' && performance.now ? performance : D
|
|
|
7564
7593
|
function isFillOrStrokeAffected(pointerEvents, fill, stroke) {
|
|
7565
7594
|
// account for pointerEvents
|
|
7566
7595
|
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
|
|
7596
|
+
if (pointerEvents === void 0) { pointerEvents = 'auto'; }
|
|
7567
7597
|
var hasFill = false;
|
|
7568
7598
|
var hasStroke = false;
|
|
7569
7599
|
var isFillOtherThanNone = !!fill && !fill.isNone;
|
|
@@ -7790,7 +7820,7 @@ var genericFontFamilies = [
|
|
|
7790
7820
|
];
|
|
7791
7821
|
var stringRegExp = /([\"\'])[^\'\"]+\1/;
|
|
7792
7822
|
function toFontString(attributes) {
|
|
7793
|
-
var
|
|
7823
|
+
var _a = attributes.fontSize, fontSize = _a === void 0 ? 16 : _a, _b = attributes.fontFamily, fontFamily = _b === void 0 ? 'sans-serif' : _b, _c = attributes.fontStyle, fontStyle = _c === void 0 ? 'normal' : _c, _d = attributes.fontVariant, fontVariant = _d === void 0 ? 'normal' : _d, _e = attributes.fontWeight, fontWeight = _e === void 0 ? 'normal' : _e;
|
|
7794
7824
|
// build canvas api font setting from individual components. Convert a numeric this.fontSize to px
|
|
7795
7825
|
// const fontSizeString: string = isNumber(fontSize) ? `${fontSize}px` : fontSize.toString();
|
|
7796
7826
|
var fontSizeString = (isNumber(fontSize) && "".concat(fontSize, "px")) || '16px';
|
|
@@ -7818,6 +7848,7 @@ function createSkewMatrix(skewMatrix, skewX, skewY) {
|
|
|
7818
7848
|
skewMatrix[1] = Math.tan(skewY); // Skew X axis in Y direction
|
|
7819
7849
|
return skewMatrix;
|
|
7820
7850
|
}
|
|
7851
|
+
var SCALE_EPSILON = 0.00001;
|
|
7821
7852
|
var tmpMat1 = mat4.create();
|
|
7822
7853
|
var tmpMat2 = mat4.create();
|
|
7823
7854
|
function parsedTransformToMat4(transform, object) {
|
|
@@ -7827,23 +7858,27 @@ function parsedTransformToMat4(transform, object) {
|
|
|
7827
7858
|
var t = parsed.t, d = parsed.d;
|
|
7828
7859
|
if (t === 'scale') {
|
|
7829
7860
|
// scale(1) scale(1, 1)
|
|
7830
|
-
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [
|
|
7861
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return Math.max(s.value, SCALE_EPSILON); })) || [
|
|
7862
|
+
1, 1,
|
|
7863
|
+
];
|
|
7831
7864
|
mat4.fromScaling(tmpMat2, [newScale[0], newScale[1], 1]);
|
|
7832
7865
|
}
|
|
7833
7866
|
else if (t === 'scalex') {
|
|
7834
|
-
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
|
|
7867
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return Math.max(s.value, SCALE_EPSILON); })) || [1];
|
|
7835
7868
|
mat4.fromScaling(tmpMat2, [newScale[0], 1, 1]);
|
|
7836
7869
|
}
|
|
7837
7870
|
else if (t === 'scaley') {
|
|
7838
|
-
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
|
|
7871
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return Math.max(s.value, SCALE_EPSILON); })) || [1];
|
|
7839
7872
|
mat4.fromScaling(tmpMat2, [1, newScale[0], 1]);
|
|
7840
7873
|
}
|
|
7841
7874
|
else if (t === 'scalez') {
|
|
7842
|
-
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
|
|
7875
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return Math.max(s.value, SCALE_EPSILON); })) || [1];
|
|
7843
7876
|
mat4.fromScaling(tmpMat2, [1, 1, newScale[0]]);
|
|
7844
7877
|
}
|
|
7845
7878
|
else if (t === 'scale3d') {
|
|
7846
|
-
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [
|
|
7879
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return Math.max(s.value, SCALE_EPSILON); })) || [
|
|
7880
|
+
1, 1, 1,
|
|
7881
|
+
];
|
|
7847
7882
|
mat4.fromScaling(tmpMat2, [newScale[0], newScale[1], newScale[2]]);
|
|
7848
7883
|
}
|
|
7849
7884
|
else if (t === 'translate') {
|
|
@@ -7988,17 +8023,18 @@ var CSSPropertyTransformOrigin = /** @class */ (function () {
|
|
|
7988
8023
|
function CSSPropertyTransformOrigin() {
|
|
7989
8024
|
this.parser = parseTransformOrigin;
|
|
7990
8025
|
this.parserUnmemoize = parseTransformOriginUnmemoize;
|
|
7991
|
-
// calculator(
|
|
7992
|
-
// name: string,
|
|
7993
|
-
// oldParsed: [CSSUnitValue, CSSUnitValue],
|
|
7994
|
-
// parsed: [CSSUnitValue, CSSUnitValue],
|
|
7995
|
-
// object: DisplayObject,
|
|
7996
|
-
// ): [number, number] {
|
|
7997
|
-
// console.log(object, parsed);
|
|
7998
|
-
// return [parsed[0].value, parsed[1].value];
|
|
7999
|
-
// // return [convertPercentUnit(parsed[0], 0, object), convertPercentUnit(parsed[1], 1, object)];
|
|
8000
|
-
// }
|
|
8001
8026
|
}
|
|
8027
|
+
CSSPropertyTransformOrigin.prototype.postProcessor = function (object) {
|
|
8028
|
+
var transformOrigin = object.parsedStyle.transformOrigin;
|
|
8029
|
+
if (transformOrigin[0].unit === UnitType.kPixels &&
|
|
8030
|
+
transformOrigin[1].unit === UnitType.kPixels) {
|
|
8031
|
+
object.setOrigin(transformOrigin[0].value, transformOrigin[1].value);
|
|
8032
|
+
}
|
|
8033
|
+
else {
|
|
8034
|
+
// Relative to geometry bounds, calculate later.
|
|
8035
|
+
object.getGeometryBounds();
|
|
8036
|
+
}
|
|
8037
|
+
};
|
|
8002
8038
|
return CSSPropertyTransformOrigin;
|
|
8003
8039
|
}());
|
|
8004
8040
|
|
|
@@ -8085,8 +8121,8 @@ var PathUpdater = /** @class */ (function () {
|
|
|
8085
8121
|
function PathUpdater() {
|
|
8086
8122
|
}
|
|
8087
8123
|
PathUpdater.prototype.update = function (parsedStyle) {
|
|
8088
|
-
var
|
|
8089
|
-
var _a =
|
|
8124
|
+
var d = parsedStyle.d;
|
|
8125
|
+
var _a = d.rect, x = _a.x, y = _a.y, width = _a.width, height = _a.height;
|
|
8090
8126
|
var hwidth = width / 2;
|
|
8091
8127
|
var hheight = height / 2;
|
|
8092
8128
|
return {
|
|
@@ -8135,17 +8171,17 @@ var RectUpdater = /** @class */ (function () {
|
|
|
8135
8171
|
function RectUpdater() {
|
|
8136
8172
|
}
|
|
8137
8173
|
RectUpdater.prototype.update = function (parsedStyle, object) {
|
|
8138
|
-
var _a = parsedStyle.x, x = _a === void 0 ? 0 : _a, _b = parsedStyle.y, y = _b === void 0 ? 0 : _b,
|
|
8174
|
+
var _a = parsedStyle.x, x = _a === void 0 ? 0 : _a, _b = parsedStyle.y, y = _b === void 0 ? 0 : _b, src = parsedStyle.src, _c = parsedStyle.width, width = _c === void 0 ? 0 : _c, _d = parsedStyle.height, height = _d === void 0 ? 0 : _d;
|
|
8139
8175
|
var contentWidth = width;
|
|
8140
8176
|
var contentHeight = height;
|
|
8141
8177
|
// resize with HTMLImageElement's size
|
|
8142
|
-
if (
|
|
8178
|
+
if (src && !isString(src)) {
|
|
8143
8179
|
if (!contentWidth) {
|
|
8144
|
-
contentWidth =
|
|
8180
|
+
contentWidth = src.width;
|
|
8145
8181
|
parsedStyle.width = contentWidth;
|
|
8146
8182
|
}
|
|
8147
8183
|
if (!contentHeight) {
|
|
8148
|
-
contentHeight =
|
|
8184
|
+
contentHeight = src.height;
|
|
8149
8185
|
parsedStyle.height = contentHeight;
|
|
8150
8186
|
}
|
|
8151
8187
|
}
|
|
@@ -8165,18 +8201,20 @@ var TextUpdater = /** @class */ (function () {
|
|
|
8165
8201
|
}
|
|
8166
8202
|
TextUpdater.prototype.isReadyToMeasure = function (parsedStyle, object) {
|
|
8167
8203
|
var text = parsedStyle.text, textAlign = parsedStyle.textAlign, textBaseline = parsedStyle.textBaseline, fontSize = parsedStyle.fontSize, fontStyle = parsedStyle.fontStyle, fontWeight = parsedStyle.fontWeight, fontVariant = parsedStyle.fontVariant, lineWidth = parsedStyle.lineWidth;
|
|
8168
|
-
return
|
|
8169
|
-
|
|
8170
|
-
|
|
8171
|
-
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
|
|
8204
|
+
return runtime.enableCSSParsing
|
|
8205
|
+
? text &&
|
|
8206
|
+
fontSize &&
|
|
8207
|
+
fontStyle &&
|
|
8208
|
+
fontWeight &&
|
|
8209
|
+
fontVariant &&
|
|
8210
|
+
textAlign &&
|
|
8211
|
+
textBaseline &&
|
|
8212
|
+
!isNil(lineWidth)
|
|
8213
|
+
: text;
|
|
8176
8214
|
};
|
|
8177
8215
|
TextUpdater.prototype.update = function (parsedStyle, object) {
|
|
8178
8216
|
var _a, _b;
|
|
8179
|
-
var text = parsedStyle.text,
|
|
8217
|
+
var text = parsedStyle.text, _c = parsedStyle.textAlign, textAlign = _c === void 0 ? 'start' : _c, _d = parsedStyle.lineWidth, lineWidth = _d === void 0 ? 1 : _d, _e = parsedStyle.textBaseline, textBaseline = _e === void 0 ? 'alphabetic' : _e, _f = parsedStyle.dx, dx = _f === void 0 ? 0 : _f, _g = parsedStyle.dy, dy = _g === void 0 ? 0 : _g, _h = parsedStyle.x, x = _h === void 0 ? 0 : _h, _j = parsedStyle.y, y = _j === void 0 ? 0 : _j;
|
|
8180
8218
|
if (!this.isReadyToMeasure(parsedStyle, object)) {
|
|
8181
8219
|
parsedStyle.metrics = {
|
|
8182
8220
|
font: '',
|
|
@@ -9599,10 +9637,13 @@ var EventService = /** @class */ (function () {
|
|
|
9599
9637
|
* whether the native event trigger came from Canvas,
|
|
9600
9638
|
* should account for HTML shape
|
|
9601
9639
|
*/
|
|
9602
|
-
EventService.prototype.isNativeEventFromCanvas = function (
|
|
9603
|
-
var
|
|
9604
|
-
|
|
9605
|
-
|
|
9640
|
+
EventService.prototype.isNativeEventFromCanvas = function ($el, nativeEvent) {
|
|
9641
|
+
var target = nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.target;
|
|
9642
|
+
// Get event target inside a web component.
|
|
9643
|
+
// @see https://stackoverflow.com/questions/57963312/get-event-target-inside-a-web-component
|
|
9644
|
+
if (target === null || target === void 0 ? void 0 : target.shadowRoot) {
|
|
9645
|
+
target = nativeEvent.composedPath()[0];
|
|
9646
|
+
}
|
|
9606
9647
|
if (target) {
|
|
9607
9648
|
// from <canvas>
|
|
9608
9649
|
if (target === $el) {
|
|
@@ -9613,8 +9654,8 @@ var EventService = /** @class */ (function () {
|
|
|
9613
9654
|
return $el.contains(target);
|
|
9614
9655
|
}
|
|
9615
9656
|
}
|
|
9616
|
-
if (
|
|
9617
|
-
return
|
|
9657
|
+
if (nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.composedPath) {
|
|
9658
|
+
return nativeEvent.composedPath().indexOf($el) > -1;
|
|
9618
9659
|
}
|
|
9619
9660
|
// account for Touch
|
|
9620
9661
|
return false;
|
|
@@ -9662,9 +9703,11 @@ var EventService = /** @class */ (function () {
|
|
|
9662
9703
|
event.nativeEvent = from.nativeEvent;
|
|
9663
9704
|
event.originalEvent = from;
|
|
9664
9705
|
var existedHTML = this.getExistedHTML(event);
|
|
9706
|
+
var $el = this.context.contextService.getDomElement();
|
|
9665
9707
|
event.target =
|
|
9666
9708
|
target !== null && target !== void 0 ? target : (existedHTML ||
|
|
9667
|
-
(this.isNativeEventFromCanvas(event) &&
|
|
9709
|
+
(this.isNativeEventFromCanvas($el, event.nativeEvent) &&
|
|
9710
|
+
this.pickTarget(event)) ||
|
|
9668
9711
|
fallbackTarget);
|
|
9669
9712
|
if (typeof type === 'string') {
|
|
9670
9713
|
event.type = type;
|
|
@@ -9679,9 +9722,11 @@ var EventService = /** @class */ (function () {
|
|
|
9679
9722
|
event.nativeEvent = from.nativeEvent;
|
|
9680
9723
|
event.originalEvent = from;
|
|
9681
9724
|
var existedHTML = this.getExistedHTML(event);
|
|
9725
|
+
var $el = this.context.contextService.getDomElement();
|
|
9682
9726
|
event.target =
|
|
9683
9727
|
existedHTML ||
|
|
9684
|
-
(this.isNativeEventFromCanvas(event) &&
|
|
9728
|
+
(this.isNativeEventFromCanvas($el, event.nativeEvent) &&
|
|
9729
|
+
this.pickTarget(event));
|
|
9685
9730
|
return event;
|
|
9686
9731
|
};
|
|
9687
9732
|
EventService.prototype.trackingData = function (id) {
|
|
@@ -10681,6 +10726,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10681
10726
|
}
|
|
10682
10727
|
};
|
|
10683
10728
|
DefaultSceneGraphService.prototype.getOrigin = function (element) {
|
|
10729
|
+
element.getGeometryBounds();
|
|
10684
10730
|
return element.transformable.origin;
|
|
10685
10731
|
};
|
|
10686
10732
|
/**
|
|
@@ -10990,6 +11036,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10990
11036
|
}
|
|
10991
11037
|
}
|
|
10992
11038
|
});
|
|
11039
|
+
if (!aabb) {
|
|
11040
|
+
aabb = new AABB();
|
|
11041
|
+
}
|
|
10993
11042
|
if (render) {
|
|
10994
11043
|
// FIXME: account for clip path
|
|
10995
11044
|
var clipped = findClosestClipPathTarget(element);
|
|
@@ -10997,28 +11046,19 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10997
11046
|
// use bounds under world space
|
|
10998
11047
|
var clipPathBounds = clipped.parsedStyle.clipPath.getBounds(render);
|
|
10999
11048
|
if (!aabb) {
|
|
11000
|
-
aabb
|
|
11049
|
+
aabb.update(clipPathBounds.center, clipPathBounds.halfExtents);
|
|
11001
11050
|
}
|
|
11002
11051
|
else if (clipPathBounds) {
|
|
11003
11052
|
aabb = clipPathBounds.intersection(aabb);
|
|
11004
11053
|
}
|
|
11005
11054
|
}
|
|
11006
11055
|
}
|
|
11007
|
-
if (!aabb) {
|
|
11008
|
-
aabb = new AABB();
|
|
11009
|
-
}
|
|
11010
|
-
if (aabb) {
|
|
11011
|
-
if (render) {
|
|
11012
|
-
renderable.renderBounds = aabb;
|
|
11013
|
-
}
|
|
11014
|
-
else {
|
|
11015
|
-
renderable.bounds = aabb;
|
|
11016
|
-
}
|
|
11017
|
-
}
|
|
11018
11056
|
if (render) {
|
|
11057
|
+
renderable.renderBounds = aabb;
|
|
11019
11058
|
renderable.renderBoundsDirty = false;
|
|
11020
11059
|
}
|
|
11021
11060
|
else {
|
|
11061
|
+
renderable.bounds = aabb;
|
|
11022
11062
|
renderable.boundsDirty = false;
|
|
11023
11063
|
}
|
|
11024
11064
|
return aabb;
|
|
@@ -11275,13 +11315,13 @@ var TextService = /** @class */ (function () {
|
|
|
11275
11315
|
return properties;
|
|
11276
11316
|
};
|
|
11277
11317
|
TextService.prototype.measureText = function (text, parsedStyle, offscreenCanvas) {
|
|
11278
|
-
var
|
|
11318
|
+
var _a = parsedStyle.fontSize, fontSize = _a === void 0 ? 16 : _a, _b = parsedStyle.wordWrap, wordWrap = _b === void 0 ? false : _b, strokeHeight = parsedStyle.lineHeight, _c = parsedStyle.lineWidth, lineWidth = _c === void 0 ? 1 : _c, _d = parsedStyle.textBaseline, textBaseline = _d === void 0 ? 'alphabetic' : _d, _e = parsedStyle.textAlign, textAlign = _e === void 0 ? 'start' : _e, _f = parsedStyle.letterSpacing, letterSpacing = _f === void 0 ? 0 : _f, textPath = parsedStyle.textPath; parsedStyle.textPathSide; parsedStyle.textPathStartOffset;
|
|
11279
11319
|
var // dropShadow = 0,
|
|
11280
11320
|
// dropShadowDistance = 0,
|
|
11281
|
-
|
|
11321
|
+
_g = parsedStyle.leading,
|
|
11282
11322
|
// dropShadow = 0,
|
|
11283
11323
|
// dropShadowDistance = 0,
|
|
11284
|
-
leading =
|
|
11324
|
+
leading = _g === void 0 ? 0 : _g;
|
|
11285
11325
|
var font = toFontString(parsedStyle);
|
|
11286
11326
|
// if (runtime.enableCSSParsing) {
|
|
11287
11327
|
var fontProperties = this.measureFont(font, offscreenCanvas);
|
|
@@ -11393,7 +11433,7 @@ var TextService = /** @class */ (function () {
|
|
|
11393
11433
|
TextService.prototype.setGraphemeOnPath = function () { };
|
|
11394
11434
|
TextService.prototype.wordWrap = function (text, parsedStyle, offscreenCanvas) {
|
|
11395
11435
|
var _this = this;
|
|
11396
|
-
var _a = parsedStyle.wordWrapWidth, wordWrapWidth = _a === void 0 ? 0 : _a,
|
|
11436
|
+
var _a = parsedStyle.wordWrapWidth, wordWrapWidth = _a === void 0 ? 0 : _a, _b = parsedStyle.letterSpacing, letterSpacing = _b === void 0 ? 0 : _b, _c = parsedStyle.maxLines, maxLines = _c === void 0 ? Infinity : _c, textOverflow = parsedStyle.textOverflow;
|
|
11397
11437
|
var context = this.runtime.offscreenCanvasCreator.getOrCreateContext(offscreenCanvas);
|
|
11398
11438
|
var maxWidth = wordWrapWidth + letterSpacing;
|
|
11399
11439
|
var ellipsis = '';
|
|
@@ -11617,9 +11657,11 @@ runtime.CSSPropertySyntaxFactory = CSSPropertySyntaxFactory;
|
|
|
11617
11657
|
runtime.styleValueRegistry = new DefaultStyleValueRegistry(runtime);
|
|
11618
11658
|
runtime.layoutRegistry = null;
|
|
11619
11659
|
runtime.globalThis = getGlobalThis();
|
|
11620
|
-
runtime.enableCSSParsing =
|
|
11660
|
+
runtime.enableCSSParsing = false;
|
|
11621
11661
|
runtime.enableDataset = false;
|
|
11622
11662
|
runtime.enableStyleSyntax = true;
|
|
11663
|
+
runtime.enableAttributeDashCased = false;
|
|
11664
|
+
runtime.enableSizeAttenuation = false;
|
|
11623
11665
|
|
|
11624
11666
|
var entityCounter = 0;
|
|
11625
11667
|
function resetEntityCounter() {
|
|
@@ -11865,8 +11907,11 @@ var Element = /** @class */ (function (_super) {
|
|
|
11865
11907
|
if ((_a = this.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) {
|
|
11866
11908
|
this.ownerDocument.defaultView.mountChildren(child);
|
|
11867
11909
|
}
|
|
11868
|
-
|
|
11869
|
-
|
|
11910
|
+
// @ts-ignore
|
|
11911
|
+
if (this.isMutationObserved) {
|
|
11912
|
+
insertedEvent.relatedNode = this;
|
|
11913
|
+
child.dispatchEvent(insertedEvent);
|
|
11914
|
+
}
|
|
11870
11915
|
return child;
|
|
11871
11916
|
};
|
|
11872
11917
|
Element.prototype.insertBefore = function (newChild, refChild) {
|
|
@@ -12139,8 +12184,10 @@ var Element = /** @class */ (function (_super) {
|
|
|
12139
12184
|
}
|
|
12140
12185
|
var value = this.attributes[name];
|
|
12141
12186
|
if (value === undefined) {
|
|
12142
|
-
|
|
12143
|
-
|
|
12187
|
+
if (runtime.enableAttributeDashCased) {
|
|
12188
|
+
var attributeName = formatAttributeName(name);
|
|
12189
|
+
value = this.attributes[attributeName];
|
|
12190
|
+
}
|
|
12144
12191
|
// if the given attribute does not exist, the value returned will either be null or ""
|
|
12145
12192
|
return runtime.enableCSSParsing ? (isNil(value) ? null : value) : value;
|
|
12146
12193
|
}
|
|
@@ -12210,6 +12257,9 @@ var Element = /** @class */ (function (_super) {
|
|
|
12210
12257
|
function isDisplayObject(value) {
|
|
12211
12258
|
return !!(value === null || value === void 0 ? void 0 : value.nodeName);
|
|
12212
12259
|
}
|
|
12260
|
+
var Proxy = runtime.globalThis.Proxy
|
|
12261
|
+
? runtime.globalThis.Proxy
|
|
12262
|
+
: function () { };
|
|
12213
12263
|
var mutationEvent = new MutationEvent(ElementEvent.ATTR_MODIFIED, null, null, null, null, MutationEvent.MODIFICATION, null, null);
|
|
12214
12264
|
var DEFAULT_STYLE_PROPS = {
|
|
12215
12265
|
opacity: '',
|
|
@@ -12246,7 +12296,20 @@ var DEFAULT_PARSED_STYLE_PROPS = {
|
|
|
12246
12296
|
shadowType: 'outer',
|
|
12247
12297
|
miterLimit: 10,
|
|
12248
12298
|
};
|
|
12249
|
-
|
|
12299
|
+
// const DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED = {
|
|
12300
|
+
// ...DEFAULT_PARSED_STYLE_PROPS,
|
|
12301
|
+
// opacity: 1,
|
|
12302
|
+
// fillOpacity: 1,
|
|
12303
|
+
// strokeOpacity: 1,
|
|
12304
|
+
// visibility: 'visible',
|
|
12305
|
+
// pointerEvents: 'auto',
|
|
12306
|
+
// lineWidth: 1,
|
|
12307
|
+
// lineCap: 'butt',
|
|
12308
|
+
// lineJoin: 'miter',
|
|
12309
|
+
// increasedLineWidthForHitTesting: 0,
|
|
12310
|
+
// fillRule: 'nonzero',
|
|
12311
|
+
// // TODO: transformOrigin
|
|
12312
|
+
// };
|
|
12250
12313
|
var INHERITABLE_BASE_STYLE_PROPS = [
|
|
12251
12314
|
'opacity',
|
|
12252
12315
|
'fillOpacity',
|
|
@@ -12298,13 +12361,6 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12298
12361
|
* push to active animations after calling `animate()`
|
|
12299
12362
|
*/
|
|
12300
12363
|
_this.activeAnimations = [];
|
|
12301
|
-
/**
|
|
12302
|
-
* Use `this.style.clipPath` instead.
|
|
12303
|
-
* @deprecated
|
|
12304
|
-
*/
|
|
12305
|
-
_this.getClip = function () {
|
|
12306
|
-
return this.style.clipPath || null;
|
|
12307
|
-
};
|
|
12308
12364
|
// assign name, id to config
|
|
12309
12365
|
// eg. group.get('name')
|
|
12310
12366
|
_this.config = config;
|
|
@@ -12315,18 +12371,17 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12315
12371
|
_this.className = _this.config.className || _this.config.class;
|
|
12316
12372
|
}
|
|
12317
12373
|
_this.nodeName = _this.config.type || Shape.GROUP;
|
|
12318
|
-
// merge parsed value
|
|
12319
|
-
Object.assign(_this.parsedStyle, runtime.enableCSSParsing
|
|
12320
|
-
? DEFAULT_PARSED_STYLE_PROPS
|
|
12321
|
-
: DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED, _this.config.initialParsedStyle);
|
|
12322
12374
|
if (runtime.enableCSSParsing) {
|
|
12323
12375
|
Object.assign(_this.attributes, DEFAULT_STYLE_PROPS);
|
|
12376
|
+
Object.assign(_this.parsedStyle, DEFAULT_PARSED_STYLE_PROPS, _this.config.initialParsedStyle);
|
|
12377
|
+
}
|
|
12378
|
+
else if (_this.config.initialParsedStyle) {
|
|
12379
|
+
Object.assign(_this.parsedStyle,
|
|
12380
|
+
// DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED,
|
|
12381
|
+
_this.config.initialParsedStyle);
|
|
12324
12382
|
}
|
|
12325
12383
|
// start to process attributes
|
|
12326
12384
|
_this.initAttributes(_this.config.style);
|
|
12327
|
-
var Proxy = runtime.globalThis.Proxy
|
|
12328
|
-
? runtime.globalThis.Proxy
|
|
12329
|
-
: function () { };
|
|
12330
12385
|
if (runtime.enableDataset) {
|
|
12331
12386
|
_this.dataset = new Proxy({}, {
|
|
12332
12387
|
get: function (target, name) {
|
|
@@ -12444,10 +12499,14 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12444
12499
|
options.usedAttributes = INHERITABLE_STYLE_PROPS;
|
|
12445
12500
|
}
|
|
12446
12501
|
// account for FCP, process properties as less as possible
|
|
12447
|
-
var formattedAttributes =
|
|
12448
|
-
|
|
12449
|
-
|
|
12450
|
-
formattedAttributes
|
|
12502
|
+
var formattedAttributes = attributes;
|
|
12503
|
+
if (runtime.enableAttributeDashCased) {
|
|
12504
|
+
// @ts-ignore
|
|
12505
|
+
formattedAttributes = {};
|
|
12506
|
+
for (var name_1 in attributes) {
|
|
12507
|
+
var attributeName = formatAttributeName(name_1);
|
|
12508
|
+
formattedAttributes[attributeName] = attributes[name_1];
|
|
12509
|
+
}
|
|
12451
12510
|
}
|
|
12452
12511
|
runtime.styleValueRegistry.processProperties(this, formattedAttributes, options);
|
|
12453
12512
|
// redraw at next frame
|
|
@@ -12456,14 +12515,16 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12456
12515
|
DisplayObject.prototype.setAttribute = function (name, value, force, memoize) {
|
|
12457
12516
|
if (force === void 0) { force = false; }
|
|
12458
12517
|
if (memoize === void 0) { memoize = true; }
|
|
12459
|
-
|
|
12518
|
+
if (runtime.enableAttributeDashCased) {
|
|
12519
|
+
name = formatAttributeName(name);
|
|
12520
|
+
}
|
|
12460
12521
|
// ignore undefined value
|
|
12461
12522
|
if (isUndefined(value)) {
|
|
12462
12523
|
return;
|
|
12463
12524
|
}
|
|
12464
|
-
if (force || value !== this.attributes[
|
|
12465
|
-
this.internalSetAttribute(
|
|
12466
|
-
_super.prototype.setAttribute.call(this,
|
|
12525
|
+
if (force || value !== this.attributes[name]) {
|
|
12526
|
+
this.internalSetAttribute(name, value, { memoize: memoize });
|
|
12527
|
+
_super.prototype.setAttribute.call(this, name, value);
|
|
12467
12528
|
}
|
|
12468
12529
|
};
|
|
12469
12530
|
/**
|
|
@@ -12717,8 +12778,10 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12717
12778
|
* shortcut for Used value of `visibility`
|
|
12718
12779
|
*/
|
|
12719
12780
|
DisplayObject.prototype.isVisible = function () {
|
|
12720
|
-
var _a;
|
|
12721
|
-
return
|
|
12781
|
+
var _a, _b;
|
|
12782
|
+
return runtime.enableCSSParsing
|
|
12783
|
+
? ((_a = this.parsedStyle) === null || _a === void 0 ? void 0 : _a.visibility) === 'visible'
|
|
12784
|
+
: ((_b = this.parsedStyle) === null || _b === void 0 ? void 0 : _b.visibility) !== 'hidden';
|
|
12722
12785
|
};
|
|
12723
12786
|
Object.defineProperty(DisplayObject.prototype, "interactive", {
|
|
12724
12787
|
get: function () {
|
|
@@ -12910,13 +12973,6 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12910
12973
|
DisplayObject.prototype.add = function (child, index) {
|
|
12911
12974
|
return this.appendChild(child, index);
|
|
12912
12975
|
};
|
|
12913
|
-
/**
|
|
12914
|
-
* Use `this.style.clipPath` instead.
|
|
12915
|
-
* @deprecated
|
|
12916
|
-
*/
|
|
12917
|
-
DisplayObject.prototype.setClip = function (clipPath) {
|
|
12918
|
-
this.style.clipPath = clipPath;
|
|
12919
|
-
};
|
|
12920
12976
|
/**
|
|
12921
12977
|
* @deprecated
|
|
12922
12978
|
*/
|
|
@@ -12961,124 +13017,11 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12961
13017
|
return DisplayObject;
|
|
12962
13018
|
}(Element));
|
|
12963
13019
|
|
|
12964
|
-
/**
|
|
12965
|
-
* holds useful CSS-related methods.
|
|
12966
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS
|
|
12967
|
-
*
|
|
12968
|
-
* * CSS Typed OM @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/factory_functions
|
|
12969
|
-
* * register property @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
|
|
12970
|
-
* * CSS Layout API
|
|
12971
|
-
*/
|
|
12972
|
-
var CSS = {
|
|
12973
|
-
/**
|
|
12974
|
-
* <number>
|
|
12975
|
-
* @see https://drafts.csswg.org/css-values-4/#number-value
|
|
12976
|
-
*/
|
|
12977
|
-
number: function (n) {
|
|
12978
|
-
return new CSSUnitValue(n);
|
|
12979
|
-
},
|
|
12980
|
-
/**
|
|
12981
|
-
* <percentage>
|
|
12982
|
-
* @see https://drafts.csswg.org/css-values-4/#percentage-value
|
|
12983
|
-
*/
|
|
12984
|
-
percent: function (n) {
|
|
12985
|
-
return new CSSUnitValue(n, '%');
|
|
12986
|
-
},
|
|
12987
|
-
/**
|
|
12988
|
-
* <length>
|
|
12989
|
-
*/
|
|
12990
|
-
px: function (n) {
|
|
12991
|
-
return new CSSUnitValue(n, 'px');
|
|
12992
|
-
},
|
|
12993
|
-
/**
|
|
12994
|
-
* <length>
|
|
12995
|
-
*/
|
|
12996
|
-
em: function (n) {
|
|
12997
|
-
return new CSSUnitValue(n, 'em');
|
|
12998
|
-
},
|
|
12999
|
-
rem: function (n) {
|
|
13000
|
-
return new CSSUnitValue(n, 'rem');
|
|
13001
|
-
},
|
|
13002
|
-
/**
|
|
13003
|
-
* <angle>
|
|
13004
|
-
*/
|
|
13005
|
-
deg: function (n) {
|
|
13006
|
-
return new CSSUnitValue(n, 'deg');
|
|
13007
|
-
},
|
|
13008
|
-
/**
|
|
13009
|
-
* <angle>
|
|
13010
|
-
*/
|
|
13011
|
-
grad: function (n) {
|
|
13012
|
-
return new CSSUnitValue(n, 'grad');
|
|
13013
|
-
},
|
|
13014
|
-
/**
|
|
13015
|
-
* <angle>
|
|
13016
|
-
*/
|
|
13017
|
-
rad: function (n) {
|
|
13018
|
-
return new CSSUnitValue(n, 'rad');
|
|
13019
|
-
},
|
|
13020
|
-
/**
|
|
13021
|
-
* <angle>
|
|
13022
|
-
*/
|
|
13023
|
-
turn: function (n) {
|
|
13024
|
-
return new CSSUnitValue(n, 'turn');
|
|
13025
|
-
},
|
|
13026
|
-
/**
|
|
13027
|
-
* <time>
|
|
13028
|
-
*/
|
|
13029
|
-
s: function (n) {
|
|
13030
|
-
return new CSSUnitValue(n, 's');
|
|
13031
|
-
},
|
|
13032
|
-
/**
|
|
13033
|
-
* <time>
|
|
13034
|
-
*/
|
|
13035
|
-
ms: function (n) {
|
|
13036
|
-
return new CSSUnitValue(n, 'ms');
|
|
13037
|
-
},
|
|
13038
|
-
/**
|
|
13039
|
-
* CSS Properties & Values API
|
|
13040
|
-
*
|
|
13041
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS_Properties_and_Values_API
|
|
13042
|
-
* @see https://drafts.css-houdini.org/css-properties-values-api/#registering-custom-properties
|
|
13043
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
|
|
13044
|
-
*/
|
|
13045
|
-
registerProperty: function (definition) {
|
|
13046
|
-
var name = definition.name, inherits = definition.inherits, interpolable = definition.interpolable, initialValue = definition.initialValue, syntax = definition.syntax;
|
|
13047
|
-
runtime.styleValueRegistry.registerMetadata({
|
|
13048
|
-
n: name,
|
|
13049
|
-
inh: inherits,
|
|
13050
|
-
int: interpolable,
|
|
13051
|
-
d: initialValue,
|
|
13052
|
-
syntax: syntax,
|
|
13053
|
-
});
|
|
13054
|
-
},
|
|
13055
|
-
/**
|
|
13056
|
-
* CSS Layout API
|
|
13057
|
-
* register layout
|
|
13058
|
-
*
|
|
13059
|
-
* @see https://github.com/w3c/css-houdini-drafts/blob/main/css-layout-api/EXPLAINER.md
|
|
13060
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/Guide/Houdini#css_layout_api
|
|
13061
|
-
*/
|
|
13062
|
-
registerLayout: function (name, clazz) {
|
|
13063
|
-
runtime.layoutRegistry.registerLayout(name, clazz);
|
|
13064
|
-
},
|
|
13065
|
-
};
|
|
13066
|
-
|
|
13067
13020
|
var Circle = /** @class */ (function (_super) {
|
|
13068
13021
|
__extends(Circle, _super);
|
|
13069
|
-
|
|
13070
|
-
|
|
13071
|
-
|
|
13072
|
-
// }
|
|
13073
|
-
function Circle(_a) {
|
|
13074
|
-
if (_a === void 0) { _a = {}; }
|
|
13075
|
-
var style = _a.style, rest = __rest(_a, ["style"]);
|
|
13076
|
-
return _super.call(this, __assign({ type: Shape.CIRCLE, style: runtime.enableCSSParsing
|
|
13077
|
-
? __assign({ cx: '', cy: '', r: '' }, style) : style, initialParsedStyle: {
|
|
13078
|
-
transformOrigin: runtime.enableCSSParsing
|
|
13079
|
-
? null
|
|
13080
|
-
: [PECENTAGE_50, PECENTAGE_50],
|
|
13081
|
-
} }, rest)) || this;
|
|
13022
|
+
function Circle(options) {
|
|
13023
|
+
if (options === void 0) { options = {}; }
|
|
13024
|
+
return _super.call(this, __assign({ type: Shape.CIRCLE }, options)) || this;
|
|
13082
13025
|
}
|
|
13083
13026
|
return Circle;
|
|
13084
13027
|
}(DisplayObject));
|
|
@@ -13107,15 +13050,9 @@ var CustomElement = /** @class */ (function (_super) {
|
|
|
13107
13050
|
|
|
13108
13051
|
var Ellipse = /** @class */ (function (_super) {
|
|
13109
13052
|
__extends(Ellipse, _super);
|
|
13110
|
-
function Ellipse(
|
|
13111
|
-
if (
|
|
13112
|
-
|
|
13113
|
-
return _super.call(this, __assign({ type: Shape.ELLIPSE, style: runtime.enableCSSParsing
|
|
13114
|
-
? __assign({ cx: '', cy: '', rx: '', ry: '' }, style) : style, initialParsedStyle: {
|
|
13115
|
-
transformOrigin: runtime.enableCSSParsing
|
|
13116
|
-
? null
|
|
13117
|
-
: [PECENTAGE_50, PECENTAGE_50],
|
|
13118
|
-
} }, rest)) || this;
|
|
13053
|
+
function Ellipse(options) {
|
|
13054
|
+
if (options === void 0) { options = {}; }
|
|
13055
|
+
return _super.call(this, __assign({ type: Shape.ELLIPSE }, options)) || this;
|
|
13119
13056
|
}
|
|
13120
13057
|
return Ellipse;
|
|
13121
13058
|
}(DisplayObject));
|
|
@@ -13132,11 +13069,9 @@ var Ellipse = /** @class */ (function (_super) {
|
|
|
13132
13069
|
*/
|
|
13133
13070
|
var Group = /** @class */ (function (_super) {
|
|
13134
13071
|
__extends(Group, _super);
|
|
13135
|
-
function Group(
|
|
13136
|
-
if (
|
|
13137
|
-
|
|
13138
|
-
return _super.call(this, __assign({ type: Shape.GROUP, style: runtime.enableCSSParsing
|
|
13139
|
-
? __assign({ width: '', height: '' }, style) : __assign({}, style) }, rest)) || this;
|
|
13072
|
+
function Group(options) {
|
|
13073
|
+
if (options === void 0) { options = {}; }
|
|
13074
|
+
return _super.call(this, __assign({ type: Shape.GROUP }, options)) || this;
|
|
13140
13075
|
}
|
|
13141
13076
|
return Group;
|
|
13142
13077
|
}(DisplayObject));
|
|
@@ -13209,11 +13144,9 @@ var HTML = /** @class */ (function (_super) {
|
|
|
13209
13144
|
|
|
13210
13145
|
var Image = /** @class */ (function (_super) {
|
|
13211
13146
|
__extends(Image, _super);
|
|
13212
|
-
function Image(
|
|
13213
|
-
if (
|
|
13214
|
-
|
|
13215
|
-
return _super.call(this, __assign({ type: Shape.IMAGE, style: runtime.enableCSSParsing
|
|
13216
|
-
? __assign({ x: '', y: '', img: '', width: '', height: '' }, style) : __assign({}, style) }, rest)) || this;
|
|
13147
|
+
function Image(options) {
|
|
13148
|
+
if (options === void 0) { options = {}; }
|
|
13149
|
+
return _super.call(this, __assign({ type: Shape.IMAGE }, options)) || this;
|
|
13217
13150
|
}
|
|
13218
13151
|
return Image;
|
|
13219
13152
|
}(DisplayObject));
|
|
@@ -13342,11 +13275,11 @@ var Path = /** @class */ (function (_super) {
|
|
|
13342
13275
|
var _this = this;
|
|
13343
13276
|
var style = _a.style, rest = __rest(_a, ["style"]);
|
|
13344
13277
|
_this = _super.call(this, __assign({ type: Shape.PATH, style: runtime.enableCSSParsing
|
|
13345
|
-
? __assign({
|
|
13278
|
+
? __assign({ d: '', miterLimit: '' }, style) : __assign({}, style), initialParsedStyle: runtime.enableCSSParsing
|
|
13346
13279
|
? null
|
|
13347
13280
|
: {
|
|
13348
13281
|
miterLimit: 4,
|
|
13349
|
-
|
|
13282
|
+
d: __assign({}, EMPTY_PARSED_PATH),
|
|
13350
13283
|
} }, rest)) || this;
|
|
13351
13284
|
_this.markerStartAngle = 0;
|
|
13352
13285
|
_this.markerEndAngle = 0;
|
|
@@ -13371,7 +13304,7 @@ var Path = /** @class */ (function (_super) {
|
|
|
13371
13304
|
return _this;
|
|
13372
13305
|
}
|
|
13373
13306
|
Path.prototype.attributeChangedCallback = function (attrName, oldValue, newValue, prevParsedValue, newParsedValue) {
|
|
13374
|
-
if (attrName === '
|
|
13307
|
+
if (attrName === 'd') {
|
|
13375
13308
|
// recalc markers
|
|
13376
13309
|
this.transformMarker(true);
|
|
13377
13310
|
this.transformMarker(false);
|
|
@@ -13446,7 +13379,7 @@ var Path = /** @class */ (function (_super) {
|
|
|
13446
13379
|
marker.setLocalPosition(ox + Math.cos(rad) * offset, oy + Math.sin(rad) * offset);
|
|
13447
13380
|
};
|
|
13448
13381
|
Path.prototype.placeMarkerMid = function (marker) {
|
|
13449
|
-
var segments = this.parsedStyle.
|
|
13382
|
+
var segments = this.parsedStyle.d.segments;
|
|
13450
13383
|
// clear all existed markers
|
|
13451
13384
|
this.markerMidList.forEach(function (marker) {
|
|
13452
13385
|
marker.remove();
|
|
@@ -13475,7 +13408,7 @@ var Path = /** @class */ (function (_super) {
|
|
|
13475
13408
|
*/
|
|
13476
13409
|
Path.prototype.getPointAtLength = function (distance, inWorldSpace) {
|
|
13477
13410
|
if (inWorldSpace === void 0) { inWorldSpace = false; }
|
|
13478
|
-
var absolutePath = this.parsedStyle.
|
|
13411
|
+
var absolutePath = this.parsedStyle.d.absolutePath;
|
|
13479
13412
|
var _a = getPointAtLength(absolutePath, distance), x = _a.x, y = _a.y;
|
|
13480
13413
|
var transformed = vec3.transformMat4(vec3.create(), vec3.fromValues(x, y, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform());
|
|
13481
13414
|
// apply local transformation
|
|
@@ -13492,7 +13425,7 @@ var Path = /** @class */ (function (_super) {
|
|
|
13492
13425
|
* Get start tangent vector
|
|
13493
13426
|
*/
|
|
13494
13427
|
Path.prototype.getStartTangent = function () {
|
|
13495
|
-
var segments = this.parsedStyle.
|
|
13428
|
+
var segments = this.parsedStyle.d.segments;
|
|
13496
13429
|
var result = [];
|
|
13497
13430
|
if (segments.length > 1) {
|
|
13498
13431
|
var startPoint = segments[0].currentPoint;
|
|
@@ -13514,7 +13447,7 @@ var Path = /** @class */ (function (_super) {
|
|
|
13514
13447
|
* Get end tangent vector
|
|
13515
13448
|
*/
|
|
13516
13449
|
Path.prototype.getEndTangent = function () {
|
|
13517
|
-
var segments = this.parsedStyle.
|
|
13450
|
+
var segments = this.parsedStyle.d.segments;
|
|
13518
13451
|
var length = segments.length;
|
|
13519
13452
|
var result = [];
|
|
13520
13453
|
if (length > 1) {
|
|
@@ -13702,7 +13635,7 @@ var Polyline = /** @class */ (function (_super) {
|
|
|
13702
13635
|
} }, rest)) || this;
|
|
13703
13636
|
}
|
|
13704
13637
|
Polyline.prototype.getTotalLength = function () {
|
|
13705
|
-
return this
|
|
13638
|
+
return getOrCalculatePolylineTotalLength(this);
|
|
13706
13639
|
};
|
|
13707
13640
|
Polyline.prototype.getPointAtLength = function (distance, inWorldSpace) {
|
|
13708
13641
|
if (inWorldSpace === void 0) { inWorldSpace = false; }
|
|
@@ -13710,16 +13643,34 @@ var Polyline = /** @class */ (function (_super) {
|
|
|
13710
13643
|
};
|
|
13711
13644
|
Polyline.prototype.getPoint = function (ratio, inWorldSpace) {
|
|
13712
13645
|
if (inWorldSpace === void 0) { inWorldSpace = false; }
|
|
13713
|
-
var
|
|
13646
|
+
var points = this.parsedStyle.points.points;
|
|
13647
|
+
if (this.parsedStyle.points.segments.length === 0) {
|
|
13648
|
+
var segments_1 = [];
|
|
13649
|
+
var tempLength_1 = 0;
|
|
13650
|
+
var segmentT_1;
|
|
13651
|
+
var segmentL_1;
|
|
13652
|
+
var totalLength_1 = this.getTotalLength();
|
|
13653
|
+
points.forEach(function (p, i) {
|
|
13654
|
+
if (points[i + 1]) {
|
|
13655
|
+
segmentT_1 = [0, 0];
|
|
13656
|
+
segmentT_1[0] = tempLength_1 / totalLength_1;
|
|
13657
|
+
segmentL_1 = lineLength(p[0], p[1], points[i + 1][0], points[i + 1][1]);
|
|
13658
|
+
tempLength_1 += segmentL_1;
|
|
13659
|
+
segmentT_1[1] = tempLength_1 / totalLength_1;
|
|
13660
|
+
segments_1.push(segmentT_1);
|
|
13661
|
+
}
|
|
13662
|
+
});
|
|
13663
|
+
this.parsedStyle.points.segments = segments_1;
|
|
13664
|
+
}
|
|
13714
13665
|
var subt = 0;
|
|
13715
13666
|
var index = 0;
|
|
13716
|
-
segments.forEach(function (v, i) {
|
|
13667
|
+
this.parsedStyle.points.segments.forEach(function (v, i) {
|
|
13717
13668
|
if (ratio >= v[0] && ratio <= v[1]) {
|
|
13718
13669
|
subt = (ratio - v[0]) / (v[1] - v[0]);
|
|
13719
13670
|
index = i;
|
|
13720
13671
|
}
|
|
13721
13672
|
});
|
|
13722
|
-
var
|
|
13673
|
+
var _a = linePointAt(points[index][0], points[index][1], points[index + 1][0], points[index + 1][1], subt), x = _a.x, y = _a.y;
|
|
13723
13674
|
var transformed = vec3.transformMat4(vec3.create(), vec3.fromValues(x, y, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform());
|
|
13724
13675
|
// apply local transformation
|
|
13725
13676
|
return new Point(transformed[0], transformed[1]);
|
|
@@ -13744,11 +13695,9 @@ var Polyline = /** @class */ (function (_super) {
|
|
|
13744
13695
|
|
|
13745
13696
|
var Rect = /** @class */ (function (_super) {
|
|
13746
13697
|
__extends(Rect, _super);
|
|
13747
|
-
function Rect(
|
|
13748
|
-
if (
|
|
13749
|
-
|
|
13750
|
-
return _super.call(this, __assign({ type: Shape.RECT, style: runtime.enableCSSParsing
|
|
13751
|
-
? __assign({ x: '', y: '', width: '', height: '', radius: '' }, style) : __assign({}, style) }, rest)) || this;
|
|
13698
|
+
function Rect(options) {
|
|
13699
|
+
if (options === void 0) { options = {}; }
|
|
13700
|
+
return _super.call(this, __assign({ type: Shape.RECT }, options)) || this;
|
|
13752
13701
|
}
|
|
13753
13702
|
return Rect;
|
|
13754
13703
|
}(DisplayObject));
|
|
@@ -13770,26 +13719,7 @@ var Text = /** @class */ (function (_super) {
|
|
|
13770
13719
|
return _super.call(this, __assign({ type: Shape.TEXT, style: runtime.enableCSSParsing
|
|
13771
13720
|
? __assign({ x: '', y: '', text: '', fontSize: '', fontFamily: '', fontStyle: '', fontWeight: '', fontVariant: '', textAlign: '', textBaseline: '', textTransform: '', fill: 'black', letterSpacing: '', lineHeight: '', miterLimit: '',
|
|
13772
13721
|
// whiteSpace: 'pre',
|
|
13773
|
-
wordWrap: false, wordWrapWidth: 0, leading: 0, dx: '', dy: '' }, style) : __assign({ fill: 'black' }, style),
|
|
13774
|
-
? {}
|
|
13775
|
-
: {
|
|
13776
|
-
x: 0,
|
|
13777
|
-
y: 0,
|
|
13778
|
-
fontSize: 16,
|
|
13779
|
-
fontFamily: 'sans-serif',
|
|
13780
|
-
fontStyle: 'normal',
|
|
13781
|
-
fontWeight: 'normal',
|
|
13782
|
-
fontVariant: 'normal',
|
|
13783
|
-
lineHeight: 0,
|
|
13784
|
-
letterSpacing: 0,
|
|
13785
|
-
textBaseline: 'alphabetic',
|
|
13786
|
-
textAlign: 'start',
|
|
13787
|
-
wordWrap: false,
|
|
13788
|
-
wordWrapWidth: 0,
|
|
13789
|
-
leading: 0,
|
|
13790
|
-
dx: 0,
|
|
13791
|
-
dy: 0,
|
|
13792
|
-
} }, rest)) || this;
|
|
13722
|
+
wordWrap: false, wordWrapWidth: 0, leading: 0, dx: '', dy: '' }, style) : __assign({ fill: 'black' }, style) }, rest)) || this;
|
|
13793
13723
|
}
|
|
13794
13724
|
// lengthAdjust: SVGAnimatedEnumeration;
|
|
13795
13725
|
// textLength: SVGAnimatedLength;
|
|
@@ -13801,6 +13731,7 @@ var Text = /** @class */ (function (_super) {
|
|
|
13801
13731
|
*/
|
|
13802
13732
|
Text.prototype.getComputedTextLength = function () {
|
|
13803
13733
|
var _a;
|
|
13734
|
+
this.getGeometryBounds();
|
|
13804
13735
|
return ((_a = this.parsedStyle.metrics) === null || _a === void 0 ? void 0 : _a.maxLineWidth) || 0;
|
|
13805
13736
|
};
|
|
13806
13737
|
// getEndPositionOfChar(charnum: number): DOMPoint {
|
|
@@ -13826,9 +13757,11 @@ var Text = /** @class */ (function (_super) {
|
|
|
13826
13757
|
// }
|
|
13827
13758
|
Text.prototype.getLineBoundingRects = function () {
|
|
13828
13759
|
var _a;
|
|
13760
|
+
this.getGeometryBounds();
|
|
13829
13761
|
return ((_a = this.parsedStyle.metrics) === null || _a === void 0 ? void 0 : _a.lineMetrics) || [];
|
|
13830
13762
|
};
|
|
13831
13763
|
Text.prototype.isOverflowing = function () {
|
|
13764
|
+
this.getGeometryBounds();
|
|
13832
13765
|
return !!this.parsedStyle.isOverflowing;
|
|
13833
13766
|
};
|
|
13834
13767
|
return Text;
|
|
@@ -13866,6 +13799,109 @@ var CustomElementRegistry = /** @class */ (function () {
|
|
|
13866
13799
|
return CustomElementRegistry;
|
|
13867
13800
|
}());
|
|
13868
13801
|
|
|
13802
|
+
/**
|
|
13803
|
+
* holds useful CSS-related methods.
|
|
13804
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS
|
|
13805
|
+
*
|
|
13806
|
+
* * CSS Typed OM @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/factory_functions
|
|
13807
|
+
* * register property @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
|
|
13808
|
+
* * CSS Layout API
|
|
13809
|
+
*/
|
|
13810
|
+
var CSS = {
|
|
13811
|
+
/**
|
|
13812
|
+
* <number>
|
|
13813
|
+
* @see https://drafts.csswg.org/css-values-4/#number-value
|
|
13814
|
+
*/
|
|
13815
|
+
number: function (n) {
|
|
13816
|
+
return new CSSUnitValue(n);
|
|
13817
|
+
},
|
|
13818
|
+
/**
|
|
13819
|
+
* <percentage>
|
|
13820
|
+
* @see https://drafts.csswg.org/css-values-4/#percentage-value
|
|
13821
|
+
*/
|
|
13822
|
+
percent: function (n) {
|
|
13823
|
+
return new CSSUnitValue(n, '%');
|
|
13824
|
+
},
|
|
13825
|
+
/**
|
|
13826
|
+
* <length>
|
|
13827
|
+
*/
|
|
13828
|
+
px: function (n) {
|
|
13829
|
+
return new CSSUnitValue(n, 'px');
|
|
13830
|
+
},
|
|
13831
|
+
/**
|
|
13832
|
+
* <length>
|
|
13833
|
+
*/
|
|
13834
|
+
em: function (n) {
|
|
13835
|
+
return new CSSUnitValue(n, 'em');
|
|
13836
|
+
},
|
|
13837
|
+
rem: function (n) {
|
|
13838
|
+
return new CSSUnitValue(n, 'rem');
|
|
13839
|
+
},
|
|
13840
|
+
/**
|
|
13841
|
+
* <angle>
|
|
13842
|
+
*/
|
|
13843
|
+
deg: function (n) {
|
|
13844
|
+
return new CSSUnitValue(n, 'deg');
|
|
13845
|
+
},
|
|
13846
|
+
/**
|
|
13847
|
+
* <angle>
|
|
13848
|
+
*/
|
|
13849
|
+
grad: function (n) {
|
|
13850
|
+
return new CSSUnitValue(n, 'grad');
|
|
13851
|
+
},
|
|
13852
|
+
/**
|
|
13853
|
+
* <angle>
|
|
13854
|
+
*/
|
|
13855
|
+
rad: function (n) {
|
|
13856
|
+
return new CSSUnitValue(n, 'rad');
|
|
13857
|
+
},
|
|
13858
|
+
/**
|
|
13859
|
+
* <angle>
|
|
13860
|
+
*/
|
|
13861
|
+
turn: function (n) {
|
|
13862
|
+
return new CSSUnitValue(n, 'turn');
|
|
13863
|
+
},
|
|
13864
|
+
/**
|
|
13865
|
+
* <time>
|
|
13866
|
+
*/
|
|
13867
|
+
s: function (n) {
|
|
13868
|
+
return new CSSUnitValue(n, 's');
|
|
13869
|
+
},
|
|
13870
|
+
/**
|
|
13871
|
+
* <time>
|
|
13872
|
+
*/
|
|
13873
|
+
ms: function (n) {
|
|
13874
|
+
return new CSSUnitValue(n, 'ms');
|
|
13875
|
+
},
|
|
13876
|
+
/**
|
|
13877
|
+
* CSS Properties & Values API
|
|
13878
|
+
*
|
|
13879
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS_Properties_and_Values_API
|
|
13880
|
+
* @see https://drafts.css-houdini.org/css-properties-values-api/#registering-custom-properties
|
|
13881
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
|
|
13882
|
+
*/
|
|
13883
|
+
registerProperty: function (definition) {
|
|
13884
|
+
var name = definition.name, inherits = definition.inherits, interpolable = definition.interpolable, initialValue = definition.initialValue, syntax = definition.syntax;
|
|
13885
|
+
runtime.styleValueRegistry.registerMetadata({
|
|
13886
|
+
n: name,
|
|
13887
|
+
inh: inherits,
|
|
13888
|
+
int: interpolable,
|
|
13889
|
+
d: initialValue,
|
|
13890
|
+
syntax: syntax,
|
|
13891
|
+
});
|
|
13892
|
+
},
|
|
13893
|
+
/**
|
|
13894
|
+
* CSS Layout API
|
|
13895
|
+
* register layout
|
|
13896
|
+
*
|
|
13897
|
+
* @see https://github.com/w3c/css-houdini-drafts/blob/main/css-layout-api/EXPLAINER.md
|
|
13898
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/Guide/Houdini#css_layout_api
|
|
13899
|
+
*/
|
|
13900
|
+
registerLayout: function (name, clazz) {
|
|
13901
|
+
runtime.layoutRegistry.registerLayout(name, clazz);
|
|
13902
|
+
},
|
|
13903
|
+
};
|
|
13904
|
+
|
|
13869
13905
|
/**
|
|
13870
13906
|
* the entry of DOM tree
|
|
13871
13907
|
* Document -> Node -> EventTarget
|
|
@@ -13977,7 +14013,7 @@ var Document = /** @class */ (function (_super) {
|
|
|
13977
14013
|
var hitTestList = [];
|
|
13978
14014
|
rBushNodes.forEach(function (_a) {
|
|
13979
14015
|
var displayObject = _a.displayObject;
|
|
13980
|
-
var
|
|
14016
|
+
var _b = displayObject.parsedStyle.pointerEvents, pointerEvents = _b === void 0 ? 'auto' : _b;
|
|
13981
14017
|
// account for `visibility`
|
|
13982
14018
|
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
|
|
13983
14019
|
var isVisibilityAffected = [
|
|
@@ -14379,21 +14415,8 @@ var EventPlugin = /** @class */ (function () {
|
|
|
14379
14415
|
return;
|
|
14380
14416
|
// account for element in SVG
|
|
14381
14417
|
var $element = _this.context.contextService.getDomElement();
|
|
14382
|
-
var
|
|
14383
|
-
|
|
14384
|
-
outside =
|
|
14385
|
-
$element &&
|
|
14386
|
-
nativeEvent.target &&
|
|
14387
|
-
nativeEvent.target !== $element &&
|
|
14388
|
-
$element.contains &&
|
|
14389
|
-
!$element.contains(nativeEvent.target)
|
|
14390
|
-
? 'outside'
|
|
14391
|
-
: '';
|
|
14392
|
-
}
|
|
14393
|
-
catch (e) {
|
|
14394
|
-
// nativeEvent.target maybe not Node, such as Window
|
|
14395
|
-
// @see https://github.com/antvis/G/issues/1235
|
|
14396
|
-
}
|
|
14418
|
+
var isNativeEventFromCanvas = _this.context.eventService.isNativeEventFromCanvas($element, nativeEvent);
|
|
14419
|
+
var outside = !isNativeEventFromCanvas ? 'outside' : '';
|
|
14397
14420
|
var normalizedEvents = _this.normalizeToPointerEvent(nativeEvent, canvas);
|
|
14398
14421
|
try {
|
|
14399
14422
|
for (var normalizedEvents_3 = __values(normalizedEvents), normalizedEvents_3_1 = normalizedEvents_3.next(); !normalizedEvents_3_1.done; normalizedEvents_3_1 = normalizedEvents_3.next()) {
|
|
@@ -14706,11 +14729,13 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14706
14729
|
* sync to RBush later
|
|
14707
14730
|
*/
|
|
14708
14731
|
this.toSync = new Set();
|
|
14732
|
+
this.isFirstTimeRendering = true;
|
|
14733
|
+
this.syncing = false;
|
|
14734
|
+
this.isFirstTimeRenderingFinished = false;
|
|
14709
14735
|
}
|
|
14710
|
-
// private isFirstTimeRendering = true;
|
|
14711
|
-
// private syncing = false;
|
|
14712
14736
|
PrepareRendererPlugin.prototype.apply = function (context) {
|
|
14713
14737
|
var _this = this;
|
|
14738
|
+
var _a;
|
|
14714
14739
|
var renderingService = context.renderingService, renderingContext = context.renderingContext, rBushRoot = context.rBushRoot;
|
|
14715
14740
|
var canvas = renderingContext.root.ownerDocument.defaultView;
|
|
14716
14741
|
this.rBush = rBushRoot;
|
|
@@ -14739,6 +14764,9 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14739
14764
|
};
|
|
14740
14765
|
var handleMounted = function (e) {
|
|
14741
14766
|
var object = e.target;
|
|
14767
|
+
if (runtime.enableSizeAttenuation) {
|
|
14768
|
+
runtime.styleValueRegistry.updateSizeAttenuation(object, canvas.getCamera().getZoom());
|
|
14769
|
+
}
|
|
14742
14770
|
if (runtime.enableCSSParsing) {
|
|
14743
14771
|
// recalc style values
|
|
14744
14772
|
runtime.styleValueRegistry.recalc(object);
|
|
@@ -14769,26 +14797,28 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14769
14797
|
canvas.removeEventListener(ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
|
|
14770
14798
|
_this.toSync.clear();
|
|
14771
14799
|
});
|
|
14800
|
+
var ric = (_a = runtime.globalThis.requestIdleCallback) !== null && _a !== void 0 ? _a : raf.bind(runtime.globalThis);
|
|
14772
14801
|
renderingService.hooks.endFrame.tap(PrepareRendererPlugin.tag, function () {
|
|
14773
|
-
|
|
14774
|
-
|
|
14775
|
-
|
|
14776
|
-
|
|
14777
|
-
|
|
14778
|
-
|
|
14779
|
-
|
|
14780
|
-
|
|
14781
|
-
|
|
14782
|
-
|
|
14783
|
-
|
|
14784
|
-
// }
|
|
14802
|
+
if (_this.isFirstTimeRendering) {
|
|
14803
|
+
_this.isFirstTimeRendering = false;
|
|
14804
|
+
_this.syncing = true;
|
|
14805
|
+
ric(function () {
|
|
14806
|
+
_this.syncRTree(true);
|
|
14807
|
+
_this.isFirstTimeRenderingFinished = true;
|
|
14808
|
+
});
|
|
14809
|
+
}
|
|
14810
|
+
else {
|
|
14811
|
+
_this.syncRTree();
|
|
14812
|
+
}
|
|
14785
14813
|
});
|
|
14786
14814
|
};
|
|
14787
|
-
PrepareRendererPlugin.prototype.syncRTree = function () {
|
|
14788
|
-
// if (this.syncing) {
|
|
14789
|
-
// return;
|
|
14790
|
-
// }
|
|
14815
|
+
PrepareRendererPlugin.prototype.syncRTree = function (force) {
|
|
14791
14816
|
var _this = this;
|
|
14817
|
+
if (force === void 0) { force = false; }
|
|
14818
|
+
if (!force && (this.syncing || this.toSync.size === 0)) {
|
|
14819
|
+
return;
|
|
14820
|
+
}
|
|
14821
|
+
this.syncing = true;
|
|
14792
14822
|
// bounds changed, need re-inserting its children
|
|
14793
14823
|
var bulk = [];
|
|
14794
14824
|
Array.from(this.toSync)
|
|
@@ -14802,6 +14832,14 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14802
14832
|
}
|
|
14803
14833
|
var renderBounds = node.getRenderBounds();
|
|
14804
14834
|
if (renderBounds) {
|
|
14835
|
+
var renderable = node.renderable;
|
|
14836
|
+
if (force) {
|
|
14837
|
+
if (!renderable.dirtyRenderBounds) {
|
|
14838
|
+
renderable.dirtyRenderBounds = new AABB();
|
|
14839
|
+
}
|
|
14840
|
+
// save last dirty aabb
|
|
14841
|
+
renderable.dirtyRenderBounds.update(renderBounds.center, renderBounds.halfExtents);
|
|
14842
|
+
}
|
|
14805
14843
|
var _a = __read(renderBounds.getMin(), 2), minX = _a[0], minY = _a[1];
|
|
14806
14844
|
var _b = __read(renderBounds.getMax(), 2), maxX = _b[0], maxY = _b[1];
|
|
14807
14845
|
if (!rBushNode.aabb) {
|
|
@@ -14828,7 +14866,7 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14828
14866
|
this.rBush.load(bulk);
|
|
14829
14867
|
bulk.length = 0;
|
|
14830
14868
|
this.toSync.clear();
|
|
14831
|
-
|
|
14869
|
+
this.syncing = false;
|
|
14832
14870
|
};
|
|
14833
14871
|
PrepareRendererPlugin.tag = 'Prepare';
|
|
14834
14872
|
return PrepareRendererPlugin;
|
|
@@ -14981,10 +15019,20 @@ var Canvas = /** @class */ (function (_super) {
|
|
|
14981
15019
|
// redraw when camera changed
|
|
14982
15020
|
camera.eventEmitter.on(CameraEvent.UPDATED, function () {
|
|
14983
15021
|
_this.context.renderingContext.renderReasons.add(RenderReason.CAMERA_CHANGED);
|
|
15022
|
+
if (runtime.enableSizeAttenuation &&
|
|
15023
|
+
_this.getConfig().renderer.getConfig().enableSizeAttenuation) {
|
|
15024
|
+
_this.updateSizeAttenuation();
|
|
15025
|
+
}
|
|
14984
15026
|
});
|
|
14985
15027
|
// bind camera
|
|
14986
15028
|
this.context.camera = camera;
|
|
14987
15029
|
};
|
|
15030
|
+
Canvas.prototype.updateSizeAttenuation = function () {
|
|
15031
|
+
var zoom = this.getCamera().getZoom();
|
|
15032
|
+
this.document.documentElement.forEach(function (node) {
|
|
15033
|
+
runtime.styleValueRegistry.updateSizeAttenuation(node, zoom);
|
|
15034
|
+
});
|
|
15035
|
+
};
|
|
14988
15036
|
Canvas.prototype.getConfig = function () {
|
|
14989
15037
|
return this.context.config;
|
|
14990
15038
|
};
|