@visactor/vrender 0.17.18-alpha.0 → 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,
@@ -11360,7 +11361,15 @@
11360
11361
  var data = ResourceLoader.cache.get(url);
11361
11362
  data ? "fail" === data.loadState ? application.global.getRequestAnimationFrame()(function () {
11362
11363
  mark.imageLoadFail(url);
11363
- }) : "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)));
11364
11373
  }
11365
11374
  }, {
11366
11375
  key: "GetSvg",
@@ -11394,68 +11403,10 @@
11394
11403
  return data.data;
11395
11404
  }));
11396
11405
  }
11397
- }, {
11398
- key: "loading",
11399
- value: function loading() {
11400
- setTimeout(function () {
11401
- if (!ResourceLoader.isLoading && ResourceLoader.toLoadAueue.length) {
11402
- ResourceLoader.isLoading = !0;
11403
- var tasks = ResourceLoader.toLoadAueue.splice(0, 10),
11404
- promises = [];
11405
- tasks.forEach(function (task) {
11406
- var url = task.url,
11407
- marks = task.marks,
11408
- data = {
11409
- type: "image",
11410
- loadState: "init"
11411
- };
11412
- if (ResourceLoader.cache.set(url, data), data.dataPromise = application.global.loadImage(url), data.dataPromise) {
11413
- data.waitingMark = marks;
11414
- var end = data.dataPromise.then(function (res) {
11415
- var _a;
11416
- 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) {
11417
- (null == res ? void 0 : res.data) ? (data.loadState = "success", data.data = res.data, mark.imageLoadSuccess(url, res.data)) : (data.loadState = "fail", mark.imageLoadFail(url));
11418
- });
11419
- });
11420
- promises.push(end);
11421
- } else data.loadState = "fail", marks.forEach(function (mark) {
11422
- return mark.imageLoadFail(url);
11423
- });
11424
- }), Promise.all(promises).then(function () {
11425
- ResourceLoader.isLoading = !1, ResourceLoader.loading();
11426
- })["catch"](function (error) {
11427
- console.error(error), ResourceLoader.isLoading = !1, ResourceLoader.loading();
11428
- });
11429
- }
11430
- }, 0);
11431
- }
11432
- }, {
11433
- key: "loadImage",
11434
- value: function loadImage(url, mark) {
11435
- var index = getIndex(url, ResourceLoader.toLoadAueue);
11436
- if (-1 !== index) return ResourceLoader.toLoadAueue[index].marks.push(mark), void ResourceLoader.loading();
11437
- ResourceLoader.toLoadAueue.push({
11438
- url: url,
11439
- marks: [mark]
11440
- }), ResourceLoader.loading();
11441
- }
11442
- }, {
11443
- key: "improveImageLoading",
11444
- value: function improveImageLoading(url) {
11445
- var index = getIndex(url, ResourceLoader.toLoadAueue);
11446
- if (-1 !== index) {
11447
- var elememt = ResourceLoader.toLoadAueue.splice(index, 1);
11448
- ResourceLoader.toLoadAueue.unshift(elememt[0]);
11449
- }
11450
- }
11451
11406
  }]);
11452
11407
  return ResourceLoader;
11453
11408
  }();
11454
- function getIndex(url, arr) {
11455
- for (var i = 0; i < arr.length; i++) if (arr[i].url === url) return i;
11456
- return -1;
11457
- }
11458
- ResourceLoader.cache = new Map(), ResourceLoader.isLoading = !1, ResourceLoader.toLoadAueue = [];
11409
+ ResourceLoader.cache = new Map();
11459
11410
 
11460
11411
  var tempMatrix = new Matrix(),
11461
11412
  tempBounds$1 = new AABBBounds();
@@ -12241,7 +12192,7 @@
12241
12192
  data: "init",
12242
12193
  state: null
12243
12194
  };
12244
- 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);
12245
12196
  }
