@visactor/vrender 0.17.18-alpha.1 → 0.17.18

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
@@ -5158,6 +5158,7 @@
5158
5158
  var DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({
5159
5159
  opacity: 1,
5160
5160
  background: null,
5161
+ backgroundCornerRadius: 0,
5161
5162
  texture: null,
5162
5163
  textureColor: "black",
5163
5164
  textureSize: 10,
@@ -6976,10 +6977,7 @@
6976
6977
  value: function removeAllChild() {
6977
6978
  if (!this._idMap) return;
6978
6979
  var child = this._firstChild;
6979
- for (; child;) {
6980
- var next = child._next;
6981
- child.parent = null, child._prev = null, child._next = null, child = next;
6982
- }
6980
+ for (; child;) child.parent = null, child._prev = null, child._next = null, child = child._next;
6983
6981
  this._firstChild = null, this._lastChild = null, this._idMap.clear(), this._structEdit = !0, this.setCount(1 - this._count);
6984
6982
  }
6985
6983
  }, {
@@ -11363,7 +11361,15 @@
11363
11361
  var data = ResourceLoader.cache.get(url);
11364
11362
  data ? "fail" === data.loadState ? application.global.getRequestAnimationFrame()(function () {
11365
11363
  mark.imageLoadFail(url);
11366
- }) : "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);
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)));
11367
11373
  }
11368
11374
  }, {
11369
11375
  key: "GetSvg",
@@ -11397,68 +11403,10 @@
11397
11403
  return data.data;
11398
11404
  }));
11399
11405
  }
11400
- }, {
11401
- key: "loading",
11402
- value: function loading() {
11403
- setTimeout(function () {
11404
- if (!ResourceLoader.isLoading && ResourceLoader.toLoadAueue.length) {
11405
- ResourceLoader.isLoading = !0;
11406
- var tasks = ResourceLoader.toLoadAueue.splice(0, 10),
11407
- promises = [];
11408
- tasks.forEach(function (task) {
11409
- var url = task.url,
11410
- marks = task.marks,
11411
- data = {
11412
- type: "image",
11413
- loadState: "init"
11414
- };
11415
- if (ResourceLoader.cache.set(url, data), data.dataPromise = application.global.loadImage(url), data.dataPromise) {
11416
- data.waitingMark = marks;
11417
- var end = data.dataPromise.then(function (res) {
11418
- var _a;
11419
- 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) {
11420
- (null == res ? void 0 : res.data) ? (data.loadState = "success", data.data = res.data, mark.imageLoadSuccess(url, res.data)) : (data.loadState = "fail", mark.imageLoadFail(url));
11421
- });
11422
- });
11423
- promises.push(end);
11424
- } else data.loadState = "fail", marks.forEach(function (mark) {
11425
- return mark.imageLoadFail(url);
11426
- });
11427
- }), Promise.all(promises).then(function () {
11428
- ResourceLoader.isLoading = !1, ResourceLoader.loading();
11429
- })["catch"](function (error) {
11430
- console.error(error), ResourceLoader.isLoading = !1, ResourceLoader.loading();
11431
- });
11432
- }
11433
- }, 0);
11434
- }
11435
- }, {
11436
- key: "loadImage",
11437
- value: function loadImage(url, mark) {
11438
- var index = getIndex(url, ResourceLoader.toLoadAueue);
11439
- if (-1 !== index) return ResourceLoader.toLoadAueue[index].marks.push(mark), void ResourceLoader.loading();
11440
- ResourceLoader.toLoadAueue.push({
11441
- url: url,
11442
- marks: [mark]
11443
- }), ResourceLoader.loading();
11444
- }
11445
- }, {
11446
- key: "improveImageLoading",
11447
- value: function improveImageLoading(url) {
11448
- var index = getIndex(url, ResourceLoader.toLoadAueue);
11449
- if (-1 !== index) {
11450
- var elememt = ResourceLoader.toLoadAueue.splice(index, 1);
11451
- ResourceLoader.toLoadAueue.unshift(elememt[0]);
11452
- }
11453
- }
11454
11406
  }]);
11455
11407
  return ResourceLoader;
11456
11408
  }();
11457
- function getIndex(url, arr) {
11458
- for (var i = 0; i < arr.length; i++) if (arr[i].url === url) return i;
11459
- return -1;
11460
- }
11461
- ResourceLoader.cache = new Map(), ResourceLoader.isLoading = !1, ResourceLoader.toLoadAueue = [];
11409
+ ResourceLoader.cache = new Map();
11462
11410
 
11463
11411
  var tempMatrix = new Matrix(),
11464
11412
  tempBounds$1 = new AABBBounds();
@@ -12244,7 +12192,7 @@
12244
12192
  data: "init",
12245
12193
  state: null
12246
12194
  };
12247
- 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";
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);
12248
12196
  }
