@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.es.js CHANGED
@@ -2726,11 +2726,12 @@ function parseSvgPath(str) {
2726
2726
  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) {
2727
2727
  for (let i = 0, len = coordsStrArr.length; i < len; i++) coordStr = coordsStrArr[i], coordNumber = parseFloat(coordStr), Number.isNaN(coordNumber) || currCommandData.push(coordNumber);
2728
2728
  if (standardCommandLen = commandLengths[commandChar], currCommandData.length - 1 > standardCommandLen) {
2729
- let subCommand;
2729
+ let subCommand,
2730
+ bestCommandChar = commandChar;
2730
2731
  for (let i = 1, len = currCommandData.length; i < len; i += standardCommandLen) {
2731
- subCommand = [commandChar];
2732
+ subCommand = [bestCommandChar];
2732
2733
  for (let j = i, subLen = i + standardCommandLen; j < subLen; j++) subCommand.push(currCommandData[j]);
2733
- result.push(subCommand);
2734
+ result.push(subCommand), "m" === bestCommandChar ? bestCommandChar = "l" : "M" === bestCommandChar && (bestCommandChar = "L");
2734
2735
  }
2735
2736
  } else result.push(currCommandData);
2736
2737
  } else result.push(currCommandData);
@@ -3979,6 +3980,7 @@ const DefaultAttribute = Object.assign(Object.assign(Object.assign({
3979
3980
  zIndex: 0,
3980
3981
  layout: null,
3981
3982
  boundsPadding: 0,
3983
+ fillStrokeOrder: 0,
3982
3984
  renderStyle: "default",
3983
3985
  pickMode: "accurate",
3984
3986
  customPickShape: null,
@@ -4057,6 +4059,7 @@ const DefaultLineAttribute = Object.assign(Object.assign(Object.assign({}, Defau
4057
4059
  });
4058
4060
  const DefaultPathAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
4059
4061
  path: new CustomPath2D(),
4062
+ fillStrokeOrder: 1,
4060
4063
  customPath: () => {
4061
4064
  Logger.getInstance().warn("空函数");
4062
4065
  }
@@ -4369,6 +4372,14 @@ let ATextMeasure = class {
4369
4372
  return data;
4370
4373
  }
4371
4374
  _clipTextEnd(text, options, width, leftIdx, rightIdx) {
4375
+ if (leftIdx === rightIdx) {
4376
+ Logger.getInstance().warn(`【_clipTextEnd】不应该走到这里${text}, ${leftIdx}, ${rightIdx}`);
4377
+ const subText = text.substring(0, rightIdx + 1);
4378
+ return {
4379
+ str: subText,
4380
+ width: this.measureTextWidth(subText, options)
4381
+ };
4382
+ }
4372
4383
  const middleIdx = Math.floor((leftIdx + rightIdx) / 2),
4373
4384
  subText = text.substring(0, middleIdx + 1),
4374
4385
  strWidth = this.measureTextWidth(subText, options);
@@ -4402,7 +4413,7 @@ let ATextMeasure = class {
4402
4413
  }
4403
4414
  _clipTextStart(text, options, width, leftIdx, rightIdx) {
4404
4415
  const middleIdx = Math.ceil((leftIdx + rightIdx) / 2),
4405
- subText = text.substring(middleIdx - 1, text.length - 1),
4416
+ subText = text.substring(middleIdx - 1, text.length),
4406
4417
  strWidth = this.measureTextWidth(subText, options);
4407
4418
  let length;
4408
4419
  if (strWidth > width) {
@@ -4410,18 +4421,18 @@ let ATextMeasure = class {
4410
4421
  str: "",
4411
4422
  width: 0
4412
4423
  };
4413
- const str = text.substring(middleIdx, text.length - 1);
4424
+ const str = text.substring(middleIdx, text.length);
4414
4425
  return length = this.measureTextWidth(str, options), length <= width ? {
4415
4426
  str: str,
4416
4427
  width: length
4417
- } : this._clipTextStart(text, options, width, middleIdx, text.length - 1);
4428
+ } : this._clipTextStart(text, options, width, middleIdx, text.length);
4418
4429
  }
4419
4430
  if (strWidth < width) {
4420
4431
  if (middleIdx <= 0) return {
4421
4432
  str: text,
4422
4433
  width: this.measureTextWidth(text, options)
4423
4434
  };
4424
- const str = text.substring(middleIdx - 2, text.length - 1);
4435
+ const str = text.substring(middleIdx - 2, text.length);
4425
4436
  return length = this.measureTextWidth(str, options), length >= width ? {
4426
4437
  str: subText,
4427
4438
  width: strWidth
@@ -5082,7 +5093,7 @@ let DefaultWindow = class {
5082
5093
  }
5083
5094
  hasSubView() {
5084
5095
  const viewBox = this._handler.getViewBox();
5085
- return !(0 === viewBox.x1 && 0 === viewBox.y1 && this.width === viewBox.width() && this.height === viewBox.height());
5096
+ return !(0 === viewBox.x1 && 0 === viewBox.y1 && isNumberClose(this.width, viewBox.width()) && isNumberClose(this.height, viewBox.height()));
5086
5097
  }
5087
5098
  isVisible(bbox) {
5088
5099
  return this._handler.isVisible(bbox);
@@ -6006,7 +6017,7 @@ class EventManager {
6006
6017
  timeStamp: now
6007
6018
  });
6008
6019
  const clickHistory = trackingData.clicksByButton[from.button];
6009
- 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);
6020
+ 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);
6010
6021
  }
6011
6022
  this.freeEvent(e);
6012
6023
  }, this.onPointerUpOutside = (from, target) => {
@@ -6223,7 +6234,8 @@ class EventSystem {
6223
6234
  supportsPointerEvents = global.supportsPointerEvents
6224
6235
  } = params;
6225
6236
  this.manager = new EventManager(rootNode, {
6226
- clickInterval: clickInterval
6237
+ clickInterval: clickInterval,
6238
+ supportsTouchEvents: supportsTouchEvents
6227
6239
  }), 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 = {
6228
6240
  default: "inherit",
6229
6241
  pointer: "pointer"
@@ -9082,7 +9094,7 @@ class ResourceLoader {
9082
9094
  }
9083
9095
  static GetFile(url, type) {
9084
9096
  let data = ResourceLoader.cache.get(url);
9085
- return data ? "init" === data.loadState || "fail" === data.loadState ? Promise.reject() : "loading" === data.loadState ? data.dataPromise.then(data => data.data) : Promise.resolve(data.data) : (data = {
9097
+ return data ? "fail" === data.loadState ? Promise.reject() : "init" === data.loadState || "loading" === data.loadState ? data.dataPromise.then(data => data.data) : Promise.resolve(data.data) : (data = {
9086
9098
  type: type,
9087
9099
  loadState: "init"
9088
9100
  }, 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));
@@ -12346,8 +12358,9 @@ class DefaultImageRenderContribution extends DefaultRectRenderContribution {
12346
12358
  constructor() {
12347
12359
  super(...arguments), this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
12348
12360
  }
12349
- drawShape(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb) {
12350
- return super.drawShape(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
12361
+ drawShape(image, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb) {
12362
+ if (!(image.isGifImage && image.renderFrame && image.playing)) return super.drawShape(image, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
12363
+ image.renderFrame(context, x, y);
12351
12364
  }
12352
12365
  }
12353
12366
  const defaultImageRenderContribution = new DefaultImageRenderContribution();
@@ -12500,7 +12513,8 @@ let DefaultCanvasArcRender = class extends BaseRender {
12500
12513
  fill = arcAttribute.fill,
12501
12514
  stroke = arcAttribute.stroke,
12502
12515
  x: originX = arcAttribute.x,
12503
- y: originY = arcAttribute.y
12516
+ y: originY = arcAttribute.y,
12517
+ fillStrokeOrder = arcAttribute.fillStrokeOrder
12504
12518
  } = arc.attribute,
12505
12519
  data = this.valid(arc, arcAttribute, fillCb, strokeCb);
12506
12520
  if (!data) return;
@@ -12536,7 +12550,17 @@ let DefaultCanvasArcRender = class extends BaseRender {
12536
12550
  isFullStroke: isFullStroke,
12537
12551
  stroke: arrayStroke
12538
12552
  } = parseStroke(stroke);
12539
- 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) {
12553
+ if (doFill || isFullStroke) {
12554
+ 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);
12555
+ const _runFill = () => {
12556
+ doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.fill()));
12557
+ },
12558
+ _runStroke = () => {
12559
+ doStroke && isFullStroke && (strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.stroke()));
12560
+ };
12561
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke());
12562
+ }
12563
+ if (!isFullStroke && doStroke) {
12540
12564
  context.beginPath();
12541
12565
  drawArcPath$1(arc, context, x, y, outerRadius, innerRadius, arrayStroke);
12542
12566
  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());
@@ -12554,14 +12578,20 @@ let DefaultCanvasArcRender = class extends BaseRender {
12554
12578
  fill = arcAttribute.fill
12555
12579
  } = arc.attribute,
12556
12580
  startAngle = endAngle;
12557
- 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) {
12558
- const color = fill;
12559
- if ("conical" === color.gradient) {
12560
- const lastColor = getConicGradientAt(0, 0, endAngle, color);
12561
- fillCb || fillVisible && (context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute), context.fillStyle = lastColor, context.fill());
12562
- }
12563
- }
12564
- doStroke && (strokeCb || sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()));
12581
+ 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);
12582
+ const _runFill = () => {
12583
+ if (doFill) {
12584
+ const color = fill;
12585
+ if ("conical" === color.gradient) {
12586
+ const lastColor = getConicGradientAt(0, 0, endAngle, color);
12587
+ fillCb || fillVisible && (context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute), context.fillStyle = lastColor, context.fill());
12588
+ }
12589
+ }
12590
+ },
12591
+ _runStroke = () => {
12592
+ doStroke && (strokeCb || sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()));
12593
+ };
12594
+ _runFill(), _runStroke();
12565
12595
  }