12246
12197
  }, {
12247
12198
  key: "imageLoadSuccess",
@@ -12815,7 +12766,7 @@
12815
12766
  value: function doUpdateAABBBounds() {
12816
12767
  var attribute = this.attribute,
12817
12768
  groupTheme = getTheme(this).group;
12818
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
12769
+ this._AABBBounds.clear();
12819
12770
  var bounds = application.graphicService.updateGroupAABBBounds(attribute, groupTheme, this._AABBBounds, this),
12820
12771
  _attribute$boundsPadd = attribute.boundsPadding,
12821
12772
  boundsPadding = _attribute$boundsPadd === void 0 ? groupTheme.boundsPadding : _attribute$boundsPadd,
@@ -13636,7 +13587,7 @@
13636
13587
  key: "doUpdateAABBBounds",
13637
13588
  value: function doUpdateAABBBounds(full) {
13638
13589
  var circleTheme = getTheme(this).circle;
13639
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
13590
+ this._AABBBounds.clear();
13640
13591
  var attribute = this.attribute,
13641
13592
  bounds = application.graphicService.updateCircleAABBBounds(attribute, getTheme(this).circle, this._AABBBounds, full, this),
13642
13593
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -13823,7 +13774,7 @@
13823
13774
  return CanvasTextLayout;
13824
13775
  }();
13825
13776
 
13826
- 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));
13827
13778
  var Text = /*#__PURE__*/function (_Graphic) {
13828
13779
  _inherits(Text, _Graphic);
13829
13780
  var _super = _createSuper(Text);
@@ -13903,7 +13854,7 @@
13903
13854
  key: "doUpdateAABBBounds",
13904
13855
  value: function doUpdateAABBBounds() {
13905
13856
  var textTheme = getTheme(this).text;
13906
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
13857
+ this._AABBBounds.clear();
13907
13858
  var attribute = this.attribute,
13908
13859
  bounds = application.graphicService.updateTextAABBBounds(attribute, textTheme, this._AABBBounds, this),
13909
13860
  _this$attribute$bound = this.attribute.boundsPadding,
@@ -15382,7 +15333,7 @@
15382
15333
  key: "doUpdateAABBBounds",
15383
15334
  value: function doUpdateAABBBounds(full) {
15384
15335
  var symbolTheme = getTheme(this).symbol;
15385
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
15336
+ this._AABBBounds.clear();
15386
15337
  var attribute = this.attribute,
15387
15338
  bounds = application.graphicService.updateSymbolAABBBounds(attribute, getTheme(this).symbol, this._AABBBounds, full, this),
15388
15339
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -15472,7 +15423,7 @@
15472
15423
  key: "doUpdateAABBBounds",
15473
15424
  value: function doUpdateAABBBounds() {
15474
15425
  var lineTheme = getTheme(this).line;
15475
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
15426
+ this._AABBBounds.clear();
15476
15427
  var attribute = this.attribute,
15477
15428
  bounds = application.graphicService.updateLineAABBBounds(attribute, getTheme(this).line, this._AABBBounds, this),
15478
15429
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -15563,7 +15514,7 @@
15563
15514
  key: "doUpdateAABBBounds",
15564
15515
  value: function doUpdateAABBBounds() {
15565
15516
  var rectTheme = getTheme(this).rect;
15566
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
15517
+ this._AABBBounds.clear();
15567
15518
  var attribute = this.attribute,
15568
15519
  bounds = application.graphicService.updateRectAABBBounds(attribute, getTheme(this).rect, this._AABBBounds, this),
15569
15520
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -15793,7 +15744,7 @@
15793
15744
  }, {
15794
15745
  key: "doUpdateAABBBounds",
15795
15746
  value: function doUpdateAABBBounds() {
15796
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
15747
+ this._AABBBounds.clear();
15797
15748
  var bounds = application.graphicService.updateGlyphAABBBounds(this.attribute, getTheme(this).glyph, this._AABBBounds, this);
15798
15749
  return this.clearUpdateBoundTag(), bounds;
15799
15750
  }
@@ -16179,7 +16130,7 @@
16179
16130
  key: "doUpdateAABBBounds",
16180
16131
  value: function doUpdateAABBBounds() {
16181
16132
  var imageTheme = getTheme(this).image;
16182
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
16133
+ this._AABBBounds.clear();
16183
16134
  var attribute = this.attribute,
16184
16135
  bounds = application.graphicService.updateImageAABBBounds(attribute, getTheme(this).image, this._AABBBounds, this),
16185
16136
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -16538,7 +16489,7 @@
16538
16489
  key: "doUpdateAABBBounds",
16539
16490
  value: function doUpdateAABBBounds() {
16540
16491
  var richTextTheme = getTheme(this).richtext;
16541
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
16492
+ this._AABBBounds.clear();
16542
16493
  var attribute = this.attribute,
16543
16494
  bounds = application.graphicService.updateRichTextAABBBounds(attribute, getTheme(this).richtext, this._AABBBounds, this),
16544
16495
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -16601,10 +16552,13 @@
16601
16552
  _this2.addUpdateBoundTag(), null === (_a = _this2.stage) || void 0 === _a || _a.renderNextFrame();
16602
16553
  }, icon.richtextId = config.id, paragraphs.push(icon);
16603
16554
  }
16604
- } else if (textConfig[i].text.includes("\n")) {
16605
- var textParts = textConfig[i].text.split("\n");
16606
- for (var j = 0; j < textParts.length; j++) paragraphs.push(new Paragraph(textParts[j], 0 !== j, textConfig[i]));
16607
- } 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
+ }
16608
16562
  var maxWidthFinite = "number" == typeof maxWidth && Number.isFinite(maxWidth) && maxWidth > 0,
16609
16563
  maxHeightFinite = "number" == typeof maxHeight && Number.isFinite(maxHeight) && maxHeight > 0,
16610
16564
  richTextWidthEnable = "number" == typeof width && Number.isFinite(width) && width > 0 && (!maxWidthFinite || width <= maxWidth),
@@ -16723,7 +16677,7 @@
16723
16677
  key: "doUpdateAABBBounds",
16724
16678
  value: function doUpdateAABBBounds() {
16725
16679
  var pathTheme = getTheme(this).path;
16726
- this.doUpdatePathShape(), this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
16680
+ this.doUpdatePathShape(), this._AABBBounds.clear();
16727
16681
  var attribute = this.attribute,
16728
16682
  bounds = application.graphicService.updatePathAABBBounds(attribute, getTheme(this).path, this._AABBBounds, this),
16729
16683
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -16811,7 +16765,7 @@
16811
16765
  key: "doUpdateAABBBounds",
16812
16766
  value: function doUpdateAABBBounds() {
16813
16767
  var areaTheme = getTheme(this).area;
16814
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
16768
+ this._AABBBounds.clear();
16815
16769
  var attribute = this.attribute,
16816
16770
  bounds = application.graphicService.updateAreaAABBBounds(attribute, getTheme(this).area, this._AABBBounds, this),
16817
16771
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -17014,7 +16968,7 @@
17014
16968
  key: "doUpdateAABBBounds",
17015
16969
  value: function doUpdateAABBBounds(full) {
17016
16970
  var arcTheme = getTheme(this).arc;
17017
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
16971
+ this._AABBBounds.clear();
17018
16972
  var attribute = this.attribute,
17019
16973
  bounds = application.graphicService.updateArcAABBBounds(attribute, getTheme(this).arc, this._AABBBounds, full, this),
17020
16974
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -17100,7 +17054,7 @@
17100
17054
  key: "doUpdateAABBBounds",
17101
17055
  value: function doUpdateAABBBounds() {
17102
17056
  var polygonTheme = getTheme(this).arc;
17103
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
17057
+ this._AABBBounds.clear();
17104
17058
  var attribute = this.attribute,
17105
17059
  bounds = application.graphicService.updateArc3dAABBBounds(attribute, getTheme(this).polygon, this._AABBBounds, this),
17106
17060
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -17148,7 +17102,7 @@
17148
17102
  key: "doUpdateAABBBounds",
17149
17103
  value: function doUpdateAABBBounds() {
17150
17104
  var polygonTheme = getTheme(this).polygon;
17151
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
17105
+ this._AABBBounds.clear();
17152
17106
  var attribute = this.attribute,
17153
17107
  bounds = application.graphicService.updatePolygonAABBBounds(attribute, getTheme(this).polygon, this._AABBBounds, this),
17154
17108
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -17221,7 +17175,7 @@
17221
17175
  key: "doUpdateAABBBounds",
17222
17176
  value: function doUpdateAABBBounds() {
17223
17177
  var polygonTheme = getTheme(this).polygon;
17224
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
17178
+ this._AABBBounds.clear();
17225
17179
  var attribute = this.attribute,
17226
17180
  bounds = application.graphicService.updatePyramid3dAABBBounds(attribute, getTheme(this).polygon, this._AABBBounds, this),
17227
17181
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -18181,35 +18135,37 @@
18181
18135
  }, {
18182
18136
  key: "transformAABBBounds",
18183
18137
  value: function transformAABBBounds(attribute, aabbBounds, theme, miter, graphic) {
18184
- var _attribute$scaleX2 = attribute.scaleX,
18185
- scaleX = _attribute$scaleX2 === void 0 ? theme.scaleX : _attribute$scaleX2,
18186
- _attribute$scaleY2 = attribute.scaleY,
18187
- scaleY = _attribute$scaleY2 === void 0 ? theme.scaleY : _attribute$scaleY2,
18188
- _attribute$stroke = attribute.stroke,
18189
- stroke = _attribute$stroke === void 0 ? theme.stroke : _attribute$stroke,
18190
- _attribute$shadowBlur2 = attribute.shadowBlur,
18191
- shadowBlur = _attribute$shadowBlur2 === void 0 ? theme.shadowBlur : _attribute$shadowBlur2,
18192
- _attribute$lineWidth = attribute.lineWidth,
18193
- lineWidth = _attribute$lineWidth === void 0 ? theme.lineWidth : _attribute$lineWidth,
18194
- _attribute$pickStroke = attribute.pickStrokeBuffer,
18195
- pickStrokeBuffer = _attribute$pickStroke === void 0 ? theme.pickStrokeBuffer : _attribute$pickStroke,
18196
- _attribute$strokeBoun2 = attribute.strokeBoundsBuffer,
18197
- strokeBoundsBuffer = _attribute$strokeBoun2 === void 0 ? theme.strokeBoundsBuffer : _attribute$strokeBoun2,
18198
- tb1 = this.tempAABBBounds1,
18199
- tb2 = this.tempAABBBounds2;
18200
- if (stroke && lineWidth) {
18201
- var scaledHalfLineWidth = (lineWidth + pickStrokeBuffer) / Math.abs(scaleX + scaleY);
18202
- 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
+ }
18203
18167
  }
18204
- if (shadowBlur) {
18205
- var _attribute$shadowOffs = attribute.shadowOffsetX,
18206
- shadowOffsetX = _attribute$shadowOffs === void 0 ? theme.shadowOffsetX : _attribute$shadowOffs,
18207
- _attribute$shadowOffs2 = attribute.shadowOffsetY,
18208
- shadowOffsetY = _attribute$shadowOffs2 === void 0 ? theme.shadowOffsetY : _attribute$shadowOffs2,
18209
- shadowBlurWidth = shadowBlur / Math.abs(scaleX + scaleY) * 2;
18210
- boundStroke(tb1, shadowBlurWidth, !1, strokeBoundsBuffer + 1), tb1.translate(shadowOffsetX, shadowOffsetY), aabbBounds.union(tb1);
18211
- }
18212
- this.combindShadowAABBBounds(aabbBounds, graphic);
18168
+ if (this.combindShadowAABBBounds(aabbBounds, graphic), aabbBounds.empty()) return;
18213
18169
  var updateMatrix = !0;
18214
18170
  var m = graphic.transMatrix;
18215
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);
@@ -20805,7 +20761,10 @@
20805
20761
  var res = graphic.resources.get(background);
20806
20762
  if ("success" !== res.state || !res.data) return;
20807
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();
20808
- } 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
+ }
20809
20768
  shouldReCalBounds && boundsAllocate.free(b);
20810
20769
  }
20811
20770
  }]);
@@ -21240,9 +21199,7 @@
21240
21199
  value: function draw(image, renderService, drawContext) {
21241
21200
  var url = image.attribute.image;
21242
21201
  if (!url || !image.resources) return;
21243
- var res = image.resources.get(url);
21244
- if ("loading" === res.state && isString$1(url)) return void ResourceLoader.improveImageLoading(url);
21245
- if ("success" !== res.state) return;
21202
+ if ("success" !== image.resources.get(url).state) return;
21246
21203
  var context = renderService.drawParams.context;
21247
21204
  if (!context) return;
21248
21205
  var imageAttribute = getTheme(image).image;
@@ -22270,7 +22227,7 @@
22270
22227
  var d = context.dpr % 1;
22271
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);
22272
22229
  var drawInArea = dirtyBounds.width() * context.dpr < context.canvas.width || dirtyBounds.height() * context.dpr < context.canvas.height;
22273
- 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) {
22274
22231
  var _a, _b;
22275
22232
  return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
22276
22233
  }).forEach(function (group) {
@@ -22333,7 +22290,7 @@
22333
22290
  }, subLayers.set(group._uid, incrementalLayer));
