@visactor/vrender 0.21.0-alpha.2 → 0.21.0-alpha.4

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
@@ -2732,11 +2732,12 @@
2732
2732
  for (let i = 0, len = paths.length; i < len; i++) if (currPath = paths[i], coordsStr = currPath.slice(1), commandChar = currPath[0], currCommandData = [commandChar], coordsStrArr = coordsStr.match(rePathCommand), null !== coordsStrArr) {
2733
2733
  for (let i = 0, len = coordsStrArr.length; i < len; i++) coordStr = coordsStrArr[i], coordNumber = parseFloat(coordStr), Number.isNaN(coordNumber) || currCommandData.push(coordNumber);
2734
2734
  if (standardCommandLen = commandLengths[commandChar], currCommandData.length - 1 > standardCommandLen) {
2735
- let subCommand;
2735
+ let subCommand,
2736
+ bestCommandChar = commandChar;
2736
2737
  for (let i = 1, len = currCommandData.length; i < len; i += standardCommandLen) {
2737
- subCommand = [commandChar];
2738
+ subCommand = [bestCommandChar];
2738
2739
  for (let j = i, subLen = i + standardCommandLen; j < subLen; j++) subCommand.push(currCommandData[j]);
2739
- result.push(subCommand);
2740
+ result.push(subCommand), "m" === bestCommandChar ? bestCommandChar = "l" : "M" === bestCommandChar && (bestCommandChar = "L");
2740
2741
  }
2741
2742
  } else result.push(currCommandData);
2742
2743
  } else result.push(currCommandData);
@@ -3985,6 +3986,7 @@
3985
3986
  zIndex: 0,
3986
3987
  layout: null,
3987
3988
  boundsPadding: 0,
3989
+ fillStrokeOrder: 0,
3988
3990
  renderStyle: "default",
3989
3991
  pickMode: "accurate",
3990
3992
  customPickShape: null,
@@ -4063,6 +4065,7 @@
4063
4065
  });
4064
4066
  const DefaultPathAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
4065
4067
  path: new CustomPath2D(),
4068
+ fillStrokeOrder: 1,
4066
4069
  customPath: () => {
4067
4070
  Logger.getInstance().warn("空函数");
4068
4071
  }
@@ -4375,6 +4378,14 @@
4375
4378
  return data;
4376
4379
  }
4377
4380
  _clipTextEnd(text, options, width, leftIdx, rightIdx) {
4381
+ if (leftIdx === rightIdx) {
4382
+ Logger.getInstance().warn(`【_clipTextEnd】不应该走到这里${text}, ${leftIdx}, ${rightIdx}`);
4383
+ const subText = text.substring(0, rightIdx + 1);
4384
+ return {
4385
+ str: subText,
4386
+ width: this.measureTextWidth(subText, options)
4387
+ };
4388
+ }
4378
4389
  const middleIdx = Math.floor((leftIdx + rightIdx) / 2),
4379
4390
  subText = text.substring(0, middleIdx + 1),
4380
4391
  strWidth = this.measureTextWidth(subText, options);
@@ -4408,7 +4419,7 @@
4408
4419
  }
4409
4420
  _clipTextStart(text, options, width, leftIdx, rightIdx) {
4410
4421
  const middleIdx = Math.ceil((leftIdx + rightIdx) / 2),
4411
- subText = text.substring(middleIdx - 1, text.length - 1),
4422
+ subText = text.substring(middleIdx - 1, text.length),
4412
4423
  strWidth = this.measureTextWidth(subText, options);
4413
4424
  let length;
4414
4425
  if (strWidth > width) {
@@ -4416,18 +4427,18 @@
4416
4427
  str: "",
4417
4428
  width: 0
4418
4429
  };
4419
- const str = text.substring(middleIdx, text.length - 1);
4430
+ const str = text.substring(middleIdx, text.length);
4420
4431
  return length = this.measureTextWidth(str, options), length <= width ? {
4421
4432
  str: str,
4422
4433
  width: length
4423
- } : this._clipTextStart(text, options, width, middleIdx, text.length - 1);
4434
+ } : this._clipTextStart(text, options, width, middleIdx, text.length);
4424
4435
  }
4425
4436
  if (strWidth < width) {
4426
4437
  if (middleIdx <= 0) return {
4427
4438
  str: text,
4428
4439
  width: this.measureTextWidth(text, options)
4429
4440
  };
4430
- const str = text.substring(middleIdx - 2, text.length - 1);
4441
+ const str = text.substring(middleIdx - 2, text.length);
4431
4442
  return length = this.measureTextWidth(str, options), length >= width ? {
4432
4443
  str: subText,
4433
4444
  width: strWidth
@@ -5088,7 +5099,7 @@
5088
5099
  }
5089
5100
  hasSubView() {
5090
5101
  const viewBox = this._handler.getViewBox();
5091
- return !(0 === viewBox.x1 && 0 === viewBox.y1 && this.width === viewBox.width() && this.height === viewBox.height());
5102
+ return !(0 === viewBox.x1 && 0 === viewBox.y1 && isNumberClose(this.width, viewBox.width()) && isNumberClose(this.height, viewBox.height()));
5092
5103
  }
5093
5104
  isVisible(bbox) {
5094
5105
  return this._handler.isVisible(bbox);
@@ -6012,7 +6023,7 @@
6012
6023
  timeStamp: now
6013
6024
  });
6014
6025
  const clickHistory = trackingData.clicksByButton[from.button];
6015
- clickHistory.target === clickEvent.target && now - clickHistory.timeStamp < (null !== (_a = this._config.clickInterval) && void 0 !== _a ? _a : 200) ? ++clickHistory.clickCount : clickHistory.clickCount = 1, clickHistory.target = clickEvent.target, clickHistory.timeStamp = now, clickEvent.detail = clickHistory.clickCount, isMouseLike(clickEvent.pointerType) ? (this.dispatchEvent(clickEvent, "click"), 2 === clickHistory.clickCount && this.dispatchEvent(clickEvent, "dblclick")) : "touch" === clickEvent.pointerType && (this.dispatchEvent(clickEvent, "tap"), 2 === clickHistory.clickCount && this.dispatchEvent(clickEvent, "dbltap")), this.dispatchEvent(clickEvent, "pointertap"), this.freeEvent(clickEvent);
6026
+ clickHistory.target === clickEvent.target && now - clickHistory.timeStamp < (null !== (_a = this._config.clickInterval) && void 0 !== _a ? _a : 200) ? ++clickHistory.clickCount : clickHistory.clickCount = 1, clickHistory.target = clickEvent.target, clickHistory.timeStamp = now, clickEvent.detail = clickHistory.clickCount, isMouseLike(clickEvent.pointerType) ? (this.dispatchEvent(clickEvent, "click"), 2 === clickHistory.clickCount && this.dispatchEvent(clickEvent, "dblclick")) : "touch" === clickEvent.pointerType && this._config.supportsTouchEvents && (this.dispatchEvent(clickEvent, "tap"), 2 === clickHistory.clickCount && this.dispatchEvent(clickEvent, "dbltap")), this.dispatchEvent(clickEvent, "pointertap"), this.freeEvent(clickEvent);
6016
6027
  }