12566
12596
  }
12567
12597
  this.afterRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb), tempChangeConicalColor && (fill.startAngle += conicalOffset, fill.endAngle += conicalOffset);
@@ -12599,7 +12629,8 @@ let DefaultCanvasCircleRender = class extends BaseRender {
12599
12629
  startAngle = circleAttribute.startAngle,
12600
12630
  endAngle = circleAttribute.endAngle,
12601
12631
  x: originX = circleAttribute.x,
12602
- y: originY = circleAttribute.y
12632
+ y: originY = circleAttribute.y,
12633
+ fillStrokeOrder = circleAttribute.fillStrokeOrder
12603
12634
  } = circle.attribute,
12604
12635
  data = this.valid(circle, circleAttribute, fillCb, strokeCb);
12605
12636
  if (!data) return;
@@ -12609,7 +12640,14 @@ let DefaultCanvasCircleRender = class extends BaseRender {
12609
12640
  doFill: doFill,
12610
12641
  doStroke: doStroke
12611
12642
  } = data;
12612
- 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);
12643
+ 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);
12644
+ const _runFill = () => {
12645
+ doFill && (fillCb ? fillCb(context, circle.attribute, circleAttribute) : fVisible && (context.setCommonStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute), context.fill()));
12646
+ },
12647
+ _runStroke = () => {
12648
+ doStroke && (strokeCb ? strokeCb(context, circle.attribute, circleAttribute) : sVisible && (context.setStrokeStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute), context.stroke()));
12649
+ };
12650
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, drawContext, fillCb, strokeCb);
12613
12651
  }