22334
22291
  var incrementalContext = incrementalLayer.layer.getNativeHandler().getContext(),
22335
22292
  idc = incrementalLayer.drawContribution || container.get(IncrementalDrawContribution);
22336
- 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), {
22337
22294
  drawContribution: idc,
22338
22295
  clear: "transparent",
22339
22296
  layer: incrementalLayer.layer,
@@ -31126,6 +31083,105 @@
31126
31083
  c.load(mathModule), c.load(mathPickerModule);
31127
31084
  }
31128
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
+
31129
31185
  var __decorate$H = undefined && undefined.__decorate || function (decorators, target, key, desc) {
31130
31186
  var d,
31131
31187
  c = arguments.length,
@@ -31136,31 +31192,12 @@
31136
31192
  __metadata$z = undefined && undefined.__metadata || function (k, v) {
31137
31193
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
31138
31194
  };
31139
- function makeUpCanvas$3(domref, canvasIdLists, canvasMap, freeCanvasIdx, freeCanvasList) {
31140
- var dpr = tt.getSystemInfoSync().pixelRatio;
31195
+ function makeUpCanvas$3(domref, canvasIdLists, canvasMap, freeCanvasIdx, freeCanvasList, pixelRatio) {
31196
+ var dpr = null != pixelRatio ? pixelRatio : tt.getSystemInfoSync().pixelRatio;
31141
31197
  canvasIdLists.forEach(function (id, i) {
31142
- var ctx = tt.createCanvasContext(id);
31143
- ctx.canvas = {
31144
- width: domref.width * dpr,
31145
- height: domref.height * dpr
31146
- };
31147
- var canvas = {
31148
- width: domref.width * dpr,
31149
- height: domref.height * dpr,
31150
- offsetWidth: domref.width,
31151
- offsetHeight: domref.height,
31152
- id: null != id ? id : "",
31153
- getContext: function getContext() {
31154
- return ctx;
31155
- },
31156
- getBoundingClientRect: function getBoundingClientRect() {
31157
- return {
31158
- height: domref.height,
31159
- width: domref.width
31160
- };
31161
- }
31162
- };
31163
- 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);
31164
31201
  });
31165
31202
  }
31166
31203
  var FeishuEnvContribution = /*#__PURE__*/function (_BaseEnvContribution) {
@@ -31191,7 +31228,7 @@
31191
31228
  }, {
31192
31229
  key: "configure",
31193
31230
  value: function configure(service, params) {
31194
- 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));
31195
31232
  }