6017
6028
  this.freeEvent(e);
6018
6029
  }, this.onPointerUpOutside = (from, target) => {
@@ -6229,7 +6240,8 @@
6229
6240
  supportsPointerEvents = global.supportsPointerEvents
6230
6241
  } = params;
6231
6242
  this.manager = new EventManager(rootNode, {
6232
- clickInterval: clickInterval
6243
+ clickInterval: clickInterval,
6244
+ supportsTouchEvents: supportsTouchEvents
6233
6245
  }), this.globalObj = global, this.supportsPointerEvents = supportsPointerEvents, this.supportsTouchEvents = supportsTouchEvents, this.supportsMouseEvents = global.supportsMouseEvents, this.applyStyles = global.applyStyles, this.autoPreventDefault = autoPreventDefault, this.eventsAdded = !1, this.rootPointerEvent = new FederatedPointerEvent(), this.rootWheelEvent = new FederatedWheelEvent(), this.cursorStyles = {
6234
6246
  default: "inherit",
6235
6247
  pointer: "pointer"
@@ -9088,7 +9100,7 @@
9088
9100
  }
9089
9101
  static GetFile(url, type) {
9090
9102
  let data = ResourceLoader.cache.get(url);
9091
- return data ? "init" === data.loadState || "fail" === data.loadState ? Promise.reject() : "loading" === data.loadState ? data.dataPromise.then(data => data.data) : Promise.resolve(data.data) : (data = {
9103
+ return data ? "fail" === data.loadState ? Promise.reject() : "init" === data.loadState || "loading" === data.loadState ? data.dataPromise.then(data => data.data) : Promise.resolve(data.data) : (data = {
9092
9104
  type: type,
9093
9105
  loadState: "init"
9094
9106
  }, ResourceLoader.cache.set(url, data), "arrayBuffer" === type ? data.dataPromise = application.global.loadArrayBuffer(url) : "blob" === type ? data.dataPromise = application.global.loadBlob(url) : "json" === type && (data.dataPromise = application.global.loadJson(url)), data.dataPromise.then(data => data.data));
@@ -12352,8 +12364,9 @@
12352
12364
  constructor() {
12353
12365
  super(...arguments), this.time = exports.BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
12354
12366
  }
12355
- drawShape(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb) {
12356
- return super.drawShape(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
12367
+ drawShape(image, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb) {
12368
+ if (!(image.isGifImage && image.renderFrame && image.playing)) return super.drawShape(image, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
12369
+ image.renderFrame(context, x, y);
12357
12370
  }
12358
12371
  }
12359
12372
  const defaultImageRenderContribution = new DefaultImageRenderContribution();
@@ -12506,7 +12519,8 @@
12506
12519
  fill = arcAttribute.fill,
12507
12520
  stroke = arcAttribute.stroke,
12508
12521
  x: originX = arcAttribute.x,
12509
- y: originY = arcAttribute.y
12522
+ y: originY = arcAttribute.y,
12523
+ fillStrokeOrder = arcAttribute.fillStrokeOrder
12510
12524
  } = arc.attribute,
12511
12525
  data = this.valid(arc, arcAttribute, fillCb, strokeCb);
12512
12526
  if (!data) return;
@@ -12542,7 +12556,17 @@
12542
12556
  isFullStroke: isFullStroke,
12543
12557
  stroke: arrayStroke
12544
12558
  } = parseStroke(stroke);
12545
- if ((doFill || isFullStroke) && (context.beginPath(), drawArcPath$1(arc, context, x, y, outerRadius, innerRadius), beforeRenderContribitionsRuned = !0, context.setShadowBlendStyle && context.setShadowBlendStyle(arc, arc.attribute, arcAttribute), this.beforeRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb), doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.fill())), doStroke && isFullStroke && (strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.stroke()))), !isFullStroke && doStroke) {
12559
+ if (doFill || isFullStroke) {
12560
+ context.beginPath(), drawArcPath$1(arc, context, x, y, outerRadius, innerRadius), beforeRenderContribitionsRuned = !0, context.setShadowBlendStyle && context.setShadowBlendStyle(arc, arc.attribute, arcAttribute), this.beforeRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb);
12561
+ const _runFill = () => {
12562
+ doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.fill()));
12563
+ },
12564
+ _runStroke = () => {
12565
+ doStroke && isFullStroke && (strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.stroke()));
12566
+ };
12567
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke());
12568
+ }
12569
+ if (!isFullStroke && doStroke) {
12546
12570
  context.beginPath();
12547
12571
  drawArcPath$1(arc, context, x, y, outerRadius, innerRadius, arrayStroke);
12548
12572
  beforeRenderContribitionsRuned || this.beforeRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb), strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke());
@@ -12560,14 +12584,20 @@
12560
12584
  fill = arcAttribute.fill
12561
12585
  } = arc.attribute,
12562
12586
  startAngle = endAngle;
12563
- if (this.drawArcTailCapPath(arc, context, x, y, outerRadius, innerRadius, startAngle, startAngle + capAngle), beforeRenderContribitionsRuned || this.beforeRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb), doFill) {
12564
- const color = fill;
12565
- if ("conical" === color.gradient) {
12566
- const lastColor = getConicGradientAt(0, 0, endAngle, color);
12567
- fillCb || fillVisible && (context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute), context.fillStyle = lastColor, context.fill());
12568
- }
12569
- }
12570
- doStroke && (strokeCb || sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()));
12587
+ this.drawArcTailCapPath(arc, context, x, y, outerRadius, innerRadius, startAngle, startAngle + capAngle), beforeRenderContribitionsRuned || this.beforeRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb);
12588
+ const _runFill = () => {
12589
+ if (doFill) {
12590
+ const color = fill;
12591
+ if ("conical" === color.gradient) {
12592
+ const lastColor = getConicGradientAt(0, 0, endAngle, color);
12593
+ fillCb || fillVisible && (context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute), context.fillStyle = lastColor, context.fill());
12594
+ }
12595
+ }
12596
+ },
12597
+ _runStroke = () => {
12598
+ doStroke && (strokeCb || sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()));
12599
+ };
12600
+ _runFill(), _runStroke();
12571
12601
  }