12614
12652
  draw(circle, renderService, drawContext, params) {
12615
12653
  const circleAttribute = getTheme(circle, null == params ? void 0 : params.theme).circle;
@@ -13050,7 +13088,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
13050
13088
  super(), this.areaRenderContribitions = areaRenderContribitions, this.numberType = AREA_NUMBER_TYPE, this.builtinContributions = [defaultAreaTextureRenderContribution, defaultAreaBackgroundRenderContribution], this.init(areaRenderContribitions);
13051
13089
  }
13052
13090
  drawLinearAreaHighPerformance(area, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, areaAttribute, drawContext, params, fillCb, strokeCb) {
13053
- var _a, _b, _c, _d, _e;
13091
+ var _a, _b, _c;
13054
13092
  const {
13055
13093
  points: points
13056
13094
  } = area.attribute;
@@ -13074,28 +13112,31 @@ let DefaultCanvasAreaRender = class extends BaseRender {
13074
13112
  x: originX = 0,
13075
13113
  x: originY = 0
13076
13114
  } = area.attribute;
13077
- 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, {
13115
+ !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, {
13078
13116
  attribute: area.attribute
13079
- }), stroke) {
13080
- const {
13081
- stroke = areaAttribute && areaAttribute.stroke
13082
- } = area.attribute;
13083
- if (isArray$1(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1]) if (context.beginPath(), stroke[0]) {
13084
- context.moveTo(startP.x + offsetX, startP.y + offsetY, z);
13085
- for (let i = 1; i < points.length; i++) {
13086
- const p = points[i];
13087
- context.lineTo(p.x + offsetX, p.y + offsetY, z);
13088
- }
13089
- } else if (stroke[2]) {
13090
- const endP = points[points.length - 1];
13091
- context.moveTo(endP.x + offsetX, endP.y + offsetY, z);
13092
- for (let i = points.length - 2; i >= 0; i--) {
13093
- const p = points[i];
13094
- 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);
13117
+ }), (() => {
13118
+ var _a, _b;
13119
+ if (stroke) {
13120
+ const {
13121
+ stroke = areaAttribute && areaAttribute.stroke
13122
+ } = area.attribute;
13123
+ if (isArray$1(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1]) if (context.beginPath(), stroke[0]) {
13124
+ context.moveTo(startP.x + offsetX, startP.y + offsetY, z);
13125
+ for (let i = 1; i < points.length; i++) {
13126
+ const p = points[i];
13127
+ context.lineTo(p.x + offsetX, p.y + offsetY, z);
13128
+ }
13129
+ } else if (stroke[2]) {
13130
+ const endP = points[points.length - 1];
13131
+ context.moveTo(endP.x + offsetX, endP.y + offsetY, z);
13132
+ for (let i = points.length - 2; i >= 0; i--) {
13133
+ const p = points[i];
13134
+ 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);
13135
+ }
13095
13136
  }
13137
+ strokeCb ? strokeCb(context, area.attribute, areaAttribute) : (context.setStrokeStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.stroke());
13096
13138
  }
13097
- strokeCb ? strokeCb(context, area.attribute, areaAttribute) : (context.setStrokeStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.stroke());
13098
- }
13139
+ })();
13099
13140
  }
