@visactor/vrender 0.17.19 → 0.17.20-alpha.2

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/index.js CHANGED
@@ -2149,15 +2149,15 @@
2149
2149
  };
2150
2150
  var isArray$1 = isArray;
2151
2151
 
2152
- var isNumber$1 = function isNumber(value) {
2152
+ var isNumber = function isNumber(value) {
2153
2153
  var fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
2154
2154
  var type = _typeof(value);
2155
2155
  return fuzzy ? "number" === type : "number" === type || isType$1(value, "Number");
2156
2156
  };
2157
- var isNumber$2 = isNumber$1;
2157
+ var isNumber$1 = isNumber;
2158
2158
 
2159
2159
  var isValidNumber = function isValidNumber(value) {
2160
- return isNumber$2(value) && Number.isFinite(value);
2160
+ return isNumber$1(value) && Number.isFinite(value);
2161
2161
  };
2162
2162
  var isValidNumber$1 = isValidNumber;
2163
2163
 
@@ -2264,12 +2264,12 @@
2264
2264
  }, {
2265
2265
  key: "add",
2266
2266
  value: function add(point) {
2267
- return isNumber$2(point) ? (this.x += point, void (this.y += point)) : (this.x += point.x, this.y += point.y, this);
2267
+ return isNumber$1(point) ? (this.x += point, void (this.y += point)) : (this.x += point.x, this.y += point.y, this);
2268
2268
  }
2269
2269
  }, {
2270
2270
  key: "sub",
2271
2271
  value: function sub(point) {
2272
- return isNumber$2(point) ? (this.x -= point, void (this.y -= point)) : (this.x -= point.x, this.y -= point.y, this);
2272
+ return isNumber$1(point) ? (this.x -= point, void (this.y -= point)) : (this.x -= point.x, this.y -= point.y, this);
2273
2273
  }
2274
2274
  }, {
2275
2275
  key: "multi",
@@ -2973,10 +2973,10 @@
2973
2973
  return ((value = Math.max(0, Math.min(255, Math.round(value) || 0))) < 16 ? "0" : "") + value.toString(16);
2974
2974
  }
2975
2975
  function rgb(value) {
2976
- return isNumber$2(value) ? new RGB(value >> 16, value >> 8 & 255, 255 & value, 1) : isArray$1(value) ? new RGB(value[0], value[1], value[2]) : new RGB(255, 255, 255);
2976
+ return isNumber$1(value) ? new RGB(value >> 16, value >> 8 & 255, 255 & value, 1) : isArray$1(value) ? new RGB(value[0], value[1], value[2]) : new RGB(255, 255, 255);
2977
2977
  }
2978
2978
  function rgba(value) {
2979
- return isNumber$2(value) ? new RGB(value >>> 24, value >>> 16 & 255, value >>> 8 & 255, 255 & value) : isArray$1(value) ? new RGB(value[0], value[1], value[2], value[3]) : new RGB(255, 255, 255, 1);
2979
+ return isNumber$1(value) ? new RGB(value >>> 24, value >>> 16 & 255, value >>> 8 & 255, 255 & value) : isArray$1(value) ? new RGB(value[0], value[1], value[2], value[3]) : new RGB(255, 255, 255, 1);
2980
2980
  }
2981
2981
  function SRGBToLinear(c) {
2982
2982
  return c < .04045 ? .0773993808 * c : Math.pow(.9478672986 * c + .0521327014, 2.4);
@@ -3657,7 +3657,7 @@
3657
3657
  }], [{
3658
3658
  key: "getInstance",
3659
3659
  value: function getInstance(level, method) {
3660
- return Logger._instance && isNumber$2(level) ? Logger._instance.level(level) : Logger._instance || (Logger._instance = new Logger(level, method)), Logger._instance;
3660
+ return Logger._instance && isNumber$1(level) ? Logger._instance.level(level) : Logger._instance || (Logger._instance = new Logger(level, method)), Logger._instance;
3661
3661
  }
3662
3662
  }, {
3663
3663
  key: "setInstance",
@@ -5797,9 +5797,6 @@
5797
5797
  function isNotAroundZero(val) {
5798
5798
  return val > EPSILON || val < -EPSILON;
5799
5799
  }
5800
- function isNumber(data) {
5801
- return "number" == typeof data && Number.isFinite(data);
5802
- }
5803
5800
  var _v0 = [0, 0],
5804
5801
  _v1 = [0, 0],
5805
5802
  _v2 = [0, 0];
@@ -6977,7 +6974,10 @@
6977
6974
  value: function removeAllChild() {
6978
6975
  if (!this._idMap) return;
6979
6976
  var child = this._firstChild;
6980
- for (; child;) child.parent = null, child._prev = null, child._next = null, child = child._next;
6977
+ for (; child;) {
6978
+ var next = child._next;
6979
+ child.parent = null, child._prev = null, child._next = null, child = next;
6980
+ }
6981
6981
  this._firstChild = null, this._lastChild = null, this._idMap.clear(), this._structEdit = !0, this.setCount(1 - this._count);
6982
6982
  }
6983
6983
  }, {
@@ -9243,7 +9243,7 @@
9243
9243
  key: "onBind",
9244
9244
  value: function onBind() {
9245
9245
  var _a, _b, _c, _d, _e, _f, _g, _h;
9246
- this.fromNumber = isNumber$2(null === (_a = this.from) || void 0 === _a ? void 0 : _a.text) ? null === (_b = this.from) || void 0 === _b ? void 0 : _b.text : Number.parseFloat(null === (_c = this.from) || void 0 === _c ? void 0 : _c.text), this.toNumber = isNumber$2(null === (_d = this.to) || void 0 === _d ? void 0 : _d.text) ? null === (_e = this.to) || void 0 === _e ? void 0 : _e.text : Number.parseFloat(null === (_f = this.to) || void 0 === _f ? void 0 : _f.text), Number.isFinite(this.toNumber) || (this.fromNumber = 0), Number.isFinite(this.toNumber) || (this.valid = !1), !1 !== this.valid && (this.decimalLength = null !== (_h = null === (_g = this.params) || void 0 === _g ? void 0 : _g.fixed) && void 0 !== _h ? _h : Math.max(getDecimalPlaces(this.fromNumber), getDecimalPlaces(this.toNumber)));
9246
+ this.fromNumber = isNumber$1(null === (_a = this.from) || void 0 === _a ? void 0 : _a.text) ? null === (_b = this.from) || void 0 === _b ? void 0 : _b.text : Number.parseFloat(null === (_c = this.from) || void 0 === _c ? void 0 : _c.text), this.toNumber = isNumber$1(null === (_d = this.to) || void 0 === _d ? void 0 : _d.text) ? null === (_e = this.to) || void 0 === _e ? void 0 : _e.text : Number.parseFloat(null === (_f = this.to) || void 0 === _f ? void 0 : _f.text), Number.isFinite(this.toNumber) || (this.fromNumber = 0), Number.isFinite(this.toNumber) || (this.valid = !1), !1 !== this.valid && (this.decimalLength = null !== (_h = null === (_g = this.params) || void 0 === _g ? void 0 : _g.fixed) && void 0 !== _h ? _h : Math.max(getDecimalPlaces(this.fromNumber), getDecimalPlaces(this.toNumber)));
9247
9247
  }
9248
9248
  }, {
9249
9249
  key: "onEnd",
@@ -10654,7 +10654,7 @@
10654
10654
  };
10655
10655
  var samplingPoints = function samplingPoints(points, count) {
10656
10656
  var validatePoints = points.filter(function (point) {
10657
- return !1 !== point.defined && isNumber$2(point.x) && isNumber$2(point.y);
10657
+ return !1 !== point.defined && isNumber$1(point.x) && isNumber$1(point.y);
10658
10658
  });
10659
10659
  if (0 === validatePoints.length) return [];
10660
10660
  if (1 === validatePoints.length) return new Array(count).fill(0).map(function (i) {
@@ -10694,7 +10694,7 @@
10694
10694
  return res.concat(null !== (_a = seg.points) && void 0 !== _a ? _a : []);
10695
10695
  }, []));
10696
10696
  var validatePoints = points.filter(function (point) {
10697
- return !1 !== point.defined && isNumber$2(point.x) && isNumber$2(point.y);
10697
+ return !1 !== point.defined && isNumber$1(point.x) && isNumber$1(point.y);
10698
10698
  });
10699
10699
  if (!validatePoints.length) return [];
10700
10700
  var allPoints = [];
@@ -11361,15 +11361,7 @@
11361
11361
  var data = ResourceLoader.cache.get(url);
11362
11362
  data ? "fail" === data.loadState ? application.global.getRequestAnimationFrame()(function () {
11363
11363
  mark.imageLoadFail(url);
11364
- }) : "init" === data.loadState || "loading" === data.loadState ? null === (_a = data.waitingMark) || void 0 === _a || _a.push(mark) : mark && mark.imageLoadSuccess(url, data.data) : (data = {
11365
- type: "image",
11366
- loadState: "init"
11367
- }, ResourceLoader.cache.set(url, data), data.dataPromise = application.global.loadImage(url), data.dataPromise ? (data.waitingMark = [mark], data.dataPromise.then(function (res) {
11368
- var _a;
11369
- data.loadState = (null == res ? void 0 : res.data) ? "success" : "fail", data.data = null == res ? void 0 : res.data, null === (_a = data.waitingMark) || void 0 === _a || _a.map(function (mark, index) {
11370
- (null == res ? void 0 : res.data) ? (data.loadState = "success", data.data = res.data, mark.imageLoadSuccess(url, res.data)) : (data.loadState = "fail", mark.imageLoadFail(url));
11371
- });
11372
- })) : (data.loadState = "fail", mark.imageLoadFail(url)));
11364
+ }) : "init" === data.loadState || "loading" === data.loadState ? null === (_a = data.waitingMark) || void 0 === _a || _a.push(mark) : mark && mark.imageLoadSuccess(url, data.data) : ResourceLoader.loadImage(url, mark);
11373
11365
  }
11374
11366
  }, {
11375
11367
  key: "GetSvg",
@@ -11403,10 +11395,68 @@
11403
11395
  return data.data;
11404
11396
  }));
11405
11397
  }
11398
+ }, {
11399
+ key: "loading",
11400
+ value: function loading() {
11401
+ setTimeout(function () {
11402
+ if (!ResourceLoader.isLoading && ResourceLoader.toLoadAueue.length) {
11403
+ ResourceLoader.isLoading = !0;
11404
+ var tasks = ResourceLoader.toLoadAueue.splice(0, 10),
11405
+ promises = [];
11406
+ tasks.forEach(function (task) {
11407
+ var url = task.url,
11408
+ marks = task.marks,
11409
+ data = {
11410
+ type: "image",
11411
+ loadState: "init"
11412
+ };
11413
+ if (ResourceLoader.cache.set(url, data), data.dataPromise = application.global.loadImage(url), data.dataPromise) {
11414
+ data.waitingMark = marks;
11415
+ var end = data.dataPromise.then(function (res) {
11416
+ var _a;
11417
+ data.loadState = (null == res ? void 0 : res.data) ? "success" : "fail", data.data = null == res ? void 0 : res.data, null === (_a = data.waitingMark) || void 0 === _a || _a.map(function (mark, index) {
11418
+ (null == res ? void 0 : res.data) ? (data.loadState = "success", data.data = res.data, mark.imageLoadSuccess(url, res.data)) : (data.loadState = "fail", mark.imageLoadFail(url));
11419
+ });
11420
+ });
11421
+ promises.push(end);
11422
+ } else data.loadState = "fail", marks.forEach(function (mark) {
11423
+ return mark.imageLoadFail(url);
11424
+ });
11425
+ }), Promise.all(promises).then(function () {
11426
+ ResourceLoader.isLoading = !1, ResourceLoader.loading();
11427
+ })["catch"](function (error) {
11428
+ console.error(error), ResourceLoader.isLoading = !1, ResourceLoader.loading();
11429
+ });
11430
+ }
11431
+ }, 0);
11432
+ }
11433
+ }, {
11434
+ key: "loadImage",
11435
+ value: function loadImage(url, mark) {
11436
+ var index = getIndex(url, ResourceLoader.toLoadAueue);
11437
+ if (-1 !== index) return ResourceLoader.toLoadAueue[index].marks.push(mark), void ResourceLoader.loading();
11438
+ ResourceLoader.toLoadAueue.push({
11439
+ url: url,
11440
+ marks: [mark]
11441
+ }), ResourceLoader.loading();
11442
+ }
11443
+ }, {
11444
+ key: "improveImageLoading",
11445
+ value: function improveImageLoading(url) {
11446
+ var index = getIndex(url, ResourceLoader.toLoadAueue);
11447
+ if (-1 !== index) {
11448
+ var elememt = ResourceLoader.toLoadAueue.splice(index, 1);
11449
+ ResourceLoader.toLoadAueue.unshift(elememt[0]);
11450
+ }
11451
+ }
11406
11452
  }]);
11407
11453
  return ResourceLoader;
11408
11454
  }();
11409
- ResourceLoader.cache = new Map();
11455
+ function getIndex(url, arr) {
11456
+ for (var i = 0; i < arr.length; i++) if (arr[i].url === url) return i;
11457
+ return -1;
11458
+ }
11459
+ ResourceLoader.cache = new Map(), ResourceLoader.isLoading = !1, ResourceLoader.toLoadAueue = [];
11410
11460
 
11411
11461
  var tempMatrix = new Matrix(),
11412
11462
  tempBounds$1 = new AABBBounds();
@@ -11524,7 +11574,7 @@
11524
11574
  if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
11525
11575
  application.graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
11526
11576
  var bounds = this.doUpdateAABBBounds(full);
11527
- return this.addUpdateLayoutTag(), application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), bounds;
11577
+ return application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), bounds;
11528
11578
  }
11529
11579
  }, {
11530
11580
  key: "combindShadowAABBBounds",
@@ -12192,7 +12242,7 @@
12192
12242
  data: "init",
12193
12243
  state: null
12194
12244
  };