12572
12602
  }
12573
12603
  this.afterRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb), tempChangeConicalColor && (fill.startAngle += conicalOffset, fill.endAngle += conicalOffset);
@@ -12605,7 +12635,8 @@
12605
12635
  startAngle = circleAttribute.startAngle,
12606
12636
  endAngle = circleAttribute.endAngle,
12607
12637
  x: originX = circleAttribute.x,
12608
- y: originY = circleAttribute.y
12638
+ y: originY = circleAttribute.y,
12639
+ fillStrokeOrder = circleAttribute.fillStrokeOrder
12609
12640
  } = circle.attribute,
12610
12641
  data = this.valid(circle, circleAttribute, fillCb, strokeCb);
12611
12642
  if (!data) return;
@@ -12615,7 +12646,14 @@
12615
12646
  doFill: doFill,
12616
12647
  doStroke: doStroke
12617
12648
  } = data;
12618
- context.beginPath(), context.arc(x, y, radius, startAngle, endAngle), context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(circle, circle.attribute, circleAttribute), this.beforeRenderStep(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, drawContext, fillCb, strokeCb), doFill && (fillCb ? fillCb(context, circle.attribute, circleAttribute) : fVisible && (context.setCommonStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute), context.fill())), doStroke && (strokeCb ? strokeCb(context, circle.attribute, circleAttribute) : sVisible && (context.setStrokeStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute), context.stroke())), this.afterRenderStep(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, drawContext, fillCb, strokeCb);
12649
+ context.beginPath(), context.arc(x, y, radius, startAngle, endAngle), context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(circle, circle.attribute, circleAttribute), this.beforeRenderStep(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, drawContext, fillCb, strokeCb);
12650
+ const _runFill = () => {
12651
+ doFill && (fillCb ? fillCb(context, circle.attribute, circleAttribute) : fVisible && (context.setCommonStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute), context.fill()));
12652
+ },
12653
+ _runStroke = () => {
12654
+ doStroke && (strokeCb ? strokeCb(context, circle.attribute, circleAttribute) : sVisible && (context.setStrokeStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute), context.stroke()));
12655
+ };
12656
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, drawContext, fillCb, strokeCb);
12619
12657
  }
12620
12658
  draw(circle, renderService, drawContext, params) {
12621
12659
  const circleAttribute = getTheme(circle, null == params ? void 0 : params.theme).circle;
@@ -13056,7 +13094,7 @@
13056
13094
  super(), this.areaRenderContribitions = areaRenderContribitions, this.numberType = AREA_NUMBER_TYPE, this.builtinContributions = [defaultAreaTextureRenderContribution, defaultAreaBackgroundRenderContribution], this.init(areaRenderContribitions);
13057
13095
  }
13058
13096
  drawLinearAreaHighPerformance(area, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, areaAttribute, drawContext, params, fillCb, strokeCb) {
13059
- var _a, _b, _c, _d, _e;
13097
+ var _a, _b, _c;
13060
13098
  const {
13061
13099
  points: points
13062
13100
  } = area.attribute;
@@ -13080,28 +13118,31 @@
13080
13118
  x: originX = 0,
13081
13119
  x: originY = 0
13082
13120
  } = area.attribute;
13083
- 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, {
13121
+ !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, {
13084
13122
  attribute: area.attribute
13085
- }), stroke) {
13086
- const {
13087
- stroke = areaAttribute && areaAttribute.stroke
13088
- } = area.attribute;
13089
- if (isArray$1(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1]) if (context.beginPath(), stroke[0]) {
13090
- context.moveTo(startP.x + offsetX, startP.y + offsetY, z);
13091
- for (let i = 1; i < points.length; i++) {
13092
- const p = points[i];
13093
- context.lineTo(p.x + offsetX, p.y + offsetY, z);
13094
- }
13095
- } else if (stroke[2]) {
13096
- const endP = points[points.length - 1];
13097
- context.moveTo(endP.x + offsetX, endP.y + offsetY, z);
13098
- for (let i = points.length - 2; i >= 0; i--) {
13099
- const p = points[i];
13100
- context.lineTo((null !== (_d = p.x1) && void 0 !== _d ? _d : p.x) + offsetX, (null !== (_e = p.y1) && void 0 !== _e ? _e : p.y) + offsetY, z);
13123
+ }), (() => {
13124
+ var _a, _b;
13125
+ if (stroke) {
13126
+ const {
13127
+ stroke = areaAttribute && areaAttribute.stroke
13128
+ } = area.attribute;
13129
+ if (isArray$1(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1]) if (context.beginPath(), stroke[0]) {
13130
+ context.moveTo(startP.x + offsetX, startP.y + offsetY, z);
13131
+ for (let i = 1; i < points.length; i++) {
13132
+ const p = points[i];
13133
+ context.lineTo(p.x + offsetX, p.y + offsetY, z);
13134
+ }
13135
+ } else if (stroke[2]) {
13136
+ const endP = points[points.length - 1];
13137
+ context.moveTo(endP.x + offsetX, endP.y + offsetY, z);
13138
+ for (let i = points.length - 2; i >= 0; i--) {
13139
+ const p = points[i];
13140
+ context.lineTo((null !== (_a = p.x1) && void 0 !== _a ? _a : p.x) + offsetX, (null !== (_b = p.y1) && void 0 !== _b ? _b : p.y) + offsetY, z);
13141
+ }
13101
13142
  }
13143
+ strokeCb ? strokeCb(context, area.attribute, areaAttribute) : (context.setStrokeStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.stroke());
13102
13144
  }
13103
- strokeCb ? strokeCb(context, area.attribute, areaAttribute) : (context.setStrokeStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.stroke());
13104
- }
13145
+ })();
13105
13146
  }
13106
13147
  drawShape(area, context, x, y, drawContext, params, fillCb, strokeCb) {
13107
13148
  var _a, _b, _c, _d, _e, _f;
@@ -13266,23 +13307,24 @@
13266
13307
  x: originX = 0,
13267
13308
  x: originY = 0
13268
13309
  } = attribute;