13100
13141
  drawShape(area, context, x, y, drawContext, params, fillCb, strokeCb) {
13101
13142
  var _a, _b, _c, _d, _e, _f;
@@ -13260,23 +13301,24 @@ let DefaultCanvasAreaRender = class extends BaseRender {
13260
13301
  x: originX = 0,
13261
13302
  x: originY = 0
13262
13303
  } = attribute;
13263
- 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, {
13304
+ 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, {
13264
13305
  attribute: attribute
13265
- }), !1 !== stroke) if (strokeCb) strokeCb(context, attribute, defaultAttribute);else {
13266
- const {
13267
- stroke = defaultAttribute && defaultAttribute[1] && defaultAttribute[1].stroke
13268
- } = attribute;
13269
- 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 === Direction$1.ROW ? "x" : "y", {
13270
- offsetX: offsetX,
13271
- offsetY: offsetY,
13272
- offsetZ: offsetZ,
13273
- drawConnect: connect,
13274
- mode: connectedType,
13275
- zeroX: connectedX,
13276
- zeroY: connectedY
13277
- })), context.setStrokeStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute), context.stroke();
13278
- }
13279
- return !1;
13306
+ }), (() => {
13307
+ if (!1 !== stroke) if (strokeCb) strokeCb(context, attribute, defaultAttribute);else {
13308
+ const {
13309
+ stroke = defaultAttribute && defaultAttribute[1] && defaultAttribute[1].stroke
13310
+ } = attribute;
13311
+ 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 === Direction$1.ROW ? "x" : "y", {
13312
+ offsetX: offsetX,
13313
+ offsetY: offsetY,
13314
+ offsetZ: offsetZ,
13315
+ drawConnect: connect,
13316
+ mode: connectedType,
13317
+ zeroX: connectedX,
13318
+ zeroY: connectedY
13319
+ })), context.setStrokeStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute), context.stroke();
13320
+ }
13321
+ })(), !1;
13280
13322
  }
13281
13323
  };
13282
13324
  DefaultCanvasAreaRender = __decorate$1v([injectable(), __param$N(0, inject(ContributionProvider)), __param$N(0, named(AreaRenderContribution)), __metadata$19("design:paramtypes", [Object])], DefaultCanvasAreaRender);
@@ -13308,7 +13350,8 @@ let DefaultCanvasPathRender = class extends BaseRender {
13308
13350
  const pathAttribute = null !== (_a = this.tempTheme) && void 0 !== _a ? _a : getTheme(path, null == params ? void 0 : params.theme).path,
13309
13351
  {
13310
13352
  x: originX = pathAttribute.x,
13311
- y: originY = pathAttribute.y
13353
+ y: originY = pathAttribute.y,
13354
+ fillStrokeOrder = pathAttribute.fillStrokeOrder
13312
13355
  } = path.attribute,
13313
13356
  z = null !== (_b = this.z) && void 0 !== _b ? _b : 0,
13314
13357
  data = this.valid(path, pathAttribute, fillCb, strokeCb);
@@ -13323,7 +13366,14 @@ let DefaultCanvasPathRender = class extends BaseRender {
13323
13366
  const path2D = null !== (_c = path.attribute.path) && void 0 !== _c ? _c : pathAttribute.path;
13324
13367
  renderCommandList(path2D.commandList, context, x, y, 1, 1, z);
13325
13368
  }
13326
- 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);
13369
+ context.setShadowBlendStyle && context.setShadowBlendStyle(path, path.attribute, pathAttribute), this.beforeRenderStep(path, context, x, y, doFill, doStroke, fVisible, sVisible, pathAttribute, drawContext, fillCb, strokeCb);
13370
+ const _runStroke = () => {
13371
+ doStroke && (strokeCb ? strokeCb(context, path.attribute, pathAttribute) : sVisible && (context.setStrokeStyle(path, path.attribute, originX - x, originY - y, pathAttribute), context.stroke()));
13372
+ },
13373
+ _runFill = () => {
13374
+ doFill && (fillCb ? fillCb(context, path.attribute, pathAttribute) : fVisible && (context.setCommonStyle(path, path.attribute, originX - x, originY - y, pathAttribute), context.fill()));
13375
+ };
13376
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(path, context, x, y, doFill, doStroke, fVisible, sVisible, pathAttribute, drawContext, fillCb, strokeCb);
13327
13377
  }
13328
13378
  draw(path, renderService, drawContext, params) {
13329
13379
  const pathAttribute = getTheme(path, null == params ? void 0 : params.theme).path;
@@ -13367,7 +13417,8 @@ let DefaultCanvasRectRender = class extends BaseRender {
13367
13417
  x1: x1,
13368
13418
  y1: y1,
13369
13419
  x: originX = rectAttribute.x,
13370
- y: originY = rectAttribute.y
13420
+ y: originY = rectAttribute.y,
13421
+ fillStrokeOrder = rectAttribute.fillStrokeOrder
13371
13422
  } = rect.attribute;
13372
13423
  let {
13373
13424
  width: width,
@@ -13386,7 +13437,14 @@ let DefaultCanvasRectRender = class extends BaseRender {
13386
13437
  doFill: doFill,
13387
13438
  doStroke: doStroke
13388
13439
  };
13389
- 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);
13440
+ context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute), this.beforeRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb, doFillOrStroke);
13441
+ const _runFill = () => {
13442
+ doFillOrStroke.doFill && (fillCb ? fillCb(context, rect.attribute, rectAttribute) : fVisible && (context.setCommonStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.fill()));
13443
+ },
13444
+ _runStroke = () => {
13445
+ doFillOrStroke.doStroke && (strokeCb ? strokeCb(context, rect.attribute, rectAttribute) : sVisible && (context.setStrokeStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.stroke()));
13446
+ };
13447
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
13390
13448
  }