31196
31233
  }, {
31197
31234
  key: "loadImage",
@@ -31369,11 +31406,11 @@
31369
31406
  value: function draw() {
31370
31407
  var _this = this;
31371
31408
  var _context = this.nativeContext;
31372
- this.drawPromise = new Promise(function (resolve) {
31409
+ _context.draw && (this.drawPromise = new Promise(function (resolve) {
31373
31410
  _context.draw(!0, function () {
31374
31411
  _this.drawPromise = null, resolve(null);
31375
31412
  });
31376
- });
31413
+ }));
31377
31414
  }
31378
31415
  }]);
31379
31416
  return LynxContext2d;
@@ -31642,32 +31679,13 @@
31642
31679
  try {
31643
31680
  ng = !!lynx.createCanvasNG;
31644
31681
  } catch (err) {}
31645
- function makeUpCanvas$2(domref, canvasIdLists, canvasMap, freeCanvasIdx, freeCanvasList) {
31646
- var dpr = SystemInfo.pixelRatio;
31682
+ function makeUpCanvas$2(domref, canvasIdLists, canvasMap, freeCanvasIdx, freeCanvasList, pixelRatio) {
31683
+ var dpr = null != pixelRatio ? pixelRatio : SystemInfo.pixelRatio;
31647
31684
  canvasIdLists.forEach(function (id, i) {
31648
31685
  var _canvas = ng ? lynx.createCanvasNG(id) : lynx.createCanvas(id);
31649
31686
  _canvas.width = domref.width * dpr, _canvas.height = domref.height * dpr, ng && _canvas.attachToCanvasView(id);
31650
- var ctx = _canvas.getContext("2d");
31651
- ctx.draw = function (a, b) {
31652
- b();
31653
- };
31654
- var canvas = {
31655
- width: domref.width * dpr,
31656
- height: domref.height * dpr,
31657
- offsetWidth: domref.width,
31658
- offsetHeight: domref.height,
31659
- id: null != id ? id : "",
31660
- getContext: function getContext() {
31661
- return ctx;
31662
- },
31663
- getBoundingClientRect: function getBoundingClientRect() {
31664
- return {
31665
- height: domref.height,
31666
- width: domref.width
31667
- };
31668
- },
31669
- nativeCanvas: _canvas
31670
- };
31687
+ var ctx = _canvas.getContext("2d"),
31688
+ canvas = new CanvasWrapEnableWH(_canvas, ctx, dpr, domref.width, domref.height, id);
31671
31689
  canvasMap.set(id, canvas), i >= freeCanvasIdx && freeCanvasList.push(canvas);
31672
31690
  });
31673
31691
  }
@@ -31701,7 +31719,7 @@
31701
31719
  _createClass(LynxEnvContribution, [{
31702
31720
  key: "configure",
31703
31721
  value: function configure(service, params) {
31704
- 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));
31705
31723
  }
31706
31724
  }, {
31707
31725
  key: "getDynamicCanvasCount",
@@ -32293,6 +32311,34 @@
32293
32311
  value: function createPattern(image, repetition) {
32294
32312
  return null;
32295
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
+ }
32296
32342
  }]);
