@visactor/vrender 0.18.0-alpha.0 → 0.18.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2149,15 +2149,15 @@
2149
2149
  };
2150
2150
  var isArray$1 = isArray;
2151
2151
 
2152
- var isNumber$1 = function isNumber(value) {
2152
+ var isNumber = function isNumber(value) {
2153
2153
  var fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
2154
2154
  var type = _typeof(value);
2155
2155
  return fuzzy ? "number" === type : "number" === type || isType$1(value, "Number");
2156
2156
  };
2157
- var isNumber$2 = isNumber$1;
2157
+ var isNumber$1 = isNumber;
2158
2158
 
2159
2159
  var isValidNumber = function isValidNumber(value) {
2160
- return isNumber$2(value) && Number.isFinite(value);
2160
+ return isNumber$1(value) && Number.isFinite(value);
2161
2161
  };
2162
2162
  var isValidNumber$1 = isValidNumber;
2163
2163
 
@@ -2264,12 +2264,12 @@
2264
2264
  }, {
2265
2265
  key: "add",
2266
2266
  value: function add(point) {
2267
- return isNumber$2(point) ? (this.x += point, void (this.y += point)) : (this.x += point.x, this.y += point.y, this);
2267
+ return isNumber$1(point) ? (this.x += point, void (this.y += point)) : (this.x += point.x, this.y += point.y, this);
2268
2268
  }
2269
2269
  }, {
2270
2270
  key: "sub",
2271
2271
  value: function sub(point) {
2272
- return isNumber$2(point) ? (this.x -= point, void (this.y -= point)) : (this.x -= point.x, this.y -= point.y, this);
2272
+ return isNumber$1(point) ? (this.x -= point, void (this.y -= point)) : (this.x -= point.x, this.y -= point.y, this);
2273
2273
  }
2274
2274
  }, {
2275
2275
  key: "multi",
@@ -2973,10 +2973,10 @@
2973
2973
  return ((value = Math.max(0, Math.min(255, Math.round(value) || 0))) < 16 ? "0" : "") + value.toString(16);
2974
2974
  }
2975
2975
  function rgb(value) {
2976
- return isNumber$2(value) ? new RGB(value >> 16, value >> 8 & 255, 255 & value, 1) : isArray$1(value) ? new RGB(value[0], value[1], value[2]) : new RGB(255, 255, 255);
2976
+ return isNumber$1(value) ? new RGB(value >> 16, value >> 8 & 255, 255 & value, 1) : isArray$1(value) ? new RGB(value[0], value[1], value[2]) : new RGB(255, 255, 255);
2977
2977
  }
2978
2978
  function rgba(value) {
2979
- return isNumber$2(value) ? new RGB(value >>> 24, value >>> 16 & 255, value >>> 8 & 255, 255 & value) : isArray$1(value) ? new RGB(value[0], value[1], value[2], value[3]) : new RGB(255, 255, 255, 1);
2979
+ return isNumber$1(value) ? new RGB(value >>> 24, value >>> 16 & 255, value >>> 8 & 255, 255 & value) : isArray$1(value) ? new RGB(value[0], value[1], value[2], value[3]) : new RGB(255, 255, 255, 1);
2980
2980
  }
2981
2981
  function SRGBToLinear(c) {
2982
2982
  return c < .04045 ? .0773993808 * c : Math.pow(.9478672986 * c + .0521327014, 2.4);
@@ -3657,7 +3657,7 @@
3657
3657
  }], [{
3658
3658
  key: "getInstance",
3659
3659
  value: function getInstance(level, method) {
3660
- return Logger._instance && isNumber$2(level) ? Logger._instance.level(level) : Logger._instance || (Logger._instance = new Logger(level, method)), Logger._instance;
3660
+ return Logger._instance && isNumber$1(level) ? Logger._instance.level(level) : Logger._instance || (Logger._instance = new Logger(level, method)), Logger._instance;
3661
3661
  }
3662
3662
  }, {
3663
3663
  key: "setInstance",
@@ -4278,6 +4278,10 @@
4278
4278
  var defined0 = !1;
4279
4279
  for (var i = 0, n = points.length; i <= n; i++) i >= n === defined0 && ((defined0 = !defined0) ? path.lineStart() : path.lineEnd()), defined0 && path.point(points[i]);
4280
4280
  }
4281
+ function genSegContext(curveType, direction, points) {
4282
+ var curveDirection = null != direction ? direction : abs(points[points.length - 1].x - points[0].x) > abs(points[points.length - 1].y - points[0].y) ? exports.Direction.ROW : exports.Direction.COLUMN;
4283
+ return "monotoneY" === curveType ? new ReflectSegContext(curveType, curveDirection) : new SegContext(curveType, curveDirection);
4284
+ }
4281
4285
 
4282
4286
  var Linear = /*#__PURE__*/function () {
4283
4287
  function Linear(context, startPoint) {
@@ -4333,7 +4337,7 @@
4333
4337
  var direction = params.direction,
4334
4338
  startPoint = params.startPoint;
4335
4339
  if (points.length < 2 - Number(!!startPoint)) return null;
4336
- var segContext = new SegContext("linear", null != direction ? direction : abs(points[points.length - 1].x - points[0].x) > abs(points[points.length - 1].y - points[0].y) ? exports.Direction.ROW : exports.Direction.COLUMN);
4340
+ var segContext = genSegContext("linear", direction, points);
4337
4341
  return genLinearTypeSegments(new Linear(segContext, startPoint), points), segContext;
4338
4342
  }
4339
4343
  function genLinearTypeSegments(path, points) {
@@ -4403,7 +4407,7 @@
4403
4407
  startPoint = params.startPoint;
4404
4408
  if (points.length < 2 - Number(!!startPoint)) return null;
4405
4409
  if (points.length < 3 - Number(!!startPoint)) return genLinearSegments(points, params);
4406
- var segContext = new SegContext("basis", null != direction ? direction : abs(points[points.length - 1].x - points[0].x) > abs(points[points.length - 1].y - points[0].y) ? exports.Direction.ROW : exports.Direction.COLUMN);
4410
+ var segContext = genSegContext("basis", direction, points);
4407
4411
  return genBasisTypeSegments(new Basis(segContext, startPoint), points), segContext;
4408
4412
  }
4409
4413
 
@@ -4510,7 +4514,7 @@
4510
4514
  }]);
4511
4515
  return MonotoneY;
4512
4516
  }(MonotoneX);
4513
- function genMonotpneXTypeSegments(path, points) {
4517
+ function genMonotoneXTypeSegments(path, points) {
4514
4518
  return genCurveSegments(path, points);
4515
4519
  }
4516
4520
  function genMonotoneXSegments(points) {
@@ -4519,10 +4523,10 @@
4519
4523
  startPoint = params.startPoint;
4520
4524
  if (points.length < 2 - Number(!!startPoint)) return null;
4521
4525
  if (points.length < 3 - Number(!!startPoint)) return genLinearSegments(points, params);
4522
- var segContext = new SegContext("monotoneX", null != direction ? direction : abs(points[points.length - 1].x - points[0].x) > abs(points[points.length - 1].y - points[0].y) ? exports.Direction.ROW : exports.Direction.COLUMN);
4523
- return genMonotpneXTypeSegments(new MonotoneX(segContext, startPoint), points), segContext;
4526
+ var segContext = genSegContext("monotoneX", direction, points);
4527
+ return genMonotoneXTypeSegments(new MonotoneX(segContext, startPoint), points), segContext;
4524
4528
  }
4525
- function genMonotpneYTypeSegments(path, points) {
4529
+ function genMonotoneYTypeSegments(path, points) {
4526
4530
  return genCurveSegments(path, points);
4527
4531
  }
4528
4532
  function genMonotoneYSegments(points) {
@@ -4531,8 +4535,8 @@
4531
4535
  startPoint = params.startPoint;
4532
4536
  if (points.length < 2 - Number(!!startPoint)) return null;
4533
4537
  if (points.length < 3 - Number(!!startPoint)) return genLinearSegments(points, params);
4534
- var segContext = new ReflectSegContext("monotoneY", null != direction ? direction : abs(points[points.length - 1].x - points[0].x) > abs(points[points.length - 1].y - points[0].y) ? exports.Direction.ROW : exports.Direction.COLUMN);
4535
- return genMonotpneYTypeSegments(new MonotoneY(segContext, startPoint), points), segContext;
4538
+ var segContext = genSegContext("monotoneY", direction, points);
4539
+ return genMonotoneYTypeSegments(new MonotoneY(segContext, startPoint), points), segContext;
4536
4540
  }
4537
4541
 
4538
4542
  var Step$1 = /*#__PURE__*/function () {
@@ -4601,61 +4605,27 @@
4601
4605
  return genCurveSegments(path, points);
4602
4606
  }
4603
4607
 
4604
- var LinearClosed = /*#__PURE__*/function () {
4605
- function LinearClosed(context, startPoint) {
4608
+ var LinearClosed = /*#__PURE__*/function (_Linear) {
4609
+ _inherits(LinearClosed, _Linear);
4610
+ var _super = _createSuper(LinearClosed);
4611
+ function LinearClosed() {
4606
4612
  _classCallCheck(this, LinearClosed);
4607
- this.context = context, startPoint && (this.startPoint = startPoint);
4613
+ return _super.apply(this, arguments);
4608
4614
  }
4609
4615
  _createClass(LinearClosed, [{
4610
- key: "areaStart",
4611
- value: function areaStart() {
4612
- this._line = 0;
4613
- }
4614
- }, {
4615
- key: "areaEnd",
4616
- value: function areaEnd() {
4617
- this._line = NaN;
4618
- }
4619
- }, {
4620
- key: "lineStart",
4621
- value: function lineStart() {
4622
- this._point = 0, this.startPoint && this.point(this.startPoint);
4623
- }
4624
- }, {
4625
4616
  key: "lineEnd",
4626
4617
  value: function lineEnd() {
4627
4618
  this.context.closePath();
4628
4619
  }
4629
- }, {
4630
- key: "point",
4631
- value: function point(p) {
4632
- var x = p.x,
4633
- y = p.y;
4634
- switch (this._point) {
4635
- case 0:
4636
- this._point = 1, this._line ? this.context.lineTo(x, y, !1 !== this._lastDefined && !1 !== p.defined, p) : this.context.moveTo(x, y, p);
4637
- break;
4638
- case 1:
4639
- this._point = 2;
4640
- default:
4641
- this.context.lineTo(x, y, !1 !== this._lastDefined && !1 !== p.defined, p);
4642
- }
4643
- this._lastDefined = p.defined;
4644
- }
4645
- }, {
4646
- key: "tryUpdateLength",
4647
- value: function tryUpdateLength() {
4648
- return this.context.tryUpdateLength();
4649
- }
4650
4620
  }]);
4651
4621
  return LinearClosed;
4652
- }();
4622
+ }(Linear);
4653
4623
  function genLinearClosedSegments(points) {
4654
4624
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4655
4625
  var direction = params.direction,
4656
4626
  startPoint = params.startPoint;
4657
4627
  if (points.length < 2 - Number(!!startPoint)) return null;
4658
- var segContext = new SegContext("linear", null != direction ? direction : abs(points[points.length - 1].x - points[0].x) > abs(points[points.length - 1].y - points[0].y) ? exports.Direction.ROW : exports.Direction.COLUMN);
4628
+ var segContext = genSegContext("linear", direction, points);
4659
4629
  return genLinearClosedTypeSegments(new LinearClosed(segContext, startPoint), points), segContext;
4660
4630
  }
4661
4631
  function genLinearClosedTypeSegments(path, points) {
@@ -5188,11 +5158,13 @@
5188
5158
  var DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({
5189
5159
  opacity: 1,
5190
5160
  background: null,
5161
+ backgroundCornerRadius: 0,
5191
5162
  texture: null,
5192
5163
  textureColor: "black",
5193
5164
  textureSize: 10,
5194
5165
  texturePadding: 2,
5195
5166
  backgroundMode: "no-repeat",
5167
+ backgroundFit: !0,
5196
5168
  blur: 0,
5197
5169
  cursor: null,
5198
5170
  html: null
@@ -5210,6 +5182,8 @@
5210
5182
  strokeSeg: null,
5211
5183
  pickable: !0,
5212
5184
  childrenPickable: !0,
5185
+ fillPickable: !0,
5186
+ strokePickable: !0,
5213
5187
  visible: !0,
5214
5188
  zIndex: 0,
5215
5189
  layout: null,
@@ -5823,9 +5797,6 @@
5823
5797
  function isNotAroundZero(val) {
5824
5798
  return val > EPSILON || val < -EPSILON;
5825
5799
  }
5826
- function isNumber(data) {
5827
- return "number" == typeof data && Number.isFinite(data);
5828
- }
5829
5800
  var _v0 = [0, 0],
5830
5801
  _v1 = [0, 0],
5831
5802
  _v2 = [0, 0];
@@ -6736,7 +6707,7 @@
6736
6707
  }();
6737
6708
  var globalTheme = new Theme();
6738
6709
  function getTheme(graphic, theme) {
6739
- return graphic.glyphHost ? getTheme(graphic.glyphHost) : theme ? (graphic.isContainer, theme) : getThemeFromGroup(graphic) || globalTheme.getTheme();
6710
+ return graphic.glyphHost ? getTheme(graphic.glyphHost) : theme ? (graphic.isContainer, theme) : getThemeFromGroup(graphic) || graphic.attachedThemeGraphic && getTheme(graphic.attachedThemeGraphic) || globalTheme.getTheme();
6740
6711
  }
6741
6712
  function getThemeFromGroup(graphic) {
6742
6713
  var g;
@@ -7000,10 +6971,13 @@
7000
6971
  }
7001
6972
  }, {
7002
6973
  key: "removeAllChild",
7003
- value: function removeAllChild() {
6974
+ value: function removeAllChild(deep) {
7004
6975
  if (!this._idMap) return;
7005
6976
  var child = this._firstChild;
7006
- for (; child;) child.parent = null, child._prev = null, child._next = null, child = child._next;
6977
+ for (; child;) {
6978
+ var next = child._next;
6979
+ child.parent = null, child._prev = null, child._next = null, child = child._next, child = next;
6980
+ }
7007
6981
  this._firstChild = null, this._lastChild = null, this._idMap.clear(), this._structEdit = !0, this.setCount(1 - this._count);
7008
6982
  }
7009
6983
  }, {
@@ -7886,10 +7860,14 @@
7886
7860
  viewport = params.viewport,
7887
7861
  _params$autoPreventDe = params.autoPreventDefault,
7888
7862
  autoPreventDefault = _params$autoPreventDe === void 0 ? !1 : _params$autoPreventDe,
7889
- clickInterval = params.clickInterval;
7863
+ clickInterval = params.clickInterval,
7864
+ _params$supportsTouch = params.supportsTouchEvents,
7865
+ supportsTouchEvents = _params$supportsTouch === void 0 ? global.supportsTouchEvents : _params$supportsTouch,
7866
+ _params$supportsPoint = params.supportsPointerEvents,
7867
+ supportsPointerEvents = _params$supportsPoint === void 0 ? global.supportsPointerEvents : _params$supportsPoint;
7890
7868
  this.manager = new EventManager(rootNode, {
7891
7869
  clickInterval: clickInterval
7892
- }), this.globalObj = global, this.supportsPointerEvents = global.supportsPointerEvents, this.supportsTouchEvents = global.supportsTouchEvents, this.supportsMouseEvents = global.supportsMouseEvents, this.applyStyles = global.applyStyles, this.autoPreventDefault = autoPreventDefault, this.eventsAdded = !1, this.viewport = viewport, this.rootPointerEvent = new FederatedPointerEvent(), this.rootWheelEvent = new FederatedWheelEvent(), this.cursorStyles = {
7870
+ }), this.globalObj = global, this.supportsPointerEvents = supportsPointerEvents, this.supportsTouchEvents = supportsTouchEvents, this.supportsMouseEvents = global.supportsMouseEvents, this.applyStyles = global.applyStyles, this.autoPreventDefault = autoPreventDefault, this.eventsAdded = !1, this.viewport = viewport, this.rootPointerEvent = new FederatedPointerEvent(), this.rootWheelEvent = new FederatedWheelEvent(), this.cursorStyles = {
7893
7871
  "default": "inherit",
7894
7872
  pointer: "pointer"
7895
7873
  }, this.resolution = resolution, this.setTargetElement(targetElement);
@@ -9265,7 +9243,7 @@
9265
9243
  key: "onBind",
9266
9244
  value: function onBind() {
9267
9245
  var _a, _b, _c, _d, _e, _f, _g, _h;
9268
- this.fromNumber = isNumber$2(null === (_a = this.from) || void 0 === _a ? void 0 : _a.text) ? null === (_b = this.from) || void 0 === _b ? void 0 : _b.text : Number.parseFloat(null === (_c = this.from) || void 0 === _c ? void 0 : _c.text), this.toNumber = isNumber$2(null === (_d = this.to) || void 0 === _d ? void 0 : _d.text) ? null === (_e = this.to) || void 0 === _e ? void 0 : _e.text : Number.parseFloat(null === (_f = this.to) || void 0 === _f ? void 0 : _f.text), Number.isFinite(this.toNumber) || (this.fromNumber = 0), Number.isFinite(this.toNumber) || (this.valid = !1), !1 !== this.valid && (this.decimalLength = null !== (_h = null === (_g = this.params) || void 0 === _g ? void 0 : _g.fixed) && void 0 !== _h ? _h : Math.max(getDecimalPlaces(this.fromNumber), getDecimalPlaces(this.toNumber)));
9246
+ this.fromNumber = isNumber$1(null === (_a = this.from) || void 0 === _a ? void 0 : _a.text) ? null === (_b = this.from) || void 0 === _b ? void 0 : _b.text : Number.parseFloat(null === (_c = this.from) || void 0 === _c ? void 0 : _c.text), this.toNumber = isNumber$1(null === (_d = this.to) || void 0 === _d ? void 0 : _d.text) ? null === (_e = this.to) || void 0 === _e ? void 0 : _e.text : Number.parseFloat(null === (_f = this.to) || void 0 === _f ? void 0 : _f.text), Number.isFinite(this.toNumber) || (this.fromNumber = 0), Number.isFinite(this.toNumber) || (this.valid = !1), !1 !== this.valid && (this.decimalLength = null !== (_h = null === (_g = this.params) || void 0 === _g ? void 0 : _g.fixed) && void 0 !== _h ? _h : Math.max(getDecimalPlaces(this.fromNumber), getDecimalPlaces(this.toNumber)));
9269
9247
  }
9270
9248
  }, {
9271
9249
  key: "onEnd",
@@ -10583,6 +10561,25 @@
10583
10561
  return path;
10584
10562
  }
10585
10563
 
10564
+ var normalizeRectAttributes = function normalizeRectAttributes(attribute) {
10565
+ if (!attribute) return {
10566
+ x: 0,
10567
+ y: 0,
10568
+ width: 0,
10569
+ height: 0
10570
+ };
10571
+ var width = isNil$1(attribute.width) ? attribute.x1 - attribute.x : attribute.width,
10572
+ height = isNil$1(attribute.height) ? attribute.y1 - attribute.y : attribute.height,
10573
+ x = 0,
10574
+ y = 0;
10575
+ return width < 0 ? (x = width, width = -width) : Number.isNaN(width) && (width = 0), height < 0 ? (y = height, height = -height) : Number.isNaN(height) && (height = 0), {
10576
+ x: x,
10577
+ y: y,
10578
+ width: width,
10579
+ height: height
10580
+ };
10581
+ };
10582
+
10586
10583
  function splitToGrids(width, height, count) {
10587
10584
  var ratio = width / height;
10588
10585
  var rowCount, columnCount;
@@ -10594,8 +10591,9 @@
10594
10591
  return grids;
10595
10592
  }
10596
10593
  var splitRect = function splitRect(rect, count) {
10597
- var width = rect.getComputedAttribute("width"),
10598
- height = rect.getComputedAttribute("height"),
10594
+ var _normalizeRectAttribu = normalizeRectAttributes(rect.attribute),
10595
+ width = _normalizeRectAttribu.width,
10596
+ height = _normalizeRectAttribu.height,
10599
10597
  grids = splitToGrids(width, height, count),
10600
10598
  res = [],
10601
10599
  gridHeight = height / grids.length;
@@ -10656,7 +10654,7 @@
10656
10654
  };
10657
10655
  var samplingPoints = function samplingPoints(points, count) {
10658
10656
  var validatePoints = points.filter(function (point) {
10659
- return !1 !== point.defined && isNumber$2(point.x) && isNumber$2(point.y);
10657
+ return !1 !== point.defined && isNumber$1(point.x) && isNumber$1(point.y);
10660
10658
  });
10661
10659
  if (0 === validatePoints.length) return [];
10662
10660
  if (1 === validatePoints.length) return new Array(count).fill(0).map(function (i) {
@@ -10696,7 +10694,7 @@
10696
10694
  return res.concat(null !== (_a = seg.points) && void 0 !== _a ? _a : []);
10697
10695
  }, []));
10698
10696
  var validatePoints = points.filter(function (point) {
10699
- return !1 !== point.defined && isNumber$2(point.x) && isNumber$2(point.y);
10697
+ return !1 !== point.defined && isNumber$1(point.x) && isNumber$1(point.y);
10700
10698
  });
10701
10699
  if (!validatePoints.length) return [];
10702
10700
  var allPoints = [];
@@ -11363,15 +11361,7 @@
11363
11361
  var data = ResourceLoader.cache.get(url);
11364
11362
  data ? "fail" === data.loadState ? application.global.getRequestAnimationFrame()(function () {
11365
11363
  mark.imageLoadFail(url);
11366
- }) : "init" === data.loadState || "loading" === data.loadState ? null === (_a = data.waitingMark) || void 0 === _a || _a.push(mark) : mark && mark.imageLoadSuccess(url, data.data) : (data = {
11367
- type: "image",
11368
- loadState: "init"
11369
- }, ResourceLoader.cache.set(url, data), data.dataPromise = application.global.loadImage(url), data.dataPromise ? (data.waitingMark = [mark], data.dataPromise.then(function (res) {
11370
- var _a;
11371
- 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) {
11372
- (null == res ? void 0 : res.data) ? (data.loadState = "success", data.data = res.data, mark.imageLoadSuccess(url, res.data)) : (data.loadState = "fail", mark.imageLoadFail(url));
11373
- });
11374
- })) : (data.loadState = "fail", mark.imageLoadFail(url)));
11364
+ }) : "init" === data.loadState || "loading" === data.loadState ? null === (_a = data.waitingMark) || void 0 === _a || _a.push(mark) : mark && mark.imageLoadSuccess(url, data.data) : ResourceLoader.loadImage(url, mark);
11375
11365
  }
11376
11366
  }, {
11377
11367
  key: "GetSvg",
@@ -11405,10 +11395,68 @@
11405
11395
  return data.data;
11406
11396
  }));
11407
11397
  }
11398
+ }, {
11399
+ key: "loading",
11400
+ value: function loading() {
11401
+ setTimeout(function () {
11402
+ if (!ResourceLoader.isLoading && ResourceLoader.toLoadAueue.length) {
11403
+ ResourceLoader.isLoading = !0;
11404
+ var tasks = ResourceLoader.toLoadAueue.splice(0, 10),
11405
+ promises = [];
11406
+ tasks.forEach(function (task) {
11407
+ var url = task.url,
11408
+ marks = task.marks,
11409
+ data = {
11410
+ type: "image",
11411
+ loadState: "init"
11412
+ };
11413
+ if (ResourceLoader.cache.set(url, data), data.dataPromise = application.global.loadImage(url), data.dataPromise) {
11414
+ data.waitingMark = marks;
11415
+ var end = data.dataPromise.then(function (res) {
11416
+ var _a;
11417
+ data.loadState = (null == res ? void 0 : res.data) ? "success" : "fail", data.data = null == res ? void 0 : res.data, null === (_a = data.waitingMark) || void 0 === _a || _a.map(function (mark, index) {
11418
+ (null == res ? void 0 : res.data) ? (data.loadState = "success", data.data = res.data, mark.imageLoadSuccess(url, res.data)) : (data.loadState = "fail", mark.imageLoadFail(url));
11419
+ });
11420
+ });
11421
+ promises.push(end);
11422
+ } else data.loadState = "fail", marks.forEach(function (mark) {
11423
+ return mark.imageLoadFail(url);
11424
+ });
11425
+ }), Promise.all(promises).then(function () {
11426
+ ResourceLoader.isLoading = !1, ResourceLoader.loading();
11427
+ })["catch"](function (error) {
11428
+ console.error(error), ResourceLoader.isLoading = !1, ResourceLoader.loading();
11429
+ });
11430
+ }
11431
+ }, 0);
11432
+ }
11433
+ }, {
11434
+ key: "loadImage",
11435
+ value: function loadImage(url, mark) {
11436
+ var index = getIndex(url, ResourceLoader.toLoadAueue);
11437
+ if (-1 !== index) return ResourceLoader.toLoadAueue[index].marks.push(mark), void ResourceLoader.loading();
11438
+ ResourceLoader.toLoadAueue.push({
11439
+ url: url,
11440
+ marks: [mark]
11441
+ }), ResourceLoader.loading();
11442
+ }
11443
+ }, {
11444
+ key: "improveImageLoading",
11445
+ value: function improveImageLoading(url) {
11446
+ var index = getIndex(url, ResourceLoader.toLoadAueue);
11447
+ if (-1 !== index) {
11448
+ var elememt = ResourceLoader.toLoadAueue.splice(index, 1);
11449
+ ResourceLoader.toLoadAueue.unshift(elememt[0]);
11450
+ }
11451
+ }
11408
11452
  }]);
11409
11453
  return ResourceLoader;
11410
11454
  }();
11411
- ResourceLoader.cache = new Map();
11455
+ function getIndex(url, arr) {
11456
+ for (var i = 0; i < arr.length; i++) if (arr[i].url === url) return i;
11457
+ return -1;
11458
+ }
11459
+ ResourceLoader.cache = new Map(), ResourceLoader.isLoading = !1, ResourceLoader.toLoadAueue = [];
11412
11460
 
11413
11461
  var tempMatrix = new Matrix(),
11414
11462
  tempBounds$1 = new AABBBounds();
@@ -11454,7 +11502,8 @@
11454
11502
  var _this;
11455
11503
  var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
11456
11504
  _classCallCheck(this, Graphic);
11457
- _this = _super.call(this), _this._AABBBounds = new AABBBounds(), _this._updateTag = exports.UpdateTag.INIT, _this.attribute = params, _this.valid = _this.isValid(), params.background && _this.loadImage(params.background, !0);
11505
+ var _a;
11506
+ _this = _super.call(this), _this._AABBBounds = new AABBBounds(), _this._updateTag = exports.UpdateTag.INIT, _this.attribute = params, _this.valid = _this.isValid(), params.background && _this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0);
11458
11507
  return _this;
11459
11508
  }
11460
11509
  _createClass(Graphic, [{
@@ -11525,7 +11574,7 @@
11525
11574
  if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
11526
11575
  application.graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
11527
11576
  var bounds = this.doUpdateAABBBounds(full);
11528
- return this.addUpdateLayoutTag(), application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), bounds;
11577
+ return application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), bounds;
11529
11578
  }
11530
11579
  }, {
11531
11580
  key: "combindShadowAABBBounds",
@@ -11538,7 +11587,8 @@
11538
11587
  }, {
11539
11588
  key: "tryUpdateGlobalAABBBounds",
11540
11589
  value: function tryUpdateGlobalAABBBounds() {
11541
- return this._globalAABBBounds ? this._globalAABBBounds.setValue(this._AABBBounds.x1, this._AABBBounds.y1, this._AABBBounds.x2, this._AABBBounds.y2) : this._globalAABBBounds = this.AABBBounds.clone(), this.parent && this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix), this._globalAABBBounds;
11590
+ var b = this.AABBBounds;
11591
+ return this._globalAABBBounds ? this._globalAABBBounds.setValue(b.x1, b.y1, b.x2, b.y2) : this._globalAABBBounds = b.clone(), this.parent && this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix), this._globalAABBBounds;
11542
11592
  }
11543
11593
  }, {
11544
11594
  key: "tryUpdateGlobalTransMatrix",
@@ -11663,7 +11713,7 @@
11663
11713
  var context = {
11664
11714
  type: exports.AttributeUpdateType.INIT
11665
11715
  };
11666
- params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background && this.loadImage(params.background, !0), this._updateTag = exports.UpdateTag.INIT, this.onAttributeUpdate(context);
11716
+ params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background && this.loadImage(params.background, !0), this._updateTag = exports.UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
11667
11717
  }
11668
11718
  }, {
11669
11719
  key: "translate",
@@ -12193,7 +12243,7 @@
12193
12243
  data: "init",
12194
12244
  state: null
12195
12245
  };
12196
- 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);
12246
+ 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";
12197
12247
  }
