@visactor/vrender 0.19.0-alpha.1 → 0.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1723,6 +1723,11 @@
1723
1723
  value: function createDom(params) {
1724
1724
  return this._env || this.setEnv("browser"), this.envContribution.createDom(params);
1725
1725
  }
1726
+ }, {
1727
+ key: "updateDom",
1728
+ value: function updateDom(dom, params) {
1729
+ return this._env || this.setEnv("browser"), this.envContribution.updateDom(dom, params);
1730
+ }
1726
1731
  }, {
1727
1732
  key: "getElementTop",
1728
1733
  value: function getElementTop(dom) {
@@ -3512,6 +3517,52 @@
3512
3517
  }();
3513
3518
  TextMeasure.ALPHABET_CHAR_SET = "abcdefghijklmnopqrstuvwxyz", TextMeasure.NUMBERS_CHAR_SET = "0123456789", TextMeasure.FULL_SIZE_CHAR = "字";
3514
3519
 
3520
+ var calculateAnchorOfBounds = function calculateAnchorOfBounds(bounds, anchorType) {
3521
+ var x1 = bounds.x1,
3522
+ x2 = bounds.x2,
3523
+ y1 = bounds.y1,
3524
+ y2 = bounds.y2,
3525
+ rectWidth = Math.abs(x2 - x1),
3526
+ rectHeight = Math.abs(y2 - y1);
3527
+ var anchorX = (x1 + x2) / 2,
3528
+ anchorY = (y1 + y2) / 2,
3529
+ sx = 0,
3530
+ sy = 0;
3531
+ switch (anchorType) {
3532
+ case "top":
3533
+ case "inside-top":
3534
+ sy = -.5;
3535
+ break;
3536
+ case "bottom":
3537
+ case "inside-bottom":
3538
+ sy = .5;
3539
+ break;
3540
+ case "left":
3541
+ case "inside-left":
3542
+ sx = -.5;
3543
+ break;
3544
+ case "right":
3545
+ case "inside-right":
3546
+ sx = .5;
3547
+ break;
3548
+ case "top-right":
3549
+ sx = .5, sy = -.5;
3550
+ break;
3551
+ case "top-left":
3552
+ sx = -.5, sy = -.5;
3553
+ break;
3554
+ case "bottom-right":
3555
+ sx = .5, sy = .5;
3556
+ break;
3557
+ case "bottom-left":
3558
+ sx = -.5, sy = .5;
3559
+ }
3560
+ return anchorX += sx * rectWidth, anchorY += sy * rectHeight, {
3561
+ x: anchorX,
3562
+ y: anchorY
3563
+ };
3564
+ };
3565
+
3515
3566
  var hasConsole = "undefined" != typeof console;
3516
3567
  function log(method, level, input) {
3517
3568
  var args = [level].concat([].slice.call(input));
@@ -3635,6 +3686,24 @@
3635
3686
  }();
3636
3687
  Logger._instance = null;
3637
3688
 
3689
+ var styleStringToObject = function styleStringToObject() {
3690
+ var styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
3691
+ var res = {};
3692
+ return styleStr.split(";").forEach(function (item) {
3693
+ if (item) {
3694
+ var arr = item.split(":");
3695
+ if (2 === arr.length) {
3696
+ var key = arr[0].trim(),
3697
+ value = arr[1].trim();
3698
+ key && value && (res[key] = value);
3699
+ }
3700
+ }
3701
+ }), res;
3702
+ };
3703
+ var lowerCamelCaseToMiddle = function lowerCamelCaseToMiddle(str) {
3704
+ return str.replace(/([A-Z])/g, "-$1").toLowerCase();
3705
+ };
3706
+
3638
3707
  var circleThreshold = tau - 1e-8;
3639
3708
  var BoundsContext = /*#__PURE__*/function () {
3640
3709
  function BoundsContext(bounds) {
@@ -5100,6 +5169,8 @@
5100
5169
  pickStrokeBuffer: 0
5101
5170
  };
5102
5171
  var DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({
5172
+ forceBoundsWidth: void 0,
5173
+ forceBoundsHeight: void 0,
5103
5174
  opacity: 1,
5104
5175
  background: null,
5105
5176
  backgroundOpacity: 1,
@@ -5126,6 +5197,7 @@
5126
5197
  };
5127
5198
  var DefaultAttribute = Object.assign(Object.assign(Object.assign({
5128
5199
  strokeSeg: null,
5200
+ renderable: !0,
5129
5201
  pickable: !0,
5130
5202
  childrenPickable: !0,
5131
5203
  fillPickable: !0,
@@ -5252,6 +5324,7 @@
5252
5324
  textBaseline: "top",
5253
5325
  layoutDirection: "horizontal",
5254
5326
  textConfig: [],
5327
+ disableAutoWrapLine: !1,
5255
5328
  maxHeight: void 0,
5256
5329
  maxWidth: void 0,
5257
5330
  singleLine: !1
@@ -5328,7 +5401,11 @@
5328
5401
  function applyFillStyle(ctx, character) {
5329
5402
  var fillStyle = character && character.fill || defaultFormatting.fill;
5330
5403
  if (!fillStyle) return void (ctx.globalAlpha = 0);
5331
- ctx.globalAlpha = 1, ctx.fillStyle = fillStyle;
5404
+ var _character$fillOpacit = character.fillOpacity,
5405
+ fillOpacity = _character$fillOpacit === void 0 ? 1 : _character$fillOpacit,
5406
+ _character$opacity = character.opacity,
5407
+ opacity = _character$opacity === void 0 ? 1 : _character$opacity;
5408
+ ctx.globalAlpha = fillOpacity * opacity, ctx.fillStyle = fillStyle;
5332
5409
  var fontSize = character.fontSize || 16;
5333
5410
  switch (character.script) {
5334
5411
  case "super":
@@ -5347,7 +5424,11 @@
5347
5424
  function applyStrokeStyle(ctx, character) {
5348
5425
  var strokeStyle = character && character.stroke || defaultFormatting.stroke;
5349
5426
  if (!strokeStyle) return void (ctx.globalAlpha = 0);
5350
- ctx.globalAlpha = 1, ctx.lineWidth = character && "number" == typeof character.lineWidth ? character.lineWidth : 1, ctx.strokeStyle = strokeStyle;
5427
+ var _character$strokeOpac = character.strokeOpacity,
5428
+ strokeOpacity = _character$strokeOpac === void 0 ? 1 : _character$strokeOpac,
5429
+ _character$opacity2 = character.opacity,
5430
+ opacity = _character$opacity2 === void 0 ? 1 : _character$opacity2;
5431
+ ctx.globalAlpha = strokeOpacity * opacity, ctx.lineWidth = character && "number" == typeof character.lineWidth ? character.lineWidth : 1, ctx.strokeStyle = strokeStyle;
5351
5432
  var fontSize = character.fontSize || 16;
5352
5433
  switch (character.script) {
5353
5434
  case "super":
@@ -5679,13 +5760,14 @@
5679
5760
  }, {
5680
5761
  key: "clipTextWithSuffix",
5681
5762
  value: function clipTextWithSuffix(text, options, width, suffix, wordBreak, position) {
5763
+ var forceSuffix = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !1;
5682
5764
  if ("" === suffix) return this.clipText(text, options, width, wordBreak);
5683
5765
  if (0 === text.length) return {
5684
5766
  str: "",
5685
5767
  width: 0
5686
5768
  };
5687
5769
  var length = this.measureTextWidth(text, options);
5688
- if (length <= width) return {
5770
+ if (!forceSuffix && length <= width) return {
5689
5771
  str: text,
5690
5772
  width: length
5691
5773
  };
@@ -5694,12 +5776,16 @@
5694
5776
  str: "",
5695
5777
  width: 0
5696
5778
  };
5779
+ if (forceSuffix && length + suffixWidth <= width) return {
5780
+ str: text + suffix,
5781
+ width: length + suffixWidth
5782
+ };
5697
5783
  width -= suffixWidth;
5698
5784
  var data = this._clipText(text, options, width, 0, text.length - 1, position, suffix);
5699
5785
  if (wordBreak && data.str !== text) {
5700
5786
  var index = testLetter(text, data.str.length);
5701
- index !== data.str.length && (data.str = text.substring(0, index), data.width = this.measureTextWidth(data.str, options));
5702
- }
5787
+ index !== data.str.length && (data.result = text.substring(0, index), data.width = this.measureTextWidth(data.str, options));
5788
+ } else forceSuffix && data.str === text && (data.result = text + suffix);
5703
5789
  return data.str = data.result, data.width += suffixWidth, data;
5704
5790
  }
5705
5791
  }]);
@@ -6585,7 +6671,6 @@
6585
6671
  symbol: DefaultSymbolAttribute,
6586
6672
  text: DefaultTextAttribute,
6587
6673
  rect: DefaultRectAttribute,
6588
- rect3d: DefaultRect3dAttribute,
6589
6674
  polygon: DefaultPolygonAttribute,
6590
6675
  richtext: DefaultRichTextAttribute,
6591
6676
  richtextIcon: DefaultRichTextIconAttribute,
@@ -6604,7 +6689,6 @@
6604
6689
  symbol: Object.assign({}, defaultThemeObj.symbol),
6605
6690
  text: Object.assign({}, defaultThemeObj.text),
6606
6691
  rect: Object.assign({}, defaultThemeObj.rect),
6607
- rect3d: Object.assign({}, defaultThemeObj.rect3d),
6608
6692
  polygon: Object.assign({}, defaultThemeObj.polygon),
6609
6693
  richtext: Object.assign({}, defaultThemeObj.richtext),
6610
6694
  richtextIcon: Object.assign({}, defaultThemeObj.richtextIcon),
@@ -7532,7 +7616,12 @@
7532
7616
  for (; overTargetAncestor && overTargetAncestor !== _this.rootTarget.parent && overTargetAncestor !== e.target;) overTargetAncestor = overTargetAncestor.parent;
7533
7617
  if (!overTargetAncestor || overTargetAncestor === _this.rootTarget.parent) {
7534
7618
  var enterEvent = _this.clonePointerEvent(e, "pointerenter");
7535
- for (enterEvent.eventPhase = enterEvent.AT_TARGET; enterEvent.target && enterEvent.target !== outTarget && enterEvent.target !== _this.rootTarget.parent;) enterEvent.currentTarget = enterEvent.target, _this.notifyTarget(enterEvent), isMouse && _this.notifyTarget(enterEvent, "mouseenter"), enterEvent.target = enterEvent.target.parent;
7619
+ enterEvent.eventPhase = enterEvent.AT_TARGET;
7620
+ var currentTarget = enterEvent.target;
7621
+ var outTargetAncestors = new Set();
7622
+ var ancestor = outTarget;
7623
+ for (; ancestor && ancestor !== _this.rootTarget;) outTargetAncestors.add(ancestor), ancestor = ancestor.parent;
7624
+ for (; currentTarget && currentTarget !== outTarget && currentTarget !== _this.rootTarget.parent;) outTargetAncestors.has(currentTarget) || (enterEvent.currentTarget = currentTarget, _this.notifyTarget(enterEvent), isMouse && _this.notifyTarget(enterEvent, "mouseenter")), currentTarget = currentTarget.parent;
7536
7625
  _this.freeEvent(enterEvent);
7537
7626
  }
7538
7627
  _this.freeEvent(overEvent);
@@ -7776,8 +7865,6 @@
7776
7865
  }();
7777
7866
 
7778
7867
  var EventTarget = {
7779
- pickable: !0,
7780
- visible: !0,
7781
7868
  dispatchEvent: function dispatchEvent(e) {
7782
7869
  var _a;
7783
7870
  if (!(e instanceof FederatedEvent)) throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");
@@ -11813,19 +11900,17 @@
11813
11900
  var _a, _b, _c, _d;
11814
11901
  if (hasAnimation) {
11815
11902
  var keys = Object.keys(attrs),
11816
- noWorkAAttr = this.getNoWorkAnimateAttr(),
11903
+ noWorkAttrs = this.getNoWorkAnimateAttr(),
11817
11904
  animateAttrs = {};
11818
11905
  var noAnimateAttrs;
11819
- isClear ? keys.forEach(function (key) {
11820
- noWorkAAttr[key] ? (noAnimateAttrs || (noAnimateAttrs = {}), noAnimateAttrs[key] = attrs[key]) : animateAttrs[key] = void 0 === attrs[key] ? _this3.getDefaultAttribute(key) : attrs[key];
11821
- }) : keys.forEach(function (key) {
11822
- noWorkAAttr[key] ? (noAnimateAttrs || (noAnimateAttrs = {}), noAnimateAttrs[key] = attrs[key]) : animateAttrs[key] = attrs[key];
11906
+ keys.forEach(function (key) {
11907
+ noWorkAttrs[key] ? (noAnimateAttrs || (noAnimateAttrs = {}), noAnimateAttrs[key] = attrs[key]) : animateAttrs[key] = isClear && void 0 === attrs[key] ? _this3.getDefaultAttribute(key) : attrs[key];
11823
11908
  });
11824
11909
  var animate = this.animate();
11825
11910
  animate.stateNames = stateNames, animate.to(animateAttrs, null !== (_b = null === (_a = this.stateAnimateConfig) || void 0 === _a ? void 0 : _a.duration) && void 0 !== _b ? _b : DefaultStateAnimateConfig.duration, null !== (_d = null === (_c = this.stateAnimateConfig) || void 0 === _c ? void 0 : _c.easing) && void 0 !== _d ? _d : DefaultStateAnimateConfig.easing), noAnimateAttrs && this.setAttributes(noAnimateAttrs, !1, {
11826
11911
  type: exports.AttributeUpdateType.STATE
11827
11912
  });
11828
- } else this.setAttributes(attrs, !1, {
11913
+ } else this.stopStateAnimates(), this.setAttributes(attrs, !1, {
11829
11914
  type: exports.AttributeUpdateType.STATE
11830
11915
  });
11831
11916
  }
@@ -11842,6 +11927,14 @@
11842
11927
  newNormalAttrs[key] = _this4.getNormalAttribute(key);
11843
11928
  }), this.normalAttrs = newNormalAttrs;
11844
11929
  }
11930
+ }, {
11931
+ key: "stopStateAnimates",
11932
+ value: function stopStateAnimates() {
11933
+ var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "end";
11934
+ this.animates && this.animates.forEach(function (animate) {
11935
+ animate.stateNames && animate.stop(type);
11936
+ });
11937
+ }
11845
11938
  }, {
11846
11939
  key: "getNormalAttribute",
11847
11940
  value: function getNormalAttribute(key) {
@@ -13222,7 +13315,7 @@
13222
13315
  }
13223
13316
  function drawPathProxy(graphic, context, x, y, drawContext, params, fillCb, strokeCb) {
13224
13317
  if (!graphic.pathProxy) return !1;
13225
- var themeAttributes = getTheme(graphic, null == params ? void 0 : params.theme)[graphic.type],
13318
+ var themeAttributes = getTheme(graphic, null == params ? void 0 : params.theme)[graphic.type.replace("3d", "")],
13226
13319
  _graphic$attribute = graphic.attribute,
13227
13320
  _graphic$attribute$fi = _graphic$attribute.fill,
13228
13321
  fill = _graphic$attribute$fi === void 0 ? themeAttributes.fill : _graphic$attribute$fi,
@@ -13644,6 +13737,15 @@
13644
13737
  var buf = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
13645
13738
  return "middle" === baseline ? -lineHeight / 2 : "top" === baseline ? 0 : "bottom" === baseline ? buf - lineHeight : baseline && "alphabetic" !== baseline ? 0 : (fontSize || (fontSize = lineHeight), -(lineHeight - fontSize) / 2 - .79 * fontSize);
13646
13739
  }
13740
+ function textAttributesToStyle(attrs) {
13741
+ var style = {};
13742
+ return ["textAlign", "fontFamily", "fontVariant", "fontStyle", "fontWeight"].forEach(function (key) {
13743
+ attrs[key] && (style[lowerCamelCaseToMiddle(key)] = attrs[key]);
13744
+ }), ["fontSize", "lineHeight"].forEach(function (key) {
13745
+ var styleKey = lowerCamelCaseToMiddle(key);
13746
+ isNil$1(attrs[key]) || (style[styleKey] = /^[0-9]*$/.test("".concat(attrs[key])) ? "".concat(attrs[key], "px") : "".concat(attrs[key]));
13747
+ }), attrs.underline ? style["text-decoration"] = "underline" : attrs.lineThrough && (style["text-decoration"] = "line-through"), attrs.fill && isString$1(attrs.fill) && (style.color = attrs.fill), style;
13748
+ }
13647
13749
 
13648
13750
  var CanvasTextLayout = /*#__PURE__*/function () {
13649
13751
  function CanvasTextLayout(fontFamily, options, textMeasure) {
@@ -13889,7 +13991,7 @@
13889
13991
  var str = lines[i];
13890
13992
  var needCut = !0;
13891
13993
  if (i === lineCountLimit - 1) {
13892
- var _clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
13994
+ var _clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition, i !== lines.length - 1);
13893
13995
  linesLayout.push({
13894
13996
  str: _clip.str,
13895
13997
  width: _clip.width
@@ -15513,7 +15615,7 @@
15513
15615
  vertices: [],
15514
15616
  edges: []
15515
15617
  },
15516
- rectTheme = getTheme(this).rect3d,
15618
+ rectTheme = getTheme(this).rect,
15517
15619
  _this$attribute = this.attribute,
15518
15620
  x1 = _this$attribute.x1,
15519
15621
  y1 = _this$attribute.y1,
@@ -15772,22 +15874,22 @@
15772
15874
  _height = _this$lines$i.height;
15773
15875
  if (top + _height < this[this.directionKey.top] || top + _height > this[this.directionKey.top] + frameHeight) return lastLineTag;
15774
15876
  var lastLine = !1;
15775
- this.ellipsis && this.lines[i + 1] && this.lines[i + 1].top + this.lines[i + 1].height > this[this.directionKey.top] + frameHeight && (lastLine = !0, lastLineTag = !0), this.lines[i].draw(ctx, lastLine, this.lines[i][this.directionKey.left] + deltaX, this.lines[i][this.directionKey.top] + deltaY, drawIcon);
15877
+ this.ellipsis && this.lines[i + 1] && this.lines[i + 1].top + this.lines[i + 1].height > this[this.directionKey.top] + frameHeight && (lastLine = !0, lastLineTag = !0), this.lines[i].draw(ctx, lastLine, this.lines[i][this.directionKey.left] + deltaX, this.lines[i][this.directionKey.top] + deltaY, this.ellipsis, drawIcon);
15776
15878
  } else {
15777
15879
  var detalHeight = Math.floor((frameHeight - this.actualHeight) / 2);
15778
15880
  "vertical" === this.layoutDirection ? deltaX += detalHeight : deltaY += detalHeight;
15779
- for (var _i = 0; _i < this.lines.length; _i++) this.lines[_i].draw(ctx, !1, this.lines[_i][this.directionKey.left] + deltaX, this.lines[_i][this.directionKey.top] + deltaY, drawIcon);
15881
+ for (var _i = 0; _i < this.lines.length; _i++) this.lines[_i].draw(ctx, !1, this.lines[_i][this.directionKey.left] + deltaX, this.lines[_i][this.directionKey.top] + deltaY, this.ellipsis, drawIcon);
15780
15882
  }
15781
15883
  } else if ("bottom" === this.verticalDirection && "vertical" !== this.layoutDirection) for (var _i2 = 0; _i2 < this.lines.length; _i2++) {
15782
15884
  var _this$lines$_i = this.lines[_i2];
15783
15885
  _this$lines$_i.top;
15784
15886
  var _height2 = _this$lines$_i.height,
15785
15887
  y = frameHeight - this.lines[_i2].top - this.lines[_i2].height;
15786
- if (0 === frameHeight) this.lines[_i2].draw(ctx, !1, deltaX, y + deltaY, drawIcon);else {
15888
+ if (0 === frameHeight) this.lines[_i2].draw(ctx, !1, deltaX, y + deltaY, this.ellipsis, drawIcon);else {
15787
15889
  if (y + _height2 > this[this.directionKey.top] + frameHeight || y < this[this.directionKey.top]) return lastLineTag;
15788
15890
  {
15789
15891
  var _lastLine = !1;
15790
- this.ellipsis && this.lines[_i2 + 1] && y - this.lines[_i2 + 1].height < this[this.directionKey.top] && (_lastLine = !0, lastLineTag = !0), this.lines[_i2].draw(ctx, _lastLine, deltaX, y + deltaY, drawIcon);
15892
+ this.ellipsis && this.lines[_i2 + 1] && y - this.lines[_i2 + 1].height < this[this.directionKey.top] && (_lastLine = !0, lastLineTag = !0), this.lines[_i2].draw(ctx, _lastLine, deltaX, y + deltaY, this.ellipsis, drawIcon);
15791
15893
  }
15792
15894
  }
15793
15895
  } else {
@@ -15797,11 +15899,11 @@
15797
15899
  var _this$lines$_i2 = this.lines[_i3],
15798
15900
  _top2 = _this$lines$_i2.top,
15799
15901
  _height3 = _this$lines$_i2.height;
15800
- if (0 === frameHeight) this.lines[_i3].draw(ctx, !1, this.lines[_i3][this.directionKey.left] + deltaX, this.lines[_i3][this.directionKey.top] + deltaY, drawIcon);else {
15902
+ if (0 === frameHeight) this.lines[_i3].draw(ctx, !1, this.lines[_i3][this.directionKey.left] + deltaX, this.lines[_i3][this.directionKey.top] + deltaY, this.ellipsis, drawIcon);else {
15801
15903
  if (_top2 + _height3 < this[this.directionKey.top] || _top2 + _height3 > this[this.directionKey.top] + frameHeight) return lastLineTag;
15802
15904
  {
15803
15905
  var _lastLine2 = !1;
15804
- this.ellipsis && this.lines[_i3 + 1] && this.lines[_i3 + 1].top + this.lines[_i3 + 1].height > this[this.directionKey.top] + frameHeight && (_lastLine2 = !0, lastLineTag = !0), this.lines[_i3].draw(ctx, _lastLine2, this.lines[_i3][this.directionKey.left] + deltaX, this.lines[_i3][this.directionKey.top] + deltaY, drawIcon);
15906
+ this.ellipsis && this.lines[_i3 + 1] && this.lines[_i3 + 1].top + this.lines[_i3 + 1].height > this[this.directionKey.top] + frameHeight && (_lastLine2 = !0, lastLineTag = !0), this.lines[_i3].draw(ctx, _lastLine2, this.lines[_i3][this.directionKey.left] + deltaX, this.lines[_i3][this.directionKey.top] + deltaY, this.ellipsis, drawIcon);
15805
15907
  }
15806
15908
  }
15807
15909
  }
@@ -15844,7 +15946,8 @@
15844
15946
  top = _this$lines$i2.top,
15845
15947
  _height4 = _this$lines$i2.height;
15846
15948
  if (top + _height4 < this[this.directionKey.top] || top + _height4 > this[this.directionKey.top] + frameHeight) ;else if (this.ellipsis && this.lines[i + 1] && this.lines[i + 1].top + this.lines[i + 1].height > this[this.directionKey.top] + frameHeight) {
15847
- var lineWidth = this.lines[i].getWidthWithEllips();
15949
+ var ellipsis = !0 === this.ellipsis ? "..." : this.ellipsis || "",
15950
+ lineWidth = this.lines[i].getWidthWithEllips(ellipsis);
15848
15951
  lineWidth > widthBound && (widthBound = lineWidth), heightBound += this.lines[i].height;
15849
15952
  } else this.lines[i].actualWidth > widthBound && (widthBound = this.lines[i].actualWidth), heightBound += this.lines[i].height;
15850
15953
  } else {
@@ -15858,7 +15961,8 @@
15858
15961
  y = frameHeight - this.lines[_i5].top - this.lines[_i5].height;
15859
15962
  if (0 === frameHeight) this.lines[_i5].actualWidth > widthBound && (widthBound = this.lines[_i5].actualWidth), heightBound += this.lines[_i5].height;else if (y + _height5 > this[this.directionKey.top] + frameHeight || y < this[this.directionKey.top]) ;else {
15860
15963
  if (this.ellipsis && this.lines[_i5 + 1] && y - this.lines[_i5 + 1].height < this[this.directionKey.top]) {
15861
- var _lineWidth = this.lines[_i5].getWidthWithEllips();
15964
+ var _ellipsis = !0 === this.ellipsis ? "..." : this.ellipsis || "",
15965
+ _lineWidth = this.lines[_i5].getWidthWithEllips(_ellipsis);
15862
15966
  _lineWidth > widthBound && (widthBound = _lineWidth), heightBound += this.lines[_i5].height;
15863
15967
  } else this.lines[_i5].actualWidth > widthBound && (widthBound = this.lines[_i5].actualWidth), heightBound += this.lines[_i5].height;
15864
15968
  }
@@ -15868,7 +15972,8 @@
15868
15972
  _height6 = _this$lines$_i4.height;
15869
15973
  if (0 === frameHeight) this.lines[_i6].actualWidth > widthBound && (widthBound = this.lines[_i6].actualWidth), heightBound += this.lines[_i6].height;else if (_top4 + _height6 < this[this.directionKey.top] || _top4 + _height6 > this[this.directionKey.top] + frameHeight) ;else {
15870
15974
  if (this.ellipsis && this.lines[_i6 + 1] && this.lines[_i6 + 1].top + this.lines[_i6 + 1].height > this[this.directionKey.top] + frameHeight) {
15871
- var _lineWidth2 = this.lines[_i6].getWidthWithEllips();
15975
+ var _ellipsis2 = !0 === this.ellipsis ? "..." : this.ellipsis || "",
15976
+ _lineWidth2 = this.lines[_i6].getWidthWithEllips(_ellipsis2);
15872
15977
  _lineWidth2 > widthBound && (widthBound = _lineWidth2), heightBound += this.lines[_i6].height;
15873
15978
  } else this.lines[_i6].actualWidth > widthBound && (widthBound = this.lines[_i6].actualWidth), heightBound += this.lines[_i6].height;
15874
15979
  }
@@ -15895,7 +16000,7 @@
15895
16000
  var halfDetaHeight = 0,
15896
16001
  deltaAscent = 0,
15897
16002
  deltaDescent = 0;
15898
- this.height > height && (halfDetaHeight = (this.height - height) / 2, deltaAscent = Math.ceil(halfDetaHeight), deltaDescent = Math.floor(halfDetaHeight)), "top" === this.textBaseline ? (this.ascent = halfDetaHeight, this.descent = height - halfDetaHeight) : "bottom" === this.textBaseline ? (this.ascent = height - halfDetaHeight, this.descent = halfDetaHeight) : "middle" === this.textBaseline ? (this.ascent = this.height / 2, this.descent = this.height / 2) : (this.ascent = ascent + deltaAscent, this.descent = descent + deltaDescent), this.length = text.length, this.width = width || 0, this.text = text || "", this.newLine = newLine || !1, this.character = character, this.left = 0, this.top = 0, this.ellipsis = "normal", this.ellipsisWidth = 0, this.ellipsisOtherParagraphWidth = 0, "vertical" === character.direction && (this.direction = character.direction, this.widthOrigin = this.width, this.heightOrigin = this.height, this.width = this.heightOrigin, this.height = this.widthOrigin, this.lineHeight = this.height);
16003
+ this.height > height && (halfDetaHeight = (this.height - height) / 2, deltaAscent = Math.ceil(halfDetaHeight), deltaDescent = Math.floor(halfDetaHeight)), "top" === this.textBaseline ? (this.ascent = halfDetaHeight, this.descent = height - halfDetaHeight) : "bottom" === this.textBaseline ? (this.ascent = height - halfDetaHeight, this.descent = halfDetaHeight) : "middle" === this.textBaseline ? (this.ascent = this.height / 2, this.descent = this.height / 2) : (this.ascent = ascent + deltaAscent, this.descent = descent + deltaDescent), this.length = text.length, this.width = width || 0, this.text = text || "", this.newLine = newLine || !1, this.character = character, this.left = 0, this.top = 0, this.ellipsis = "normal", this.ellipsisWidth = 0, this.ellipsisOtherParagraphWidth = 0, "vertical" === character.direction && (this.direction = character.direction, this.widthOrigin = this.width, this.heightOrigin = this.height, this.width = this.heightOrigin, this.height = this.widthOrigin, this.lineHeight = this.height), this.ellipsisStr = "...";
15899
16004
  }
15900
16005
  return _createClass(Paragraph, [{
15901
16006
  key: "updateWidth",
@@ -15911,11 +16016,11 @@
15911
16016
  left = this.left + deltaLeft;
15912
16017
  baseline += this.top;
15913
16018
  var direction = this.direction;
15914
- if (this.verticalEllipsis) text = "...", direction = "vertical", baseline -= this.ellipsisWidth / 2;else {
16019
+ if (this.verticalEllipsis) text = this.ellipsisStr, direction = "vertical", baseline -= this.ellipsisWidth / 2;else {
15915
16020
  if ("hide" === this.ellipsis) return;
15916
- if ("add" === this.ellipsis) text += "...", "right" !== textAlign && "end" !== textAlign || (left -= this.ellipsisWidth);else if ("replace" === this.ellipsis) {
16021
+ if ("add" === this.ellipsis) text += this.ellipsisStr, "right" !== textAlign && "end" !== textAlign || (left -= this.ellipsisWidth);else if ("replace" === this.ellipsis) {
15917
16022
  var index = getStrByWithCanvas(text, ("vertical" === direction ? this.height : this.width) - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.character, text.length - 1);
15918
- if (text = text.slice(0, index), text += "...", "right" === textAlign || "end" === textAlign) {
16023
+ if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) {
15919
16024
  var _measureTextCanvas3 = measureTextCanvas(this.text.slice(index), this.character),
15920
16025
  width = _measureTextCanvas3.width;
15921
16026
  "vertical" === direction || (left -= this.ellipsisWidth - width);
@@ -15940,7 +16045,7 @@
15940
16045
  if ("add" === this.ellipsis) return width + this.ellipsisWidth;
15941
16046
  if ("replace" === this.ellipsis) {
15942
16047
  var index = getStrByWithCanvas(text, width - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.character, text.length - 1);
15943
- text = text.slice(0, index), text += "...";
16048
+ text = text.slice(0, index), text += this.ellipsisStr;
15944
16049
  var _measureTextCanvas4 = measureTextCanvas(this.text.slice(index), this.character),
15945
16050
  measureWidth = _measureTextCanvas4.width;
15946
16051
  return width + this.ellipsisWidth - measureWidth;
@@ -16172,22 +16277,27 @@
16172
16277
  }
16173
16278
  }, {
16174
16279
  key: "draw",
16175
- value: function draw(ctx, lastLine, x, y, drawIcon) {
16280
+ value: function draw(ctx, lastLine, x, y, drawEllipsis, drawIcon) {
16176
16281
  var _this2 = this;
16177
- if (lastLine) {
16282
+ if (drawEllipsis && (lastLine || this.paragraphs.some(function (p) {
16283
+ return p.overflow;
16284
+ }))) {
16178
16285
  var otherParagraphWidth = 0;
16179
16286
  for (var i = this.paragraphs.length - 1; i >= 0; i--) {
16180
16287
  var paragraph = this.paragraphs[i];
16288
+ if (paragraph.overflow) continue;
16181
16289
  if (paragraph instanceof RichTextIcon) break;
16182
16290
  if ("vertical" === this.direction && "vertical" !== paragraph.direction) {
16183
16291
  paragraph.verticalEllipsis = !0;
16184
16292
  break;
16185
16293
  }
16186
- var _measureTextCanvas = measureTextCanvas("...", paragraph.character),
16294
+ var ellipsis = !0 === drawEllipsis ? "..." : drawEllipsis || "";
16295
+ paragraph.ellipsisStr = ellipsis;
16296
+ var _measureTextCanvas = measureTextCanvas(ellipsis, paragraph.character),
16187
16297
  width = _measureTextCanvas.width,
16188
16298
  ellipsisWidth = width || 0;
16189
16299
  if (ellipsisWidth <= this.blankWidth + otherParagraphWidth) {
16190
- paragraph.ellipsis = "add";
16300
+ lastLine && (paragraph.ellipsis = "add");
16191
16301
  break;
16192
16302
  }
16193
16303
  if (ellipsisWidth <= this.blankWidth + otherParagraphWidth + paragraph.width) {
@@ -16207,13 +16317,13 @@
16207
16317
  }
16208
16318
  }, {
16209
16319
  key: "getWidthWithEllips",
16210
- value: function getWidthWithEllips() {
16320
+ value: function getWidthWithEllips(ellipsis) {
16211
16321
  var _this3 = this;
16212
16322
  var otherParagraphWidth = 0;
16213
16323
  for (var i = this.paragraphs.length - 1; i >= 0; i--) {
16214
16324
  var paragraph = this.paragraphs[i];
16215
16325
  if (paragraph instanceof RichTextIcon) break;
16216
- var _measureTextCanvas2 = measureTextCanvas("...", paragraph.character),
16326
+ var _measureTextCanvas2 = measureTextCanvas(ellipsis, paragraph.character),
16217
16327
  _width = _measureTextCanvas2.width,
16218
16328
  ellipsisWidth = _width || 0;
16219
16329
  if (ellipsisWidth <= this.blankWidth + otherParagraphWidth) {
@@ -16424,7 +16534,10 @@
16424
16534
  fontFamily = _this$attribute.fontFamily,
16425
16535
  fontStyle = _this$attribute.fontStyle,
16426
16536
  fontWeight = _this$attribute.fontWeight,
16427
- lineWidth = _this$attribute.lineWidth;
16537
+ lineWidth = _this$attribute.lineWidth,
16538
+ opacity = _this$attribute.opacity,
16539
+ fillOpacity = _this$attribute.fillOpacity,
16540
+ strokeOpacity = _this$attribute.strokeOpacity;
16428
16541
  return Object.assign({
16429
16542
  fill: fill,
16430
16543
  stroke: stroke,
@@ -16432,7 +16545,10 @@
16432
16545
  fontFamily: fontFamily,
16433
16546
  fontStyle: fontStyle,
16434
16547
  fontWeight: fontWeight,
16435
- lineWidth: lineWidth
16548
+ lineWidth: lineWidth,
16549
+ opacity: opacity,
16550
+ fillOpacity: fillOpacity,
16551
+ strokeOpacity: strokeOpacity
16436
16552
  }, config);
16437
16553
  }
16438
16554
  }, {
@@ -16454,6 +16570,7 @@
16454
16570
  textBaseline = _this$attribute2.textBaseline,
16455
16571
  layoutDirection = _this$attribute2.layoutDirection,
16456
16572
  singleLine = _this$attribute2.singleLine,
16573
+ disableAutoWrapLine = _this$attribute2.disableAutoWrapLine,
16457
16574
  paragraphs = [];
16458
16575
  for (var i = 0; i < textConfig.length; i++) if ("image" in textConfig[i]) {
16459
16576
  var config = this.combinedStyleToCharacter(textConfig[i]),
@@ -16478,7 +16595,14 @@
16478
16595
  richTextHeightEnable = "number" == typeof height && Number.isFinite(height) && height > 0 && (!maxHeightFinite || height <= maxHeight),
16479
16596
  frame = new Frame(0, 0, (richTextWidthEnable ? width : maxWidthFinite ? maxWidth : 0) || 0, (richTextHeightEnable ? height : maxHeightFinite ? maxHeight : 0) || 0, ellipsis, wordBreak, verticalDirection, textAlign, textBaseline, layoutDirection || "horizontal", !richTextWidthEnable && maxWidthFinite, !richTextHeightEnable && maxHeightFinite, singleLine || !1, null === (_a = this._frameCache) || void 0 === _a ? void 0 : _a.icons),
16480
16597
  wrapper = new Wrapper(frame);
16481
- for (var _i = 0; _i < paragraphs.length; _i++) wrapper.deal(paragraphs[_i]);
16598
+ if (disableAutoWrapLine) {
16599
+ var lineCount = 0,
16600
+ skip = !1;
16601
+ for (var _i = 0; _i < paragraphs.length; _i++) {
16602
+ var p = paragraphs[_i];
16603
+ skip ? (p.overflow = !0, p.left = 1 / 0, p.top = 1 / 0, !p.newLine && frame.lines[frame.lines.length - 1].paragraphs.push(p)) : wrapper.deal(p), frame.lines.length !== lineCount && (lineCount = frame.lines.length, wrapper.lineBuffer.length = 0, p.overflow = !0, p.left = 1e3, p.top = 1e3, frame.lines[frame.lines.length - 1].paragraphs.push(p), skip = !0), p.newLine && (skip = !1, wrapper.lineWidth = 0);
16604
+ }
16605
+ } else for (var _i2 = 0; _i2 < paragraphs.length; _i2++) wrapper.deal(paragraphs[_i2]);
16482
16606
  wrapper.send();
16483
16607
  if (!("horizontal" === frame.layoutDirection ? richTextWidthEnable : richTextHeightEnable)) {
16484
16608
  var frameSize = frame.getActualSizeWidthEllipsis();
@@ -17671,6 +17795,8 @@
17671
17795
  }, {
17672
17796
  key: "updateGroupAABBBounds",
17673
17797
  value: function updateGroupAABBBounds(attribute, groupTheme, aabbBounds, graphic) {
17798
+ var originalAABBBounds = aabbBounds;
17799
+ aabbBounds = aabbBounds.clone();
17674
17800
  var width = attribute.width,
17675
17801
  height = attribute.height,
17676
17802
  path = attribute.path,
@@ -17678,12 +17804,12 @@
17678
17804
  clip = _attribute$clip === void 0 ? groupTheme.clip : _attribute$clip;
17679
17805
  path && path.length ? path.forEach(function (g) {
17680
17806
  aabbBounds.union(g.AABBBounds);
17681
- }) : null != width && null != height && aabbBounds.set(0, 0, width, height), clip || graphic.forEachChildren(function (node) {
17807
+ }) : null != width && null != height && aabbBounds.set(0, 0, Math.max(0, width), Math.max(0, height)), clip || graphic.forEachChildren(function (node) {
17682
17808
  aabbBounds.union(node.AABBBounds);
17683
17809
  });
17684
17810
  var tb1 = this.tempAABBBounds1,
17685
17811
  tb2 = this.tempAABBBounds2;
17686
- return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), this.transformAABBBounds(attribute, aabbBounds, groupTheme, !1, graphic), aabbBounds;
17812
+ return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), this.transformAABBBounds(attribute, aabbBounds, groupTheme, !1, graphic), originalAABBBounds.copy(aabbBounds), originalAABBBounds;
17687
17813
  }
17688
17814
  }, {
17689
17815
  key: "updateGlyphAABBBounds",
@@ -17692,6 +17818,22 @@
17692
17818
  aabbBounds.union(node.AABBBounds);
17693
17819
  }), aabbBounds) : aabbBounds;
17694
17820
  }
17821
+ }, {
17822
+ key: "updateHTMLTextAABBBounds",
17823
+ value: function updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds, graphic) {
17824
+ var textAlign = attribute.textAlign,
17825
+ textBaseline = attribute.textBaseline;
17826
+ if (null != attribute.forceBoundsHeight) {
17827
+ var h = isNumber$1(attribute.forceBoundsHeight) ? attribute.forceBoundsHeight : attribute.forceBoundsHeight(),
17828
+ dy = textLayoutOffsetY(textBaseline, h, h);
17829
+ aabbBounds.set(aabbBounds.x1, dy, aabbBounds.x2, dy + h);
17830
+ }
17831
+ if (null != attribute.forceBoundsWidth) {
17832
+ var w = isNumber$1(attribute.forceBoundsWidth) ? attribute.forceBoundsWidth : attribute.forceBoundsWidth(),
17833
+ dx = textDrawOffsetX(textAlign, w);
17834
+ aabbBounds.set(dx, aabbBounds.y1, dx + w, aabbBounds.y2);
17835
+ }
17836
+ }
17695
17837
  }, {
17696
17838
  key: "updateRichTextAABBBounds",
17697
17839
  value: function updateRichTextAABBBounds(attribute, richtextTheme, aabbBounds, graphic) {
@@ -17743,7 +17885,7 @@
17743
17885
  aabbBounds.translate(deltaX, deltaY);
17744
17886
  var tb1 = this.tempAABBBounds1,
17745
17887
  tb2 = this.tempAABBBounds2;
17746
- return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), this.transformAABBBounds(attribute, aabbBounds, richtextTheme, !1, graphic), aabbBounds;
17888
+ return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || this.updateHTMLTextAABBBounds(attribute, richtextTheme, aabbBounds), this.transformAABBBounds(attribute, aabbBounds, richtextTheme, !1, graphic), aabbBounds;
17747
17889
  }
17748
17890
  }, {
17749
17891
  key: "updateTextAABBBounds",
@@ -17768,7 +17910,7 @@
17768
17910
  var shadowBlurHalfWidth = shadowBlur / Math.abs(scaleX + scaleY);
17769
17911
  boundStroke(tb1, shadowBlurHalfWidth, !0, strokeBoundsBuffer), aabbBounds.union(tb1);
17770
17912
  }
17771
- return this.combindShadowAABBBounds(aabbBounds, graphic), transformBoundsWithMatrix(aabbBounds, aabbBounds, graphic.transMatrix), aabbBounds;
17913
+ return this.combindShadowAABBBounds(aabbBounds, graphic), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || this.updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds), transformBoundsWithMatrix(aabbBounds, aabbBounds, graphic.transMatrix), aabbBounds;
17772
17914
  }
17773
17915
  }, {
17774
17916
  key: "updatePathAABBBounds",
@@ -18092,6 +18234,7 @@
18092
18234
  key: "_validCheck",
18093
18235
  value: function _validCheck(attribute, theme, aabbBounds, graphic) {
18094
18236
  if (!graphic) return !0;
18237
+ if (null != attribute.forceBoundsHeight || null != attribute.forceBoundsWidth) return !0;
18095
18238
  if (!graphic.valid) return aabbBounds.clear(), !1;
18096
18239
  var _attribute$visible = attribute.visible,
18097
18240
  visible = _attribute$visible === void 0 ? theme.visible : _attribute$visible;
@@ -18157,6 +18300,9 @@
18157
18300
  key: "beforeRenderStep",
18158
18301
  value: function beforeRenderStep(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params) {
18159
18302
  this._beforeRenderContribitions && this._beforeRenderContribitions.forEach(function (c) {
18303
+ if (c.supportedAppName && graphic.stage && graphic.stage.params && graphic.stage.params.context && graphic.stage.params.context.appName) {
18304
+ if (!(Array.isArray(c.supportedAppName) ? c.supportedAppName : [c.supportedAppName]).includes(graphic.stage.params.context.appName)) return;
18305
+ }
18160
18306
  c.drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params);
18161
18307
  });
18162
18308
  }
@@ -18164,6 +18310,9 @@
18164
18310
  key: "afterRenderStep",
18165
18311
  value: function afterRenderStep(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params) {
18166
18312
  this._afterRenderContribitions && this._afterRenderContribitions.forEach(function (c) {
18313
+ if (c.supportedAppName && graphic.stage && graphic.stage.params && graphic.stage.params.context && graphic.stage.params.context.appName) {
18314
+ if (!(Array.isArray(c.supportedAppName) ? c.supportedAppName : [c.supportedAppName]).includes(graphic.stage.params.context.appName)) return;
18315
+ }
18167
18316
  c.drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params);
18168
18317
  });
18169
18318
  }
@@ -18284,6 +18433,8 @@
18284
18433
  value: function _draw(graphic, defaultAttr, computed3dMatrix, drawContext, params) {
18285
18434
  var context = drawContext.context;
18286
18435
  if (!context) return;
18436
+ var renderable = graphic.attribute.renderable;
18437
+ if (!1 === renderable) return;
18287
18438
  context.highPerformanceSave();
18288
18439
  var data = this.transform(graphic, defaultAttr, context, computed3dMatrix),
18289
18440
  x = data.x,
@@ -19281,13 +19432,18 @@
19281
19432
  key: "drawShape",
19282
19433
  value: function drawShape(rect, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb) {
19283
19434
  var _rect$attribute4 = rect.attribute,
19284
- _rect$attribute4$widt = _rect$attribute4.width,
19285
- width = _rect$attribute4$widt === void 0 ? groupAttribute.width : _rect$attribute4$widt,
19286
- _rect$attribute4$heig = _rect$attribute4.height,
19287
- height = _rect$attribute4$heig === void 0 ? groupAttribute.height : _rect$attribute4$heig,
19435
+ x1 = _rect$attribute4.x1,
19436
+ y1 = _rect$attribute4.y1,
19437
+ _rect$attribute4$x = _rect$attribute4.x,
19438
+ originX = _rect$attribute4$x === void 0 ? groupAttribute.x : _rect$attribute4$x,
19439
+ _rect$attribute4$y = _rect$attribute4.y,
19440
+ originY = _rect$attribute4$y === void 0 ? groupAttribute.y : _rect$attribute4$y,
19288
19441
  _rect$attribute4$stro = _rect$attribute4.stroke,
19289
19442
  stroke = _rect$attribute4$stro === void 0 ? groupAttribute.stroke : _rect$attribute4$stro;
19290
- if (Array.isArray(stroke) && stroke.some(function (s) {
19443
+ var _rect$attribute5 = rect.attribute,
19444
+ width = _rect$attribute5.width,
19445
+ height = _rect$attribute5.height;
19446
+ if (width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0, Array.isArray(stroke) && stroke.some(function (s) {
19291
19447
  return !1 === s;
19292
19448
  })) {
19293
19449
  if (context.setStrokeStyle(rect, rect.attribute, x, y, groupAttribute), context.beginPath(), context.moveTo(x, y), stroke[0] ? context.lineTo(x + width, y) : context.moveTo(x + width, y), stroke[1] ? context.lineTo(x + width, y + height) : context.moveTo(x + width, y + height), stroke[2] ? context.lineTo(x, y + height) : context.moveTo(x, y + height), stroke[3]) {
@@ -20643,9 +20799,14 @@
20643
20799
  backgroundMode = _graphic$attribute$ba === void 0 ? graphicAttribute.backgroundMode : _graphic$attribute$ba,
20644
20800
  _graphic$attribute$ba2 = _graphic$attribute.backgroundFit,
20645
20801
  backgroundFit = _graphic$attribute$ba2 === void 0 ? graphicAttribute.backgroundFit : _graphic$attribute$ba2;
20646
- var b,
20802
+ var matrix,
20647
20803
  background = graphic.attribute.background;
20648
20804
  if (!background) return;
20805
+ var restore = function restore() {
20806
+ "richtext" === graphic.type && (context.restore(), context.save(), matrix && context.setTransformFromMatrix(matrix, !0, 1));
20807
+ };
20808
+ var b;
20809
+ "richtext" === graphic.type && (matrix = context.currentMatrix.clone(), context.restore(), context.save(), context.setTransformForCurrent());
20649
20810
  var shouldReCalBounds = isObject$1(background) && background.background,
20650
20811
  onlyTranslate = graphic.transMatrix.onlyTranslate();
20651
20812
  if (shouldReCalBounds) {
@@ -20670,13 +20831,13 @@
20670
20831
  })).clone());
20671
20832
  if (graphic.backgroundImg && graphic.resources) {
20672
20833
  var res = graphic.resources.get(background);
20673
- if ("success" !== res.state || !res.data) return;
20834
+ if ("success" !== res.state || !res.data) return void restore();
20674
20835
  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();
20675
20836
  } else {
20676
20837
  var backgroundCornerRadius = graphic.attribute.backgroundCornerRadius;
20677
20838
  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();
20678
20839
  }
20679
- shouldReCalBounds && boundsAllocate.free(b);
20840
+ shouldReCalBounds && boundsAllocate.free(b), restore();
20680
20841
  }
20681
20842
  }]);
20682
20843
  }(DefaultBaseBackgroundRenderContribution);
@@ -20867,7 +21028,7 @@
20867
21028
  strokeOpacity: fillOpacity
20868
21029
  };
20869
21030
  if (underline) {
20870
- attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, x, y, textAttribute), context.setLineDash(underlineDash), context.beginPath();
21031
+ attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, x, y, textAttribute), underlineDash && context.setLineDash(underlineDash), context.beginPath();
20871
21032
  var dy = y + offsetY + fontSize + underlineOffset;
20872
21033
  context.moveTo(x + offsetX, dy, z), context.lineTo(x + offsetX + w, dy, z), context.stroke();
20873
21034
  }
@@ -20903,7 +21064,7 @@
20903
21064
  };
20904
21065
  var deltaY = -3;
20905
21066
  if (underline) {
20906
- attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, x, y, textAttribute), context.setLineDash(underlineDash), context.beginPath();
21067
+ attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, x, y, textAttribute), underlineDash && context.setLineDash(underlineDash), context.beginPath();
20907
21068
  var dy = y + offsetY + fontSize + deltaY + underlineOffset;
20908
21069
  context.moveTo(x + 0, dy, z), context.lineTo(x + 0 + w, dy, z), context.stroke();
20909
21070
  }
@@ -21266,6 +21427,13 @@
21266
21427
  key: "beforeDrawInteractive",
21267
21428
  value: function beforeDrawInteractive(graphic, renderService, drawContext, drawContribution, params) {
21268
21429
  var baseGraphic = graphic.baseGraphic;
21430
+ if (!baseGraphic.stage) {
21431
+ var interactiveLayer = drawContext.stage.getLayer("_builtin_interactive");
21432
+ if (interactiveLayer) {
21433
+ this.getShadowRoot(interactiveLayer).removeChild(graphic);
21434
+ }
21435
+ return !0;
21436
+ }
21269
21437
  if (baseGraphic) {
21270
21438
  this.processing = !0;
21271
21439
  var context = drawContext.context;
@@ -21434,14 +21602,14 @@
21434
21602
  value: function render(groups, params) {
21435
21603
  this.renderTreeRoots = groups, this.drawParams = params;
21436
21604
  var updateBounds = params.updateBounds;
21437
- this.prepare(updateBounds), this.prepareRenderList(), this.beforeDraw(params), this.draw(params), this.afterDraw(params);
21605
+ this.prepare(updateBounds), this.prepareRenderList(), this.beforeDraw(params), this.draw(params), this.afterDraw(params), this.drawParams = null;
21438
21606
  }
21439
21607
  }]);
21440
21608
  }();
21441
21609
  exports.DefaultRenderService = __decorate$1i([injectable(), __param$E(0, inject(DrawContribution)), __metadata$_("design:paramtypes", [Object])], exports.DefaultRenderService);
21442
21610
 
21443
21611
  var renderModule$1 = new ContainerModule(function (bind) {
21444
- bind(RenderService).to(exports.DefaultRenderService).inSingletonScope();
21612
+ bind(RenderService).to(exports.DefaultRenderService);
21445
21613
  });
21446
21614
 
21447
21615
  var GraphicPicker = Symbol["for"]("GraphicPicker");
@@ -22121,7 +22289,7 @@
22121
22289
  return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
22122
22290
  }).forEach(function (group) {
22123
22291
  group.isContainer ? _this2.renderGroup(group, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0)) : _this2.renderItem(group, drawContext);
22124
- }), context.restore(), context.draw(), context.setClearMatrix(1, 0, 0, 1, 0, 0), context.inuse = !1;
22292
+ }), context.restore(), context.setClearMatrix(1, 0, 0, 1, 0, 0), context.inuse = !1, context.draw();
22125
22293
  }
