@antv/g-lite 1.3.0-next.11 → 1.3.0-next.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/parser/path.d.ts +2 -2
- package/dist/css/properties/CSSPropertyPath.d.ts +2 -2
- package/dist/display-objects/DisplayObject.d.ts +0 -10
- 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/Rect.d.ts +1 -1
- package/dist/index.esm.js +103 -128
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +103 -128
- 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 +1 -0
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4241,10 +4241,10 @@ function mergeNumberLists(left, right) {
|
|
|
4241
4241
|
}
|
|
4242
4242
|
|
|
4243
4243
|
function getOrCalculatePathTotalLength(path) {
|
|
4244
|
-
if (path.parsedStyle.
|
|
4245
|
-
path.parsedStyle.
|
|
4244
|
+
if (path.parsedStyle.d.totalLength === 0) {
|
|
4245
|
+
path.parsedStyle.d.totalLength = util.getTotalLength(path.parsedStyle.d.absolutePath);
|
|
4246
4246
|
}
|
|
4247
|
-
return path.parsedStyle.
|
|
4247
|
+
return path.parsedStyle.d.totalLength;
|
|
4248
4248
|
}
|
|
4249
4249
|
function removeRedundantMCommand(path) {
|
|
4250
4250
|
for (var i = 0; i < path.length; i++) {
|
|
@@ -4954,7 +4954,7 @@ function convertToPath(object, transform) {
|
|
|
4954
4954
|
}));
|
|
4955
4955
|
break;
|
|
4956
4956
|
case exports.Shape.PATH:
|
|
4957
|
-
var absolutePath = object.parsedStyle.
|
|
4957
|
+
var absolutePath = object.parsedStyle.d.absolutePath;
|
|
4958
4958
|
commands = tslib.__spreadArray([], tslib.__read(absolutePath), false);
|
|
4959
4959
|
break;
|
|
4960
4960
|
}
|
|
@@ -6394,11 +6394,10 @@ var BUILT_IN_PROPERTIES = [
|
|
|
6394
6394
|
},
|
|
6395
6395
|
// Path
|
|
6396
6396
|
{
|
|
6397
|
-
n: '
|
|
6397
|
+
n: 'd',
|
|
6398
6398
|
int: true,
|
|
6399
6399
|
l: true,
|
|
6400
6400
|
d: '',
|
|
6401
|
-
a: ['d'],
|
|
6402
6401
|
syntax: exports.PropertySyntax.PATH,
|
|
6403
6402
|
p: 50,
|
|
6404
6403
|
},
|
|
@@ -6565,7 +6564,7 @@ var BUILT_IN_PROPERTIES = [
|
|
|
6565
6564
|
d: '0',
|
|
6566
6565
|
},
|
|
6567
6566
|
];
|
|
6568
|
-
BUILT_IN_PROPERTIES.filter(function (n) { return !!n.l; }).map(function (n) { return n.n; });
|
|
6567
|
+
var GEOMETRY_ATTRIBUTE_NAMES = BUILT_IN_PROPERTIES.filter(function (n) { return !!n.l; }).map(function (n) { return n.n; });
|
|
6569
6568
|
var propertyMetadataCache = {};
|
|
6570
6569
|
var unresolvedProperties = new WeakMap();
|
|
6571
6570
|
// const uniqueAttributeSet = new Set<string>();
|
|
@@ -6628,14 +6627,14 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6628
6627
|
var oldOffsetPath = object.parsedStyle.offsetPath;
|
|
6629
6628
|
object.parsedStyle = Object.assign(object.parsedStyle, attributes);
|
|
6630
6629
|
var needUpdateGeometry = !!options.forceUpdateGeometry;
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6630
|
+
if (!needUpdateGeometry) {
|
|
6631
|
+
for (var i = 0; i < GEOMETRY_ATTRIBUTE_NAMES.length; i++) {
|
|
6632
|
+
if (GEOMETRY_ATTRIBUTE_NAMES[i] in attributes) {
|
|
6633
|
+
needUpdateGeometry = true;
|
|
6634
|
+
break;
|
|
6635
|
+
}
|
|
6636
|
+
}
|
|
6637
|
+
}
|
|
6639
6638
|
if (attributes.fill) {
|
|
6640
6639
|
object.parsedStyle.fill = parseColor(attributes.fill);
|
|
6641
6640
|
}
|
|
@@ -6667,14 +6666,14 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6667
6666
|
}
|
|
6668
6667
|
// Path
|
|
6669
6668
|
// @ts-ignore
|
|
6670
|
-
if (attributes.
|
|
6671
|
-
object.parsedStyle.
|
|
6669
|
+
if (attributes.d === '') {
|
|
6670
|
+
object.parsedStyle.d = tslib.__assign({}, EMPTY_PARSED_PATH);
|
|
6672
6671
|
}
|
|
6673
6672
|
// @ts-ignore
|
|
6674
|
-
if (attributes.
|
|
6675
|
-
object.parsedStyle.
|
|
6673
|
+
if (attributes.d) {
|
|
6674
|
+
object.parsedStyle.d = parsePath(
|
|
6676
6675
|
// @ts-ignore
|
|
6677
|
-
attributes.
|
|
6676
|
+
attributes.d);
|
|
6678
6677
|
}
|
|
6679
6678
|
// Text
|
|
6680
6679
|
if (attributes.textTransform) {
|
|
@@ -6726,10 +6725,13 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6726
6725
|
if (attributes.transform) {
|
|
6727
6726
|
this.runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object, attributeNames);
|
|
6728
6727
|
}
|
|
6728
|
+
if (attributes.transformOrigin) {
|
|
6729
|
+
this.runtime.CSSPropertySyntaxFactory['<transform-origin>'].postProcessor(object, attributeNames);
|
|
6730
|
+
}
|
|
6729
6731
|
if (needUpdateGeometry) {
|
|
6730
6732
|
object.geometry.dirty = true;
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
+
object.renderable.boundsDirty = true;
|
|
6734
|
+
object.renderable.renderBoundsDirty = true;
|
|
6733
6735
|
}
|
|
6734
6736
|
}
|
|
6735
6737
|
else {
|
|
@@ -6789,8 +6791,8 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6789
6791
|
// update geometry
|
|
6790
6792
|
if (needUpdateGeometry_1) {
|
|
6791
6793
|
object.geometry.dirty = true;
|
|
6792
|
-
|
|
6793
|
-
|
|
6794
|
+
object.renderable.boundsDirty = true;
|
|
6795
|
+
object.renderable.renderBoundsDirty = true;
|
|
6794
6796
|
}
|
|
6795
6797
|
attributeNames_1.forEach(function (name) {
|
|
6796
6798
|
if (name in object.parsedStyle) {
|
|
@@ -7002,11 +7004,15 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
7002
7004
|
// depth / 2,
|
|
7003
7005
|
// );
|
|
7004
7006
|
// anchor is center by default, don't account for lineWidth here
|
|
7005
|
-
var _h = parsedStyle, stroke = _h.stroke,
|
|
7007
|
+
var _h = parsedStyle, stroke = _h.stroke, _j = _h.lineWidth, lineWidth = _j === void 0 ? 1 : _j,
|
|
7008
|
+
// lineCap,
|
|
7009
|
+
// lineJoin,
|
|
7010
|
+
// miterLimit,
|
|
7011
|
+
_k = _h.increasedLineWidthForHitTesting,
|
|
7006
7012
|
// lineCap,
|
|
7007
7013
|
// lineJoin,
|
|
7008
7014
|
// miterLimit,
|
|
7009
|
-
increasedLineWidthForHitTesting =
|
|
7015
|
+
increasedLineWidthForHitTesting = _k === void 0 ? 0 : _k, shadowType = _h.shadowType, shadowColor = _h.shadowColor, _l = _h.filter, filter = _l === void 0 ? [] : _l, transformOrigin = _h.transformOrigin;
|
|
7010
7016
|
var center = [cx, cy, cz];
|
|
7011
7017
|
// update geometry's AABB
|
|
7012
7018
|
geometry_1.contentBounds.update(center, halfExtents);
|
|
@@ -7040,8 +7046,8 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
7040
7046
|
geometry_1.renderBounds.update(center, halfExtents);
|
|
7041
7047
|
// account for shadow, only support constant value now
|
|
7042
7048
|
if (shadowColor && shadowType && shadowType !== 'inner') {
|
|
7043
|
-
var
|
|
7044
|
-
var
|
|
7049
|
+
var _m = geometry_1.renderBounds, min = _m.min, max = _m.max;
|
|
7050
|
+
var _o = parsedStyle, shadowBlur = _o.shadowBlur, shadowOffsetX = _o.shadowOffsetX, shadowOffsetY = _o.shadowOffsetY;
|
|
7045
7051
|
var shadowBlurInPixels = shadowBlur || 0;
|
|
7046
7052
|
var shadowOffsetXInPixels = shadowOffsetX || 0;
|
|
7047
7053
|
var shadowOffsetYInPixels = shadowOffsetY || 0;
|
|
@@ -7412,6 +7418,7 @@ var CSSPropertyPath = /** @class */ (function () {
|
|
|
7412
7418
|
rect: new Rectangle(0, 0, 0, 0),
|
|
7413
7419
|
};
|
|
7414
7420
|
}
|
|
7421
|
+
console.log('parsed', parsed);
|
|
7415
7422
|
return parsed;
|
|
7416
7423
|
};
|
|
7417
7424
|
return CSSPropertyPath;
|
|
@@ -7811,7 +7818,7 @@ var genericFontFamilies = [
|
|
|
7811
7818
|
];
|
|
7812
7819
|
var stringRegExp = /([\"\'])[^\'\"]+\1/;
|
|
7813
7820
|
function toFontString(attributes) {
|
|
7814
|
-
var
|
|
7821
|
+
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;
|
|
7815
7822
|
// build canvas api font setting from individual components. Convert a numeric this.fontSize to px
|
|
7816
7823
|
// const fontSizeString: string = isNumber(fontSize) ? `${fontSize}px` : fontSize.toString();
|
|
7817
7824
|
var fontSizeString = (util.isNumber(fontSize) && "".concat(fontSize, "px")) || '16px';
|
|
@@ -8107,8 +8114,8 @@ var PathUpdater = /** @class */ (function () {
|
|
|
8107
8114
|
function PathUpdater() {
|
|
8108
8115
|
}
|
|
8109
8116
|
PathUpdater.prototype.update = function (parsedStyle) {
|
|
8110
|
-
var
|
|
8111
|
-
var _a =
|
|
8117
|
+
var d = parsedStyle.d;
|
|
8118
|
+
var _a = d.rect, x = _a.x, y = _a.y, width = _a.width, height = _a.height;
|
|
8112
8119
|
var hwidth = width / 2;
|
|
8113
8120
|
var hheight = height / 2;
|
|
8114
8121
|
return {
|
|
@@ -8157,17 +8164,17 @@ var RectUpdater = /** @class */ (function () {
|
|
|
8157
8164
|
function RectUpdater() {
|
|
8158
8165
|
}
|
|
8159
8166
|
RectUpdater.prototype.update = function (parsedStyle, object) {
|
|
8160
|
-
var _a = parsedStyle.x, x = _a === void 0 ? 0 : _a, _b = parsedStyle.y, y = _b === void 0 ? 0 : _b,
|
|
8167
|
+
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;
|
|
8161
8168
|
var contentWidth = width;
|
|
8162
8169
|
var contentHeight = height;
|
|
8163
8170
|
// resize with HTMLImageElement's size
|
|
8164
|
-
if (
|
|
8171
|
+
if (src && !util.isString(src)) {
|
|
8165
8172
|
if (!contentWidth) {
|
|
8166
|
-
contentWidth =
|
|
8173
|
+
contentWidth = src.width;
|
|
8167
8174
|
parsedStyle.width = contentWidth;
|
|
8168
8175
|
}
|
|
8169
8176
|
if (!contentHeight) {
|
|
8170
|
-
contentHeight =
|
|
8177
|
+
contentHeight = src.height;
|
|
8171
8178
|
parsedStyle.height = contentHeight;
|
|
8172
8179
|
}
|
|
8173
8180
|
}
|
|
@@ -8187,18 +8194,20 @@ var TextUpdater = /** @class */ (function () {
|
|
|
8187
8194
|
}
|
|
8188
8195
|
TextUpdater.prototype.isReadyToMeasure = function (parsedStyle, object) {
|
|
8189
8196
|
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;
|
|
8190
|
-
return
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
|
|
8195
|
-
|
|
8196
|
-
|
|
8197
|
-
|
|
8197
|
+
return runtime.enableCSSParsing
|
|
8198
|
+
? text &&
|
|
8199
|
+
fontSize &&
|
|
8200
|
+
fontStyle &&
|
|
8201
|
+
fontWeight &&
|
|
8202
|
+
fontVariant &&
|
|
8203
|
+
textAlign &&
|
|
8204
|
+
textBaseline &&
|
|
8205
|
+
!util.isNil(lineWidth)
|
|
8206
|
+
: text;
|
|
8198
8207
|
};
|
|
8199
8208
|
TextUpdater.prototype.update = function (parsedStyle, object) {
|
|
8200
8209
|
var _a, _b;
|
|
8201
|
-
var text = parsedStyle.text,
|
|
8210
|
+
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;
|
|
8202
8211
|
if (!this.isReadyToMeasure(parsedStyle, object)) {
|
|
8203
8212
|
parsedStyle.metrics = {
|
|
8204
8213
|
font: '',
|
|
@@ -10062,7 +10071,7 @@ var RenderingService = /** @class */ (function () {
|
|
|
10062
10071
|
this.zIndexCounter = 0;
|
|
10063
10072
|
var renderingContext = this.context.renderingContext;
|
|
10064
10073
|
this.globalRuntime.sceneGraphService.syncHierarchy(renderingContext.root);
|
|
10065
|
-
|
|
10074
|
+
this.globalRuntime.sceneGraphService.triggerPendingEvents();
|
|
10066
10075
|
if (renderingContext.renderReasons.size && this.inited) {
|
|
10067
10076
|
// @ts-ignore
|
|
10068
10077
|
renderingContext.dirtyRectangleRenderingDisabled =
|
|
@@ -11298,13 +11307,13 @@ var TextService = /** @class */ (function () {
|
|
|
11298
11307
|
return properties;
|
|
11299
11308
|
};
|
|
11300
11309
|
TextService.prototype.measureText = function (text, parsedStyle, offscreenCanvas) {
|
|
11301
|
-
var
|
|
11310
|
+
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;
|
|
11302
11311
|
var // dropShadow = 0,
|
|
11303
11312
|
// dropShadowDistance = 0,
|
|
11304
|
-
|
|
11313
|
+
_g = parsedStyle.leading,
|
|
11305
11314
|
// dropShadow = 0,
|
|
11306
11315
|
// dropShadowDistance = 0,
|
|
11307
|
-
leading =
|
|
11316
|
+
leading = _g === void 0 ? 0 : _g;
|
|
11308
11317
|
var font = toFontString(parsedStyle);
|
|
11309
11318
|
// if (runtime.enableCSSParsing) {
|
|
11310
11319
|
var fontProperties = this.measureFont(font, offscreenCanvas);
|
|
@@ -11416,7 +11425,7 @@ var TextService = /** @class */ (function () {
|
|
|
11416
11425
|
TextService.prototype.setGraphemeOnPath = function () { };
|
|
11417
11426
|
TextService.prototype.wordWrap = function (text, parsedStyle, offscreenCanvas) {
|
|
11418
11427
|
var _this = this;
|
|
11419
|
-
var _a = parsedStyle.wordWrapWidth, wordWrapWidth = _a === void 0 ? 0 : _a,
|
|
11428
|
+
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;
|
|
11420
11429
|
var context = this.runtime.offscreenCanvasCreator.getOrCreateContext(offscreenCanvas);
|
|
11421
11430
|
var maxWidth = wordWrapWidth + letterSpacing;
|
|
11422
11431
|
var ellipsis = '';
|
|
@@ -12236,6 +12245,9 @@ var Element = /** @class */ (function (_super) {
|
|
|
12236
12245
|
function isDisplayObject(value) {
|
|
12237
12246
|
return !!(value === null || value === void 0 ? void 0 : value.nodeName);
|
|
12238
12247
|
}
|
|
12248
|
+
var Proxy = runtime.globalThis.Proxy
|
|
12249
|
+
? runtime.globalThis.Proxy
|
|
12250
|
+
: function () { };
|
|
12239
12251
|
var mutationEvent = new MutationEvent(exports.ElementEvent.ATTR_MODIFIED, null, null, null, null, MutationEvent.MODIFICATION, null, null);
|
|
12240
12252
|
var DEFAULT_STYLE_PROPS = {
|
|
12241
12253
|
opacity: '',
|
|
@@ -12272,20 +12284,7 @@ var DEFAULT_PARSED_STYLE_PROPS = {
|
|
|
12272
12284
|
shadowType: 'outer',
|
|
12273
12285
|
miterLimit: 10,
|
|
12274
12286
|
};
|
|
12275
|
-
|
|
12276
|
-
// ...DEFAULT_PARSED_STYLE_PROPS,
|
|
12277
|
-
// opacity: 1,
|
|
12278
|
-
// fillOpacity: 1,
|
|
12279
|
-
// strokeOpacity: 1,
|
|
12280
|
-
// visibility: 'visible',
|
|
12281
|
-
// pointerEvents: 'auto',
|
|
12282
|
-
// lineWidth: 1,
|
|
12283
|
-
// lineCap: 'butt',
|
|
12284
|
-
// lineJoin: 'miter',
|
|
12285
|
-
// increasedLineWidthForHitTesting: 0,
|
|
12286
|
-
// fillRule: 'nonzero',
|
|
12287
|
-
// // TODO: transformOrigin
|
|
12288
|
-
// };
|
|
12287
|
+
tslib.__assign(tslib.__assign({}, DEFAULT_PARSED_STYLE_PROPS), { opacity: 1, fillOpacity: 1, strokeOpacity: 1, visibility: 'visible', pointerEvents: 'auto', lineWidth: 1, lineCap: 'butt', lineJoin: 'miter', increasedLineWidthForHitTesting: 0, fillRule: 'nonzero' });
|
|
12289
12288
|
var INHERITABLE_BASE_STYLE_PROPS = [
|
|
12290
12289
|
'opacity',
|
|
12291
12290
|
'fillOpacity',
|
|
@@ -12337,13 +12336,6 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12337
12336
|
* push to active animations after calling `animate()`
|
|
12338
12337
|
*/
|
|
12339
12338
|
_this.activeAnimations = [];
|
|
12340
|
-
/**
|
|
12341
|
-
* Use `this.style.clipPath` instead.
|
|
12342
|
-
* @deprecated
|
|
12343
|
-
*/
|
|
12344
|
-
_this.getClip = function () {
|
|
12345
|
-
return this.style.clipPath || null;
|
|
12346
|
-
};
|
|
12347
12339
|
// assign name, id to config
|
|
12348
12340
|
// eg. group.get('name')
|
|
12349
12341
|
_this.config = config;
|
|
@@ -12358,11 +12350,13 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12358
12350
|
Object.assign(_this.attributes, DEFAULT_STYLE_PROPS);
|
|
12359
12351
|
Object.assign(_this.parsedStyle, DEFAULT_PARSED_STYLE_PROPS, _this.config.initialParsedStyle);
|
|
12360
12352
|
}
|
|
12353
|
+
else if (_this.config.initialParsedStyle) {
|
|
12354
|
+
Object.assign(_this.parsedStyle,
|
|
12355
|
+
// DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED,
|
|
12356
|
+
_this.config.initialParsedStyle);
|
|
12357
|
+
}
|
|
12361
12358
|
// start to process attributes
|
|
12362
12359
|
_this.initAttributes(_this.config.style);
|
|
12363
|
-
var Proxy = runtime.globalThis.Proxy
|
|
12364
|
-
? runtime.globalThis.Proxy
|
|
12365
|
-
: function () { };
|
|
12366
12360
|
if (runtime.enableDataset) {
|
|
12367
12361
|
_this.dataset = new Proxy({}, {
|
|
12368
12362
|
get: function (target, name) {
|
|
@@ -12954,13 +12948,6 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12954
12948
|
DisplayObject.prototype.add = function (child, index) {
|
|
12955
12949
|
return this.appendChild(child, index);
|
|
12956
12950
|
};
|
|
12957
|
-
/**
|
|
12958
|
-
* Use `this.style.clipPath` instead.
|
|
12959
|
-
* @deprecated
|
|
12960
|
-
*/
|
|
12961
|
-
DisplayObject.prototype.setClip = function (clipPath) {
|
|
12962
|
-
this.style.clipPath = clipPath;
|
|
12963
|
-
};
|
|
12964
12951
|
/**
|
|
12965
12952
|
* @deprecated
|
|
12966
12953
|
*/
|
|
@@ -13061,11 +13048,11 @@ var Ellipse = /** @class */ (function (_super) {
|
|
|
13061
13048
|
*/
|
|
13062
13049
|
var Group = /** @class */ (function (_super) {
|
|
13063
13050
|
tslib.__extends(Group, _super);
|
|
13064
|
-
function Group(
|
|
13065
|
-
if (
|
|
13066
|
-
var
|
|
13067
|
-
|
|
13068
|
-
|
|
13051
|
+
function Group(options) {
|
|
13052
|
+
if (options === void 0) { options = {}; }
|
|
13053
|
+
var _this = _super.call(this, options) || this;
|
|
13054
|
+
_this.nodeName = exports.Shape.GROUP;
|
|
13055
|
+
return _this;
|
|
13069
13056
|
}
|
|
13070
13057
|
return Group;
|
|
13071
13058
|
}(DisplayObject));
|
|
@@ -13138,11 +13125,11 @@ var HTML = /** @class */ (function (_super) {
|
|
|
13138
13125
|
|
|
13139
13126
|
var Image = /** @class */ (function (_super) {
|
|
13140
13127
|
tslib.__extends(Image, _super);
|
|
13141
|
-
function Image(
|
|
13142
|
-
if (
|
|
13143
|
-
var
|
|
13144
|
-
|
|
13145
|
-
|
|
13128
|
+
function Image(options) {
|
|
13129
|
+
if (options === void 0) { options = {}; }
|
|
13130
|
+
var _this = _super.call(this, options) || this;
|
|
13131
|
+
_this.nodeName = exports.Shape.IMAGE;
|
|
13132
|
+
return _this;
|
|
13146
13133
|
}
|
|
13147
13134
|
return Image;
|
|
13148
13135
|
}(DisplayObject));
|
|
@@ -13271,11 +13258,11 @@ var Path = /** @class */ (function (_super) {
|
|
|
13271
13258
|
var _this = this;
|
|
13272
13259
|
var style = _a.style, rest = tslib.__rest(_a, ["style"]);
|
|
13273
13260
|
_this = _super.call(this, tslib.__assign({ type: exports.Shape.PATH, style: runtime.enableCSSParsing
|
|
13274
|
-
? tslib.__assign({
|
|
13261
|
+
? tslib.__assign({ d: '', miterLimit: '' }, style) : tslib.__assign({}, style), initialParsedStyle: runtime.enableCSSParsing
|
|
13275
13262
|
? null
|
|
13276
13263
|
: {
|
|
13277
13264
|
miterLimit: 4,
|
|
13278
|
-
|
|
13265
|
+
d: tslib.__assign({}, EMPTY_PARSED_PATH),
|
|
13279
13266
|
} }, rest)) || this;
|
|
13280
13267
|
_this.markerStartAngle = 0;
|
|
13281
13268
|
_this.markerEndAngle = 0;
|
|
@@ -13300,7 +13287,7 @@ var Path = /** @class */ (function (_super) {
|
|
|
13300
13287
|
return _this;
|
|
13301
13288
|
}
|
|
13302
13289
|
Path.prototype.attributeChangedCallback = function (attrName, oldValue, newValue, prevParsedValue, newParsedValue) {
|
|
13303
|
-
if (attrName === '
|
|
13290
|
+
if (attrName === 'd') {
|
|
13304
13291
|
// recalc markers
|
|
13305
13292
|
this.transformMarker(true);
|
|
13306
13293
|
this.transformMarker(false);
|
|
@@ -13375,7 +13362,7 @@ var Path = /** @class */ (function (_super) {
|
|
|
13375
13362
|
marker.setLocalPosition(ox + Math.cos(rad) * offset, oy + Math.sin(rad) * offset);
|
|
13376
13363
|
};
|
|
13377
13364
|
Path.prototype.placeMarkerMid = function (marker) {
|
|
13378
|
-
var segments = this.parsedStyle.
|
|
13365
|
+
var segments = this.parsedStyle.d.segments;
|
|
13379
13366
|
// clear all existed markers
|
|
13380
13367
|
this.markerMidList.forEach(function (marker) {
|
|
13381
13368
|
marker.remove();
|
|
@@ -13404,7 +13391,7 @@ var Path = /** @class */ (function (_super) {
|
|
|
13404
13391
|
*/
|
|
13405
13392
|
Path.prototype.getPointAtLength = function (distance, inWorldSpace) {
|
|
13406
13393
|
if (inWorldSpace === void 0) { inWorldSpace = false; }
|
|
13407
|
-
var absolutePath = this.parsedStyle.
|
|
13394
|
+
var absolutePath = this.parsedStyle.d.absolutePath;
|
|
13408
13395
|
var _a = util.getPointAtLength(absolutePath, distance), x = _a.x, y = _a.y;
|
|
13409
13396
|
var transformed = glMatrix.vec3.transformMat4(glMatrix.vec3.create(), glMatrix.vec3.fromValues(x, y, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform());
|
|
13410
13397
|
// apply local transformation
|
|
@@ -13421,7 +13408,7 @@ var Path = /** @class */ (function (_super) {
|
|
|
13421
13408
|
* Get start tangent vector
|
|
13422
13409
|
*/
|
|
13423
13410
|
Path.prototype.getStartTangent = function () {
|
|
13424
|
-
var segments = this.parsedStyle.
|
|
13411
|
+
var segments = this.parsedStyle.d.segments;
|
|
13425
13412
|
var result = [];
|
|
13426
13413
|
if (segments.length > 1) {
|
|
13427
13414
|
var startPoint = segments[0].currentPoint;
|
|
@@ -13443,7 +13430,7 @@ var Path = /** @class */ (function (_super) {
|
|
|
13443
13430
|
* Get end tangent vector
|
|
13444
13431
|
*/
|
|
13445
13432
|
Path.prototype.getEndTangent = function () {
|
|
13446
|
-
var segments = this.parsedStyle.
|
|
13433
|
+
var segments = this.parsedStyle.d.segments;
|
|
13447
13434
|
var length = segments.length;
|
|
13448
13435
|
var result = [];
|
|
13449
13436
|
if (length > 1) {
|
|
@@ -13673,11 +13660,11 @@ var Polyline = /** @class */ (function (_super) {
|
|
|
13673
13660
|
|
|
13674
13661
|
var Rect = /** @class */ (function (_super) {
|
|
13675
13662
|
tslib.__extends(Rect, _super);
|
|
13676
|
-
function Rect(
|
|
13677
|
-
if (
|
|
13678
|
-
var
|
|
13679
|
-
|
|
13680
|
-
|
|
13663
|
+
function Rect(options) {
|
|
13664
|
+
if (options === void 0) { options = {}; }
|
|
13665
|
+
var _this = _super.call(this, options) || this;
|
|
13666
|
+
_this.nodeName = exports.Shape.RECT;
|
|
13667
|
+
return _this;
|
|
13681
13668
|
}
|
|
13682
13669
|
return Rect;
|
|
13683
13670
|
}(DisplayObject));
|
|
@@ -13699,26 +13686,7 @@ var Text = /** @class */ (function (_super) {
|
|
|
13699
13686
|
return _super.call(this, tslib.__assign({ type: exports.Shape.TEXT, style: runtime.enableCSSParsing
|
|
13700
13687
|
? tslib.__assign({ x: '', y: '', text: '', fontSize: '', fontFamily: '', fontStyle: '', fontWeight: '', fontVariant: '', textAlign: '', textBaseline: '', textTransform: '', fill: 'black', letterSpacing: '', lineHeight: '', miterLimit: '',
|
|
13701
13688
|
// whiteSpace: 'pre',
|
|
13702
|
-
wordWrap: false, wordWrapWidth: 0, leading: 0, dx: '', dy: '' }, style) : tslib.__assign({ fill: 'black' }, style),
|
|
13703
|
-
? {}
|
|
13704
|
-
: {
|
|
13705
|
-
x: 0,
|
|
13706
|
-
y: 0,
|
|
13707
|
-
fontSize: 16,
|
|
13708
|
-
fontFamily: 'sans-serif',
|
|
13709
|
-
fontStyle: 'normal',
|
|
13710
|
-
fontWeight: 'normal',
|
|
13711
|
-
fontVariant: 'normal',
|
|
13712
|
-
lineHeight: 0,
|
|
13713
|
-
letterSpacing: 0,
|
|
13714
|
-
textBaseline: 'alphabetic',
|
|
13715
|
-
textAlign: 'start',
|
|
13716
|
-
wordWrap: false,
|
|
13717
|
-
wordWrapWidth: 0,
|
|
13718
|
-
leading: 0,
|
|
13719
|
-
dx: 0,
|
|
13720
|
-
dy: 0,
|
|
13721
|
-
} }, rest)) || this;
|
|
13689
|
+
wordWrap: false, wordWrapWidth: 0, leading: 0, dx: '', dy: '' }, style) : tslib.__assign({ fill: 'black' }, style) }, rest)) || this;
|
|
13722
13690
|
}
|
|
13723
13691
|
// lengthAdjust: SVGAnimatedEnumeration;
|
|
13724
13692
|
// textLength: SVGAnimatedLength;
|
|
@@ -14738,7 +14706,7 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14738
14706
|
* sync to RBush later
|
|
14739
14707
|
*/
|
|
14740
14708
|
this.toSync = new Set();
|
|
14741
|
-
|
|
14709
|
+
this.isFirstTimeRendering = true;
|
|
14742
14710
|
this.syncing = false;
|
|
14743
14711
|
}
|
|
14744
14712
|
PrepareRendererPlugin.prototype.apply = function (context) {
|
|
@@ -14802,14 +14770,22 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14802
14770
|
_this.toSync.clear();
|
|
14803
14771
|
});
|
|
14804
14772
|
renderingService.hooks.endFrame.tap(PrepareRendererPlugin.tag, function () {
|
|
14805
|
-
|
|
14773
|
+
if (_this.isFirstTimeRendering) {
|
|
14774
|
+
_this.isFirstTimeRendering = false;
|
|
14775
|
+
_this.syncing = true;
|
|
14776
|
+
requestIdleCallback(function () {
|
|
14777
|
+
_this.syncRTree(true);
|
|
14778
|
+
});
|
|
14779
|
+
}
|
|
14780
|
+
else {
|
|
14806
14781
|
_this.syncRTree();
|
|
14807
|
-
}
|
|
14782
|
+
}
|
|
14808
14783
|
});
|
|
14809
14784
|
};
|
|
14810
|
-
PrepareRendererPlugin.prototype.syncRTree = function () {
|
|
14785
|
+
PrepareRendererPlugin.prototype.syncRTree = function (force) {
|
|
14811
14786
|
var _this = this;
|
|
14812
|
-
if (
|
|
14787
|
+
if (force === void 0) { force = false; }
|
|
14788
|
+
if (!force && (this.syncing || this.toSync.size === 0)) {
|
|
14813
14789
|
return;
|
|
14814
14790
|
}
|
|
14815
14791
|
this.syncing = true;
|
|
@@ -14850,7 +14826,6 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14850
14826
|
// use bulk inserting, which is ~2-3 times faster
|
|
14851
14827
|
// @see https://github.com/mourner/rbush#bulk-inserting-data
|
|
14852
14828
|
this.rBush.load(bulk);
|
|
14853
|
-
console.log('sync...', Array.from(this.toSync));
|
|
14854
14829
|
bulk.length = 0;
|
|
14855
14830
|
this.toSync.clear();
|
|
14856
14831
|
this.syncing = false;
|