12249
12197
  }, {
12250
12198
  key: "imageLoadSuccess",
@@ -12818,7 +12766,7 @@
12818
12766
  value: function doUpdateAABBBounds() {
12819
12767
  var attribute = this.attribute,
12820
12768
  groupTheme = getTheme(this).group;
12821
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
12769
+ this._AABBBounds.clear();
12822
12770
  var bounds = application.graphicService.updateGroupAABBBounds(attribute, groupTheme, this._AABBBounds, this),
12823
12771
  _attribute$boundsPadd = attribute.boundsPadding,
12824
12772
  boundsPadding = _attribute$boundsPadd === void 0 ? groupTheme.boundsPadding : _attribute$boundsPadd,
@@ -13639,7 +13587,7 @@
13639
13587
  key: "doUpdateAABBBounds",
13640
13588
  value: function doUpdateAABBBounds(full) {
13641
13589
  var circleTheme = getTheme(this).circle;
13642
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
13590
+ this._AABBBounds.clear();
13643
13591
  var attribute = this.attribute,
13644
13592
  bounds = application.graphicService.updateCircleAABBBounds(attribute, getTheme(this).circle, this._AABBBounds, full, this),
13645
13593
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -13826,7 +13774,7 @@
13826
13774
  return CanvasTextLayout;
13827
13775
  }();
13828
13776
 
13829
- var TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak", "heightLimit", "lineClamp"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
13777
+ var TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "textAlign", "textBaseline", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak", "heightLimit", "lineClamp"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
13830
13778
  var Text = /*#__PURE__*/function (_Graphic) {
13831
13779
  _inherits(Text, _Graphic);
13832
13780
  var _super = _createSuper(Text);
@@ -13906,7 +13854,7 @@
13906
13854
  key: "doUpdateAABBBounds",
13907
13855
  value: function doUpdateAABBBounds() {
13908
13856
  var textTheme = getTheme(this).text;
13909
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
13857
+ this._AABBBounds.clear();
13910
13858
  var attribute = this.attribute,
13911
13859
  bounds = application.graphicService.updateTextAABBBounds(attribute, textTheme, this._AABBBounds, this),
13912
13860
  _this$attribute$bound = this.attribute.boundsPadding,
@@ -15385,7 +15333,7 @@
15385
15333
  key: "doUpdateAABBBounds",
15386
15334
  value: function doUpdateAABBBounds(full) {
15387
15335
  var symbolTheme = getTheme(this).symbol;
15388
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
15336
+ this._AABBBounds.clear();
15389
15337
  var attribute = this.attribute,
15390
15338
  bounds = application.graphicService.updateSymbolAABBBounds(attribute, getTheme(this).symbol, this._AABBBounds, full, this),
15391
15339
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -15475,7 +15423,7 @@
15475
15423
  key: "doUpdateAABBBounds",
15476
15424
  value: function doUpdateAABBBounds() {
15477
15425
  var lineTheme = getTheme(this).line;
15478
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
15426
+ this._AABBBounds.clear();
15479
15427
  var attribute = this.attribute,
15480
15428
  bounds = application.graphicService.updateLineAABBBounds(attribute, getTheme(this).line, this._AABBBounds, this),
15481
15429
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -15566,7 +15514,7 @@
15566
15514
  key: "doUpdateAABBBounds",
15567
15515
  value: function doUpdateAABBBounds() {
15568
15516
  var rectTheme = getTheme(this).rect;
15569
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
15517
+ this._AABBBounds.clear();
15570
15518
  var attribute = this.attribute,
15571
15519
  bounds = application.graphicService.updateRectAABBBounds(attribute, getTheme(this).rect, this._AABBBounds, this),
15572
15520
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -15796,7 +15744,7 @@
15796
15744
  }, {
15797
15745
  key: "doUpdateAABBBounds",
15798
15746
  value: function doUpdateAABBBounds() {
15799
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
15747
+ this._AABBBounds.clear();
15800
15748
  var bounds = application.graphicService.updateGlyphAABBBounds(this.attribute, getTheme(this).glyph, this._AABBBounds, this);
15801
15749
  return this.clearUpdateBoundTag(), bounds;
15802
15750
  }
@@ -16182,7 +16130,7 @@
16182
16130
  key: "doUpdateAABBBounds",
16183
16131
  value: function doUpdateAABBBounds() {
16184
16132
  var imageTheme = getTheme(this).image;
16185
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
16133
+ this._AABBBounds.clear();
16186
16134
  var attribute = this.attribute,
16187
16135
  bounds = application.graphicService.updateImageAABBBounds(attribute, getTheme(this).image, this._AABBBounds, this),
16188
16136
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -16541,7 +16489,7 @@
16541
16489
  key: "doUpdateAABBBounds",
16542
16490
  value: function doUpdateAABBBounds() {
16543
16491
  var richTextTheme = getTheme(this).richtext;
16544
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
16492
+ this._AABBBounds.clear();
16545
16493
  var attribute = this.attribute,
16546
16494
  bounds = application.graphicService.updateRichTextAABBBounds(attribute, getTheme(this).richtext, this._AABBBounds, this),
16547
16495
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -16604,10 +16552,13 @@
16604
16552
  _this2.addUpdateBoundTag(), null === (_a = _this2.stage) || void 0 === _a || _a.renderNextFrame();
16605
16553
  }, icon.richtextId = config.id, paragraphs.push(icon);
16606
16554
  }
16607
- } else if (textConfig[i].text.includes("\n")) {
16608
- var textParts = textConfig[i].text.split("\n");
16609
- for (var j = 0; j < textParts.length; j++) paragraphs.push(new Paragraph(textParts[j], 0 !== j, textConfig[i]));
16610
- } else paragraphs.push(new Paragraph(textConfig[i].text, !1, textConfig[i]));
16555
+ } else {
16556
+ var richTextConfig = textConfig[i];
16557
+ if (isNumber$2(richTextConfig.text) && (richTextConfig.text = "".concat(richTextConfig.text)), richTextConfig.text.includes("\n")) {
16558
+ var textParts = richTextConfig.text.split("\n");
16559
+ 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));
16561
+ }
16611
16562
  var maxWidthFinite = "number" == typeof maxWidth && Number.isFinite(maxWidth) && maxWidth > 0,
16612
16563
  maxHeightFinite = "number" == typeof maxHeight && Number.isFinite(maxHeight) && maxHeight > 0,
16613
16564
  richTextWidthEnable = "number" == typeof width && Number.isFinite(width) && width > 0 && (!maxWidthFinite || width <= maxWidth),
@@ -16726,7 +16677,7 @@
16726
16677
  key: "doUpdateAABBBounds",
16727
16678
  value: function doUpdateAABBBounds() {
16728
16679
  var pathTheme = getTheme(this).path;
16729
- this.doUpdatePathShape(), this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
16680
+ this.doUpdatePathShape(), this._AABBBounds.clear();
16730
16681
  var attribute = this.attribute,
16731
16682
  bounds = application.graphicService.updatePathAABBBounds(attribute, getTheme(this).path, this._AABBBounds, this),
16732
16683
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -16814,7 +16765,7 @@
16814
16765
  key: "doUpdateAABBBounds",
16815
16766
  value: function doUpdateAABBBounds() {
16816
16767
  var areaTheme = getTheme(this).area;
16817
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
16768
+ this._AABBBounds.clear();
16818
16769
  var attribute = this.attribute,
16819
16770
  bounds = application.graphicService.updateAreaAABBBounds(attribute, getTheme(this).area, this._AABBBounds, this),
16820
16771
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -17017,7 +16968,7 @@
17017
16968
  key: "doUpdateAABBBounds",
17018
16969
  value: function doUpdateAABBBounds(full) {
17019
16970
  var arcTheme = getTheme(this).arc;
17020
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
16971
+ this._AABBBounds.clear();
17021
16972
  var attribute = this.attribute,
17022
16973
  bounds = application.graphicService.updateArcAABBBounds(attribute, getTheme(this).arc, this._AABBBounds, full, this),
17023
16974
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -17103,7 +17054,7 @@
17103
17054
  key: "doUpdateAABBBounds",
17104
17055
  value: function doUpdateAABBBounds() {
17105
17056
  var polygonTheme = getTheme(this).arc;
17106
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
17057
+ this._AABBBounds.clear();
17107
17058
  var attribute = this.attribute,
17108
17059
  bounds = application.graphicService.updateArc3dAABBBounds(attribute, getTheme(this).polygon, this._AABBBounds, this),
17109
17060
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -17151,7 +17102,7 @@
17151
17102
  key: "doUpdateAABBBounds",
17152
17103
  value: function doUpdateAABBBounds() {
17153
17104
  var polygonTheme = getTheme(this).polygon;
17154
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
17105
+ this._AABBBounds.clear();
17155
17106
  var attribute = this.attribute,
17156
17107
  bounds = application.graphicService.updatePolygonAABBBounds(attribute, getTheme(this).polygon, this._AABBBounds, this),
17157
17108
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -17224,7 +17175,7 @@
17224
17175
  key: "doUpdateAABBBounds",
17225
17176
  value: function doUpdateAABBBounds() {
17226
17177
  var polygonTheme = getTheme(this).polygon;
17227
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
17178
+ this._AABBBounds.clear();
17228
17179
  var attribute = this.attribute,
17229
17180
  bounds = application.graphicService.updatePyramid3dAABBBounds(attribute, getTheme(this).polygon, this._AABBBounds, this),
17230
17181
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -18184,35 +18135,37 @@
18184
18135
  }, {
18185
18136
  key: "transformAABBBounds",
18186
18137
  value: function transformAABBBounds(attribute, aabbBounds, theme, miter, graphic) {
18187
- var _attribute$scaleX2 = attribute.scaleX,
18188
- scaleX = _attribute$scaleX2 === void 0 ? theme.scaleX : _attribute$scaleX2,
18189
- _attribute$scaleY2 = attribute.scaleY,
18190
- scaleY = _attribute$scaleY2 === void 0 ? theme.scaleY : _attribute$scaleY2,
18191
- _attribute$stroke = attribute.stroke,
18192
- stroke = _attribute$stroke === void 0 ? theme.stroke : _attribute$stroke,
18193
- _attribute$shadowBlur2 = attribute.shadowBlur,
18194
- shadowBlur = _attribute$shadowBlur2 === void 0 ? theme.shadowBlur : _attribute$shadowBlur2,
18195
- _attribute$lineWidth = attribute.lineWidth,
18196
- lineWidth = _attribute$lineWidth === void 0 ? theme.lineWidth : _attribute$lineWidth,
18197
- _attribute$pickStroke = attribute.pickStrokeBuffer,
18198
- pickStrokeBuffer = _attribute$pickStroke === void 0 ? theme.pickStrokeBuffer : _attribute$pickStroke,
18199
- _attribute$strokeBoun2 = attribute.strokeBoundsBuffer,
18200
- strokeBoundsBuffer = _attribute$strokeBoun2 === void 0 ? theme.strokeBoundsBuffer : _attribute$strokeBoun2,
18201
- tb1 = this.tempAABBBounds1,
18202
- tb2 = this.tempAABBBounds2;
18203
- if (stroke && lineWidth) {
18204
- var scaledHalfLineWidth = (lineWidth + pickStrokeBuffer) / Math.abs(scaleX + scaleY);
18205
- boundStroke(tb1, scaledHalfLineWidth, miter, strokeBoundsBuffer), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
18138
+ if (!aabbBounds.empty()) {
18139
+ var _attribute$scaleX2 = attribute.scaleX,
18140
+ scaleX = _attribute$scaleX2 === void 0 ? theme.scaleX : _attribute$scaleX2,
18141
+ _attribute$scaleY2 = attribute.scaleY,
18142
+ scaleY = _attribute$scaleY2 === void 0 ? theme.scaleY : _attribute$scaleY2,
18143
+ _attribute$stroke = attribute.stroke,
18144
+ stroke = _attribute$stroke === void 0 ? theme.stroke : _attribute$stroke,
18145
+ _attribute$shadowBlur2 = attribute.shadowBlur,
18146
+ shadowBlur = _attribute$shadowBlur2 === void 0 ? theme.shadowBlur : _attribute$shadowBlur2,
18147
+ _attribute$lineWidth = attribute.lineWidth,
18148
+ lineWidth = _attribute$lineWidth === void 0 ? theme.lineWidth : _attribute$lineWidth,
18149
+ _attribute$pickStroke = attribute.pickStrokeBuffer,
18150
+ pickStrokeBuffer = _attribute$pickStroke === void 0 ? theme.pickStrokeBuffer : _attribute$pickStroke,
18151
+ _attribute$strokeBoun2 = attribute.strokeBoundsBuffer,
18152
+ strokeBoundsBuffer = _attribute$strokeBoun2 === void 0 ? theme.strokeBoundsBuffer : _attribute$strokeBoun2,
18153
+ tb1 = this.tempAABBBounds1,
18154
+ tb2 = this.tempAABBBounds2;
18155
+ if (stroke && lineWidth) {
18156
+ var scaledHalfLineWidth = (lineWidth + pickStrokeBuffer) / Math.abs(scaleX + scaleY);
18157
+ boundStroke(tb1, scaledHalfLineWidth, miter, strokeBoundsBuffer), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
18158
+ }
18159
+ if (shadowBlur) {
18160
+ var _attribute$shadowOffs = attribute.shadowOffsetX,
18161
+ shadowOffsetX = _attribute$shadowOffs === void 0 ? theme.shadowOffsetX : _attribute$shadowOffs,
18162
+ _attribute$shadowOffs2 = attribute.shadowOffsetY,
18163
+ shadowOffsetY = _attribute$shadowOffs2 === void 0 ? theme.shadowOffsetY : _attribute$shadowOffs2,
18164
+ shadowBlurWidth = shadowBlur / Math.abs(scaleX + scaleY) * 2;
18165
+ boundStroke(tb1, shadowBlurWidth, !1, strokeBoundsBuffer + 1), tb1.translate(shadowOffsetX, shadowOffsetY), aabbBounds.union(tb1);
18166
+ }
18206
18167
  }
18207
- if (shadowBlur) {
18208
- var _attribute$shadowOffs = attribute.shadowOffsetX,
18209
- shadowOffsetX = _attribute$shadowOffs === void 0 ? theme.shadowOffsetX : _attribute$shadowOffs,
18210
- _attribute$shadowOffs2 = attribute.shadowOffsetY,
18211
- shadowOffsetY = _attribute$shadowOffs2 === void 0 ? theme.shadowOffsetY : _attribute$shadowOffs2,
18212
- shadowBlurWidth = shadowBlur / Math.abs(scaleX + scaleY) * 2;
18213
- boundStroke(tb1, shadowBlurWidth, !1, strokeBoundsBuffer + 1), tb1.translate(shadowOffsetX, shadowOffsetY), aabbBounds.union(tb1);
18214
- }
18215
- this.combindShadowAABBBounds(aabbBounds, graphic);
18168
+ if (this.combindShadowAABBBounds(aabbBounds, graphic), aabbBounds.empty()) return;
18216
18169
  var updateMatrix = !0;
18217
18170
  var m = graphic.transMatrix;
18218
18171
  graphic && graphic.isContainer && (updateMatrix = !(1 === m.a && 0 === m.b && 0 === m.c && 1 === m.d && 0 === m.e && 0 === m.f)), updateMatrix && transformBoundsWithMatrix(aabbBounds, aabbBounds, m);
@@ -20808,7 +20761,10 @@
20808
20761
  var res = graphic.resources.get(background);
20809
20762
  if ("success" !== res.state || !res.data) return;
20810
20763
  context.highPerformanceSave(), onlyTranslate && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), this.doDrawImage(context, res.data, b, backgroundMode, backgroundFit), context.highPerformanceRestore(), context.setTransformForCurrent();
20811
- } else context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = background, context.fillRect(b.x1, b.y1, b.width(), b.height()), context.highPerformanceRestore();
20764
+ } else {
20765
+ var backgroundCornerRadius = graphic.attribute.backgroundCornerRadius;
20766
+ context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = background, backgroundCornerRadius ? (createRectPath(context, b.x1, b.y1, b.width(), b.height(), backgroundCornerRadius), context.fill()) : context.fillRect(b.x1, b.y1, b.width(), b.height()), context.highPerformanceRestore();
20767
+ }
20812
20768
  shouldReCalBounds && boundsAllocate.free(b);
20813
20769
  }
20814
20770
  }]);
@@ -21243,9 +21199,7 @@
21243
21199
  value: function draw(image, renderService, drawContext) {
21244
21200
  var url = image.attribute.image;
21245
21201
  if (!url || !image.resources) return;
21246
- var res = image.resources.get(url);
21247
- if ("loading" === res.state && isString$1(url)) return void ResourceLoader.improveImageLoading(url);
21248
- if ("success" !== res.state) return;
21202
+ if ("success" !== image.resources.get(url).state) return;
21249
21203
  var context = renderService.drawParams.context;
21250
21204
  if (!context) return;
21251
21205
  var imageAttribute = getTheme(image).image;
@@ -21286,355 +21240,120 @@
21286
21240
  },
21287
21241
  __metadata$$ = undefined && undefined.__metadata || function (k, v) {
21288
21242
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
21243
+ },
21244
+ __param$E = undefined && undefined.__param || function (paramIndex, decorator) {
21245
+ return function (target, key) {
21246
+ decorator(target, key, paramIndex);
21247
+ };
21289
21248
  };
21290
- var DrawItemInterceptor = Symbol["for"]("DrawItemInterceptor");
21291
- var tempDirtyBounds = new AABBBounds();
21292
- var ShadowRootDrawItemInterceptorContribution = /*#__PURE__*/function () {
21293
- function ShadowRootDrawItemInterceptorContribution() {
21294
- _classCallCheck(this, ShadowRootDrawItemInterceptorContribution);
21295
- this.order = 1;
21249
+ var RenderService = Symbol["for"]("RenderService");
21250
+ var BeforeRenderConstribution = Symbol["for"]("BeforeRenderConstribution");
21251
+ exports.DefaultRenderService = /*#__PURE__*/function () {
21252
+ function DefaultRenderService(drawContribution) {
21253
+ _classCallCheck(this, DefaultRenderService);
21254
+ this.drawContribution = drawContribution;
21296
21255
  }
21297
- _createClass(ShadowRootDrawItemInterceptorContribution, [{
21298
- key: "afterDrawItem",
21299
- value: function afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21300
- return (graphic.attribute.shadowRootIdx > 0 || !graphic.attribute.shadowRootIdx) && this.drawItem(graphic, renderService, drawContext, drawContribution, params), !1;
21256
+ _createClass(DefaultRenderService, [{
21257
+ key: "prepare",
21258
+ value: function prepare(updateBounds) {
21259
+ var _this = this;
21260
+ updateBounds && this.renderTreeRoots.forEach(function (g) {
21261
+ _this._prepare(g, updateBounds);
21262
+ });
21301
21263
  }
21302
21264
  }, {
21303
- key: "beforeDrawItem",
21304
- value: function beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21305
- return graphic.attribute.shadowRootIdx < 0 && this.drawItem(graphic, renderService, drawContext, drawContribution, params), !1;
21265
+ key: "_prepare",
21266
+ value: function _prepare(g, updateBounds) {
21267
+ var _this2 = this;
21268
+ g.forEachChildren(function (g) {
21269
+ _this2._prepare(g, updateBounds);
21270
+ }), g.update({
21271
+ bounds: updateBounds,
21272
+ trans: !0
21273
+ });
21306
21274
  }
21307
21275
  }, {
21308
- key: "drawItem",
21309
- value: function drawItem(graphic, renderService, drawContext, drawContribution, params) {
21310
- if (!graphic.shadowRoot) return !1;
21311
- var context = drawContext.context;
21312
- if (context.highPerformanceSave(), context.transformFromMatrix(graphic.transMatrix, !0), drawContribution.dirtyBounds && drawContribution.backupDirtyBounds) {
21313
- tempDirtyBounds.copy(drawContribution.dirtyBounds);
21314
- var m = graphic.globalTransMatrix.getInverse();
21315
- drawContribution.dirtyBounds.copy(drawContribution.backupDirtyBounds).transformWithMatrix(m);
21316
- }
21317
- return drawContribution.renderGroup(graphic.shadowRoot, drawContext, graphic.parent.globalTransMatrix), context.highPerformanceRestore(), drawContribution.dirtyBounds && drawContribution.backupDirtyBounds && drawContribution.dirtyBounds.copy(tempDirtyBounds), !0;
21318
- }
21319
- }]);
21320
- return ShadowRootDrawItemInterceptorContribution;
21321
- }();
21322
- var DebugDrawItemInterceptorContribution = /*#__PURE__*/function () {
21323
- function DebugDrawItemInterceptorContribution() {
21324
- _classCallCheck(this, DebugDrawItemInterceptorContribution);
21325
- this.order = 1;
21326
- }
21327
- _createClass(DebugDrawItemInterceptorContribution, [{
21328
- key: "afterDrawItem",
21329
- value: function afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21330
- return graphic.attribute._debug_bounds && this.drawItem(graphic, renderService, drawContext, drawContribution, params), !1;
21331
- }
21276
+ key: "prepareRenderList",
21277
+ value: function prepareRenderList() {}
21332
21278
  }, {
21333
- key: "drawItem",
21334
- value: function drawItem(graphic, renderService, drawContext, drawContribution, params) {
21335
- if (!graphic.attribute._debug_bounds) return !1;
21336
- var context = drawContext.context;
21337
- context.highPerformanceSave(), graphic.parent && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), graphic.glyphHost && graphic.glyphHost.parent && context.setTransformFromMatrix(graphic.glyphHost.parent.globalTransMatrix, !0);
21338
- var b = graphic.AABBBounds;
21339
- 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;
21279
+ key: "beforeDraw",
21280
+ value: function beforeDraw(params) {}
21281
+ }, {
21282
+ key: "draw",
21283
+ value: function draw(params) {
21284
+ this.drawContribution.draw(this, Object.assign({}, this.drawParams));
21340
21285
  }
21341
- }]);
21342
- return DebugDrawItemInterceptorContribution;
21343
- }();
21344
- exports.CommonDrawItemInterceptorContribution = /*#__PURE__*/function () {
21345
- function CommonDrawItemInterceptorContribution() {
21346
- _classCallCheck(this, CommonDrawItemInterceptorContribution);
21347
- this.order = 1, this.interceptors = [new ShadowRootDrawItemInterceptorContribution(), new Canvas3DDrawItemInterceptor(), new InteractiveDrawItemInterceptorContribution(), new DebugDrawItemInterceptorContribution()];
21348
- }
21349
- _createClass(CommonDrawItemInterceptorContribution, [{
21350
- key: "afterDrawItem",
21351
- value: function afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21352
- 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;
21353
- return !1;
21286
+ }, {
21287
+ key: "afterDraw",
21288
+ value: function afterDraw(params) {
21289
+ this.drawContribution.afterDraw && this.drawContribution.afterDraw(this, Object.assign({}, this.drawParams));
21354
21290
  }
21355
21291
  }, {
21356
- key: "beforeDrawItem",
21357
- value: function beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21358
- if ((!graphic.in3dMode || drawContext.in3dInterceptor) && !graphic.shadowRoot && !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)) return !1;
21359
- 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;
21360
- return !1;
21292
+ key: "render",
21293
+ value: function render(groups, params) {
21294
+ this.renderTreeRoots = groups, this.drawParams = params;
21295
+ var updateBounds = params.updateBounds;
21296
+ this.prepare(updateBounds), this.prepareRenderList(), this.beforeDraw(params), this.draw(params), this.afterDraw(params);
21361
21297
  }
21362
21298
  }]);
21363
- return CommonDrawItemInterceptorContribution;
21299
+ return DefaultRenderService;
21364
21300
  }();
21365
- exports.CommonDrawItemInterceptorContribution = __decorate$1j([injectable(), __metadata$$("design:paramtypes", [])], exports.CommonDrawItemInterceptorContribution);
21366
- var InteractiveDrawItemInterceptorContribution = /*#__PURE__*/function () {
21367
- function InteractiveDrawItemInterceptorContribution() {
21368
- _classCallCheck(this, InteractiveDrawItemInterceptorContribution);
21301
+ exports.DefaultRenderService = __decorate$1j([injectable(), __param$E(0, inject(DrawContribution)), __metadata$$("design:paramtypes", [Object])], exports.DefaultRenderService);
21302
+
21303
+ var renderModule$1 = new ContainerModule(function (bind) {
21304
+ bind(RenderService).to(exports.DefaultRenderService).inSingletonScope();
21305
+ });
21306
+
21307
+ var GraphicPicker = Symbol["for"]("GraphicPicker");
21308
+ var PickerService = Symbol["for"]("PickerService");
21309
+ var BoundsPicker = Symbol["for"]("BoundsPicker");
21310
+ var GlobalPickerService = Symbol["for"]("GlobalPickerService");
21311
+
21312
+ var __decorate$1i = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21313
+ var d,
21314
+ c = arguments.length,
21315
+ r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
21316
+ 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);
21317
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
21318
+ };
21319
+ var PickItemInterceptor = Symbol["for"]("PickItemInterceptor");
21320
+ exports.ShadowRootPickItemInterceptorContribution = /*#__PURE__*/function () {
21321
+ function ShadowRootPickItemInterceptorContribution() {
21322
+ _classCallCheck(this, ShadowRootPickItemInterceptorContribution);
21369
21323
  this.order = 1;
21370
21324
  }
21371
- _createClass(InteractiveDrawItemInterceptorContribution, [{
21372
- key: "beforeDrawItem",
21373
- value: function beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21374
- return !this.processing && (graphic.baseGraphic ? this.beforeDrawInteractive(graphic, renderService, drawContext, drawContribution, params) : this.beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params));
21375
- }
21376
- }, {
21377
- key: "beforeSetInteractive",
21378
- value: function beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params) {
21379
- var interactiveGraphic = graphic.interactiveGraphic;
21380
- if (graphic.attribute.globalZIndex) {
21381
- interactiveGraphic || (interactiveGraphic = graphic.clone(), graphic.interactiveGraphic = interactiveGraphic, interactiveGraphic.baseGraphic = graphic), interactiveGraphic.setAttributes({
21382
- globalZIndex: 0,
21383
- zIndex: graphic.attribute.globalZIndex
21384
- }, !1, {
21385
- skipUpdateCallback: !0
21386
- }), drawContext.stage.tryInitInteractiveLayer();
21387
- var interactiveLayer = drawContext.stage.getLayer("_builtin_interactive");
21388
- if (interactiveLayer) {
21389
- this.getShadowRoot(interactiveLayer).add(interactiveGraphic);
21390
- }
21391
- return !0;
21392
- }
21393
- if (interactiveGraphic) {
21394
- drawContext.stage.tryInitInteractiveLayer();
21395
- var _interactiveLayer = drawContext.stage.getLayer("_builtin_interactive");
21396
- if (_interactiveLayer) {
21397
- this.getShadowRoot(_interactiveLayer).removeChild(interactiveGraphic);
21398
- }
21399
- graphic.interactiveGraphic = null, interactiveGraphic.baseGraphic = null;
21400
- }
21401
- return !1;
21325
+ _createClass(ShadowRootPickItemInterceptorContribution, [{
21326
+ key: "afterPickItem",
21327
+ value: function afterPickItem(graphic, pickerService, point, pickParams, params) {
21328
+ return graphic.attribute.shadowRootIdx > 0 || !graphic.attribute.shadowRootIdx ? this._pickItem(graphic, pickerService, point, pickParams, params) : null;
21402
21329
  }
21403
21330
  }, {
21404
- key: "beforeDrawInteractive",
21405
- value: function beforeDrawInteractive(graphic, renderService, drawContext, drawContribution, params) {
21406
- var baseGraphic = graphic.baseGraphic;
21407
- if (baseGraphic) {
21408
- this.processing = !0;
21409
- var context = drawContext.context;
21410
- 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;
21411
- }
21412
- return !1;
21331
+ key: "beforePickItem",
21332
+ value: function beforePickItem(graphic, pickerService, point, pickParams, params) {
21333
+ return graphic.attribute.shadowRootIdx < 0 ? this._pickItem(graphic, pickerService, point, pickParams, params) : null;
21413
21334
  }
21414
21335
  }, {
21415
- key: "getShadowRoot",
21416
- value: function getShadowRoot(interactiveLayer) {
21417
- var _a;
21418
- var group = interactiveLayer.getElementById("_interactive_group");
21419
- return group || (group = graphicCreator.CreateGraphic("group", {}), group.id = "_interactive_group", interactiveLayer.add(group)), null !== (_a = group.shadowRoot) && void 0 !== _a ? _a : group.attachShadow();
21336
+ key: "_pickItem",
21337
+ value: function _pickItem(graphic, pickerService, point, pickParams, params) {
21338
+ if (!graphic.shadowRoot) return null;
21339
+ var _ref = params || {},
21340
+ parentMatrix = _ref.parentMatrix;
21341
+ if (!parentMatrix) return null;
21342
+ var context = pickerService.pickContext;
21343
+ context.highPerformanceSave();
21344
+ var g = graphic.shadowRoot,
21345
+ currentGroupMatrix = matrixAllocate.allocateByObj(parentMatrix),
21346
+ newPoint = new Point(currentGroupMatrix.a * point.x + currentGroupMatrix.c * point.y + currentGroupMatrix.e, currentGroupMatrix.b * point.x + currentGroupMatrix.d * point.y + currentGroupMatrix.f),
21347
+ result = pickerService.pickGroup(g, newPoint, currentGroupMatrix, pickParams);
21348
+ return context.highPerformanceRestore(), result;
21420
21349
  }
21421
21350
  }]);
21422
- return InteractiveDrawItemInterceptorContribution;
21351
+ return ShadowRootPickItemInterceptorContribution;
21423
21352
  }();
21424
- var Canvas3DDrawItemInterceptor = /*#__PURE__*/function () {
21425
- function Canvas3DDrawItemInterceptor() {
21426
- _classCallCheck(this, Canvas3DDrawItemInterceptor);
21427
- this.order = 1;
21428
- }
21429
- _createClass(Canvas3DDrawItemInterceptor, [{
21430
- key: "beforeDrawItem",
21431
- value: function beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21432
- if (!graphic.in3dMode || drawContext.in3dInterceptor) return !1;
21433
- drawContext.in3dInterceptor = !0;
21434
- var _renderService$drawPa = renderService.drawParams,
21435
- context = _renderService$drawPa.context,
21436
- stage = _renderService$drawPa.stage;
21437
- context.canvas;
21438
- context.save(), this.initCanvasCtx(context), context.camera = stage.camera;
21439
- var m = context.currentMatrix;
21440
- m.a /= context.dpr, m.b /= context.dpr, m.c /= context.dpr, m.d /= context.dpr, m.e /= context.dpr, m.f /= context.dpr;
21441
- var matrix = mat4Allocate.allocate();
21442
- mat3Tomat4(matrix, m);
21443
- var lastModelMatrix = context.modelMatrix;
21444
- if (lastModelMatrix) {
21445
- if (matrix) {
21446
- var _m = mat4Allocate.allocate();
21447
- context.modelMatrix = multiplyMat4Mat4(_m, lastModelMatrix, matrix);
21448
- }
21449
- } else context.modelMatrix = matrix;
21450
- if (context.setTransform(1, 0, 0, 1, 0, 0, !0), graphic.isContainer) {
21451
- var isPie = !1,
21452
- is3d = !1;
21453
- if (graphic.forEachChildren(function (c) {
21454
- return isPie = c.numberType === ARC3D_NUMBER_TYPE, !isPie;
21455
- }), graphic.forEachChildren(function (c) {
21456
- return is3d = !!c.findFace, !is3d;
21457
- }), isPie) {
21458
- var children = graphic.getChildren(),
21459
- sortedChildren = _toConsumableArray(children);
21460
- sortedChildren.sort(function (a, b) {
21461
- var _a, _b, _c, _d;
21462
- var angle1 = ((null !== (_a = a.attribute.startAngle) && void 0 !== _a ? _a : 0) + (null !== (_b = a.attribute.endAngle) && void 0 !== _b ? _b : 0)) / 2,
21463
- angle2 = ((null !== (_c = b.attribute.startAngle) && void 0 !== _c ? _c : 0) + (null !== (_d = b.attribute.endAngle) && void 0 !== _d ? _d : 0)) / 2;
21464
- for (; angle1 < 0;) angle1 += pi2;
21465
- for (; angle2 < 0;) angle2 += pi2;
21466
- return angle2 - angle1;
21467
- }), sortedChildren.forEach(function (c) {
21468
- c._next = null, c._prev = null;
21469
- }), graphic.removeAllChild(), graphic.update(), sortedChildren.forEach(function (c) {
21470
- graphic.appendChild(c);
21471
- });
21472
- var _m2 = graphic.parent.globalTransMatrix;
21473
- 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) {
21474
- c._next = null, c._prev = null;
21475
- }), children.forEach(function (c) {
21476
- graphic.appendChild(c);
21477
- });
21478
- } else if (is3d) {
21479
- var _children = graphic.getChildren(),
21480
- zChildren = _children.map(function (g) {
21481
- return {
21482
- ave_z: g.findFace().vertices.map(function (v) {
21483
- var _a;
21484
- return context.view(v[0], v[1], null !== (_a = v[2] + g.attribute.z) && void 0 !== _a ? _a : 0)[2];
21485
- }).reduce(function (a, b) {
21486
- return a + b;
21487
- }, 0),
21488
- g: g
21489
- };
21490
- });
21491
- zChildren.sort(function (a, b) {
21492
- return b.ave_z - a.ave_z;
21493
- }), graphic.removeAllChild(), zChildren.forEach(function (i) {
21494
- i.g._next = null, i.g._prev = null;
21495
- }), graphic.update(), zChildren.forEach(function (i) {
21496
- graphic.add(i.g);
21497
- }), drawContribution.renderGroup(graphic, drawContext, graphic.parent.globalTransMatrix, !0), graphic.removeAllChild(), _children.forEach(function (g) {
21498
- g._next = null, g._prev = null;
21499
- }), graphic.update(), _children.forEach(function (g) {
21500
- graphic.add(g);
21501
- });
21502
- } else drawContribution.renderGroup(graphic, drawContext, graphic.parent.globalTransMatrix);
21503
- } else drawContribution.renderItem(graphic, drawContext);
21504
- return context.camera = null, context.restore(), context.modelMatrix !== lastModelMatrix && mat4Allocate.free(context.modelMatrix), context.modelMatrix = lastModelMatrix, drawContext.in3dInterceptor = !1, !0;
21505
- }
21506
- }, {
21507
- key: "initCanvasCtx",
21508
- value: function initCanvasCtx(context) {
21509
- context.setTransformForCurrent();
21510
- }
21511
- }]);
21512
- return Canvas3DDrawItemInterceptor;
21513
- }();
21514
-
21515
- var __decorate$1i = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21516
- var d,
21517
- c = arguments.length,
21518
- r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
21519
- 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);
21520
- return c > 3 && r && Object.defineProperty(target, key, r), r;
21521
- },
21522
- __metadata$_ = undefined && undefined.__metadata || function (k, v) {
21523
- if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
21524
- },
21525
- __param$E = undefined && undefined.__param || function (paramIndex, decorator) {
21526
- return function (target, key) {
21527
- decorator(target, key, paramIndex);
21528
- };
21529
- };
21530
- var RenderService = Symbol["for"]("RenderService");
21531
- var BeforeRenderConstribution = Symbol["for"]("BeforeRenderConstribution");
21532
- exports.DefaultRenderService = /*#__PURE__*/function () {
21533
- function DefaultRenderService(drawContribution) {
21534
- _classCallCheck(this, DefaultRenderService);
21535
- this.drawContribution = drawContribution;
21536
- }
21537
- _createClass(DefaultRenderService, [{
21538
- key: "prepare",
21539
- value: function prepare(updateBounds) {
21540
- var _this = this;
21541
- updateBounds && this.renderTreeRoots.forEach(function (g) {
21542
- _this._prepare(g, updateBounds);
21543
- });
21544
- }
21545
- }, {
21546
- key: "_prepare",
21547
- value: function _prepare(g, updateBounds) {
21548
- var _this2 = this;
21549
- g.forEachChildren(function (g) {
21550
- _this2._prepare(g, updateBounds);
21551
- }), g.update({
21552
- bounds: updateBounds,
21553
- trans: !0
21554
- });
21555
- }
21556
- }, {
21557
- key: "prepareRenderList",
21558
- value: function prepareRenderList() {}
21559
- }, {
21560
- key: "beforeDraw",
21561
- value: function beforeDraw(params) {}
21562
- }, {
21563
- key: "draw",
21564
- value: function draw(params) {
21565
- this.drawContribution.draw(this, Object.assign({}, this.drawParams));
21566
- }
21567
- }, {
21568
- key: "afterDraw",
21569
- value: function afterDraw(params) {
21570
- this.drawContribution.afterDraw && this.drawContribution.afterDraw(this, Object.assign({}, this.drawParams));
21571
- }
21572
- }, {
21573
- key: "render",
21574
- value: function render(groups, params) {
21575
- this.renderTreeRoots = groups, this.drawParams = params;
21576
- var updateBounds = params.updateBounds;
21577
- this.prepare(updateBounds), this.prepareRenderList(), this.beforeDraw(params), this.draw(params), this.afterDraw(params);
21578
- }
21579
- }]);
21580
- return DefaultRenderService;
21581
- }();
21582
- exports.DefaultRenderService = __decorate$1i([injectable(), __param$E(0, inject(DrawContribution)), __metadata$_("design:paramtypes", [Object])], exports.DefaultRenderService);
21583
-
21584
- var renderModule$1 = new ContainerModule(function (bind) {
21585
- bind(RenderService).to(exports.DefaultRenderService).inSingletonScope();
21586
- });
21587
-
21588
- var GraphicPicker = Symbol["for"]("GraphicPicker");
21589
- var PickerService = Symbol["for"]("PickerService");
21590
- var BoundsPicker = Symbol["for"]("BoundsPicker");
21591
- var GlobalPickerService = Symbol["for"]("GlobalPickerService");
21592
-
21593
- var __decorate$1h = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21594
- var d,
21595
- c = arguments.length,
21596
- r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
21597
- 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);
21598
- return c > 3 && r && Object.defineProperty(target, key, r), r;
21599
- };
21600
- var PickItemInterceptor = Symbol["for"]("PickItemInterceptor");
21601
- exports.ShadowRootPickItemInterceptorContribution = /*#__PURE__*/function () {
21602
- function ShadowRootPickItemInterceptorContribution() {
21603
- _classCallCheck(this, ShadowRootPickItemInterceptorContribution);
21604
- this.order = 1;
21605
- }
21606
- _createClass(ShadowRootPickItemInterceptorContribution, [{
21607
- key: "afterPickItem",
21608
- value: function afterPickItem(graphic, pickerService, point, pickParams, params) {
21609
- return graphic.attribute.shadowRootIdx > 0 || !graphic.attribute.shadowRootIdx ? this._pickItem(graphic, pickerService, point, pickParams, params) : null;
21610
- }
21611
- }, {
21612
- key: "beforePickItem",
21613
- value: function beforePickItem(graphic, pickerService, point, pickParams, params) {
21614
- return graphic.attribute.shadowRootIdx < 0 ? this._pickItem(graphic, pickerService, point, pickParams, params) : null;
21615
- }
21616
- }, {
21617
- key: "_pickItem",
21618
- value: function _pickItem(graphic, pickerService, point, pickParams, params) {
21619
- if (!graphic.shadowRoot) return null;
21620
- var _ref = params || {},
21621
- parentMatrix = _ref.parentMatrix;
21622
- if (!parentMatrix) return null;
21623
- var context = pickerService.pickContext;
21624
- context.highPerformanceSave();
21625
- var g = graphic.shadowRoot,
21626
- currentGroupMatrix = matrixAllocate.allocateByObj(parentMatrix),
21627
- newPoint = new Point(currentGroupMatrix.a * point.x + currentGroupMatrix.c * point.y + currentGroupMatrix.e, currentGroupMatrix.b * point.x + currentGroupMatrix.d * point.y + currentGroupMatrix.f),
21628
- result = pickerService.pickGroup(g, newPoint, currentGroupMatrix, pickParams);
21629
- return context.highPerformanceRestore(), result;
21630
- }
21631
- }]);
21632
- return ShadowRootPickItemInterceptorContribution;
21633
- }();
21634
- exports.ShadowRootPickItemInterceptorContribution = __decorate$1h([injectable()], exports.ShadowRootPickItemInterceptorContribution);
21635
- exports.InteractivePickItemInterceptorContribution = /*#__PURE__*/function () {
21636
- function InteractivePickItemInterceptorContribution() {
21637
- _classCallCheck(this, InteractivePickItemInterceptorContribution);
21353
+ exports.ShadowRootPickItemInterceptorContribution = __decorate$1i([injectable()], exports.ShadowRootPickItemInterceptorContribution);
21354
+ exports.InteractivePickItemInterceptorContribution = /*#__PURE__*/function () {
21355
+ function InteractivePickItemInterceptorContribution() {
21356
+ _classCallCheck(this, InteractivePickItemInterceptorContribution);
21638
21357
  this.order = 1;
21639
21358
  }
21640
21359
  _createClass(InteractivePickItemInterceptorContribution, [{
@@ -21655,7 +21374,7 @@
21655
21374
  }]);
21656
21375
  return InteractivePickItemInterceptorContribution;
21657
21376
  }();
21658
- exports.InteractivePickItemInterceptorContribution = __decorate$1h([injectable()], exports.InteractivePickItemInterceptorContribution);
21377
+ exports.InteractivePickItemInterceptorContribution = __decorate$1i([injectable()], exports.InteractivePickItemInterceptorContribution);
21659
21378
  exports.Canvas3DPickItemInterceptor = /*#__PURE__*/function () {
21660
21379
  function Canvas3DPickItemInterceptor() {
21661
21380
  _classCallCheck(this, Canvas3DPickItemInterceptor);
@@ -21732,7 +21451,7 @@
21732
21451
  }]);
21733
21452
  return Canvas3DPickItemInterceptor;
21734
21453
  }();
21735
- exports.Canvas3DPickItemInterceptor = __decorate$1h([injectable()], exports.Canvas3DPickItemInterceptor);
21454
+ exports.Canvas3DPickItemInterceptor = __decorate$1i([injectable()], exports.Canvas3DPickItemInterceptor);
21736
21455
 
21737
21456
  var pickModule = new ContainerModule(function (bind, unbind, isBound) {
21738
21457
  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);
@@ -21745,14 +21464,14 @@
21745
21464
  var AutoEnablePlugins = Symbol["for"]("AutoEnablePlugins");
21746
21465
  var PluginService = Symbol["for"]("PluginService");
21747
21466
 
21748
- var __decorate$1g = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21467
+ var __decorate$1h = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21749
21468
  var d,
21750
21469
  c = arguments.length,
21751
21470
  r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
21752
21471
  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);
21753
21472
  return c > 3 && r && Object.defineProperty(target, key, r), r;
21754
21473
  },
21755
- __metadata$Z = undefined && undefined.__metadata || function (k, v) {
21474
+ __metadata$_ = undefined && undefined.__metadata || function (k, v) {
21756
21475
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
21757
21476
  },
21758
21477
  __param$D = undefined && undefined.__param || function (paramIndex, decorator) {
@@ -21808,7 +21527,7 @@
21808
21527
  }]);
21809
21528
  return DefaultPluginService;
21810
21529
  }();
21811
- DefaultPluginService = __decorate$1g([injectable(), __param$D(0, inject(ContributionProvider)), __param$D(0, named(AutoEnablePlugins)), __metadata$Z("design:paramtypes", [Object])], DefaultPluginService);
21530
+ DefaultPluginService = __decorate$1h([injectable(), __param$D(0, inject(ContributionProvider)), __param$D(0, named(AutoEnablePlugins)), __metadata$_("design:paramtypes", [Object])], DefaultPluginService);
21812
21531
 
21813
21532
  var pluginModule = new ContainerModule(function (bind) {
21814
21533
  bind(PluginService).to(DefaultPluginService), bindContributionProviderNoSingletonScope(bind, AutoEnablePlugins);
@@ -21822,14 +21541,14 @@
21822
21541
  bind(TextMeasureContribution).to(exports.DefaultTextMeasureContribution).inSingletonScope(), bindContributionProvider(bind, TextMeasureContribution);
21823
21542
  });
21824
21543
 
21825
- var __decorate$1f = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21544
+ var __decorate$1g = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21826
21545
  var d,
21827
21546
  c = arguments.length,
21828
21547
  r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
21829
21548
  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);