12198
12248
  }, {
12199
12249
  key: "imageLoadSuccess",
@@ -12767,7 +12817,7 @@
12767
12817
  value: function doUpdateAABBBounds() {
12768
12818
  var attribute = this.attribute,
12769
12819
  groupTheme = getTheme(this).group;
12770
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
12820
+ this._AABBBounds.clear();
12771
12821
  var bounds = application.graphicService.updateGroupAABBBounds(attribute, groupTheme, this._AABBBounds, this),
12772
12822
  _attribute$boundsPadd = attribute.boundsPadding,
12773
12823
  boundsPadding = _attribute$boundsPadd === void 0 ? groupTheme.boundsPadding : _attribute$boundsPadd,
@@ -12844,8 +12894,9 @@
12844
12894
  }, {
12845
12895
  key: "removeAllChild",
12846
12896
  value: function removeAllChild() {
12897
+ var deep = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
12847
12898
  this.forEachChildren(function (child) {
12848
- application.graphicService.onRemove(child);
12899
+ application.graphicService.onRemove(child), deep && child.isContainer && child.removeAllChild(deep);
12849
12900
  }), _get(_getPrototypeOf(Group.prototype), "removeAllChild", this).call(this), this.addUpdateBoundTag();
12850
12901
  }
12851
12902
  }, {
@@ -13588,7 +13639,7 @@
13588
13639
  key: "doUpdateAABBBounds",
13589
13640
  value: function doUpdateAABBBounds(full) {
13590
13641
  var circleTheme = getTheme(this).circle;
13591
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
13642
+ this._AABBBounds.clear();
13592
13643
  var attribute = this.attribute,
13593
13644
  bounds = application.graphicService.updateCircleAABBBounds(attribute, getTheme(this).circle, this._AABBBounds, full, this),
13594
13645
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -13775,7 +13826,7 @@
13775
13826
  return CanvasTextLayout;
13776
13827
  }();
13777
13828
 
13778
- var TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak", "heightLimit", "lineClamp"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
13829
+ 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));
13779
13830
  var Text = /*#__PURE__*/function (_Graphic) {
13780
13831
  _inherits(Text, _Graphic);
13781
13832
  var _super = _createSuper(Text);
@@ -13816,10 +13867,12 @@
13816
13867
  get: function get() {
13817
13868
  var textTheme = getTheme(this).text,
13818
13869
  attribute = this.attribute;
13819
- if (!this.isSimplify()) return;
13870
+ if (this.isMultiLine) return;
13820
13871
  var _attribute$maxLineWid2 = attribute.maxLineWidth,
13821
13872
  maxLineWidth = _attribute$maxLineWid2 === void 0 ? textTheme.maxLineWidth : _attribute$maxLineWid2;
13822
- return !!Number.isFinite(maxLineWidth) && (this.tryUpdateAABBBounds(), null != this.clipedText && this.clipedText !== attribute.text.toString());
13873
+ return !!Number.isFinite(maxLineWidth) && (this.tryUpdateAABBBounds(), "vertical" === attribute.direction && this.cache.verticalList && this.cache.verticalList[0] ? this.cache.verticalList[0].map(function (item) {
13874
+ return item.text;
13875
+ }).join("") !== attribute.text.toString() : null != this.clipedText && this.clipedText !== attribute.text.toString());
13823
13876
  }
13824
13877
  }, {
13825
13878
  key: "multilineLayout",
@@ -13853,7 +13906,7 @@
13853
13906
  key: "doUpdateAABBBounds",
13854
13907
  value: function doUpdateAABBBounds() {
13855
13908
  var textTheme = getTheme(this).text;
13856
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
13909
+ this._AABBBounds.clear();
13857
13910
  var attribute = this.attribute,
13858
13911
  bounds = application.graphicService.updateTextAABBBounds(attribute, textTheme, this._AABBBounds, this),
13859
13912
  _this$attribute$bound = this.attribute.boundsPadding,
@@ -14509,7 +14562,7 @@
14509
14562
  _createClass(BaseSymbol, [{
14510
14563
  key: "bounds",
14511
14564
  value: function bounds(size, _bounds) {
14512
- if (isNumber$2(size)) {
14565
+ if (isNumber$1(size)) {
14513
14566
  var halfS = size / 2;
14514
14567
  _bounds.x1 = -halfS, _bounds.x2 = halfS, _bounds.y1 = -halfS, _bounds.y2 = halfS;
14515
14568
  } else _bounds.x1 = -size[0] / 2, _bounds.x2 = size[0] / 2, _bounds.y1 = -size[1] / 2, _bounds.y2 = size[1] / 2;
@@ -15196,12 +15249,12 @@
15196
15249
  _createClass(RectSymbol, [{
15197
15250
  key: "draw",
15198
15251
  value: function draw(ctx, size, x, y) {
15199
- return isNumber$2(size) ? rectSize(ctx, size, x, y) : rectSizeArray(ctx, size, x, y);
15252
+ return isNumber$1(size) ? rectSize(ctx, size, x, y) : rectSizeArray(ctx, size, x, y);
15200
15253
  }
15201
15254
  }, {
15202
15255
  key: "drawOffset",
15203
15256
  value: function drawOffset(ctx, size, x, y, offset) {
15204
- return isNumber$2(size) ? rectSize(ctx, size + 2 * offset, x, y) : rectSizeArray(ctx, [size[0] + 2 * offset, size[1] + 2 * offset], x, y);
15257
+ return isNumber$1(size) ? rectSize(ctx, size + 2 * offset, x, y) : rectSizeArray(ctx, [size[0] + 2 * offset, size[1] + 2 * offset], x, y);
15205
15258
  }
15206
15259
  }]);
15207
15260
  return RectSymbol;
@@ -15332,7 +15385,7 @@
15332
15385
  key: "doUpdateAABBBounds",
15333
15386
  value: function doUpdateAABBBounds(full) {
15334
15387
  var symbolTheme = getTheme(this).symbol;
15335
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
15388
+ this._AABBBounds.clear();
15336
15389
  var attribute = this.attribute,
15337
15390
  bounds = application.graphicService.updateSymbolAABBBounds(attribute, getTheme(this).symbol, this._AABBBounds, full, this),
15338
15391
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -15422,7 +15475,7 @@
15422
15475
  key: "doUpdateAABBBounds",
15423
15476
  value: function doUpdateAABBBounds() {
15424
15477
  var lineTheme = getTheme(this).line;
15425
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
15478
+ this._AABBBounds.clear();
15426
15479
  var attribute = this.attribute,
15427
15480
  bounds = application.graphicService.updateLineAABBBounds(attribute, getTheme(this).line, this._AABBBounds, this),
15428
15481
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -15513,7 +15566,7 @@
15513
15566
  key: "doUpdateAABBBounds",
15514
15567
  value: function doUpdateAABBBounds() {
15515
15568
  var rectTheme = getTheme(this).rect;
15516
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
15569
+ this._AABBBounds.clear();
15517
15570
  var attribute = this.attribute,
15518
15571
  bounds = application.graphicService.updateRectAABBBounds(attribute, getTheme(this).rect, this._AABBBounds, this),
15519
15572
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -15544,13 +15597,13 @@
15544
15597
  }, {
15545
15598
  key: "toCustomPath",
15546
15599
  value: function toCustomPath() {
15547
- var attribute = this.attribute;
15548
- var width = isNil$1(attribute.width) ? attribute.x1 - attribute.x : attribute.width,
15549
- height = isNil$1(attribute.height) ? attribute.y1 - attribute.y : attribute.height,
15550
- x = 0,
15551
- y = 0;
15552
- width < 0 && (x = width, width = -width), height < 0 && (y = height, height = -height);
15553
- var path = new CustomPath2D();
15600
+ var attribute = this.attribute,
15601
+ _normalizeRectAttribu = normalizeRectAttributes(attribute),
15602
+ x = _normalizeRectAttribu.x,
15603
+ y = _normalizeRectAttribu.y,
15604
+ width = _normalizeRectAttribu.width,
15605
+ height = _normalizeRectAttribu.height,
15606
+ path = new CustomPath2D();
15554
15607
  return path.moveTo(x, y), path.rect(x, y, width, height), path;
15555
15608
  }
15556
15609
  }, {
@@ -15743,7 +15796,7 @@
15743
15796
  }, {
15744
15797
  key: "doUpdateAABBBounds",
15745
15798
  value: function doUpdateAABBBounds() {
15746
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
15799
+ this._AABBBounds.clear();
15747
15800
  var bounds = application.graphicService.updateGlyphAABBBounds(this.attribute, getTheme(this).glyph, this._AABBBounds, this);
15748
15801
  return this.clearUpdateBoundTag(), bounds;
15749
15802
  }
@@ -15840,16 +15893,7 @@
15840
15893
  deltaY = -height;
15841
15894
  }
15842
15895
  var deltaX = 0;
15843
- switch (this.globalAlign) {
15844
- case "left":
15845
- deltaX = 0;
15846
- break;
15847
- case "center":
15848
- deltaX = -width / 2;
15849
- break;
15850
- case "right":
15851
- deltaX = -width;
15852
- }
15896
+ "right" === this.globalAlign || "end" === this.globalAlign ? deltaX = -width : "center" === this.globalAlign && (deltaX = -width / 2);
15853
15897
  var frameHeight = this[this.directionKey.height];
15854
15898
  this.singleLine && (frameHeight = this.lines[0].height + 1);
15855
15899
  var lastLineTag = !1;
@@ -16002,9 +16046,9 @@
16002
16046
  var direction = this.direction;
16003
16047
  if (this.verticalEllipsis) text = "...", direction = "vertical", baseline -= this.ellipsisWidth / 2;else {
16004
16048
  if ("hide" === this.ellipsis) return;
16005
- if ("add" === this.ellipsis) text += "...", "right" === textAlign && (left -= this.ellipsisWidth);else if ("replace" === this.ellipsis) {
16049
+ if ("add" === this.ellipsis) text += "...", "right" !== textAlign && "end" !== textAlign || (left -= this.ellipsisWidth);else if ("replace" === this.ellipsis) {
16006
16050
  var index = getStrByWithCanvas(text, ("vertical" === direction ? this.height : this.width) - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.character, text.length - 1);
16007
- if (text = text.slice(0, index), text += "...", "right" === textAlign) {
16051
+ if (text = text.slice(0, index), text += "...", "right" === textAlign || "end" === textAlign) {
16008
16052
  var _measureTextCanvas3 = measureTextCanvas(this.text.slice(index), this.character),
16009
16053
  width = _measureTextCanvas3.width;
16010
16054
  "vertical" === direction || (left -= this.ellipsisWidth - width);
@@ -16115,11 +16159,21 @@
16115
16159
  _this3.failCallback && _this3.failCallback();
16116
16160
  });
16117
16161
  }
16162
+ }, {
16163
+ key: "setAttributes",
16164
+ value: function setAttributes(params, forceUpdateTag, context) {
16165
+ return params.image && this.loadImage(params.image), _get(_getPrototypeOf(Image.prototype), "setAttributes", this).call(this, params, forceUpdateTag, context);
16166
+ }
16167
+ }, {
16168
+ key: "setAttribute",
16169
+ value: function setAttribute(key, value, forceUpdateTag, context) {
16170
+ return "image" === key && this.loadImage(value), _get(_getPrototypeOf(Image.prototype), "setAttribute", this).call(this, key, value, forceUpdateTag, context);
16171
+ }
16118
16172
  }, {
16119
16173
  key: "doUpdateAABBBounds",
16120
16174
  value: function doUpdateAABBBounds() {
16121
16175
  var imageTheme = getTheme(this).image;
16122
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
16176
+ this._AABBBounds.clear();
16123
16177
  var attribute = this.attribute,
16124
16178
  bounds = application.graphicService.updateImageAABBBounds(attribute, getTheme(this).image, this._AABBBounds, this),
16125
16179
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -16250,17 +16304,7 @@
16250
16304
  maxHeight = this.height;
16251
16305
  var x = this.left,
16252
16306
  spacing = 0;
16253
- if (this.actualWidth < width && !isWidthMax) switch (this.textAlign) {
16254
- case "right":
16255
- x = width - this.actualWidth;
16256
- break;
16257
- case "center":
16258
- x = (width - this.actualWidth) / 2;
16259
- break;
16260
- case "justify":
16261
- this.paragraphs.length < 2 ? x = (width - this.actualWidth) / 2 : spacing = (width - this.actualWidth) / (this.paragraphs.length - 1);
16262
- }
16263
- this.paragraphs.map(function (paragraph) {
16307
+ this.actualWidth < width && !isWidthMax && ("right" === this.textAlign || "end" === this.textAlign ? x = width - this.actualWidth : "center" === this.textAlign ? x = (width - this.actualWidth) / 2 : "justify" === this.textAlign && (this.paragraphs.length < 2 ? x = (width - this.actualWidth) / 2 : spacing = (width - this.actualWidth) / (this.paragraphs.length - 1))), this.paragraphs.map(function (paragraph) {
16264
16308
  paragraph instanceof RichTextIcon ? (paragraph["_" + directionKey.x] = x, x += paragraph[directionKey.width] + spacing, paragraph["_" + directionKey.y] = "top" === paragraph.attribute.textBaseline ? 0 : "bottom" === paragraph.attribute.textBaseline ? maxHeight - paragraph.height : (maxHeight - paragraph.height) / 2) : (paragraph[directionKey.left] = x, x += paragraph[directionKey.width] + spacing);
16265
16309
  });
16266
16310
  }
@@ -16478,7 +16522,7 @@
16478
16522
  key: "doUpdateAABBBounds",
16479
16523
  value: function doUpdateAABBBounds() {
16480
16524
  var richTextTheme = getTheme(this).richtext;
16481
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
16525
+ this._AABBBounds.clear();
16482
16526
  var attribute = this.attribute,
16483
16527
  bounds = application.graphicService.updateRichTextAABBBounds(attribute, getTheme(this).richtext, this._AABBBounds, this),
16484
16528
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -16541,10 +16585,13 @@
16541
16585
  _this2.addUpdateBoundTag(), null === (_a = _this2.stage) || void 0 === _a || _a.renderNextFrame();
16542
16586
  }, icon.richtextId = config.id, paragraphs.push(icon);
16543
16587
  }
16544
- } else if (textConfig[i].text.includes("\n")) {
16545
- var textParts = textConfig[i].text.split("\n");
16546
- for (var j = 0; j < textParts.length; j++) paragraphs.push(new Paragraph(textParts[j], 0 !== j, textConfig[i]));
16547
- } else paragraphs.push(new Paragraph(textConfig[i].text, !1, textConfig[i]));
16588
+ } else {
16589
+ var richTextConfig = textConfig[i];
16590
+ if (isNumber$1(richTextConfig.text) && (richTextConfig.text = "".concat(richTextConfig.text)), richTextConfig.text && richTextConfig.text.includes("\n")) {
16591
+ var textParts = richTextConfig.text.split("\n");
16592
+ for (var j = 0; j < textParts.length; j++) paragraphs.push(new Paragraph(textParts[j], 0 !== j, richTextConfig));
16593
+ } else richTextConfig.text && paragraphs.push(new Paragraph(richTextConfig.text, !1, richTextConfig));
16594
+ }
16548
16595
  var maxWidthFinite = "number" == typeof maxWidth && Number.isFinite(maxWidth) && maxWidth > 0,
16549
16596
  maxHeightFinite = "number" == typeof maxHeight && Number.isFinite(maxHeight) && maxHeight > 0,
16550
16597
  richTextWidthEnable = "number" == typeof width && Number.isFinite(width) && width > 0 && (!maxWidthFinite || width <= maxWidth),
@@ -16663,7 +16710,7 @@
16663
16710
  key: "doUpdateAABBBounds",
16664
16711
  value: function doUpdateAABBBounds() {
16665
16712
  var pathTheme = getTheme(this).path;
16666
- this.doUpdatePathShape(), this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
16713
+ this.doUpdatePathShape(), this._AABBBounds.clear();
16667
16714
  var attribute = this.attribute,
16668
16715
  bounds = application.graphicService.updatePathAABBBounds(attribute, getTheme(this).path, this._AABBBounds, this),
16669
16716
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -16751,7 +16798,7 @@
16751
16798
  key: "doUpdateAABBBounds",
16752
16799
  value: function doUpdateAABBBounds() {
16753
16800
  var areaTheme = getTheme(this).area;
16754
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
16801
+ this._AABBBounds.clear();
16755
16802
  var attribute = this.attribute,
16756
16803
  bounds = application.graphicService.updateAreaAABBBounds(attribute, getTheme(this).area, this._AABBBounds, this),
16757
16804
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -16869,7 +16916,7 @@
16869
16916
  innerRadius = _this$attribute2$inne === void 0 ? arcTheme.innerRadius : _this$attribute2$inne;
16870
16917
  if (0 === cornerRadius || "0%" === cornerRadius) return 0;
16871
16918
  var deltaRadius = Math.abs(outerRadius - innerRadius);
16872
- return Math.min(isNumber$2(cornerRadius, !0) ? cornerRadius : deltaRadius * parseFloat(cornerRadius) / 100, deltaRadius / 2);
16919
+ return Math.min(isNumber$1(cornerRadius, !0) ? cornerRadius : deltaRadius * parseFloat(cornerRadius) / 100, deltaRadius / 2);
16873
16920
  }
16874
16921
  }, {
16875
16922
  key: "getParsedAngle",
@@ -16954,7 +17001,7 @@
16954
17001
  key: "doUpdateAABBBounds",
16955
17002
  value: function doUpdateAABBBounds(full) {
16956
17003
  var arcTheme = getTheme(this).arc;
16957
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
17004
+ this._AABBBounds.clear();
16958
17005
  var attribute = this.attribute,
16959
17006
  bounds = application.graphicService.updateArcAABBBounds(attribute, getTheme(this).arc, this._AABBBounds, full, this),
16960
17007
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -17040,7 +17087,7 @@
17040
17087
  key: "doUpdateAABBBounds",
17041
17088
  value: function doUpdateAABBBounds() {
17042
17089
  var polygonTheme = getTheme(this).arc;
17043
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
17090
+ this._AABBBounds.clear();
17044
17091
  var attribute = this.attribute,
17045
17092
  bounds = application.graphicService.updateArc3dAABBBounds(attribute, getTheme(this).polygon, this._AABBBounds, this),
17046
17093
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -17088,7 +17135,7 @@
17088
17135
  key: "doUpdateAABBBounds",
17089
17136
  value: function doUpdateAABBBounds() {
17090
17137
  var polygonTheme = getTheme(this).polygon;
17091
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
17138
+ this._AABBBounds.clear();
17092
17139
  var attribute = this.attribute,
17093
17140
  bounds = application.graphicService.updatePolygonAABBBounds(attribute, getTheme(this).polygon, this._AABBBounds, this),
17094
17141
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -17161,7 +17208,7 @@
17161
17208
  key: "doUpdateAABBBounds",
17162
17209
  value: function doUpdateAABBBounds() {
17163
17210
  var polygonTheme = getTheme(this).polygon;
17164
- this._AABBBounds.setValue(1 / 0, 1 / 0, -1 / 0, -1 / 0);
17211
+ this._AABBBounds.clear();
17165
17212
  var attribute = this.attribute,
17166
17213
  bounds = application.graphicService.updatePyramid3dAABBBounds(attribute, getTheme(this).polygon, this._AABBBounds, this),
17167
17214
  _attribute$boundsPadd = attribute.boundsPadding,
@@ -18121,35 +18168,37 @@
18121
18168
  }, {
18122
18169
  key: "transformAABBBounds",
18123
18170
  value: function transformAABBBounds(attribute, aabbBounds, theme, miter, graphic) {
18124
- var _attribute$scaleX2 = attribute.scaleX,
18125
- scaleX = _attribute$scaleX2 === void 0 ? theme.scaleX : _attribute$scaleX2,
18126
- _attribute$scaleY2 = attribute.scaleY,
18127
- scaleY = _attribute$scaleY2 === void 0 ? theme.scaleY : _attribute$scaleY2,
18128
- _attribute$stroke = attribute.stroke,
18129
- stroke = _attribute$stroke === void 0 ? theme.stroke : _attribute$stroke,
18130
- _attribute$shadowBlur2 = attribute.shadowBlur,
18131
- shadowBlur = _attribute$shadowBlur2 === void 0 ? theme.shadowBlur : _attribute$shadowBlur2,
18132
- _attribute$lineWidth = attribute.lineWidth,
18133
- lineWidth = _attribute$lineWidth === void 0 ? theme.lineWidth : _attribute$lineWidth,
18134
- _attribute$pickStroke = attribute.pickStrokeBuffer,
18135
- pickStrokeBuffer = _attribute$pickStroke === void 0 ? theme.pickStrokeBuffer : _attribute$pickStroke,
18136
- _attribute$strokeBoun2 = attribute.strokeBoundsBuffer,
18137
- strokeBoundsBuffer = _attribute$strokeBoun2 === void 0 ? theme.strokeBoundsBuffer : _attribute$strokeBoun2,
18138
- tb1 = this.tempAABBBounds1,
18139
- tb2 = this.tempAABBBounds2;
18140
- if (stroke && lineWidth) {
18141
- var scaledHalfLineWidth = (lineWidth + pickStrokeBuffer) / Math.abs(scaleX + scaleY);
18142
- boundStroke(tb1, scaledHalfLineWidth, miter, strokeBoundsBuffer), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
18171
+ if (!aabbBounds.empty()) {
18172
+ var _attribute$scaleX2 = attribute.scaleX,
18173
+ scaleX = _attribute$scaleX2 === void 0 ? theme.scaleX : _attribute$scaleX2,
18174
+ _attribute$scaleY2 = attribute.scaleY,
18175
+ scaleY = _attribute$scaleY2 === void 0 ? theme.scaleY : _attribute$scaleY2,
18176
+ _attribute$stroke = attribute.stroke,
18177
+ stroke = _attribute$stroke === void 0 ? theme.stroke : _attribute$stroke,
18178
+ _attribute$shadowBlur2 = attribute.shadowBlur,
18179
+ shadowBlur = _attribute$shadowBlur2 === void 0 ? theme.shadowBlur : _attribute$shadowBlur2,
18180
+ _attribute$lineWidth = attribute.lineWidth,
18181
+ lineWidth = _attribute$lineWidth === void 0 ? theme.lineWidth : _attribute$lineWidth,
18182
+ _attribute$pickStroke = attribute.pickStrokeBuffer,
18183
+ pickStrokeBuffer = _attribute$pickStroke === void 0 ? theme.pickStrokeBuffer : _attribute$pickStroke,
18184
+ _attribute$strokeBoun2 = attribute.strokeBoundsBuffer,
18185
+ strokeBoundsBuffer = _attribute$strokeBoun2 === void 0 ? theme.strokeBoundsBuffer : _attribute$strokeBoun2,
18186
+ tb1 = this.tempAABBBounds1,
18187
+ tb2 = this.tempAABBBounds2;
18188
+ if (stroke && lineWidth) {
18189
+ var scaledHalfLineWidth = (lineWidth + pickStrokeBuffer) / Math.abs(scaleX + scaleY);
18190
+ boundStroke(tb1, scaledHalfLineWidth, miter, strokeBoundsBuffer), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
18191
+ }
18192
+ if (shadowBlur) {
18193
+ var _attribute$shadowOffs = attribute.shadowOffsetX,
18194
+ shadowOffsetX = _attribute$shadowOffs === void 0 ? theme.shadowOffsetX : _attribute$shadowOffs,
18195
+ _attribute$shadowOffs2 = attribute.shadowOffsetY,
18196
+ shadowOffsetY = _attribute$shadowOffs2 === void 0 ? theme.shadowOffsetY : _attribute$shadowOffs2,
18197
+ shadowBlurWidth = shadowBlur / Math.abs(scaleX + scaleY) * 2;
18198
+ boundStroke(tb1, shadowBlurWidth, !1, strokeBoundsBuffer + 1), tb1.translate(shadowOffsetX, shadowOffsetY), aabbBounds.union(tb1);
18199
+ }
18143
18200
  }
18144
- if (shadowBlur) {
18145
- var _attribute$shadowOffs = attribute.shadowOffsetX,
18146
- shadowOffsetX = _attribute$shadowOffs === void 0 ? theme.shadowOffsetX : _attribute$shadowOffs,
18147
- _attribute$shadowOffs2 = attribute.shadowOffsetY,
18148
- shadowOffsetY = _attribute$shadowOffs2 === void 0 ? theme.shadowOffsetY : _attribute$shadowOffs2,
18149
- shadowBlurWidth = shadowBlur / Math.abs(scaleX + scaleY) * 2;
18150
- boundStroke(tb1, shadowBlurWidth, !1, strokeBoundsBuffer + 1), tb1.translate(shadowOffsetX, shadowOffsetY), aabbBounds.union(tb1);
18151
- }
18152
- this.combindShadowAABBBounds(aabbBounds, graphic);
18201
+ if (this.combindShadowAABBBounds(aabbBounds, graphic), aabbBounds.empty()) return;
18153
18202
  var updateMatrix = !0;
18154
18203
  var m = graphic.transMatrix;
18155
18204
  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);
@@ -18191,7 +18240,7 @@
18191
18240
 
18192
18241
  var text, richText;
18193
18242
  function getTextBounds(params) {
18194
- return text || (text = graphicCreator.CreateGraphic("text", {})), text.setAttributes(params), text.AABBBounds;
18243
+ return text || (text = graphicCreator.CreateGraphic("text", {})), text.initAttributes(params), text.AABBBounds;
18195
18244
  }
18196
18245
  function getRichTextBounds(params) {
18197
18246
  return richText || (richText = graphicCreator.CreateGraphic("richtext", {})), richText.setAttributes(params), richText.AABBBounds;
@@ -18364,6 +18413,254 @@
18364
18413
  return BaseRender;
18365
18414
  }();
18366
18415
 
18416
+ var parse = function () {
18417
+ var tokens = {
18418
+ linearGradient: /^(linear\-gradient)/i,
18419
+ radialGradient: /^(radial\-gradient)/i,
18420
+ conicGradient: /^(conic\-gradient)/i,
18421
+ sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,
18422
+ extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
18423
+ positionKeywords: /^(left|center|right|top|bottom)/i,
18424
+ pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,
18425
+ percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,
18426
+ emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,
18427
+ angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
18428
+ fromAngleValue: /^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
18429
+ startCall: /^\(/,
18430
+ endCall: /^\)/,
18431
+ comma: /^,/,
18432
+ hexColor: /(^\#[0-9a-fA-F]+)/,
18433
+ literalColor: /^([a-zA-Z]+)/,
18434
+ rgbColor: /^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,
18435
+ rgbaColor: /^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,
18436
+ number: /^(([0-9]*\.[0-9]+)|([0-9]+\.?))/
18437
+ };
18438
+ var input = "";
18439
+ function error(msg) {
18440
+ var err = new Error(input + ": " + msg);
18441
+ throw err.source = input, err;
18442
+ }
18443
+ function getAST() {
18444
+ var ast = matchListing(matchDefinition);
18445
+ return input.length > 0 && error("Invalid input not EOF"), ast;
18446
+ }
18447
+ function matchDefinition() {
18448
+ return matchGradient("linear", tokens.linearGradient, matchLinearOrientation) || matchGradient("radial", tokens.radialGradient, matchListRadialOrientations) || matchGradient("conic", tokens.conicGradient, matchConicalOrientation);
18449
+ }
18450
+ function matchGradient(gradientType, pattern, orientationMatcher) {
18451
+ return function (pattern, callback) {
18452
+ var captures = scan(pattern);
18453
+ if (captures) {
18454
+ scan(tokens.startCall) || error("Missing (");
18455
+ var result = callback(captures);
18456
+ return scan(tokens.endCall) || error("Missing )"), result;
18457
+ }
18458
+ }(pattern, function (captures) {
18459
+ var orientation = orientationMatcher();
18460
+ return orientation && (scan(tokens.comma) || error("Missing comma before color stops")), {
18461
+ type: gradientType,
18462
+ orientation: orientation,
18463
+ colorStops: matchListing(matchColorStop)
18464
+ };
18465
+ });
18466
+ }
18467
+ function matchLinearOrientation() {
18468
+ return match("directional", tokens.sideOrCorner, 1) || match("angular", tokens.angleValue, 1);
18469
+ }
18470
+ function matchConicalOrientation() {
18471
+ return match("angular", tokens.fromAngleValue, 1);
18472
+ }
18473
+ function matchListRadialOrientations() {
18474
+ var radialOrientations,
18475
+ lookaheadCache,
18476
+ radialOrientation = matchRadialOrientation();
18477
+ return radialOrientation && (radialOrientations = [], radialOrientations.push(radialOrientation), lookaheadCache = input, scan(tokens.comma) && (radialOrientation = matchRadialOrientation(), radialOrientation ? radialOrientations.push(radialOrientation) : input = lookaheadCache)), radialOrientations;
18478
+ }
18479
+ function matchRadialOrientation() {
18480
+ var radialType = function () {
18481
+ var circle = match("shape", /^(circle)/i, 0);
18482
+ circle && (circle.style = matchLength() || matchExtentKeyword());
18483
+ return circle;
18484
+ }() || function () {
18485
+ var ellipse = match("shape", /^(ellipse)/i, 0);
18486
+ ellipse && (ellipse.style = matchDistance() || matchExtentKeyword());
18487
+ return ellipse;
18488
+ }();
18489
+ if (radialType) radialType.at = matchAtPosition();else {
18490
+ var extent = matchExtentKeyword();
18491
+ if (extent) {
18492
+ radialType = extent;
18493
+ var positionAt = matchAtPosition();
18494
+ positionAt && (radialType.at = positionAt);
18495
+ } else {
18496
+ var defaultPosition = matchPositioning();
18497
+ defaultPosition && (radialType = {
18498
+ type: "default-radial",
18499
+ at: defaultPosition
18500
+ });
18501
+ }
18502
+ }
18503
+ return radialType;
18504
+ }
18505
+ function matchExtentKeyword() {
18506
+ return match("extent-keyword", tokens.extentKeywords, 1);
18507
+ }
18508
+ function matchAtPosition() {
18509
+ if (match("position", /^at/, 0)) {
18510
+ var positioning = matchPositioning();
18511
+ return positioning || error("Missing positioning value"), positioning;
18512
+ }
18513
+ }
18514
+ function matchPositioning() {
18515
+ var location = {
18516
+ x: matchDistance(),
18517
+ y: matchDistance()
18518
+ };
18519
+ if (location.x || location.y) return {
18520
+ type: "position",
18521
+ value: location
18522
+ };
18523
+ }
18524
+ function matchListing(matcher) {
18525
+ var captures = matcher();
18526
+ var result = [];
18527
+ if (captures) for (result.push(captures); scan(tokens.comma);) captures = matcher(), captures ? result.push(captures) : error("One extra comma");
18528
+ return result;
18529
+ }
18530
+ function matchColorStop() {
18531
+ var color = match("hex", tokens.hexColor, 1) || match("rgba", tokens.rgbaColor, 1) || match("rgb", tokens.rgbColor, 1) || match("literal", tokens.literalColor, 0);
18532
+ return color || error("Expected color definition"), color.length = matchDistance(), color;
18533
+ }
18534
+ function matchDistance() {
18535
+ return match("%", tokens.percentageValue, 1) || match("position-keyword", tokens.positionKeywords, 1) || matchLength();
18536
+ }
18537
+ function matchLength() {
18538
+ return match("px", tokens.pixelValue, 1) || match("em", tokens.emValue, 1);
18539
+ }
18540
+ function match(type, pattern, captureIndex) {
18541
+ var captures = scan(pattern);
18542
+ if (captures) return {
18543
+ type: type,
18544
+ value: captures[captureIndex]
18545
+ };
18546
+ }
18547
+ function scan(regexp) {
18548
+ var blankCaptures = /^[\n\r\t\s]+/.exec(input);
18549
+ blankCaptures && consume(blankCaptures[0].length);
18550
+ var captures = regexp.exec(input);
18551
+ return captures && consume(captures[0].length), captures;
18552
+ }
18553
+ function consume(size) {
18554
+ input = input.substr(size);
18555
+ }
18556
+ return function (code) {
18557
+ return input = code.toString(), getAST();
18558
+ };
18559
+ }();
18560
+ var GradientParser = /*#__PURE__*/function () {
18561
+ function GradientParser() {
18562
+ _classCallCheck(this, GradientParser);
18563
+ }
18564
+ _createClass(GradientParser, null, [{
18565
+ key: "IsGradient",
18566
+ value: function IsGradient(c) {
18567
+ return !("string" == typeof c && c.length < 10);
18568
+ }
18569
+ }, {
18570
+ key: "IsGradientStr",
18571
+ value: function IsGradientStr(c) {
18572
+ return "string" == typeof c && c.length > 10;
18573
+ }
18574
+ }, {
18575
+ key: "Parse",
18576
+ value: function Parse(c) {
18577
+ if (GradientParser.IsGradientStr(c)) try {
18578
+ var datum = parse(c)[0];
18579
+ if (datum) {
18580
+ if ("linear" === datum.type) return GradientParser.ParseLinear(datum);
18581
+ if ("radial" === datum.type) return GradientParser.ParseRadial(datum);
18582
+ if ("conic" === datum.type) return GradientParser.ParseConic(datum);
18583
+ }
18584
+ } catch (err) {
18585
+ return c;
18586
+ }
18587
+ return c;
18588
+ }
18589
+ }, {
18590
+ key: "ParseConic",
18591
+ value: function ParseConic(datum) {
18592
+ var orientation = datum.orientation,
18593
+ _datum$colorStops = datum.colorStops,
18594
+ colorStops = _datum$colorStops === void 0 ? [] : _datum$colorStops,
18595
+ halfPi = pi / 2,
18596
+ sa = parseFloat(orientation.value) / 180 * pi - halfPi;
18597
+ return {
18598
+ gradient: "conical",
18599
+ x: .5,
18600
+ y: .5,
18601
+ startAngle: sa,
18602
+ endAngle: sa + pi2,
18603
+ stops: colorStops.map(function (item) {
18604
+ return {
18605
+ color: item.value,
18606
+ offset: parseFloat(item.length.value) / 100
18607
+ };
18608
+ })
18609
+ };
18610
+ }
18611
+ }, {
18612
+ key: "ParseRadial",
18613
+ value: function ParseRadial(datum) {
18614
+ var _datum$colorStops2 = datum.colorStops,
18615
+ colorStops = _datum$colorStops2 === void 0 ? [] : _datum$colorStops2;
18616
+ return {
18617
+ gradient: "radial",
18618
+ x0: .5,
18619
+ y0: .5,
18620
+ x1: .5,
18621
+ y1: .5,
18622
+ r0: 0,
18623
+ r1: 1,
18624
+ stops: colorStops.map(function (item) {
18625
+ return {
18626
+ color: item.value,
18627
+ offset: parseFloat(item.length.value) / 100
18628
+ };
18629
+ })
18630
+ };
18631
+ }
18632
+ }, {
18633
+ key: "ParseLinear",
18634
+ value: function ParseLinear(datum) {
18635
+ var orientation = datum.orientation,
18636
+ _datum$colorStops3 = datum.colorStops,
18637
+ colorStops = _datum$colorStops3 === void 0 ? [] : _datum$colorStops3,
18638
+ halfPi = pi / 2;
18639
+ var angle = "angular" === orientation.type ? parseFloat(orientation.value) / 180 * pi : 0;
18640
+ for (; angle < 0;) angle += pi2;
18641
+ for (; angle > pi2;) angle -= pi2;
18642
+ var x0 = 0,
18643
+ y0 = 0,
18644
+ x1 = 0,
18645
+ y1 = 0;
18646
+ return angle < halfPi ? (x0 = 0, y0 = 1, x1 = Math.sin(angle), y1 = Math.cos(angle)) : angle < pi ? (x0 = 0, y0 = 0, x1 = Math.cos(angle - halfPi), y1 = Math.sin(angle - halfPi)) : angle < pi + halfPi ? (x0 = 1, y0 = 0, x1 = x0 - Math.sin(angle - pi), y1 = Math.cos(angle - pi)) : (x0 = 1, x1 = x0 - Math.cos(angle - halfPi - pi), y1 -= Math.sin(angle - halfPi - pi)), {
18647
+ gradient: "linear",
18648
+ x0: x0,
18649
+ y0: y0,
18650
+ x1: x1,
18651
+ y1: y1,
18652
+ stops: colorStops.map(function (item) {
18653
+ return {
18654
+ color: item.value,
18655
+ offset: parseFloat(item.length.value) / 100
18656
+ };
18657
+ })
18658
+ };
18659
+ }
18660
+ }]);
18661
+ return GradientParser;
18662
+ }();
18663
+
18367
18664
  function getScaledStroke(context, width, dpr) {
18368
18665
  var strokeWidth = width;
18369
18666
  var _context$currentMatri = context.currentMatrix,
@@ -18379,7 +18676,7 @@
18379
18676
  if (!c || !0 === c) return "black";
18380
18677
  var result, color;
18381
18678
  if (isArray$1(c)) for (var i = 0; i < c.length && (color = c[i], !color); i++);else color = c;
18382
- return "string" == typeof color ? color : ("linear" === color.gradient ? result = createLinearGradient(context, color, params, offsetX, offsetY) : "conical" === color.gradient ? result = createConicGradient(context, color, params, offsetX, offsetY) : "radial" === color.gradient && (result = createRadialGradient(context, color, params, offsetX, offsetY)), result || "orange");
18679
+ return color = GradientParser.Parse(color), "string" == typeof color ? color : ("linear" === color.gradient ? result = createLinearGradient(context, color, params, offsetX, offsetY) : "conical" === color.gradient ? result = createConicGradient(context, color, params, offsetX, offsetY) : "radial" === color.gradient && (result = createRadialGradient(context, color, params, offsetX, offsetY)), result || "orange");
18383
18680
  }
18384
18681
  function createLinearGradient(context, color, params) {
18385
18682
  var offsetX = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
@@ -18480,7 +18777,9 @@
18480
18777
  var _graphic$attribute = graphic.attribute,
18481
18778
  background = _graphic$attribute.background,
18482
18779
  _graphic$attribute$ba = _graphic$attribute.backgroundMode,
18483
- backgroundMode = _graphic$attribute$ba === void 0 ? graphicAttribute.backgroundMode : _graphic$attribute$ba;
18780
+ backgroundMode = _graphic$attribute$ba === void 0 ? graphicAttribute.backgroundMode : _graphic$attribute$ba,
18781
+ _graphic$attribute$ba2 = _graphic$attribute.backgroundFit,
18782
+ backgroundFit = _graphic$attribute$ba2 === void 0 ? graphicAttribute.backgroundFit : _graphic$attribute$ba2;
18484
18783
  if (background) if (graphic.backgroundImg && graphic.resources) {
18485
18784
  var res = graphic.resources.get(background);
18486
18785
  if ("success" !== res.state || !res.data) return;
@@ -18495,15 +18794,37 @@
18495
18794
  }
18496
18795
  context.clip();
18497
18796
  var b = graphic.AABBBounds;
18498
- context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), this.doDrawImage(context, res.data, b, backgroundMode), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
18797
+ context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), this.doDrawImage(context, res.data, b, backgroundMode, backgroundFit), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
18499
18798
  } else context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = background, context.fill(), context.highPerformanceRestore();
18500
18799
  }
18501
18800
  }, {
18502
18801
  key: "doDrawImage",
18503
- value: function doDrawImage(context, data, b, backgroundMode) {
18802
+ value: function doDrawImage(context, data, b, backgroundMode, backgroundFit) {
18504
18803
  if ("no-repeat" === backgroundMode) context.drawImage(data, b.x1, b.y1, b.width(), b.height());else {
18505
- var pattern = context.createPattern(data, backgroundMode);
18506
- context.fillStyle = pattern, context.translate(b.x1, b.y1), context.fillRect(0, 0, b.width(), b.height()), context.translate(-b.x1, -b.y1);
18804
+ var targetW = b.width(),
18805
+ targetH = b.height();
18806
+ var w = targetW,
18807
+ h = targetH;
18808
+ if (backgroundFit && "repeat" !== backgroundMode && (data.width || data.height)) {
18809
+ var resW = data.width,
18810
+ resH = data.height;
18811
+ if ("repeat-x" === backgroundMode) {
18812
+ w = resW * (targetH / resH), h = targetH;
18813
+ } else if ("repeat-y" === backgroundMode) {
18814
+ h = resH * (targetW / resW), w = targetW;
18815
+ }
18816
+ var _dpr = context.dpr,
18817
+ canvas = canvasAllocate.allocate({
18818
+ width: w,
18819
+ height: h,
18820
+ dpr: _dpr
18821
+ }),
18822
+ ctx = canvas.getContext("2d");
18823
+ ctx && (ctx.inuse = !0, ctx.clearMatrix(), ctx.setTransformForCurrent(!0), ctx.clearRect(0, 0, w, h), ctx.drawImage(data, 0, 0, w, h), data = canvas.nativeCanvas), canvasAllocate.free(canvas);
18824
+ }
18825
+ var dpr = context.dpr,
18826
+ pattern = context.createPattern(data, backgroundMode);
18827
+ pattern.setTransform && pattern.setTransform(new DOMMatrix([1 / dpr, 0, 0, 1 / dpr, 0, 0])), context.fillStyle = pattern, context.translate(b.x1, b.y1), context.fillRect(0, 0, targetW, targetH), context.translate(-b.x1, -b.y1);
18507
18828
  }
18508
18829
  }
18509
18830
  }]);
@@ -18526,6 +18847,7 @@
18526
18847
  return DefaultBaseInteractiveRenderContribution;
18527
18848
  }();
18528
18849
  exports.DefaultBaseInteractiveRenderContribution = __decorate$1w([injectable(), __param$O(0, inject(ContributionProvider)), __param$O(0, named(InteractiveSubRenderContribution)), __metadata$19("design:paramtypes", [Object])], exports.DefaultBaseInteractiveRenderContribution);
18850
+
18529
18851
  var DefaultBaseTextureRenderContribution = /*#__PURE__*/function () {
18530
18852
  function DefaultBaseTextureRenderContribution() {
18531
18853
  _classCallCheck(this, DefaultBaseTextureRenderContribution);
@@ -18626,16 +18948,20 @@
18626
18948
  key: "drawShape",
18627
18949
  value: function drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, options) {
18628
18950
  this.textureMap || this.initTextureMap(context, graphic.stage);
18629
- var _graphic$attribute2 = graphic.attribute,
18630
- _graphic$attribute2$t = _graphic$attribute2.texture,
18631
- texture = _graphic$attribute2$t === void 0 ? graphicAttribute.texture : _graphic$attribute2$t,
18632
- _graphic$attribute2$t2 = _graphic$attribute2.textureColor,
18633
- textureColor = _graphic$attribute2$t2 === void 0 ? graphicAttribute.textureColor : _graphic$attribute2$t2,
18634
- _graphic$attribute2$t3 = _graphic$attribute2.textureSize,
18635
- textureSize = _graphic$attribute2$t3 === void 0 ? graphicAttribute.textureSize : _graphic$attribute2$t3,
18636
- _graphic$attribute2$t4 = _graphic$attribute2.texturePadding,
18637
- texturePadding = _graphic$attribute2$t4 === void 0 ? graphicAttribute.texturePadding : _graphic$attribute2$t4;
18638
- if (!texture) return;
18951
+ var _graphic$attribute = graphic.attribute,
18952
+ _graphic$attribute$te = _graphic$attribute.texture,
18953
+ texture = _graphic$attribute$te === void 0 ? graphicAttribute.texture : _graphic$attribute$te,
18954
+ _graphic$attribute$te2 = _graphic$attribute.textureColor,
18955
+ textureColor = _graphic$attribute$te2 === void 0 ? graphicAttribute.textureColor : _graphic$attribute$te2,
18956
+ _graphic$attribute$te3 = _graphic$attribute.textureSize,
18957
+ textureSize = _graphic$attribute$te3 === void 0 ? graphicAttribute.textureSize : _graphic$attribute$te3,
18958
+ _graphic$attribute$te4 = _graphic$attribute.texturePadding,
18959
+ texturePadding = _graphic$attribute$te4 === void 0 ? graphicAttribute.texturePadding : _graphic$attribute$te4;
18960
+ texture && this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);
18961
+ }
18962
+ }, {
18963
+ key: "drawTexture",
18964
+ value: function drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding) {
18639
18965
  var pattern = this.textureMap.get(texture);
18640
18966
  if (!pattern) switch (texture) {
18641
18967
  case "circle":
@@ -18822,13 +19148,15 @@
18822
19148
  var _graphic$attribute = graphic.attribute,
18823
19149
  background = _graphic$attribute.background,
18824
19150
  _graphic$attribute$ba = _graphic$attribute.backgroundMode,
18825
- backgroundMode = _graphic$attribute$ba === void 0 ? graphicAttribute.backgroundMode : _graphic$attribute$ba;
19151
+ backgroundMode = _graphic$attribute$ba === void 0 ? graphicAttribute.backgroundMode : _graphic$attribute$ba,
19152
+ _graphic$attribute$ba2 = _graphic$attribute.backgroundFit,
19153
+ backgroundFit = _graphic$attribute$ba2 === void 0 ? graphicAttribute.backgroundFit : _graphic$attribute$ba2;
18826
19154
  if (background) if (graphic.backgroundImg && graphic.resources) {
18827
19155
  var res = graphic.resources.get(background);
18828
19156
  if ("success" !== res.state || !res.data) return;
18829
19157
  context.highPerformanceSave(), context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0);
18830
19158
  var b = graphic.AABBBounds;
18831
- this.doDrawImage(context, res.data, b, backgroundMode), context.highPerformanceRestore(), context.setTransformForCurrent();
19159
+ this.doDrawImage(context, res.data, b, backgroundMode, backgroundFit), context.highPerformanceRestore(), context.setTransformForCurrent();
18832
19160
  } else context.highPerformanceSave(), context.fillStyle = background, context.fill(), context.highPerformanceRestore();
18833
19161
  }
18834
19162
  }]);
@@ -18839,7 +19167,7 @@
18839
19167
  var halfPi = pi / 2;
18840
19168
  function createRectPath(path, x, y, width, height, rectCornerRadius) {
18841
19169
  var cornerRadius;
18842
- if (width < 0 && (x += width, width = -width), height < 0 && (y += height, height = -height), isNumber$2(rectCornerRadius, !0)) cornerRadius = [rectCornerRadius = abs(rectCornerRadius), rectCornerRadius, rectCornerRadius, rectCornerRadius];else if (Array.isArray(rectCornerRadius)) {
19170
+ if (width < 0 && (x += width, width = -width), height < 0 && (y += height, height = -height), isNumber$1(rectCornerRadius, !0)) cornerRadius = [rectCornerRadius = abs(rectCornerRadius), rectCornerRadius, rectCornerRadius, rectCornerRadius];else if (Array.isArray(rectCornerRadius)) {
18843
19171
  var cornerRadiusArr = rectCornerRadius;
18844
19172
  var cr0, cr1;
18845
19173
  switch (cornerRadiusArr.length) {
@@ -18910,7 +19238,9 @@
18910
19238
  var _graphic$attribute = graphic.attribute,
18911
19239
  background = _graphic$attribute.background,
18912
19240
  _graphic$attribute$ba = _graphic$attribute.backgroundMode,
18913
- backgroundMode = _graphic$attribute$ba === void 0 ? graphicAttribute.backgroundMode : _graphic$attribute$ba;
19241
+ backgroundMode = _graphic$attribute$ba === void 0 ? graphicAttribute.backgroundMode : _graphic$attribute$ba,
19242
+ _graphic$attribute$ba2 = _graphic$attribute.backgroundFit,
19243
+ backgroundFit = _graphic$attribute$ba2 === void 0 ? graphicAttribute.backgroundFit : _graphic$attribute$ba2;
18914
19244
  if (background) if (graphic.backgroundImg) {
18915
19245
  var res = graphic.resources.get(background);
18916
19246
  if ("success" !== res.state || !res.data) return;
@@ -18924,7 +19254,7 @@
18924
19254
  context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.translate(scrollX, scrollY);
18925
19255
  }
18926
19256
  var b = graphic.AABBBounds;
18927
- this.doDrawImage(context, res.data, b, backgroundMode), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
19257
+ this.doDrawImage(context, res.data, b, backgroundMode, backgroundFit), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
18928
19258
  } else if (isObject$1(background)) {
18929
19259
  var stroke = background.stroke,
18930
19260
  fill = background.fill,
@@ -18960,7 +19290,7 @@
18960
19290
  y = bounds.y1,
18961
19291
  width = bounds.width(),
18962
19292
  height = bounds.height();
18963
- return isNumber$2(boundsPadding) ? (x += boundsPadding, y += boundsPadding, width -= 2 * boundsPadding, height -= 2 * boundsPadding) : (x += boundsPadding[3], y += boundsPadding[0], width -= boundsPadding[1] + boundsPadding[3], height -= boundsPadding[0] + boundsPadding[2]), {
19293
+ return isNumber$1(boundsPadding) ? (x += boundsPadding, y += boundsPadding, width -= 2 * boundsPadding, height -= 2 * boundsPadding) : (x += boundsPadding[3], y += boundsPadding[0], width -= boundsPadding[1] + boundsPadding[3], height -= boundsPadding[0] + boundsPadding[2]), {
18964
19294
  x: x,
18965
19295
  y: y,
18966
19296
  width: width,
@@ -19151,6 +19481,37 @@
19151
19481
  var defaultSymbolTextureRenderContribution = defaultBaseTextureRenderContribution;
19152
19482
  var defaultSymbolBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;
19153
19483
 
19484
+ var DefaultAreaTextureRenderContribution = /*#__PURE__*/function (_DefaultBaseTextureRe) {
19485
+ _inherits(DefaultAreaTextureRenderContribution, _DefaultBaseTextureRe);
19486
+ var _super = _createSuper(DefaultAreaTextureRenderContribution);
19487
+ function DefaultAreaTextureRenderContribution() {
19488
+ var _this;
19489
+ _classCallCheck(this, DefaultAreaTextureRenderContribution);
19490
+ _this = _super.apply(this, arguments), _this.time = exports.BaseRenderContributionTime.afterFillStroke;
19491
+ return _this;
19492
+ }
19493
+ _createClass(DefaultAreaTextureRenderContribution, [{
19494
+ key: "drawShape",
19495
+ value: function drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, options) {
19496
+ var _a, _b, _c, _d;
19497
+ this.textureMap || this.initTextureMap(context, graphic.stage);
19498
+ var _ref = options || {},
19499
+ _ref$attribute = _ref.attribute,
19500
+ attribute = _ref$attribute === void 0 ? graphic.attribute : _ref$attribute,
19501
+ _attribute$texture = attribute.texture,
19502
+ texture = _attribute$texture === void 0 ? null !== (_a = graphic.attribute.texture) && void 0 !== _a ? _a : getAttributeFromDefaultAttrList(graphicAttribute, "texture") : _attribute$texture,
19503
+ _attribute$textureCol = attribute.textureColor,
19504
+ textureColor = _attribute$textureCol === void 0 ? null !== (_b = graphic.attribute.textureColor) && void 0 !== _b ? _b : getAttributeFromDefaultAttrList(graphicAttribute, "textureColor") : _attribute$textureCol,
19505
+ _attribute$textureSiz = attribute.textureSize,
19506
+ textureSize = _attribute$textureSiz === void 0 ? null !== (_c = graphic.attribute.textureSize) && void 0 !== _c ? _c : getAttributeFromDefaultAttrList(graphicAttribute, "textureSize") : _attribute$textureSiz,
19507
+ _attribute$texturePad = attribute.texturePadding,
19508
+ texturePadding = _attribute$texturePad === void 0 ? null !== (_d = graphic.attribute.texturePadding) && void 0 !== _d ? _d : getAttributeFromDefaultAttrList(graphicAttribute, "texturePadding") : _attribute$texturePad;
19509
+ texture && this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);
19510
+ }
19511
+ }]);
19512
+ return DefaultAreaTextureRenderContribution;
19513
+ }(DefaultBaseTextureRenderContribution);
19514
+
19154
19515
  var __decorate$1u = undefined && undefined.__decorate || function (decorators, target, key, desc) {
19155
19516
  var d,
19156
19517
  c = arguments.length,
@@ -19391,6 +19752,26 @@
19391
19752
  }(BaseRender);
19392
19753
  exports.DefaultCanvasCircleRender = __decorate$1t([injectable(), __param$M(0, inject(ContributionProvider)), __param$M(0, named(CircleRenderContribution)), __metadata$17("design:paramtypes", [Object])], exports.DefaultCanvasCircleRender);
19393
19754
 
19755
+ function drawSegItem(ctx, curve, endPercent, params) {
19756
+ if (!curve.p1) return;
19757
+ var _ref = params || {},
19758
+ _ref$offsetX = _ref.offsetX,
19759
+ offsetX = _ref$offsetX === void 0 ? 0 : _ref$offsetX,
19760
+ _ref$offsetY = _ref.offsetY,
19761
+ offsetY = _ref$offsetY === void 0 ? 0 : _ref$offsetY,
19762
+ _ref$offsetZ = _ref.offsetZ,
19763
+ offsetZ = _ref$offsetZ === void 0 ? 0 : _ref$offsetZ;
19764
+ if (1 === endPercent) curve.p2 && curve.p3 ? ctx.bezierCurveTo(offsetX + curve.p1.x, offsetY + curve.p1.y, offsetX + curve.p2.x, offsetY + curve.p2.y, offsetX + curve.p3.x, offsetY + curve.p3.y, offsetZ) : ctx.lineTo(offsetX + curve.p1.x, offsetY + curve.p1.y, offsetZ);else if (curve.p2 && curve.p3) {
19765
+ var _divideCubic = divideCubic(curve, endPercent),
19766
+ _divideCubic2 = _slicedToArray(_divideCubic, 1),
19767
+ curve1 = _divideCubic2[0];
19768
+ ctx.bezierCurveTo(offsetX + curve1.p1.x, offsetY + curve1.p1.y, offsetX + curve1.p2.x, offsetY + curve1.p2.y, offsetX + curve1.p3.x, offsetY + curve1.p3.y, offsetZ);
19769
+ } else {
19770
+ var p = curve.getPointAt(endPercent);
19771
+ ctx.lineTo(offsetX + p.x, offsetY + p.y, offsetZ);
19772
+ }
19773
+ }
19774
+
19394
19775
  function drawSegments(path, segPath, percent, clipRangeByDimension, params) {
19395
19776
  var _a;
19396
19777
  var _ref = params || {},
@@ -19433,7 +19814,7 @@
19433
19814
  } else _lastCurve = curve;
19434
19815
  });
19435
19816
  } else curves.forEach(function (curve) {
19436
- curve.defined ? (needMoveTo && path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), drawSegItem$1(path, curve, 1, params), needMoveTo = !1) : needMoveTo = !0;
19817
+ curve.defined ? (needMoveTo && path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), drawSegItem(path, curve, 1, params), needMoveTo = !1) : needMoveTo = !0;
19437
19818
  });
19438
19819
  return;
19439
19820
  }
@@ -19472,7 +19853,7 @@
19472
19853
  needMoveTo = !0;
19473
19854
  continue;
19474
19855
  }
19475
- needMoveTo && path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), drawSegItem$1(path, curve, min(_p, 1), params), needMoveTo = !1;
19856
+ needMoveTo && path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), drawSegItem(path, curve, min(_p, 1), params), needMoveTo = !1;
19476
19857
  }
19477
19858
  }