12195
- this.resources.set(url, cache), "string" == typeof image ? (cache.state = "loading", image.startsWith("<svg") ? (ResourceLoader.GetSvg(image, this), this.backgroundImg = this.backgroundImg || background) : (isValidUrl$1(image) || image.includes("/") || isBase64$1(image)) && (ResourceLoader.GetImage(image, this), this.backgroundImg = this.backgroundImg || background)) : (cache.state = "success", cache.data = image, this.backgroundImg = this.backgroundImg || background);
12245
+ this.resources.set(url, cache), "string" == typeof image ? (cache.state = "loading", image.startsWith("<svg") ? (ResourceLoader.GetSvg(image, this), this.backgroundImg = this.backgroundImg || background) : (isValidUrl$1(image) || image.includes("/") || isBase64$1(image)) && (ResourceLoader.GetImage(image, this), this.backgroundImg = this.backgroundImg || background)) : isObject$1(image) ? (cache.state = "success", cache.data = image, this.backgroundImg = this.backgroundImg || background) : cache.state = "fail";
12196
12246
  }
12197
12247
  }, {
12198
12248
  key: "imageLoadSuccess",
@@ -14510,7 +14560,7 @@
14510
14560
  _createClass(BaseSymbol, [{
14511
14561
  key: "bounds",
14512
14562
  value: function bounds(size, _bounds) {
14513
- if (isNumber$2(size)) {
14563
+ if (isNumber$1(size)) {
14514
14564
  var halfS = size / 2;
14515
14565
  _bounds.x1 = -halfS, _bounds.x2 = halfS, _bounds.y1 = -halfS, _bounds.y2 = halfS;
14516
14566
  } else _bounds.x1 = -size[0] / 2, _bounds.x2 = size[0] / 2, _bounds.y1 = -size[1] / 2, _bounds.y2 = size[1] / 2;
@@ -15197,12 +15247,12 @@
15197
15247
  _createClass(RectSymbol, [{
15198
15248
  key: "draw",
15199
15249
  value: function draw(ctx, size, x, y) {
15200
- return isNumber$2(size) ? rectSize(ctx, size, x, y) : rectSizeArray(ctx, size, x, y);
15250
+ return isNumber$1(size) ? rectSize(ctx, size, x, y) : rectSizeArray(ctx, size, x, y);
15201
15251
  }
15202
15252
  }, {
15203
15253
  key: "drawOffset",
15204
15254
  value: function drawOffset(ctx, size, x, y, offset) {
15205
- return isNumber$2(size) ? rectSize(ctx, size + 2 * offset, x, y) : rectSizeArray(ctx, [size[0] + 2 * offset, size[1] + 2 * offset], x, y);
15255
+ return isNumber$1(size) ? rectSize(ctx, size + 2 * offset, x, y) : rectSizeArray(ctx, [size[0] + 2 * offset, size[1] + 2 * offset], x, y);
15206
15256
  }
15207
15257
  }]);
15208
15258
  return RectSymbol;
@@ -15841,16 +15891,7 @@
15841
15891
  deltaY = -height;
15842
15892
  }
15843
15893
  var deltaX = 0;
15844
- switch (this.globalAlign) {
15845
- case "left":
15846
- deltaX = 0;
15847
- break;
15848
- case "center":
15849
- deltaX = -width / 2;
15850
- break;
15851
- case "right":
15852
- deltaX = -width;
15853
- }
15894
+ "right" === this.globalAlign || "end" === this.globalAlign ? deltaX = -width : "center" === this.globalAlign && (deltaX = -width / 2);
15854
15895
  var frameHeight = this[this.directionKey.height];
15855
15896
  this.singleLine && (frameHeight = this.lines[0].height + 1);
15856
15897
  var lastLineTag = !1;
@@ -16003,9 +16044,9 @@
16003
16044
  var direction = this.direction;
16004
16045
  if (this.verticalEllipsis) text = "...", direction = "vertical", baseline -= this.ellipsisWidth / 2;else {
16005
16046
  if ("hide" === this.ellipsis) return;
16006
- if ("add" === this.ellipsis) text += "...", "right" === textAlign && (left -= this.ellipsisWidth);else if ("replace" === this.ellipsis) {
16047
+ if ("add" === this.ellipsis) text += "...", "right" !== textAlign && "end" !== textAlign || (left -= this.ellipsisWidth);else if ("replace" === this.ellipsis) {
16007
16048
  var index = getStrByWithCanvas(text, ("vertical" === direction ? this.height : this.width) - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.character, text.length - 1);
16008
- if (text = text.slice(0, index), text += "...", "right" === textAlign) {
16049
+ if (text = text.slice(0, index), text += "...", "right" === textAlign || "end" === textAlign) {
16009
16050
  var _measureTextCanvas3 = measureTextCanvas(this.text.slice(index), this.character),
16010
16051
  width = _measureTextCanvas3.width;
16011
16052
  "vertical" === direction || (left -= this.ellipsisWidth - width);
@@ -16261,17 +16302,7 @@
16261
16302
  maxHeight = this.height;
16262
16303
  var x = this.left,
16263
16304
  spacing = 0;
16264
- if (this.actualWidth < width && !isWidthMax) switch (this.textAlign) {
16265
- case "right":
16266
- x = width - this.actualWidth;
16267
- break;
16268
- case "center":
16269
- x = (width - this.actualWidth) / 2;
16270
- break;
16271
- case "justify":
16272
- this.paragraphs.length < 2 ? x = (width - this.actualWidth) / 2 : spacing = (width - this.actualWidth) / (this.paragraphs.length - 1);
16273
- }
16274
- this.paragraphs.map(function (paragraph) {
16305
+ this.actualWidth < width && !isWidthMax && ("right" === this.textAlign || "end" === this.textAlign ? x = width - this.actualWidth : "center" === this.textAlign ? x = (width - this.actualWidth) / 2 : "justify" === this.textAlign && (this.paragraphs.length < 2 ? x = (width - this.actualWidth) / 2 : spacing = (width - this.actualWidth) / (this.paragraphs.length - 1))), this.paragraphs.map(function (paragraph) {
16275
16306
  paragraph instanceof RichTextIcon ? (paragraph["_" + directionKey.x] = x, x += paragraph[directionKey.width] + spacing, paragraph["_" + directionKey.y] = "top" === paragraph.attribute.textBaseline ? 0 : "bottom" === paragraph.attribute.textBaseline ? maxHeight - paragraph.height : (maxHeight - paragraph.height) / 2) : (paragraph[directionKey.left] = x, x += paragraph[directionKey.width] + spacing);
16276
16307
  });
16277
16308
  }
@@ -16554,10 +16585,10 @@
16554
16585
  }
16555
16586
  } else {
16556
16587
  var richTextConfig = textConfig[i];
16557
- if (isNumber$2(richTextConfig.text) && (richTextConfig.text = "".concat(richTextConfig.text)), richTextConfig.text.includes("\n")) {
16588
+ if (isNumber$1(richTextConfig.text) && (richTextConfig.text = "".concat(richTextConfig.text)), richTextConfig.text && richTextConfig.text.includes("\n")) {
16558
16589
  var textParts = richTextConfig.text.split("\n");
16559
16590
  for (var j = 0; j < textParts.length; j++) paragraphs.push(new Paragraph(textParts[j], 0 !== j, richTextConfig));
16560
- } else paragraphs.push(new Paragraph(richTextConfig.text, !1, richTextConfig));
16591
+ } else richTextConfig.text && paragraphs.push(new Paragraph(richTextConfig.text, !1, richTextConfig));
16561
16592
  }
16562
16593
  var maxWidthFinite = "number" == typeof maxWidth && Number.isFinite(maxWidth) && maxWidth > 0,
16563
16594
  maxHeightFinite = "number" == typeof maxHeight && Number.isFinite(maxHeight) && maxHeight > 0,
@@ -16883,7 +16914,7 @@
16883
16914
  innerRadius = _this$attribute2$inne === void 0 ? arcTheme.innerRadius : _this$attribute2$inne;
16884
16915
  if (0 === cornerRadius || "0%" === cornerRadius) return 0;
16885
16916
  var deltaRadius = Math.abs(outerRadius - innerRadius);
16886
- return Math.min(isNumber$2(cornerRadius, !0) ? cornerRadius : deltaRadius * parseFloat(cornerRadius) / 100, deltaRadius / 2);
16917
+ return Math.min(isNumber$1(cornerRadius, !0) ? cornerRadius : deltaRadius * parseFloat(cornerRadius) / 100, deltaRadius / 2);
16887
16918
  }
16888
16919
  }, {
16889
16920
  key: "getParsedAngle",
@@ -19134,7 +19165,7 @@
19134
19165
  var halfPi = pi / 2;
19135
19166
  function createRectPath(path, x, y, width, height, rectCornerRadius) {
19136
19167
  var cornerRadius;
19137
- if (width < 0 && (x += width, width = -width), height < 0 && (y += height, height = -height), isNumber$2(rectCornerRadius, !0)) cornerRadius = [rectCornerRadius = abs(rectCornerRadius), rectCornerRadius, rectCornerRadius, rectCornerRadius];else if (Array.isArray(rectCornerRadius)) {
19168
+ if (width < 0 && (x += width, width = -width), height < 0 && (y += height, height = -height), isNumber$1(rectCornerRadius, !0)) cornerRadius = [rectCornerRadius = abs(rectCornerRadius), rectCornerRadius, rectCornerRadius, rectCornerRadius];else if (Array.isArray(rectCornerRadius)) {
19138
19169
  var cornerRadiusArr = rectCornerRadius;
19139
19170
  var cr0, cr1;
19140
19171
  switch (cornerRadiusArr.length) {
@@ -19257,7 +19288,7 @@
19257
19288
  y = bounds.y1,
19258
19289
  width = bounds.width(),
19259
19290
  height = bounds.height();
19260
- return isNumber$2(boundsPadding) ? (x += boundsPadding, y += boundsPadding, width -= 2 * boundsPadding, height -= 2 * boundsPadding) : (x += boundsPadding[3], y += boundsPadding[0], width -= boundsPadding[1] + boundsPadding[3], height -= boundsPadding[0] + boundsPadding[2]), {
19291
+ return isNumber$1(boundsPadding) ? (x += boundsPadding, y += boundsPadding, width -= 2 * boundsPadding, height -= 2 * boundsPadding) : (x += boundsPadding[3], y += boundsPadding[0], width -= boundsPadding[1] + boundsPadding[3], height -= boundsPadding[0] + boundsPadding[2]), {
19261
19292
  x: x,
19262
19293
  y: y,
19263
19294
  width: width,
@@ -21199,7 +21230,9 @@
21199
21230
  value: function draw(image, renderService, drawContext) {
21200
21231
  var url = image.attribute.image;
21201
21232
  if (!url || !image.resources) return;
21202
- if ("success" !== image.resources.get(url).state) return;
21233
+ var res = image.resources.get(url);
21234
+ if ("loading" === res.state && isString$1(url)) return void ResourceLoader.improveImageLoading(url);
21235
+ if ("success" !== res.state) return;
21203
21236
  var context = renderService.drawParams.context;
21204
21237
  if (!context) return;
21205
21238
  var imageAttribute = getTheme(image).image;
@@ -21240,6 +21273,241 @@
21240
21273
  },
21241
21274
  __metadata$$ = undefined && undefined.__metadata || function (k, v) {
21242
21275
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
21276
+ };
21277
+ var DrawItemInterceptor = Symbol["for"]("DrawItemInterceptor");
21278
+ var tempDirtyBounds = new AABBBounds();
21279
+ var ShadowRootDrawItemInterceptorContribution = /*#__PURE__*/function () {
21280
+ function ShadowRootDrawItemInterceptorContribution() {
21281
+ _classCallCheck(this, ShadowRootDrawItemInterceptorContribution);
21282
+ this.order = 1;
21283
+ }
21284
+ _createClass(ShadowRootDrawItemInterceptorContribution, [{
21285
+ key: "afterDrawItem",
21286
+ value: function afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21287
+ return (graphic.attribute.shadowRootIdx > 0 || !graphic.attribute.shadowRootIdx) && this.drawItem(graphic, renderService, drawContext, drawContribution, params), !1;
21288
+ }
21289
+ }, {
21290
+ key: "beforeDrawItem",
21291
+ value: function beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21292
+ return graphic.attribute.shadowRootIdx < 0 && this.drawItem(graphic, renderService, drawContext, drawContribution, params), !1;
21293
+ }
21294
+ }, {
21295
+ key: "drawItem",
21296
+ value: function drawItem(graphic, renderService, drawContext, drawContribution, params) {
21297
+ if (!graphic.shadowRoot) return !1;
21298
+ var context = drawContext.context;
21299
+ if (context.highPerformanceSave(), context.transformFromMatrix(graphic.transMatrix, !0), drawContribution.dirtyBounds && drawContribution.backupDirtyBounds) {
21300
+ tempDirtyBounds.copy(drawContribution.dirtyBounds);
21301
+ var m = graphic.globalTransMatrix.getInverse();
21302
+ drawContribution.dirtyBounds.copy(drawContribution.backupDirtyBounds).transformWithMatrix(m);
21303
+ }
21304
+ return drawContribution.renderGroup(graphic.shadowRoot, drawContext, graphic.parent.globalTransMatrix), context.highPerformanceRestore(), drawContribution.dirtyBounds && drawContribution.backupDirtyBounds && drawContribution.dirtyBounds.copy(tempDirtyBounds), !0;
21305
+ }
21306
+ }]);
21307
+ return ShadowRootDrawItemInterceptorContribution;
21308
+ }();
21309
+ var DebugDrawItemInterceptorContribution = /*#__PURE__*/function () {
21310
+ function DebugDrawItemInterceptorContribution() {
21311
+ _classCallCheck(this, DebugDrawItemInterceptorContribution);
21312
+ this.order = 1;
21313
+ }
21314
+ _createClass(DebugDrawItemInterceptorContribution, [{
21315
+ key: "afterDrawItem",
21316
+ value: function afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21317
+ return graphic.attribute._debug_bounds && this.drawItem(graphic, renderService, drawContext, drawContribution, params), !1;
21318
+ }
21319
+ }, {
21320
+ key: "drawItem",
21321
+ value: function drawItem(graphic, renderService, drawContext, drawContribution, params) {
21322
+ if (!graphic.attribute._debug_bounds) return !1;
21323
+ var context = drawContext.context;
21324
+ context.highPerformanceSave(), graphic.parent && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), graphic.glyphHost && graphic.glyphHost.parent && context.setTransformFromMatrix(graphic.glyphHost.parent.globalTransMatrix, !0);
21325
+ var b = graphic.AABBBounds;
21326
+ return !0 !== graphic.attribute._debug_bounds && graphic.attribute._debug_bounds(context, graphic), context.strokeRect(b.x1, b.y1, b.width(), b.height()), context.highPerformanceRestore(), !0;
21327
+ }
21328
+ }]);
21329
+ return DebugDrawItemInterceptorContribution;
21330
+ }();
21331
+ exports.CommonDrawItemInterceptorContribution = /*#__PURE__*/function () {
21332
+ function CommonDrawItemInterceptorContribution() {
21333
+ _classCallCheck(this, CommonDrawItemInterceptorContribution);
21334
+ this.order = 1, this.interceptors = [new ShadowRootDrawItemInterceptorContribution(), new Canvas3DDrawItemInterceptor(), new InteractiveDrawItemInterceptorContribution(), new DebugDrawItemInterceptorContribution()];
21335
+ }
21336
+ _createClass(CommonDrawItemInterceptorContribution, [{
21337
+ key: "afterDrawItem",
21338
+ value: function afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21339
+ for (var i = 0; i < this.interceptors.length; i++) if (this.interceptors[i].afterDrawItem && this.interceptors[i].afterDrawItem(graphic, renderService, drawContext, drawContribution, params)) return !0;
21340
+ return !1;
21341
+ }
21342
+ }, {
21343
+ key: "beforeDrawItem",
21344
+ value: function beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21345
+ if ((!graphic.in3dMode || drawContext.in3dInterceptor) && !graphic.shadowRoot && !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)) return !1;
21346
+ for (var i = 0; i < this.interceptors.length; i++) if (this.interceptors[i].beforeDrawItem && this.interceptors[i].beforeDrawItem(graphic, renderService, drawContext, drawContribution, params)) return !0;
21347
+ return !1;
21348
+ }
21349
+ }]);
21350
+ return CommonDrawItemInterceptorContribution;
21351
+ }();
21352
+ exports.CommonDrawItemInterceptorContribution = __decorate$1j([injectable(), __metadata$$("design:paramtypes", [])], exports.CommonDrawItemInterceptorContribution);
21353
+ var InteractiveDrawItemInterceptorContribution = /*#__PURE__*/function () {
21354
+ function InteractiveDrawItemInterceptorContribution() {
21355
+ _classCallCheck(this, InteractiveDrawItemInterceptorContribution);
21356
+ this.order = 1;
21357
+ }
21358
+ _createClass(InteractiveDrawItemInterceptorContribution, [{
21359
+ key: "beforeDrawItem",
21360
+ value: function beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21361
+ return !this.processing && (graphic.baseGraphic ? this.beforeDrawInteractive(graphic, renderService, drawContext, drawContribution, params) : this.beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params));
21362
+ }
21363
+ }, {
21364
+ key: "beforeSetInteractive",
21365
+ value: function beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params) {
21366
+ var interactiveGraphic = graphic.interactiveGraphic;
21367
+ if (graphic.attribute.globalZIndex) {
21368
+ interactiveGraphic || (interactiveGraphic = graphic.clone(), graphic.interactiveGraphic = interactiveGraphic, interactiveGraphic.baseGraphic = graphic), interactiveGraphic.setAttributes({
21369
+ globalZIndex: 0,
21370
+ zIndex: graphic.attribute.globalZIndex
21371
+ }, !1, {
21372
+ skipUpdateCallback: !0
21373
+ }), drawContext.stage.tryInitInteractiveLayer();
21374
+ var interactiveLayer = drawContext.stage.getLayer("_builtin_interactive");
21375
+ if (interactiveLayer) {
21376
+ this.getShadowRoot(interactiveLayer).add(interactiveGraphic);
21377
+ }
21378
+ return !0;
21379
+ }
21380
+ if (interactiveGraphic) {
21381
+ drawContext.stage.tryInitInteractiveLayer();
21382
+ var _interactiveLayer = drawContext.stage.getLayer("_builtin_interactive");
21383
+ if (_interactiveLayer) {
21384
+ this.getShadowRoot(_interactiveLayer).removeChild(interactiveGraphic);
21385
+ }
21386
+ graphic.interactiveGraphic = null, interactiveGraphic.baseGraphic = null;
21387
+ }
21388
+ return !1;
21389
+ }
21390
+ }, {
21391
+ key: "beforeDrawInteractive",
21392
+ value: function beforeDrawInteractive(graphic, renderService, drawContext, drawContribution, params) {
21393
+ var baseGraphic = graphic.baseGraphic;
21394
+ if (baseGraphic) {
21395
+ this.processing = !0;
21396
+ var context = drawContext.context;
21397
+ return context.highPerformanceSave(), context.setTransformFromMatrix(baseGraphic.parent.globalTransMatrix, !0), baseGraphic.isContainer ? drawContribution.renderGroup(baseGraphic, drawContext, baseGraphic.parent.globalTransMatrix) : drawContribution.renderItem(baseGraphic, drawContext), context.highPerformanceRestore(), this.processing = !1, !0;
21398
+ }
21399
+ return !1;
21400
+ }
21401
+ }, {
21402
+ key: "getShadowRoot",
21403
+ value: function getShadowRoot(interactiveLayer) {
21404
+ var _a;
21405
+ var group = interactiveLayer.getElementById("_interactive_group");
21406
+ return group || (group = graphicCreator.CreateGraphic("group", {}), group.id = "_interactive_group", interactiveLayer.add(group)), null !== (_a = group.shadowRoot) && void 0 !== _a ? _a : group.attachShadow();
21407
+ }
21408
+ }]);
21409
+ return InteractiveDrawItemInterceptorContribution;
21410
+ }();
21411
+ var Canvas3DDrawItemInterceptor = /*#__PURE__*/function () {
21412
+ function Canvas3DDrawItemInterceptor() {
21413
+ _classCallCheck(this, Canvas3DDrawItemInterceptor);
21414
+ this.order = 1;
21415
+ }
21416
+ _createClass(Canvas3DDrawItemInterceptor, [{
21417
+ key: "beforeDrawItem",
21418
+ value: function beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21419
+ if (!graphic.in3dMode || drawContext.in3dInterceptor) return !1;
21420
+ drawContext.in3dInterceptor = !0;
21421
+ var _renderService$drawPa = renderService.drawParams,
21422
+ context = _renderService$drawPa.context,
21423
+ stage = _renderService$drawPa.stage;
21424
+ context.canvas;
21425
+ context.save(), this.initCanvasCtx(context), context.camera = stage.camera;
21426
+ var m = context.currentMatrix;
21427
+ m.a /= context.dpr, m.b /= context.dpr, m.c /= context.dpr, m.d /= context.dpr, m.e /= context.dpr, m.f /= context.dpr;
21428
+ var matrix = mat4Allocate.allocate();
21429
+ mat3Tomat4(matrix, m);
21430
+ var lastModelMatrix = context.modelMatrix;
21431
+ if (lastModelMatrix) {
21432
+ if (matrix) {
21433
+ var _m = mat4Allocate.allocate();
21434
+ context.modelMatrix = multiplyMat4Mat4(_m, lastModelMatrix, matrix);
21435
+ }
21436
+ } else context.modelMatrix = matrix;
21437
+ if (context.setTransform(1, 0, 0, 1, 0, 0, !0), graphic.isContainer) {
21438
+ var isPie = !1,
21439
+ is3d = !1;
21440
+ if (graphic.forEachChildren(function (c) {
21441
+ return isPie = c.numberType === ARC3D_NUMBER_TYPE, !isPie;
21442
+ }), graphic.forEachChildren(function (c) {
21443
+ return is3d = !!c.findFace, !is3d;
21444
+ }), isPie) {
21445
+ var children = graphic.getChildren(),
21446
+ sortedChildren = _toConsumableArray(children);
21447
+ sortedChildren.sort(function (a, b) {
21448
+ var _a, _b, _c, _d;
21449
+ var angle1 = ((null !== (_a = a.attribute.startAngle) && void 0 !== _a ? _a : 0) + (null !== (_b = a.attribute.endAngle) && void 0 !== _b ? _b : 0)) / 2,
21450
+ angle2 = ((null !== (_c = b.attribute.startAngle) && void 0 !== _c ? _c : 0) + (null !== (_d = b.attribute.endAngle) && void 0 !== _d ? _d : 0)) / 2;
21451
+ for (; angle1 < 0;) angle1 += pi2;
21452
+ for (; angle2 < 0;) angle2 += pi2;
21453
+ return angle2 - angle1;
21454
+ }), sortedChildren.forEach(function (c) {
21455
+ c._next = null, c._prev = null;
21456
+ }), graphic.removeAllChild(), graphic.update(), sortedChildren.forEach(function (c) {
21457
+ graphic.appendChild(c);
21458
+ });
21459
+ var _m2 = graphic.parent.globalTransMatrix;
21460
+ drawContext.hack_pieFace = "outside", drawContribution.renderGroup(graphic, drawContext, _m2), drawContext.hack_pieFace = "inside", drawContribution.renderGroup(graphic, drawContext, _m2), drawContext.hack_pieFace = "top", drawContribution.renderGroup(graphic, drawContext, _m2), graphic.removeAllChild(), children.forEach(function (c) {
21461
+ c._next = null, c._prev = null;
21462
+ }), children.forEach(function (c) {
21463
+ graphic.appendChild(c);
21464
+ });
21465
+ } else if (is3d) {
21466
+ var _children = graphic.getChildren(),
21467
+ zChildren = _children.map(function (g) {
21468
+ return {
21469
+ ave_z: g.findFace().vertices.map(function (v) {
21470
+ var _a;
21471
+ return context.view(v[0], v[1], null !== (_a = v[2] + g.attribute.z) && void 0 !== _a ? _a : 0)[2];
21472
+ }).reduce(function (a, b) {
21473
+ return a + b;
21474
+ }, 0),
21475
+ g: g
21476
+ };
21477
+ });
21478
+ zChildren.sort(function (a, b) {
21479
+ return b.ave_z - a.ave_z;
21480
+ }), graphic.removeAllChild(), zChildren.forEach(function (i) {
21481
+ i.g._next = null, i.g._prev = null;
21482
+ }), graphic.update(), zChildren.forEach(function (i) {
21483
+ graphic.add(i.g);
21484
+ }), drawContribution.renderGroup(graphic, drawContext, graphic.parent.globalTransMatrix, !0), graphic.removeAllChild(), _children.forEach(function (g) {
21485
+ g._next = null, g._prev = null;
21486
+ }), graphic.update(), _children.forEach(function (g) {
21487
+ graphic.add(g);
21488
+ });
21489
+ } else drawContribution.renderGroup(graphic, drawContext, graphic.parent.globalTransMatrix);
21490
+ } else drawContribution.renderItem(graphic, drawContext);
21491
+ return context.camera = null, context.restore(), context.modelMatrix !== lastModelMatrix && mat4Allocate.free(context.modelMatrix), context.modelMatrix = lastModelMatrix, drawContext.in3dInterceptor = !1, !0;
21492
+ }
21493
+ }, {
21494
+ key: "initCanvasCtx",
21495
+ value: function initCanvasCtx(context) {
21496
+ context.setTransformForCurrent();
21497
+ }
21498
+ }]);
21499
+ return Canvas3DDrawItemInterceptor;
21500
+ }();
21501
+
21502
+ var __decorate$1i = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21503
+ var d,
21504
+ c = arguments.length,
21505
+ r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
21506
+ if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
21507
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
21508
+ },
21509
+ __metadata$_ = undefined && undefined.__metadata || function (k, v) {
21510
+ if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
21243
21511
  },
21244
21512
  __param$E = undefined && undefined.__param || function (paramIndex, decorator) {
21245
21513
  return function (target, key) {
@@ -21298,7 +21566,7 @@
21298
21566
  }]);
21299
21567
  return DefaultRenderService;
21300
21568
  }();