21830
21549
  return c > 3 && r && Object.defineProperty(target, key, r), r;
21831
21550
  },
21832
- __metadata$Y = undefined && undefined.__metadata || function (k, v) {
21551
+ __metadata$Z = undefined && undefined.__metadata || function (k, v) {
21833
21552
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
21834
21553
  };
21835
21554
  var CanvasLayerHandlerContribution = /*#__PURE__*/function () {
@@ -21923,16 +21642,16 @@
21923
21642
  }]);
21924
21643
  return CanvasLayerHandlerContribution;
21925
21644
  }();
21926
- CanvasLayerHandlerContribution = __decorate$1f([injectable(), __metadata$Y("design:paramtypes", [])], CanvasLayerHandlerContribution);
21645
+ CanvasLayerHandlerContribution = __decorate$1g([injectable(), __metadata$Z("design:paramtypes", [])], CanvasLayerHandlerContribution);
21927
21646
 
21928
- var __decorate$1e = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21647
+ var __decorate$1f = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21929
21648
  var d,
21930
21649
  c = arguments.length,
21931
21650
  r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
21932
21651
  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);
21933
21652
  return c > 3 && r && Object.defineProperty(target, key, r), r;
21934
21653
  },
21935
- __metadata$X = undefined && undefined.__metadata || function (k, v) {
21654
+ __metadata$Y = undefined && undefined.__metadata || function (k, v) {
21936
21655
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
21937
21656
  };
21938
21657
  var EmptyLayerHandlerContribution = /*#__PURE__*/function () {
@@ -21990,16 +21709,16 @@
21990
21709
  }]);