13269
- if (!1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute), context.fill())), this.afterRenderStep(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, defaultAttribute, drawContext, fillCb, null, {
13310
+ return !1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute), context.fill())), this.afterRenderStep(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, defaultAttribute, drawContext, fillCb, null, {
13270
13311
  attribute: attribute
13271
- }), !1 !== stroke) if (strokeCb) strokeCb(context, attribute, defaultAttribute);else {
13272
- const {
13273
- stroke = defaultAttribute && defaultAttribute[1] && defaultAttribute[1].stroke
13274
- } = attribute;
13275
- isArray$1(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1] && (context.beginPath(), drawSegments(context.camera ? context : context.nativeContext, stroke[0] ? cache.top : cache.bottom, clipRange, direction === exports.Direction.ROW ? "x" : "y", {
13276
- offsetX: offsetX,
13277
- offsetY: offsetY,
13278
- offsetZ: offsetZ,
13279
- drawConnect: connect,
13280
- mode: connectedType,
13281
- zeroX: connectedX,
13282
- zeroY: connectedY
13283
- })), context.setStrokeStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute), context.stroke();
13284
- }
13285
- return !1;
13312
+ }), (() => {
13313
+ if (!1 !== stroke) if (strokeCb) strokeCb(context, attribute, defaultAttribute);else {
13314
+ const {
13315
+ stroke = defaultAttribute && defaultAttribute[1] && defaultAttribute[1].stroke
13316
+ } = attribute;
13317
+ isArray$1(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1] && (context.beginPath(), drawSegments(context.camera ? context : context.nativeContext, stroke[0] ? cache.top : cache.bottom, clipRange, direction === exports.Direction.ROW ? "x" : "y", {
13318
+ offsetX: offsetX,
13319
+ offsetY: offsetY,
13320
+ offsetZ: offsetZ,
13321
+ drawConnect: connect,
13322
+ mode: connectedType,
13323
+ zeroX: connectedX,
13324
+ zeroY: connectedY
13325
+ })), context.setStrokeStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute), context.stroke();
13326
+ }
13327
+ })(), !1;
13286
13328
  }
13287
13329
  };
13288
13330
  exports.DefaultCanvasAreaRender = __decorate$1v([injectable(), __param$N(0, inject(ContributionProvider)), __param$N(0, named(AreaRenderContribution)), __metadata$19("design:paramtypes", [Object])], exports.DefaultCanvasAreaRender);
@@ -13314,7 +13356,8 @@
13314
13356
  const pathAttribute = null !== (_a = this.tempTheme) && void 0 !== _a ? _a : getTheme(path, null == params ? void 0 : params.theme).path,
13315
13357
  {
13316
13358
  x: originX = pathAttribute.x,
13317
- y: originY = pathAttribute.y
13359
+ y: originY = pathAttribute.y,
13360
+ fillStrokeOrder = pathAttribute.fillStrokeOrder
13318
13361
  } = path.attribute,
13319
13362
  z = null !== (_b = this.z) && void 0 !== _b ? _b : 0,
13320
13363
  data = this.valid(path, pathAttribute, fillCb, strokeCb);
@@ -13329,7 +13372,14 @@
13329
13372
  const path2D = null !== (_c = path.attribute.path) && void 0 !== _c ? _c : pathAttribute.path;
13330
13373
  renderCommandList(path2D.commandList, context, x, y, 1, 1, z);
13331
13374
  }
13332
- context.setShadowBlendStyle && context.setShadowBlendStyle(path, path.attribute, pathAttribute), this.beforeRenderStep(path, context, x, y, doFill, doStroke, fVisible, sVisible, pathAttribute, drawContext, fillCb, strokeCb), doStroke && (strokeCb ? strokeCb(context, path.attribute, pathAttribute) : sVisible && (context.setStrokeStyle(path, path.attribute, originX - x, originY - y, pathAttribute), context.stroke())), doFill && (fillCb ? fillCb(context, path.attribute, pathAttribute) : fVisible && (context.setCommonStyle(path, path.attribute, originX - x, originY - y, pathAttribute), context.fill())), this.afterRenderStep(path, context, x, y, doFill, doStroke, fVisible, sVisible, pathAttribute, drawContext, fillCb, strokeCb);
13375
+ context.setShadowBlendStyle && context.setShadowBlendStyle(path, path.attribute, pathAttribute), this.beforeRenderStep(path, context, x, y, doFill, doStroke, fVisible, sVisible, pathAttribute, drawContext, fillCb, strokeCb);
13376
+ const _runStroke = () => {
13377
+ doStroke && (strokeCb ? strokeCb(context, path.attribute, pathAttribute) : sVisible && (context.setStrokeStyle(path, path.attribute, originX - x, originY - y, pathAttribute), context.stroke()));
13378
+ },
13379
+ _runFill = () => {
13380
+ doFill && (fillCb ? fillCb(context, path.attribute, pathAttribute) : fVisible && (context.setCommonStyle(path, path.attribute, originX - x, originY - y, pathAttribute), context.fill()));
13381
+ };
13382
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(path, context, x, y, doFill, doStroke, fVisible, sVisible, pathAttribute, drawContext, fillCb, strokeCb);
13333
13383
  }
13334
13384
  draw(path, renderService, drawContext, params) {
13335
13385
  const pathAttribute = getTheme(path, null == params ? void 0 : params.theme).path;
@@ -13373,7 +13423,8 @@
13373
13423
  x1: x1,
13374
13424
  y1: y1,
13375
13425
  x: originX = rectAttribute.x,
13376
- y: originY = rectAttribute.y
13426
+ y: originY = rectAttribute.y,
13427
+ fillStrokeOrder = rectAttribute.fillStrokeOrder
13377
13428
  } = rect.attribute;
13378
13429
  let {
13379
13430
  width: width,
@@ -13392,7 +13443,14 @@
13392
13443
  doFill: doFill,
13393
13444
  doStroke: doStroke
13394
13445
  };
13395
- context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute), this.beforeRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb, doFillOrStroke), doFillOrStroke.doFill && (fillCb ? fillCb(context, rect.attribute, rectAttribute) : fVisible && (context.setCommonStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.fill())), doFillOrStroke.doStroke && (strokeCb ? strokeCb(context, rect.attribute, rectAttribute) : sVisible && (context.setStrokeStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.stroke())), this.afterRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
13446
+ context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute), this.beforeRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb, doFillOrStroke);
13447
+ const _runFill = () => {
13448
+ doFillOrStroke.doFill && (fillCb ? fillCb(context, rect.attribute, rectAttribute) : fVisible && (context.setCommonStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.fill()));
13449
+ },
13450
+ _runStroke = () => {
13451
+ doFillOrStroke.doStroke && (strokeCb ? strokeCb(context, rect.attribute, rectAttribute) : sVisible && (context.setStrokeStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.stroke()));
13452
+ };
13453
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
13396
13454
  }
13397
13455
  draw(rect, renderService, drawContext, params) {
13398
13456
  const rectAttribute = getTheme(rect, null == params ? void 0 : params.theme).rect;
@@ -13428,7 +13486,8 @@
13428
13486
  x: originX = symbolAttribute.x,
13429
13487
  y: originY = symbolAttribute.y,
13430
13488
  scaleX = symbolAttribute.scaleX,
13431
- scaleY = symbolAttribute.scaleY
13489
+ scaleY = symbolAttribute.scaleY,
13490
+ fillStrokeOrder = symbolAttribute.fillStrokeOrder
13432
13491
  } = symbol.attribute,