21301
- exports.DefaultRenderService = __decorate$1j([injectable(), __param$E(0, inject(DrawContribution)), __metadata$$("design:paramtypes", [Object])], exports.DefaultRenderService);
21569
+ exports.DefaultRenderService = __decorate$1i([injectable(), __param$E(0, inject(DrawContribution)), __metadata$_("design:paramtypes", [Object])], exports.DefaultRenderService);
21302
21570
 
21303
21571
  var renderModule$1 = new ContainerModule(function (bind) {
21304
21572
  bind(RenderService).to(exports.DefaultRenderService).inSingletonScope();
@@ -21309,7 +21577,7 @@
21309
21577
  var BoundsPicker = Symbol["for"]("BoundsPicker");
21310
21578
  var GlobalPickerService = Symbol["for"]("GlobalPickerService");
21311
21579
 
21312
- var __decorate$1i = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21580
+ var __decorate$1h = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21313
21581
  var d,
21314
21582
  c = arguments.length,
21315
21583
  r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
@@ -21350,7 +21618,7 @@
21350
21618
  }]);
21351
21619
  return ShadowRootPickItemInterceptorContribution;
21352
21620
  }();
21353
- exports.ShadowRootPickItemInterceptorContribution = __decorate$1i([injectable()], exports.ShadowRootPickItemInterceptorContribution);
21621
+ exports.ShadowRootPickItemInterceptorContribution = __decorate$1h([injectable()], exports.ShadowRootPickItemInterceptorContribution);
21354
21622
  exports.InteractivePickItemInterceptorContribution = /*#__PURE__*/function () {
21355
21623
  function InteractivePickItemInterceptorContribution() {
21356
21624
  _classCallCheck(this, InteractivePickItemInterceptorContribution);
@@ -21374,7 +21642,7 @@
21374
21642
  }]);