21991
21710
  return EmptyLayerHandlerContribution;
21992
21711
  }();
21993
- EmptyLayerHandlerContribution = __decorate$1e([injectable(), __metadata$X("design:paramtypes", [])], EmptyLayerHandlerContribution);
21712
+ EmptyLayerHandlerContribution = __decorate$1f([injectable(), __metadata$Y("design:paramtypes", [])], EmptyLayerHandlerContribution);
21994
21713
 
21995
- var __decorate$1d = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21714
+ var __decorate$1e = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21996
21715
  var d,
21997
21716
  c = arguments.length,
21998
21717
  r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
21999
21718
  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);
22000
21719
  return c > 3 && r && Object.defineProperty(target, key, r), r;
22001
21720
  },
22002
- __metadata$W = undefined && undefined.__metadata || function (k, v) {
21721
+ __metadata$X = undefined && undefined.__metadata || function (k, v) {
22003
21722
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
22004
21723
  };
22005
21724
  var OffscreenLayerHandlerContribution = /*#__PURE__*/function () {
@@ -22081,137 +21800,372 @@
22081
21800
  context.nativeContext.save(), context.nativeContext.setTransform(targetDpr, 0, 0, targetDpr, 0, 0), params.clear && context.clearRect(x, y, width, height), context.drawImage(this.canvas.nativeCanvas, 0, 0, this.canvas.width, this.canvas.height, x, y, width, height), context.nativeContext.restore();
22082
21801
  }
22083
21802
  }, {
22084
- key: "merge",
22085
- value: function merge(layerHandlers) {}
21803
+ key: "merge",
21804
+ value: function merge(layerHandlers) {}
21805
+ }]);
21806
+ return OffscreenLayerHandlerContribution;
21807
+ }();
21808
+ OffscreenLayerHandlerContribution = __decorate$1e([injectable(), __metadata$X("design:paramtypes", [])], OffscreenLayerHandlerContribution);
21809
+
21810
+ var layerHandlerModules = new ContainerModule(function (bind) {
21811
+ bind(CanvasLayerHandlerContribution).toSelf(), bind(OffscreenLayerHandlerContribution).toSelf(), bind(EmptyLayerHandlerContribution).toSelf(), bind(StaticLayerHandlerContribution).toService(CanvasLayerHandlerContribution), bind(DynamicLayerHandlerContribution).toService(OffscreenLayerHandlerContribution), bind(VirtualLayerHandlerContribution).toService(EmptyLayerHandlerContribution);
21812
+ });
21813
+
21814
+ function load$1(container) {
21815
+ container.load(envModules), container.load(textMeasureModules), container.load(layerHandlerModules);
21816
+ }
21817
+
21818
+ var __awaiter$2 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
21819
+ return new (P || (P = Promise))(function (resolve, reject) {
21820
+ function fulfilled(value) {
21821
+ try {
21822
+ step(generator.next(value));
21823
+ } catch (e) {
21824
+ reject(e);
21825
+ }
21826
+ }
21827
+ function rejected(value) {
21828
+ try {
21829
+ step(generator["throw"](value));
21830
+ } catch (e) {
21831
+ reject(e);
21832
+ }
21833
+ }
21834
+ function step(result) {
21835
+ var value;
21836
+ result.done ? resolve(result.value) : (value = result.value, value instanceof P ? value : new P(function (resolve) {
21837
+ resolve(value);
21838
+ })).then(fulfilled, rejected);
21839
+ }
21840
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21841
+ });
21842
+ };
21843
+ function foreach(graphic, defaultZIndex, cb) {
21844
+ var reverse = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
21845
+ var sort3d = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !1;
21846
+ var childMap = {},
21847
+ zIdxArray = [];
21848
+ var needSort = !1;
21849
+ if (sort3d) needSort = !0;else {
21850
+ var lastZIndex;
21851
+ graphic.forEachChildren(function (item, i) {
21852
+ var _item$attribute$zInde = item.attribute.zIndex,
21853
+ zIndex = _item$attribute$zInde === void 0 ? defaultZIndex : _item$attribute$zInde;
21854
+ if (0 === i) lastZIndex = zIndex;else if (lastZIndex !== zIndex) return needSort = !0, !0;
21855
+ return !1;
21856
+ }, reverse);
21857
+ }
21858
+ if (needSort) {
21859
+ graphic.forEachChildren(function (item) {
21860
+ var _item$attribute$zInde2 = item.attribute.zIndex,
21861
+ zIndex = _item$attribute$zInde2 === void 0 ? defaultZIndex : _item$attribute$zInde2;
21862
+ childMap[zIndex] ? childMap[zIndex].push(item) : (childMap[zIndex] = [item], zIdxArray.push(zIndex));
21863
+ }, reverse), zIdxArray.sort(function (a, b) {
21864
+ return reverse ? b - a : a - b;
21865
+ });
21866
+ var skip = !1;
21867
+ for (var i = 0; i < zIdxArray.length && !skip; i++) {
21868
+ var idx = zIdxArray[i],
21869
+ children = childMap[idx];
21870
+ sort3d && children.sort(function (a, b) {
21871
+ var _a, _b;
21872
+ return (reverse ? -1 : 1) * ((null !== (_a = b.attribute.z) && void 0 !== _a ? _a : 0) - (null !== (_b = a.attribute.z) && void 0 !== _b ? _b : 0));
21873
+ });
21874
+ for (var _i = 0; _i < children.length; _i++) if (cb(children[_i], _i)) {
21875
+ skip = !0;
21876
+ break;
21877
+ }
21878
+ }
21879
+ } else graphic.forEachChildren(cb, reverse);
21880
+ }
21881
+ function foreachAsync(graphic, defaultZIndex, cb) {
21882
+ var reverse = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
21883
+ return __awaiter$2(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
21884
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
21885
+ while (1) switch (_context.prev = _context.next) {
21886
+ case 0:
21887
+ _context.next = 2;
21888
+ return graphic.forEachChildrenAsync(cb, reverse);
21889
+ case 2:
21890
+ case "end":
21891
+ return _context.stop();
21892
+ }
21893
+ }, _callee);
21894
+ }));
21895
+ }
21896
+ function findNextGraphic(graphic, id, defaultZIndex) {
21897
+ var reverse = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
21898
+ var childMap = {},
21899
+ zIdxArray = [];
21900
+ var needSort = !1;
21901
+ graphic.forEachChildren(function (item, i) {
21902
+ var _item$attribute$zInde3 = item.attribute.zIndex,
21903
+ zIndex = _item$attribute$zInde3 === void 0 ? defaultZIndex : _item$attribute$zInde3;
21904
+ if (0 === i) ;else if (undefined !== zIndex) return needSort = !0, !0;
21905
+ return !1;
21906
+ }, reverse);
21907
+ var result = null,
21908
+ next = !1;
21909
+ if (needSort) {
21910
+ graphic.forEachChildren(function (item) {
21911
+ var _item$attribute$zInde4 = item.attribute.zIndex,
21912
+ zIndex = _item$attribute$zInde4 === void 0 ? defaultZIndex : _item$attribute$zInde4;
21913
+ childMap[zIndex] ? childMap[zIndex].push(item) : (childMap[zIndex] = [item], zIdxArray.push(zIndex));
21914
+ }, reverse), zIdxArray.sort(function (a, b) {
21915
+ return reverse ? b - a : a - b;
21916
+ });
21917
+ var skip = !1;
21918
+ for (var i = 0; i < zIdxArray.length && !skip; i++) {
21919
+ var idx = zIdxArray[i],
21920
+ children = childMap[idx];
21921
+ for (var _i2 = 0; _i2 < children.length; _i2++) {
21922
+ if (next) {
21923
+ skip = !0, result = children[_i2];
21924
+ break;
21925
+ }
21926
+ children[_i2]._uid !== id || (next = !0);
21927
+ }
21928
+ }
21929
+ } else graphic.forEachChildren(function (item) {
21930
+ return next ? (result = item, !0) : (item._uid === id && (next = !0), !1);
21931
+ }, reverse);
21932
+ return result;
21933
+ }
21934
+
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
+ }
22086
22166
  }]);