22126
22294
  }, {
22127
22295
  key: "doRegister",
@@ -23029,7 +23197,7 @@
23029
23197
  var HtmlAttributePlugin = /*#__PURE__*/function () {
23030
23198
  function HtmlAttributePlugin() {
23031
23199
  _classCallCheck(this, HtmlAttributePlugin);
23032
- this.name = "HtmlAttributePlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid, this.lastDomContainerSet = new Set(), this.currentDomContainerSet = new Set();
23200
+ this.name = "HtmlAttributePlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid, this.htmlMap = {}, this.renderId = 0;
23033
23201
  }
23034
23202
  return _createClass(HtmlAttributePlugin, [{
23035
23203
  key: "activate",
@@ -23037,10 +23205,6 @@
23037
23205
  var _this = this;
23038
23206
  this.pluginService = context, context.stage.hooks.afterRender.tap(this.key, function (stage) {
23039
23207
  stage && stage === _this.pluginService.stage && _this.drawHTML(context.stage.renderService);
23040
- }), application.graphicService.hooks.onRemove.tap(this.key, function (graphic) {
23041
- _this.removeDom(graphic);
23042
- }), application.graphicService.hooks.onRelease.tap(this.key, function (graphic) {
23043
- _this.removeDom(graphic);
23044
23208
  });
23045
23209
  }
23046
23210
  }, {
@@ -23051,99 +23215,176 @@
23051
23215
  return item.name !== _this2.key;
23052
23216
  }), application.graphicService.hooks.onRemove.unTap(this.key), application.graphicService.hooks.onRelease.unTap(this.key), this.release();
23053
23217
  }
23218
+ }, {
23219
+ key: "getWrapContainer",
23220
+ value: function getWrapContainer(stage, userContainer, domParams) {
23221
+ var nativeContainer;
23222
+ return nativeContainer = userContainer ? "string" == typeof userContainer ? application.global.getElementById(userContainer) : userContainer : stage.window.getContainer(), {
23223
+ wrapContainer: application.global.createDom(Object.assign({
23224
+ tagName: "div",
23225
+ parent: nativeContainer
23226
+ }, domParams)),
23227
+ nativeContainer: nativeContainer
23228
+ };
23229
+ }
23230
+ }, {
23231
+ key: "parseDefaultStyleFromGraphic",
23232
+ value: function parseDefaultStyleFromGraphic(graphic) {
23233
+ var attrs = "text" === graphic.type && graphic.attribute ? graphic.attribute : getTheme(graphic).text;
23234
+ return textAttributesToStyle(attrs);
23235
+ }
23236
+ }, {
23237
+ key: "getTransformOfText",
23238
+ value: function getTransformOfText(graphic) {
23239
+ var textTheme = getTheme(graphic).text,
23240
+ _graphic$attribute = graphic.attribute,
23241
+ _graphic$attribute$te = _graphic$attribute.textAlign,
23242
+ textAlign = _graphic$attribute$te === void 0 ? textTheme.textAlign : _graphic$attribute$te,
23243
+ _graphic$attribute$te2 = _graphic$attribute.textBaseline,
23244
+ textBaseline = _graphic$attribute$te2 === void 0 ? textTheme.textBaseline : _graphic$attribute$te2,
23245
+ cssAttrs = graphic.globalTransMatrix.toTransformAttrs(),
23246
+ rotateDeg = cssAttrs.rotateDeg,
23247
+ scaleX = cssAttrs.scaleX,
23248
+ scaleY = cssAttrs.scaleY,
23249
+ translateMap = {
23250
+ left: "0",
23251
+ start: "0",
23252
+ end: "-100%",
23253
+ center: "-50%",
23254
+ right: "-100%",
23255
+ top: "0",
23256
+ middle: "-50%",
23257
+ bottom: "-100%",
23258
+ alphabetic: "-79%"
23259
+ },
23260
+ originMap = {
23261
+ left: "0",
23262
+ start: "0",
23263
+ end: "100%",
23264
+ center: "50%",
23265
+ right: "100%",
23266
+ top: "0",
23267
+ middle: "50%",
23268
+ bottom: "100%",
23269
+ alphabetic: "79%"
23270
+ };
23271
+ return {
23272
+ textAlign: textAlign,
23273
+ transform: "translate(".concat(translateMap[textAlign], ",").concat(translateMap[textBaseline], ") rotate(").concat(rotateDeg, "deg) scaleX(").concat(scaleX, ") scaleY(").concat(scaleY, ")"),
23274
+ transformOrigin: "".concat(originMap[textAlign], " ").concat(originMap[textBaseline])
23275
+ };
23276
+ }
23277
+ }, {
23278
+ key: "updateStyleOfWrapContainer",
23279
+ value: function updateStyleOfWrapContainer(graphic, stage, wrapContainer, nativeContainer, options) {
23280
+ var pointerEvents = options.pointerEvents;
23281
+ var calculateStyle = this.parseDefaultStyleFromGraphic(graphic);
23282
+ calculateStyle.display = !1 !== graphic.attribute.visible ? "block" : "none", calculateStyle.pointerEvents = !0 === pointerEvents ? "all" : pointerEvents || "none", wrapContainer.style.position || (wrapContainer.style.position = "absolute", nativeContainer.style.position = "relative");
23283
+ var left = 0,
23284
+ top = 0;
23285
+ var b = graphic.globalAABBBounds;
23286
+ var anchorType = options.anchorType;
23287
+ if (isNil$1(anchorType) && (anchorType = "text" === graphic.type ? "position" : "boundsLeftTop"), "boundsLeftTop" === anchorType && (anchorType = "top-left"), "position" === anchorType || b.empty()) {
23288
+ var matrix = graphic.globalTransMatrix;
23289
+ left = matrix.e, top = matrix.f;
23290
+ } else {
23291
+ var anchor = calculateAnchorOfBounds(b, anchorType);
23292
+ left = anchor.x, top = anchor.y;
23293
+ }
23294
+ var containerTL = application.global.getElementTopLeft(nativeContainer, !1),
23295
+ windowTL = stage.window.getTopLeft(!1),
23296
+ offsetX = left + windowTL.left - containerTL.left,
23297
+ offsetTop = top + windowTL.top - containerTL.top;
23298
+ if (calculateStyle.left = "".concat(offsetX, "px"), calculateStyle.top = "".concat(offsetTop, "px"), "text" === graphic.type && "position" === anchorType && (calculateStyle = Object.assign(Object.assign({}, calculateStyle), this.getTransformOfText(graphic))), isFunction$1(options.style)) {
23299
+ var userStyle = options.style({
23300
+ top: offsetTop,
23301
+ left: offsetX,
23302
+ width: b.width(),
23303
+ height: b.height()
23304
+ }, graphic, wrapContainer);
23305
+ userStyle && (calculateStyle = Object.assign(Object.assign({}, calculateStyle), userStyle));
23306
+ } else isObject$1(options.style) ? calculateStyle = Object.assign(Object.assign({}, calculateStyle), options.style) : isString$1(options.style) && options.style && (calculateStyle = Object.assign(Object.assign({}, calculateStyle), styleStringToObject(options.style)));
23307
+ application.global.updateDom(wrapContainer, {
23308
+ width: options.width,
23309
+ height: options.width,
23310
+ style: calculateStyle
23311
+ });
23312
+ }
23313
+ }, {
23314
+ key: "clearCacheContainer",
23315
+ value: function clearCacheContainer() {
23316
+ var _this3 = this;
23317
+ this.htmlMap && Object.keys(this.htmlMap).forEach(function (key) {
23318
+ _this3.htmlMap[key] && _this3.htmlMap[key].renderId !== _this3.renderId && _this3.removeElement(key);
23319
+ }), this.renderId += 1;
23320
+ }
23054
23321
  }, {
23055
23322
  key: "drawHTML",
23056
23323
  value: function drawHTML(renderService) {
23057
- var _this3 = this;
23324
+ var _this4 = this;
23058
23325
  "browser" === application.global.env && (renderService.renderTreeRoots.sort(function (a, b) {
23059
23326
  var _a, _b;
23060
23327
  return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
23061
23328
  }).forEach(function (group) {
23062
- _this3.renderGroupHTML(group);
23063
- }), this.lastDomContainerSet.forEach(function (item) {
23064
- _this3.currentDomContainerSet.has(item) || item.parentElement && item.parentElement.removeChild(item);
23065
- }), this.lastDomContainerSet = new Set(this.currentDomContainerSet), this.currentDomContainerSet.clear());
23329
+ _this4.renderGroupHTML(group);
23330
+ }), this.clearCacheContainer());
23066
23331
  }