13433
13492
  data = this.valid(symbol, symbolAttribute, fillCb, strokeCb);
13434
13493
  if (!data) return;
@@ -13451,14 +13510,27 @@
13451
13510
  const obj = Object.assign({}, a);
13452
13511
  obj.fill = null !== (_a = a.fill) && void 0 !== _a ? _a : symbol.attribute.fill, obj.opacity = null !== (_b = a.opacity) && void 0 !== _b ? _b : symbol.attribute.opacity, obj.fillOpacity = symbol.attribute.fillOpacity, obj.stroke = null !== (_c = a.stroke) && void 0 !== _c ? _c : symbol.attribute.stroke, a = obj;
13453
13512
  }
13454
- a.fill && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : (context.setCommonStyle(symbol, a, originX - x, originY - y, symbolAttribute), context.fill())), a.stroke && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : (context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke()));
13513
+ const _runFill = () => {
13514
+ a.fill && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : (context.setCommonStyle(symbol, a, originX - x, originY - y, symbolAttribute), context.fill()));
13515
+ },
13516
+ _runStroke = () => {
13517
+ a.stroke && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : (context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke()));
13518
+ };
13519
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke());
13455
13520
  };
13456
13521
  if (keepDirIn3d && context.camera && context.project) {
13457
13522
  const p = context.project(x, y, z),
13458
13523
  camera = context.camera;
13459
13524
  context.camera = null, !1 === parsedPath.draw(context, isArray$1(size) ? [size[0] * scaleX, size[1] * scaleY] : size * scaleX, p.x, p.y, void 0, callback) && context.closePath(), context.camera = camera;
13460
13525
  } else !1 === parsedPath.draw(context, size, x, y, z, callback) && context.closePath();
13461
- context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute), this.beforeRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb), doFill && !parsedPath.isSvg && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : fVisible && (context.setCommonStyle(symbol, symbol.attribute, originX - x, originY - y, symbolAttribute), context.fill())), doStroke && !parsedPath.isSvg && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : sVisible && (context.setStrokeStyle(symbol, symbol.attribute, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke())), this.afterRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
13526
+ context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute), this.beforeRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
13527
+ const _runFill = () => {
13528
+ doFill && !parsedPath.isSvg && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : fVisible && (context.setCommonStyle(symbol, symbol.attribute, originX - x, originY - y, symbolAttribute), context.fill()));
13529
+ },
13530
+ _runStroke = () => {
13531
+ doStroke && !parsedPath.isSvg && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : sVisible && (context.setStrokeStyle(symbol, symbol.attribute, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke()));
13532
+ };
13533
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
13462
13534
  }
13463
13535
  draw(symbol, renderService, drawContext, params) {
13464
13536
  const symbolAttribute = getTheme(symbol, null == params ? void 0 : params.theme).symbol;
@@ -13845,7 +13917,8 @@
13845
13917
  cornerRadius = polygonAttribute.cornerRadius,
13846
13918
  x: originX = polygonAttribute.x,
13847
13919
  y: originY = polygonAttribute.y,
13848
- closePath = polygonAttribute.closePath
13920
+ closePath = polygonAttribute.closePath,
13921
+ fillStrokeOrder = polygonAttribute.fillStrokeOrder
13849
13922
  } = polygon.attribute,
13850
13923
  data = this.valid(polygon, polygonAttribute, fillCb, strokeCb);
13851
13924
  if (!data) return;
@@ -13855,7 +13928,14 @@
13855
13928
  doFill: doFill,
13856
13929
  doStroke: doStroke
13857
13930
  } = data;
13858
- context.beginPath(), cornerRadius <= 0 || isArray$1(cornerRadius) && cornerRadius.every(num => 0 === num) ? drawPolygon(context.camera ? context : context.nativeContext, points, x, y) : drawRoundedPolygon(context.camera ? context : context.nativeContext, points, x, y, cornerRadius, closePath), closePath && context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(polygon, polygon.attribute, polygonAttribute), this.beforeRenderStep(polygon, context, x, y, doFill, doStroke, fVisible, sVisible, polygonAttribute, drawContext, fillCb, strokeCb), doFill && (fillCb ? fillCb(context, polygon.attribute, polygonAttribute) : fVisible && (context.setCommonStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute), context.fill())), doStroke && (strokeCb ? strokeCb(context, polygon.attribute, polygonAttribute) : sVisible && (context.setStrokeStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute), context.stroke())), this.afterRenderStep(polygon, context, x, y, doFill, doStroke, fVisible, sVisible, polygonAttribute, drawContext, fillCb, strokeCb);
13931
+ context.beginPath(), cornerRadius <= 0 || isArray$1(cornerRadius) && cornerRadius.every(num => 0 === num) ? drawPolygon(context.camera ? context : context.nativeContext, points, x, y) : drawRoundedPolygon(context.camera ? context : context.nativeContext, points, x, y, cornerRadius, closePath), closePath && context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(polygon, polygon.attribute, polygonAttribute), this.beforeRenderStep(polygon, context, x, y, doFill, doStroke, fVisible, sVisible, polygonAttribute, drawContext, fillCb, strokeCb);
13932
+ const _runFill = () => {
13933
+ doFill && (fillCb ? fillCb(context, polygon.attribute, polygonAttribute) : fVisible && (context.setCommonStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute), context.fill()));
13934
+ },
13935
+ _runStroke = () => {
13936
+ doStroke && (strokeCb ? strokeCb(context, polygon.attribute, polygonAttribute) : sVisible && (context.setStrokeStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute), context.stroke()));
13937
+ };
13938
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(polygon, context, x, y, doFill, doStroke, fVisible, sVisible, polygonAttribute, drawContext, fillCb, strokeCb);
13859
13939
  }
13860
13940
  draw(polygon, renderService, drawContext, params) {
13861
13941
  const polygonAttribute = getTheme(polygon, null == params ? void 0 : params.theme).polygon;
@@ -13898,7 +13978,10 @@
13898
13978
  cornerRadius = groupAttribute.cornerRadius,
13899
13979
  path = groupAttribute.path,
13900
13980
  lineWidth = groupAttribute.lineWidth,
13901
- visible = groupAttribute.visible
13981
+ visible = groupAttribute.visible,
13982
+ fillStrokeOrder = groupAttribute.fillStrokeOrder,
13983
+ x: originX = groupAttribute.x,
13984
+ y: originY = groupAttribute.y
13902
13985
  } = group.attribute,