22087
- return OffscreenLayerHandlerContribution;
22167
+ return Canvas3DDrawItemInterceptor;
22088
22168
  }();
22089
- OffscreenLayerHandlerContribution = __decorate$1d([injectable(), __metadata$W("design:paramtypes", [])], OffscreenLayerHandlerContribution);
22090
-
22091
- var layerHandlerModules = new ContainerModule(function (bind) {
22092
- bind(CanvasLayerHandlerContribution).toSelf(), bind(OffscreenLayerHandlerContribution).toSelf(), bind(EmptyLayerHandlerContribution).toSelf(), bind(StaticLayerHandlerContribution).toService(CanvasLayerHandlerContribution), bind(DynamicLayerHandlerContribution).toService(OffscreenLayerHandlerContribution), bind(VirtualLayerHandlerContribution).toService(EmptyLayerHandlerContribution);
22093
- });
22094
-
22095
- function load$1(container) {
22096
- container.load(envModules), container.load(textMeasureModules), container.load(layerHandlerModules);
22097
- }
22098
-
22099
- var __awaiter$2 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
22100
- return new (P || (P = Promise))(function (resolve, reject) {
22101
- function fulfilled(value) {
22102
- try {
22103
- step(generator.next(value));
22104
- } catch (e) {
22105
- reject(e);
22106
- }
22107
- }
22108
- function rejected(value) {
22109
- try {
22110
- step(generator["throw"](value));
22111
- } catch (e) {
22112
- reject(e);
22113
- }
22114
- }
22115
- function step(result) {
22116
- var value;
22117
- result.done ? resolve(result.value) : (value = result.value, value instanceof P ? value : new P(function (resolve) {
22118
- resolve(value);
22119
- })).then(fulfilled, rejected);
22120
- }
22121
- step((generator = generator.apply(thisArg, _arguments || [])).next());
22122
- });
22123
- };
22124
- function foreach(graphic, defaultZIndex, cb) {
22125
- var reverse = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
22126
- var sort3d = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !1;
22127
- var childMap = {},
22128
- zIdxArray = [];
22129
- var needSort = !1;
22130
- if (sort3d) needSort = !0;else {
22131
- var lastZIndex;
22132
- graphic.forEachChildren(function (item, i) {
22133
- var _item$attribute$zInde = item.attribute.zIndex,
22134
- zIndex = _item$attribute$zInde === void 0 ? defaultZIndex : _item$attribute$zInde;
22135
- if (0 === i) lastZIndex = zIndex;else if (lastZIndex !== zIndex) return needSort = !0, !0;
22136
- return !1;
22137
- }, reverse);
22138
- }
22139
- if (needSort) {
22140
- graphic.forEachChildren(function (item) {
22141
- var _item$attribute$zInde2 = item.attribute.zIndex,
22142
- zIndex = _item$attribute$zInde2 === void 0 ? defaultZIndex : _item$attribute$zInde2;
22143
- childMap[zIndex] ? childMap[zIndex].push(item) : (childMap[zIndex] = [item], zIdxArray.push(zIndex));
22144
- }, reverse), zIdxArray.sort(function (a, b) {
22145
- return reverse ? b - a : a - b;
22146
- });
22147
- var skip = !1;
22148
- for (var i = 0; i < zIdxArray.length && !skip; i++) {
22149
- var idx = zIdxArray[i],
22150
- children = childMap[idx];
22151
- sort3d && children.sort(function (a, b) {
22152
- var _a, _b;
22153
- return (reverse ? -1 : 1) * ((null !== (_a = b.attribute.z) && void 0 !== _a ? _a : 0) - (null !== (_b = a.attribute.z) && void 0 !== _b ? _b : 0));
22154
- });
22155
- for (var _i = 0; _i < children.length; _i++) if (cb(children[_i], _i)) {
22156
- skip = !0;
22157
- break;
22158
- }
22159
- }
22160
- } else graphic.forEachChildren(cb, reverse);
22161
- }
22162
- function foreachAsync(graphic, defaultZIndex, cb) {
22163
- var reverse = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
22164
- return __awaiter$2(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
22165
- return _regeneratorRuntime().wrap(function _callee$(_context) {
22166
- while (1) switch (_context.prev = _context.next) {
22167
- case 0:
22168
- _context.next = 2;
22169
- return graphic.forEachChildrenAsync(cb, reverse);
22170
- case 2:
22171
- case "end":
22172
- return _context.stop();
22173
- }
22174
- }, _callee);
22175
- }));
22176
- }
22177
- function findNextGraphic(graphic, id, defaultZIndex) {
22178
- var reverse = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
22179
- var childMap = {},
22180
- zIdxArray = [];
22181
- var needSort = !1;
22182
- graphic.forEachChildren(function (item, i) {
22183
- var _item$attribute$zInde3 = item.attribute.zIndex,
22184
- zIndex = _item$attribute$zInde3 === void 0 ? defaultZIndex : _item$attribute$zInde3;
22185
- if (0 === i) ;else if (undefined !== zIndex) return needSort = !0, !0;
22186
- return !1;
22187
- }, reverse);
22188
- var result = null,
22189
- next = !1;
22190
- if (needSort) {
22191
- graphic.forEachChildren(function (item) {
22192
- var _item$attribute$zInde4 = item.attribute.zIndex,
22193
- zIndex = _item$attribute$zInde4 === void 0 ? defaultZIndex : _item$attribute$zInde4;
22194
- childMap[zIndex] ? childMap[zIndex].push(item) : (childMap[zIndex] = [item], zIdxArray.push(zIndex));
22195
- }, reverse), zIdxArray.sort(function (a, b) {
22196
- return reverse ? b - a : a - b;
22197
- });
22198
- var skip = !1;
22199
- for (var i = 0; i < zIdxArray.length && !skip; i++) {
22200
- var idx = zIdxArray[i],
22201
- children = childMap[idx];
22202
- for (var _i2 = 0; _i2 < children.length; _i2++) {
22203
- if (next) {
22204
- skip = !0, result = children[_i2];
22205
- break;
22206
- }
22207
- children[_i2]._uid !== id || (next = !0);
22208
- }
22209
- }
22210
- } else graphic.forEachChildren(function (item) {
22211
- return next ? (result = item, !0) : (item._uid === id && (next = !0), !1);
22212
- }, reverse);
22213
- return result;
22214
- }
22215
22169
 