23067
23332
  }, {
23068
23333
  key: "renderGroupHTML",
23069
23334
  value: function renderGroupHTML(group) {
23070
- var _this4 = this;
23335
+ var _this5 = this;
23071
23336
  this.renderGraphicHTML(group), group.forEachChildren(function (g) {
23072
- g.isContainer ? _this4.renderGroupHTML(g) : _this4.renderGraphicHTML(g);
23337
+ g.isContainer ? _this5.renderGroupHTML(g) : _this5.renderGraphicHTML(g);
23073
23338
  });
23074
23339
  }
23075
23340
  }, {
23076
- key: "removeDom",
23077
- value: function removeDom(graphic) {
23078
- graphic.bindDom && graphic.bindDom.size && (graphic.bindDom.forEach(function (item) {
23079
- item.dom && item.dom.parentElement.removeChild(item.dom);
23080
- }), graphic.bindDom.clear());
23341
+ key: "removeElement",
23342
+ value: function removeElement(id) {
23343
+ if (!this.htmlMap || !this.htmlMap[id]) return;
23344
+ var wrapContainer = this.htmlMap[id].wrapContainer;
23345
+ wrapContainer && application.global.removeDom(wrapContainer), this.htmlMap[id] = null;
23081
23346
  }
23082
23347
  }, {
23083
23348
  key: "renderGraphicHTML",
23084
23349
  value: function renderGraphicHTML(graphic) {
23350
+ var _a;
23085
23351
  var html = graphic.attribute.html;
23086
- if (!html) return void (graphic.bindDom && graphic.bindDom.size && (graphic.bindDom.forEach(function (item) {
23087
- item.dom && item.dom.parentElement.removeChild(item.dom);
23088
- }), graphic.bindDom.clear()));
23352
+ if (!html) return;
23089
23353
  var stage = graphic.stage;
23090
23354
  if (!stage) return;
23091
23355
  var dom = html.dom,
23092
- container = html.container,
23093
- width = html.width,
23094
- height = html.height,
23095
- style = html.style,
23096
- _html$anchorType = html.anchorType,
23097
- anchorType = _html$anchorType === void 0 ? "boundsLeftTop" : _html$anchorType,
23098
- pointerEvents = html.pointerEvents;
23099
- graphic.bindDom || (graphic.bindDom = new Map());
23100
- var lastDom = graphic.bindDom.get(dom);
23101
- var wrapGroup, nativeContainer;
23102
- if (!lastDom || container && container !== lastDom.container) {
23103
- var nativeDom;
23104
- graphic.bindDom.forEach(function (_ref) {
23105
- var wrapGroup = _ref.wrapGroup;
23106
- application.global.removeDom(wrapGroup);
23107
- }), "string" == typeof dom ? (nativeDom = new DOMParser().parseFromString(dom, "text/html").firstChild, nativeDom.lastChild && (nativeDom = nativeDom.lastChild.firstChild)) : nativeDom = dom;
23108
- var _container = container || (!0 === stage.params.enableHtmlAttribute ? null : stage.params.enableHtmlAttribute);
23109
- nativeContainer = _container ? "string" == typeof _container ? application.global.getElementById(_container) : _container : graphic.stage.window.getContainer(), wrapGroup = application.global.createDom({
23110
- tagName: "div",
23111
- width: width,
23112
- height: height,
23113
- style: style,
23114
- parent: nativeContainer
23115
- }), wrapGroup && (wrapGroup.appendChild(nativeDom), graphic.bindDom.set(dom, {
23116
- dom: nativeDom,
23356
+ container = html.container;
23357
+ if (!dom) return;
23358
+ var id = isNil$1(html.id) ? "".concat(null !== (_a = graphic.id) && void 0 !== _a ? _a : graphic._uid, "_react") : html.id;
23359
+ if (this.htmlMap && this.htmlMap[id] && container && container !== this.htmlMap[id].container && this.removeElement(id), this.htmlMap && this.htmlMap[id]) "string" == typeof dom ? this.htmlMap[id].wrapContainer.innerHTML = dom : dom !== this.htmlMap[id].wrapContainer.firstChild && (this.htmlMap[id].wrapContainer.removeChild(this.htmlMap[id].wrapContainer.firstChild), this.htmlMap[id].wrapContainer.appendChild(dom));else {
23360
+ var _this$getWrapContaine = this.getWrapContainer(stage, container),
23361
+ _wrapContainer = _this$getWrapContaine.wrapContainer,
23362
+ _nativeContainer = _this$getWrapContaine.nativeContainer;
23363
+ _wrapContainer && ("string" == typeof dom ? _wrapContainer.innerHTML = dom : _wrapContainer.appendChild(dom), this.htmlMap || (this.htmlMap = {}), this.htmlMap[id] = {
23364
+ wrapContainer: _wrapContainer,
23365
+ nativeContainer: _nativeContainer,
23117
23366
  container: container,
23118
- wrapGroup: wrapGroup
23119
- }));
23120
- } else wrapGroup = lastDom.wrapGroup, nativeContainer = wrapGroup.parentNode;
23121
- wrapGroup.style.pointerEvents = pointerEvents || "none", wrapGroup.style.position || (wrapGroup.style.position = "absolute", nativeContainer.style.position = "relative");
23122
- var left = 0,
23123
- top = 0;
23124
- var b = graphic.globalAABBBounds;
23125
- if ("position" === anchorType || b.empty()) {
23126
- var matrix = graphic.globalTransMatrix;
23127
- left = matrix.e, top = matrix.f;
23128
- } else left = b.x1, top = b.y1;
23129
- var containerTL = application.global.getElementTopLeft(nativeContainer, !1),
23130
- windowTL = stage.window.getTopLeft(!1),
23131
- offsetX = left + windowTL.left - containerTL.left,
23132
- offsetTop = top + windowTL.top - containerTL.top;
23133
- wrapGroup.style.left = "".concat(offsetX, "px"), wrapGroup.style.top = "".concat(offsetTop, "px"), this.currentDomContainerSet.add(wrapGroup);
23367
+ renderId: this.renderId
23368
+ });
23369
+ }
23370
+ if (!this.htmlMap || !this.htmlMap[id]) return;
23371
+ var _this$htmlMap$id = this.htmlMap[id],
23372
+ wrapContainer = _this$htmlMap$id.wrapContainer,
23373
+ nativeContainer = _this$htmlMap$id.nativeContainer;
23374
+ this.updateStyleOfWrapContainer(graphic, stage, wrapContainer, nativeContainer, html), this.htmlMap[id].renderId = this.renderId;
23134
23375
  }
23135
23376
  }, {
23136
23377
  key: "release",
23137
23378
  value: function release() {
23138
- "browser" === application.global.env && (this.removeAllDom(this.pluginService.stage.defaultLayer), this.lastDomContainerSet.clear(), this.currentDomContainerSet.clear());
23379
+ "browser" === application.global.env && this.removeAllDom(this.pluginService.stage.defaultLayer);
23139
23380
  }
23140
23381
  }, {
23141
23382
  key: "removeAllDom",
23142
23383
  value: function removeAllDom(g) {
23143
- var _this5 = this;
23144
- this.removeDom(g), g.forEachChildren(function (item) {
23145
- item.isContainer && _this5.removeAllDom(g);
23146
- });
23384
+ var _this6 = this;
23385
+ this.htmlMap && (Object.keys(this.htmlMap).forEach(function (key) {
23386
+ _this6.removeElement(key);
23387
+ }), this.htmlMap = null);
23147
23388
  }
23148
23389
  }]);