13391
13449
  draw(rect, renderService, drawContext, params) {
13392
13450
  const rectAttribute = getTheme(rect, null == params ? void 0 : params.theme).rect;
@@ -13422,7 +13480,8 @@ let DefaultCanvasSymbolRender = class extends BaseRender {
13422
13480
  x: originX = symbolAttribute.x,
13423
13481
  y: originY = symbolAttribute.y,
13424
13482
  scaleX = symbolAttribute.scaleX,
13425
- scaleY = symbolAttribute.scaleY
13483
+ scaleY = symbolAttribute.scaleY,
13484
+ fillStrokeOrder = symbolAttribute.fillStrokeOrder
13426
13485
  } = symbol.attribute,
13427
13486
  data = this.valid(symbol, symbolAttribute, fillCb, strokeCb);
13428
13487
  if (!data) return;
@@ -13445,14 +13504,27 @@ let DefaultCanvasSymbolRender = class extends BaseRender {
13445
13504
  const obj = Object.assign({}, a);
13446
13505
  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;
13447
13506
  }
13448
- 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()));
13507
+ const _runFill = () => {
13508
+ a.fill && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : (context.setCommonStyle(symbol, a, originX - x, originY - y, symbolAttribute), context.fill()));
13509
+ },
13510
+ _runStroke = () => {
13511
+ a.stroke && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : (context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke()));
13512
+ };
13513
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke());
13449
13514
  };
13450
13515
  if (keepDirIn3d && context.camera && context.project) {
13451
13516
  const p = context.project(x, y, z),
13452
13517
  camera = context.camera;
13453
13518
  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;
13454
13519
  } else !1 === parsedPath.draw(context, size, x, y, z, callback) && context.closePath();
13455
- 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);
13520
+ context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute), this.beforeRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
13521
+ const _runFill = () => {
13522
+ doFill && !parsedPath.isSvg && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : fVisible && (context.setCommonStyle(symbol, symbol.attribute, originX - x, originY - y, symbolAttribute), context.fill()));
13523
+ },
13524
+ _runStroke = () => {
13525
+ doStroke && !parsedPath.isSvg && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : sVisible && (context.setStrokeStyle(symbol, symbol.attribute, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke()));
13526
+ };
13527
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
13456
13528
  }
13457
13529
  draw(symbol, renderService, drawContext, params) {
13458
13530
  const symbolAttribute = getTheme(symbol, null == params ? void 0 : params.theme).symbol;
@@ -13839,7 +13911,8 @@ let DefaultCanvasPolygonRender = class extends BaseRender {
13839
13911
  cornerRadius = polygonAttribute.cornerRadius,
13840
13912
  x: originX = polygonAttribute.x,
13841
13913
  y: originY = polygonAttribute.y,
13842
- closePath = polygonAttribute.closePath
13914
+ closePath = polygonAttribute.closePath,
13915
+ fillStrokeOrder = polygonAttribute.fillStrokeOrder
13843
13916
  } = polygon.attribute,
13844
13917
  data = this.valid(polygon, polygonAttribute, fillCb, strokeCb);
13845
13918
  if (!data) return;
@@ -13849,7 +13922,14 @@ let DefaultCanvasPolygonRender = class extends BaseRender {
13849
13922
  doFill: doFill,
13850
13923
  doStroke: doStroke
13851
13924
  } = data;
13852
- 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);
13925
+ 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);
13926
+ const _runFill = () => {
13927
+ doFill && (fillCb ? fillCb(context, polygon.attribute, polygonAttribute) : fVisible && (context.setCommonStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute), context.fill()));
13928
+ },
13929
+ _runStroke = () => {
13930
+ doStroke && (strokeCb ? strokeCb(context, polygon.attribute, polygonAttribute) : sVisible && (context.setStrokeStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute), context.stroke()));
13931
+ };
13932
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(polygon, context, x, y, doFill, doStroke, fVisible, sVisible, polygonAttribute, drawContext, fillCb, strokeCb);
13853
13933
  }
13854
13934
  draw(polygon, renderService, drawContext, params) {
13855
13935
  const polygonAttribute = getTheme(polygon, null == params ? void 0 : params.theme).polygon;
@@ -13892,7 +13972,10 @@ let DefaultCanvasGroupRender = class {
13892
13972
  cornerRadius = groupAttribute.cornerRadius,
13893
13973
  path = groupAttribute.path,
13894
13974
  lineWidth = groupAttribute.lineWidth,
13895
- visible = groupAttribute.visible
13975
+ visible = groupAttribute.visible,
13976
+ fillStrokeOrder = groupAttribute.fillStrokeOrder,
13977
+ x: originX = groupAttribute.x,
13978
+ y: originY = groupAttribute.y
13896
13979
  } = group.attribute,
13897
13980
  fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
13898
13981
  sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height),