21375
21643
  return InteractivePickItemInterceptorContribution;
21376
21644
  }();
21377
- exports.InteractivePickItemInterceptorContribution = __decorate$1i([injectable()], exports.InteractivePickItemInterceptorContribution);
21645
+ exports.InteractivePickItemInterceptorContribution = __decorate$1h([injectable()], exports.InteractivePickItemInterceptorContribution);
21378
21646
  exports.Canvas3DPickItemInterceptor = /*#__PURE__*/function () {
21379
21647
  function Canvas3DPickItemInterceptor() {
21380
21648
  _classCallCheck(this, Canvas3DPickItemInterceptor);
@@ -21451,7 +21719,7 @@
21451
21719
  }]);
21452
21720
  return Canvas3DPickItemInterceptor;
21453
21721
  }();
21454
- exports.Canvas3DPickItemInterceptor = __decorate$1i([injectable()], exports.Canvas3DPickItemInterceptor);
21722
+ exports.Canvas3DPickItemInterceptor = __decorate$1h([injectable()], exports.Canvas3DPickItemInterceptor);
21455
21723
 
21456
21724
  var pickModule = new ContainerModule(function (bind, unbind, isBound) {
21457
21725
  isBound(PickerService) || (bind(GlobalPickerService).toSelf(), bind(PickerService).toService(GlobalPickerService)), bind(exports.Canvas3DPickItemInterceptor).toSelf().inSingletonScope(), bind(PickItemInterceptor).toService(exports.Canvas3DPickItemInterceptor), bind(exports.ShadowRootPickItemInterceptorContribution).toSelf().inSingletonScope(), bind(PickItemInterceptor).toService(exports.ShadowRootPickItemInterceptorContribution), bind(exports.InteractivePickItemInterceptorContribution).toSelf().inSingletonScope(), bind(PickItemInterceptor).toService(exports.InteractivePickItemInterceptorContribution), bindContributionProvider(bind, PickItemInterceptor);
@@ -21464,14 +21732,14 @@
21464
21732
  var AutoEnablePlugins = Symbol["for"]("AutoEnablePlugins");
21465
21733
  var PluginService = Symbol["for"]("PluginService");
21466
21734
 
21467
- var __decorate$1h = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21735
+ var __decorate$1g = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21468
21736
  var d,
21469
21737
  c = arguments.length,
21470
21738
  r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
21471
21739
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
21472
21740
  return c > 3 && r && Object.defineProperty(target, key, r), r;
21473
21741
  },
21474
- __metadata$_ = undefined && undefined.__metadata || function (k, v) {
21742
+ __metadata$Z = undefined && undefined.__metadata || function (k, v) {
21475
21743
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
21476
21744
  },
21477
21745
  __param$D = undefined && undefined.__param || function (paramIndex, decorator) {
@@ -21527,7 +21795,7 @@
21527
21795
  }]);
21528
21796
  return DefaultPluginService;
21529
21797
  }();
21530
- DefaultPluginService = __decorate$1h([injectable(), __param$D(0, inject(ContributionProvider)), __param$D(0, named(AutoEnablePlugins)), __metadata$_("design:paramtypes", [Object])], DefaultPluginService);
21798
+ DefaultPluginService = __decorate$1g([injectable(), __param$D(0, inject(ContributionProvider)), __param$D(0, named(AutoEnablePlugins)), __metadata$Z("design:paramtypes", [Object])], DefaultPluginService);
21531
21799
 
21532
21800
  var pluginModule = new ContainerModule(function (bind) {
21533
21801
  bind(PluginService).to(DefaultPluginService), bindContributionProviderNoSingletonScope(bind, AutoEnablePlugins);
@@ -21541,14 +21809,14 @@
21541
21809
  bind(TextMeasureContribution).to(exports.DefaultTextMeasureContribution).inSingletonScope(), bindContributionProvider(bind, TextMeasureContribution);
21542
21810
  });
21543
21811
 
21544
- var __decorate$1g = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21812
+ var __decorate$1f = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21545
21813
  var d,
21546
21814
  c = arguments.length,
21547
21815
  r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
21548
21816
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
21549
21817
  return c > 3 && r && Object.defineProperty(target, key, r), r;
21550
21818
  },
21551
- __metadata$Z = undefined && undefined.__metadata || function (k, v) {
21819
+ __metadata$Y = undefined && undefined.__metadata || function (k, v) {
21552
21820
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
21553
21821
  };
21554
21822
  var CanvasLayerHandlerContribution = /*#__PURE__*/function () {
@@ -21642,16 +21910,16 @@
21642
21910
  }]);
21643
21911
  return CanvasLayerHandlerContribution;
21644
21912
  }();
21645
- CanvasLayerHandlerContribution = __decorate$1g([injectable(), __metadata$Z("design:paramtypes", [])], CanvasLayerHandlerContribution);
21913
+ CanvasLayerHandlerContribution = __decorate$1f([injectable(), __metadata$Y("design:paramtypes", [])], CanvasLayerHandlerContribution);
21646
21914
 
21647
- var __decorate$1f = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21915
+ var __decorate$1e = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21648
21916
  var d,
21649
21917
  c = arguments.length,
21650
21918
  r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
21651
21919
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
21652
21920
  return c > 3 && r && Object.defineProperty(target, key, r), r;
21653
21921
  },
21654
- __metadata$Y = undefined && undefined.__metadata || function (k, v) {
21922
+ __metadata$X = undefined && undefined.__metadata || function (k, v) {
21655
21923
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
21656
21924
  };
21657
21925
  var EmptyLayerHandlerContribution = /*#__PURE__*/function () {
@@ -21709,16 +21977,16 @@
21709
21977
  }]);
21710
21978
  return EmptyLayerHandlerContribution;
21711
21979
  }();
21712
- EmptyLayerHandlerContribution = __decorate$1f([injectable(), __metadata$Y("design:paramtypes", [])], EmptyLayerHandlerContribution);
21980
+ EmptyLayerHandlerContribution = __decorate$1e([injectable(), __metadata$X("design:paramtypes", [])], EmptyLayerHandlerContribution);
21713
21981
 
21714
- var __decorate$1e = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21982
+ var __decorate$1d = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21715
21983
  var d,
21716
21984
  c = arguments.length,
21717
21985
  r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
21718
21986
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
21719
21987
  return c > 3 && r && Object.defineProperty(target, key, r), r;
21720
21988
  },
21721
- __metadata$X = undefined && undefined.__metadata || function (k, v) {
21989
+ __metadata$W = undefined && undefined.__metadata || function (k, v) {
21722
21990
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
21723
21991
  };
21724
21992
  var OffscreenLayerHandlerContribution = /*#__PURE__*/function () {
@@ -21805,7 +22073,7 @@
21805
22073
  }]);
21806
22074
  return OffscreenLayerHandlerContribution;
21807
22075
  }();
21808
- OffscreenLayerHandlerContribution = __decorate$1e([injectable(), __metadata$X("design:paramtypes", [])], OffscreenLayerHandlerContribution);
22076
+ OffscreenLayerHandlerContribution = __decorate$1d([injectable(), __metadata$W("design:paramtypes", [])], OffscreenLayerHandlerContribution);
21809
22077
 