23149
23390
  }();
@@ -23241,7 +23482,7 @@
23241
23482
  }), !isFinite(boundsLegal)) return;
23242
23483
  width = childrenWidth, height = childrenHeight;
23243
23484
  }
23244
- p.attribute.width = width, p.attribute.height = height, this.tempBounds.copy(p._AABBBounds);
23485
+ null == p.attribute.width ? p.attribute.width = width : width = p.attribute.width, null == p.attribute.height ? p.attribute.height = height : height = p.attribute.height, this.tempBounds.copy(p._AABBBounds);
23245
23486
  var result = {
23246
23487
  main: {
23247
23488
  len: width,
@@ -23282,7 +23523,7 @@
23282
23523
  }), tempMainL = 0, tempCrossL = 0) : (mainList.push({
23283
23524
  idx: i - 1,
23284
23525
  mainLen: tempMainL,
23285
- crossLen: crossLen
23526
+ crossLen: tempCrossL
23286
23527
  }), tempMainL = mainLen, tempCrossL = crossLen) : (tempMainL += mainLen, tempCrossL = Math.max(tempCrossL, crossLen));
23287
23528
  }), mainList.push({
23288
23529
  idx: mianLenArray.length - 1,
@@ -23383,7 +23624,7 @@
23383
23624
  }
23384
23625
  } else if ("flex-end" === justifyContent) {
23385
23626
  var _pos = main.len;
23386
- for (var _i = lastIdx; _i <= currSeg.idx; _i++) {
23627
+ for (var _i = currSeg.idx; _i >= lastIdx; _i--) {
23387
23628
  _pos -= mianLenArray[_i].mainLen;
23388
23629
  var _posBaseLeftTop = _pos + getPadding(children[_i], main.field),
23389
23630
  _b = this.getAABBBounds(children[_i]);
@@ -23664,74 +23905,57 @@
23664
23905
  function ReactAttributePlugin() {
23665
23906
  var _this;
23666
23907
  _classCallCheck(this, ReactAttributePlugin);
23667
- _this = _callSuper(this, ReactAttributePlugin, arguments), _this.name = "ReactAttributePlugin", _this.activeEvent = "onRegister", _this._uid = Generator.GenAutoIncrementId(), _this.key = _this.name + _this._uid;
23908
+ _this = _callSuper(this, ReactAttributePlugin, arguments), _this.name = "ReactAttributePlugin", _this.activeEvent = "onRegister", _this._uid = Generator.GenAutoIncrementId(), _this.key = _this.name + _this._uid, _this.htmlMap = {};
23668
23909
  return _this;
23669
23910
  }
23670
23911
  _inherits(ReactAttributePlugin, _HtmlAttributePlugin);
23671
23912
  return _createClass(ReactAttributePlugin, [{
23672
- key: "removeDom",
23673
- value: function removeDom(graphic) {
23674
- graphic.bindDom && graphic.bindDom.size && (graphic.bindDom.forEach(function (item) {
23675
- item.root && item.root.unmount();
23676
- }), graphic.bindDom.clear());
23913
+ key: "removeElement",
23914
+ value: function removeElement(id) {
23915
+ if (!this.htmlMap || !this.htmlMap[id]) return;
23916
+ var _this$htmlMap$id = this.htmlMap[id],
23917
+ root = _this$htmlMap$id.root,
23918
+ wrapContainer = _this$htmlMap$id.wrapContainer;
23919
+ if (root) {
23920
+ application.global.getRequestAnimationFrame()(function () {
23921
+ root.unmount();
23922
+ });
23923
+ }
23924
+ wrapContainer && application.global.removeDom(wrapContainer), this.htmlMap[id] = null;
23677
23925
  }
23678
23926
  }, {
23679
23927
  key: "renderGraphicHTML",
23680
23928
  value: function renderGraphicHTML(graphic) {
23929
+ var _a;
23681
23930
  var react = graphic.attribute.react;
23682
- if (!react) return void (graphic.bindDom && graphic.bindDom.size && (graphic.bindDom.forEach(function (item) {
23683
- item.root && item.root.unmount();
23684
- }), graphic.bindDom.clear()));
23931
+ if (!react) return;
23685
23932
  var stage = graphic.stage;
23686
23933
  if (!stage) return;
23687
23934
  var ReactDOM = stage.params.ReactDOM,
23688
23935
  element = react.element,
23689
- container = react.container,
23690
- width = react.width,
23691
- height = react.height,
23692
- style = react.style,
23693
- _react$anchorType = react.anchorType,
23694
- anchorType = _react$anchorType === void 0 ? "boundsLeftTop" : _react$anchorType,
23695
- pointerEvents = react.pointerEvents;
23936
+ container = react.container;
23696
23937
  if (!(element && ReactDOM && ReactDOM.createRoot)) return;
23697
- graphic.bindDom || (graphic.bindDom = new Map());
23698
- var lastDom = graphic.bindDom.get(element);
23699
- var wrapGroup, nativeContainer;
23700
- if (!lastDom || container && container !== lastDom.container) {
23701
- graphic.bindDom.forEach(function (_ref) {
23702
- var wrapGroup = _ref.wrapGroup;
23703
- application.global.removeDom(wrapGroup);
23704
- });
23705
- var _container = container;
23706
- if (nativeContainer = _container ? "string" == typeof _container ? application.global.getElementById(_container) : _container : graphic.stage.window.getContainer(), wrapGroup = application.global.createDom({
23707
- tagName: "div",
23708
- width: width,
23709
- height: height,
23710
- style: style,
23711
- parent: nativeContainer
23712
- }), wrapGroup) {
23713
- var root = ReactDOM.createRoot(wrapGroup);
23714
- root.render(element), graphic.bindDom.set(element, {
23715
- dom: element,
23938
+ var id = isNil$1(react.id) ? "".concat(null !== (_a = graphic.id) && void 0 !== _a ? _a : graphic._uid, "_react") : react.id;
23939
+ if (this.htmlMap && this.htmlMap[id] && container && container !== this.htmlMap[id].container && this.removeElement(id), this.htmlMap && this.htmlMap[id]) this.htmlMap[id].root.render(element);else {
23940
+ var _this$getWrapContaine = this.getWrapContainer(stage, container),
23941
+ _wrapContainer = _this$getWrapContaine.wrapContainer,
23942
+ _nativeContainer = _this$getWrapContaine.nativeContainer;
23943
+ if (_wrapContainer) {
23944
+ var root = ReactDOM.createRoot(_wrapContainer);
23945
+ root.render(element), this.htmlMap || (this.htmlMap = {}), this.htmlMap[id] = {
23946
+ root: root,
23947
+ wrapContainer: _wrapContainer,
23948
+ nativeContainer: _nativeContainer,
23716
23949
  container: container,
23717
- wrapGroup: wrapGroup,
23718
- root: root
23719
- });
23950
+ renderId: this.renderId
23951
+ };
23720
23952
  }
23721
- } else wrapGroup = lastDom.wrapGroup, nativeContainer = wrapGroup.parentNode;
23722
- wrapGroup.style.pointerEvents = pointerEvents || "none", wrapGroup.style.position || (wrapGroup.style.position = "absolute", nativeContainer.style.position = "relative");
23723
- var left = 0,
23724
- top = 0;
23725
- var b = graphic.globalAABBBounds;
23726
- if ("position" === anchorType || b.empty()) {
23727
- var matrix = graphic.globalTransMatrix;
23728
- left = matrix.e, top = matrix.f;
23729
- } else left = b.x1, top = b.y1;
23730
- var containerTL = application.global.getElementTopLeft(nativeContainer, !1),
23731
- windowTL = stage.window.getTopLeft(!1),
23732
- offsetX = left + windowTL.left - containerTL.left,
23733
- offsetTop = top + windowTL.top - containerTL.top;
23734
- wrapGroup.style.left = "".concat(offsetX, "px"), wrapGroup.style.top = "".concat(offsetTop, "px");
23953
+ }
23954
+ if (!this.htmlMap || !this.htmlMap[id]) return;
23955
+ var _this$htmlMap$id2 = this.htmlMap[id],
23956
+ wrapContainer = _this$htmlMap$id2.wrapContainer,
23957
+ nativeContainer = _this$htmlMap$id2.nativeContainer;
23958
+ this.updateStyleOfWrapContainer(graphic, stage, wrapContainer, nativeContainer, react), this.htmlMap[id].renderId = this.renderId;
23735
23959
  }
23736
23960
  }]);
23737
23961
  }(HtmlAttributePlugin);
@@ -24273,7 +24497,7 @@
24273
24497
  value: function release() {
24274
24498
  _get(_getPrototypeOf(Stage.prototype), "release", this).call(this), this.hooks.beforeRender.unTap("constructor", this.beforeRender), this.hooks.afterRender.unTap("constructor", this.afterRender), this.eventSystem && this.eventSystem.release(), this.layerService.releaseStage(this), this.pluginService.release(), this.forEach(function (layer) {
24275
24499
  layer.release();
24276
- }), this.interactiveLayer && this.interactiveLayer.release(), this.window.release();
24500
+ }), this.interactiveLayer && this.interactiveLayer.release(), this.window.release(), this.ticker.remTimeline(this.timeline), this.renderService.renderTreeRoots = [];
24277
24501
  }
24278
24502
  }, {
24279
24503
  key: "setStage",
@@ -24349,6 +24573,12 @@
24349
24573
  value: function getCursor() {
24350
24574
  return this._cursor;
24351
24575
  }
24576
+ }, {
24577
+ key: "eventPointTransform",
24578
+ value: function eventPointTransform(e) {
24579
+ var point = this.global.mapToCanvasPoint(e, this.window.getContext().canvas.nativeCanvas);
24580
+ return this.stage.window.pointTransform(point.x, point.y);
24581
+ }
24352
24582
  }]);