19478
19859
  }
@@ -19509,25 +19890,6 @@
19509
19890
  path.lineTo(null !== (_c = startP.x1) && void 0 !== _c ? _c : startP.x, null !== (_d = startP.y1) && void 0 !== _d ? _d : startP.y), path.closePath();
19510
19891
  });
19511
19892
  }
19512
- function drawSegItem$1(ctx, curve, endPercent, params) {
19513
- if (!curve.p1) return;
19514
- var _ref4 = params || {},
19515
- _ref4$offsetX = _ref4.offsetX,
19516
- offsetX = _ref4$offsetX === void 0 ? 0 : _ref4$offsetX,
19517
- _ref4$offsetY = _ref4.offsetY,
19518
- offsetY = _ref4$offsetY === void 0 ? 0 : _ref4$offsetY,
19519
- _ref4$offsetZ = _ref4.offsetZ,
19520
- offsetZ = _ref4$offsetZ === void 0 ? 0 : _ref4$offsetZ;
19521
- if (1 === endPercent) curve.p2 && curve.p3 ? ctx.bezierCurveTo(offsetX + curve.p1.x, offsetY + curve.p1.y, offsetX + curve.p2.x, offsetY + curve.p2.y, offsetX + curve.p3.x, offsetY + curve.p3.y, offsetZ) : ctx.lineTo(offsetX + curve.p1.x, offsetY + curve.p1.y, offsetZ);else if (curve.p2 && curve.p3) {
19522
- var _divideCubic = divideCubic(curve, endPercent),
19523
- _divideCubic2 = _slicedToArray(_divideCubic, 1),
19524
- curve1 = _divideCubic2[0];
19525
- ctx.bezierCurveTo(offsetX + curve1.p1.x, offsetY + curve1.p1.y, offsetX + curve1.p2.x, offsetY + curve1.p2.y, offsetX + curve1.p3.x, offsetY + curve1.p3.y, offsetZ);
19526
- } else {
19527
- var p = curve.getPointAt(endPercent);
19528
- ctx.lineTo(offsetX + p.x, offsetY + p.y, offsetZ);
19529
- }
19530
- }
19531
19893
 
19532
19894
  var __decorate$1s = undefined && undefined.__decorate || function (decorators, target, key, desc) {
19533
19895
  var d,
@@ -19835,83 +20197,7 @@
19835
20197
  }
19836
20198
  path.closePath();
19837
20199
  }
19838
- function drawSegItem(ctx, curve, endPercent, params) {
19839
- if (!curve.p1) return;
19840
- var _ref5 = params || {},
19841
- _ref5$offsetX = _ref5.offsetX,
19842
- offsetX = _ref5$offsetX === void 0 ? 0 : _ref5$offsetX,
19843
- _ref5$offsetY = _ref5.offsetY,
19844
- offsetY = _ref5$offsetY === void 0 ? 0 : _ref5$offsetY,
19845
- _ref5$offsetZ = _ref5.offsetZ,
19846
- offsetZ = _ref5$offsetZ === void 0 ? 0 : _ref5$offsetZ;
19847
- if (1 === endPercent) curve.p2 && curve.p3 ? ctx.bezierCurveTo(offsetX + curve.p1.x, offsetY + curve.p1.y, offsetX + curve.p2.x, offsetY + curve.p2.y, offsetX + curve.p3.x, offsetY + curve.p3.y, offsetZ) : ctx.lineTo(offsetX + curve.p1.x, offsetY + curve.p1.y, offsetZ);else if (curve.p2 && curve.p3) {
19848
- var _divideCubic = divideCubic(curve, endPercent),
19849
- _divideCubic2 = _slicedToArray(_divideCubic, 1),
19850
- curve1 = _divideCubic2[0];
19851
- ctx.bezierCurveTo(offsetX + curve1.p1.x, offsetY + curve1.p1.y, offsetX + curve1.p2.x, offsetY + curve1.p2.y, offsetX + curve1.p3.x, offsetY + curve1.p3.y, offsetZ);
19852
- } else {
19853
- var p = curve.getPointAt(endPercent);
19854
- ctx.lineTo(offsetX + p.x, offsetY + p.y, offsetZ);
19855
- }
19856
- }
19857
20200
 
19858
- var DefaultAreaTextureRenderContribution = /*#__PURE__*/function (_DefaultBaseTextureRe) {
19859
- _inherits(DefaultAreaTextureRenderContribution, _DefaultBaseTextureRe);
19860
- var _super = _createSuper(DefaultAreaTextureRenderContribution);
19861
- function DefaultAreaTextureRenderContribution() {
19862
- var _this;
19863
- _classCallCheck(this, DefaultAreaTextureRenderContribution);
19864
- _this = _super.apply(this, arguments), _this.time = exports.BaseRenderContributionTime.afterFillStroke;
19865
- return _this;
19866
- }
19867
- _createClass(DefaultAreaTextureRenderContribution, [{
19868
- key: "drawShape",
19869
- value: function drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, options) {
19870
- var _a, _b, _c, _d;
19871
- this.textureMap || this.initTextureMap(context, graphic.stage);
19872
- var _ref = options || {},
19873
- _ref$attribute = _ref.attribute,
19874
- attribute = _ref$attribute === void 0 ? graphic.attribute : _ref$attribute,
19875
- _attribute$texture = attribute.texture,
19876
- texture = _attribute$texture === void 0 ? null !== (_a = graphic.attribute.texture) && void 0 !== _a ? _a : getAttributeFromDefaultAttrList(graphicAttribute, "texture") : _attribute$texture,
19877
- _attribute$textureCol = attribute.textureColor,
19878
- textureColor = _attribute$textureCol === void 0 ? null !== (_b = graphic.attribute.textureColor) && void 0 !== _b ? _b : getAttributeFromDefaultAttrList(graphicAttribute, "textureColor") : _attribute$textureCol,
19879
- _attribute$textureSiz = attribute.textureSize,
19880
- textureSize = _attribute$textureSiz === void 0 ? null !== (_c = graphic.attribute.textureSize) && void 0 !== _c ? _c : getAttributeFromDefaultAttrList(graphicAttribute, "textureSize") : _attribute$textureSiz,
19881
- _attribute$texturePad = attribute.texturePadding,
19882
- texturePadding = _attribute$texturePad === void 0 ? null !== (_d = graphic.attribute.texturePadding) && void 0 !== _d ? _d : getAttributeFromDefaultAttrList(graphicAttribute, "texturePadding") : _attribute$texturePad;
19883
- if (!texture) return;
19884
- var pattern = this.textureMap.get(texture);
19885
- if (!pattern) switch (texture) {
19886
- case "circle":
19887
- pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
19888
- break;
19889
- case "diamond":
19890
- pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
19891
- break;
19892
- case "rect":
19893
- pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
19894
- break;
19895
- case "vertical-line":
19896
- pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
19897
- break;
19898
- case "horizontal-line":
19899
- pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
19900
- break;
19901
- case "bias-lr":
19902
- pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
19903
- break;
19904
- case "bias-rl":
19905
- pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
19906
- break;
19907
- case "grid":
19908
- pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
19909
- }
19910
- pattern && (context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = pattern, context.fill(), context.highPerformanceRestore());
19911
- }
19912
- }]);
19913
- return DefaultAreaTextureRenderContribution;
19914
- }(DefaultBaseTextureRenderContribution);
19915
20201
  var defaultAreaTextureRenderContribution = new DefaultAreaTextureRenderContribution();
19916
20202
  var defaultAreaBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;
19917
20203
 
@@ -19985,7 +20271,9 @@
19985
20271
  originX = _area$attribute$x === void 0 ? 0 : _area$attribute$x,
19986
20272
  _area$attribute$x2 = _area$attribute.x,
19987
20273
  originY = _area$attribute$x2 === void 0 ? 0 : _area$attribute$x2;
19988
- if (!1 !== fill && (fillCb ? fillCb(context, area.attribute, areaAttribute) : fillOpacity && (context.setCommonStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.fill())), stroke) {
20274
+ if (!1 !== fill && (fillCb ? fillCb(context, area.attribute, areaAttribute) : fillOpacity && (context.setCommonStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.fill())), this.afterRenderStep(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, areaAttribute, drawContext, fillCb, null, {
20275
+ attribute: area.attribute
20276
+ }), stroke) {
19989
20277
  var _area$attribute$strok = area.attribute.stroke,
19990
20278
  _stroke = _area$attribute$strok === void 0 ? areaAttribute && areaAttribute.stroke : _area$attribute$strok;
19991
20279
  if (isArray$1(_stroke) && (_stroke[0] || _stroke[2]) && !1 === _stroke[1]) if (context.beginPath(), _stroke[0]) {
@@ -20002,9 +20290,7 @@
20002
20290
  context.lineTo((null !== (_d = _p3.x1) && void 0 !== _d ? _d : _p3.x) + offsetX, (null !== (_e = _p3.y1) && void 0 !== _e ? _e : _p3.y) + offsetY, z);
20003
20291
  }
20004
20292
  }
20005
- context.setStrokeStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.stroke(), this.afterRenderStep(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, areaAttribute, drawContext, fillCb, null, {
20006
- attribute: area.attribute
20007
- });
20293
+ strokeCb ? strokeCb(context, area.attribute, areaAttribute) : (context.setStrokeStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.stroke());
20008
20294
  }
20009
20295
  }
20010
20296
  }, {
@@ -20429,6 +20715,46 @@
20429
20715
  }(BaseRender);
20430
20716
  exports.DefaultCanvasSymbolRender = __decorate$1o([injectable(), __param$I(0, inject(ContributionProvider)), __param$I(0, named(SymbolRenderContribution)), __metadata$13("design:paramtypes", [Object])], exports.DefaultCanvasSymbolRender);
20431
20717
 
20718
+ var DefaultBoundsAllocate = /*#__PURE__*/function () {
20719
+ function DefaultBoundsAllocate() {
20720
+ _classCallCheck(this, DefaultBoundsAllocate);
20721
+ this.pools = [];
20722
+ for (var i = 0; i < 10; i++) this.pools.push(new AABBBounds());
20723
+ }
20724
+ _createClass(DefaultBoundsAllocate, [{
20725
+ key: "allocate",
20726
+ value: function allocate(x1, y1, x2, y2) {
20727
+ if (!this.pools.length) return new AABBBounds().setValue(x1, y1, x2, y2);
20728
+ var b = this.pools.pop();
20729
+ return b.x1 = x1, b.y1 = y1, b.x2 = x2, b.y2 = y2, b;
20730
+ }
20731
+ }, {
20732
+ key: "allocateByObj",
20733
+ value: function allocateByObj(b) {
20734
+ if (!this.pools.length) return new AABBBounds(b);
20735
+ var _b = this.pools.pop();
20736
+ return _b.x1 = b.x1, _b.y1 = b.y1, _b.x2 = b.x2, _b.y2 = b.y2, _b;
20737
+ }
20738
+ }, {
20739
+ key: "free",
20740
+ value: function free(b) {
20741
+ this.pools.push(b);
20742
+ }
20743
+ }, {
20744
+ key: "length",
20745
+ get: function get() {
20746
+ return this.pools.length;
20747
+ }
20748
+ }, {
20749
+ key: "release",
20750
+ value: function release() {
20751
+ this.pools = [];
20752
+ }
20753
+ }]);
20754
+ return DefaultBoundsAllocate;
20755
+ }();
20756
+ var boundsAllocate = new DefaultBoundsAllocate();
20757
+
20432
20758
  var DefaultTextBackgroundRenderContribution = /*#__PURE__*/function (_DefaultBaseBackgroun) {
20433
20759
  _inherits(DefaultTextBackgroundRenderContribution, _DefaultBaseBackgroun);
20434
20760
  var _super = _createSuper(DefaultTextBackgroundRenderContribution);
@@ -20441,17 +20767,38 @@
20441
20767
  _createClass(DefaultTextBackgroundRenderContribution, [{
20442
20768
  key: "drawShape",
20443
20769
  value: function drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
20770
+ var _a, _c, _d, _e, _f, _g, _h, _j, _k, _l;
20444
20771
  var _graphic$attribute = graphic.attribute,
20445
- background = _graphic$attribute.background,
20446
20772
  _graphic$attribute$ba = _graphic$attribute.backgroundMode,
20447
- backgroundMode = _graphic$attribute$ba === void 0 ? graphicAttribute.backgroundMode : _graphic$attribute$ba;
20773
+ backgroundMode = _graphic$attribute$ba === void 0 ? graphicAttribute.backgroundMode : _graphic$attribute$ba,
20774
+ _graphic$attribute$ba2 = _graphic$attribute.backgroundFit,
20775
+ backgroundFit = _graphic$attribute$ba2 === void 0 ? graphicAttribute.backgroundFit : _graphic$attribute$ba2;
20776
+ var b,
20777
+ background = graphic.attribute.background;
20448
20778
  if (!background) return;
20449
- var b = graphic.AABBBounds;
20779
+ var shouldReCalBounds = isObject$1(background) && background.background,
20780
+ onlyTranslate = graphic.transMatrix.onlyTranslate();
20781
+ if (shouldReCalBounds) {
20782
+ var _b = graphic.AABBBounds,
20783
+ _x = (null !== (_a = background.x) && void 0 !== _a ? _a : _b.x1) + (null !== (_c = background.dx) && void 0 !== _c ? _c : 0),
20784
+ _y = (null !== (_d = background.y) && void 0 !== _d ? _d : _b.y1) + (null !== (_e = background.dy) && void 0 !== _e ? _e : 0),
20785
+ w = null !== (_f = background.width) && void 0 !== _f ? _f : _b.width(),
20786
+ h = null !== (_g = background.height) && void 0 !== _g ? _g : _b.height();
20787
+ if (b = boundsAllocate.allocate(_x, _y, _x + w, _y + h), background = background.background, !onlyTranslate) {
20788
+ var _w = b.width(),
20789
+ _h2 = b.height();
20790
+ b.set((null !== (_h = background.x) && void 0 !== _h ? _h : 0) + (null !== (_j = background.dx) && void 0 !== _j ? _j : 0), (null !== (_k = background.y) && void 0 !== _k ? _k : 0) + (null !== (_l = background.dy) && void 0 !== _l ? _l : 0), _w, _h2);
20791
+ }
20792
+ } else b = graphic.AABBBounds, onlyTranslate || b.set(0, 0, b.width(), b.height());
20450
20793
  if (graphic.backgroundImg && graphic.resources) {
20451
20794
  var res = graphic.resources.get(background);
20452
20795
  if ("success" !== res.state || !res.data) return;
20453
- context.highPerformanceSave(), context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), this.doDrawImage(context, res.data, b, backgroundMode), context.highPerformanceRestore(), context.setTransformForCurrent();
20454
- } else context.highPerformanceSave(), context.fillStyle = background, context.fillRect(b.x1, b.y1, b.width(), b.height()), context.highPerformanceRestore();
20796
+ 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();
20797
+ } else {
20798
+ var backgroundCornerRadius = graphic.attribute.backgroundCornerRadius;
20799
+ 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();
20800
+ }
20801
+ shouldReCalBounds && boundsAllocate.free(b);
20455
20802
  }
20456
20803
  }]);
20457
20804
  return DefaultTextBackgroundRenderContribution;
@@ -20885,7 +21232,9 @@
20885
21232
  value: function draw(image, renderService, drawContext) {
20886
21233
  var url = image.attribute.image;
20887
21234
  if (!url || !image.resources) return;
20888
- if ("success" !== image.resources.get(url).state) return;
21235
+ var res = image.resources.get(url);
21236
+ if ("loading" === res.state && isString$1(url)) return void ResourceLoader.improveImageLoading(url);
21237
+ if ("success" !== res.state) return;
20889
21238
  var context = renderService.drawParams.context;
20890
21239
  if (!context) return;
20891
21240
  var imageAttribute = getTheme(image).image;
@@ -20926,156 +21275,169 @@
20926
21275
  },
20927
21276
  __metadata$$ = undefined && undefined.__metadata || function (k, v) {
20928
21277
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
20929
- },
20930
- __param$E = undefined && undefined.__param || function (paramIndex, decorator) {
20931
- return function (target, key) {
20932
- decorator(target, key, paramIndex);
20933
- };
20934
21278
  };