32297
32343
  return TaroContext2d;
32298
32344
  }(BrowserContext2d);
@@ -32560,47 +32606,9 @@
32560
32606
  };
32561
32607
  function makeUpCanvas$1(domref, canvasIdLists, canvasMap, freeCanvasIdx, freeCanvasList, taro, dpr) {
32562
32608
  canvasIdLists.forEach(function (id, i) {
32563
- var ctx = taro.createCanvasContext(id);
32564
- ctx.canvas = {
32565
- width: domref.width * dpr,
32566
- height: domref.height * dpr
32567
- }, ctx.createRadialGradient || (ctx.createRadialGradient = function () {
32568
- return ctx.createCircularGradient.apply(ctx, arguments);
32569
- }), !ctx.getImageData && taro.canvasGetImageData && (ctx.getImageData = function (x, y, width, height) {
32570
- return new Promise(function (resolve, reject) {
32571
- try {
32572
- taro.canvasGetImageData({
32573
- canvasId: id,
32574
- x: x,
32575
- y: y,
32576
- width: width,
32577
- height: height,
32578
- success: function success(res) {
32579
- resolve(res);
32580
- }
32581
- });
32582
- } catch (err) {
32583
- reject(err);
32584
- }
32585
- });
32586
- });
32587
- var canvas = {
32588
- id: id,
32589
- width: domref.width * dpr,
32590
- height: domref.height * dpr,
32591
- offsetWidth: domref.width,
32592
- offsetHeight: domref.height,
32593
- getContext: function getContext() {
32594
- return ctx;
32595
- },
32596
- getBoundingClientRect: function getBoundingClientRect() {
32597
- return {
32598
- height: domref.height,
32599
- width: domref.width
32600
- };
32601
- }
32602
- };
32603
- 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;
32604
32612
  });
32605
32613
  }
32606
32614
  var TaroEnvContribution = /*#__PURE__*/function (_BaseEnvContribution) {
@@ -34845,7 +34853,7 @@
34845
34853
 
34846
34854
  var roughModule = _roughModule;
34847
34855
 
34848
- const version = "0.17.18-alpha.0";
34856
+ const version = "0.17.18";
34849
34857
  preLoadAllModule();
34850
34858
  if (isBrowserEnv()) {
34851
34859
  loadBrowserEnv(container);