13903
13986
  fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
13904
13987
  sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height),
@@ -13924,7 +14007,14 @@
13924
14007
  };
13925
14008
  this._groupRenderContribitions.forEach(c => {
13926
14009
  c.time === exports.BaseRenderContributionTime.beforeFillStroke && c.drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb, doFillOrStroke);
13927
- }), clip && context.clip(), context.setShadowBlendStyle && context.setShadowBlendStyle(group, group.attribute, groupAttribute), doFillOrStroke.doFill && (fillCb ? fillCb(context, group.attribute, groupAttribute) : fVisible && (context.setCommonStyle(group, group.attribute, x, y, groupAttribute), context.fill())), doFillOrStroke.doStroke && (strokeCb ? strokeCb(context, group.attribute, groupAttribute) : sVisible && (context.setStrokeStyle(group, group.attribute, x, y, groupAttribute), context.stroke())), this._groupRenderContribitions.forEach(c => {
14010
+ }), clip && context.clip(), context.setShadowBlendStyle && context.setShadowBlendStyle(group, group.attribute, groupAttribute);
14011
+ const _runFill = () => {
14012
+ doFillOrStroke.doFill && (fillCb ? fillCb(context, group.attribute, groupAttribute) : fVisible && (context.setCommonStyle(group, group.attribute, originX - x, originY - y, groupAttribute), context.fill()));
14013
+ },
14014
+ _runStroke = () => {
14015
+ doFillOrStroke.doStroke && (strokeCb ? strokeCb(context, group.attribute, groupAttribute) : sVisible && (context.setStrokeStyle(group, group.attribute, originX - x, originY - y, groupAttribute), context.stroke()));
14016
+ };
14017
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this._groupRenderContribitions.forEach(c => {
13928
14018
  c.time === exports.BaseRenderContributionTime.afterFillStroke && c.drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb);
13929
14019
  });
13930
14020
  }
@@ -13990,6 +14080,7 @@
13990
14080
  x: originX = imageAttribute.x,
13991
14081
  y: originY = imageAttribute.y,
13992
14082
  cornerRadius = imageAttribute.cornerRadius,
14083
+ fillStrokeOrder = imageAttribute.fillStrokeOrder,
13993
14084
  image: url
13994
14085
  } = image.attribute,
13995
14086
  data = this.valid(image, imageAttribute, fillCb);
@@ -14000,29 +14091,37 @@
14000
14091
  doFill: doFill,
14001
14092
  doStroke: doStroke
14002
14093
  } = data;
14003
- if (context.setShadowBlendStyle && context.setShadowBlendStyle(image, imageAttribute), this.beforeRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb), doFill) if (fillCb) fillCb(context, image.attribute, imageAttribute);else if (fVisible) {
14004
- if (!url || !image.resources) return;
14005
- const res = image.resources.get(url);
14006
- if ("success" !== res.state) return;
14007
- let needRestore = !1;
14008
- 0 === cornerRadius || isArray$1(cornerRadius) && cornerRadius.every(num => 0 === num) || (context.beginPath(), createRectPath(context, x, y, width, height, cornerRadius), context.save(), context.clip(), needRestore = !0), context.setCommonStyle(image, image.attribute, x, y, imageAttribute);
14009
- let repeat = 0;
14010
- if ("repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat) {
14011
- const pattern = context.createPattern(res.data, repeatStr[repeat]);
14012
- context.fillStyle = pattern, context.translate(x, y, !0), context.fillRect(0, 0, width, height), context.translate(-x, -y, !0);
14013
- } else context.drawImage(res.data, x, y, width, height);
14014
- needRestore && context.restore();
14015
- }
14016
- doStroke && (strokeCb ? strokeCb(context, image.attribute, imageAttribute) : sVisible && (context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute), context.stroke())), this.afterRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb);
14094
+ context.setShadowBlendStyle && context.setShadowBlendStyle(image, imageAttribute), this.beforeRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb);
14095
+ const _runFill = () => {
14096
+ if (doFill) if (fillCb) fillCb(context, image.attribute, imageAttribute);else if (fVisible) {
14097
+ if (!url || !image.resources) return;
14098
+ const res = image.resources.get(url);
14099
+ if ("success" !== res.state) return;
14100
+ let needRestore = !1;
14101
+ 0 === cornerRadius || isArray$1(cornerRadius) && cornerRadius.every(num => 0 === num) || (context.beginPath(), createRectPath(context, x, y, width, height, cornerRadius), context.save(), context.clip(), needRestore = !0), context.setCommonStyle(image, image.attribute, x, y, imageAttribute);
14102
+ let repeat = 0;
14103
+ if ("repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat) {
14104
+ const pattern = context.createPattern(res.data, repeatStr[repeat]);
14105
+ context.fillStyle = pattern, context.translate(x, y, !0), context.fillRect(0, 0, width, height), context.translate(-x, -y, !0);
14106
+ } else context.drawImage(res.data, x, y, width, height);
14107
+ needRestore && context.restore();
14108
+ }
14109
+ },
14110
+ _runStroke = () => {
14111
+ doStroke && (strokeCb ? strokeCb(context, image.attribute, imageAttribute) : sVisible && (context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute), context.stroke()));
14112
+ };
14113
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb);
14017
14114
  }
14018
14115
  draw(image, renderService, drawContext) {
14019
14116
  const {
14020
14117
  image: url
14021
14118
  } = image.attribute;
14022
- if (!url || !image.resources) return;
14023
- const res = image.resources.get(url);
14024
- if ("loading" === res.state && isString$1(url)) return void ResourceLoader.improveImageLoading(url);
14025
- if ("success" !== res.state) return;
14119
+ if (!image.isGifImage) {
14120
+ if (!url || !image.resources) return;
14121
+ const res = image.resources.get(url);
14122
+ if ("loading" === res.state && isString$1(url)) return void ResourceLoader.improveImageLoading(url);
14123
+ if ("success" !== res.state) return;
14124
+ }
14026
14125
  const {
14027
14126
  context: context
14028
14127
  } = renderService.drawParams;
@@ -18278,6 +18377,42 @@
18278
18377
  }
18279
18378
  }
18280
18379
 