21810
22078
  var layerHandlerModules = new ContainerModule(function (bind) {
21811
22079
  bind(CanvasLayerHandlerContribution).toSelf(), bind(OffscreenLayerHandlerContribution).toSelf(), bind(EmptyLayerHandlerContribution).toSelf(), bind(StaticLayerHandlerContribution).toService(CanvasLayerHandlerContribution), bind(DynamicLayerHandlerContribution).toService(OffscreenLayerHandlerContribution), bind(VirtualLayerHandlerContribution).toService(EmptyLayerHandlerContribution);
@@ -21932,241 +22200,6 @@
21932
22200
  return result;
21933
22201
  }
21934
22202
 
21935
- var __decorate$1d = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21936
- var d,
21937
- c = arguments.length,
21938
- r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
21939
- if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
21940
- return c > 3 && r && Object.defineProperty(target, key, r), r;
21941
- },
21942
- __metadata$W = undefined && undefined.__metadata || function (k, v) {
21943
- if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
21944
- };
21945
- var DrawItemInterceptor = Symbol["for"]("DrawItemInterceptor");
21946
- var tempDirtyBounds = new AABBBounds();
21947
- var ShadowRootDrawItemInterceptorContribution = /*#__PURE__*/function () {
21948
- function ShadowRootDrawItemInterceptorContribution() {
21949
- _classCallCheck(this, ShadowRootDrawItemInterceptorContribution);
21950
- this.order = 1;
21951
- }
21952
- _createClass(ShadowRootDrawItemInterceptorContribution, [{
21953
- key: "afterDrawItem",
21954
- value: function afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21955
- return (graphic.attribute.shadowRootIdx > 0 || !graphic.attribute.shadowRootIdx) && this.drawItem(graphic, renderService, drawContext, drawContribution, params), !1;
21956
- }
21957
- }, {
21958
- key: "beforeDrawItem",
21959
- value: function beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21960
- return graphic.attribute.shadowRootIdx < 0 && this.drawItem(graphic, renderService, drawContext, drawContribution, params), !1;
21961
- }
21962
- }, {
21963
- key: "drawItem",
21964
- value: function drawItem(graphic, renderService, drawContext, drawContribution, params) {
21965
- if (!graphic.shadowRoot) return !1;
21966
- var context = drawContext.context;
21967
- if (context.highPerformanceSave(), context.transformFromMatrix(graphic.transMatrix, !0), drawContribution.dirtyBounds && drawContribution.backupDirtyBounds) {
21968
- tempDirtyBounds.copy(drawContribution.dirtyBounds);
21969
- var m = graphic.globalTransMatrix.getInverse();
21970
- drawContribution.dirtyBounds.copy(drawContribution.backupDirtyBounds).transformWithMatrix(m);
21971
- }
21972
- return drawContribution.renderGroup(graphic.shadowRoot, drawContext, graphic.parent.globalTransMatrix), context.highPerformanceRestore(), drawContribution.dirtyBounds && drawContribution.backupDirtyBounds && drawContribution.dirtyBounds.copy(tempDirtyBounds), !0;
21973
- }
21974
- }]);
21975
- return ShadowRootDrawItemInterceptorContribution;
21976
- }();
21977
- var DebugDrawItemInterceptorContribution = /*#__PURE__*/function () {
21978
- function DebugDrawItemInterceptorContribution() {
21979
- _classCallCheck(this, DebugDrawItemInterceptorContribution);
21980
- this.order = 1;
21981
- }
21982
- _createClass(DebugDrawItemInterceptorContribution, [{
21983
- key: "afterDrawItem",
21984
- value: function afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21985
- return graphic.attribute._debug_bounds && this.drawItem(graphic, renderService, drawContext, drawContribution, params), !1;
21986
- }
21987
- }, {
21988
- key: "drawItem",
21989
- value: function drawItem(graphic, renderService, drawContext, drawContribution, params) {
21990
- if (!graphic.attribute._debug_bounds) return !1;
21991
- var context = drawContext.context;
21992
- context.highPerformanceSave(), graphic.parent && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), graphic.glyphHost && graphic.glyphHost.parent && context.setTransformFromMatrix(graphic.glyphHost.parent.globalTransMatrix, !0);
21993
- var b = graphic.AABBBounds;
21994
- return !0 !== graphic.attribute._debug_bounds && graphic.attribute._debug_bounds(context, graphic), context.strokeRect(b.x1, b.y1, b.width(), b.height()), context.highPerformanceRestore(), !0;
21995
- }
21996
- }]);
21997
- return DebugDrawItemInterceptorContribution;
21998
- }();
21999
- var CommonDrawItemInterceptorContribution = /*#__PURE__*/function () {
22000
- function CommonDrawItemInterceptorContribution() {
22001
- _classCallCheck(this, CommonDrawItemInterceptorContribution);
22002
- this.order = 1, this.interceptors = [new ShadowRootDrawItemInterceptorContribution(), new Canvas3DDrawItemInterceptor(), new InteractiveDrawItemInterceptorContribution(), new DebugDrawItemInterceptorContribution()];
22003
- }
22004
- _createClass(CommonDrawItemInterceptorContribution, [{
22005
- key: "afterDrawItem",
22006
- value: function afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
22007
- for (var i = 0; i < this.interceptors.length; i++) if (this.interceptors[i].afterDrawItem && this.interceptors[i].afterDrawItem(graphic, renderService, drawContext, drawContribution, params)) return !0;
22008
- return !1;
22009
- }
22010
- }, {
22011
- key: "beforeDrawItem",
22012
- value: function beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
22013
- if ((!graphic.in3dMode || drawContext.in3dInterceptor) && !graphic.shadowRoot && !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)) return !1;
22014
- for (var i = 0; i < this.interceptors.length; i++) if (this.interceptors[i].beforeDrawItem && this.interceptors[i].beforeDrawItem(graphic, renderService, drawContext, drawContribution, params)) return !0;
22015
- return !1;
22016
- }
22017
- }]);
22018
- return CommonDrawItemInterceptorContribution;
22019
- }();
22020
- CommonDrawItemInterceptorContribution = __decorate$1d([injectable(), __metadata$W("design:paramtypes", [])], CommonDrawItemInterceptorContribution);
22021
- var InteractiveDrawItemInterceptorContribution = /*#__PURE__*/function () {
22022
- function InteractiveDrawItemInterceptorContribution() {
22023
- _classCallCheck(this, InteractiveDrawItemInterceptorContribution);
22024
- this.order = 1;
22025
- }
22026
- _createClass(InteractiveDrawItemInterceptorContribution, [{
22027
- key: "beforeDrawItem",
22028
- value: function beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
22029
- return !this.processing && (graphic.baseGraphic ? this.beforeDrawInteractive(graphic, renderService, drawContext, drawContribution, params) : this.beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params));
22030
- }
22031
- }, {
22032
- key: "beforeSetInteractive",
22033
- value: function beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params) {
22034
- var interactiveGraphic = graphic.interactiveGraphic;
22035
- if (graphic.attribute.globalZIndex) {
22036
- interactiveGraphic || (interactiveGraphic = graphic.clone(), graphic.interactiveGraphic = interactiveGraphic, interactiveGraphic.baseGraphic = graphic), interactiveGraphic.setAttributes({
22037
- globalZIndex: 0,
22038
- zIndex: graphic.attribute.globalZIndex
22039
- }, !1, {
22040
- skipUpdateCallback: !0
22041
- }), drawContext.stage.tryInitInteractiveLayer();
22042
- var interactiveLayer = drawContext.stage.getLayer("_builtin_interactive");
22043
- if (interactiveLayer) {
22044
- this.getShadowRoot(interactiveLayer).add(interactiveGraphic);
22045
- }
22046
- return !0;
22047
- }
22048
- if (interactiveGraphic) {
22049
- drawContext.stage.tryInitInteractiveLayer();
22050
- var _interactiveLayer = drawContext.stage.getLayer("_builtin_interactive");
22051
- if (_interactiveLayer) {
22052
- this.getShadowRoot(_interactiveLayer).removeChild(interactiveGraphic);
22053
- }
22054
- graphic.interactiveGraphic = null, interactiveGraphic.baseGraphic = null;
22055
- }
22056
- return !1;
22057
- }
22058
- }, {
22059
- key: "beforeDrawInteractive",
22060
- value: function beforeDrawInteractive(graphic, renderService, drawContext, drawContribution, params) {
22061
- var baseGraphic = graphic.baseGraphic;
22062
- if (baseGraphic) {
22063
- this.processing = !0;
22064
- var context = drawContext.context;
22065
- return context.highPerformanceSave(), context.setTransformFromMatrix(baseGraphic.parent.globalTransMatrix, !0), baseGraphic.isContainer ? drawContribution.renderGroup(baseGraphic, drawContext, baseGraphic.parent.globalTransMatrix) : drawContribution.renderItem(baseGraphic, drawContext), context.highPerformanceRestore(), this.processing = !1, !0;
22066
- }
22067
- return !1;
22068
- }
22069
- }, {
22070
- key: "getShadowRoot",
22071
- value: function getShadowRoot(interactiveLayer) {
22072
- var _a;
22073
- var group = interactiveLayer.getElementById("_interactive_group");
22074
- return group || (group = graphicCreator.CreateGraphic("group", {}), group.id = "_interactive_group", interactiveLayer.add(group)), null !== (_a = group.shadowRoot) && void 0 !== _a ? _a : group.attachShadow();
22075
- }
22076
- }]);
22077
- return InteractiveDrawItemInterceptorContribution;
22078
- }();
22079
- var Canvas3DDrawItemInterceptor = /*#__PURE__*/function () {
22080
- function Canvas3DDrawItemInterceptor() {
22081
- _classCallCheck(this, Canvas3DDrawItemInterceptor);
22082
- this.order = 1;
22083
- }
22084
- _createClass(Canvas3DDrawItemInterceptor, [{
22085
- key: "beforeDrawItem",
22086
- value: function beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
22087
- if (!graphic.in3dMode || drawContext.in3dInterceptor) return !1;
22088
- drawContext.in3dInterceptor = !0;
22089
- var _renderService$drawPa = renderService.drawParams,
22090
- context = _renderService$drawPa.context,
22091
- stage = _renderService$drawPa.stage;
22092
- context.canvas;
22093
- context.save(), this.initCanvasCtx(context), context.camera = stage.camera;
22094
- var m = context.currentMatrix;
22095
- m.a /= context.dpr, m.b /= context.dpr, m.c /= context.dpr, m.d /= context.dpr, m.e /= context.dpr, m.f /= context.dpr;
22096
- var matrix = mat4Allocate.allocate();
22097
- mat3Tomat4(matrix, m);
22098
- var lastModelMatrix = context.modelMatrix;
22099
- if (lastModelMatrix) {
22100
- if (matrix) {
22101
- var _m = mat4Allocate.allocate();
22102
- context.modelMatrix = multiplyMat4Mat4(_m, lastModelMatrix, matrix);
22103
- }
22104
- } else context.modelMatrix = matrix;
22105
- if (context.setTransform(1, 0, 0, 1, 0, 0, !0), graphic.isContainer) {
22106
- var isPie = !1,
22107
- is3d = !1;
22108
- if (graphic.forEachChildren(function (c) {
22109
- return isPie = c.numberType === ARC3D_NUMBER_TYPE, !isPie;
22110
- }), graphic.forEachChildren(function (c) {
22111
- return is3d = !!c.findFace, !is3d;
22112
- }), isPie) {
22113
- var children = graphic.getChildren(),
22114
- sortedChildren = _toConsumableArray(children);
22115
- sortedChildren.sort(function (a, b) {
22116
- var _a, _b, _c, _d;
22117
- var angle1 = ((null !== (_a = a.attribute.startAngle) && void 0 !== _a ? _a : 0) + (null !== (_b = a.attribute.endAngle) && void 0 !== _b ? _b : 0)) / 2,
22118
- angle2 = ((null !== (_c = b.attribute.startAngle) && void 0 !== _c ? _c : 0) + (null !== (_d = b.attribute.endAngle) && void 0 !== _d ? _d : 0)) / 2;
22119
- for (; angle1 < 0;) angle1 += pi2;
22120
- for (; angle2 < 0;) angle2 += pi2;
22121
- return angle2 - angle1;
22122
- }), sortedChildren.forEach(function (c) {
22123
- c._next = null, c._prev = null;
22124
- }), graphic.removeAllChild(), graphic.update(), sortedChildren.forEach(function (c) {
22125
- graphic.appendChild(c);
22126
- });
22127
- var _m2 = graphic.parent.globalTransMatrix;
22128
- drawContext.hack_pieFace = "outside", drawContribution.renderGroup(graphic, drawContext, _m2), drawContext.hack_pieFace = "inside", drawContribution.renderGroup(graphic, drawContext, _m2), drawContext.hack_pieFace = "top", drawContribution.renderGroup(graphic, drawContext, _m2), graphic.removeAllChild(), children.forEach(function (c) {
22129
- c._next = null, c._prev = null;
22130
- }), children.forEach(function (c) {
22131
- graphic.appendChild(c);
22132
- });
22133
- } else if (is3d) {
22134
- var _children = graphic.getChildren(),
22135
- zChildren = _children.map(function (g) {
22136
- return {
22137
- ave_z: g.findFace().vertices.map(function (v) {
22138
- var _a;
22139
- return context.view(v[0], v[1], null !== (_a = v[2] + g.attribute.z) && void 0 !== _a ? _a : 0)[2];
22140
- }).reduce(function (a, b) {
22141
- return a + b;
22142
- }, 0),
22143
- g: g
22144
- };
22145
- });
22146
- zChildren.sort(function (a, b) {
22147
- return b.ave_z - a.ave_z;
22148
- }), graphic.removeAllChild(), zChildren.forEach(function (i) {
22149
- i.g._next = null, i.g._prev = null;
22150
- }), graphic.update(), zChildren.forEach(function (i) {
22151
- graphic.add(i.g);
22152
- }), drawContribution.renderGroup(graphic, drawContext, graphic.parent.globalTransMatrix, !0), graphic.removeAllChild(), _children.forEach(function (g) {
22153
- g._next = null, g._prev = null;
22154
- }), graphic.update(), _children.forEach(function (g) {
22155
- graphic.add(g);
22156
- });
22157
- } else drawContribution.renderGroup(graphic, drawContext, graphic.parent.globalTransMatrix);
22158
- } else drawContribution.renderItem(graphic, drawContext);
22159
- return context.camera = null, context.restore(), context.modelMatrix !== lastModelMatrix && mat4Allocate.free(context.modelMatrix), context.modelMatrix = lastModelMatrix, drawContext.in3dInterceptor = !1, !0;
22160
- }
22161
- }, {
22162
- key: "initCanvasCtx",
22163
- value: function initCanvasCtx(context) {
22164
- context.setTransformForCurrent();
22165
- }
22166
- }]);
22167
- return Canvas3DDrawItemInterceptor;
22168
- }();
22169
-
22170
22203
  var __decorate$1c = undefined && undefined.__decorate || function (decorators, target, key, desc) {
22171
22204
  var d,
22172
22205
  c = arguments.length,
@@ -22219,20 +22252,26 @@
22219
22252
  width = drawContext.width,
22220
22253
  height = drawContext.height;
22221
22254
  if (!context) return;
22255
+ if (drawContext.keepMatrix) {
22256
+ if (context.nativeContext && context.nativeContext.getTransform) {
22257
+ var t = context.nativeContext.getTransform();
22258
+ context.setTransformFromMatrix(t, !0, 1);
22259
+ }
22260
+ } else context.inuse = !0, context.clearMatrix(), context.setTransformForCurrent(!0);
22222
22261
  var dirtyBounds = this.dirtyBounds.setValue(0, 0, width, height);
22223
22262
  if (stage.dirtyBounds && !stage.dirtyBounds.empty()) {
22224
22263
  var b = getRectIntersect(dirtyBounds, stage.dirtyBounds, !1);
22225
22264
  dirtyBounds.x1 = Math.floor(b.x1), dirtyBounds.y1 = Math.floor(b.y1), dirtyBounds.x2 = Math.ceil(b.x2), dirtyBounds.y2 = Math.ceil(b.y2);
22226
22265
  }
22227
22266
  var d = context.dpr % 1;
22228
- (d || .5 !== d) && (dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr, dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr, dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr, dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr), this.backupDirtyBounds.copy(dirtyBounds), context.inuse = !0, context.clearMatrix(), context.setTransformForCurrent(!0);
22267
+ (d || .5 !== d) && (dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr, dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr, dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr, dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr), this.backupDirtyBounds.copy(dirtyBounds);
22229
22268
  var drawInArea = dirtyBounds.width() * context.dpr < context.canvas.width || dirtyBounds.height() * context.dpr < context.canvas.height;
22230
- context.save(), context.translate(x, y, !0), drawInArea && (context.beginPath(), context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height()), context.clip()), stage.camera && (this.dirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0), this.backupDirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0)), this.clearScreen(renderService, context, drawContext), context.save(), renderService.renderTreeRoots.sort(function (a, b) {
22269
+ context.save(), context.translate(x, y, !0), drawInArea && (context.beginPath(), context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height()), context.clip()), stage.camera && (this.dirtyBounds.clear(), this.backupDirtyBounds.clear()), this.clearScreen(renderService, context, drawContext), context.save(), renderService.renderTreeRoots.sort(function (a, b) {
22231
22270
  var _a, _b;
22232
22271
  return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
22233
22272
  }).forEach(function (group) {
22234
22273
  group.isContainer ? _this2.renderGroup(group, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0)) : _this2.renderItem(group, drawContext);
22235
- }), context.restore(), context.restore(), context.draw(), context.inuse = !1;
22274
+ }), context.restore(), context.restore(), context.draw(), drawContext.keepMatrix || (context.inuse = !1);
22236
22275
  }
22237
22276
  }, {
22238
22277
  key: "doRegister",
@@ -22290,7 +22329,7 @@
22290
22329
  }, subLayers.set(group._uid, incrementalLayer));
22291
22330
  var incrementalContext = incrementalLayer.layer.getNativeHandler().getContext(),
22292
22331
  idc = incrementalLayer.drawContribution || container.get(IncrementalDrawContribution);