22216
22170
  var __decorate$1c = undefined && undefined.__decorate || function (decorators, target, key, desc) {
22217
22171
  var d,
@@ -22273,7 +22227,7 @@
22273
22227
  var d = context.dpr % 1;
22274
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);
22275
22229
  var drawInArea = dirtyBounds.width() * context.dpr < context.canvas.width || dirtyBounds.height() * context.dpr < context.canvas.height;
22276
- 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) {
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.clear(), this.backupDirtyBounds.clear()), this.clearScreen(renderService, context, drawContext), context.save(), renderService.renderTreeRoots.sort(function (a, b) {
22277
22231
  var _a, _b;
22278
22232
  return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
22279
22233
  }).forEach(function (group) {
@@ -22336,7 +22290,7 @@
22336
22290
  }, subLayers.set(group._uid, incrementalLayer));
22337
22291
  var incrementalContext = incrementalLayer.layer.getNativeHandler().getContext(),
22338
22292
  idc = incrementalLayer.drawContribution || container.get(IncrementalDrawContribution);
22339
- 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), {
22293
+ idc.dirtyBounds.clear(), idc.backupDirtyBounds.clear(), idc.draw(this.currentRenderService, Object.assign(Object.assign({}, drawContext), {
22340
22294
  drawContribution: idc,
22341
22295
  clear: "transparent",
22342
22296
  layer: incrementalLayer.layer,
@@ -23046,7 +23000,7 @@
23046
23000
  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);
23047
23001
 
23048
23002
  var renderModule = new ContainerModule(function (bind) {
23049
- 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);
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
23004
  });
23051
23005
 
23052
23006
  function load(container) {
@@ -31129,6 +31083,105 @@
31129
31083
  c.load(mathModule), c.load(mathPickerModule);
31130
31084
  }
31131
31085
 
31086
+ var CanvasWrapDisableWH = /*#__PURE__*/function () {
31087
+ function CanvasWrapDisableWH(nativeCanvas, ctx, dpr, w, h, id) {
31088
+ _classCallCheck(this, CanvasWrapDisableWH);
31089
+ this.nativeCanvas = nativeCanvas, this.ctx = ctx, this._w = w, this._h = h, this.id = id, nativeCanvas.id = id, this.dpr = dpr;
31090
+ }
31091
+ _createClass(CanvasWrapDisableWH, [{
31092
+ key: "width",
31093
+ get: function get() {
31094
+ return this._w * this.dpr;
31095
+ },
31096
+ set: function set(w) {}
31097
+ }, {
31098
+ key: "height",
31099
+ get: function get() {
31100
+ return this._h * this.dpr;
31101
+ },
31102
+ set: function set(h) {}
31103
+ }, {
31104
+ key: "offsetWidth",
31105
+ get: function get() {
31106
+ return this._w;
31107
+ },
31108
+ set: function set(w) {}
31109
+ }, {
31110
+ key: "offsetHeight",
31111
+ get: function get() {
31112
+ return this._h;
31113
+ },
31114
+ set: function set(h) {}
31115
+ }, {
31116
+ key: "getContext",
31117
+ value: function getContext() {
31118
+ return this.ctx;
31119
+ }
31120
+ }, {
31121
+ key: "getBoundingClientRect",
31122
+ value: function getBoundingClientRect() {
31123
+ return {
31124
+ width: this._w,
31125
+ height: this._h
31126
+ };
31127
+ }
31128
+ }]);
31129
+ return CanvasWrapDisableWH;
31130
+ }();
31131
+ var CanvasWrapEnableWH = /*#__PURE__*/function () {
31132
+ function CanvasWrapEnableWH(nativeCanvas, ctx, dpr, w, h, id) {
31133
+ _classCallCheck(this, CanvasWrapEnableWH);
31134
+ this.nativeCanvas = nativeCanvas, this.ctx = ctx, this._w = w, this._h = h, this.id = id, nativeCanvas.id = id, this.dpr = dpr;
31135
+ }
31136
+ _createClass(CanvasWrapEnableWH, [{
31137
+ key: "width",
31138
+ get: function get() {
31139
+ return this._w * this.dpr;
31140
+ },
31141
+ set: function set(w) {
31142
+ this._w = w / this.dpr, this.nativeCanvas.width = w;
31143
+ }
31144
+ }, {
31145
+ key: "height",
31146
+ get: function get() {
31147
+ return this._h * this.dpr;
31148
+ },
31149
+ set: function set(h) {
31150
+ this._h = h / this.dpr, this.nativeCanvas.height = h;
31151
+ }
31152
+ }, {
31153
+ key: "offsetWidth",
31154
+ get: function get() {
31155
+ return this._w;
31156
+ },
31157
+ set: function set(w) {
31158
+ this._w = w, this.nativeCanvas.width = w * this.dpr;
31159
+ }
31160
+ }, {
31161
+ key: "offsetHeight",
31162
+ get: function get() {
31163
+ return this._h;
31164
+ },
31165
+ set: function set(h) {
31166
+ this._h = h, this.nativeCanvas.height = h * this.dpr;
31167
+ }
31168
+ }, {
31169
+ key: "getContext",
31170
+ value: function getContext() {
31171
+ return this.ctx;
31172
+ }
31173
+ }, {
31174
+ key: "getBoundingClientRect",
31175
+ value: function getBoundingClientRect() {
31176
+ return {
31177
+ width: this._w,
31178
+ height: this._h
31179
+ };
31180
+ }
31181
+ }]);
31182
+ return CanvasWrapEnableWH;
31183
+ }();
31184
+
31132
31185
  var __decorate$H = undefined && undefined.__decorate || function (decorators, target, key, desc) {
31133
31186
  var d,
31134
31187
  c = arguments.length,
@@ -31139,31 +31192,12 @@
31139
31192
  __metadata$z = undefined && undefined.__metadata || function (k, v) {
31140
31193
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
31141
31194
  };
31142
- function makeUpCanvas$3(domref, canvasIdLists, canvasMap, freeCanvasIdx, freeCanvasList) {
31143
- var dpr = tt.getSystemInfoSync().pixelRatio;
31195
+ function makeUpCanvas$3(domref, canvasIdLists, canvasMap, freeCanvasIdx, freeCanvasList, pixelRatio) {
31196
+ var dpr = null != pixelRatio ? pixelRatio : tt.getSystemInfoSync().pixelRatio;
31144
31197
  canvasIdLists.forEach(function (id, i) {
31145
- var ctx = tt.createCanvasContext(id);
31146
- ctx.canvas = {
31147
- width: domref.width * dpr,
31148
- height: domref.height * dpr
31149
- };
31150
- var canvas = {
31151
- width: domref.width * dpr,
31152
- height: domref.height * dpr,
31153
- offsetWidth: domref.width,
31154
- offsetHeight: domref.height,
31155
- id: null != id ? id : "",
31156
- getContext: function getContext() {
31157
- return ctx;
31158
- },
31159
- getBoundingClientRect: function getBoundingClientRect() {
31160
- return {
31161
- height: domref.height,
31162
- width: domref.width
31163
- };
31164
- }
31165
- };
31166
- canvasMap.set(id, canvas), i >= freeCanvasIdx && freeCanvasList.push(canvas);
31198
+ var ctx = tt.createCanvasContext(id),
31199
+ canvas = new CanvasWrapDisableWH(ctx.canvas || {}, ctx, dpr, domref.width, domref.height, id);
31200
+ ctx.canvas = canvas, canvasMap.set(id, canvas), i >= freeCanvasIdx && freeCanvasList.push(canvas);
31167
31201
  });
31168
31202
  }
31169
31203
  var FeishuEnvContribution = /*#__PURE__*/function (_BaseEnvContribution) {
@@ -31194,7 +31228,7 @@
31194
31228
  }, {
31195
31229
  key: "configure",
31196
31230
  value: function configure(service, params) {
31197
- service.env === this.type && (service.setActiveEnvContribution(this), makeUpCanvas$3(params.domref, params.canvasIdLists, this.canvasMap, params.freeCanvasIdx, this.freeCanvasList));
31231
+ service.env === this.type && (service.setActiveEnvContribution(this), makeUpCanvas$3(params.domref, params.canvasIdLists, this.canvasMap, params.freeCanvasIdx, this.freeCanvasList, params.pixelRatio));
31198
31232
  }
31199
31233
  }, {
31200
31234
  key: "loadImage",
@@ -31372,11 +31406,11 @@
31372
31406
  value: function draw() {
31373
31407
  var _this = this;
31374
31408
  var _context = this.nativeContext;
31375
- this.drawPromise = new Promise(function (resolve) {
31409
+ _context.draw && (this.drawPromise = new Promise(function (resolve) {
31376
31410
  _context.draw(!0, function () {
31377
31411
  _this.drawPromise = null, resolve(null);
31378
31412
  });
31379
- });
31413
+ }));
31380
31414
  }
31381
31415
  }]);
31382
31416
  return LynxContext2d;
@@ -31645,32 +31679,13 @@
31645
31679
  try {
31646
31680
  ng = !!lynx.createCanvasNG;
31647
31681
  } catch (err) {}
31648
- function makeUpCanvas$2(domref, canvasIdLists, canvasMap, freeCanvasIdx, freeCanvasList) {
31649
- var dpr = SystemInfo.pixelRatio;
31682
+ function makeUpCanvas$2(domref, canvasIdLists, canvasMap, freeCanvasIdx, freeCanvasList, pixelRatio) {
31683
+ var dpr = null != pixelRatio ? pixelRatio : SystemInfo.pixelRatio;
31650
31684
  canvasIdLists.forEach(function (id, i) {
31651
31685
  var _canvas = ng ? lynx.createCanvasNG(id) : lynx.createCanvas(id);
31652
31686
  _canvas.width = domref.width * dpr, _canvas.height = domref.height * dpr, ng && _canvas.attachToCanvasView(id);
31653
- var ctx = _canvas.getContext("2d");
31654
- ctx.draw = function (a, b) {
31655
- b();
31656
- };
31657
- var canvas = {
31658
- width: domref.width * dpr,
31659
- height: domref.height * dpr,
31660
- offsetWidth: domref.width,
31661
- offsetHeight: domref.height,
31662
- id: null != id ? id : "",
31663
- getContext: function getContext() {
31664
- return ctx;
31665
- },
31666
- getBoundingClientRect: function getBoundingClientRect() {
31667
- return {
31668
- height: domref.height,
31669
- width: domref.width
31670
- };
31671
- },
31672
- nativeCanvas: _canvas
31673
- };
31687
+ var ctx = _canvas.getContext("2d"),
31688
+ canvas = new CanvasWrapEnableWH(_canvas, ctx, dpr, domref.width, domref.height, id);
31674
31689
  canvasMap.set(id, canvas), i >= freeCanvasIdx && freeCanvasList.push(canvas);
31675
31690
  });
31676
31691
  }
@@ -31704,7 +31719,7 @@
31704
31719
  _createClass(LynxEnvContribution, [{
31705
31720
  key: "configure",
31706
31721
  value: function configure(service, params) {
31707
- service.env === this.type && (service.setActiveEnvContribution(this), makeUpCanvas$2(params.domref, params.canvasIdLists, this.canvasMap, params.freeCanvasIdx, this.freeCanvasList));
31722
+ service.env === this.type && (service.setActiveEnvContribution(this), makeUpCanvas$2(params.domref, params.canvasIdLists, this.canvasMap, params.freeCanvasIdx, this.freeCanvasList, params.pixelRatio));
31708
31723
  }
31709
31724
  }, {
31710
31725
  key: "getDynamicCanvasCount",
@@ -32296,6 +32311,34 @@
32296
32311
  value: function createPattern(image, repetition) {
32297
32312
  return null;
32298
32313
  }
32314
+ }, {
32315
+ key: "getImageData",
32316
+ value: function getImageData(sx, sy, sw, sh) {
32317
+ var _this = this;
32318
+ var ctx = this.nativeContext,
32319
+ taro = ctx.taro;
32320
+ if (ctx && taro) return !ctx.getImageData && taro.canvasGetImageData ? new Promise(function (resolve, reject) {
32321
+ try {
32322
+ taro.canvasGetImageData({
32323
+ canvasId: _this.canvas.nativeCanvas.id,
32324
+ sx: sx,
32325
+ sy: sy,
32326
+ sw: sw,
32327
+ sh: sh,
32328
+ success: function success(res) {
32329
+ resolve(res);
32330
+ }
32331
+ });
32332
+ } catch (err) {
32333
+ reject(err);
32334
+ }
32335
+ }) : void 0;
32336
+ }
32337
+ }, {
32338
+ key: "createRadialGradient",
32339
+ value: function createRadialGradient(x0, y0, r0, x1, y1, r1) {
32340
+ return this.nativeContext.createCircularGradient && this.nativeContext.createCircularGradient(x0, y0, r0, x1, y1, r1);
32341
+ }
32299
32342
  }]);
32300
32343
  return TaroContext2d;
32301
32344
  }(BrowserContext2d);
@@ -32563,47 +32606,9 @@
32563
32606
  };
32564
32607
  function makeUpCanvas$1(domref, canvasIdLists, canvasMap, freeCanvasIdx, freeCanvasList, taro, dpr) {
32565
32608
  canvasIdLists.forEach(function (id, i) {
32566
- var ctx = taro.createCanvasContext(id);
32567
- ctx.canvas = {
32568
- width: domref.width * dpr,
32569
- height: domref.height * dpr
32570
- }, ctx.createRadialGradient || (ctx.createRadialGradient = function () {
32571
- return ctx.createCircularGradient.apply(ctx, arguments);
32572
- }), !ctx.getImageData && taro.canvasGetImageData && (ctx.getImageData = function (x, y, width, height) {
32573
- return new Promise(function (resolve, reject) {
32574
- try {
32575
- taro.canvasGetImageData({
32576
- canvasId: id,
32577
- x: x,
32578
- y: y,
32579
- width: width,
32580
- height: height,
32581
- success: function success(res) {
32582
- resolve(res);
32583
- }
32584
- });
32585
- } catch (err) {
32586
- reject(err);
32587
- }
32588
- });
32589
- });
32590
- var canvas = {
32591
- id: id,
32592
- width: domref.width * dpr,
32593
- height: domref.height * dpr,
32594
- offsetWidth: domref.width,
32595
- offsetHeight: domref.height,
32596
- getContext: function getContext() {
32597
- return ctx;
32598
- },
32599
- getBoundingClientRect: function getBoundingClientRect() {
32600
- return {
32601
- height: domref.height,
32602
- width: domref.width
32603
- };
32604
- }
32605
- };
32606
- return canvasMap.set(id, canvas), i >= freeCanvasIdx && freeCanvasList.push(canvas), canvas;
32609
+ var ctx = taro.createCanvasContext(id),
32610
+ canvas = new CanvasWrapDisableWH(ctx.canvas || {}, ctx, dpr, domref.width, domref.height, id);
32611
+ return ctx.canvas = canvas, canvasMap.set(id, canvas), i >= freeCanvasIdx && freeCanvasList.push(canvas), canvas;
32607
32612
  });
32608
32613
  }
32609
32614
  var TaroEnvContribution = /*#__PURE__*/function (_BaseEnvContribution) {
@@ -34848,7 +34853,7 @@
34848
34853
 
34849
34854
  var roughModule = _roughModule;
34850
34855
 
34851
- const version = "0.17.18-alpha.1";
34856
+ const version = "0.17.18";
34852
34857
  preLoadAllModule();
34853
34858
  if (isBrowserEnv()) {
34854
34859
  loadBrowserEnv(container);
@@ -34899,7 +34904,6 @@
34899
34904
  exports.BoundsContext = BoundsContext;
34900
34905
  exports.BoundsPicker = BoundsPicker;
34901
34906
  exports.CIRCLE_NUMBER_TYPE = CIRCLE_NUMBER_TYPE;
34902
- exports.Canvas3DDrawItemInterceptor = Canvas3DDrawItemInterceptor;
34903
34907
  exports.CanvasFactory = CanvasFactory;
34904
34908
  exports.CanvasTextLayout = CanvasTextLayout;
34905
34909
  exports.CbAnimate = CbAnimate;
@@ -34921,7 +34925,6 @@
34921
34925
  exports.CustomEvent = CustomEvent;
34922
34926
  exports.CustomPath2D = CustomPath2D;
34923
34927
  exports.CustomSymbolClass = CustomSymbolClass;
34924
- exports.DebugDrawItemInterceptorContribution = DebugDrawItemInterceptorContribution;
34925
34928
  exports.DefaultArcAllocate = DefaultArcAllocate;
34926
34929
  exports.DefaultArcAttribute = DefaultArcAttribute;
34927
34930
  exports.DefaultArcRenderContribution = DefaultArcRenderContribution;
@@ -34975,7 +34978,6 @@
34975
34978
  exports.DefaultTransform = DefaultTransform;
34976
34979
  exports.DragNDrop = DragNDrop;
34977
34980
  exports.DrawContribution = DrawContribution;
34978
- exports.DrawItemInterceptor = DrawItemInterceptor;
34979
34981
  exports.DynamicLayerHandlerContribution = DynamicLayerHandlerContribution;
34980
34982
  exports.EnvContribution = EnvContribution;
34981
34983
  exports.EventManager = EventManager;
@@ -35014,7 +35016,6 @@
35014
35016
  exports.IncreaseCount = IncreaseCount;
35015
35017
  exports.IncrementalDrawContribution = IncrementalDrawContribution;
35016
35018
  exports.InputText = InputText;
35017
- exports.InteractiveDrawItemInterceptorContribution = InteractiveDrawItemInterceptorContribution;
35018
35019
  exports.InteractiveSubRenderContribution = InteractiveSubRenderContribution;
35019
35020
  exports.LINE_NUMBER_TYPE = LINE_NUMBER_TYPE;
35020
35021
  exports.Layer = Layer;
@@ -35076,7 +35077,6 @@
35076
35077
  exports.SYMBOL_NUMBER_TYPE = SYMBOL_NUMBER_TYPE;
35077
35078
  exports.SegContext = SegContext;
35078
35079
  exports.ShadowRoot = ShadowRoot;
35079
- exports.ShadowRootDrawItemInterceptorContribution = ShadowRootDrawItemInterceptorContribution;
35080
35080
  exports.Stage = Stage;
35081
35081
  exports.StaticLayerHandlerContribution = StaticLayerHandlerContribution;
35082
35082
  exports.Step = Step$1;