@@ -13918,7 +14001,14 @@ let DefaultCanvasGroupRender = class {
13918
14001
  };
13919
14002
  this._groupRenderContribitions.forEach(c => {
13920
14003
  c.time === BaseRenderContributionTime.beforeFillStroke && c.drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb, doFillOrStroke);
13921
- }), 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 => {
14004
+ }), clip && context.clip(), context.setShadowBlendStyle && context.setShadowBlendStyle(group, group.attribute, groupAttribute);
14005
+ const _runFill = () => {
14006
+ doFillOrStroke.doFill && (fillCb ? fillCb(context, group.attribute, groupAttribute) : fVisible && (context.setCommonStyle(group, group.attribute, originX - x, originY - y, groupAttribute), context.fill()));
14007
+ },
14008
+ _runStroke = () => {
14009
+ doFillOrStroke.doStroke && (strokeCb ? strokeCb(context, group.attribute, groupAttribute) : sVisible && (context.setStrokeStyle(group, group.attribute, originX - x, originY - y, groupAttribute), context.stroke()));
14010
+ };
14011
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this._groupRenderContribitions.forEach(c => {
13922
14012
  c.time === BaseRenderContributionTime.afterFillStroke && c.drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb);
13923
14013
  });
13924
14014
  }
@@ -13984,6 +14074,7 @@ let DefaultCanvasImageRender = class extends BaseRender {
13984
14074
  x: originX = imageAttribute.x,
13985
14075
  y: originY = imageAttribute.y,
13986
14076
  cornerRadius = imageAttribute.cornerRadius,
14077
+ fillStrokeOrder = imageAttribute.fillStrokeOrder,
13987
14078
  image: url
13988
14079
  } = image.attribute,
13989
14080
  data = this.valid(image, imageAttribute, fillCb);
@@ -13994,29 +14085,37 @@ let DefaultCanvasImageRender = class extends BaseRender {
13994
14085
  doFill: doFill,
13995
14086
  doStroke: doStroke
13996
14087
  } = data;
13997
- 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) {
13998
- if (!url || !image.resources) return;
13999
- const res = image.resources.get(url);
14000
- if ("success" !== res.state) return;
14001
- let needRestore = !1;
14002
- 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);
14003
- let repeat = 0;
14004
- if ("repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat) {
14005
- const pattern = context.createPattern(res.data, repeatStr[repeat]);
14006
- context.fillStyle = pattern, context.translate(x, y, !0), context.fillRect(0, 0, width, height), context.translate(-x, -y, !0);
14007
- } else context.drawImage(res.data, x, y, width, height);
14008
- needRestore && context.restore();
14009
- }
14010
- 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);
14088
+ context.setShadowBlendStyle && context.setShadowBlendStyle(image, imageAttribute), this.beforeRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb);
14089
+ const _runFill = () => {
14090
+ if (doFill) if (fillCb) fillCb(context, image.attribute, imageAttribute);else if (fVisible) {
14091
+ if (!url || !image.resources) return;
14092
+ const res = image.resources.get(url);
14093
+ if ("success" !== res.state) return;
14094
+ let needRestore = !1;
14095
+ 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);
14096
+ let repeat = 0;
14097
+ if ("repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat) {
14098
+ const pattern = context.createPattern(res.data, repeatStr[repeat]);
14099
+ context.fillStyle = pattern, context.translate(x, y, !0), context.fillRect(0, 0, width, height), context.translate(-x, -y, !0);
14100
+ } else context.drawImage(res.data, x, y, width, height);
14101
+ needRestore && context.restore();
14102
+ }
14103
+ },
14104
+ _runStroke = () => {
14105
+ doStroke && (strokeCb ? strokeCb(context, image.attribute, imageAttribute) : sVisible && (context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute), context.stroke()));
14106
+ };
14107
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb);
14011
14108
  }
14012
14109
  draw(image, renderService, drawContext) {
14013
14110
  const {
14014
14111
  image: url
14015
14112
  } = image.attribute;
14016
- if (!url || !image.resources) return;
14017
- const res = image.resources.get(url);
14018
- if ("loading" === res.state && isString$1(url)) return void ResourceLoader.improveImageLoading(url);
14019
- if ("success" !== res.state) return;
14113
+ if (!image.isGifImage) {
14114
+ if (!url || !image.resources) return;
14115
+ const res = image.resources.get(url);
14116
+ if ("loading" === res.state && isString$1(url)) return void ResourceLoader.improveImageLoading(url);
14117
+ if ("success" !== res.state) return;
14118
+ }
14020
14119
  const {
14021
14120
  context: context
14022
14121
  } = renderService.drawParams;
@@ -18272,6 +18371,42 @@ class AutoRenderPlugin {
18272
18371
  }
18273
18372
  }