18380
+ class AutoRefreshPlugin {
18381
+ constructor() {
18382
+ this.name = "AutoRefreshPlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid, this.handleChange = graphic => {
18383
+ graphic.glyphHost && (graphic = graphic.glyphHost), graphic.stage === this.pluginService.stage && null != graphic.stage && graphic.stage.renderNextFrame();
18384
+ };
18385
+ }
18386
+ activate(context) {
18387
+ this.pluginService = context, this.dpr = application.global.devicePixelRatio, this.refresh();
18388
+ }
18389
+ refresh() {
18390
+ this._refreshByMediaQuery() || this._refreshByRaf();
18391
+ }
18392
+ _refreshByRaf() {
18393
+ const raf = application.global.getRequestAnimationFrame();
18394
+ this.rafId = raf(() => {
18395
+ application.global.devicePixelRatio !== this.dpr && (this.dpr = application.global.devicePixelRatio, this.pluginService.stage.setDpr(this.dpr, !0)), this.refresh();
18396
+ });
18397
+ }
18398
+ _refreshByMediaQuery() {
18399
+ try {
18400
+ const mqString = `(resolution: ${window.devicePixelRatio}dppx)`,
18401
+ updatePixelRatio = () => {
18402
+ window.devicePixelRatio !== this.dpr && (this.dpr = window.devicePixelRatio, this.pluginService.stage.setDpr(this.dpr, !0));
18403
+ };
18404
+ matchMedia(mqString).addEventListener("change", updatePixelRatio);
18405
+ } catch (err) {
18406
+ return !1;
18407
+ }
18408
+ return !0;
18409
+ }
18410
+ deactivate(context) {
18411
+ const craf = application.global.getCancelAnimationFrame();
18412
+ craf && this.rafId && craf(this.rafId);
18413
+ }
18414
+ }
18415
+
18281
18416
  class IncrementalAutoRenderPlugin {
18282
18417
  constructor() {
18283
18418
  this.name = "IncrementalAutoRenderPlugin", this.activeEvent = "onRegister", this.nextFrameRenderGroupSet = new Set(), this.willNextFrameRender = !1, this.nextUserParams = {}, this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid;
@@ -18480,7 +18615,7 @@
18480
18615
  canvas: params.canvas
18481
18616
  }), this.state = "normal", this.renderCount = 0, this.tryInitEventSystem(), this._background = null !== (_a = params.background) && void 0 !== _a ? _a : DefaultConfig$1.BACKGROUND, this.appendChild(this.layerService.createLayer(this, {
18482
18617
  main: !0
18483
- })), this.nextFrameRenderLayerSet = new Set(), this.willNextFrameRender = !1, this.stage = this, this.renderStyle = params.renderStyle, params.autoRender && this.enableAutoRender(), !1 === params.disableDirtyBounds && this.enableDirtyBounds(), params.enableHtmlAttribute && this.enableHtmlAttribute(params.enableHtmlAttribute), params.ReactDOM && this.enableReactAttribute(params.ReactDOM), params.enableLayout && this.enableLayout(), this.hooks.beforeRender.tap("constructor", this.beforeRender), this.hooks.afterRender.tap("constructor", this.afterRender), this._beforeRender = params.beforeRender, this._afterRender = params.afterRender, this.ticker = params.ticker || defaultTicker, this.supportInteractiveLayer = !1 !== params.interactiveLayer, this.timeline = new DefaultTimeline(), this.ticker.addTimeline(this.timeline), this.timeline.pause(), params.optimize || (params.optimize = {}), this.optmize(params.optimize), params.background && isString$1(this._background) && this._background.includes("/") && this.setAttributes({
18618
+ })), this.nextFrameRenderLayerSet = new Set(), this.willNextFrameRender = !1, this.stage = this, this.renderStyle = params.renderStyle, params.autoRender && this.enableAutoRender(), params.autoRefresh && this.enableAutoRefresh(), !1 === params.disableDirtyBounds && this.enableDirtyBounds(), params.enableHtmlAttribute && this.enableHtmlAttribute(params.enableHtmlAttribute), params.ReactDOM && this.enableReactAttribute(params.ReactDOM), params.enableLayout && this.enableLayout(), this.hooks.beforeRender.tap("constructor", this.beforeRender), this.hooks.afterRender.tap("constructor", this.afterRender), this._beforeRender = params.beforeRender, this._afterRender = params.afterRender, this.ticker = params.ticker || defaultTicker, this.supportInteractiveLayer = !1 !== params.interactiveLayer, this.timeline = new DefaultTimeline(), this.ticker.addTimeline(this.timeline), this.timeline.pause(), params.optimize || (params.optimize = {}), this.optmize(params.optimize), params.background && isString$1(this._background) && this._background.includes("/") && this.setAttributes({
18484
18619
  background: this._background
18485
18620
  });
18486
18621
  }
@@ -18615,6 +18750,14 @@
18615
18750
  this.pluginService.unRegister(plugin);
18616
18751
  }));
18617
18752
  }
18753
+ enableAutoRefresh() {
18754
+ this.autoRefresh || (this.autoRefresh = !0, this.pluginService.register(new AutoRefreshPlugin()));
18755
+ }
18756
+ disableAutoRefresh() {
18757
+ this.autoRefresh && (this.autoRefresh = !1, this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach(plugin => {
18758
+ this.pluginService.unRegister(plugin);
18759
+ }));
18760
+ }
18618
18761
  enableIncrementalAutoRender() {
18619
18762
  this.increaseAutoRender || (this.increaseAutoRender = !0, this.pluginService.register(new IncrementalAutoRenderPlugin()));
18620
18763
  }
@@ -19621,27 +19764,9 @@
19621
19764
  for (let 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]));
19622
19765
  return points[points.length - 1].x === lastX && points[points.length - 1].y === lastY || newPoints.push(points[points.length - 1]), newPoints;
19623
19766
  }
19624
- function simplifyDPStep(points, startIdx, endIdx, sqTolerance, simplified) {
19625
- let maxSqDist = sqTolerance,
19626
- nextIdx = startIdx;
19627
- const startX = points[startIdx].x,
19628
- startY = points[startIdx].y,
19629
- vecX2 = points[endIdx].x - startX,
19630
- vecY2 = points[endIdx].y - startY,
19631
- sqLength = vecX2 * vecX2 + vecY2 * vecY2;
19632
- let area, sqArea, sqDistance, vecX1, vecY1;
19633
- for (let 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);
19634
- 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));
19635
- }
19636
- function simplifyDouglasPeucker(points, sqTolerance) {
19637
- const lastIdx = points.length - 1,
19638
- simplified = [points[0]];
19639
- return simplifyDPStep(points, 0, lastIdx, sqTolerance, simplified), simplified.push(points[lastIdx]), simplified;
19640
- }
19641
19767
  function flatten_simplify(points, tolerance, highestQuality) {
19642
19768
  if (points.length <= 10) return points;
19643
- const sqTolerance = void 0 !== tolerance ? tolerance * tolerance : 1;
19644
- return points = simplifyDouglasPeucker(points = highestQuality ? points : simplifyRadialDist(points, sqTolerance), sqTolerance);
19769
+ return points = highestQuality ? points : simplifyRadialDist(points, void 0 !== tolerance ? tolerance * tolerance : 1);
19645
19770
  }