24353
24583
  }(Group);
24354
24584
 
@@ -24899,6 +25129,11 @@
24899
25129
  value: function createDom(params) {
24900
25130
  return null;
24901
25131
  }
25132
+ }, {
25133
+ key: "updateDom",
25134
+ value: function updateDom(dom, params) {
25135
+ return !1;
25136
+ }
24902
25137
  }, {
24903
25138
  key: "getDynamicCanvasCount",
24904
25139
  value: function getDynamicCanvasCount() {
@@ -25752,7 +25987,7 @@
25752
25987
  key: "drawShape",
25753
25988
  value: function drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
25754
25989
  var _a;
25755
- var rectAttribute = getTheme(rect, null == params ? void 0 : params.theme).rect3d,
25990
+ var rectAttribute = getTheme(rect, null == params ? void 0 : params.theme).rect,
25756
25991
  _rect$attribute = rect.attribute,
25757
25992
  _rect$attribute$fill = _rect$attribute.fill,
25758
25993
  fill = _rect$attribute$fill === void 0 ? rectAttribute.fill : _rect$attribute$fill,
@@ -29090,9 +29325,9 @@
29090
29325
  if (target && !isRoot) {
29091
29326
  var handlePointerMove = function handlePointerMove(moveEvent) {
29092
29327
  if (dragstartTriggered || (moveEvent.type = "dragstart", null == target || target.dispatchEvent(moveEvent), dragstartTriggered = !0), moveEvent.type = "drag", null == target || target.dispatchEvent(moveEvent), !isRoot) {
29093
- target.pickable = !1;
29328
+ target.attribute.pickable = !1;
29094
29329
  var elemBelow = (null == rootNode ? void 0 : rootNode.pick(moveEvent.global.x, moveEvent.global.y)).graphic;
29095
- target.pickable = !0, currentDroppable !== elemBelow && (currentDroppable && (moveEvent.type = "dragleave", moveEvent.target = currentDroppable, currentDroppable.dispatchEvent(moveEvent)), elemBelow && (moveEvent.type = "dragenter", moveEvent.target = elemBelow, elemBelow.dispatchEvent(moveEvent)), currentDroppable = elemBelow, currentDroppable && (moveEvent.type = "dragover", moveEvent.target = currentDroppable, currentDroppable.dispatchEvent(moveEvent)));
29330
+ target.attribute.pickable = !0, currentDroppable !== elemBelow && (currentDroppable && (moveEvent.type = "dragleave", moveEvent.target = currentDroppable, currentDroppable.dispatchEvent(moveEvent)), elemBelow && (moveEvent.type = "dragenter", moveEvent.target = elemBelow, elemBelow.dispatchEvent(moveEvent)), currentDroppable = elemBelow, currentDroppable && (moveEvent.type = "dragover", moveEvent.target = currentDroppable, currentDroppable.dispatchEvent(moveEvent)));
29096
29331
  }
29097
29332
  };
29098
29333
  var currentDroppable,
@@ -29890,7 +30125,7 @@
29890
30125
  value: function setLineDash(segments) {
29891
30126
  var a = arguments,
29892
30127
  _context = this.nativeContext;
29893
- this.nativeContext.setLineDash ? _context.setLineDash(a[0]) : "mozDash" in _context ? _context.mozDash = a[0] : "webkitLineDash" in _context && (_context.webkitLineDash = a[0]);
30128
+ this.nativeContext.setLineDash ? a[0] && _context.setLineDash(a[0]) : "mozDash" in _context ? _context.mozDash = a[0] : "webkitLineDash" in _context && (_context.webkitLineDash = a[0]);
29894
30129
  }
29895
30130
  }, {
29896
30131
  key: "stroke",
@@ -30011,7 +30246,7 @@
30011
30246
  lineCap = _attribute$lineCap === void 0 ? defaultParams.lineCap : _attribute$lineCap,
30012
30247
  _attribute$miterLimit = attribute.miterLimit,
30013
30248
  miterLimit = _attribute$miterLimit === void 0 ? defaultParams.miterLimit : _attribute$miterLimit;
30014
- _context.globalAlpha = strokeOpacity * opacity, _context.lineWidth = getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
30249
+ _context.globalAlpha = strokeOpacity * opacity, _context.lineWidth = getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, lineDash && _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
30015
30250
  }
30016
30251
  }
30017
30252
  }, {
@@ -30669,19 +30904,24 @@
30669
30904
  value: function removeDom(dom) {
30670
30905
  return dom.parentElement.removeChild(dom), !0;
30671
30906
  }
30907
+ }, {
30908
+ key: "updateDom",
30909
+ value: function updateDom(dom, params) {
30910
+ var width = params.width,
30911
+ height = params.height,
30912
+ style = params.style;
30913
+ return style && (isString$1(style) ? dom.setAttribute("style", style) : Object.keys(style).forEach(function (k) {
30914
+ dom.style[k] = style[k];
30915
+ })), null != width && (dom.style.width = "".concat(width, "px")), null != height && (dom.style.height = "".concat(height, "px")), !0;
30916
+ }
30672
30917
  }, {
30673
30918
  key: "createDom",
30674
30919
  value: function createDom(params) {
30675
30920
  var _params$tagName = params.tagName,
30676
30921
  tagName = _params$tagName === void 0 ? "div" : _params$tagName,
30677
- width = params.width,
30678
- height = params.height,
30679
- style = params.style,
30680
30922
  parent = params.parent,
30681
30923
  element = document.createElement(tagName);
30682
- if (style && (isString$1(style) ? element.setAttribute("style", style) : Object.keys(style).forEach(function (k) {
30683
- element.setAttribute(k, style[k]);
30684
- })), null != width && (element.style.width = "".concat(width, "px")), null != height && (element.style.height = "".concat(height, "px")), parent) {
30924
+ if (this.updateDom(element, params), parent) {
30685
30925
  var pd = isString$1(parent) ? this.getElementById(parent) : parent;
30686
30926
  pd && pd.appendChild && pd.appendChild(element);
30687
30927
  }
@@ -31470,7 +31710,7 @@
31470
31710
  if (this.nativeContext.setLineDash) {
31471
31711
  var lineDash = a[0];
31472
31712
  if (0 === lineDash[0] && 0 === lineDash[1]) return;
31473
- _context.setLineDash(lineDash);
31713
+ lineDash && _context.setLineDash(lineDash);
31474
31714
  }
31475
31715
  }
31476
31716
  }, {
@@ -31495,7 +31735,7 @@
31495
31735
  lineCap = _attribute$lineCap === void 0 ? defaultParams.lineCap : _attribute$lineCap,
31496
31736
  _attribute$miterLimit = attribute.miterLimit,
31497
31737
  miterLimit = _attribute$miterLimit === void 0 ? defaultParams.miterLimit : _attribute$miterLimit;
31498
- _context.globalAlpha = strokeOpacity * opacity, _context.lineWidth = getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, 0 === lineDash[0] && 0 === lineDash[1] || _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
31738
+ _context.globalAlpha = strokeOpacity * opacity, _context.lineWidth = getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, 0 === lineDash[0] && 0 === lineDash[1] || lineDash && _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
31499
31739
  }
31500
31740
  }