18274
18373
 
18374
+ class AutoRefreshPlugin {
18375
+ constructor() {
18376
+ this.name = "AutoRefreshPlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid, this.handleChange = graphic => {
18377
+ graphic.glyphHost && (graphic = graphic.glyphHost), graphic.stage === this.pluginService.stage && null != graphic.stage && graphic.stage.renderNextFrame();
18378
+ };
18379
+ }
18380
+ activate(context) {
18381
+ this.pluginService = context, this.dpr = application.global.devicePixelRatio, this.refresh();
18382
+ }
18383
+ refresh() {
18384
+ this._refreshByMediaQuery() || this._refreshByRaf();
18385
+ }
18386
+ _refreshByRaf() {
18387
+ const raf = application.global.getRequestAnimationFrame();
18388
+ this.rafId = raf(() => {
18389
+ application.global.devicePixelRatio !== this.dpr && (this.dpr = application.global.devicePixelRatio, this.pluginService.stage.setDpr(this.dpr, !0)), this.refresh();
18390
+ });
18391
+ }
18392
+ _refreshByMediaQuery() {
18393
+ try {
18394
+ const mqString = `(resolution: ${window.devicePixelRatio}dppx)`,
18395
+ updatePixelRatio = () => {
18396
+ window.devicePixelRatio !== this.dpr && (this.dpr = window.devicePixelRatio, this.pluginService.stage.setDpr(this.dpr, !0));
18397
+ };
18398
+ matchMedia(mqString).addEventListener("change", updatePixelRatio);
18399
+ } catch (err) {
18400
+ return !1;
18401
+ }
18402
+ return !0;
18403
+ }
18404
+ deactivate(context) {
18405
+ const craf = application.global.getCancelAnimationFrame();
18406
+ craf && this.rafId && craf(this.rafId);
18407
+ }
18408
+ }
18409
+
18275
18410
  class IncrementalAutoRenderPlugin {
18276
18411
  constructor() {
18277
18412
  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;
@@ -18474,7 +18609,7 @@ class Stage extends Group {
18474
18609
  canvas: params.canvas
18475
18610
  }), 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, {
18476
18611
  main: !0
18477
- })), 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({
18612
+ })), 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({
18478
18613
  background: this._background
18479
18614
  });
18480
18615
  }
@@ -18609,6 +18744,14 @@ class Stage extends Group {
18609
18744
  this.pluginService.unRegister(plugin);
18610
18745
  }));
18611
18746
  }
18747
+ enableAutoRefresh() {
18748
+ this.autoRefresh || (this.autoRefresh = !0, this.pluginService.register(new AutoRefreshPlugin()));
18749
+ }
18750
+ disableAutoRefresh() {
18751
+ this.autoRefresh && (this.autoRefresh = !1, this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach(plugin => {
18752
+ this.pluginService.unRegister(plugin);
18753
+ }));
18754
+ }
18612
18755
  enableIncrementalAutoRender() {
18613
18756
  this.increaseAutoRender || (this.increaseAutoRender = !0, this.pluginService.register(new IncrementalAutoRenderPlugin()));
18614
18757
  }
@@ -19615,27 +19758,9 @@ function simplifyRadialDist(points, sqTolerance) {
19615
19758
  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]));
19616
19759
  return points[points.length - 1].x === lastX && points[points.length - 1].y === lastY || newPoints.push(points[points.length - 1]), newPoints;
19617
19760
  }
19618
- function simplifyDPStep(points, startIdx, endIdx, sqTolerance, simplified) {
19619
- let maxSqDist = sqTolerance,
19620
- nextIdx = startIdx;
19621
- const startX = points[startIdx].x,
19622
- startY = points[startIdx].y,
19623
- vecX2 = points[endIdx].x - startX,
19624
- vecY2 = points[endIdx].y - startY,
19625
- sqLength = vecX2 * vecX2 + vecY2 * vecY2;
19626
- let area, sqArea, sqDistance, vecX1, vecY1;
19627
- 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);
19628
- 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));
19629
- }
19630
- function simplifyDouglasPeucker(points, sqTolerance) {
19631
- const lastIdx = points.length - 1,
19632
- simplified = [points[0]];
19633
- return simplifyDPStep(points, 0, lastIdx, sqTolerance, simplified), simplified.push(points[lastIdx]), simplified;
19634
- }
19635
19761
  function flatten_simplify(points, tolerance, highestQuality) {
19636
19762
  if (points.length <= 10) return points;
19637
- const sqTolerance = void 0 !== tolerance ? tolerance * tolerance : 1;
19638
- return points = simplifyDouglasPeucker(points = highestQuality ? points : simplifyRadialDist(points, sqTolerance), sqTolerance);
19763
+ return points = highestQuality ? points : simplifyRadialDist(points, void 0 !== tolerance ? tolerance * tolerance : 1);
19639
19764
  }
19640
19765
 