20935
- var RenderService = Symbol["for"]("RenderService");
20936
- var BeforeRenderConstribution = Symbol["for"]("BeforeRenderConstribution");
20937
- exports.DefaultRenderService = /*#__PURE__*/function () {
20938
- function DefaultRenderService(drawContribution) {
20939
- _classCallCheck(this, DefaultRenderService);
20940
- this.drawContribution = drawContribution;
21279
+ var DrawItemInterceptor = Symbol["for"]("DrawItemInterceptor");
21280
+ var tempDirtyBounds = new AABBBounds();
21281
+ var ShadowRootDrawItemInterceptorContribution = /*#__PURE__*/function () {
21282
+ function ShadowRootDrawItemInterceptorContribution() {
21283
+ _classCallCheck(this, ShadowRootDrawItemInterceptorContribution);
21284
+ this.order = 1;
20941
21285
  }
20942
- _createClass(DefaultRenderService, [{
20943
- key: "prepare",
20944
- value: function prepare(updateBounds) {
20945
- var _this = this;
20946
- updateBounds && this.renderTreeRoots.forEach(function (g) {
20947
- _this._prepare(g, updateBounds);
20948
- });
20949
- }
20950
- }, {
20951
- key: "_prepare",
20952
- value: function _prepare(g, updateBounds) {
20953
- var _this2 = this;
20954
- g.forEachChildren(function (g) {
20955
- _this2._prepare(g, updateBounds);
20956
- }), g.update({
20957
- bounds: updateBounds,
20958
- trans: !0
20959
- });
20960
- }
20961
- }, {
20962
- key: "prepareRenderList",
20963
- value: function prepareRenderList() {}
20964
- }, {
20965
- key: "beforeDraw",
20966
- value: function beforeDraw(params) {}
20967
- }, {
20968
- key: "draw",
20969
- value: function draw(params) {
20970
- this.drawContribution.draw(this, Object.assign({}, this.drawParams));
21286
+ _createClass(ShadowRootDrawItemInterceptorContribution, [{
21287
+ key: "afterDrawItem",
21288
+ value: function afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21289
+ return (graphic.attribute.shadowRootIdx > 0 || !graphic.attribute.shadowRootIdx) && this.drawItem(graphic, renderService, drawContext, drawContribution, params), !1;
20971
21290
  }
20972
21291
  }, {
20973
- key: "afterDraw",
20974
- value: function afterDraw(params) {
20975
- this.drawContribution.afterDraw && this.drawContribution.afterDraw(this, Object.assign({}, this.drawParams));
21292
+ key: "beforeDrawItem",
21293
+ value: function beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21294
+ return graphic.attribute.shadowRootIdx < 0 && this.drawItem(graphic, renderService, drawContext, drawContribution, params), !1;
20976
21295
  }
20977
21296
  }, {
20978
- key: "render",
20979
- value: function render(groups, params) {
20980
- this.renderTreeRoots = groups, this.drawParams = params;
20981
- var updateBounds = params.updateBounds;
20982
- this.prepare(updateBounds), this.prepareRenderList(), this.beforeDraw(params), this.draw(params), this.afterDraw(params);
21297
+ key: "drawItem",
21298
+ value: function drawItem(graphic, renderService, drawContext, drawContribution, params) {
21299
+ if (!graphic.shadowRoot) return !1;
21300
+ var context = drawContext.context;
21301
+ if (context.highPerformanceSave(), context.transformFromMatrix(graphic.transMatrix, !0), drawContribution.dirtyBounds && drawContribution.backupDirtyBounds) {
21302
+ tempDirtyBounds.copy(drawContribution.dirtyBounds);
21303
+ var m = graphic.globalTransMatrix.getInverse();
21304
+ drawContribution.dirtyBounds.copy(drawContribution.backupDirtyBounds).transformWithMatrix(m);
21305
+ }
21306
+ return drawContribution.renderGroup(graphic.shadowRoot, drawContext, graphic.parent.globalTransMatrix), context.highPerformanceRestore(), drawContribution.dirtyBounds && drawContribution.backupDirtyBounds && drawContribution.dirtyBounds.copy(tempDirtyBounds), !0;
20983
21307
  }
20984
21308
  }]);
20985
- return DefaultRenderService;
21309
+ return ShadowRootDrawItemInterceptorContribution;
20986
21310
  }();
20987
- exports.DefaultRenderService = __decorate$1j([injectable(), __param$E(0, inject(DrawContribution)), __metadata$$("design:paramtypes", [Object])], exports.DefaultRenderService);
20988
-
20989
- var renderModule$1 = new ContainerModule(function (bind) {
20990
- bind(RenderService).to(exports.DefaultRenderService).inSingletonScope();
20991
- });
20992
-
20993
- var GraphicPicker = Symbol["for"]("GraphicPicker");
20994
- var PickerService = Symbol["for"]("PickerService");
20995
- var BoundsPicker = Symbol["for"]("BoundsPicker");
20996
- var GlobalPickerService = Symbol["for"]("GlobalPickerService");
20997
-
20998
- var __decorate$1i = undefined && undefined.__decorate || function (decorators, target, key, desc) {
20999
- var d,
21000
- c = arguments.length,
21001
- r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
21002
- if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
21003
- return c > 3 && r && Object.defineProperty(target, key, r), r;
21004
- };
21005
- var PickItemInterceptor = Symbol["for"]("PickItemInterceptor");
21006
- exports.ShadowRootPickItemInterceptorContribution = /*#__PURE__*/function () {
21007
- function ShadowRootPickItemInterceptorContribution() {
21008
- _classCallCheck(this, ShadowRootPickItemInterceptorContribution);
21311
+ var DebugDrawItemInterceptorContribution = /*#__PURE__*/function () {
21312
+ function DebugDrawItemInterceptorContribution() {
21313
+ _classCallCheck(this, DebugDrawItemInterceptorContribution);
21009
21314
  this.order = 1;
21010
21315
  }
21011
- _createClass(ShadowRootPickItemInterceptorContribution, [{
21012
- key: "afterPickItem",
21013
- value: function afterPickItem(graphic, pickerService, point, pickParams, params) {
21014
- return graphic.attribute.shadowRootIdx > 0 || !graphic.attribute.shadowRootIdx ? this._pickItem(graphic, pickerService, point, pickParams, params) : null;
21316
+ _createClass(DebugDrawItemInterceptorContribution, [{
21317
+ key: "afterDrawItem",
21318
+ value: function afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21319
+ return graphic.attribute._debug_bounds && this.drawItem(graphic, renderService, drawContext, drawContribution, params), !1;
21015
21320
  }
21016
21321
  }, {
21017
- key: "beforePickItem",
21018
- value: function beforePickItem(graphic, pickerService, point, pickParams, params) {
21019
- return graphic.attribute.shadowRootIdx < 0 ? this._pickItem(graphic, pickerService, point, pickParams, params) : null;
21322
+ key: "drawItem",
21323
+ value: function drawItem(graphic, renderService, drawContext, drawContribution, params) {
21324
+ if (!graphic.attribute._debug_bounds) return !1;
21325
+ var context = drawContext.context;
21326
+ context.highPerformanceSave(), graphic.parent && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), graphic.glyphHost && graphic.glyphHost.parent && context.setTransformFromMatrix(graphic.glyphHost.parent.globalTransMatrix, !0);
21327
+ var b = graphic.AABBBounds;
21328
+ return !0 !== graphic.attribute._debug_bounds && graphic.attribute._debug_bounds(context, graphic), context.strokeRect(b.x1, b.y1, b.width(), b.height()), context.highPerformanceRestore(), !0;
21329
+ }
21330
+ }]);
21331
+ return DebugDrawItemInterceptorContribution;
21332
+ }();
21333
+ exports.CommonDrawItemInterceptorContribution = /*#__PURE__*/function () {
21334
+ function CommonDrawItemInterceptorContribution() {
21335
+ _classCallCheck(this, CommonDrawItemInterceptorContribution);
21336
+ this.order = 1, this.interceptors = [new ShadowRootDrawItemInterceptorContribution(), new Canvas3DDrawItemInterceptor(), new InteractiveDrawItemInterceptorContribution(), new DebugDrawItemInterceptorContribution()];
21337
+ }
21338
+ _createClass(CommonDrawItemInterceptorContribution, [{
21339
+ key: "afterDrawItem",
21340
+ value: function afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21341
+ for (var i = 0; i < this.interceptors.length; i++) if (this.interceptors[i].afterDrawItem && this.interceptors[i].afterDrawItem(graphic, renderService, drawContext, drawContribution, params)) return !0;
21342
+ return !1;
21020
21343
  }
21021
21344
  }, {
21022
- key: "_pickItem",
21023
- value: function _pickItem(graphic, pickerService, point, pickParams, params) {
21024
- if (!graphic.shadowRoot) return null;
21025
- var _ref = params || {},
21026
- parentMatrix = _ref.parentMatrix;
21027
- if (!parentMatrix) return null;
21028
- var context = pickerService.pickContext;
21029
- context.highPerformanceSave();
21030
- var g = graphic.shadowRoot,
21031
- currentGroupMatrix = matrixAllocate.allocateByObj(parentMatrix),
21032
- newPoint = new Point(currentGroupMatrix.a * point.x + currentGroupMatrix.c * point.y + currentGroupMatrix.e, currentGroupMatrix.b * point.x + currentGroupMatrix.d * point.y + currentGroupMatrix.f),
21033
- result = pickerService.pickGroup(g, newPoint, currentGroupMatrix, pickParams);
21034
- return context.highPerformanceRestore(), result;
21345
+ key: "beforeDrawItem",
21346
+ value: function beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21347
+ if ((!graphic.in3dMode || drawContext.in3dInterceptor) && !graphic.shadowRoot && !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)) return !1;
21348
+ for (var i = 0; i < this.interceptors.length; i++) if (this.interceptors[i].beforeDrawItem && this.interceptors[i].beforeDrawItem(graphic, renderService, drawContext, drawContribution, params)) return !0;
21349
+ return !1;
21035
21350
  }
21036
21351
  }]);
21037
- return ShadowRootPickItemInterceptorContribution;
21352
+ return CommonDrawItemInterceptorContribution;
21038
21353
  }();
21039
- exports.ShadowRootPickItemInterceptorContribution = __decorate$1i([injectable()], exports.ShadowRootPickItemInterceptorContribution);
21040
- exports.InteractivePickItemInterceptorContribution = /*#__PURE__*/function () {
21041
- function InteractivePickItemInterceptorContribution() {
21042
- _classCallCheck(this, InteractivePickItemInterceptorContribution);
21354
+ exports.CommonDrawItemInterceptorContribution = __decorate$1j([injectable(), __metadata$$("design:paramtypes", [])], exports.CommonDrawItemInterceptorContribution);
21355
+ var InteractiveDrawItemInterceptorContribution = /*#__PURE__*/function () {
21356
+ function InteractiveDrawItemInterceptorContribution() {
21357
+ _classCallCheck(this, InteractiveDrawItemInterceptorContribution);
21043
21358
  this.order = 1;
21044
21359
  }
21045
- _createClass(InteractivePickItemInterceptorContribution, [{
21046
- key: "beforePickItem",
21047
- value: function beforePickItem(graphic, pickerService, point, pickParams, params) {
21048
- var originGraphic = graphic.baseGraphic;
21049
- if (originGraphic && originGraphic.parent) {
21050
- var newPoint = new Point(point.x, point.y),
21051
- context = pickerService.pickContext;
21052
- context.highPerformanceSave();
21053
- var parentMatrix = originGraphic.parent.globalTransMatrix;
21054
- parentMatrix.transformPoint(newPoint, newPoint);
21055
- var result = originGraphic.isContainer ? pickerService.pickGroup(originGraphic, newPoint.clone(), parentMatrix, pickParams) : pickerService.pickItem(originGraphic, newPoint.clone(), parentMatrix, pickParams);
21056
- return context.highPerformanceRestore(), result;
21360
+ _createClass(InteractiveDrawItemInterceptorContribution, [{
21361
+ key: "beforeDrawItem",
21362
+ value: function beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21363
+ return !this.processing && (graphic.baseGraphic ? this.beforeDrawInteractive(graphic, renderService, drawContext, drawContribution, params) : this.beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params));
21364
+ }
21365
+ }, {
21366
+ key: "beforeSetInteractive",
21367
+ value: function beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params) {
21368
+ var interactiveGraphic = graphic.interactiveGraphic;
21369
+ if (graphic.attribute.globalZIndex) {
21370
+ interactiveGraphic || (interactiveGraphic = graphic.clone(), graphic.interactiveGraphic = interactiveGraphic, interactiveGraphic.baseGraphic = graphic), interactiveGraphic.setAttributes({
21371
+ globalZIndex: 0,
21372
+ zIndex: graphic.attribute.globalZIndex
21373
+ }, !1, {
21374
+ skipUpdateCallback: !0
21375
+ }), drawContext.stage.tryInitInteractiveLayer();
21376
+ var interactiveLayer = drawContext.stage.getLayer("_builtin_interactive");
21377
+ if (interactiveLayer) {
21378
+ this.getShadowRoot(interactiveLayer).add(interactiveGraphic);
21379
+ }
21380
+ return !0;
21057
21381
  }
21058
- return null;
21382
+ if (interactiveGraphic) {
21383
+ drawContext.stage.tryInitInteractiveLayer();
21384
+ var _interactiveLayer = drawContext.stage.getLayer("_builtin_interactive");
21385
+ if (_interactiveLayer) {
21386
+ this.getShadowRoot(_interactiveLayer).removeChild(interactiveGraphic);
21387
+ }
21388
+ graphic.interactiveGraphic = null, interactiveGraphic.baseGraphic = null;
21389
+ }
21390
+ return !1;
21391
+ }
21392
+ }, {
21393
+ key: "beforeDrawInteractive",
21394
+ value: function beforeDrawInteractive(graphic, renderService, drawContext, drawContribution, params) {
21395
+ var baseGraphic = graphic.baseGraphic;
21396
+ if (baseGraphic) {
21397
+ this.processing = !0;
21398
+ var context = drawContext.context;
21399
+ return context.highPerformanceSave(), context.setTransformFromMatrix(baseGraphic.parent.globalTransMatrix, !0), baseGraphic.isContainer ? drawContribution.renderGroup(baseGraphic, drawContext, baseGraphic.parent.globalTransMatrix) : drawContribution.renderItem(baseGraphic, drawContext), context.highPerformanceRestore(), this.processing = !1, !0;
21400
+ }
21401
+ return !1;
21402
+ }
21403
+ }, {
21404
+ key: "getShadowRoot",
21405
+ value: function getShadowRoot(interactiveLayer) {
21406
+ var _a;
21407
+ var group = interactiveLayer.getElementById("_interactive_group");
21408
+ return group || (group = graphicCreator.CreateGraphic("group", {}), group.id = "_interactive_group", interactiveLayer.add(group)), null !== (_a = group.shadowRoot) && void 0 !== _a ? _a : group.attachShadow();
21059
21409
  }
21060
21410
  }]);
21061
- return InteractivePickItemInterceptorContribution;
21411
+ return InteractiveDrawItemInterceptorContribution;
21062
21412
  }();
21063
- exports.InteractivePickItemInterceptorContribution = __decorate$1i([injectable()], exports.InteractivePickItemInterceptorContribution);
21064
- exports.Canvas3DPickItemInterceptor = /*#__PURE__*/function () {
21065
- function Canvas3DPickItemInterceptor() {
21066
- _classCallCheck(this, Canvas3DPickItemInterceptor);
21413
+ var Canvas3DDrawItemInterceptor = /*#__PURE__*/function () {
21414
+ function Canvas3DDrawItemInterceptor() {
21415
+ _classCallCheck(this, Canvas3DDrawItemInterceptor);
21067
21416
  this.order = 1;
21068
21417
  }
21069
- _createClass(Canvas3DPickItemInterceptor, [{
21070
- key: "beforePickItem",
21071
- value: function beforePickItem(graphic, pickerService, point, pickParams, params) {
21072
- if (!graphic.in3dMode || pickParams.in3dInterceptor) return null;
21073
- var context = pickerService.pickContext,
21074
- stage = graphic.stage;
21075
- if (!context || !stage) return null;
21076
- if (pickParams.in3dInterceptor = !0, context.save(), this.initCanvasCtx(context), context.camera = stage.camera, graphic.isContainer) {
21077
- var result,
21078
- isPie = !1,
21418
+ _createClass(Canvas3DDrawItemInterceptor, [{
21419
+ key: "beforeDrawItem",
21420
+ value: function beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21421
+ if (!graphic.in3dMode || drawContext.in3dInterceptor) return !1;
21422
+ drawContext.in3dInterceptor = !0;
21423
+ var _renderService$drawPa = renderService.drawParams,
21424
+ context = _renderService$drawPa.context,
21425
+ stage = _renderService$drawPa.stage;
21426
+ context.canvas;
21427
+ context.save(), this.initCanvasCtx(context), context.camera = stage.camera;
21428
+ var m = context.currentMatrix;
21429
+ m.a /= context.dpr, m.b /= context.dpr, m.c /= context.dpr, m.d /= context.dpr, m.e /= context.dpr, m.f /= context.dpr;
21430
+ var matrix = mat4Allocate.allocate();
21431
+ mat3Tomat4(matrix, m);
21432
+ var lastModelMatrix = context.modelMatrix;
21433
+ if (lastModelMatrix) {
21434
+ if (matrix) {
21435
+ var _m = mat4Allocate.allocate();
21436
+ context.modelMatrix = multiplyMat4Mat4(_m, lastModelMatrix, matrix);
21437
+ }
21438
+ } else context.modelMatrix = matrix;
21439
+ if (context.setTransform(1, 0, 0, 1, 0, 0, !0), graphic.isContainer) {
21440
+ var isPie = !1,
21079
21441
  is3d = !1;
21080
21442
  if (graphic.forEachChildren(function (c) {
21081
21443
  return isPie = c.numberType === ARC3D_NUMBER_TYPE, !isPie;
@@ -21086,8 +21448,8 @@
21086
21448
  sortedChildren = _toConsumableArray(children);
21087
21449
  sortedChildren.sort(function (a, b) {
21088
21450
  var _a, _b, _c, _d;
21089
- var angle1 = (null !== (_b = null !== (_a = a.attribute.startAngle) && void 0 !== _a ? _a : 0 + a.attribute.endAngle) && void 0 !== _b ? _b : 0) / 2,
21090
- angle2 = (null !== (_d = null !== (_c = b.attribute.startAngle) && void 0 !== _c ? _c : 0 + b.attribute.endAngle) && void 0 !== _d ? _d : 0) / 2;
21451
+ var angle1 = ((null !== (_a = a.attribute.startAngle) && void 0 !== _a ? _a : 0) + (null !== (_b = a.attribute.endAngle) && void 0 !== _b ? _b : 0)) / 2,
21452
+ angle2 = ((null !== (_c = b.attribute.startAngle) && void 0 !== _c ? _c : 0) + (null !== (_d = b.attribute.endAngle) && void 0 !== _d ? _d : 0)) / 2;
21091
21453
  for (; angle1 < 0;) angle1 += pi2;
21092
21454
  for (; angle2 < 0;) angle2 += pi2;
21093
21455
  return angle2 - angle1;
@@ -21095,7 +21457,9 @@
21095
21457
  c._next = null, c._prev = null;
21096
21458
  }), graphic.removeAllChild(), graphic.update(), sortedChildren.forEach(function (c) {
21097
21459
  graphic.appendChild(c);
21098
- }), pickParams.hack_pieFace = "outside", result = pickerService.pickGroup(graphic, point, params.parentMatrix, pickParams), result.graphic || (pickParams.hack_pieFace = "inside", result = pickerService.pickGroup(graphic, point, params.parentMatrix, pickParams)), result.graphic || (pickParams.hack_pieFace = "top", result = pickerService.pickGroup(graphic, point, params.parentMatrix, pickParams)), graphic.removeAllChild(), children.forEach(function (c) {
21460
+ });
21461
+ var _m2 = graphic.parent.globalTransMatrix;
21462
+ drawContext.hack_pieFace = "outside", drawContribution.renderGroup(graphic, drawContext, _m2), drawContext.hack_pieFace = "inside", drawContribution.renderGroup(graphic, drawContext, _m2), drawContext.hack_pieFace = "top", drawContribution.renderGroup(graphic, drawContext, _m2), graphic.removeAllChild(), children.forEach(function (c) {
21099
21463
  c._next = null, c._prev = null;
21100
21464
  }), children.forEach(function (c) {
21101
21465
  graphic.appendChild(c);
@@ -21119,15 +21483,14 @@
21119
21483
  i.g._next = null, i.g._prev = null;
21120
21484
  }), graphic.update(), zChildren.forEach(function (i) {
21121
21485
  graphic.add(i.g);
21122
- }), result = pickerService.pickGroup(graphic, point, params.parentMatrix, pickParams), graphic.removeAllChild(), _children.forEach(function (g) {
21486
+ }), drawContribution.renderGroup(graphic, drawContext, graphic.parent.globalTransMatrix, !0), graphic.removeAllChild(), _children.forEach(function (g) {
21123
21487
  g._next = null, g._prev = null;
21124
21488
  }), graphic.update(), _children.forEach(function (g) {
21125
21489
  graphic.add(g);
21126
21490
  });
21127
- } else result = pickerService.pickGroup(graphic, point, params.parentMatrix, pickParams);
21128
- return context.camera = null, pickParams.in3dInterceptor = !1, context.restore(), result;
21129
- }
21130
- return context.restore(), null;
21491
+ } else drawContribution.renderGroup(graphic, drawContext, graphic.parent.globalTransMatrix);
21492
+ } else drawContribution.renderItem(graphic, drawContext);
21493
+ return context.camera = null, context.restore(), context.modelMatrix !== lastModelMatrix && mat4Allocate.free(context.modelMatrix), context.modelMatrix = lastModelMatrix, drawContext.in3dInterceptor = !1, !0;
21131
21494
  }
21132
21495
  }, {
21133
21496
  key: "initCanvasCtx",
@@ -21135,22 +21498,10 @@
21135
21498
  context.setTransformForCurrent();
21136
21499
  }
21137
21500
  }]);
21138
- return Canvas3DPickItemInterceptor;
21501
+ return Canvas3DDrawItemInterceptor;
21139
21502
  }();
21140
- exports.Canvas3DPickItemInterceptor = __decorate$1i([injectable()], exports.Canvas3DPickItemInterceptor);
21141
-
21142
- var pickModule = new ContainerModule(function (bind, unbind, isBound) {
21143
- isBound(PickerService) || (bind(GlobalPickerService).toSelf(), bind(PickerService).toService(GlobalPickerService)), bind(exports.Canvas3DPickItemInterceptor).toSelf().inSingletonScope(), bind(PickItemInterceptor).toService(exports.Canvas3DPickItemInterceptor), bind(exports.ShadowRootPickItemInterceptorContribution).toSelf().inSingletonScope(), bind(PickItemInterceptor).toService(exports.ShadowRootPickItemInterceptorContribution), bind(exports.InteractivePickItemInterceptorContribution).toSelf().inSingletonScope(), bind(PickItemInterceptor).toService(exports.InteractivePickItemInterceptorContribution), bindContributionProvider(bind, PickItemInterceptor);
21144
- });
21145
-
21146
- var graphicModule = new ContainerModule(function (bind) {
21147
- bind(GraphicService).to(exports.DefaultGraphicService).inSingletonScope(), bind(GraphicCreator$1).toConstantValue(graphicCreator);
21148
- });
21149
21503
 
21150
- var AutoEnablePlugins = Symbol["for"]("AutoEnablePlugins");
21151
- var PluginService = Symbol["for"]("PluginService");
21152
-
21153
- var __decorate$1h = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21504
+ var __decorate$1i = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21154
21505
  var d,
21155
21506
  c = arguments.length,
21156
21507
  r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
@@ -21160,92 +21511,325 @@
21160
21511
  __metadata$_ = undefined && undefined.__metadata || function (k, v) {
21161
21512
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
21162
21513
  },
21163
- __param$D = undefined && undefined.__param || function (paramIndex, decorator) {
21514
+ __param$E = undefined && undefined.__param || function (paramIndex, decorator) {
21164
21515
  return function (target, key) {
21165
21516
  decorator(target, key, paramIndex);
21166
21517
  };
21167
21518
  };
21168
- var DefaultPluginService = /*#__PURE__*/function () {
21169
- function DefaultPluginService(autoEnablePlugins) {
21170
- _classCallCheck(this, DefaultPluginService);
21171
- this.autoEnablePlugins = autoEnablePlugins, this.onStartupFinishedPlugin = [], this.onRegisterPlugin = [], this.actived = !1;
21519
+ var RenderService = Symbol["for"]("RenderService");
21520
+ var BeforeRenderConstribution = Symbol["for"]("BeforeRenderConstribution");
21521
+ exports.DefaultRenderService = /*#__PURE__*/function () {
21522
+ function DefaultRenderService(drawContribution) {
21523
+ _classCallCheck(this, DefaultRenderService);
21524
+ this.drawContribution = drawContribution;
21172
21525
  }
21173
- _createClass(DefaultPluginService, [{
21174
- key: "active",
21175
- value: function active(stage, params) {
21526
+ _createClass(DefaultRenderService, [{
21527
+ key: "prepare",
21528
+ value: function prepare(updateBounds) {
21176
21529
  var _this = this;
21177
- this.stage = stage, this.actived = !0;
21178
- var pluginList = params.pluginList;
21179
- pluginList && container.isBound(AutoEnablePlugins) && this.autoEnablePlugins.getContributions().forEach(function (p) {
21180
- pluginList.includes(p.name) && _this.register(p);
21530
+ updateBounds && this.renderTreeRoots.forEach(function (g) {
21531
+ _this._prepare(g, updateBounds);
21181
21532
  });
21182
21533
  }
21183
21534
  }, {
21184
- key: "findPluginsByName",
21185
- value: function findPluginsByName(name) {
21186
- var arr = [];
21187
- return this.onStartupFinishedPlugin.forEach(function (plugin) {
21188
- plugin.name === name && arr.push(plugin);
21189
- }), this.onRegisterPlugin.forEach(function (plugin) {
21190
- plugin.name === name && arr.push(plugin);
21191
- }), arr;
21535
+ key: "_prepare",
21536
+ value: function _prepare(g, updateBounds) {
21537
+ var _this2 = this;
21538
+ g.forEachChildren(function (g) {
21539
+ _this2._prepare(g, updateBounds);
21540
+ }), g.update({
21541
+ bounds: updateBounds,
21542
+ trans: !0
21543
+ });
21192
21544
  }
21193
21545
  }, {
21194
- key: "register",
21195
- value: function register(plugin) {
21196
- "onStartupFinished" === plugin.activeEvent ? this.onStartupFinishedPlugin.push(plugin) : "onRegister" === plugin.activeEvent && (this.onRegisterPlugin.push(plugin), plugin.activate(this));
21546
+ key: "prepareRenderList",
21547
+ value: function prepareRenderList() {}
21548
+ }, {
21549
+ key: "beforeDraw",
21550
+ value: function beforeDraw(params) {}
21551
+ }, {
21552
+ key: "draw",
21553
+ value: function draw(params) {
21554
+ this.drawContribution.draw(this, Object.assign({}, this.drawParams));
21197
21555
  }
21198
21556
  }, {
21199
- key: "unRegister",
21200
- value: function unRegister(plugin) {
21201
- "onStartupFinished" === plugin.activeEvent ? this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(plugin), 1) : "onRegister" === plugin.activeEvent && this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(plugin), 1), plugin.deactivate(this);
21557
+ key: "afterDraw",
21558
+ value: function afterDraw(params) {
21559
+ this.drawContribution.afterDraw && this.drawContribution.afterDraw(this, Object.assign({}, this.drawParams));
21202
21560
  }
21203
21561
  }, {
21204
- key: "release",
21205
- value: function release() {
21206
- var _this2 = this;
21207
- this.onStartupFinishedPlugin.forEach(function (plugin) {
21208
- plugin.deactivate(_this2);
21209
- }), this.onStartupFinishedPlugin = [], this.onRegisterPlugin.forEach(function (plugin) {
21210
- plugin.deactivate(_this2);
21211
- }), this.onRegisterPlugin = [];
21562
+ key: "render",
21563
+ value: function render(groups, params) {
21564
+ this.renderTreeRoots = groups, this.drawParams = params;
21565
+ var updateBounds = params.updateBounds;
21566
+ this.prepare(updateBounds), this.prepareRenderList(), this.beforeDraw(params), this.draw(params), this.afterDraw(params);
21212
21567
  }
21213
21568
  }]);
21214
- return DefaultPluginService;
21569
+ return DefaultRenderService;
21215
21570
  }();
21216
- DefaultPluginService = __decorate$1h([injectable(), __param$D(0, inject(ContributionProvider)), __param$D(0, named(AutoEnablePlugins)), __metadata$_("design:paramtypes", [Object])], DefaultPluginService);
21217
-
21218
- var pluginModule = new ContainerModule(function (bind) {
21219
- bind(PluginService).to(DefaultPluginService), bindContributionProviderNoSingletonScope(bind, AutoEnablePlugins);
21220
- });
21571
+ exports.DefaultRenderService = __decorate$1i([injectable(), __param$E(0, inject(DrawContribution)), __metadata$_("design:paramtypes", [Object])], exports.DefaultRenderService);
21221
21572
 
21222
- var envModules = new ContainerModule(function (bind) {
21223
- bindContributionProvider(bind, EnvContribution);
21573
+ var renderModule$1 = new ContainerModule(function (bind) {
21574
+ bind(RenderService).to(exports.DefaultRenderService).inSingletonScope();
21224
21575
  });
21225
21576
 
21226
- var textMeasureModules = new ContainerModule(function (bind) {
21227
- bind(TextMeasureContribution).to(exports.DefaultTextMeasureContribution).inSingletonScope(), bindContributionProvider(bind, TextMeasureContribution);
21228
- });
21577
+ var GraphicPicker = Symbol["for"]("GraphicPicker");
21578
+ var PickerService = Symbol["for"]("PickerService");
21579
+ var BoundsPicker = Symbol["for"]("BoundsPicker");
21580
+ var GlobalPickerService = Symbol["for"]("GlobalPickerService");
21229
21581
 
21230
- var __decorate$1g = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21231
- var d,
21232
- c = arguments.length,
21233
- r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
21234
- if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
21235
- return c > 3 && r && Object.defineProperty(target, key, r), r;
21236
- },
21237
- __metadata$Z = undefined && undefined.__metadata || function (k, v) {
21238
- if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
21239
- };
21240
- var CanvasLayerHandlerContribution = /*#__PURE__*/function () {
21241
- function CanvasLayerHandlerContribution() {
21242
- _classCallCheck(this, CanvasLayerHandlerContribution);
21243
- this.type = "static", this.offscreen = !1, this.global = application.global;
21582
+ var __decorate$1h = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21583
+ var d,
21584
+ c = arguments.length,
21585
+ r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
21586
+ if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
21587
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
21588
+ };
21589
+ var PickItemInterceptor = Symbol["for"]("PickItemInterceptor");
21590
+ exports.ShadowRootPickItemInterceptorContribution = /*#__PURE__*/function () {
21591
+ function ShadowRootPickItemInterceptorContribution() {
21592
+ _classCallCheck(this, ShadowRootPickItemInterceptorContribution);
21593
+ this.order = 1;
21244
21594
  }
21245
- _createClass(CanvasLayerHandlerContribution, [{
21246
- key: "setDpr",
21247
- value: function setDpr(dpr) {
21248
- this.canvas.dpr = dpr;
21595
+ _createClass(ShadowRootPickItemInterceptorContribution, [{
21596
+ key: "afterPickItem",
21597
+ value: function afterPickItem(graphic, pickerService, point, pickParams, params) {
21598
+ return graphic.attribute.shadowRootIdx > 0 || !graphic.attribute.shadowRootIdx ? this._pickItem(graphic, pickerService, point, pickParams, params) : null;
21599
+ }
21600
+ }, {
21601
+ key: "beforePickItem",
21602
+ value: function beforePickItem(graphic, pickerService, point, pickParams, params) {
21603
+ return graphic.attribute.shadowRootIdx < 0 ? this._pickItem(graphic, pickerService, point, pickParams, params) : null;
21604
+ }
21605
+ }, {
21606
+ key: "_pickItem",
21607
+ value: function _pickItem(graphic, pickerService, point, pickParams, params) {
21608
+ if (!graphic.shadowRoot) return null;
21609
+ var _ref = params || {},
21610
+ parentMatrix = _ref.parentMatrix;
21611
+ if (!parentMatrix) return null;
21612
+ var context = pickerService.pickContext;
21613
+ context.highPerformanceSave();
21614
+ var g = graphic.shadowRoot,
21615
+ currentGroupMatrix = matrixAllocate.allocateByObj(parentMatrix),
21616
+ newPoint = new Point(currentGroupMatrix.a * point.x + currentGroupMatrix.c * point.y + currentGroupMatrix.e, currentGroupMatrix.b * point.x + currentGroupMatrix.d * point.y + currentGroupMatrix.f),
21617
+ result = pickerService.pickGroup(g, newPoint, currentGroupMatrix, pickParams);
21618
+ return context.highPerformanceRestore(), result;
21619
+ }
21620
+ }]);
21621
+ return ShadowRootPickItemInterceptorContribution;
21622
+ }();
21623
+ exports.ShadowRootPickItemInterceptorContribution = __decorate$1h([injectable()], exports.ShadowRootPickItemInterceptorContribution);
21624
+ exports.InteractivePickItemInterceptorContribution = /*#__PURE__*/function () {
21625
+ function InteractivePickItemInterceptorContribution() {
21626
+ _classCallCheck(this, InteractivePickItemInterceptorContribution);
21627
+ this.order = 1;
21628
+ }
21629
+ _createClass(InteractivePickItemInterceptorContribution, [{
21630
+ key: "beforePickItem",
21631
+ value: function beforePickItem(graphic, pickerService, point, pickParams, params) {
21632
+ var originGraphic = graphic.baseGraphic;
21633
+ if (originGraphic && originGraphic.parent) {
21634
+ var newPoint = new Point(point.x, point.y),
21635
+ context = pickerService.pickContext;
21636
+ context.highPerformanceSave();
21637
+ var parentMatrix = originGraphic.parent.globalTransMatrix;
21638
+ parentMatrix.transformPoint(newPoint, newPoint);
21639
+ var result = originGraphic.isContainer ? pickerService.pickGroup(originGraphic, newPoint.clone(), parentMatrix, pickParams) : pickerService.pickItem(originGraphic, newPoint.clone(), parentMatrix, pickParams);
21640
+ return context.highPerformanceRestore(), result;
21641
+ }
21642
+ return null;
21643
+ }
21644
+ }]);
21645
+ return InteractivePickItemInterceptorContribution;
21646
+ }();
21647
+ exports.InteractivePickItemInterceptorContribution = __decorate$1h([injectable()], exports.InteractivePickItemInterceptorContribution);
21648
+ exports.Canvas3DPickItemInterceptor = /*#__PURE__*/function () {
21649
+ function Canvas3DPickItemInterceptor() {
21650
+ _classCallCheck(this, Canvas3DPickItemInterceptor);
21651
+ this.order = 1;
21652
+ }
21653
+ _createClass(Canvas3DPickItemInterceptor, [{
21654
+ key: "beforePickItem",
21655
+ value: function beforePickItem(graphic, pickerService, point, pickParams, params) {
21656
+ if (!graphic.in3dMode || pickParams.in3dInterceptor) return null;
21657
+ var context = pickerService.pickContext,
21658
+ stage = graphic.stage;
21659
+ if (!context || !stage) return null;
21660
+ if (pickParams.in3dInterceptor = !0, context.save(), this.initCanvasCtx(context), context.camera = stage.camera, graphic.isContainer) {
21661
+ var result,
21662
+ isPie = !1,
21663
+ is3d = !1;
21664
+ if (graphic.forEachChildren(function (c) {
21665
+ return isPie = c.numberType === ARC3D_NUMBER_TYPE, !isPie;
21666
+ }), graphic.forEachChildren(function (c) {
21667
+ return is3d = !!c.findFace, !is3d;
21668
+ }), isPie) {
21669
+ var children = graphic.getChildren(),
21670
+ sortedChildren = _toConsumableArray(children);
21671
+ sortedChildren.sort(function (a, b) {
21672
+ var _a, _b, _c, _d;
21673
+ var angle1 = (null !== (_b = null !== (_a = a.attribute.startAngle) && void 0 !== _a ? _a : 0 + a.attribute.endAngle) && void 0 !== _b ? _b : 0) / 2,
21674
+ angle2 = (null !== (_d = null !== (_c = b.attribute.startAngle) && void 0 !== _c ? _c : 0 + b.attribute.endAngle) && void 0 !== _d ? _d : 0) / 2;
21675
+ for (; angle1 < 0;) angle1 += pi2;
21676
+ for (; angle2 < 0;) angle2 += pi2;
21677
+ return angle2 - angle1;
21678
+ }), sortedChildren.forEach(function (c) {
21679
+ c._next = null, c._prev = null;
21680
+ }), graphic.removeAllChild(), graphic.update(), sortedChildren.forEach(function (c) {
21681
+ graphic.appendChild(c);
21682
+ }), pickParams.hack_pieFace = "outside", result = pickerService.pickGroup(graphic, point, params.parentMatrix, pickParams), result.graphic || (pickParams.hack_pieFace = "inside", result = pickerService.pickGroup(graphic, point, params.parentMatrix, pickParams)), result.graphic || (pickParams.hack_pieFace = "top", result = pickerService.pickGroup(graphic, point, params.parentMatrix, pickParams)), graphic.removeAllChild(), children.forEach(function (c) {
21683
+ c._next = null, c._prev = null;
21684
+ }), children.forEach(function (c) {
21685
+ graphic.appendChild(c);
21686
+ });
21687
+ } else if (is3d) {
21688
+ var _children = graphic.getChildren(),
21689
+ zChildren = _children.map(function (g) {
21690
+ return {
21691
+ ave_z: g.findFace().vertices.map(function (v) {
21692
+ var _a;
21693
+ return context.view(v[0], v[1], null !== (_a = v[2] + g.attribute.z) && void 0 !== _a ? _a : 0)[2];
21694
+ }).reduce(function (a, b) {
21695
+ return a + b;
21696
+ }, 0),
21697
+ g: g
21698
+ };
21699
+ });
21700
+ zChildren.sort(function (a, b) {
21701
+ return b.ave_z - a.ave_z;
21702
+ }), graphic.removeAllChild(), zChildren.forEach(function (i) {
21703
+ i.g._next = null, i.g._prev = null;
21704
+ }), graphic.update(), zChildren.forEach(function (i) {
21705
+ graphic.add(i.g);
21706
+ }), result = pickerService.pickGroup(graphic, point, params.parentMatrix, pickParams), graphic.removeAllChild(), _children.forEach(function (g) {
21707
+ g._next = null, g._prev = null;
21708
+ }), graphic.update(), _children.forEach(function (g) {
21709
+ graphic.add(g);
21710
+ });
21711
+ } else result = pickerService.pickGroup(graphic, point, params.parentMatrix, pickParams);
21712
+ return context.camera = null, pickParams.in3dInterceptor = !1, context.restore(), result;
21713
+ }
21714
+ return context.restore(), null;
21715
+ }
21716
+ }, {
21717
+ key: "initCanvasCtx",
21718
+ value: function initCanvasCtx(context) {
21719
+ context.setTransformForCurrent();
21720
+ }
21721
+ }]);
21722
+ return Canvas3DPickItemInterceptor;
21723
+ }();
21724
+ exports.Canvas3DPickItemInterceptor = __decorate$1h([injectable()], exports.Canvas3DPickItemInterceptor);
21725
+
21726
+ var pickModule = new ContainerModule(function (bind, unbind, isBound) {
21727
+ isBound(PickerService) || (bind(GlobalPickerService).toSelf(), bind(PickerService).toService(GlobalPickerService)), bind(exports.Canvas3DPickItemInterceptor).toSelf().inSingletonScope(), bind(PickItemInterceptor).toService(exports.Canvas3DPickItemInterceptor), bind(exports.ShadowRootPickItemInterceptorContribution).toSelf().inSingletonScope(), bind(PickItemInterceptor).toService(exports.ShadowRootPickItemInterceptorContribution), bind(exports.InteractivePickItemInterceptorContribution).toSelf().inSingletonScope(), bind(PickItemInterceptor).toService(exports.InteractivePickItemInterceptorContribution), bindContributionProvider(bind, PickItemInterceptor);
21728
+ });
21729
+
21730
+ var graphicModule = new ContainerModule(function (bind) {
21731
+ bind(GraphicService).to(exports.DefaultGraphicService).inSingletonScope(), bind(GraphicCreator$1).toConstantValue(graphicCreator);
21732
+ });
21733
+
21734
+ var AutoEnablePlugins = Symbol["for"]("AutoEnablePlugins");
21735
+ var PluginService = Symbol["for"]("PluginService");
21736
+
21737
+ var __decorate$1g = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21738
+ var d,
21739
+ c = arguments.length,
21740
+ r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
21741
+ if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
21742
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
21743
+ },
21744
+ __metadata$Z = undefined && undefined.__metadata || function (k, v) {
21745
+ if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
21746
+ },
21747
+ __param$D = undefined && undefined.__param || function (paramIndex, decorator) {
21748
+ return function (target, key) {
21749
+ decorator(target, key, paramIndex);
21750
+ };
21751
+ };
21752
+ var DefaultPluginService = /*#__PURE__*/function () {
21753
+ function DefaultPluginService(autoEnablePlugins) {
21754
+ _classCallCheck(this, DefaultPluginService);
21755
+ this.autoEnablePlugins = autoEnablePlugins, this.onStartupFinishedPlugin = [], this.onRegisterPlugin = [], this.actived = !1;
21756
+ }
21757
+ _createClass(DefaultPluginService, [{
21758
+ key: "active",
21759
+ value: function active(stage, params) {
21760
+ var _this = this;
21761
+ this.stage = stage, this.actived = !0;
21762
+ var pluginList = params.pluginList;
21763
+ pluginList && container.isBound(AutoEnablePlugins) && this.autoEnablePlugins.getContributions().forEach(function (p) {
21764
+ pluginList.includes(p.name) && _this.register(p);
21765
+ });
21766
+ }
21767
+ }, {
21768
+ key: "findPluginsByName",
21769
+ value: function findPluginsByName(name) {
21770
+ var arr = [];
21771
+ return this.onStartupFinishedPlugin.forEach(function (plugin) {
21772
+ plugin.name === name && arr.push(plugin);
21773
+ }), this.onRegisterPlugin.forEach(function (plugin) {
21774
+ plugin.name === name && arr.push(plugin);
21775
+ }), arr;
21776
+ }
21777
+ }, {
21778
+ key: "register",
21779
+ value: function register(plugin) {
21780
+ "onStartupFinished" === plugin.activeEvent ? this.onStartupFinishedPlugin.push(plugin) : "onRegister" === plugin.activeEvent && (this.onRegisterPlugin.push(plugin), plugin.activate(this));
21781
+ }
21782
+ }, {
21783
+ key: "unRegister",
21784
+ value: function unRegister(plugin) {
21785
+ "onStartupFinished" === plugin.activeEvent ? this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(plugin), 1) : "onRegister" === plugin.activeEvent && this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(plugin), 1), plugin.deactivate(this);
21786
+ }
21787
+ }, {
21788
+ key: "release",
21789
+ value: function release() {
21790
+ var _this2 = this;
21791
+ this.onStartupFinishedPlugin.forEach(function (plugin) {
21792
+ plugin.deactivate(_this2);
21793
+ }), this.onStartupFinishedPlugin = [], this.onRegisterPlugin.forEach(function (plugin) {
21794
+ plugin.deactivate(_this2);
21795
+ }), this.onRegisterPlugin = [];
21796
+ }
21797
+ }]);
21798
+ return DefaultPluginService;
21799
+ }();
21800
+ DefaultPluginService = __decorate$1g([injectable(), __param$D(0, inject(ContributionProvider)), __param$D(0, named(AutoEnablePlugins)), __metadata$Z("design:paramtypes", [Object])], DefaultPluginService);
21801
+
21802
+ var pluginModule = new ContainerModule(function (bind) {
21803
+ bind(PluginService).to(DefaultPluginService), bindContributionProviderNoSingletonScope(bind, AutoEnablePlugins);
21804
+ });
21805
+
21806
+ var envModules = new ContainerModule(function (bind) {
21807
+ bindContributionProvider(bind, EnvContribution);
21808
+ });
21809
+
21810
+ var textMeasureModules = new ContainerModule(function (bind) {
21811
+ bind(TextMeasureContribution).to(exports.DefaultTextMeasureContribution).inSingletonScope(), bindContributionProvider(bind, TextMeasureContribution);
21812
+ });
21813
+
21814
+ var __decorate$1f = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21815
+ var d,
21816
+ c = arguments.length,
21817
+ r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
21818
+ if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
21819
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
21820
+ },
21821
+ __metadata$Y = undefined && undefined.__metadata || function (k, v) {
21822
+ if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
21823
+ };
21824
+ var CanvasLayerHandlerContribution = /*#__PURE__*/function () {
21825
+ function CanvasLayerHandlerContribution() {
21826
+ _classCallCheck(this, CanvasLayerHandlerContribution);
21827
+ this.type = "static", this.offscreen = !1, this.global = application.global;
21828
+ }
21829
+ _createClass(CanvasLayerHandlerContribution, [{
21830
+ key: "setDpr",
21831
+ value: function setDpr(dpr) {
21832
+ this.canvas.dpr = dpr;
21249
21833
  }
21250
21834
  }, {
21251
21835
  key: "init",
@@ -21328,16 +21912,16 @@
21328
21912
  }]);
21329
21913
  return CanvasLayerHandlerContribution;
21330
21914
  }();
21331
- CanvasLayerHandlerContribution = __decorate$1g([injectable(), __metadata$Z("design:paramtypes", [])], CanvasLayerHandlerContribution);
21915
+ CanvasLayerHandlerContribution = __decorate$1f([injectable(), __metadata$Y("design:paramtypes", [])], CanvasLayerHandlerContribution);
21332
21916
 
21333
- var __decorate$1f = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21917
+ var __decorate$1e = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21334
21918
  var d,
21335
21919
  c = arguments.length,
21336
21920
  r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
21337
21921
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
21338
21922
  return c > 3 && r && Object.defineProperty(target, key, r), r;
21339
21923
  },
21340
- __metadata$Y = undefined && undefined.__metadata || function (k, v) {
21924
+ __metadata$X = undefined && undefined.__metadata || function (k, v) {
21341
21925
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
21342
21926
  };
21343
21927
  var EmptyLayerHandlerContribution = /*#__PURE__*/function () {
@@ -21395,16 +21979,16 @@
21395
21979
  }]);
21396
21980
  return EmptyLayerHandlerContribution;
21397
21981
  }();
21398
- EmptyLayerHandlerContribution = __decorate$1f([injectable(), __metadata$Y("design:paramtypes", [])], EmptyLayerHandlerContribution);
21982
+ EmptyLayerHandlerContribution = __decorate$1e([injectable(), __metadata$X("design:paramtypes", [])], EmptyLayerHandlerContribution);
21399
21983
 
21400
- var __decorate$1e = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21984
+ var __decorate$1d = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21401
21985
  var d,
21402
21986
  c = arguments.length,
21403
21987
  r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
21404
21988
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
21405
21989
  return c > 3 && r && Object.defineProperty(target, key, r), r;
21406
21990
  },
21407
- __metadata$X = undefined && undefined.__metadata || function (k, v) {
21991
+ __metadata$W = undefined && undefined.__metadata || function (k, v) {
21408
21992
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
21409
21993
  };
21410
21994
  var OffscreenLayerHandlerContribution = /*#__PURE__*/function () {
@@ -21491,7 +22075,7 @@
21491
22075
  }]);
21492
22076
  return OffscreenLayerHandlerContribution;
21493
22077
  }();
21494
- OffscreenLayerHandlerContribution = __decorate$1e([injectable(), __metadata$X("design:paramtypes", [])], OffscreenLayerHandlerContribution);
22078
+ OffscreenLayerHandlerContribution = __decorate$1d([injectable(), __metadata$W("design:paramtypes", [])], OffscreenLayerHandlerContribution);
21495
22079
 
21496
22080
  var layerHandlerModules = new ContainerModule(function (bind) {
21497
22081
  bind(CanvasLayerHandlerContribution).toSelf(), bind(OffscreenLayerHandlerContribution).toSelf(), bind(EmptyLayerHandlerContribution).toSelf(), bind(StaticLayerHandlerContribution).toService(CanvasLayerHandlerContribution), bind(DynamicLayerHandlerContribution).toService(OffscreenLayerHandlerContribution), bind(VirtualLayerHandlerContribution).toService(EmptyLayerHandlerContribution);
@@ -21567,331 +22151,56 @@
21567
22151
  function foreachAsync(graphic, defaultZIndex, cb) {
21568
22152
  var reverse = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
21569
22153
  return __awaiter$2(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
21570
- return _regeneratorRuntime().wrap(function _callee$(_context) {
21571
- while (1) switch (_context.prev = _context.next) {
21572
- case 0:
21573
- _context.next = 2;
21574
- return graphic.forEachChildrenAsync(cb, reverse);
21575
- case 2:
21576
- case "end":
21577
- return _context.stop();
21578
- }
21579
- }, _callee);
21580
- }));
21581
- }
21582
- function findNextGraphic(graphic, id, defaultZIndex) {
21583
- var reverse = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
21584
- var childMap = {},
21585
- zIdxArray = [];
21586
- var needSort = !1;
21587
- graphic.forEachChildren(function (item, i) {
21588
- var _item$attribute$zInde3 = item.attribute.zIndex,
21589
- zIndex = _item$attribute$zInde3 === void 0 ? defaultZIndex : _item$attribute$zInde3;
21590
- if (0 === i) ;else if (undefined !== zIndex) return needSort = !0, !0;
21591
- return !1;
21592
- }, reverse);
21593
- var result = null,
21594
- next = !1;
21595
- if (needSort) {
21596
- graphic.forEachChildren(function (item) {
21597
- var _item$attribute$zInde4 = item.attribute.zIndex,
21598
- zIndex = _item$attribute$zInde4 === void 0 ? defaultZIndex : _item$attribute$zInde4;
21599
- childMap[zIndex] ? childMap[zIndex].push(item) : (childMap[zIndex] = [item], zIdxArray.push(zIndex));
21600
- }, reverse), zIdxArray.sort(function (a, b) {
21601
- return reverse ? b - a : a - b;
21602
- });
21603
- var skip = !1;
21604
- for (var i = 0; i < zIdxArray.length && !skip; i++) {
21605
- var idx = zIdxArray[i],
21606
- children = childMap[idx];
21607
- for (var _i2 = 0; _i2 < children.length; _i2++) {
21608
- if (next) {
21609
- skip = !0, result = children[_i2];
21610
- break;
21611
- }
21612
- children[_i2]._uid !== id || (next = !0);
21613
- }
21614
- }
21615
- } else graphic.forEachChildren(function (item) {
21616
- return next ? (result = item, !0) : (item._uid === id && (next = !0), !1);
21617
- }, reverse);
21618
- return result;
21619
- }
21620
-
21621
- var __decorate$1d = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21622
- var d,
21623
- c = arguments.length,
21624
- r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
21625
- if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
21626
- return c > 3 && r && Object.defineProperty(target, key, r), r;
21627
- },
21628
- __metadata$W = undefined && undefined.__metadata || function (k, v) {
21629
- if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
21630
- };
21631
- var DrawItemInterceptor = Symbol["for"]("DrawItemInterceptor");
21632
- var tempDirtyBounds = new AABBBounds();
21633
- var ShadowRootDrawItemInterceptorContribution = /*#__PURE__*/function () {
21634
- function ShadowRootDrawItemInterceptorContribution() {
21635
- _classCallCheck(this, ShadowRootDrawItemInterceptorContribution);
21636
- this.order = 1;
21637
- }
21638
- _createClass(ShadowRootDrawItemInterceptorContribution, [{
21639
- key: "afterDrawItem",
21640
- value: function afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21641
- return (graphic.attribute.shadowRootIdx > 0 || !graphic.attribute.shadowRootIdx) && this.drawItem(graphic, renderService, drawContext, drawContribution, params), !1;
21642
- }
21643
- }, {
21644
- key: "beforeDrawItem",
21645
- value: function beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21646
- return graphic.attribute.shadowRootIdx < 0 && this.drawItem(graphic, renderService, drawContext, drawContribution, params), !1;
21647
- }
21648
- }, {
21649
- key: "drawItem",
21650
- value: function drawItem(graphic, renderService, drawContext, drawContribution, params) {
21651
- if (!graphic.shadowRoot) return !1;
21652
- var context = drawContext.context;
21653
- if (context.highPerformanceSave(), context.transformFromMatrix(graphic.transMatrix, !0), drawContribution.dirtyBounds && drawContribution.backupDirtyBounds) {
21654
- tempDirtyBounds.copy(drawContribution.dirtyBounds);
21655
- var m = graphic.globalTransMatrix.getInverse();
21656
- drawContribution.dirtyBounds.copy(drawContribution.backupDirtyBounds).transformWithMatrix(m);
21657
- }
21658
- return drawContribution.renderGroup(graphic.shadowRoot, drawContext, graphic.parent.globalTransMatrix), context.highPerformanceRestore(), drawContribution.dirtyBounds && drawContribution.backupDirtyBounds && drawContribution.dirtyBounds.copy(tempDirtyBounds), !0;
21659
- }
21660
- }]);
21661
- return ShadowRootDrawItemInterceptorContribution;
21662
- }();
21663
- var DebugDrawItemInterceptorContribution = /*#__PURE__*/function () {
21664
- function DebugDrawItemInterceptorContribution() {
21665
- _classCallCheck(this, DebugDrawItemInterceptorContribution);
21666
- this.order = 1;
21667
- }
21668
- _createClass(DebugDrawItemInterceptorContribution, [{
21669
- key: "afterDrawItem",
21670
- value: function afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21671
- return graphic.attribute._debug_bounds && this.drawItem(graphic, renderService, drawContext, drawContribution, params), !1;
21672
- }
21673
- }, {
21674
- key: "drawItem",
21675
- value: function drawItem(graphic, renderService, drawContext, drawContribution, params) {
21676
- if (!graphic.attribute._debug_bounds) return !1;
21677
- var context = drawContext.context;
21678
- context.highPerformanceSave(), graphic.parent && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), graphic.glyphHost && graphic.glyphHost.parent && context.setTransformFromMatrix(graphic.glyphHost.parent.globalTransMatrix, !0);
21679
- var b = graphic.AABBBounds;
21680
- return !0 !== graphic.attribute._debug_bounds && graphic.attribute._debug_bounds(context, graphic), context.strokeRect(b.x1, b.y1, b.width(), b.height()), context.highPerformanceRestore(), !0;
21681
- }
21682
- }]);
21683
- return DebugDrawItemInterceptorContribution;
21684
- }();
21685
- var CommonDrawItemInterceptorContribution = /*#__PURE__*/function () {
21686
- function CommonDrawItemInterceptorContribution() {
21687
- _classCallCheck(this, CommonDrawItemInterceptorContribution);
21688
- this.order = 1, this.interceptors = [new ShadowRootDrawItemInterceptorContribution(), new Canvas3DDrawItemInterceptor(), new InteractiveDrawItemInterceptorContribution(), new DebugDrawItemInterceptorContribution()];
21689
- }
21690
- _createClass(CommonDrawItemInterceptorContribution, [{
21691
- key: "afterDrawItem",
21692
- value: function afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21693
- for (var i = 0; i < this.interceptors.length; i++) if (this.interceptors[i].afterDrawItem && this.interceptors[i].afterDrawItem(graphic, renderService, drawContext, drawContribution, params)) return !0;
21694
- return !1;
21695
- }
21696
- }, {
21697
- key: "beforeDrawItem",
21698
- value: function beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21699
- if ((!graphic.in3dMode || drawContext.in3dInterceptor) && !graphic.shadowRoot && !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)) return !1;
21700
- for (var i = 0; i < this.interceptors.length; i++) if (this.interceptors[i].beforeDrawItem && this.interceptors[i].beforeDrawItem(graphic, renderService, drawContext, drawContribution, params)) return !0;
21701
- return !1;
21702
- }
21703
- }]);
21704
- return CommonDrawItemInterceptorContribution;
21705
- }();
21706
- CommonDrawItemInterceptorContribution = __decorate$1d([injectable(), __metadata$W("design:paramtypes", [])], CommonDrawItemInterceptorContribution);
21707
- var InteractiveDrawItemInterceptorContribution = /*#__PURE__*/function () {
21708
- function InteractiveDrawItemInterceptorContribution() {
21709
- _classCallCheck(this, InteractiveDrawItemInterceptorContribution);
21710
- this.order = 1;
21711
- }
21712
- _createClass(InteractiveDrawItemInterceptorContribution, [{
21713
- key: "beforeDrawItem",
21714
- value: function beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21715
- return !this.processing && (graphic.baseGraphic ? this.beforeDrawInteractive(graphic, renderService, drawContext, drawContribution, params) : this.beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params));
21716
- }
21717
- }, {
21718
- key: "beforeSetInteractive",
21719
- value: function beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params) {
21720
- var interactiveGraphic = graphic.interactiveGraphic;
21721
- if (graphic.attribute.globalZIndex) {
21722
- interactiveGraphic || (interactiveGraphic = graphic.clone(), graphic.interactiveGraphic = interactiveGraphic, interactiveGraphic.baseGraphic = graphic), interactiveGraphic.setAttributes({
21723
- globalZIndex: 0,
21724
- zIndex: graphic.attribute.globalZIndex
21725
- }, !1, {
21726
- skipUpdateCallback: !0
21727
- }), drawContext.stage.tryInitInteractiveLayer();
21728
- var interactiveLayer = drawContext.stage.getLayer("_builtin_interactive");
21729
- if (interactiveLayer) {
21730
- this.getShadowRoot(interactiveLayer).add(interactiveGraphic);
21731
- }
21732
- return !0;
21733
- }
21734
- if (interactiveGraphic) {
21735
- drawContext.stage.tryInitInteractiveLayer();
21736
- var _interactiveLayer = drawContext.stage.getLayer("_builtin_interactive");
21737
- if (_interactiveLayer) {
21738
- this.getShadowRoot(_interactiveLayer).removeChild(interactiveGraphic);
21739
- }
21740
- graphic.interactiveGraphic = null, interactiveGraphic.baseGraphic = null;
21741
- }
21742
- return !1;
21743
- }
21744
- }, {
21745
- key: "beforeDrawInteractive",
21746
- value: function beforeDrawInteractive(graphic, renderService, drawContext, drawContribution, params) {
21747
- var baseGraphic = graphic.baseGraphic;
21748
- if (baseGraphic) {
21749
- this.processing = !0;
21750
- var context = drawContext.context;
21751
- return context.highPerformanceSave(), context.setTransformFromMatrix(baseGraphic.parent.globalTransMatrix, !0), baseGraphic.isContainer ? drawContribution.renderGroup(baseGraphic, drawContext, baseGraphic.parent.globalTransMatrix) : drawContribution.renderItem(baseGraphic, drawContext), context.highPerformanceRestore(), this.processing = !1, !0;
21752
- }
21753
- return !1;
21754
- }
21755
- }, {
21756
- key: "getShadowRoot",
21757
- value: function getShadowRoot(interactiveLayer) {
21758
- var _a;
21759
- var group = interactiveLayer.getElementById("_interactive_group");
21760
- return group || (group = graphicCreator.CreateGraphic("group", {}), group.id = "_interactive_group", interactiveLayer.add(group)), null !== (_a = group.shadowRoot) && void 0 !== _a ? _a : group.attachShadow();
21761
- }
21762
- }]);
21763
- return InteractiveDrawItemInterceptorContribution;
21764
- }();
21765
- var Canvas3DDrawItemInterceptor = /*#__PURE__*/function () {
21766
- function Canvas3DDrawItemInterceptor() {
21767
- _classCallCheck(this, Canvas3DDrawItemInterceptor);
21768
- this.order = 1;
21769
- }
21770
- _createClass(Canvas3DDrawItemInterceptor, [{
21771
- key: "beforeDrawItem",
21772
- value: function beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
21773
- if (!graphic.in3dMode || drawContext.in3dInterceptor) return !1;
21774
- drawContext.in3dInterceptor = !0;
21775
- var _renderService$drawPa = renderService.drawParams,
21776
- context = _renderService$drawPa.context,
21777
- stage = _renderService$drawPa.stage;
21778
- context.canvas;
21779
- context.save(), this.initCanvasCtx(context), context.camera = stage.camera;
21780
- var m = context.currentMatrix;
21781
- m.a /= context.dpr, m.b /= context.dpr, m.c /= context.dpr, m.d /= context.dpr, m.e /= context.dpr, m.f /= context.dpr;
21782
- var matrix = mat4Allocate.allocate();
21783
- mat3Tomat4(matrix, m);
21784
- var lastModelMatrix = context.modelMatrix;
21785
- if (lastModelMatrix) {
21786
- if (matrix) {
21787
- var _m = mat4Allocate.allocate();
21788
- context.modelMatrix = multiplyMat4Mat4(_m, lastModelMatrix, matrix);
21789
- }
21790
- } else context.modelMatrix = matrix;
21791
- if (context.setTransform(1, 0, 0, 1, 0, 0, !0), graphic.isContainer) {
21792
- var isPie = !1,
21793
- is3d = !1;
21794
- if (graphic.forEachChildren(function (c) {
21795
- return isPie = c.numberType === ARC3D_NUMBER_TYPE, !isPie;
21796
- }), graphic.forEachChildren(function (c) {
21797
- return is3d = !!c.findFace, !is3d;
21798
- }), isPie) {
21799
- var children = graphic.getChildren(),
21800
- sortedChildren = _toConsumableArray(children);
21801
- sortedChildren.sort(function (a, b) {
21802
- var _a, _b, _c, _d;
21803
- var angle1 = ((null !== (_a = a.attribute.startAngle) && void 0 !== _a ? _a : 0) + (null !== (_b = a.attribute.endAngle) && void 0 !== _b ? _b : 0)) / 2,
21804
- angle2 = ((null !== (_c = b.attribute.startAngle) && void 0 !== _c ? _c : 0) + (null !== (_d = b.attribute.endAngle) && void 0 !== _d ? _d : 0)) / 2;
21805
- for (; angle1 < 0;) angle1 += pi2;
21806
- for (; angle2 < 0;) angle2 += pi2;
21807
- return angle2 - angle1;
21808
- }), sortedChildren.forEach(function (c) {
21809
- c._next = null, c._prev = null;
21810
- }), graphic.removeAllChild(), graphic.update(), sortedChildren.forEach(function (c) {
21811
- graphic.appendChild(c);
21812
- });
21813
- var _m2 = graphic.parent.globalTransMatrix;
21814
- drawContext.hack_pieFace = "outside", drawContribution.renderGroup(graphic, drawContext, _m2), drawContext.hack_pieFace = "inside", drawContribution.renderGroup(graphic, drawContext, _m2), drawContext.hack_pieFace = "top", drawContribution.renderGroup(graphic, drawContext, _m2), graphic.removeAllChild(), children.forEach(function (c) {
21815
- c._next = null, c._prev = null;
21816
- }), children.forEach(function (c) {
21817
- graphic.appendChild(c);
21818
- });
21819
- } else if (is3d) {
21820
- var _children = graphic.getChildren(),
21821
- zChildren = _children.map(function (g) {
21822
- return {
21823
- ave_z: g.findFace().vertices.map(function (v) {
21824
- var _a;
21825
- return context.view(v[0], v[1], null !== (_a = v[2] + g.attribute.z) && void 0 !== _a ? _a : 0)[2];
21826
- }).reduce(function (a, b) {
21827
- return a + b;
21828
- }, 0),
21829
- g: g
21830
- };
21831
- });
21832
- zChildren.sort(function (a, b) {
21833
- return b.ave_z - a.ave_z;
21834
- }), graphic.removeAllChild(), zChildren.forEach(function (i) {
21835
- i.g._next = null, i.g._prev = null;
21836
- }), graphic.update(), zChildren.forEach(function (i) {
21837
- graphic.add(i.g);
21838
- }), drawContribution.renderGroup(graphic, drawContext, graphic.parent.globalTransMatrix, !0), graphic.removeAllChild(), _children.forEach(function (g) {
21839
- g._next = null, g._prev = null;
21840
- }), graphic.update(), _children.forEach(function (g) {
21841
- graphic.add(g);
21842
- });
21843
- } else drawContribution.renderGroup(graphic, drawContext, graphic.parent.globalTransMatrix);
21844
- } else drawContribution.renderItem(graphic, drawContext);
21845
- return context.camera = null, context.restore(), context.modelMatrix !== lastModelMatrix && mat4Allocate.free(context.modelMatrix), context.modelMatrix = lastModelMatrix, drawContext.in3dInterceptor = !1, !0;
21846
- }
21847
- }, {
21848
- key: "initCanvasCtx",
21849
- value: function initCanvasCtx(context) {
21850
- context.setTransformForCurrent();
21851
- }
21852
- }]);
21853
- return Canvas3DDrawItemInterceptor;
21854
- }();
21855
-
21856
- var DefaultBoundsAllocate = /*#__PURE__*/function () {
21857
- function DefaultBoundsAllocate() {
21858
- _classCallCheck(this, DefaultBoundsAllocate);
21859
- this.pools = [];
21860
- for (var i = 0; i < 10; i++) this.pools.push(new AABBBounds());
21861
- }
21862
- _createClass(DefaultBoundsAllocate, [{
21863
- key: "allocate",
21864
- value: function allocate(x1, y1, x2, y2) {
21865
- if (!this.pools.length) return new AABBBounds().setValue(x1, y1, x2, y2);
21866
- var b = this.pools.pop();
21867
- return b.x1 = x1, b.y1 = y1, b.x2 = x2, b.y2 = y2, b;
21868
- }
21869
- }, {
21870
- key: "allocateByObj",
21871
- value: function allocateByObj(b) {
21872
- if (!this.pools.length) return new AABBBounds(b);
21873
- var _b = this.pools.pop();
21874
- return _b.x1 = b.x1, _b.y1 = b.y1, _b.x2 = b.x2, _b.y2 = b.y2, _b;
21875
- }
21876
- }, {
21877
- key: "free",
21878
- value: function free(b) {
21879
- this.pools.push(b);
21880
- }
21881
- }, {
21882
- key: "length",
21883
- get: function get() {
21884
- return this.pools.length;
21885
- }
21886
- }, {
21887
- key: "release",
21888
- value: function release() {
21889
- this.pools = [];
22154
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
22155
+ while (1) switch (_context.prev = _context.next) {
22156
+ case 0:
22157
+ _context.next = 2;
22158
+ return graphic.forEachChildrenAsync(cb, reverse);
22159
+ case 2:
22160
+ case "end":
22161
+ return _context.stop();
22162
+ }
22163
+ }, _callee);
22164
+ }));
22165
+ }
22166
+ function findNextGraphic(graphic, id, defaultZIndex) {
22167
+ var reverse = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
22168
+ var childMap = {},
22169
+ zIdxArray = [];
22170
+ var needSort = !1;
22171
+ graphic.forEachChildren(function (item, i) {
22172
+ var _item$attribute$zInde3 = item.attribute.zIndex,
22173
+ zIndex = _item$attribute$zInde3 === void 0 ? defaultZIndex : _item$attribute$zInde3;
22174
+ if (0 === i) ;else if (undefined !== zIndex) return needSort = !0, !0;
22175
+ return !1;
22176
+ }, reverse);
22177
+ var result = null,
22178
+ next = !1;
22179
+ if (needSort) {
22180
+ graphic.forEachChildren(function (item) {
22181
+ var _item$attribute$zInde4 = item.attribute.zIndex,
22182
+ zIndex = _item$attribute$zInde4 === void 0 ? defaultZIndex : _item$attribute$zInde4;
22183
+ childMap[zIndex] ? childMap[zIndex].push(item) : (childMap[zIndex] = [item], zIdxArray.push(zIndex));
22184
+ }, reverse), zIdxArray.sort(function (a, b) {
22185
+ return reverse ? b - a : a - b;
22186
+ });
22187
+ var skip = !1;
22188
+ for (var i = 0; i < zIdxArray.length && !skip; i++) {
22189
+ var idx = zIdxArray[i],
22190
+ children = childMap[idx];
22191
+ for (var _i2 = 0; _i2 < children.length; _i2++) {
22192
+ if (next) {
22193
+ skip = !0, result = children[_i2];
22194
+ break;
22195
+ }
22196
+ children[_i2]._uid !== id || (next = !0);
22197
+ }
21890
22198
  }
21891
- }]);
21892
- return DefaultBoundsAllocate;
21893
- }();
21894
- var boundsAllocate = new DefaultBoundsAllocate();
22199
+ } else graphic.forEachChildren(function (item) {
22200
+ return next ? (result = item, !0) : (item._uid === id && (next = !0), !1);
22201
+ }, reverse);
22202
+ return result;
22203
+ }
21895
22204
 
21896
22205
  var __decorate$1c = undefined && undefined.__decorate || function (decorators, target, key, desc) {
21897
22206
  var d,
@@ -21945,20 +22254,26 @@
21945
22254
  width = drawContext.width,
21946
22255
  height = drawContext.height;
21947
22256
  if (!context) return;
22257
+ if (drawContext.keepMatrix) {
22258
+ if (context.nativeContext && context.nativeContext.getTransform) {
22259
+ var t = context.nativeContext.getTransform();
22260
+ context.setTransformFromMatrix(t, !0, 1);
22261
+ }
22262
+ } else context.inuse = !0, context.clearMatrix(), context.setTransformForCurrent(!0);
21948
22263
  var dirtyBounds = this.dirtyBounds.setValue(0, 0, width, height);
21949
22264
  if (stage.dirtyBounds && !stage.dirtyBounds.empty()) {
21950
22265
  var b = getRectIntersect(dirtyBounds, stage.dirtyBounds, !1);
21951
22266
  dirtyBounds.x1 = Math.floor(b.x1), dirtyBounds.y1 = Math.floor(b.y1), dirtyBounds.x2 = Math.ceil(b.x2), dirtyBounds.y2 = Math.ceil(b.y2);
21952
22267
  }
21953
22268
  var d = context.dpr % 1;
21954
- (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);
22269
+ (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);
21955
22270
  var drawInArea = dirtyBounds.width() * context.dpr < context.canvas.width || dirtyBounds.height() * context.dpr < context.canvas.height;
21956
22271
  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) {
21957
22272
  var _a, _b;
21958
22273
  return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
21959
22274
  }).forEach(function (group) {
21960
22275
  group.isContainer ? _this2.renderGroup(group, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0)) : _this2.renderItem(group, drawContext);
21961
- }), context.restore(), context.restore(), context.draw(), context.inuse = !1;
22276
+ }), context.restore(), context.restore(), context.draw(), drawContext.keepMatrix || (context.inuse = !1);
21962
22277
  }
21963
22278
  }, {
21964
22279
  key: "doRegister",
@@ -22091,7 +22406,7 @@
22091
22406
  }, {
22092
22407
  key: "clearScreen",
22093
22408
  value: function clearScreen(renderService, context, drawContext) {
22094
- var _a;
22409
+ var _a, _b;
22095
22410
  var clear = drawContext.clear;
22096
22411
  if (clear) {
22097
22412
  var canvas = context.getCanvas(),
@@ -22103,7 +22418,7 @@
22103
22418
  y = 0;
22104
22419
  context.clearRect(x, y, width, height);
22105
22420
  var stage = null === (_a = renderService.drawParams) || void 0 === _a ? void 0 : _a.stage;
22106
- if (stage && stage.backgroundImg && stage.resources) {
22421
+ if (stage && (context.globalAlpha = null !== (_b = stage.attribute.opacity) && void 0 !== _b ? _b : 1), stage && stage.backgroundImg && stage.resources) {
22107
22422
  var res = stage.resources.get(clear);
22108
22423
  res && "success" === res.state && res.data && context.drawImage(res.data, x, y, width, height);
22109
22424
  } else context.fillStyle = createColor(context, clear, {
@@ -22413,20 +22728,15 @@
22413
22728
  _classCallCheck(this, DefaultIncrementalDrawContribution);
22414
22729
  _this = _super.call(this, contributions, drawItemInterceptorContributions), _this.contributions = contributions, _this.lineRender = lineRender, _this.areaRender = areaRender, _this.drawItemInterceptorContributions = drawItemInterceptorContributions, _this.rendering = !1, _this.currFrameStartAt = 0, _this.currentIdx = 0, _this.status = STATUS.NORMAL, _this.checkingForDrawPromise = null, _this.hooks = {
22415
22730
  completeDraw: new SyncHook([])
22416
- };
22731
+ }, _this.defaultRenderMap.set(_this.lineRender.numberType, _this.lineRender), _this.defaultRenderMap.set(_this.areaRender.numberType, _this.areaRender);
22417
22732
  return _this;
22418
22733
  }
22419
22734
  _createClass(DefaultIncrementalDrawContribution, [{
22420
- key: "init",
22421
- value: function init() {
22422
- _get(_getPrototypeOf(DefaultIncrementalDrawContribution.prototype), "init", this).call(this), this.defaultRenderMap.set(this.lineRender.numberType, this.lineRender), this.defaultRenderMap.set(this.areaRender.numberType, this.areaRender);
22423
- }
22424
- }, {
22425
22735
  key: "draw",
22426
22736
  value: function draw(renderService, drawContext) {
22427
22737
  return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
22428
22738
  var _this2 = this;
22429
- var skipDraw, context, _drawContext$x, x, _drawContext$y, y;
22739
+ var skipDraw, context, _drawContext$x, x, _drawContext$y, y, t;
22430
22740
  return _regeneratorRuntime().wrap(function _callee$(_context) {
22431
22741
  while (1) switch (_context.prev = _context.next) {
22432
22742
  case 0:
@@ -22449,14 +22759,22 @@
22449
22759
  case 8:
22450
22760
  this.currentRenderService = renderService;
22451
22761
  context = drawContext.context, _drawContext$x = drawContext.x, x = _drawContext$x === void 0 ? 0 : _drawContext$x, _drawContext$y = drawContext.y, y = _drawContext$y === void 0 ? 0 : _drawContext$y;
22452
- context && (context.inuse = !0, context.clearMatrix(), context.setTransformForCurrent(!0), context.save(), drawContext.restartIncremental && this.clearScreen(this.currentRenderService, context, drawContext), context.translate(x, y, !0), context.save(), renderService.renderTreeRoots.sort(function (a, b) {
22453
- var _a, _b;
22454
- return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
22455
- }).forEach(function (group) {
22456
- _this2.renderGroup(group, drawContext);
22457
- }), this.hooks.completeDraw.tap("top-draw", function () {
22458
- context.restore(), context.restore(), context.draw(), context.inuse = !1, _this2.rendering = !1;
22459
- }));
22762
+ if (context) {
22763
+ if (drawContext.keepMatrix) {
22764
+ if (context.nativeContext && context.nativeContext.getTransform) {
22765
+ t = context.nativeContext.getTransform();
22766
+ context.setTransformFromMatrix(t, !0, 1);
22767
+ }
22768
+ } else context.inuse = !0, context.clearMatrix();
22769
+ context.setTransformForCurrent(!0), context.save(), drawContext.restartIncremental && this.clearScreen(this.currentRenderService, context, drawContext), context.translate(x, y, !0), context.save(), renderService.renderTreeRoots.sort(function (a, b) {
22770
+ var _a, _b;
22771
+ return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
22772
+ }).forEach(function (group) {
22773
+ _this2.renderGroup(group, drawContext);
22774
+ }), this.hooks.completeDraw.tap("top-draw", function () {
22775
+ context.restore(), context.restore(), context.draw(), drawContext.keepMatrix || (context.inuse = !1), _this2.rendering = !1;
22776
+ });
22777
+ }
22460
22778
  case 11:
22461
22779
  case "end":
22462
22780
  return _context.stop();
@@ -22731,18 +23049,17 @@
22731
23049
  DefaultIncrementalDrawContribution = __decorate$18([injectable(), __param$A(0, multiInject(GraphicRender)), __param$A(1, inject(DefaultIncrementalCanvasLineRender)), __param$A(2, inject(DefaultIncrementalCanvasAreaRender)), __param$A(3, inject(ContributionProvider)), __param$A(3, named(DrawItemInterceptor)), __metadata$T("design:paramtypes", [Array, Object, Object, Object])], DefaultIncrementalDrawContribution);
22732
23050
 
22733
23051
  var renderModule = new ContainerModule(function (bind) {
22734
- bind(DefaultBaseBackgroundRenderContribution).toSelf().inSingletonScope(), bind(DefaultBaseTextureRenderContribution).toSelf().inSingletonScope(), bind(DrawContribution).to(DefaultDrawContribution), bind(IncrementalDrawContribution).to(DefaultIncrementalDrawContribution), bind(GroupRender).to(DefaultCanvasGroupRender).inSingletonScope(), bind(GraphicRender).toService(GroupRender), bindContributionProvider(bind, GroupRenderContribution), bind(exports.DefaultBaseInteractiveRenderContribution).toSelf().inSingletonScope(), bindContributionProvider(bind, InteractiveSubRenderContribution), bindContributionProvider(bind, GraphicRender), bind(CommonDrawItemInterceptorContribution).toSelf().inSingletonScope(), bind(DrawItemInterceptor).toService(CommonDrawItemInterceptorContribution), bindContributionProvider(bind, DrawItemInterceptor);
23052
+ bind(DefaultBaseBackgroundRenderContribution).toSelf().inSingletonScope(), bind(DefaultBaseTextureRenderContribution).toSelf().inSingletonScope(), bind(DrawContribution).to(DefaultDrawContribution), bind(IncrementalDrawContribution).to(DefaultIncrementalDrawContribution), bind(GroupRender).to(DefaultCanvasGroupRender).inSingletonScope(), bind(GraphicRender).toService(GroupRender), bindContributionProvider(bind, GroupRenderContribution), bind(exports.DefaultBaseInteractiveRenderContribution).toSelf().inSingletonScope(), bindContributionProvider(bind, InteractiveSubRenderContribution), bindContributionProvider(bind, GraphicRender), bind(exports.CommonDrawItemInterceptorContribution).toSelf().inSingletonScope(), bind(DrawItemInterceptor).toService(exports.CommonDrawItemInterceptorContribution), bindContributionProvider(bind, DrawItemInterceptor);
22735
23053
  });
22736
23054
 
22737
23055
  function load(container) {
22738
23056
  container.load(renderModule);
22739
23057
  }
22740
23058
 
22741
- var loaded$r = !1;
22742
23059
  function preLoadAllModule() {
22743
- loaded$r || (loaded$r = !0, container.load(coreModule), container.load(graphicModule), container.load(renderModule$1), container.load(pickModule), container.load(pluginModule), load$1(container), load(container));
23060
+ preLoadAllModule.__loaded || (preLoadAllModule.__loaded = !0, container.load(coreModule), container.load(graphicModule), container.load(renderModule$1), container.load(pickModule), container.load(pluginModule), load$1(container), load(container));
22744
23061
  }
22745
- preLoadAllModule();
23062
+ preLoadAllModule.__loaded = !1, preLoadAllModule();
22746
23063
  var vglobal = container.get(VGlobal);
22747
23064
  application.global = vglobal;
22748
23065
  var graphicUtil = container.get(GraphicUtil);
@@ -22892,6 +23209,8 @@
22892
23209
  var _this = this;
22893
23210
  this.pluginService = context, context.stage.hooks.afterRender.tap(this.key, function (stage) {
22894
23211
  stage && stage === _this.pluginService.stage && _this.drawHTML(context.stage.renderService);
23212
+ }), application.graphicService.hooks.onRemove.tap(this.key, function (graphic) {
23213
+ _this.removeDom(graphic);
22895
23214
  }), application.graphicService.hooks.onRelease.tap(this.key, function (graphic) {
22896
23215
  _this.removeDom(graphic);
22897
23216
  });
@@ -22948,35 +23267,34 @@
22948
23267
  anchorType = _html$anchorType === void 0 ? "boundsLeftTop" : _html$anchorType;
22949
23268
  graphic.bindDom || (graphic.bindDom = new Map());
22950
23269
  var lastDom = graphic.bindDom.get(dom);
22951
- if (lastDom && (!container || container === lastDom.container)) return;
22952
- var nativeDom, nativeContainer;
22953
- graphic.bindDom.forEach(function (_ref) {
22954
- var wrapGroup = _ref.wrapGroup;
22955
- application.global.removeDom(wrapGroup);
22956
- }), nativeDom = "string" == typeof dom ? new DOMParser().parseFromString(dom, "text/html").firstChild : dom;
22957
- var _container = container || (!0 === stage.params.enableHtmlAttribute ? null : stage.params.enableHtmlAttribute);
22958
- nativeContainer = _container ? "string" == typeof _container ? application.global.getElementById(_container) : _container : graphic.stage.window.getContainer();
22959
- var wrapGroup = application.global.createDom({
22960
- tagName: "div",
22961
- width: width,
22962
- height: height,
22963
- style: style,
22964
- parent: nativeContainer
22965
- });
22966
- wrapGroup && (wrapGroup.appendChild(nativeDom), graphic.bindDom.set(dom, {
22967
- dom: nativeDom,
22968
- container: container,
22969
- wrapGroup: wrapGroup
22970
- })), wrapGroup.style.pointerEvents = "none", wrapGroup.style.position || (wrapGroup.style.position = "absolute", nativeContainer.style.position = "relative");
23270
+ var wrapGroup, nativeContainer;
23271
+ if (!lastDom || container && container !== lastDom.container) {
23272
+ var nativeDom;
23273
+ graphic.bindDom.forEach(function (_ref) {
23274
+ var wrapGroup = _ref.wrapGroup;
23275
+ application.global.removeDom(wrapGroup);
23276
+ }), "string" == typeof dom ? (nativeDom = new DOMParser().parseFromString(dom, "text/html").firstChild, nativeDom.lastChild && (nativeDom = nativeDom.lastChild.firstChild)) : nativeDom = dom;
23277
+ var _container = container || (!0 === stage.params.enableHtmlAttribute ? null : stage.params.enableHtmlAttribute);
23278
+ nativeContainer = _container ? "string" == typeof _container ? application.global.getElementById(_container) : _container : graphic.stage.window.getContainer(), wrapGroup = application.global.createDom({
23279
+ tagName: "div",
23280
+ width: width,
23281
+ height: height,
23282
+ style: style,
23283
+ parent: nativeContainer
23284
+ }), wrapGroup && (wrapGroup.appendChild(nativeDom), graphic.bindDom.set(dom, {
23285
+ dom: nativeDom,
23286
+ container: container,
23287
+ wrapGroup: wrapGroup
23288
+ }));
23289
+ } else wrapGroup = lastDom.wrapGroup, nativeContainer = wrapGroup.parentNode;
23290
+ wrapGroup.style.pointerEvents = "none", wrapGroup.style.position || (wrapGroup.style.position = "absolute", nativeContainer.style.position = "relative");
22971
23291
  var left = 0,
22972
23292
  top = 0;
22973
- if ("position" === anchorType) {
22974
- var matrix = graphic.transMatrix;
23293
+ var b = graphic.globalAABBBounds;
23294
+ if ("position" === anchorType || b.empty()) {
23295
+ var matrix = graphic.globalTransMatrix;
22975
23296
  left = matrix.e, top = matrix.f;
22976
- } else {
22977
- var b = graphic.AABBBounds;
22978
- left = b.x1, top = b.y1;
22979
- }
23297
+ } else left = b.x1, top = b.y1;
22980
23298
  var containerTL = application.global.getElementTopLeft(nativeContainer, !1),
22981
23299
  windowTL = stage.window.getTopLeft(!1),
22982
23300
  offsetX = left + windowTL.left - containerTL.left,
@@ -23033,13 +23351,23 @@
23033
23351
  this.name = "FlexLayoutPlugin", this.activeEvent = "onRegister", this.id = Generator.GenAutoIncrementId(), this.key = this.name + this.id, this.tempBounds = new AABBBounds();
23034
23352
  }
23035
23353
  _createClass(FlexLayoutPlugin, [{
23354
+ key: "pauseLayout",
23355
+ value: function pauseLayout(p) {
23356
+ this.pause = p;
23357
+ }
23358
+ }, {
23359
+ key: "tryLayoutChildren",
23360
+ value: function tryLayoutChildren(graphic) {
23361
+ graphic.firstChild && this.tryLayout(graphic.firstChild);
23362
+ }
23363
+ }, {
23036
23364
  key: "tryLayout",
23037
23365
  value: function tryLayout(graphic) {
23038
23366
  var _this = this;
23039
- if (this.layouting) return;
23040
- this.layouting = !0;
23367
+ var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
23368
+ if (this.pause) return;
23041
23369
  var p = graphic.parent;
23042
- if (!p || !graphic.needUpdateLayout()) return;
23370
+ if (!(force || p && graphic.needUpdateLayout())) return;
23043
23371
  var theme = getTheme(p).group,
23044
23372
  _p$attribute$display = p.attribute.display,
23045
23373
  display = _p$attribute$display === void 0 ? theme.display : _p$attribute$display;
@@ -23049,24 +23377,29 @@
23049
23377
  flexDirection = _p$attribute$flexDire === void 0 ? theme.flexDirection : _p$attribute$flexDire,
23050
23378
  _p$attribute$flexWrap = _p$attribute.flexWrap,
23051
23379
  flexWrap = _p$attribute$flexWrap === void 0 ? theme.flexWrap : _p$attribute$flexWrap,
23052
- _p$attribute$justifyC = _p$attribute.justifyContent,
23053
- justifyContent = _p$attribute$justifyC === void 0 ? theme.justifyContent : _p$attribute$justifyC,
23054
23380
  _p$attribute$alignIte = _p$attribute.alignItems,
23055
23381
  alignItems = _p$attribute$alignIte === void 0 ? theme.alignItems : _p$attribute$alignIte,
23056
- _p$attribute$alignCon = _p$attribute.alignContent,
23057
- alignContent = _p$attribute$alignCon === void 0 ? theme.alignContent : _p$attribute$alignCon,
23058
23382
  _p$attribute$clip = _p$attribute.clip,
23059
- clip = _p$attribute$clip === void 0 ? theme.clip : _p$attribute$clip;
23060
- var childrenWidth = 0,
23061
- childrenHeight = 0,
23062
- boundsLegal = 0;
23063
- if (p.forEachChildren(function (child) {
23064
- var bounds = child.AABBBounds;
23065
- "column" === flexDirection || "column-reverse" === flexDirection ? (childrenHeight += bounds.height(), childrenWidth = Math.max(childrenWidth, bounds.width())) : (childrenWidth += bounds.width(), childrenHeight = Math.max(childrenHeight, bounds.height())), boundsLegal += bounds.x1, boundsLegal += bounds.y1, boundsLegal += bounds.x2, boundsLegal += bounds.y2;
23066
- }), !isFinite(boundsLegal)) return;
23067
- var width = p.attribute.width || childrenWidth,
23068
- height = p.attribute.height || childrenHeight;
23069
- p.attribute.width || (p.attribute.width = 0), p.attribute.height || (p.attribute.height = 0), this.tempBounds.copy(p._AABBBounds);
23383
+ clip = _p$attribute$clip === void 0 ? theme.clip : _p$attribute$clip,
23384
+ _p$attribute$alignCon = p.attribute.alignContent,
23385
+ alignContent = _p$attribute$alignCon === void 0 ? null != alignItems ? alignItems : theme.alignContent : _p$attribute$alignCon;
23386
+ var _p$attribute2 = p.attribute,
23387
+ width = _p$attribute2.width,
23388
+ height = _p$attribute2.height,
23389
+ _p$attribute2$justify = _p$attribute2.justifyContent,
23390
+ justifyContent = _p$attribute2$justify === void 0 ? theme.justifyContent : _p$attribute2$justify;
23391
+ var children = p.getChildren();
23392
+ if (null == width || null == height) {
23393
+ var childrenWidth = 0,
23394
+ childrenHeight = 0,
23395
+ boundsLegal = 0;
23396
+ if (children.forEach(function (child) {
23397
+ var bounds = _this.getAABBBounds(child);
23398
+ bounds.empty() || ("column" === flexDirection || "column-reverse" === flexDirection ? (childrenHeight += bounds.height(), childrenWidth = Math.max(childrenWidth, bounds.width())) : (childrenWidth += bounds.width(), childrenHeight = Math.max(childrenHeight, bounds.height())), boundsLegal += bounds.x1, boundsLegal += bounds.y1, boundsLegal += bounds.x2, boundsLegal += bounds.y2);
23399
+ }), !isFinite(boundsLegal)) return;
23400
+ width = childrenWidth, height = childrenHeight;
23401
+ }
23402
+ p.attribute.width = width, p.attribute.height = height, this.tempBounds.copy(p._AABBBounds);
23070
23403
  var result = {
23071
23404
  main: {
23072
23405
  len: width,
@@ -23075,18 +23408,18 @@
23075
23408
  cross: {
23076
23409
  len: height,
23077
23410
  field: "y"
23078
- },
23079
- dir: 1
23411
+ }
23080
23412
  },
23081
23413
  main = result.main,
23082
23414
  cross = result.cross;
23083
- "row-reverse" === flexDirection ? result.dir = -1 : "column" === flexDirection ? (main.len = height, cross.len = width, main.field = "y", cross.field = "x") : "column-reverse" === flexDirection && (main.len = height, cross.len = width, main.field = "y", cross.field = "x", result.dir = -1);
23415
+ "column" !== flexDirection && "column-reverse" !== flexDirection || (main.len = height, cross.len = width, main.field = "y", cross.field = "x"), "row-reverse" !== flexDirection && "column-reverse" !== flexDirection || ("flex-start" === justifyContent ? justifyContent = "flex-end" : "flex-end" === justifyContent ? justifyContent = "flex-start" : children.reverse());
23084
23416
  var mainLen = 0,
23085
23417
  crossLen = 0;
23086
23418
  var mianLenArray = [];
23087
- p.forEachChildren(function (c) {
23088
- var b = c.AABBBounds,
23089
- ml = "x" === main.field ? b.width() : b.height(),
23419
+ children.forEach(function (c) {
23420
+ var b = _this.getAABBBounds(c);
23421
+ if (b.empty()) return;
23422
+ var ml = "x" === main.field ? b.width() : b.height(),
23090
23423
  cl = "x" === cross.field ? b.width() : b.height();
23091
23424
  mianLenArray.push({
23092
23425
  mainLen: ml,
@@ -23119,104 +23452,171 @@
23119
23452
  mainLen: mainLen,
23120
23453
  crossLen: crossLen
23121
23454
  });
23122
- var children = p.getChildren();
23123
23455
  var lastIdx = 0;
23124
23456
  if (mainList.forEach(function (s) {
23125
23457
  _this.layoutMain(p, children, justifyContent, main, mianLenArray, lastIdx, s), lastIdx = s.idx + 1;
23126
23458
  }), crossLen = mainList.reduce(function (a, b) {
23127
23459
  return a + b.crossLen;
23128
23460
  }, 0), 1 === mainList.length) {
23129
- if ("flex-end" === alignItems) {
23130
- var anchorPos = cross.len;
23131
- this.layoutCross(children, alignItems, cross, anchorPos, mianLenArray, mainList[0], 0);
23132
- } else if ("center" === alignItems) {
23133
- var _anchorPos = cross.len / 2;
23134
- this.layoutCross(children, alignItems, cross, _anchorPos, mianLenArray, mainList[0], 0);
23135
- } else children.forEach(function (child) {
23136
- child.attribute[cross.field] = getPadding(child, cross.field);
23137
- });
23461
+ var anchorPosMap = {
23462
+ "flex-start": 0,
23463
+ "flex-end": cross.len,
23464
+ center: cross.len / 2
23465
+ };
23466
+ this.layoutCross(children, alignItems, cross, anchorPosMap, mianLenArray, mainList[0], 0);
23138
23467
  } else if ("flex-start" === alignContent) {
23139
23468
  lastIdx = 0;
23140
- var _anchorPos2 = 0;
23469
+ var anchorPos = 0;
23141
23470
  mainList.forEach(function (s, i) {
23142
- _this.layoutCross(children, "flex-start", cross, _anchorPos2, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, _anchorPos2 += s.crossLen;
23471
+ var anchorPosMap = {
23472
+ "flex-start": anchorPos,
23473
+ "flex-end": anchorPos + s.crossLen,
23474
+ center: anchorPos + s.crossLen / 2
23475
+ };
23476
+ _this.layoutCross(children, "flex-start", cross, anchorPosMap, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, anchorPos += s.crossLen;
23143
23477
  });
23144
23478
  } else if ("center" === alignContent) {
23145
23479
  lastIdx = 0;
23146
- var _anchorPos3 = Math.max(0, (cross.len - crossLen) / 2);
23480
+ var _anchorPos = Math.max(0, (cross.len - crossLen) / 2);
23147
23481
  mainList.forEach(function (s, i) {
23148
- _this.layoutCross(children, "center", cross, _anchorPos3 + s.crossLen / 2, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, _anchorPos3 += s.crossLen;
23482
+ var anchorPosMap = {
23483
+ "flex-start": _anchorPos,
23484
+ "flex-end": _anchorPos + s.crossLen,
23485
+ center: _anchorPos + s.crossLen / 2
23486
+ };
23487
+ _this.layoutCross(children, "center", cross, anchorPosMap, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, _anchorPos += s.crossLen;
23149
23488
  });
23150
23489
  } else if ("space-around" === alignContent) {
23151
23490
  lastIdx = 0;
23152
23491
  var padding = Math.max(0, (cross.len - crossLen) / mainList.length / 2);
23153
- var _anchorPos4 = padding;
23492
+ var _anchorPos2 = padding;
23154
23493
  mainList.forEach(function (s, i) {
23155
- _this.layoutCross(children, "flex-start", cross, _anchorPos4, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, _anchorPos4 += s.crossLen + 2 * padding;
23494
+ var anchorPosMap = {
23495
+ "flex-start": _anchorPos2,
23496
+ "flex-end": _anchorPos2 + s.crossLen,
23497
+ center: _anchorPos2 + s.crossLen / 2
23498
+ };
23499
+ _this.layoutCross(children, "flex-start", cross, anchorPosMap, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, _anchorPos2 += s.crossLen + 2 * padding;
23156
23500
  });
23157
23501
  } else if ("space-between" === alignContent) {
23158
23502
  lastIdx = 0;
23159
23503
  var _padding = Math.max(0, (cross.len - crossLen) / (2 * mainList.length - 2));
23160
- var _anchorPos5 = 0;
23504
+ var _anchorPos3 = 0;
23161
23505
  mainList.forEach(function (s, i) {
23162
- _this.layoutCross(children, "flex-start", cross, _anchorPos5, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, _anchorPos5 += s.crossLen + 2 * _padding;
23506
+ var anchorPosMap = {
23507
+ "flex-start": _anchorPos3,
23508
+ "flex-end": _anchorPos3 + s.crossLen,
23509
+ center: _anchorPos3 + s.crossLen / 2
23510
+ };
23511
+ _this.layoutCross(children, "flex-start", cross, anchorPosMap, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, _anchorPos3 += s.crossLen + 2 * _padding;
23163
23512
  });
23164
23513
  }
23165
23514
  children.forEach(function (child, idx) {
23166
23515
  child.addUpdateBoundTag(), child.addUpdatePositionTag(), child.clearUpdateLayoutTag();
23167
- }), p.addUpdateLayoutTag(), clip || this.tempBounds.equals(p.AABBBounds) || (this.tryLayout(p), this.layouting = !1);
23516
+ }), p.addUpdateLayoutTag();
23517
+ var b = this.getAABBBounds(p);
23518
+ clip || this.tempBounds.equals(b) || this.tryLayout(p, !1);
23519
+ }
23520
+ }, {
23521
+ key: "getAABBBounds",
23522
+ value: function getAABBBounds(graphic) {
23523
+ this.skipBoundsTrigger = !0;
23524
+ var b = graphic.AABBBounds;
23525
+ return this.skipBoundsTrigger = !1, b;
23526
+ }
23527
+ }, {
23528
+ key: "updateChildPos",
23529
+ value: function updateChildPos(posBaseLeftTop, lastP, lastBP) {
23530
+ return posBaseLeftTop + (null != lastP ? lastP : 0) - lastBP;
23168
23531
  }
23169
23532
  }, {
23170
23533
  key: "layoutMain",
23171
23534
  value: function layoutMain(p, children, justifyContent, main, mianLenArray, lastIdx, currSeg) {
23172
23535
  if ("flex-start" === justifyContent) {
23173
23536
  var pos = 0;
23174
- for (var i = lastIdx; i <= currSeg.idx; i++) children[i].attribute[main.field] = pos + getPadding(children[i], main.field), pos += mianLenArray[i].mainLen;
23537
+ for (var i = lastIdx; i <= currSeg.idx; i++) {
23538
+ var posBaseLeftTop = pos + getPadding(children[i], main.field),
23539
+ b = this.getAABBBounds(children[i]);
23540
+ !b.empty() && (children[i].attribute[main.field] = this.updateChildPos(posBaseLeftTop, children[i].attribute[main.field], b["".concat(main.field, "1")])), pos += mianLenArray[i].mainLen;
23541
+ }
23175
23542
  } else if ("flex-end" === justifyContent) {
23176
23543
  var _pos = main.len;
23177
- for (var _i = lastIdx; _i <= currSeg.idx; _i++) _pos -= mianLenArray[_i].mainLen, children[_i].attribute[main.field] = _pos + getPadding(children[_i], main.field);
23544
+ for (var _i = lastIdx; _i <= currSeg.idx; _i++) {
23545
+ _pos -= mianLenArray[_i].mainLen;
23546
+ var _posBaseLeftTop = _pos + getPadding(children[_i], main.field),
23547
+ _b = this.getAABBBounds(children[_i]);
23548
+ !_b.empty() && (children[_i].attribute[main.field] = this.updateChildPos(_posBaseLeftTop, children[_i].attribute[main.field], _b["".concat(main.field, "1")]));
23549
+ }
23178
23550
  } else if ("space-around" === justifyContent) {
23179
23551
  if (currSeg.mainLen >= main.len) {
23180
23552
  var _pos2 = 0;
23181
- for (var _i2 = lastIdx; _i2 <= currSeg.idx; _i2++) children[_i2].attribute[main.field] = _pos2 + getPadding(children[_i2], main.field), _pos2 += mianLenArray[_i2].mainLen;
23553
+ for (var _i2 = lastIdx; _i2 <= currSeg.idx; _i2++) {
23554
+ var _posBaseLeftTop2 = _pos2 + getPadding(children[_i2], main.field),
23555
+ _b2 = this.getAABBBounds(children[_i2]);
23556
+ !_b2.empty() && (children[_i2].attribute[main.field] = this.updateChildPos(_posBaseLeftTop2, children[_i2].attribute[main.field], _b2["".concat(main.field, "1")])), _pos2 += mianLenArray[_i2].mainLen;
23557
+ }
23182
23558
  } else {
23183
23559
  var size = currSeg.idx - lastIdx + 1,
23184
23560
  padding = (main.len - currSeg.mainLen) / size / 2;
23185
23561
  var _pos3 = padding;
23186
- for (var _i3 = lastIdx; _i3 <= currSeg.idx; _i3++) children[_i3].attribute[main.field] = _pos3 + getPadding(children[_i3], main.field), _pos3 += mianLenArray[_i3].mainLen + 2 * padding;
23562
+ for (var _i3 = lastIdx; _i3 <= currSeg.idx; _i3++) {
23563
+ var _posBaseLeftTop3 = _pos3 + getPadding(children[_i3], main.field),
23564
+ _b3 = this.getAABBBounds(children[_i3]);
23565
+ !_b3.empty() && (children[_i3].attribute[main.field] = this.updateChildPos(_posBaseLeftTop3, children[_i3].attribute[main.field], _b3["".concat(main.field, "1")])), _pos3 += mianLenArray[_i3].mainLen + 2 * padding;
23566
+ }
23187
23567
  }
23188
23568
  } else if ("space-between" === justifyContent) {
23189
23569
  if (currSeg.mainLen >= main.len) {
23190
23570
  var _pos4 = 0;
23191
- for (var _i4 = lastIdx; _i4 <= currSeg.idx; _i4++) children[_i4].attribute[main.field] = _pos4 + getPadding(children[_i4], main.field), _pos4 += mianLenArray[_i4].mainLen;
23571
+ for (var _i4 = lastIdx; _i4 <= currSeg.idx; _i4++) {
23572
+ var _posBaseLeftTop4 = _pos4 + getPadding(children[_i4], main.field),
23573
+ _b4 = this.getAABBBounds(children[_i4]);
23574
+ !_b4.empty() && (children[_i4].attribute[main.field] = this.updateChildPos(_posBaseLeftTop4, children[_i4].attribute[main.field], _b4["".concat(main.field, "1")])), _pos4 += mianLenArray[_i4].mainLen;
23575
+ }
23192
23576
  } else {
23193
23577
  var _size = currSeg.idx - lastIdx + 1,
23194
23578
  _padding2 = (main.len - currSeg.mainLen) / (2 * _size - 2);
23195
23579
  var _pos5 = 0;
23196
- for (var _i5 = lastIdx; _i5 <= currSeg.idx; _i5++) children[_i5].attribute[main.field] = _pos5 + getPadding(children[_i5], main.field), _pos5 += mianLenArray[_i5].mainLen + 2 * _padding2;
23580
+ for (var _i5 = lastIdx; _i5 <= currSeg.idx; _i5++) {
23581
+ var _posBaseLeftTop5 = _pos5 + getPadding(children[_i5], main.field),
23582
+ _b5 = this.getAABBBounds(children[_i5]);
23583
+ !_b5.empty() && (children[_i5].attribute[main.field] = this.updateChildPos(_posBaseLeftTop5, children[_i5].attribute[main.field], _b5["".concat(main.field, "1")])), _pos5 += mianLenArray[_i5].mainLen + 2 * _padding2;
23584
+ }
23197
23585
  }
23198
23586
  } else if ("center" === justifyContent) {
23199
23587
  var _pos6 = (main.len - currSeg.mainLen) / 2;
23200
- for (var _i6 = lastIdx; _i6 <= currSeg.idx; _i6++) children[_i6].attribute[main.field] = _pos6 + getPadding(children[_i6], main.field), _pos6 += mianLenArray[_i6].mainLen;
23588
+ for (var _i6 = lastIdx; _i6 <= currSeg.idx; _i6++) {
23589
+ var _posBaseLeftTop6 = _pos6 + getPadding(children[_i6], main.field),
23590
+ _b6 = this.getAABBBounds(children[_i6]);
23591
+ !_b6.empty() && (children[_i6].attribute[main.field] = this.updateChildPos(_posBaseLeftTop6, children[_i6].attribute[main.field], _b6["".concat(main.field, "1")])), _pos6 += mianLenArray[_i6].mainLen;
23592
+ }
23201
23593
  }
23202
23594
  }
23203
23595
  }, {
23204
23596
  key: "layoutCross",
23205
- value: function layoutCross(children, alignItem, cross, anchorPos, lenArray, currSeg, lastIdx) {
23206
- if ("flex-end" === alignItem) for (var i = lastIdx; i <= currSeg.idx; i++) children[i].attribute[cross.field] = anchorPos - lenArray[i].crossLen + getPadding(children[i], cross.field);else if ("center" === alignItem) for (var _i7 = lastIdx; _i7 <= currSeg.idx; _i7++) children[_i7].attribute[cross.field] = anchorPos - lenArray[_i7].crossLen / 2 + getPadding(children[_i7], cross.field);else for (var _i8 = lastIdx; _i8 <= currSeg.idx; _i8++) children[_i8].attribute[cross.field] = anchorPos + getPadding(children[_i8], cross.field);
23597
+ value: function layoutCross(children, alignItem, cross, anchorPosMap, lenArray, currSeg, lastIdx) {
23598
+ var _a;
23599
+ for (var i = lastIdx; i <= currSeg.idx; i++) {
23600
+ var child = children[i];
23601
+ var alignSelf = child.attribute.alignSelf;
23602
+ alignSelf && "auto" !== alignSelf || (alignSelf = alignItem);
23603
+ var b = this.getAABBBounds(child),
23604
+ anchorPos = null !== (_a = anchorPosMap[alignSelf]) && void 0 !== _a ? _a : anchorPosMap["flex-start"];
23605
+ "flex-end" === alignSelf ? !b.empty() && (child.attribute[cross.field] = this.updateChildPos(anchorPos - lenArray[i].crossLen + getPadding(child, cross.field), child.attribute[cross.field], b["".concat(cross.field, "1")])) : "center" === alignSelf ? !b.empty() && (child.attribute[cross.field] = this.updateChildPos(anchorPos - lenArray[i].crossLen / 2 + getPadding(child, cross.field), child.attribute[cross.field], b["".concat(cross.field, "1")])) : !b.empty() && (child.attribute[cross.field] = this.updateChildPos(anchorPos + getPadding(child, cross.field), child.attribute[cross.field], b["".concat(cross.field, "1")]));
23606
+ }
23207
23607
  }
23208
23608
  }, {
23209
23609
  key: "activate",
23210
23610
  value: function activate(context) {
23211
23611
  var _this2 = this;
23212
23612
  this.pluginService = context, application.graphicService.hooks.onAttributeUpdate.tap(this.key, function (graphic) {
23213
- graphic.glyphHost && (graphic = graphic.glyphHost), _this2.tryLayout(graphic), _this2.layouting = !1;
23613
+ graphic.glyphHost && (graphic = graphic.glyphHost), graphic.stage && graphic.stage === _this2.pluginService.stage && _this2.tryLayout(graphic, !1);
23214
23614
  }), application.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key, function (graphic, stage, willUpdate, bounds) {
23215
- graphic.glyphHost && (graphic = graphic.glyphHost), stage && stage === _this2.pluginService.stage && graphic.isContainer && _tempBounds.copy(bounds);
23615
+ graphic.glyphHost && (graphic = graphic.glyphHost), stage && stage === _this2.pluginService.stage && graphic.isContainer && !_this2.skipBoundsTrigger && _tempBounds.copy(bounds);
23216
23616
  }), application.graphicService.hooks.afterUpdateAABBBounds.tap(this.key, function (graphic, stage, bounds, params, selfChange) {
23217
- stage && stage === _this2.pluginService.stage && graphic.isContainer && (_tempBounds.equals(bounds) || (_this2.tryLayout(graphic), _this2.layouting = !1));
23617
+ stage && stage === _this2.pluginService.stage && graphic.isContainer && !_this2.skipBoundsTrigger && (_tempBounds.equals(bounds) || _this2.tryLayout(graphic, !1));
23218
23618
  }), application.graphicService.hooks.onSetStage.tap(this.key, function (graphic) {
23219
- graphic.glyphHost && (graphic = graphic.glyphHost), _this2.tryLayout(graphic), _this2.layouting = !1;
23619
+ graphic.glyphHost && (graphic = graphic.glyphHost), _this2.tryLayout(graphic, !1);
23220
23620
  });
23221
23621
  }
23222
23622
  }, {
@@ -23225,6 +23625,10 @@
23225
23625
  var _this3 = this;
23226
23626
  application.graphicService.hooks.onAttributeUpdate.taps = application.graphicService.hooks.onAttributeUpdate.taps.filter(function (item) {
23227
23627
  return item.name !== _this3.key;
23628
+ }), application.graphicService.hooks.beforeUpdateAABBBounds.taps = application.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(function (item) {
23629
+ return item.name !== _this3.key;
23630
+ }), application.graphicService.hooks.afterUpdateAABBBounds.taps = application.graphicService.hooks.afterUpdateAABBBounds.taps.filter(function (item) {
23631
+ return item.name !== _this3.key;
23228
23632
  }), application.graphicService.hooks.onSetStage.taps = application.graphicService.hooks.onSetStage.taps.filter(function (item) {
23229
23633
  return item.name !== _this3.key;
23230
23634
  });
@@ -23233,11 +23637,7 @@
23233
23637
  return FlexLayoutPlugin;
23234
23638
  }();
23235
23639
  function getPadding(graphic, field) {
23236
- if (!graphic.attribute.boundsPadding) return 0;
23237
- if (isNumber(graphic.attribute.boundsPadding)) return graphic.attribute.boundsPadding;
23238
- if (isArray$1(graphic.attribute.boundsPadding) && 1 === graphic.attribute.boundsPadding.length) return graphic.attribute.boundsPadding[0];
23239
- var paddingArray = parsePadding(graphic.attribute.boundsPadding);
23240
- return "x" === field ? paddingArray[3] : "y" === field ? paddingArray[0] : 0;
23640
+ return 0;
23241
23641
  }
23242
23642
 
23243
23643
  var defaultTicker = new DefaultTicker();
@@ -23401,24 +23801,21 @@
23401
23801
 
23402
23802
  var _isBrowserEnv;
23403
23803
  function initIsBrowserEnv() {
23404
- if (null == _isBrowserEnv) {
23405
- try {
23406
- _isBrowserEnv = !!window;
23407
- } catch (err) {
23408
- _isBrowserEnv = !1;
23409
- }
23410
- if (_isBrowserEnv) try {
23411
- _isBrowserEnv = !tt;
23412
- } catch (err) {
23413
- _isBrowserEnv = !0;
23414
- }
23804
+ if (null == _isBrowserEnv) try {
23805
+ _isBrowserEnv = globalThis === window, _isBrowserEnv && (_isBrowserEnv = !!document.createElement);
23806
+ } catch (err) {
23807
+ _isBrowserEnv = !1;
23415
23808
  }
23416
23809
  }
23417
23810
  function isBrowserEnv() {
23418
- return initIsBrowserEnv(), _isBrowserEnv;
23811
+ initIsBrowserEnv();
23812
+ var env = application.global && application.global.env;
23813
+ return env ? "browser" === env : _isBrowserEnv;
23419
23814
  }
23420
23815
  function isNodeEnv() {
23421
- return initIsBrowserEnv(), !_isBrowserEnv;
23816
+ initIsBrowserEnv();
23817
+ var env = application.global && application.global.env;
23818
+ return env ? "node" === env : !_isBrowserEnv;
23422
23819
  }
23423
23820
  function getCurrentEnv() {
23424
23821
  return isBrowserEnv() ? "browser" : "node";
@@ -23556,6 +23953,8 @@
23556
23953
  resolution: this.window.dpr || this.global.devicePixelRatio,
23557
23954
  rootNode: this,
23558
23955
  global: this.global,
23956
+ supportsPointerEvents: this.params.supportsPointerEvents,
23957
+ supportsTouchEvents: this.params.supportsTouchEvents,
23559
23958
  viewport: {
23560
23959
  viewBox: this._viewBox,
23561
23960
  get x() {
@@ -23762,6 +24161,11 @@
23762
24161
  _this7.pluginService.unRegister(plugin);
23763
24162
  }));
23764
24163
  }
24164
+ }, {
24165
+ key: "getPluginsByName",
24166
+ value: function getPluginsByName(name) {
24167
+ return this.pluginService.findPluginsByName(name);
24168
+ }
23765
24169
  }, {
23766
24170
  key: "tryUpdateAABBBounds",
23767
24171
  value: function tryUpdateAABBBounds() {
@@ -23800,7 +24204,7 @@
23800
24204
  }, {
23801
24205
  key: "tryInitInteractiveLayer",
23802
24206
  value: function tryInitInteractiveLayer() {
23803
- this.supportInteractiveLayer && !this.interactiveLayer && (this.interactiveLayer = this.createLayer(), this.interactiveLayer.name = "_builtin_interactive", this.nextFrameRenderLayerSet.add(this.interactiveLayer));
24207
+ this.supportInteractiveLayer && !this.interactiveLayer && (this.interactiveLayer = this.createLayer(), this.interactiveLayer.name = "_builtin_interactive", this.interactiveLayer.attribute.pickable = !1, this.nextFrameRenderLayerSet.add(this.interactiveLayer));
23804
24208
  }
23805
24209
  }, {
23806
24210
  key: "clearViewBox",
@@ -23812,7 +24216,7 @@
23812
24216
  value: function render(layers, params) {
23813
24217
  this.ticker.start(), this.timeline.resume();
23814
24218
  var state = this.state;
23815
- this.state = "rendering", this.layerService.prepareStageLayer(this), this._skipRender || (this.lastRenderparams = params, this.hooks.beforeRender.call(this), this.renderLayerList(this.children), this.combineLayersToWindow(), this.nextFrameRenderLayerSet.clear(), this.hooks.afterRender.call(this)), this.state = state, this._skipRender && this._skipRender++;
24219
+ this.state = "rendering", this.layerService.prepareStageLayer(this), this._skipRender || (this.lastRenderparams = params, this.hooks.beforeRender.call(this), this.renderLayerList(this.children, params), this.combineLayersToWindow(), this.nextFrameRenderLayerSet.clear(), this.hooks.afterRender.call(this)), this.state = state, this._skipRender && this._skipRender++;
23816
24220
  }
23817
24221
  }, {
23818
24222
  key: "combineLayersToWindow",
@@ -23849,7 +24253,8 @@
23849
24253
  background: layer === _this10.defaultLayer ? _this10.background : void 0,
23850
24254
  updateBounds: !(!_this10.dirtyBounds || _this10.dirtyBounds.empty())
23851
24255
  }, Object.assign({
23852
- renderStyle: _this10.renderStyle
24256
+ renderStyle: _this10.renderStyle,
24257
+ keepMatrix: _this10.params.renderKeepMatrix
23853
24258
  }, params)));
23854
24259
  }), this.interactiveLayer && !layerList.includes(this.interactiveLayer) && this.interactiveLayer.render({
23855
24260
  renderService: this.renderService,
@@ -24751,11 +25156,17 @@
24751
25156
  if (!params.bounds.contains(point.x, point.y)) return result;
24752
25157
  offsetX = params.bounds.x1, offsetY = params.bounds.y1;
24753
25158
  }
24754
- this.pickContext && (this.pickContext.inuse = !0), params.pickContext = this.pickContext, this.pickContext && this.pickContext.clearMatrix(!0, 1);
25159
+ if (this.pickContext) if (params.keepMatrix) {
25160
+ if (this.pickContext.nativeContext && this.pickContext.nativeContext.getTransform) {
25161
+ var t = this.pickContext.nativeContext.getTransform();
25162
+ this.pickContext.setTransformFromMatrix(t, !0, 1);
25163
+ }
25164
+ } else this.pickContext.inuse = !0, this.pickContext.clearMatrix(!0, 1);
25165
+ params.pickContext = this.pickContext;
24755
25166
  var parentMatrix = new Matrix(1, 0, 0, 1, offsetX, offsetY);
24756
25167
  var group;
24757
25168
  for (var i = graphics.length - 1; i >= 0 && (result = graphics[i].isContainer ? this.pickGroup(graphics[i], point, parentMatrix, params) : this.pickItem(graphics[i], point, parentMatrix, params), !result.graphic); i--) group || (group = result.group);
24758
- if (result.graphic || (result.group = group), this.pickContext && (this.pickContext.inuse = !1), result.graphic) {
25169
+ if (result.graphic || (result.group = group), this.pickContext && !params.keepMatrix && (this.pickContext.inuse = !1), result.graphic) {
24759
25170
  var g = result.graphic;
24760
25171
  for (; g.parent;) g = g.parent;
24761
25172
  g.shadowHost && (result.params = {
@@ -24938,6 +25349,38 @@
24938
25349
  }();
24939
25350
  exports.DefaultGlobalPickerService = __decorate$12([injectable(), __metadata$O("design:paramtypes", [])], exports.DefaultGlobalPickerService);
24940
25351
 
25352
+ function simplifyRadialDist(points, sqTolerance) {
25353
+ var deltaX,
25354
+ deltaY,
25355
+ lastX = points[0].x,
25356
+ lastY = points[0].y;
25357
+ var newPoints = [points[0]];
25358
+ for (var i = 1, len = points.length; i < len; i++) deltaX = points[i].x - lastX, deltaY = points[i].y - lastY, deltaX * deltaX + deltaY * deltaY > sqTolerance && (lastX = points[i].x, lastY = points[i].y, newPoints.push(points[i]));
25359
+ return points[points.length - 1].x === lastX && points[points.length - 1].y === lastY || newPoints.push(points[points.length - 1]), newPoints;
25360
+ }
25361
+ function simplifyDPStep(points, startIdx, endIdx, sqTolerance, simplified) {
25362
+ var maxSqDist = sqTolerance,
25363
+ nextIdx = startIdx;
25364
+ var startX = points[startIdx].x,
25365
+ startY = points[startIdx].y,
25366
+ vecX2 = points[endIdx].x - startX,
25367
+ vecY2 = points[endIdx].y - startY,
25368
+ sqLength = vecX2 * vecX2 + vecY2 * vecY2;
25369
+ var area, sqArea, sqDistance, vecX1, vecY1;
25370
+ for (var i = startIdx + 1, len = endIdx - 1; i < len; i++) vecX1 = points[i].x - startX, vecY1 = points[i].y - startY, area = vecX1 * vecY2 - vecX2 * vecY1, sqArea = area * area, sqDistance = sqArea / sqLength, sqDistance > maxSqDist && (maxSqDist = sqDistance, nextIdx = i);
25371
+ maxSqDist > sqTolerance && (nextIdx - startIdx > 2 && simplifyDPStep(points, startIdx, nextIdx, sqTolerance, simplified), simplified.push(points[nextIdx], points[nextIdx + 1]), endIdx - nextIdx > 2 && simplifyDPStep(points, nextIdx, endIdx, sqTolerance, simplified));
25372
+ }
25373
+ function simplifyDouglasPeucker(points, sqTolerance) {
25374
+ var lastIdx = points.length - 1,
25375
+ simplified = [points[0]];
25376
+ return simplifyDPStep(points, 0, lastIdx, sqTolerance, simplified), simplified.push(points[lastIdx]), simplified;
25377
+ }
25378
+ function flatten_simplify(points, tolerance, highestQuality) {
25379
+ if (points.length <= 10) return points;
25380
+ var sqTolerance = void 0 !== tolerance ? tolerance * tolerance : 1;
25381
+ return points = simplifyDouglasPeucker(points = highestQuality ? points : simplifyRadialDist(points, sqTolerance), sqTolerance);
25382
+ }
25383
+
24941
25384
  var DefaultGraphicAllocate = /*#__PURE__*/function () {
24942
25385
  function DefaultGraphicAllocate() {
24943
25386
  _classCallCheck(this, DefaultGraphicAllocate);
@@ -26685,7 +27128,7 @@
26685
27128
  ops: I(t, e, s, n, a)
26686
27129
  };
26687
27130
  }
26688
- function m(t, e, s) {
27131
+ function m$2(t, e, s) {
26689
27132
  var n = (t || []).length;
26690
27133
  if (n > 2) {
26691
27134
  var _a5 = [];
@@ -26702,7 +27145,7 @@
26702
27145
  }
26703
27146
  function w(t, e, s, n, a) {
26704
27147
  return function (t, e) {
26705
- return m(t, !0, e);
27148
+ return m$2(t, !0, e);
26706
27149
  }([[t, e], [t + s, e], [t + s, e + n], [t, e + n]], a);
26707
27150
  }
26708
27151
  function x(t, e) {
@@ -27138,7 +27581,7 @@
27138
27581
  key: "linearPath",
27139
27582
  value: function linearPath(t, e) {
27140
27583
  var s = this._o(e);
27141
- return this._d("linearPath", [m(t, !1, s)], s);
27584
+ return this._d("linearPath", [m$2(t, !1, s)], s);
27142
27585
  }
27143
27586
  }, {
27144
27587
  key: "arc",
@@ -27205,7 +27648,7 @@
27205
27648
  value: function polygon(t, e) {
27206
27649
  var s = this._o(e),
27207
27650
  n = [],
27208
- a = m(t, !0, s);
27651
+ a = m$2(t, !0, s);
27209
27652
  return s.fill && ("solid" === s.fillStyle ? n.push(S([t], s)) : n.push(L([t], s))), s.stroke !== H && n.push(a), this._d("polygon", n, s);
27210
27653
  }
27211
27654
  }, {
@@ -27271,7 +27714,7 @@
27271
27714
  return l;
27272
27715
  }(t, 1, h ? 4 - 4 * s.simplification : (1 + s.roughness) / 2);
27273
27716
  return a && ("solid" === s.fillStyle ? n.push(S(r, s)) : n.push(L(r, s))), o && (h ? r.forEach(function (t) {
27274
- n.push(m(t, !1, s));
27717
+ n.push(m$2(t, !1, s));
27275
27718
  }) : n.push(function (t, e) {
27276
27719
  var s = g(d(f(t))),
27277
27720
  n = [];
@@ -28664,9 +29107,9 @@
28664
29107
  }
28665
29108
  children.length && flatten(1 === children.length ? children[0] : children, childrenList);
28666
29109
  var g = "Group" === c.name ? new c(attribute) : c(config);
28667
- return parseToGraphic(g, childrenList, props), stateProxy && (g.stateProxy = stateProxy), g;
29110
+ return parseToGraphic$1(g, childrenList, props), stateProxy && (g.stateProxy = stateProxy), g;
28668
29111
  }
28669
- function parseToGraphic(g, childrenList, props) {
29112
+ function parseToGraphic$1(g, childrenList, props) {
28670
29113
  var out,
28671
29114
  isGraphic = !1;
28672
29115
  switch (g.type) {
@@ -28692,6 +29135,47 @@
28692
29135
  }
28693
29136
  var Fragment = Group;
28694
29137
 
29138
+ function decodeReactDom(dom) {
29139
+ if (!dom || !dom.$$typeof) return dom;
29140
+ var type = dom.type,
29141
+ _dom$props = dom.props,
29142
+ attribute = _dom$props.attribute,
29143
+ children = _dom$props.children,
29144
+ stateProxy = _dom$props.stateProxy,
29145
+ g = type({
29146
+ attribute: attribute
29147
+ }),
29148
+ out = parseToGraphic(g, dom.props, children);
29149
+ return out || (stateProxy && (g.stateProxy = stateProxy), g.id = attribute.id, g.name = attribute.name, isArray$1(children) ? children.forEach(function (item) {
29150
+ var c = decodeReactDom(item);
29151
+ c && c.type && g.add(c);
29152
+ }) : children && g.add(decodeReactDom(children)), g);
29153
+ }
29154
+ function parseToGraphic(g, props, childrenList) {
29155
+ var out,
29156
+ isGraphic = !1;
29157
+ switch (g.type) {
29158
+ case "richtext":
29159
+ break;
29160
+ case "rich/text":
29161
+ out = g.attribute || {}, childrenList && (out.text = childrenList), g.attribute = out;
29162
+ break;
29163
+ case "rich/image":
29164
+ out = g.attribute || {};
29165
+ break;
29166
+ default:
29167
+ isGraphic = !0;
29168
+ }
29169
+ return isGraphic ? Object.keys(props).forEach(function (k) {
29170
+ var en = REACT_TO_CANOPUS_EVENTS[k];
29171
+ en && g.on(en, props[k]);
29172
+ }) : "richtext" === g.type && (g.attribute.textConfig = childrenList.map(function (item) {
29173
+ return decodeReactDom(item);
29174
+ }).filter(function (item) {
29175
+ return item;
29176
+ })), out;
29177
+ }
29178
+
28695
29179
  var DragNDrop = /*#__PURE__*/function () {
28696
29180
  function DragNDrop(rootNode) {
28697
29181
  var _this = this;
@@ -29919,10 +30403,11 @@
29919
30403
  }();
29920
30404
  DefaultCanvasGroupPicker = __decorate$O([injectable()], DefaultCanvasGroupPicker);
29921
30405
 
29922
- var loaded$q = !1;
29923
- var canvasModule = new ContainerModule(function (bind, unbind, isBound, rebind) {
29924
- loaded$q || (loaded$q = !0, bind(CanvasGroupPicker).to(DefaultCanvasGroupPicker).inSingletonScope(), bind(CanvasPickerContribution).toService(CanvasGroupPicker), bindContributionProvider(bind, CanvasPickerContribution));
30406
+ var m$1 = new ContainerModule(function (bind, unbind, isBound, rebind) {
30407
+ m$1.__vloaded || (m$1.__vloaded = !0, bind(CanvasGroupPicker).to(DefaultCanvasGroupPicker).inSingletonScope(), bind(CanvasPickerContribution).toService(CanvasGroupPicker), bindContributionProvider(bind, CanvasPickerContribution));
29925
30408
  });
30409
+ m$1.__vloaded = !1;
30410
+ var canvasModule = m$1;
29926
30411
 
29927
30412
  var canvasPickerModule = new ContainerModule(function (bind, unbind, isBound, rebind) {
29928
30413
  isBound(DefaultCanvasPickerService) || bind(DefaultCanvasPickerService).toSelf().inSingletonScope(), isBound(PickerService) ? rebind(PickerService).toService(DefaultCanvasPickerService) : bind(PickerService).toService(DefaultCanvasPickerService);
@@ -30269,7 +30754,7 @@
30269
30754
  key: "getNativeAABBBounds",
30270
30755
  value: function getNativeAABBBounds(_dom) {
30271
30756
  var dom = _dom;
30272
- if ("string" == typeof _dom && (dom = new DOMParser().parseFromString(_dom, "text/html").firstChild), dom.getBoundingClientRect) {
30757
+ if ("string" == typeof _dom && (dom = new DOMParser().parseFromString(_dom, "text/html").firstChild, dom.lastChild && (dom = dom.lastChild.firstChild)), dom.getBoundingClientRect) {
30273
30758
  var b = dom.getBoundingClientRect();
30274
30759
  return new DynamicB(b);
30275
30760
  }
@@ -30431,15 +30916,15 @@
30431
30916
  }(exports.BaseEnvContribution);
30432
30917
  BrowserEnvContribution = __decorate$M([injectable(), __metadata$D("design:paramtypes", [])], BrowserEnvContribution);
30433
30918
 
30434
- var isBrowserBound = !1;
30435
30919
  var browserEnvModule = new ContainerModule(function (bind) {
30436
- isBrowserBound || (isBrowserBound = !0, bind(BrowserEnvContribution).toSelf().inSingletonScope(), bind(EnvContribution).toService(BrowserEnvContribution));
30920
+ browserEnvModule.isBrowserBound || (browserEnvModule.isBrowserBound = !0, bind(BrowserEnvContribution).toSelf().inSingletonScope(), bind(EnvContribution).toService(BrowserEnvContribution));
30437
30921
  });
30438
- var loaded$p = !1;
30922
+ browserEnvModule.isBrowserBound = !1;
30439
30923
  function loadBrowserEnv(container) {
30440
30924
  var loadPicker = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
30441
- loaded$p || (loaded$p = !0, container.load(browserEnvModule), container.load(browserCanvasModule), container.load(browserWindowModule), loadPicker && loadCanvasPicker(container));
30925
+ loadBrowserEnv.__loaded || (loadBrowserEnv.__loaded = !0, container.load(browserEnvModule), container.load(browserCanvasModule), container.load(browserWindowModule), loadPicker && loadCanvasPicker(container));
30442
30926
  }
30927
+ loadBrowserEnv.__loaded = !1;
30443
30928
  function initBrowserEnv() {
30444
30929
  loadBrowserEnv(container);
30445
30930
  }
@@ -30804,10 +31289,11 @@
30804
31289
  }(exports.DefaultPickService);
30805
31290
  DefaultMathPickerService = __decorate$I([injectable(), __param$r(0, inject(ContributionProvider)), __param$r(0, named(MathPickerContribution)), __param$r(1, inject(ContributionProvider)), __param$r(1, named(PickItemInterceptor)), __metadata$A("design:paramtypes", [Object, Object])], DefaultMathPickerService);
30806
31291
 
30807
- var loaded$o = !1;
30808
- var mathModule = new ContainerModule(function (bind) {
30809
- loaded$o || (loaded$o = !0, bindContributionProvider(bind, MathPickerContribution));
31292
+ var m = new ContainerModule(function (bind) {
31293
+ m.__vloaded || (m.__vloaded = !0, bindContributionProvider(bind, MathPickerContribution));
30810
31294
  });
31295
+ m.__vloaded = !1;
31296
+ var mathModule = m;
30811
31297
 
30812
31298
  var mathPickerModule = new ContainerModule(function (bind, unbind, isBound, rebind) {
30813
31299
  isBound(DefaultMathPickerService) || bind(DefaultMathPickerService).toSelf().inSingletonScope(), isBound(PickerService) ? rebind(PickerService).toService(DefaultMathPickerService) : bind(PickerService).toService(DefaultMathPickerService);
@@ -30816,6 +31302,105 @@
30816
31302
  c.load(mathModule), c.load(mathPickerModule);
30817
31303
  }
30818
31304
 
31305
+ var CanvasWrapDisableWH = /*#__PURE__*/function () {
31306
+ function CanvasWrapDisableWH(nativeCanvas, ctx, dpr, w, h, id) {
31307
+ _classCallCheck(this, CanvasWrapDisableWH);
31308
+ this.nativeCanvas = nativeCanvas, this.ctx = ctx, this._w = w, this._h = h, this.id = id, nativeCanvas.id = id, this.dpr = dpr;
31309
+ }
31310
+ _createClass(CanvasWrapDisableWH, [{
31311
+ key: "width",
31312
+ get: function get() {
31313
+ return this._w * this.dpr;
31314
+ },
31315
+ set: function set(w) {}
31316
+ }, {
31317
+ key: "height",
31318
+ get: function get() {
31319
+ return this._h * this.dpr;
31320
+ },
31321
+ set: function set(h) {}
31322
+ }, {
31323
+ key: "offsetWidth",
31324
+ get: function get() {
31325
+ return this._w;
31326
+ },
31327
+ set: function set(w) {}
31328
+ }, {
31329
+ key: "offsetHeight",
31330
+ get: function get() {
31331
+ return this._h;
31332
+ },
31333
+ set: function set(h) {}
31334
+ }, {
31335
+ key: "getContext",
31336
+ value: function getContext() {
31337
+ return this.ctx;
31338
+ }
31339
+ }, {
31340
+ key: "getBoundingClientRect",
31341
+ value: function getBoundingClientRect() {
31342
+ return {
31343
+ width: this._w,
31344
+ height: this._h
31345
+ };
31346
+ }
31347
+ }]);
31348
+ return CanvasWrapDisableWH;
31349
+ }();
31350
+ var CanvasWrapEnableWH = /*#__PURE__*/function () {
31351
+ function CanvasWrapEnableWH(nativeCanvas, ctx, dpr, w, h, id) {
31352
+ _classCallCheck(this, CanvasWrapEnableWH);
31353
+ this.nativeCanvas = nativeCanvas, this.ctx = ctx, this._w = w, this._h = h, this.id = id, nativeCanvas.id = id, this.dpr = dpr;
31354
+ }
31355
+ _createClass(CanvasWrapEnableWH, [{
31356
+ key: "width",
31357
+ get: function get() {
31358
+ return this._w * this.dpr;
31359
+ },
31360
+ set: function set(w) {
31361
+ this._w = w / this.dpr, this.nativeCanvas.width = w;
31362
+ }
31363
+ }, {
31364
+ key: "height",
31365
+ get: function get() {
31366
+ return this._h * this.dpr;
31367
+ },
31368
+ set: function set(h) {
31369
+ this._h = h / this.dpr, this.nativeCanvas.height = h;
31370
+ }
31371
+ }, {
31372
+ key: "offsetWidth",
31373
+ get: function get() {
31374
+ return this._w;
31375
+ },
31376
+ set: function set(w) {
31377
+ this._w = w, this.nativeCanvas.width = w * this.dpr;
31378
+ }
31379
+ }, {
31380
+ key: "offsetHeight",
31381
+ get: function get() {
31382
+ return this._h;
31383
+ },
31384
+ set: function set(h) {
31385
+ this._h = h, this.nativeCanvas.height = h * this.dpr;
31386
+ }
31387
+ }, {
31388
+ key: "getContext",
31389
+ value: function getContext() {
31390
+ return this.ctx;
31391
+ }
31392
+ }, {
31393
+ key: "getBoundingClientRect",
31394
+ value: function getBoundingClientRect() {
31395
+ return {
31396
+ width: this._w,
31397
+ height: this._h
31398
+ };
31399
+ }
31400
+ }]);
31401
+ return CanvasWrapEnableWH;
31402
+ }();
31403
+
30819
31404
  var __decorate$H = undefined && undefined.__decorate || function (decorators, target, key, desc) {
30820
31405
  var d,
30821
31406
  c = arguments.length,
@@ -30826,31 +31411,12 @@
30826
31411
  __metadata$z = undefined && undefined.__metadata || function (k, v) {
30827
31412
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
30828
31413
  };
30829
- function makeUpCanvas$3(domref, canvasIdLists, canvasMap, freeCanvasIdx, freeCanvasList) {
30830
- var dpr = tt.getSystemInfoSync().pixelRatio;
31414
+ function makeUpCanvas$3(domref, canvasIdLists, canvasMap, freeCanvasIdx, freeCanvasList, pixelRatio) {
31415
+ var dpr = null != pixelRatio ? pixelRatio : tt.getSystemInfoSync().pixelRatio;
30831
31416
  canvasIdLists.forEach(function (id, i) {
30832
- var ctx = tt.createCanvasContext(id);
30833
- ctx.canvas = {
30834
- width: domref.width * dpr,
30835
- height: domref.height * dpr
30836
- };
30837
- var canvas = {
30838
- width: domref.width * dpr,
30839
- height: domref.height * dpr,
30840
- offsetWidth: domref.width,
30841
- offsetHeight: domref.height,
30842
- id: null != id ? id : "",
30843
- getContext: function getContext() {
30844
- return ctx;
30845
- },
30846
- getBoundingClientRect: function getBoundingClientRect() {
30847
- return {
30848
- height: domref.height,
30849
- width: domref.width
30850
- };
30851
- }
30852
- };
30853
- canvasMap.set(id, canvas), i >= freeCanvasIdx && freeCanvasList.push(canvas);
31417
+ var ctx = tt.createCanvasContext(id),
31418
+ canvas = new CanvasWrapDisableWH(ctx.canvas || {}, ctx, dpr, domref.width, domref.height, id);
31419
+ ctx.canvas = canvas, canvasMap.set(id, canvas), i >= freeCanvasIdx && freeCanvasList.push(canvas);
30854
31420
  });
30855
31421
  }
30856
31422
  var FeishuEnvContribution = /*#__PURE__*/function (_BaseEnvContribution) {
@@ -30881,7 +31447,7 @@
30881
31447
  }, {
30882
31448
  key: "configure",
30883
31449
  value: function configure(service, params) {
30884
- service.env === this.type && (service.setActiveEnvContribution(this), makeUpCanvas$3(params.domref, params.canvasIdLists, this.canvasMap, params.freeCanvasIdx, this.freeCanvasList));
31450
+ service.env === this.type && (service.setActiveEnvContribution(this), makeUpCanvas$3(params.domref, params.canvasIdLists, this.canvasMap, params.freeCanvasIdx, this.freeCanvasList, params.pixelRatio));
30885
31451
  }
30886
31452
  }, {
30887
31453
  key: "loadImage",
@@ -30971,15 +31537,15 @@
30971
31537
  }(exports.BaseEnvContribution);
30972
31538
  FeishuEnvContribution = __decorate$H([injectable(), __metadata$z("design:paramtypes", [])], FeishuEnvContribution);
30973
31539
 
30974
- var isFeishuBound = !1;
30975
31540
  var feishuEnvModule = new ContainerModule(function (bind) {
30976
- isFeishuBound || (isFeishuBound = !0, bind(FeishuEnvContribution).toSelf().inSingletonScope(), bind(EnvContribution).toService(FeishuEnvContribution));
31541
+ feishuEnvModule.isFeishuBound || (feishuEnvModule.isFeishuBound = !0, bind(FeishuEnvContribution).toSelf().inSingletonScope(), bind(EnvContribution).toService(FeishuEnvContribution));
30977
31542
  });
30978
- var loaded$n = !1;
31543
+ feishuEnvModule.isFeishuBound = !1;
30979
31544
  function loadFeishuEnv(container) {
30980
31545
  var loadPicker = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
30981
- loaded$n || (loaded$n = !0, container.load(feishuEnvModule), container.load(feishuCanvasModule), container.load(feishuWindowModule), loadPicker && loadMathPicker(container));
31546
+ loadFeishuEnv.__loaded || (loadFeishuEnv.__loaded = !0, container.load(feishuEnvModule), container.load(feishuCanvasModule), container.load(feishuWindowModule), loadPicker && loadMathPicker(container));
30982
31547
  }
31548
+ loadFeishuEnv.__loaded = !1;
30983
31549
  function initFeishuEnv() {
30984
31550
  loadFeishuEnv(container);
30985
31551
  }
@@ -31059,11 +31625,11 @@
31059
31625
  value: function draw() {
31060
31626
  var _this = this;
31061
31627
  var _context = this.nativeContext;
31062
- this.drawPromise = new Promise(function (resolve) {
31628
+ _context.draw && (this.drawPromise = new Promise(function (resolve) {
31063
31629
  _context.draw(!0, function () {
31064
31630
  _this.drawPromise = null, resolve(null);
31065
31631
  });
31066
- });
31632
+ }));
31067
31633
  }
31068
31634
  }]);
31069
31635
  return LynxContext2d;
@@ -31332,32 +31898,13 @@
31332
31898
  try {
31333
31899
  ng = !!lynx.createCanvasNG;
31334
31900
  } catch (err) {}
31335
- function makeUpCanvas$2(domref, canvasIdLists, canvasMap, freeCanvasIdx, freeCanvasList) {
31336
- var dpr = SystemInfo.pixelRatio;
31901
+ function makeUpCanvas$2(domref, canvasIdLists, canvasMap, freeCanvasIdx, freeCanvasList, pixelRatio) {
31902
+ var dpr = null != pixelRatio ? pixelRatio : SystemInfo.pixelRatio;
31337
31903
  canvasIdLists.forEach(function (id, i) {
31338
31904
  var _canvas = ng ? lynx.createCanvasNG(id) : lynx.createCanvas(id);
31339
31905
  _canvas.width = domref.width * dpr, _canvas.height = domref.height * dpr, ng && _canvas.attachToCanvasView(id);
31340
- var ctx = _canvas.getContext("2d");
31341
- ctx.draw = function (a, b) {
31342
- b();
31343
- };
31344
- var canvas = {
31345
- width: domref.width * dpr,
31346
- height: domref.height * dpr,
31347
- offsetWidth: domref.width,
31348
- offsetHeight: domref.height,
31349
- id: null != id ? id : "",
31350
- getContext: function getContext() {
31351
- return ctx;
31352
- },
31353
- getBoundingClientRect: function getBoundingClientRect() {
31354
- return {
31355
- height: domref.height,
31356
- width: domref.width
31357
- };
31358
- },
31359
- nativeCanvas: _canvas
31360
- };
31906
+ var ctx = _canvas.getContext("2d"),
31907
+ canvas = new CanvasWrapEnableWH(_canvas, ctx, dpr, domref.width, domref.height, id);
31361
31908
  canvasMap.set(id, canvas), i >= freeCanvasIdx && freeCanvasList.push(canvas);
31362
31909
  });
31363
31910
  }
@@ -31391,7 +31938,7 @@
31391
31938
  _createClass(LynxEnvContribution, [{
31392
31939
  key: "configure",
31393
31940
  value: function configure(service, params) {
31394
- service.env === this.type && (service.setActiveEnvContribution(this), makeUpCanvas$2(params.domref, params.canvasIdLists, this.canvasMap, params.freeCanvasIdx, this.freeCanvasList));
31941
+ service.env === this.type && (service.setActiveEnvContribution(this), makeUpCanvas$2(params.domref, params.canvasIdLists, this.canvasMap, params.freeCanvasIdx, this.freeCanvasList, params.pixelRatio));
31395
31942
  }
31396
31943
  }, {
31397
31944
  key: "getDynamicCanvasCount",
@@ -31498,15 +32045,15 @@
31498
32045
  }(exports.BaseEnvContribution);
31499
32046
  LynxEnvContribution = __decorate$D([injectable(), __metadata$w("design:paramtypes", [])], LynxEnvContribution);
31500
32047
 
31501
- var isLynxBound = !1;
31502
32048
  var lynxEnvModule = new ContainerModule(function (bind) {
31503
- isLynxBound || (isLynxBound = !0, bind(LynxEnvContribution).toSelf().inSingletonScope(), bind(EnvContribution).toService(LynxEnvContribution));
32049
+ lynxEnvModule.isLynxBound || (lynxEnvModule.isLynxBound = !0, bind(LynxEnvContribution).toSelf().inSingletonScope(), bind(EnvContribution).toService(LynxEnvContribution));
31504
32050
  });
31505
- var loaded$m = !1;
32051
+ lynxEnvModule.isLynxBound = !1;
31506
32052
  function loadLynxEnv(container) {
31507
32053
  var loadPicker = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
31508
- loaded$m || (loaded$m = !0, container.load(lynxEnvModule), container.load(lynxCanvasModule), container.load(lynxWindowModule), loadPicker && loadMathPicker(container));
32054
+ loadLynxEnv.__loaded || (loadLynxEnv.__loaded = !0, container.load(lynxEnvModule), container.load(lynxCanvasModule), container.load(lynxWindowModule), loadPicker && loadMathPicker(container));
31509
32055
  }
32056
+ loadLynxEnv.__loaded = !1;
31510
32057
  function initLynxEnv() {
31511
32058
  loadLynxEnv(container);
31512
32059
  }
@@ -31879,14 +32426,14 @@
31879
32426
  }(exports.BaseEnvContribution);
31880
32427
  NodeEnvContribution = __decorate$z([injectable()], NodeEnvContribution);
31881
32428
 
31882
- var isNodeBound = !1;
31883
32429
  var nodeEnvModule = new ContainerModule(function (bind) {
31884
- isNodeBound || (isNodeBound = !0, bind(NodeEnvContribution).toSelf().inSingletonScope(), bind(EnvContribution).toService(NodeEnvContribution));
32430
+ nodeEnvModule.isNodeBound || (nodeEnvModule.isNodeBound = !0, bind(NodeEnvContribution).toSelf().inSingletonScope(), bind(EnvContribution).toService(NodeEnvContribution));
31885
32431
  });
31886
- var loaded$l = !1;
32432
+ nodeEnvModule.isNodeBound = !1;
31887
32433
  function loadNodeEnv(container) {
31888
- loaded$l || (loaded$l = !0, container.load(nodeEnvModule), container.load(nodeCanvasModule), container.load(nodeWindowModule));
32434
+ loadNodeEnv.__loaded || (loadNodeEnv.__loaded = !0, container.load(nodeEnvModule), container.load(nodeCanvasModule), container.load(nodeWindowModule));
31889
32435
  }
32436
+ loadNodeEnv.__loaded = !1;
31890
32437
  function initNodeEnv() {
31891
32438
  loadNodeEnv(container);
31892
32439
  }
@@ -31983,6 +32530,34 @@
31983
32530
  value: function createPattern(image, repetition) {
31984
32531
  return null;
31985
32532
  }
32533
+ }, {
32534
+ key: "getImageData",
32535
+ value: function getImageData(sx, sy, sw, sh) {
32536
+ var _this = this;
32537
+ var ctx = this.nativeContext,
32538
+ taro = ctx.taro;
32539
+ if (ctx && taro) return !ctx.getImageData && taro.canvasGetImageData ? new Promise(function (resolve, reject) {
32540
+ try {
32541
+ taro.canvasGetImageData({
32542
+ canvasId: _this.canvas.nativeCanvas.id,
32543
+ sx: sx,
32544
+ sy: sy,
32545
+ sw: sw,
32546
+ sh: sh,
32547
+ success: function success(res) {
32548
+ resolve(res);
32549
+ }
32550
+ });
32551
+ } catch (err) {
32552
+ reject(err);
32553
+ }
32554
+ }) : void 0;
32555
+ }
32556
+ }, {
32557
+ key: "createRadialGradient",
32558
+ value: function createRadialGradient(x0, y0, r0, x1, y1, r1) {
32559
+ return this.nativeContext.createCircularGradient && this.nativeContext.createCircularGradient(x0, y0, r0, x1, y1, r1);
32560
+ }
31986
32561
  }]);
31987
32562
  return TaroContext2d;
31988
32563
  }(BrowserContext2d);
@@ -32250,47 +32825,9 @@
32250
32825
  };
32251
32826
  function makeUpCanvas$1(domref, canvasIdLists, canvasMap, freeCanvasIdx, freeCanvasList, taro, dpr) {
32252
32827
  canvasIdLists.forEach(function (id, i) {
32253
- var ctx = taro.createCanvasContext(id);
32254
- ctx.canvas = {
32255
- width: domref.width * dpr,
32256
- height: domref.height * dpr
32257
- }, ctx.createRadialGradient || (ctx.createRadialGradient = function () {
32258
- return ctx.createCircularGradient.apply(ctx, arguments);
32259
- }), !ctx.getImageData && taro.canvasGetImageData && (ctx.getImageData = function (x, y, width, height) {
32260
- return new Promise(function (resolve, reject) {
32261
- try {
32262
- taro.canvasGetImageData({
32263
- canvasId: id,
32264
- x: x,
32265
- y: y,
32266
- width: width,
32267
- height: height,
32268
- success: function success(res) {
32269
- resolve(res);
32270
- }
32271
- });
32272
- } catch (err) {
32273
- reject(err);
32274
- }
32275
- });
32276
- });
32277
- var canvas = {
32278
- id: id,
32279
- width: domref.width * dpr,
32280
- height: domref.height * dpr,
32281
- offsetWidth: domref.width,
32282
- offsetHeight: domref.height,
32283
- getContext: function getContext() {
32284
- return ctx;
32285
- },
32286
- getBoundingClientRect: function getBoundingClientRect() {
32287
- return {
32288
- height: domref.height,
32289
- width: domref.width
32290
- };
32291
- }
32292
- };
32293
- return canvasMap.set(id, canvas), i >= freeCanvasIdx && freeCanvasList.push(canvas), canvas;
32828
+ var ctx = taro.createCanvasContext(id),
32829
+ canvas = new CanvasWrapDisableWH(ctx.canvas || {}, ctx, dpr, domref.width, domref.height, id);
32830
+ return ctx.canvas = canvas, canvasMap.set(id, canvas), i >= freeCanvasIdx && freeCanvasList.push(canvas), canvas;
32294
32831
  });
32295
32832
  }
32296
32833
  var TaroEnvContribution = /*#__PURE__*/function (_BaseEnvContribution) {
@@ -32427,15 +32964,15 @@
32427
32964
  }(exports.BaseEnvContribution);
32428
32965
  TaroEnvContribution = __decorate$v([injectable(), __metadata$q("design:paramtypes", [])], TaroEnvContribution);
32429
32966
 
32430
- var isTaroBound = !1;
32431
32967
  var taroEnvModule = new ContainerModule(function (bind) {
32432
- isTaroBound || (isTaroBound = !0, bind(TaroEnvContribution).toSelf().inSingletonScope(), bind(EnvContribution).toService(TaroEnvContribution));
32968
+ taroEnvModule.isTaroBound || (taroEnvModule.isTaroBound = !0, bind(TaroEnvContribution).toSelf().inSingletonScope(), bind(EnvContribution).toService(TaroEnvContribution));
32433
32969
  });
32434
- var loaded$k = !1;
32970
+ taroEnvModule.isTaroBound = !1;
32435
32971
  function loadTaroEnv(container) {
32436
32972
  var loadPicker = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
32437
- loaded$k || (loaded$k = !0, container.load(taroEnvModule), container.load(taroCanvasModule), container.load(taroWindowModule), loadPicker && loadMathPicker(container));
32973
+ loadTaroEnv.__loaded || (loadTaroEnv.__loaded = !0, container.load(taroEnvModule), container.load(taroCanvasModule), container.load(taroWindowModule), loadPicker && loadMathPicker(container));
32438
32974
  }
32975
+ loadTaroEnv.__loaded = !1;
32439
32976
  function initTaroEnv() {
32440
32977
  loadTaroEnv(container);
32441
32978
  }
@@ -32902,15 +33439,15 @@
32902
33439
  }(exports.BaseEnvContribution);
32903
33440
  WxEnvContribution = __decorate$r([injectable(), __metadata$n("design:paramtypes", [])], WxEnvContribution);
32904
33441
 
32905
- var isWxBound = !1;
32906
33442
  var wxEnvModule = new ContainerModule(function (bind) {
32907
- isWxBound || (isWxBound = !0, bind(WxEnvContribution).toSelf().inSingletonScope(), bind(EnvContribution).toService(WxEnvContribution));
33443
+ wxEnvModule._isWxBound || (wxEnvModule._isWxBound = !0, bind(WxEnvContribution).toSelf().inSingletonScope(), bind(EnvContribution).toService(WxEnvContribution));
32908
33444
  });
32909
- var loaded$j = !1;
33445
+ wxEnvModule._isWxBound = !1;
32910
33446
  function loadWxEnv(container) {
32911
33447
  var loadPicker = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
32912
- loaded$j || (loaded$j = !0, container.load(wxEnvModule), container.load(wxCanvasModule), container.load(wxWindowModule), loadPicker && loadMathPicker(container));
33448
+ loadWxEnv.__loaded || (loadWxEnv.__loaded = !0, container.load(wxEnvModule), container.load(wxCanvasModule), container.load(wxWindowModule), loadPicker && loadMathPicker(container));
32913
33449
  }
33450
+ loadWxEnv.__loaded = !1;
32914
33451
  function initWxEnv() {
32915
33452
  loadWxEnv(container);
32916
33453
  }
@@ -32918,12 +33455,12 @@
32918
33455
  function loadAllEnv(container) {
32919
33456
  loadAllModule(container);
32920
33457
  }
32921
- var loaded$i = !1;
32922
33458
  function loadAllModule(container) {
32923
- loaded$i || (loaded$i = !0, loadBrowserEnv(container, !1), loadFeishuEnv(container, !1), loadLynxEnv(container, !1), loadNodeEnv(container), loadTaroEnv(container, !1), loadWxEnv(container, !1), loadCanvasPicker(container), vglobal.hooks.onSetEnv.tap("loadMathPicker", function (lastEnv, env) {
33459
+ loadAllModule.__loaded || (loadAllModule.__loaded = !0, loadBrowserEnv(container, !1), loadFeishuEnv(container, !1), loadLynxEnv(container, !1), loadNodeEnv(container), loadTaroEnv(container, !1), loadWxEnv(container, !1), loadCanvasPicker(container), vglobal.hooks.onSetEnv.tap("loadMathPicker", function (lastEnv, env) {
32924
33460
  "browser" !== env && loadMathPicker(container);
32925
33461
  }));
32926
33462
  }
33463
+ loadAllModule.__loaded = !1;
32927
33464
  function initAllEnv() {
32928
33465
  loadAllEnv(container);
32929
33466
  }
@@ -33090,7 +33627,7 @@
33090
33627
  x += _point.x, y += _point.y, pickContext.setTransformForCurrent();
33091
33628
  } else x = 0, y = 0, onlyTranslate = !1, pickContext.transformFromMatrix(rect.transMatrix, !0);
33092
33629
  var picked = !0;
33093
- if (!onlyTranslate || rect.shadowRoot || isNumber$2(cornerRadius, !0) && 0 !== cornerRadius || isArray$1(cornerRadius) && cornerRadius.some(function (num) {
33630
+ if (!onlyTranslate || rect.shadowRoot || isNumber$1(cornerRadius, !0) && 0 !== cornerRadius || isArray$1(cornerRadius) && cornerRadius.some(function (num) {
33094
33631
  return 0 !== num;
33095
33632
  })) picked = !1, this.canvasRenderer.drawShape(rect, pickContext, x, y, {}, null, function (context, rectAttribute, themeAttribute) {
33096
33633
  return !!picked || (picked = context.isPointInPath(point.x, point.y), picked);
@@ -33168,7 +33705,7 @@
33168
33705
  x += _point.x, y += _point.y, pickContext.setTransformForCurrent();
33169
33706
  } else x = 0, y = 0, onlyTranslate = !1, pickContext.transformFromMatrix(rect.transMatrix, !0);
33170
33707
  var picked = !0;
33171
- if (!onlyTranslate || isNumber$2(cornerRadius, !0) && 0 !== cornerRadius || isArray$1(cornerRadius) && cornerRadius.some(function (num) {
33708
+ if (!onlyTranslate || isNumber$1(cornerRadius, !0) && 0 !== cornerRadius || isArray$1(cornerRadius) && cornerRadius.some(function (num) {
33172
33709
  return 0 !== num;
33173
33710
  })) picked = !1, this.canvasRenderer.drawShape(rect, pickContext, x, y, {}, null, function (context, rectAttribute, themeAttribute) {
33174
33711
  return !!picked || (picked = context.isPointInPath(point.x, point.y), picked);
@@ -33378,13 +33915,24 @@
33378
33915
  x = _area$attribute$x === void 0 ? areaAttribute.x : _area$attribute$x,
33379
33916
  _area$attribute$y = _area$attribute.y,
33380
33917
  y = _area$attribute$y === void 0 ? areaAttribute.y : _area$attribute$y;
33918
+ var _area$attribute2 = area.attribute,
33919
+ _area$attribute2$fill = _area$attribute2.fillPickable,
33920
+ fillPickable = _area$attribute2$fill === void 0 ? areaAttribute.fillPickable : _area$attribute2$fill,
33921
+ _area$attribute2$stro = _area$attribute2.strokePickable,
33922
+ strokePickable = _area$attribute2$stro === void 0 ? areaAttribute.strokePickable : _area$attribute2$stro;
33381
33923
  if (pickContext.highPerformanceSave(), area.transMatrix.onlyTranslate()) {
33382
33924
  var _point = area.getOffsetXY(areaAttribute);
33383
33925
  x += _point.x, y += _point.y, pickContext.setTransformForCurrent();
33384
33926
  } else x = 0, y = 0, pickContext.transformFromMatrix(area.transMatrix, !0);
33385
33927
  var picked = !1;
33386
33928
  return this.canvasRenderer.drawShape(area, pickContext, x, y, {}, null, function (context) {
33387
- return !!picked || (picked = context.isPointInPath(point.x, point.y), picked);
33929
+ return !!picked || !!fillPickable && (picked = context.isPointInPath(point.x, point.y), picked);
33930
+ }, function (context, areaAttribute, themeAttribute) {
33931
+ if (picked) return !0;
33932
+ if (!strokePickable) return !1;
33933
+ var lineWidth = areaAttribute.lineWidth || themeAttribute.lineWidth,
33934
+ pickStrokeBuffer = areaAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;
33935
+ return pickContext.lineWidth = getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
33388
33936
  }), pickContext.highPerformanceRestore(), picked;
33389
33937
  }
33390
33938
  }]);
@@ -34414,99 +34962,117 @@
34414
34962
 
34415
34963
  var browser = isBrowserEnv();
34416
34964
 
34417
- var loaded$h = !1;
34418
- function registerArc() {
34419
- loaded$h || (loaded$h = !0, registerArcGraphic(), container.load(arcModule), container.load(browser ? arcCanvasPickModule : arcMathPickModule));
34965
+ function _registerArc() {
34966
+ _registerArc.__loaded || (_registerArc.__loaded = !0, registerArcGraphic(), container.load(arcModule), container.load(browser ? arcCanvasPickModule : arcMathPickModule));
34420
34967
  }
34968
+ _registerArc.__loaded = !1;
34969
+ var registerArc = _registerArc;
34421
34970
 
34422
- var loaded$g = !1;
34423
- function registerArc3d() {
34424
- loaded$g || (loaded$g = !0, registerArc3dGraphic(), container.load(arc3dModule), container.load(arc3dCanvasPickModule));
34971
+ function _registerArc3d() {
34972
+ _registerArc3d.__loaded || (_registerArc3d.__loaded = !0, registerArc3dGraphic(), container.load(arc3dModule), container.load(arc3dCanvasPickModule));
34425
34973
  }
34974
+ _registerArc3d.__loaded = !1;
34975
+ var registerArc3d = _registerArc3d;
34426
34976
 
34427
- var loaded$f = !1;
34428
- function registerArea() {
34429
- loaded$f || (loaded$f = !0, registerAreaGraphic(), container.load(areaModule), container.load(browser ? areaCanvasPickModule : areaMathPickModule));
34977
+ function _registerArea() {
34978
+ _registerArea.__loaded || (_registerArea.__loaded = !0, registerAreaGraphic(), container.load(areaModule), container.load(browser ? areaCanvasPickModule : areaMathPickModule));
34430
34979
  }
34980
+ _registerArea.__loaded = !1;
34981
+ var registerArea = _registerArea;
34431
34982
 
34432
- var loaded$e = !1;
34433
- function registerCircle() {
34434
- loaded$e || (loaded$e = !0, registerCircleGraphic(), container.load(circleModule), container.load(browser ? circleCanvasPickModule : circleMathPickModule));
34983
+ function _registerCircle() {
34984
+ _registerCircle.__loaded || (_registerCircle.__loaded = !0, registerCircleGraphic(), container.load(circleModule), container.load(browser ? circleCanvasPickModule : circleMathPickModule));
34435
34985
  }
34986
+ _registerCircle.__loaded = !1;
34987
+ var registerCircle = _registerCircle;
34436
34988
 
34437
- var loaded$d = !1;
34438
- function registerGlyph() {
34439
- loaded$d || (loaded$d = !0, registerGlyphGraphic(), container.load(glyphModule), container.load(browser ? glyphCanvasPickModule : glyphMathPickModule));
34989
+ function _registerGlyph() {
34990
+ _registerGlyph.__loaded || (_registerGlyph.__loaded = !0, registerGlyphGraphic(), container.load(glyphModule), container.load(browser ? glyphCanvasPickModule : glyphMathPickModule));
34440
34991
  }
34992
+ _registerGlyph.__loaded = !1;
34993
+ var registerGlyph = _registerGlyph;
34441
34994
 
34442
- var loaded$c = !1;
34443
- function registerGroup() {
34444
- loaded$c || (loaded$c = !0, registerGroupGraphic());
34995
+ function _registerGroup() {
34996
+ _registerGroup.__loaded || (_registerGroup.__loaded = !0, registerGroupGraphic());
34445
34997
  }
34998
+ _registerGroup.__loaded = !1;
34999
+ var registerGroup = _registerGroup;
34446
35000
 
34447
- var loaded$b = !1;
34448
- function registerImage() {
34449
- loaded$b || (loaded$b = !0, registerImageGraphic(), container.load(imageModule), container.load(browser ? imageCanvasPickModule : imageMathPickModule));
35001
+ function _registerImage() {
35002
+ _registerImage.__loaded || (_registerImage.__loaded = !0, registerImageGraphic(), container.load(imageModule), container.load(browser ? imageCanvasPickModule : imageMathPickModule));
34450
35003
  }
35004
+ _registerImage.__loaded = !1;
35005
+ var registerImage = _registerImage;
34451
35006
 
34452
- var loaded$a = !1;
34453
- function registerLine() {
34454
- loaded$a || (loaded$a = !0, registerLineGraphic(), container.load(lineModule), container.load(browser ? lineCanvasPickModule : lineMathPickModule));
35007
+ function _registerLine() {
35008
+ _registerLine.__loaded || (_registerLine.__loaded = !0, registerLineGraphic(), container.load(lineModule), container.load(browser ? lineCanvasPickModule : lineMathPickModule));
34455
35009
  }
35010
+ _registerLine.__loaded = !1;
35011
+ var registerLine = _registerLine;
34456
35012
 
34457
- var loaded$9 = !1;
34458
- function registerPath() {
34459
- loaded$9 || (loaded$9 = !0, registerPathGraphic(), container.load(pathModule), container.load(browser ? pathCanvasPickModule : pathMathPickModule));
35013
+ function _registerPath() {
35014
+ _registerPath.__loaded || (_registerPath.__loaded = !0, registerPathGraphic(), container.load(pathModule), container.load(browser ? pathCanvasPickModule : pathMathPickModule));
34460
35015
  }
35016
+ _registerPath.__loaded = !1;
35017
+ var registerPath = _registerPath;
34461
35018
 
34462
- var loaded$8 = !1;
34463
- function registerPolygon() {
34464
- loaded$8 || (loaded$8 = !0, registerPolygonGraphic(), container.load(polygonModule), container.load(browser ? polygonCanvasPickModule : polygonMathPickModule));
35019
+ function _registerPolygon() {
35020
+ _registerPolygon.__loaded || (_registerPolygon.__loaded = !0, registerPolygonGraphic(), container.load(polygonModule), container.load(browser ? polygonCanvasPickModule : polygonMathPickModule));
34465
35021
  }
35022
+ _registerPolygon.__loaded = !1;
35023
+ var registerPolygon = _registerPolygon;
34466
35024
 
34467
- var loaded$7 = !1;
34468
- function registerPyramid3d() {
34469
- loaded$7 || (loaded$7 = !0, registerPyramid3dGraphic(), container.load(pyramid3dModule), container.load(pyramid3dCanvasPickModule));
35025
+ function _registerPyramid3d() {
35026
+ _registerPyramid3d.__loaded || (_registerPyramid3d.__loaded = !0, registerPyramid3dGraphic(), container.load(pyramid3dModule), container.load(pyramid3dCanvasPickModule));
34470
35027
  }
35028
+ _registerPyramid3d.__loaded = !1;
35029
+ var registerPyramid3d = _registerPyramid3d;
34471
35030
 
34472
- var loaded$6 = !1;
34473
- function registerRect() {
34474
- loaded$6 || (loaded$6 = !0, registerRectGraphic(), container.load(rectModule), container.load(browser ? rectCanvasPickModule : rectMathPickModule));
35031
+ function _registerRect() {
35032
+ _registerRect.__loaded || (_registerRect.__loaded = !0, registerRectGraphic(), container.load(rectModule), container.load(browser ? rectCanvasPickModule : rectMathPickModule));
34475
35033
  }
35034
+ _registerRect.__loaded = !1;
35035
+ var registerRect = _registerRect;
34476
35036
 
34477
- var loaded$5 = !1;
34478
- function registerRect3d() {
34479
- loaded$5 || (loaded$5 = !0, registerRect3dGraphic(), container.load(rect3dModule), container.load(rect3dCanvasPickModule));
35037
+ function _registerRect3d() {
35038
+ _registerRect3d.__loaded || (_registerRect3d.__loaded = !0, registerRect3dGraphic(), container.load(rect3dModule), container.load(rect3dCanvasPickModule));
34480
35039
  }
35040
+ _registerRect3d.__loaded = !1;
35041
+ var registerRect3d = _registerRect3d;
34481
35042
 
34482
- var loaded$4 = !1;
34483
- function registerRichtext() {
34484
- loaded$4 || (loaded$4 = !0, registerRichtextGraphic(), container.load(richtextModule), container.load(browser ? richtextCanvasPickModule : richTextMathPickModule));
35043
+ function _registerRichtext() {
35044
+ _registerRichtext.__loaded || (_registerRichtext.__loaded = !0, registerRichtextGraphic(), container.load(richtextModule), container.load(browser ? richtextCanvasPickModule : richTextMathPickModule));
34485
35045
  }
35046
+ _registerRichtext.__loaded = !1;
35047
+ var registerRichtext = _registerRichtext;
34486
35048
 
34487
- var loaded$3 = !1;
34488
- function registerShadowRoot() {
34489
- loaded$3 || (loaded$3 = !0, registerShadowRootGraphic());
35049
+ function _registerShadowRoot() {
35050
+ _registerShadowRoot.__loaded || (_registerShadowRoot.__loaded = !0, registerShadowRootGraphic());
34490
35051
  }
35052
+ _registerShadowRoot.__loaded = !1;
35053
+ var registerShadowRoot = _registerShadowRoot;
34491
35054
 
34492
- var loaded$2 = !1;
34493
- function registerSymbol() {
34494
- loaded$2 || (loaded$2 = !0, registerSymbolGraphic(), container.load(symbolModule), container.load(browser ? symbolCanvasPickModule : symbolMathPickModule));
35055
+ function _registerSymbol() {
35056
+ _registerSymbol.__loaded || (_registerSymbol.__loaded = !0, registerSymbolGraphic(), container.load(symbolModule), container.load(browser ? symbolCanvasPickModule : symbolMathPickModule));
34495
35057
  }
35058
+ _registerSymbol.__loaded = !1;
35059
+ var registerSymbol = _registerSymbol;
34496
35060
 
34497
- var loaded$1 = !1;
34498
- function registerText() {
34499
- loaded$1 || (loaded$1 = !0, registerTextGraphic(), container.load(textModule), container.load(browser ? textCanvasPickModule : textMathPickModule));
35061
+ function _registerText() {
35062
+ _registerText.__loaded || (_registerText.__loaded = !0, registerTextGraphic(), container.load(textModule), container.load(browser ? textCanvasPickModule : textMathPickModule));
34500
35063
  }
35064
+ _registerText.__loaded = !1;
35065
+ var registerText = _registerText;
34501
35066
 
34502
- var loaded = !1;
34503
- function registerWrapText() {
34504
- loaded || (loaded = !0, registerWrapTextGraphic());
35067
+ function _registerWrapText() {
35068
+ _registerWrapText.__loaded || (_registerWrapText.__loaded = !0, registerWrapTextGraphic());
34505
35069
  }
35070
+ _registerWrapText.__loaded = !1;
35071
+ var registerWrapText = _registerWrapText;
34506
35072
 
34507
35073
  var roughModule = _roughModule;
34508
35074
 
34509
- const version = "0.18.0-alpha.0";
35075
+ const version = "0.18.0-alpha.2";
34510
35076
  preLoadAllModule();
34511
35077
  if (isBrowserEnv()) {
34512
35078
  loadBrowserEnv(container);
@@ -34557,6 +35123,7 @@
34557
35123
  exports.BoundsContext = BoundsContext;
34558
35124
  exports.BoundsPicker = BoundsPicker;
34559
35125
  exports.CIRCLE_NUMBER_TYPE = CIRCLE_NUMBER_TYPE;
35126
+ exports.Canvas3DDrawItemInterceptor = Canvas3DDrawItemInterceptor;
34560
35127
  exports.CanvasFactory = CanvasFactory;
34561
35128
  exports.CanvasTextLayout = CanvasTextLayout;
34562
35129
  exports.CbAnimate = CbAnimate;
@@ -34578,11 +35145,13 @@
34578
35145
  exports.CustomEvent = CustomEvent;
34579
35146
  exports.CustomPath2D = CustomPath2D;
34580
35147
  exports.CustomSymbolClass = CustomSymbolClass;
35148
+ exports.DebugDrawItemInterceptorContribution = DebugDrawItemInterceptorContribution;
34581
35149
  exports.DefaultArcAllocate = DefaultArcAllocate;
34582
35150
  exports.DefaultArcAttribute = DefaultArcAttribute;
34583
35151
  exports.DefaultArcRenderContribution = DefaultArcRenderContribution;
34584
35152
  exports.DefaultAreaAllocate = DefaultAreaAllocate;
34585
35153
  exports.DefaultAreaAttribute = DefaultAreaAttribute;
35154
+ exports.DefaultAreaTextureRenderContribution = DefaultAreaTextureRenderContribution;
34586
35155
  exports.DefaultAttribute = DefaultAttribute;
34587
35156
  exports.DefaultBaseBackgroundRenderContribution = DefaultBaseBackgroundRenderContribution;
34588
35157
  exports.DefaultBaseTextureRenderContribution = DefaultBaseTextureRenderContribution;
@@ -34630,6 +35199,7 @@
34630
35199
  exports.DefaultTransform = DefaultTransform;
34631
35200
  exports.DragNDrop = DragNDrop;
34632
35201
  exports.DrawContribution = DrawContribution;
35202
+ exports.DrawItemInterceptor = DrawItemInterceptor;
34633
35203
  exports.DynamicLayerHandlerContribution = DynamicLayerHandlerContribution;
34634
35204
  exports.EnvContribution = EnvContribution;
34635
35205
  exports.EventManager = EventManager;
@@ -34668,6 +35238,7 @@
34668
35238
  exports.IncreaseCount = IncreaseCount;
34669
35239
  exports.IncrementalDrawContribution = IncrementalDrawContribution;
34670
35240
  exports.InputText = InputText;
35241
+ exports.InteractiveDrawItemInterceptorContribution = InteractiveDrawItemInterceptorContribution;
34671
35242
  exports.InteractiveSubRenderContribution = InteractiveSubRenderContribution;
34672
35243
  exports.LINE_NUMBER_TYPE = LINE_NUMBER_TYPE;
34673
35244
  exports.Layer = Layer;
@@ -34729,6 +35300,7 @@
34729
35300
  exports.SYMBOL_NUMBER_TYPE = SYMBOL_NUMBER_TYPE;
34730
35301
  exports.SegContext = SegContext;
34731
35302
  exports.ShadowRoot = ShadowRoot;
35303
+ exports.ShadowRootDrawItemInterceptorContribution = ShadowRootDrawItemInterceptorContribution;
34732
35304
  exports.Stage = Stage;
34733
35305
  exports.StaticLayerHandlerContribution = StaticLayerHandlerContribution;
34734
35306
  exports.Step = Step$1;
@@ -34769,6 +35341,7 @@
34769
35341
  exports.WindowHandlerContribution = WindowHandlerContribution;
34770
35342
  exports.WrapText = WrapText;
34771
35343
  exports.XMLParser = XMLParser;
35344
+ exports._registerArc = _registerArc;
34772
35345
  exports.addArcToBezierPath = addArcToBezierPath$1;
34773
35346
  exports.addAttributeToPrototype = addAttributeToPrototype;
34774
35347
  exports.alignBezierCurves = alignBezierCurves;
@@ -34834,6 +35407,7 @@
34834
35407
  exports.cubicLength = cubicLength;
34835
35408
  exports.cubicPointAt = cubicPointAt;
34836
35409
  exports.cubicSubdivide = cubicSubdivide;
35410
+ exports.decodeReactDom = decodeReactDom;
34837
35411
  exports.defaultArcAllocate = defaultArcAllocate;
34838
35412
  exports.defaultArcBackgroundRenderContribution = defaultArcBackgroundRenderContribution;
34839
35413
  exports.defaultArcRenderContribution = defaultArcRenderContribution;
@@ -34873,6 +35447,7 @@
34873
35447
  exports.fillVisible = fillVisible;
34874
35448
  exports.findBestMorphingRotation = findBestMorphingRotation;
34875
35449
  exports.findNextGraphic = findNextGraphic;
35450
+ exports.flatten_simplify = flatten_simplify;
34876
35451
  exports.foreach = foreach;
34877
35452
  exports.foreachAsync = foreachAsync;
34878
35453
  exports.genBasisSegments = genBasisSegments;
@@ -34882,9 +35457,9 @@
34882
35457
  exports.genLinearSegments = genLinearSegments;
34883
35458
  exports.genLinearTypeSegments = genLinearTypeSegments;
34884
35459
  exports.genMonotoneXSegments = genMonotoneXSegments;
35460
+ exports.genMonotoneXTypeSegments = genMonotoneXTypeSegments;
34885
35461
  exports.genMonotoneYSegments = genMonotoneYSegments;
34886
- exports.genMonotpneXTypeSegments = genMonotpneXTypeSegments;
34887
- exports.genMonotpneYTypeSegments = genMonotpneYTypeSegments;
35462
+ exports.genMonotoneYTypeSegments = genMonotoneYTypeSegments;
34888
35463
  exports.genNumberType = genNumberType;
34889
35464
  exports.genStepSegments = genStepSegments;
34890
35465
  exports.genStepTypeSegments = genStepTypeSegments;