31501
31741
  }, {
@@ -32377,7 +32617,7 @@
32377
32617
  lineCap = _attribute$lineCap === void 0 ? defaultParams.lineCap : _attribute$lineCap,
32378
32618
  _attribute$miterLimit = attribute.miterLimit,
32379
32619
  miterLimit = _attribute$miterLimit === void 0 ? defaultParams.miterLimit : _attribute$miterLimit;
32380
- _context.setGlobalAlpha(strokeOpacity * opacity), _context.setLineWidth(getScaledStroke(this, lineWidth, this.dpr)), _context.setStrokeStyle(createColor(this, stroke, params, offsetX, offsetY)), _context.setLineJoin(lineJoin), _context.setLineDash(lineDash), _context.setLineCap(lineCap), _context.setMiterLimit(miterLimit);
32620
+ _context.setGlobalAlpha(strokeOpacity * opacity), _context.setLineWidth(getScaledStroke(this, lineWidth, this.dpr)), _context.setStrokeStyle(createColor(this, stroke, params, offsetX, offsetY)), _context.setLineJoin(lineJoin), lineDash && _context.setLineDash(lineDash), _context.setLineCap(lineCap), _context.setMiterLimit(miterLimit);
32381
32621
  }
32382
32622
  }
32383
32623
  }, {
@@ -34897,7 +35137,7 @@
34897
35137
 
34898
35138
  var roughModule = _roughModule;
34899
35139
 
34900
- const version = "0.19.0-alpha.1";
35140
+ const version = "0.19.1";
34901
35141
  preLoadAllModule();
34902
35142
  if (isBrowserEnv()) {
34903
35143
  loadBrowserEnv(container);
@@ -35451,6 +35691,7 @@
35451
35691
  exports.symbolMathPickModule = symbolMathPickModule;
35452
35692
  exports.symbolModule = symbolModule;
35453
35693
  exports.taroEnvModule = taroEnvModule;
35694
+ exports.textAttributesToStyle = textAttributesToStyle;
35454
35695
  exports.textCanvasPickModule = textCanvasPickModule;
35455
35696
  exports.textDrawOffsetX = textDrawOffsetX;
35456
35697
  exports.textDrawOffsetY = textDrawOffsetY;