19641
19766
  function findCursorIndexIgnoreLinebreak(textConfig, cursorIndex) {
@@ -23521,9 +23646,11 @@ function jsx(type, config) {
23521
23646
  name: name,
23522
23647
  id: id,
23523
23648
  attribute: attribute,
23524
- stateProxy: stateProxy
23649
+ stateProxy: stateProxy,
23650
+ animation: animation,
23651
+ timeline: timeline
23525
23652
  } = _a,
23526
- props = __rest(_a, ["key", "name", "id", "attribute", "stateProxy"]);
23653
+ props = __rest(_a, ["key", "name", "id", "attribute", "stateProxy", "animation", "timeline"]);
23527
23654
  let c = type;
23528
23655
  isString$1(type) && (c = graphicCreator[type]);
23529
23656
  const childrenList = [];
@@ -23532,7 +23659,13 @@ function jsx(type, config) {
23532
23659
  }
23533
23660
  children.length && flatten(1 === children.length ? children[0] : children, childrenList);
23534
23661
  const g = "Group" === c.name ? new c(attribute) : c(config);
23535
- return parseToGraphic$1(g, childrenList, props), stateProxy && (g.stateProxy = stateProxy), g;
23662
+ if (parseToGraphic$1(g, childrenList, props), stateProxy && (g.stateProxy = stateProxy), name && (g.name = name), isArray$1(animation)) {
23663
+ const animate = g.animate();
23664
+ timeline && animate.setTimeline(timeline), animation.forEach(item => {
23665
+ animate[item[0]](...item.slice(1));
23666
+ });
23667
+ }
23668
+ return g;
23536
23669
  }
23537
23670
  function parseToGraphic$1(g, childrenList, props) {
23538
23671
  let out,
@@ -23672,7 +23805,7 @@ class Gesture extends EventEmitter {
23672
23805
  let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
23673
23806
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
23674
23807
  super(), this.cachedEvents = [], this.startPoints = [], this.processEvent = {}, this.throttleTimer = 0, this.emitThrottles = [], this.lastTapTarget = null, this.onStart = ev => {
23675
- this.reset(), this.startTime = clock.now();
23808
+ this.cachedEvents = [], this.startPoints = [], this.reset(), this.startTime = clock.now();
23676
23809
  const {
23677
23810
  cachedEvents: cachedEvents,
23678
23811
  startPoints: startPoints
@@ -23692,7 +23825,7 @@ class Gesture extends EventEmitter {
23692
23825
  if (1 !== startPoints.length) this.startDistance = calcDistance(startPoints[0], startPoints[1]), this.center = getCenter([startPoints[0], startPoints[1]]);else {
23693
23826
  const event = cachedEvents[0];
23694
23827
  this.pressTimeout = setTimeout(() => {
23695
- 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";
23828
+ 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;
23696
23829
  }, this.config.press.time);
23697
23830
  }
23698
23831
  }, this.onMove = ev => {
@@ -23755,10 +23888,10 @@ class Gesture extends EventEmitter {
23755
23888
  lastMovePoint = this.lastMovePoint || startPoints[0],
23756
23889
  distance = calcDistance(prevMovePoint, lastMovePoint),
23757
23890
  velocity = distance / intervalTime;
23758
- velocity > this.config.swipe.velocity && distance > this.config.swipe.threshold && (endEvent.velocity = velocity, endEvent.direction = calcDirection(prevMovePoint, lastMovePoint), this.triggerEvent("swipe", endEvent));
23891
+ 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();
23759
23892
  }
23760
23893
  }
23761
- 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);
23894
+ 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));
23762
23895
  }
23763
23896
  for (let i = 0, len = cachedEvents.length; i < len; i++) if (cachedEvents[i].pointerId === endEvent.pointerId) {
23764
23897
  cachedEvents.splice(i, 1), startPoints.splice(i, 1);
@@ -23834,6 +23967,7 @@ class Gesture extends EventEmitter {
23834
23967
  emitThrottles: emitThrottles
23835
23968
  } = this;
23836
23969
  throttleTimer || (this.throttleTimer = application.global.getRequestAnimationFrame()(() => {
23970
+ application.global.getCancelAnimationFrame()(this.throttleTimer), this.throttleTimer = null;
23837
23971
  for (let i = 0, len = emitThrottles.length; i < len; i++) {
23838
23972
  const {
23839
23973
  type: type,
@@ -23841,7 +23975,7 @@ class Gesture extends EventEmitter {
23841
23975
  } = emitThrottles[i];
23842
23976
  this.emitEvent(type, ev);
23843
23977
  }
23844
- this.throttleTimer = 0, this.emitThrottles.length = 0;
23978
+ this.emitThrottles.length = 0;
23845
23979
  }));
23846
23980
  }
23847
23981
  triggerStartEvent(type, ev) {
@@ -28477,7 +28611,7 @@ const registerWrapText = _registerWrapText;
28477
28611
 
28478
28612
  const roughModule = _roughModule;
28479
28613
 
28480
- const version = "0.21.0-alpha.2";
28614
+ const version = "0.21.0-alpha.4";
28481
28615
  preLoadAllModule();
28482
28616
  if (isBrowserEnv()) {
28483
28617
  loadBrowserEnv(container);