19646
19771
 
19647
19772
  function findCursorIndexIgnoreLinebreak(textConfig, cursorIndex) {
@@ -23527,9 +23652,11 @@
23527
23652
  name: name,
23528
23653
  id: id,
23529
23654
  attribute: attribute,
23530
- stateProxy: stateProxy
23655
+ stateProxy: stateProxy,
23656
+ animation: animation,
23657
+ timeline: timeline
23531
23658
  } = _a,
23532
- props = __rest(_a, ["key", "name", "id", "attribute", "stateProxy"]);
23659
+ props = __rest(_a, ["key", "name", "id", "attribute", "stateProxy", "animation", "timeline"]);
23533
23660
  let c = type;
23534
23661
  isString$1(type) && (c = graphicCreator[type]);
23535
23662
  const childrenList = [];
@@ -23538,7 +23665,13 @@
23538
23665
  }
23539
23666
  children.length && flatten(1 === children.length ? children[0] : children, childrenList);
23540
23667
  const g = "Group" === c.name ? new c(attribute) : c(config);
23541
- return parseToGraphic$1(g, childrenList, props), stateProxy && (g.stateProxy = stateProxy), g;
23668
+ if (parseToGraphic$1(g, childrenList, props), stateProxy && (g.stateProxy = stateProxy), name && (g.name = name), isArray$1(animation)) {
23669
+ const animate = g.animate();
23670
+ timeline && animate.setTimeline(timeline), animation.forEach(item => {
23671
+ animate[item[0]](...item.slice(1));
23672
+ });
23673
+ }
23674
+ return g;
23542
23675
  }
23543
23676
  function parseToGraphic$1(g, childrenList, props) {
23544
23677
  let out,
@@ -23678,7 +23811,7 @@
23678
23811
  let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
23679
23812
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
23680
23813
  super(), this.cachedEvents = [], this.startPoints = [], this.processEvent = {}, this.throttleTimer = 0, this.emitThrottles = [], this.lastTapTarget = null, this.onStart = ev => {
23681
- this.reset(), this.startTime = clock.now();
23814
+ this.cachedEvents = [], this.startPoints = [], this.reset(), this.startTime = clock.now();
23682
23815
  const {
23683
23816
  cachedEvents: cachedEvents,
23684
23817
  startPoints: startPoints
@@ -23698,7 +23831,7 @@
23698
23831
  if (1 !== startPoints.length) this.startDistance = calcDistance(startPoints[0], startPoints[1]), this.center = getCenter([startPoints[0], startPoints[1]]);else {
23699
23832
  const event = cachedEvents[0];
23700
23833
  this.pressTimeout = setTimeout(() => {
23701
- event.direction = "none", event.deltaX = 0, event.deltaY = 0, event.points = startPoints, this.triggerStartEvent("press", event), this.triggerEvent("press", event), this.eventType = "press", this.direction = "none";
23834
+ event.direction = "none", event.deltaX = 0, event.deltaY = 0, event.points = startPoints, this.triggerStartEvent("press", event), this.triggerEvent("press", event), this.eventType = "press", this.direction = "none", this.pressTimeout = null;
23702
23835
  }, this.config.press.time);
23703
23836
  }
23704
23837
  }, this.onMove = ev => {
@@ -23761,10 +23894,10 @@
23761
23894
  lastMovePoint = this.lastMovePoint || startPoints[0],
23762
23895
  distance = calcDistance(prevMovePoint, lastMovePoint),
23763
23896
  velocity = distance / intervalTime;
23764
- velocity > this.config.swipe.velocity && distance > this.config.swipe.threshold && (endEvent.velocity = velocity, endEvent.direction = calcDirection(prevMovePoint, lastMovePoint), this.triggerEvent("swipe", endEvent));
23897
+ if (velocity > this.config.swipe.velocity && distance > this.config.swipe.threshold) return endEvent.velocity = velocity, endEvent.direction = calcDirection(prevMovePoint, lastMovePoint), this.triggerEvent("swipe", endEvent), this.cachedEvents = [], this.startPoints = [], void this.reset();
23765
23898
  }
23766
23899
  }
23767
- now - this.lastTapTime < this.config.tap.interval && ev.target === this.lastTapTarget ? this.tapCount++ : this.tapCount = 1, this.lastTapTime = now, this.lastTapTarget = ev.target, 1 === this.tapCount ? this.triggerEvent("tap", endEvent) : 2 === this.tapCount && (this.triggerEvent("doubletap", endEvent), this.tapCount = 0);
23900
+ now - this.startTime < this.config.press.time && (now - this.lastTapTime < this.config.tap.interval && ev.target === this.lastTapTarget ? this.tapCount++ : this.tapCount = 1, this.lastTapTime = now, this.lastTapTarget = ev.target, 1 === this.tapCount ? this.triggerEvent("tap", endEvent) : 2 === this.tapCount && (this.triggerEvent("doubletap", endEvent), this.tapCount = 0));
23768
23901
  }
23769
23902
  for (let i = 0, len = cachedEvents.length; i < len; i++) if (cachedEvents[i].pointerId === endEvent.pointerId) {
23770
23903
  cachedEvents.splice(i, 1), startPoints.splice(i, 1);
@@ -23840,6 +23973,7 @@
23840
23973
  emitThrottles: emitThrottles
23841
23974
  } = this;
23842
23975
  throttleTimer || (this.throttleTimer = application.global.getRequestAnimationFrame()(() => {
23976
+ application.global.getCancelAnimationFrame()(this.throttleTimer), this.throttleTimer = null;
23843
23977
  for (let i = 0, len = emitThrottles.length; i < len; i++) {
23844
23978
  const {
23845
23979
  type: type,
@@ -23847,7 +23981,7 @@
23847
23981
  } = emitThrottles[i];
23848
23982
  this.emitEvent(type, ev);
23849
23983
  }
23850
- this.throttleTimer = 0, this.emitThrottles.length = 0;
23984
+ this.emitThrottles.length = 0;
23851
23985
  }));
23852
23986
  }
23853
23987
  triggerStartEvent(type, ev) {
@@ -28483,7 +28617,7 @@
28483
28617
 
28484
28618
  const roughModule = _roughModule;
28485
28619
 
28486
- const version = "0.21.0-alpha.2";
28620
+ const version = "0.21.0-alpha.4";
28487
28621
  preLoadAllModule();
28488
28622
  if (isBrowserEnv()) {
28489
28623
  loadBrowserEnv(container);