22293
- idc.dirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0), idc.backupDirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0), idc.draw(this.currentRenderService, Object.assign(Object.assign({}, drawContext), {
22332
+ idc.dirtyBounds.clear(), idc.backupDirtyBounds.clear(), idc.draw(this.currentRenderService, Object.assign(Object.assign({}, drawContext), {
22294
22333
  drawContribution: idc,
22295
22334
  clear: "transparent",
22296
22335
  layer: incrementalLayer.layer,
@@ -22695,7 +22734,7 @@
22695
22734
  value: function draw(renderService, drawContext) {
22696
22735
  return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
22697
22736
  var _this2 = this;
22698
- var skipDraw, context, _drawContext$x, x, _drawContext$y, y;
22737
+ var skipDraw, context, _drawContext$x, x, _drawContext$y, y, t;
22699
22738
  return _regeneratorRuntime().wrap(function _callee$(_context) {
22700
22739
  while (1) switch (_context.prev = _context.next) {
22701
22740
  case 0:
@@ -22718,14 +22757,22 @@
22718
22757
  case 8:
22719
22758
  this.currentRenderService = renderService;
22720
22759
  context = drawContext.context, _drawContext$x = drawContext.x, x = _drawContext$x === void 0 ? 0 : _drawContext$x, _drawContext$y = drawContext.y, y = _drawContext$y === void 0 ? 0 : _drawContext$y;
22721
- context && (context.inuse = !0, context.clearMatrix(), context.setTransformForCurrent(!0), context.save(), drawContext.restartIncremental && this.clearScreen(this.currentRenderService, context, drawContext), context.translate(x, y, !0), context.save(), renderService.renderTreeRoots.sort(function (a, b) {
22722
- var _a, _b;
22723
- return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
22724
- }).forEach(function (group) {
22725
- _this2.renderGroup(group, drawContext);
22726
- }), this.hooks.completeDraw.tap("top-draw", function () {
22727
- context.restore(), context.restore(), context.draw(), context.inuse = !1, _this2.rendering = !1;
22728
- }));
22760
+ if (context) {
22761
+ if (drawContext.keepMatrix) {
22762
+ if (context.nativeContext && context.nativeContext.getTransform) {
22763
+ t = context.nativeContext.getTransform();
22764
+ context.setTransformFromMatrix(t, !0, 1);
22765
+ }
22766
+ } else context.inuse = !0, context.clearMatrix();
22767
+ context.setTransformForCurrent(!0), context.save(), drawContext.restartIncremental && this.clearScreen(this.currentRenderService, context, drawContext), context.translate(x, y, !0), context.save(), renderService.renderTreeRoots.sort(function (a, b) {
22768
+ var _a, _b;
22769
+ return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
22770
+ }).forEach(function (group) {
22771
+ _this2.renderGroup(group, drawContext);
22772
+ }), this.hooks.completeDraw.tap("top-draw", function () {
22773
+ context.restore(), context.restore(), context.draw(), drawContext.keepMatrix || (context.inuse = !1), _this2.rendering = !1;
22774
+ });
22775
+ }
22729
22776
  case 11:
22730
22777
  case "end":
22731
22778
  return _context.stop();
@@ -23000,7 +23047,7 @@
23000
23047
  DefaultIncrementalDrawContribution = __decorate$18([injectable(), __param$A(0, multiInject(GraphicRender)), __param$A(1, inject(DefaultIncrementalCanvasLineRender)), __param$A(2, inject(DefaultIncrementalCanvasAreaRender)), __param$A(3, inject(ContributionProvider)), __param$A(3, named(DrawItemInterceptor)), __metadata$T("design:paramtypes", [Array, Object, Object, Object])], DefaultIncrementalDrawContribution);
23001
23048
 
23002
23049
  var renderModule = new ContainerModule(function (bind) {
23003
- bind(DefaultBaseBackgroundRenderContribution).toSelf().inSingletonScope(), bind(DefaultBaseTextureRenderContribution).toSelf().inSingletonScope(), bind(DrawContribution).to(DefaultDrawContribution), bind(IncrementalDrawContribution).to(DefaultIncrementalDrawContribution), bind(GroupRender).to(DefaultCanvasGroupRender).inSingletonScope(), bind(GraphicRender).toService(GroupRender), bindContributionProvider(bind, GroupRenderContribution), bind(exports.DefaultBaseInteractiveRenderContribution).toSelf().inSingletonScope(), bindContributionProvider(bind, InteractiveSubRenderContribution), bindContributionProvider(bind, GraphicRender), bind(CommonDrawItemInterceptorContribution).toSelf().inSingletonScope(), bind(DrawItemInterceptor).toService(CommonDrawItemInterceptorContribution), bindContributionProvider(bind, DrawItemInterceptor);
23050
+ bind(DefaultBaseBackgroundRenderContribution).toSelf().inSingletonScope(), bind(DefaultBaseTextureRenderContribution).toSelf().inSingletonScope(), bind(DrawContribution).to(DefaultDrawContribution), bind(IncrementalDrawContribution).to(DefaultIncrementalDrawContribution), bind(GroupRender).to(DefaultCanvasGroupRender).inSingletonScope(), bind(GraphicRender).toService(GroupRender), bindContributionProvider(bind, GroupRenderContribution), bind(exports.DefaultBaseInteractiveRenderContribution).toSelf().inSingletonScope(), bindContributionProvider(bind, InteractiveSubRenderContribution), bindContributionProvider(bind, GraphicRender), bind(exports.CommonDrawItemInterceptorContribution).toSelf().inSingletonScope(), bind(DrawItemInterceptor).toService(exports.CommonDrawItemInterceptorContribution), bindContributionProvider(bind, DrawItemInterceptor);
23004
23051
  });
23005
23052
 
23006
23053
  function load(container) {
@@ -23299,13 +23346,23 @@
23299
23346
  this.name = "FlexLayoutPlugin", this.activeEvent = "onRegister", this.id = Generator.GenAutoIncrementId(), this.key = this.name + this.id, this.tempBounds = new AABBBounds();
23300
23347
  }
23301
23348
  _createClass(FlexLayoutPlugin, [{
23349
+ key: "pauseLayout",
23350
+ value: function pauseLayout(p) {
23351
+ this.pause = p;
23352
+ }
23353
+ }, {
23354
+ key: "tryLayoutChildren",
23355
+ value: function tryLayoutChildren(graphic) {
23356
+ graphic.firstChild && this.tryLayout(graphic.firstChild);
23357
+ }
23358
+ }, {
23302
23359
  key: "tryLayout",
23303
23360
  value: function tryLayout(graphic) {
23304
23361
  var _this = this;
23305
- if (this.layouting) return;
23306
- this.layouting = !0;
23362
+ var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
23363
+ if (this.pause) return;
23307
23364
  var p = graphic.parent;
23308
- if (!p || !graphic.needUpdateLayout()) return;
23365
+ if (!(force || p && graphic.needUpdateLayout())) return;
23309
23366
  var theme = getTheme(p).group,
23310
23367
  _p$attribute$display = p.attribute.display,
23311
23368
  display = _p$attribute$display === void 0 ? theme.display : _p$attribute$display;
@@ -23315,24 +23372,29 @@
23315
23372
  flexDirection = _p$attribute$flexDire === void 0 ? theme.flexDirection : _p$attribute$flexDire,
23316
23373
  _p$attribute$flexWrap = _p$attribute.flexWrap,
23317
23374
  flexWrap = _p$attribute$flexWrap === void 0 ? theme.flexWrap : _p$attribute$flexWrap,
23318
- _p$attribute$justifyC = _p$attribute.justifyContent,
23319
- justifyContent = _p$attribute$justifyC === void 0 ? theme.justifyContent : _p$attribute$justifyC,
23320
23375
  _p$attribute$alignIte = _p$attribute.alignItems,
23321
23376
  alignItems = _p$attribute$alignIte === void 0 ? theme.alignItems : _p$attribute$alignIte,
23322
- _p$attribute$alignCon = _p$attribute.alignContent,
23323
- alignContent = _p$attribute$alignCon === void 0 ? theme.alignContent : _p$attribute$alignCon,
23324
23377
  _p$attribute$clip = _p$attribute.clip,
23325
- clip = _p$attribute$clip === void 0 ? theme.clip : _p$attribute$clip;
23326
- var childrenWidth = 0,
23327
- childrenHeight = 0,
23328
- boundsLegal = 0;
23329
- if (p.forEachChildren(function (child) {
23330
- var bounds = child.AABBBounds;
23331
- "column" === flexDirection || "column-reverse" === flexDirection ? (childrenHeight += bounds.height(), childrenWidth = Math.max(childrenWidth, bounds.width())) : (childrenWidth += bounds.width(), childrenHeight = Math.max(childrenHeight, bounds.height())), boundsLegal += bounds.x1, boundsLegal += bounds.y1, boundsLegal += bounds.x2, boundsLegal += bounds.y2;
23332
- }), !isFinite(boundsLegal)) return;
23333
- var width = p.attribute.width || childrenWidth,
23334
- height = p.attribute.height || childrenHeight;
23335
- p.attribute.width || (p.attribute.width = 0), p.attribute.height || (p.attribute.height = 0), this.tempBounds.copy(p._AABBBounds);
23378
+ clip = _p$attribute$clip === void 0 ? theme.clip : _p$attribute$clip,
23379
+ _p$attribute$alignCon = p.attribute.alignContent,
23380
+ alignContent = _p$attribute$alignCon === void 0 ? null != alignItems ? alignItems : theme.alignContent : _p$attribute$alignCon;
23381
+ var _p$attribute2 = p.attribute,
23382
+ width = _p$attribute2.width,
23383
+ height = _p$attribute2.height,
23384
+ _p$attribute2$justify = _p$attribute2.justifyContent,
23385
+ justifyContent = _p$attribute2$justify === void 0 ? theme.justifyContent : _p$attribute2$justify;
23386
+ var children = p.getChildren();
23387
+ if (null == width || null == height) {
23388
+ var childrenWidth = 0,
23389
+ childrenHeight = 0,
23390
+ boundsLegal = 0;
23391
+ if (children.forEach(function (child) {
23392
+ var bounds = _this.getAABBBounds(child);
23393
+ bounds.empty() || ("column" === flexDirection || "column-reverse" === flexDirection ? (childrenHeight += bounds.height(), childrenWidth = Math.max(childrenWidth, bounds.width())) : (childrenWidth += bounds.width(), childrenHeight = Math.max(childrenHeight, bounds.height())), boundsLegal += bounds.x1, boundsLegal += bounds.y1, boundsLegal += bounds.x2, boundsLegal += bounds.y2);
23394
+ }), !isFinite(boundsLegal)) return;
23395
+ width = childrenWidth, height = childrenHeight;
23396
+ }
23397
+ p.attribute.width = width, p.attribute.height = height, this.tempBounds.copy(p._AABBBounds);
23336
23398
  var result = {
23337
23399
  main: {
23338
23400
  len: width,
@@ -23341,18 +23403,18 @@
23341
23403
  cross: {
23342
23404
  len: height,
23343
23405
  field: "y"
23344
- },
23345
- dir: 1
23406
+ }
23346
23407
  },
23347
23408
  main = result.main,
23348
23409
  cross = result.cross;
23349
- "row-reverse" === flexDirection ? result.dir = -1 : "column" === flexDirection ? (main.len = height, cross.len = width, main.field = "y", cross.field = "x") : "column-reverse" === flexDirection && (main.len = height, cross.len = width, main.field = "y", cross.field = "x", result.dir = -1);
23410
+ "column" !== flexDirection && "column-reverse" !== flexDirection || (main.len = height, cross.len = width, main.field = "y", cross.field = "x"), "row-reverse" !== flexDirection && "column-reverse" !== flexDirection || ("flex-start" === justifyContent ? justifyContent = "flex-end" : "flex-end" === justifyContent ? justifyContent = "flex-start" : children.reverse());
23350
23411
  var mainLen = 0,
23351
23412
  crossLen = 0;
23352
23413
  var mianLenArray = [];
23353
- p.forEachChildren(function (c) {
23354
- var b = c.AABBBounds,
23355
- ml = "x" === main.field ? b.width() : b.height(),
23414
+ children.forEach(function (c) {
23415
+ var b = _this.getAABBBounds(c);
23416
+ if (b.empty()) return;
23417
+ var ml = "x" === main.field ? b.width() : b.height(),
23356
23418
  cl = "x" === cross.field ? b.width() : b.height();
23357
23419
  mianLenArray.push({
23358
23420
  mainLen: ml,
@@ -23385,104 +23447,171 @@
23385
23447
  mainLen: mainLen,
23386
23448
  crossLen: crossLen
23387
23449
  });
23388
- var children = p.getChildren();
23389
23450
  var lastIdx = 0;
23390
23451
  if (mainList.forEach(function (s) {
23391
23452
  _this.layoutMain(p, children, justifyContent, main, mianLenArray, lastIdx, s), lastIdx = s.idx + 1;
23392
23453
  }), crossLen = mainList.reduce(function (a, b) {
23393
23454
  return a + b.crossLen;
23394
23455
  }, 0), 1 === mainList.length) {
23395
- if ("flex-end" === alignItems) {
23396
- var anchorPos = cross.len;
23397
- this.layoutCross(children, alignItems, cross, anchorPos, mianLenArray, mainList[0], 0);
23398
- } else if ("center" === alignItems) {
23399
- var _anchorPos = cross.len / 2;
23400
- this.layoutCross(children, alignItems, cross, _anchorPos, mianLenArray, mainList[0], 0);
23401
- } else children.forEach(function (child) {
23402
- child.attribute[cross.field] = getPadding(child, cross.field);
23403
- });
23456
+ var anchorPosMap = {
23457
+ "flex-start": 0,
23458
+ "flex-end": cross.len,
23459
+ center: cross.len / 2
23460
+ };
23461
+ this.layoutCross(children, alignItems, cross, anchorPosMap, mianLenArray, mainList[0], 0);
23404
23462
  } else if ("flex-start" === alignContent) {
23405
23463
  lastIdx = 0;
23406
- var _anchorPos2 = 0;
23464
+ var anchorPos = 0;
23407
23465
  mainList.forEach(function (s, i) {
23408
- _this.layoutCross(children, "flex-start", cross, _anchorPos2, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, _anchorPos2 += s.crossLen;
23466
+ var anchorPosMap = {
23467
+ "flex-start": anchorPos,
23468
+ "flex-end": anchorPos + s.crossLen,
23469
+ center: anchorPos + s.crossLen / 2
23470
+ };
23471
+ _this.layoutCross(children, "flex-start", cross, anchorPosMap, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, anchorPos += s.crossLen;
23409
23472
  });
23410
23473
  } else if ("center" === alignContent) {
23411
23474
  lastIdx = 0;
23412
- var _anchorPos3 = Math.max(0, (cross.len - crossLen) / 2);
23475
+ var _anchorPos = Math.max(0, (cross.len - crossLen) / 2);
23413
23476
  mainList.forEach(function (s, i) {
23414
- _this.layoutCross(children, "center", cross, _anchorPos3 + s.crossLen / 2, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, _anchorPos3 += s.crossLen;
23477
+ var anchorPosMap = {
23478
+ "flex-start": _anchorPos,
23479
+ "flex-end": _anchorPos + s.crossLen,
23480
+ center: _anchorPos + s.crossLen / 2
23481
+ };
23482
+ _this.layoutCross(children, "center", cross, anchorPosMap, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, _anchorPos += s.crossLen;
23415
23483
  });
23416
23484
  } else if ("space-around" === alignContent) {
23417
23485
  lastIdx = 0;
23418
23486
  var padding = Math.max(0, (cross.len - crossLen) / mainList.length / 2);
23419
- var _anchorPos4 = padding;
23487
+ var _anchorPos2 = padding;
23420
23488
  mainList.forEach(function (s, i) {
23421
- _this.layoutCross(children, "flex-start", cross, _anchorPos4, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, _anchorPos4 += s.crossLen + 2 * padding;
23489
+ var anchorPosMap = {
23490
+ "flex-start": _anchorPos2,
23491
+ "flex-end": _anchorPos2 + s.crossLen,
23492
+ center: _anchorPos2 + s.crossLen / 2
23493
+ };
23494
+ _this.layoutCross(children, "flex-start", cross, anchorPosMap, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, _anchorPos2 += s.crossLen + 2 * padding;
23422
23495
  });
23423
23496
  } else if ("space-between" === alignContent) {
23424
23497
  lastIdx = 0;
23425
23498
  var _padding = Math.max(0, (cross.len - crossLen) / (2 * mainList.length - 2));
23426
- var _anchorPos5 = 0;
23499
+ var _anchorPos3 = 0;
23427
23500
  mainList.forEach(function (s, i) {
23428
- _this.layoutCross(children, "flex-start", cross, _anchorPos5, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, _anchorPos5 += s.crossLen + 2 * _padding;
23501
+ var anchorPosMap = {
23502
+ "flex-start": _anchorPos3,
23503
+ "flex-end": _anchorPos3 + s.crossLen,
23504
+ center: _anchorPos3 + s.crossLen / 2
23505
+ };
23506
+ _this.layoutCross(children, "flex-start", cross, anchorPosMap, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, _anchorPos3 += s.crossLen + 2 * _padding;
23429
23507
  });
23430
23508
  }
23431
23509
  children.forEach(function (child, idx) {
23432
23510
  child.addUpdateBoundTag(), child.addUpdatePositionTag(), child.clearUpdateLayoutTag();
23433
- }), p.addUpdateLayoutTag(), clip || this.tempBounds.equals(p.AABBBounds) || (this.tryLayout(p), this.layouting = !1);
23511
+ }), p.addUpdateLayoutTag();
23512
+ var b = this.getAABBBounds(p);
23513
+ clip || this.tempBounds.equals(b) || this.tryLayout(p, !1);
23514
+ }
23515
+ }, {
23516
+ key: "getAABBBounds",
23517
+ value: function getAABBBounds(graphic) {
23518
+ this.skipBoundsTrigger = !0;
23519
+ var b = graphic.AABBBounds;
23520
+ return this.skipBoundsTrigger = !1, b;
23521
+ }
23522
+ }, {
23523
+ key: "updateChildPos",
23524
+ value: function updateChildPos(posBaseLeftTop, lastP, lastBP) {
23525
+ return posBaseLeftTop + (null != lastP ? lastP : 0) - lastBP;
23434
23526
  }
23435
23527
  }, {
23436
23528
  key: "layoutMain",
23437
23529
  value: function layoutMain(p, children, justifyContent, main, mianLenArray, lastIdx, currSeg) {
23438
23530
  if ("flex-start" === justifyContent) {
23439
23531
  var pos = 0;
23440
- for (var i = lastIdx; i <= currSeg.idx; i++) children[i].attribute[main.field] = pos + getPadding(children[i], main.field), pos += mianLenArray[i].mainLen;
23532
+ for (var i = lastIdx; i <= currSeg.idx; i++) {
23533
+ var posBaseLeftTop = pos + getPadding(children[i], main.field),
23534
+ b = this.getAABBBounds(children[i]);
23535
+ !b.empty() && (children[i].attribute[main.field] = this.updateChildPos(posBaseLeftTop, children[i].attribute[main.field], b["".concat(main.field, "1")])), pos += mianLenArray[i].mainLen;
23536
+ }
23441
23537
  } else if ("flex-end" === justifyContent) {
23442
23538
  var _pos = main.len;
23443
- for (var _i = lastIdx; _i <= currSeg.idx; _i++) _pos -= mianLenArray[_i].mainLen, children[_i].attribute[main.field] = _pos + getPadding(children[_i], main.field);
23539
+ for (var _i = lastIdx; _i <= currSeg.idx; _i++) {
23540
+ _pos -= mianLenArray[_i].mainLen;
23541
+ var _posBaseLeftTop = _pos + getPadding(children[_i], main.field),
23542
+ _b = this.getAABBBounds(children[_i]);
23543
+ !_b.empty() && (children[_i].attribute[main.field] = this.updateChildPos(_posBaseLeftTop, children[_i].attribute[main.field], _b["".concat(main.field, "1")]));
23544
+ }
23444
23545
  } else if ("space-around" === justifyContent) {
23445
23546
  if (currSeg.mainLen >= main.len) {
23446
23547
  var _pos2 = 0;
23447
- for (var _i2 = lastIdx; _i2 <= currSeg.idx; _i2++) children[_i2].attribute[main.field] = _pos2 + getPadding(children[_i2], main.field), _pos2 += mianLenArray[_i2].mainLen;
23548
+ for (var _i2 = lastIdx; _i2 <= currSeg.idx; _i2++) {
23549
+ var _posBaseLeftTop2 = _pos2 + getPadding(children[_i2], main.field),
23550
+ _b2 = this.getAABBBounds(children[_i2]);
23551
+ !_b2.empty() && (children[_i2].attribute[main.field] = this.updateChildPos(_posBaseLeftTop2, children[_i2].attribute[main.field], _b2["".concat(main.field, "1")])), _pos2 += mianLenArray[_i2].mainLen;
23552
+ }
23448
23553
  } else {
23449
23554
  var size = currSeg.idx - lastIdx + 1,
23450
23555
  padding = (main.len - currSeg.mainLen) / size / 2;
23451
23556
  var _pos3 = padding;
23452
- for (var _i3 = lastIdx; _i3 <= currSeg.idx; _i3++) children[_i3].attribute[main.field] = _pos3 + getPadding(children[_i3], main.field), _pos3 += mianLenArray[_i3].mainLen + 2 * padding;
23557
+ for (var _i3 = lastIdx; _i3 <= currSeg.idx; _i3++) {
23558
+ var _posBaseLeftTop3 = _pos3 + getPadding(children[_i3], main.field),
23559
+ _b3 = this.getAABBBounds(children[_i3]);
23560
+ !_b3.empty() && (children[_i3].attribute[main.field] = this.updateChildPos(_posBaseLeftTop3, children[_i3].attribute[main.field], _b3["".concat(main.field, "1")])), _pos3 += mianLenArray[_i3].mainLen + 2 * padding;
23561
+ }
23453
23562
  }
23454
23563
  } else if ("space-between" === justifyContent) {
23455
23564
  if (currSeg.mainLen >= main.len) {
23456
23565
  var _pos4 = 0;
23457
- for (var _i4 = lastIdx; _i4 <= currSeg.idx; _i4++) children[_i4].attribute[main.field] = _pos4 + getPadding(children[_i4], main.field), _pos4 += mianLenArray[_i4].mainLen;
23566
+ for (var _i4 = lastIdx; _i4 <= currSeg.idx; _i4++) {
23567
+ var _posBaseLeftTop4 = _pos4 + getPadding(children[_i4], main.field),
23568
+ _b4 = this.getAABBBounds(children[_i4]);
23569
+ !_b4.empty() && (children[_i4].attribute[main.field] = this.updateChildPos(_posBaseLeftTop4, children[_i4].attribute[main.field], _b4["".concat(main.field, "1")])), _pos4 += mianLenArray[_i4].mainLen;
23570
+ }
23458
23571
  } else {
23459
23572
  var _size = currSeg.idx - lastIdx + 1,
23460
23573
  _padding2 = (main.len - currSeg.mainLen) / (2 * _size - 2);
23461
23574
  var _pos5 = 0;
23462
- for (var _i5 = lastIdx; _i5 <= currSeg.idx; _i5++) children[_i5].attribute[main.field] = _pos5 + getPadding(children[_i5], main.field), _pos5 += mianLenArray[_i5].mainLen + 2 * _padding2;
23575
+ for (var _i5 = lastIdx; _i5 <= currSeg.idx; _i5++) {
23576
+ var _posBaseLeftTop5 = _pos5 + getPadding(children[_i5], main.field),
23577
+ _b5 = this.getAABBBounds(children[_i5]);
23578
+ !_b5.empty() && (children[_i5].attribute[main.field] = this.updateChildPos(_posBaseLeftTop5, children[_i5].attribute[main.field], _b5["".concat(main.field, "1")])), _pos5 += mianLenArray[_i5].mainLen + 2 * _padding2;
23579
+ }
23463
23580
  }
23464
23581
  } else if ("center" === justifyContent) {
23465
23582
  var _pos6 = (main.len - currSeg.mainLen) / 2;
23466
- for (var _i6 = lastIdx; _i6 <= currSeg.idx; _i6++) children[_i6].attribute[main.field] = _pos6 + getPadding(children[_i6], main.field), _pos6 += mianLenArray[_i6].mainLen;
23583
+ for (var _i6 = lastIdx; _i6 <= currSeg.idx; _i6++) {
23584
+ var _posBaseLeftTop6 = _pos6 + getPadding(children[_i6], main.field),
23585
+ _b6 = this.getAABBBounds(children[_i6]);
23586
+ !_b6.empty() && (children[_i6].attribute[main.field] = this.updateChildPos(_posBaseLeftTop6, children[_i6].attribute[main.field], _b6["".concat(main.field, "1")])), _pos6 += mianLenArray[_i6].mainLen;
23587
+ }
23467
23588
  }
23468
23589
  }
23469
23590
  }, {
23470
23591
  key: "layoutCross",
23471
- value: function layoutCross(children, alignItem, cross, anchorPos, lenArray, currSeg, lastIdx) {
23472
- if ("flex-end" === alignItem) for (var i = lastIdx; i <= currSeg.idx; i++) children[i].attribute[cross.field] = anchorPos - lenArray[i].crossLen + getPadding(children[i], cross.field);else if ("center" === alignItem) for (var _i7 = lastIdx; _i7 <= currSeg.idx; _i7++) children[_i7].attribute[cross.field] = anchorPos - lenArray[_i7].crossLen / 2 + getPadding(children[_i7], cross.field);else for (var _i8 = lastIdx; _i8 <= currSeg.idx; _i8++) children[_i8].attribute[cross.field] = anchorPos + getPadding(children[_i8], cross.field);
23592
+ value: function layoutCross(children, alignItem, cross, anchorPosMap, lenArray, currSeg, lastIdx) {
23593
+ var _a;
23594
+ for (var i = lastIdx; i <= currSeg.idx; i++) {
23595
+ var child = children[i];
23596
+ var alignSelf = child.attribute.alignSelf;
23597
+ alignSelf && "auto" !== alignSelf || (alignSelf = alignItem);
23598
+ var b = this.getAABBBounds(child),
23599
+ anchorPos = null !== (_a = anchorPosMap[alignSelf]) && void 0 !== _a ? _a : anchorPosMap["flex-start"];
23600
+ "flex-end" === alignSelf ? !b.empty() && (child.attribute[cross.field] = this.updateChildPos(anchorPos - lenArray[i].crossLen + getPadding(child, cross.field), child.attribute[cross.field], b["".concat(cross.field, "1")])) : "center" === alignSelf ? !b.empty() && (child.attribute[cross.field] = this.updateChildPos(anchorPos - lenArray[i].crossLen / 2 + getPadding(child, cross.field), child.attribute[cross.field], b["".concat(cross.field, "1")])) : !b.empty() && (child.attribute[cross.field] = this.updateChildPos(anchorPos + getPadding(child, cross.field), child.attribute[cross.field], b["".concat(cross.field, "1")]));
23601
+ }
23473
23602
  }
23474
23603
  }, {
23475
23604
  key: "activate",
23476
23605
  value: function activate(context) {
23477
23606
  var _this2 = this;
23478
23607
  this.pluginService = context, application.graphicService.hooks.onAttributeUpdate.tap(this.key, function (graphic) {
23479
- graphic.glyphHost && (graphic = graphic.glyphHost), _this2.tryLayout(graphic), _this2.layouting = !1;
23608
+ graphic.glyphHost && (graphic = graphic.glyphHost), graphic.stage && graphic.stage === _this2.pluginService.stage && _this2.tryLayout(graphic, !1);
23480
23609
  }), application.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key, function (graphic, stage, willUpdate, bounds) {
23481
- graphic.glyphHost && (graphic = graphic.glyphHost), stage && stage === _this2.pluginService.stage && graphic.isContainer && _tempBounds.copy(bounds);
23610
+ graphic.glyphHost && (graphic = graphic.glyphHost), stage && stage === _this2.pluginService.stage && graphic.isContainer && !_this2.skipBoundsTrigger && _tempBounds.copy(bounds);
23482
23611
  }), application.graphicService.hooks.afterUpdateAABBBounds.tap(this.key, function (graphic, stage, bounds, params, selfChange) {
23483
- stage && stage === _this2.pluginService.stage && graphic.isContainer && (_tempBounds.equals(bounds) || (_this2.tryLayout(graphic), _this2.layouting = !1));
23612
+ stage && stage === _this2.pluginService.stage && graphic.isContainer && !_this2.skipBoundsTrigger && (_tempBounds.equals(bounds) || _this2.tryLayout(graphic, !1));
23484
23613
  }), application.graphicService.hooks.onSetStage.tap(this.key, function (graphic) {
23485
- graphic.glyphHost && (graphic = graphic.glyphHost), _this2.tryLayout(graphic), _this2.layouting = !1;
23614
+ graphic.glyphHost && (graphic = graphic.glyphHost), _this2.tryLayout(graphic, !1);
23486
23615
  });
23487
23616
  }
23488
23617
  }, {
@@ -23491,6 +23620,10 @@
23491
23620
  var _this3 = this;
23492
23621
  application.graphicService.hooks.onAttributeUpdate.taps = application.graphicService.hooks.onAttributeUpdate.taps.filter(function (item) {
23493
23622
  return item.name !== _this3.key;
23623
+ }), application.graphicService.hooks.beforeUpdateAABBBounds.taps = application.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(function (item) {
23624
+ return item.name !== _this3.key;
23625
+ }), application.graphicService.hooks.afterUpdateAABBBounds.taps = application.graphicService.hooks.afterUpdateAABBBounds.taps.filter(function (item) {
23626
+ return item.name !== _this3.key;
23494
23627
  }), application.graphicService.hooks.onSetStage.taps = application.graphicService.hooks.onSetStage.taps.filter(function (item) {
23495
23628
  return item.name !== _this3.key;
23496
23629
  });
@@ -23499,11 +23632,7 @@
23499
23632
  return FlexLayoutPlugin;
23500
23633
  }();
23501
23634
  function getPadding(graphic, field) {
23502
- if (!graphic.attribute.boundsPadding) return 0;
23503
- if (isNumber(graphic.attribute.boundsPadding)) return graphic.attribute.boundsPadding;
23504
- if (isArray$1(graphic.attribute.boundsPadding) && 1 === graphic.attribute.boundsPadding.length) return graphic.attribute.boundsPadding[0];
23505
- var paddingArray = parsePadding(graphic.attribute.boundsPadding);
23506
- return "x" === field ? paddingArray[3] : "y" === field ? paddingArray[0] : 0;
23635
+ return 0;
23507
23636
  }
23508
23637
 
23509
23638
  var defaultTicker = new DefaultTicker();
@@ -24027,6 +24156,11 @@
24027
24156
  _this7.pluginService.unRegister(plugin);
24028
24157
  }));
24029
24158
  }
24159
+ }, {
24160
+ key: "getPluginsByName",
24161
+ value: function getPluginsByName(name) {
24162
+ return this.pluginService.findPluginsByName(name);
24163
+ }
24030
24164
  }, {
24031
24165
  key: "tryUpdateAABBBounds",
24032
24166
  value: function tryUpdateAABBBounds() {
@@ -24077,7 +24211,7 @@
24077
24211
  value: function render(layers, params) {
24078
24212
  this.ticker.start(), this.timeline.resume();
24079
24213
  var state = this.state;
24080
- this.state = "rendering", this.layerService.prepareStageLayer(this), this._skipRender || (this.lastRenderparams = params, this.hooks.beforeRender.call(this), this.renderLayerList(this.children), this.combineLayersToWindow(), this.nextFrameRenderLayerSet.clear(), this.hooks.afterRender.call(this)), this.state = state, this._skipRender && this._skipRender++;
24214
+ this.state = "rendering", this.layerService.prepareStageLayer(this), this._skipRender || (this.lastRenderparams = params, this.hooks.beforeRender.call(this), this.renderLayerList(this.children, params), this.combineLayersToWindow(), this.nextFrameRenderLayerSet.clear(), this.hooks.afterRender.call(this)), this.state = state, this._skipRender && this._skipRender++;
24081
24215
  }
24082
24216
  }, {
24083
24217
  key: "combineLayersToWindow",
@@ -24114,7 +24248,8 @@
24114
24248
  background: layer === _this10.defaultLayer ? _this10.background : void 0,
24115
24249
  updateBounds: !(!_this10.dirtyBounds || _this10.dirtyBounds.empty())
24116
24250
  }, Object.assign({
24117
- renderStyle: _this10.renderStyle
24251
+ renderStyle: _this10.renderStyle,
24252
+ keepMatrix: _this10.params.renderKeepMatrix
24118
24253
  }, params)));
24119
24254
  }), this.interactiveLayer && !layerList.includes(this.interactiveLayer) && this.interactiveLayer.render({
24120
24255
  renderService: this.renderService,
@@ -25016,11 +25151,17 @@
25016
25151
  if (!params.bounds.contains(point.x, point.y)) return result;
25017
25152
  offsetX = params.bounds.x1, offsetY = params.bounds.y1;
25018
25153
  }
25019
- this.pickContext && (this.pickContext.inuse = !0), params.pickContext = this.pickContext, this.pickContext && this.pickContext.clearMatrix(!0, 1);
25154
+ if (this.pickContext) if (params.keepMatrix) {
25155
+ if (this.pickContext.nativeContext && this.pickContext.nativeContext.getTransform) {
25156
+ var t = this.pickContext.nativeContext.getTransform();
25157
+ this.pickContext.setTransformFromMatrix(t, !0, 1);
25158
+ }
25159
+ } else this.pickContext.inuse = !0, this.pickContext.clearMatrix(!0, 1);
25160
+ params.pickContext = this.pickContext;
25020
25161
  var parentMatrix = new Matrix(1, 0, 0, 1, offsetX, offsetY);
25021
25162
  var group;
25022
25163
  for (var i = graphics.length - 1; i >= 0 && (result = graphics[i].isContainer ? this.pickGroup(graphics[i], point, parentMatrix, params) : this.pickItem(graphics[i], point, parentMatrix, params), !result.graphic); i--) group || (group = result.group);
25023
- if (result.graphic || (result.group = group), this.pickContext && (this.pickContext.inuse = !1), result.graphic) {
25164
+ if (result.graphic || (result.group = group), this.pickContext && !params.keepMatrix && (this.pickContext.inuse = !1), result.graphic) {
25024
25165
  var g = result.graphic;
25025
25166
  for (; g.parent;) g = g.parent;
25026
25167
  g.shadowHost && (result.params = {
@@ -28929,9 +29070,9 @@
28929
29070
  }
28930
29071
  children.length && flatten(1 === children.length ? children[0] : children, childrenList);
28931
29072
  var g = "Group" === c.name ? new c(attribute) : c(config);
28932
- return parseToGraphic(g, childrenList, props), stateProxy && (g.stateProxy = stateProxy), g;
29073
+ return parseToGraphic$1(g, childrenList, props), stateProxy && (g.stateProxy = stateProxy), g;
28933
29074
  }
28934
- function parseToGraphic(g, childrenList, props) {
29075
+ function parseToGraphic$1(g, childrenList, props) {
28935
29076
  var out,
28936
29077
  isGraphic = !1;
28937
29078
  switch (g.type) {
@@ -28957,6 +29098,47 @@
28957
29098
  }
28958
29099
  var Fragment = Group;
28959
29100
 
29101
+ function decodeReactDom(dom) {
29102
+ if (!dom || !dom.$$typeof) return dom;
29103
+ var type = dom.type,
29104
+ _dom$props = dom.props,
29105
+ attribute = _dom$props.attribute,
29106
+ children = _dom$props.children,
29107
+ stateProxy = _dom$props.stateProxy,
29108
+ g = type({
29109
+ attribute: attribute
29110
+ }),
29111
+ out = parseToGraphic(g, dom.props, children);
29112
+ return out || (stateProxy && (g.stateProxy = stateProxy), g.id = attribute.id, g.name = attribute.name, isArray$1(children) ? children.forEach(function (item) {
29113
+ var c = decodeReactDom(item);
29114
+ c && c.type && g.add(c);
29115
+ }) : children && g.add(decodeReactDom(children)), g);
29116
+ }
29117
+ function parseToGraphic(g, props, childrenList) {
29118
+ var out,
29119
+ isGraphic = !1;
29120
+ switch (g.type) {
29121
+ case "richtext":
29122
+ break;
29123
+ case "rich/text":
29124
+ out = g.attribute || {}, childrenList && (out.text = childrenList), g.attribute = out;
29125
+ break;
29126
+ case "rich/image":
29127
+ out = g.attribute || {};
29128
+ break;
29129
+ default:
29130
+ isGraphic = !0;
29131
+ }
29132
+ return isGraphic ? Object.keys(props).forEach(function (k) {
29133
+ var en = REACT_TO_CANOPUS_EVENTS[k];
29134
+ en && g.on(en, props[k]);
29135
+ }) : "richtext" === g.type && (g.attribute.textConfig = childrenList.map(function (item) {
29136
+ return decodeReactDom(item);
29137
+ }).filter(function (item) {
29138
+ return item;
29139
+ })), out;
29140
+ }
29141
+
28960
29142
  var DragNDrop = /*#__PURE__*/function () {
28961
29143
  function DragNDrop(rootNode) {
28962
29144
  var _this = this;
@@ -33408,7 +33590,7 @@
33408
33590
  x += _point.x, y += _point.y, pickContext.setTransformForCurrent();
33409
33591
  } else x = 0, y = 0, onlyTranslate = !1, pickContext.transformFromMatrix(rect.transMatrix, !0);
33410
33592
  var picked = !0;
33411
- if (!onlyTranslate || rect.shadowRoot || isNumber$2(cornerRadius, !0) && 0 !== cornerRadius || isArray$1(cornerRadius) && cornerRadius.some(function (num) {
33593
+ if (!onlyTranslate || rect.shadowRoot || isNumber$1(cornerRadius, !0) && 0 !== cornerRadius || isArray$1(cornerRadius) && cornerRadius.some(function (num) {
33412
33594
  return 0 !== num;
33413
33595
  })) picked = !1, this.canvasRenderer.drawShape(rect, pickContext, x, y, {}, null, function (context, rectAttribute, themeAttribute) {
33414
33596
  return !!picked || (picked = context.isPointInPath(point.x, point.y), picked);
@@ -33486,7 +33668,7 @@
33486
33668
  x += _point.x, y += _point.y, pickContext.setTransformForCurrent();
33487
33669
  } else x = 0, y = 0, onlyTranslate = !1, pickContext.transformFromMatrix(rect.transMatrix, !0);
33488
33670
  var picked = !0;
33489
- if (!onlyTranslate || isNumber$2(cornerRadius, !0) && 0 !== cornerRadius || isArray$1(cornerRadius) && cornerRadius.some(function (num) {
33671
+ if (!onlyTranslate || isNumber$1(cornerRadius, !0) && 0 !== cornerRadius || isArray$1(cornerRadius) && cornerRadius.some(function (num) {
33490
33672
  return 0 !== num;
33491
33673
  })) picked = !1, this.canvasRenderer.drawShape(rect, pickContext, x, y, {}, null, function (context, rectAttribute, themeAttribute) {
33492
33674
  return !!picked || (picked = context.isPointInPath(point.x, point.y), picked);
@@ -34853,7 +35035,7 @@
34853
35035
 
34854
35036
  var roughModule = _roughModule;
34855
35037
 
34856
- const version = "0.17.19";
35038
+ const version = "0.17.20-alpha.2";
34857
35039
  preLoadAllModule();
34858
35040
  if (isBrowserEnv()) {
34859
35041
  loadBrowserEnv(container);
@@ -34904,6 +35086,7 @@
34904
35086
  exports.BoundsContext = BoundsContext;
34905
35087
  exports.BoundsPicker = BoundsPicker;
34906
35088
  exports.CIRCLE_NUMBER_TYPE = CIRCLE_NUMBER_TYPE;
35089
+ exports.Canvas3DDrawItemInterceptor = Canvas3DDrawItemInterceptor;
34907
35090
  exports.CanvasFactory = CanvasFactory;
34908
35091
  exports.CanvasTextLayout = CanvasTextLayout;
34909
35092
  exports.CbAnimate = CbAnimate;
@@ -34925,6 +35108,7 @@
34925
35108
  exports.CustomEvent = CustomEvent;
34926
35109
  exports.CustomPath2D = CustomPath2D;
34927
35110
  exports.CustomSymbolClass = CustomSymbolClass;
35111
+ exports.DebugDrawItemInterceptorContribution = DebugDrawItemInterceptorContribution;
34928
35112
  exports.DefaultArcAllocate = DefaultArcAllocate;
34929
35113
  exports.DefaultArcAttribute = DefaultArcAttribute;
34930
35114
  exports.DefaultArcRenderContribution = DefaultArcRenderContribution;
@@ -34978,6 +35162,7 @@
34978
35162
  exports.DefaultTransform = DefaultTransform;
34979
35163
  exports.DragNDrop = DragNDrop;
34980
35164
  exports.DrawContribution = DrawContribution;
35165
+ exports.DrawItemInterceptor = DrawItemInterceptor;
34981
35166
  exports.DynamicLayerHandlerContribution = DynamicLayerHandlerContribution;
34982
35167
  exports.EnvContribution = EnvContribution;
34983
35168
  exports.EventManager = EventManager;
@@ -35016,6 +35201,7 @@
35016
35201
  exports.IncreaseCount = IncreaseCount;
35017
35202
  exports.IncrementalDrawContribution = IncrementalDrawContribution;
35018
35203
  exports.InputText = InputText;
35204
+ exports.InteractiveDrawItemInterceptorContribution = InteractiveDrawItemInterceptorContribution;
35019
35205
  exports.InteractiveSubRenderContribution = InteractiveSubRenderContribution;
35020
35206
  exports.LINE_NUMBER_TYPE = LINE_NUMBER_TYPE;
35021
35207
  exports.Layer = Layer;
@@ -35077,6 +35263,7 @@
35077
35263
  exports.SYMBOL_NUMBER_TYPE = SYMBOL_NUMBER_TYPE;
35078
35264
  exports.SegContext = SegContext;
35079
35265
  exports.ShadowRoot = ShadowRoot;
35266
+ exports.ShadowRootDrawItemInterceptorContribution = ShadowRootDrawItemInterceptorContribution;
35080
35267
  exports.Stage = Stage;
35081
35268
  exports.StaticLayerHandlerContribution = StaticLayerHandlerContribution;
35082
35269
  exports.Step = Step$1;
@@ -35183,6 +35370,7 @@
35183
35370
  exports.cubicLength = cubicLength;
35184
35371
  exports.cubicPointAt = cubicPointAt;
35185
35372
  exports.cubicSubdivide = cubicSubdivide;
35373
+ exports.decodeReactDom = decodeReactDom;
35186
35374
  exports.defaultArcAllocate = defaultArcAllocate;
35187
35375
  exports.defaultArcBackgroundRenderContribution = defaultArcBackgroundRenderContribution;
35188
35376
  exports.defaultArcRenderContribution = defaultArcRenderContribution;