@visactor/vchart 2.0.21 → 2.0.22-alpha.0

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.
Files changed (40) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +148 -374
  3. package/build/index.js +148 -374
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/animation/callback-disappear.js +1 -2
  7. package/cjs/animation/utils.js +2 -1
  8. package/cjs/constant/correlation.js +2 -1
  9. package/cjs/constant/marker.js +1 -1
  10. package/cjs/constant/polar.js +1 -1
  11. package/cjs/constant/scatter.js +1 -1
  12. package/cjs/constant/scroll-bar.js +1 -2
  13. package/cjs/constant/sunburst.js +1 -1
  14. package/cjs/constant/waterfall.js +1 -1
  15. package/cjs/constant/word-cloud.js +1 -1
  16. package/cjs/core/index.js +1 -1
  17. package/cjs/core/instance-manager.js +1 -1
  18. package/cjs/core/interface.js +1 -1
  19. package/cjs/core/util.js +1 -1
  20. package/cjs/core/vchart.js +1 -1
  21. package/cjs/env/env.js +1 -1
  22. package/cjs/env/index.js +1 -1
  23. package/esm/animation/callback-disappear.js +1 -2
  24. package/esm/animation/utils.js +2 -1
  25. package/esm/constant/correlation.js +2 -1
  26. package/esm/constant/marker.js +1 -1
  27. package/esm/constant/polar.js +1 -1
  28. package/esm/constant/scatter.js +1 -1
  29. package/esm/constant/scroll-bar.js +1 -2
  30. package/esm/constant/sunburst.js +1 -1
  31. package/esm/constant/waterfall.js +1 -1
  32. package/esm/constant/word-cloud.js +1 -1
  33. package/esm/core/index.js +1 -1
  34. package/esm/core/instance-manager.js +1 -1
  35. package/esm/core/interface.js +1 -1
  36. package/esm/core/util.js +1 -1
  37. package/esm/core/vchart.js +1 -1
  38. package/esm/env/env.js +1 -1
  39. package/esm/env/index.js +1 -1
  40. package/package.json +12 -8
package/build/index.es.js CHANGED
@@ -11444,7 +11444,6 @@ const DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({
11444
11444
  backgroundScale: 1,
11445
11445
  backgroundOffsetX: 0,
11446
11446
  backgroundOffsetY: 0,
11447
- backgroundPosition: "top-left",
11448
11447
  blur: 0,
11449
11448
  filter: "",
11450
11449
  cursor: null,
@@ -11617,16 +11616,11 @@ const DefaultRichTextAttribute = Object.assign(Object.assign(Object.assign({}, D
11617
11616
  const DefaultImageAttribute = Object.assign(Object.assign({
11618
11617
  repeatX: "no-repeat",
11619
11618
  repeatY: "no-repeat",
11620
- imageMode: void 0,
11621
11619
  image: "",
11622
11620
  width: 0,
11623
11621
  height: 0,
11624
11622
  maxWidth: 500,
11625
- maxHeight: 500,
11626
- imagePosition: "top-left",
11627
- imageScale: 1,
11628
- imageOffsetX: 0,
11629
- imageOffsetY: 0
11623
+ maxHeight: 500
11630
11624
  }, DefaultAttribute), {
11631
11625
  fill: !0,
11632
11626
  cornerRadius: 0,
@@ -16065,6 +16059,7 @@ const GRAPHIC_UPDATE_TAG_KEY = ["lineWidth", "scaleX", "scaleY", "angle", "ancho
16065
16059
  const tempConstantXYKey = ["x", "y"],
16066
16060
  tempConstantScaleXYKey = ["scaleX", "scaleY"],
16067
16061
  tempConstantAngleKey = ["angle"],
16062
+ builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
16068
16063
  point = new Point();
16069
16064
  const NOWORK_ANIMATE_ATTR = {
16070
16065
  strokeSeg: 1,
@@ -16121,7 +16116,7 @@ class Graphic extends Node {
16121
16116
  }
16122
16117
  constructor(params = {}) {
16123
16118
  var _a;
16124
- super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background ? this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
16119
+ super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background && this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0), isExternalTexture(params.texture) ? this.loadImage(params.texture, !1) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
16125
16120
  }
16126
16121
  getGraphicService() {
16127
16122
  var _a, _b;
@@ -16310,7 +16305,7 @@ class Graphic extends Node {
16310
16305
  });
16311
16306
  }
16312
16307
  setAttributes(params, forceUpdateTag = !1, context) {
16313
- params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
16308
+ params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background && this.loadImage(params.background, !0), isExternalTexture(params.texture) ? this.loadImage(params.texture, !1) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
16314
16309
  }
16315
16310
  _setAttributes(params, forceUpdateTag = !1, context) {
16316
16311
  const keys = Object.keys(params);
@@ -16325,7 +16320,7 @@ class Graphic extends Node {
16325
16320
  const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
16326
16321
  [key]: value
16327
16322
  }, this.attribute, key, context);
16328
- params ? this._setAttributes(params, forceUpdateTag, context) : isNil$1(null === (_a = this.normalAttrs) || void 0 === _a ? void 0 : _a[key]) ? (this.attribute[key] = value, this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag(), this.onAttributeUpdate(context)) : this.normalAttrs[key] = value, "background" === key ? this.loadImage(value, !0) : "shadowGraphic" === key && this.setShadowGraphic(value);
16323
+ params ? this._setAttributes(params, forceUpdateTag, context) : isNil$1(null === (_a = this.normalAttrs) || void 0 === _a ? void 0 : _a[key]) ? (this.attribute[key] = value, this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag(), this.onAttributeUpdate(context)) : this.normalAttrs[key] = value, "background" === key ? this.loadImage(value, !0) : "texture" === key && isExternalTexture(value) ? this.loadImage(value, !1) : "shadowGraphic" === key && this.setShadowGraphic(value);
16329
16324
  }
16330
16325
  needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
16331
16326
  for (let i = 0; i < k.length; i++) {
@@ -16344,7 +16339,7 @@ class Graphic extends Node {
16344
16339
  const context = {
16345
16340
  type: AttributeUpdateType.INIT
16346
16341
  };
16347
- params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._updateTag = UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
16342
+ params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background && this.loadImage(params.background, !0), isExternalTexture(params.texture) ? this.loadImage(params.texture, !1) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._updateTag = UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
16348
16343
  }
16349
16344
  translate(x, y) {
16350
16345
  var _a, _b;
@@ -16677,8 +16672,7 @@ class Graphic extends Node {
16677
16672
  return isString$1(path, !0) ? this.pathProxy = new CustomPath2D().fromString(path) : this.pathProxy = new CustomPath2D(), this.pathProxy;
16678
16673
  }
16679
16674
  loadImage(image, background = !1) {
16680
- if (background && (null == image ? void 0 : image.background) && (image = image.background), background && (!image || backgroundNotImage(image))) return void (this.backgroundImg = !1);
16681
- if (!image) return;
16675
+ if (!image || background && backgroundNotImage(image)) return;
16682
16676
  const url = image;
16683
16677
  this.resources || (this.resources = new Map());
16684
16678
  const cache = {
@@ -16733,7 +16727,10 @@ class Graphic extends Node {
16733
16727
  }
16734
16728
  }
16735
16729
  function backgroundNotImage(image) {
16736
- return "string" == typeof image ? !(image.startsWith("<svg") || isValidUrl$1(image) || image.includes("/") || isBase64$1(image)) : !(!image.fill && !image.stroke) || !("string" != typeof image.gradient || !Array.isArray(image.stops));
16730
+ return !(!image.fill && !image.stroke);
16731
+ }
16732
+ function isExternalTexture(texture) {
16733
+ return !!texture && ("string" == typeof texture ? !builtinTextureTypes.has(texture) && (texture.startsWith("<svg") || isValidUrl$1(texture) || texture.includes("/") || isBase64$1(texture)) : isObject$2(texture));
16737
16734
  }
16738
16735
  Graphic.userSymbolMap = {}, Graphic.mixin(EventTarget);
16739
16736
 
@@ -18866,7 +18863,7 @@ function seperateParagraph(paragraph, index) {
18866
18863
  return [new Paragraph(text1, paragraph.newLine, paragraph.character, paragraph.ascentDescentMode), new Paragraph(text2, !0, paragraph.character, paragraph.ascentDescentMode)];
18867
18864
  }
18868
18865
 
18869
- const IMAGE_UPDATE_TAG_KEY = ["width", "height", "image", "imageMode", "imagePosition", "imageScale", "imageOffsetX", "imageOffsetY", ...GRAPHIC_UPDATE_TAG_KEY];
18866
+ const IMAGE_UPDATE_TAG_KEY = ["width", "height", "image", ...GRAPHIC_UPDATE_TAG_KEY];
18870
18867
  class Image extends Graphic {
18871
18868
  constructor(params) {
18872
18869
  super(params), this.type = "image", this.numberType = IMAGE_NUMBER_TYPE, this.loadImage(this.attribute.image);
@@ -18971,7 +18968,6 @@ class Image extends Graphic {
18971
18968
  }
18972
18969
  Image.NOWORK_ANIMATE_ATTR = Object.assign({
18973
18970
  image: 1,
18974
- imageMode: 1,
18975
18971
  repeatX: 1,
18976
18972
  repeatY: 1
18977
18973
  }, NOWORK_ANIMATE_ATTR);
@@ -20165,12 +20161,11 @@ class DefaultBaseBackgroundRenderContribution {
20165
20161
  backgroundScale = graphicAttribute.backgroundScale,
20166
20162
  backgroundOffsetX = graphicAttribute.backgroundOffsetX,
20167
20163
  backgroundOffsetY = graphicAttribute.backgroundOffsetY,
20168
- backgroundClip = graphicAttribute.backgroundClip,
20169
- backgroundPosition = graphicAttribute.backgroundPosition
20164
+ backgroundClip = graphicAttribute.backgroundClip
20170
20165
  } = graphic.attribute;
20171
20166
  if (background) if (graphic.backgroundImg && graphic.resources) {
20172
- const res = graphic.resources.get(getBackgroundImage(background));
20173
- if (!res || "success" !== res.state || !res.data) return;
20167
+ const res = graphic.resources.get(background);
20168
+ if ("success" !== res.state || !res.data) return;
20174
20169
  if (context.save(), graphic.parent && !graphic.transMatrix.onlyTranslate()) {
20175
20170
  const groupAttribute = getTheme$1(graphic.parent).group,
20176
20171
  {
@@ -20187,160 +20182,59 @@ class DefaultBaseBackgroundRenderContribution {
20187
20182
  backgroundKeepAspectRatio: backgroundKeepAspectRatio,
20188
20183
  backgroundScale: backgroundScale,
20189
20184
  backgroundOffsetX: backgroundOffsetX,
20190
- backgroundOffsetY: backgroundOffsetY,
20191
- backgroundPosition: backgroundPosition
20185
+ backgroundOffsetY: backgroundOffsetY
20192
20186
  }), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
20193
20187
  } else context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, context.fill(), context.highPerformanceRestore();
20194
20188
  }
20195
20189
  doDrawImage(context, data, b, params) {
20196
- drawBackgroundImage(context, data, b, params);
20197
- }
20198
- }
20199
- const defaultBaseBackgroundRenderContribution = new DefaultBaseBackgroundRenderContribution();
20200
- const verticalPositionKeywords = new Set(["top", "center", "bottom"]);
20201
- function getBackgroundImage(background) {
20202
- var _a;
20203
- return null !== (_a = null == background ? void 0 : background.background) && void 0 !== _a ? _a : background;
20204
- }
20205
- function resolveBackgroundSizing({
20206
- backgroundFit: backgroundFit,
20207
- backgroundKeepAspectRatio: backgroundKeepAspectRatio
20208
- }) {
20209
- return backgroundFit ? backgroundKeepAspectRatio ? "cover" : "fill" : "auto";
20210
- }
20211
- const NO_REPEAT_SIZING_MAP = {
20212
- "no-repeat-cover": "cover",
20213
- "no-repeat-contain": "contain",
20214
- "no-repeat-fill": "fill",
20215
- "no-repeat-auto": "auto"
20216
- };
20217
- function resolveBackgroundDrawMode({
20218
- backgroundMode: backgroundMode,
20219
- backgroundFit: backgroundFit,
20220
- backgroundKeepAspectRatio: backgroundKeepAspectRatio
20221
- }) {
20222
- const sizing = NO_REPEAT_SIZING_MAP[backgroundMode];
20223
- return sizing ? {
20224
- backgroundRepeatMode: "no-repeat",
20225
- backgroundSizing: sizing
20226
- } : {
20227
- backgroundRepeatMode: backgroundMode,
20228
- backgroundSizing: resolveBackgroundSizing({
20229
- backgroundFit: backgroundFit,
20230
- backgroundKeepAspectRatio: backgroundKeepAspectRatio
20231
- })
20232
- };
20233
- }
20234
- function isPercentageValue(value) {
20235
- return /^-?\d+(\.\d+)?%$/.test(value);
20236
- }
20237
- function parsePositionToken(value, remainSpace, startKeyword, centerKeyword, endKeyword) {
20238
- if ("number" == typeof value && Number.isFinite(value)) return value;
20239
- const normalizedValue = `${null != value ? value : ""}`.trim().toLowerCase();
20240
- if (!normalizedValue || normalizedValue === startKeyword) return 0;
20241
- if (normalizedValue === centerKeyword) return remainSpace / 2;
20242
- if (normalizedValue === endKeyword) return remainSpace;
20243
- if (isPercentageValue(normalizedValue)) return remainSpace * parseFloat(normalizedValue) / 100;
20244
- const parsedValue = Number(normalizedValue);
20245
- return Number.isFinite(parsedValue) ? parsedValue : 0;
20246
- }
20247
- function normalizeBackgroundPosition(position) {
20248
- var _a, _b;
20249
- if (Array.isArray(position)) return [null !== (_a = position[0]) && void 0 !== _a ? _a : "left", null !== (_b = position[1]) && void 0 !== _b ? _b : "top"];
20250
- const tokens = `${null != position ? position : "top-left"}`.trim().toLowerCase().replace(/-/g, " ").split(/\s+/).filter(Boolean);
20251
- if (0 === tokens.length) return ["left", "top"];
20252
- if (1 === tokens.length) {
20253
- const token = tokens[0];
20254
- return "center" === token ? ["center", "center"] : verticalPositionKeywords.has(token) ? ["center", token] : [token, "center"];
20255
- }
20256
- let horizontal, vertical;
20257
- const genericTokens = [];
20258
- for (let i = 0; i < 2; i++) {
20259
- const token = tokens[i];
20260
- "left" !== token && "right" !== token ? "top" !== token && "bottom" !== token ? genericTokens.push(token) : vertical = token : horizontal = token;
20261
- }
20262
- return null == horizontal && genericTokens.length && (horizontal = genericTokens.shift()), null == vertical && genericTokens.length && (vertical = genericTokens.shift()), [null != horizontal ? horizontal : "left", null != vertical ? vertical : "top"];
20263
- }
20264
- function resolveBackgroundPosition(position, remainWidth, remainHeight) {
20265
- const [horizontalPosition, verticalPosition] = normalizeBackgroundPosition(position);
20266
- return {
20267
- x: parsePositionToken(horizontalPosition, remainWidth, "left", "center", "right"),
20268
- y: parsePositionToken(verticalPosition, remainHeight, "top", "center", "bottom")
20269
- };
20270
- }
20271
- function pickRenderableDimension(...values) {
20272
- for (const value of values) if ("number" == typeof value && Number.isFinite(value) && value > 0) return value;
20273
- return null;
20274
- }
20275
- function resolveRenderableImageSize(data) {
20276
- if (!data) return null;
20277
- const width = pickRenderableDimension(data.naturalWidth, data.videoWidth, data.width),
20278
- height = pickRenderableDimension(data.naturalHeight, data.videoHeight, data.height);
20279
- return null == width || null == height ? null : {
20280
- width: width,
20281
- height: height
20282
- };
20283
- }
20284
- function drawBackgroundImage(context, data, b, params) {
20285
- var _a, _b;
20286
- const {
20287
- backgroundMode: backgroundMode,
20288
- backgroundFit: backgroundFit,
20289
- backgroundKeepAspectRatio: backgroundKeepAspectRatio,
20290
- backgroundScale = 1,
20291
- backgroundOffsetX = 0,
20292
- backgroundOffsetY = 0,
20293
- backgroundPosition = "top-left"
20294
- } = params,
20295
- targetW = b.width(),
20296
- targetH = b.height(),
20297
- sourceSize = resolveRenderableImageSize(data),
20298
- {
20299
- backgroundRepeatMode: backgroundRepeatMode,
20300
- backgroundSizing: resolvedBackgroundSizing
20301
- } = resolveBackgroundDrawMode({
20302
- backgroundMode: backgroundMode,
20303
- backgroundFit: backgroundFit,
20304
- backgroundKeepAspectRatio: backgroundKeepAspectRatio
20305
- });
20306
- let w = targetW,
20307
- h = targetH;
20308
- if (targetW <= 0 || targetH <= 0) return;
20309
- if ("no-repeat" === backgroundRepeatMode) {
20310
- let drawWidth = null !== (_a = null == sourceSize ? void 0 : sourceSize.width) && void 0 !== _a ? _a : targetW,
20311
- drawHeight = null !== (_b = null == sourceSize ? void 0 : sourceSize.height) && void 0 !== _b ? _b : targetH;
20312
- if ("cover" !== resolvedBackgroundSizing && "contain" !== resolvedBackgroundSizing || !sourceSize) "fill" === resolvedBackgroundSizing && (drawWidth = targetW, drawHeight = targetH);else {
20313
- const scale = "cover" === resolvedBackgroundSizing ? Math.max(targetW / sourceSize.width, targetH / sourceSize.height) : Math.min(targetW / sourceSize.width, targetH / sourceSize.height);
20314
- drawWidth = sourceSize.width * scale, drawHeight = sourceSize.height * scale;
20315
- }
20316
- drawWidth *= backgroundScale, drawHeight *= backgroundScale;
20317
20190
  const {
20318
- x: x,
20319
- y: y
20320
- } = resolveBackgroundPosition(backgroundPosition, targetW - drawWidth, targetH - drawHeight);
20321
- return void context.drawImage(data, b.x1 + x + backgroundOffsetX, b.y1 + y + backgroundOffsetY, drawWidth, drawHeight);
20322
- }
20323
- if (backgroundFit && "repeat" !== backgroundRepeatMode && sourceSize) {
20324
- const resW = sourceSize.width,
20325
- resH = sourceSize.height;
20326
- if ("repeat-x" === backgroundRepeatMode) {
20327
- w = resW * (targetH / resH), h = targetH;
20328
- } else if ("repeat-y" === backgroundRepeatMode) {
20329
- h = resH * (targetW / resW), w = targetW;
20330
- }
20331
- const dpr = context.dpr,
20332
- canvas = canvasAllocate.allocate({
20333
- width: w,
20334
- height: h,
20335
- dpr: dpr
20336
- }),
20337
- ctx = canvas.getContext("2d");
20338
- ctx && (ctx.inuse = !0, ctx.clearMatrix(), ctx.setTransformForCurrent(!0), ctx.clearRect(0, 0, w, h), ctx.drawImage(data, 0, 0, w, h), data = canvas.nativeCanvas), canvasAllocate.free(canvas);
20191
+ backgroundMode: backgroundMode,
20192
+ backgroundFit: backgroundFit,
20193
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio,
20194
+ backgroundScale = 1,
20195
+ backgroundOffsetX = 0,
20196
+ backgroundOffsetY = 0
20197
+ } = params,
20198
+ targetW = b.width(),
20199
+ targetH = b.height();
20200
+ let w = targetW,
20201
+ h = targetH;
20202
+ if ("no-repeat" === backgroundMode) {
20203
+ if (backgroundFit) {
20204
+ if (backgroundKeepAspectRatio) {
20205
+ const maxScale = Math.max(targetW / data.width, targetH / data.height);
20206
+ context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, data.width * maxScale * backgroundScale, data.height * maxScale * backgroundScale);
20207
+ } else context.drawImage(data, b.x1, b.y1, b.width(), b.height());
20208
+ } else {
20209
+ const resW = data.width * backgroundScale,
20210
+ resH = data.height * backgroundScale;
20211
+ context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, resW, resH);
20212
+ }
20213
+ } else {
20214
+ if (backgroundFit && "repeat" !== backgroundMode && (data.width || data.height)) {
20215
+ const resW = data.width,
20216
+ resH = data.height;
20217
+ if ("repeat-x" === backgroundMode) {
20218
+ w = resW * (targetH / resH), h = targetH;
20219
+ } else if ("repeat-y" === backgroundMode) {
20220
+ h = resH * (targetW / resW), w = targetW;
20221
+ }
20222
+ const dpr = context.dpr,
20223
+ canvas = canvasAllocate.allocate({
20224
+ width: w,
20225
+ height: h,
20226
+ dpr: dpr
20227
+ }),
20228
+ ctx = canvas.getContext("2d");
20229
+ ctx && (ctx.inuse = !0, ctx.clearMatrix(), ctx.setTransformForCurrent(!0), ctx.clearRect(0, 0, w, h), ctx.drawImage(data, 0, 0, w, h), data = canvas.nativeCanvas), canvasAllocate.free(canvas);
20230
+ }
20231
+ const dpr = context.dpr,
20232
+ pattern = context.createPattern(data, backgroundMode);
20233
+ pattern.setTransform && pattern.setTransform(new DOMMatrix([1 / dpr, 0, 0, 1 / dpr, 0, 0])), context.fillStyle = pattern, context.translate(b.x1, b.y1), context.fillRect(0, 0, targetW, targetH), context.translate(-b.x1, -b.y1);
20234
+ }
20339
20235
  }
20340
- const dpr = context.dpr,
20341
- pattern = context.createPattern(data, backgroundRepeatMode);
20342
- pattern.setTransform && pattern.setTransform(new DOMMatrix([1 / dpr, 0, 0, 1 / dpr, 0, 0])), context.fillStyle = pattern, context.translate(b.x1, b.y1), context.fillRect(0, 0, targetW, targetH), context.translate(-b.x1, -b.y1);
20343
20236
  }
20237
+ const defaultBaseBackgroundRenderContribution = new DefaultBaseBackgroundRenderContribution();
20344
20238
  let DefaultBaseInteractiveRenderContribution = class {
20345
20239
  constructor(subRenderContribitions) {
20346
20240
  this.subRenderContribitions = subRenderContribitions, this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
@@ -20504,33 +20398,37 @@ class DefaultBaseTextureRenderContribution {
20504
20398
  textureRatio = graphicAttribute.textureRatio,
20505
20399
  textureOptions = null
20506
20400
  } = graphic.attribute;
20507
- let pattern = this.textureMap.get(texture);
20508
- if (!pattern) switch (texture) {
20509
- case "circle":
20510
- pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
20511
- break;
20512
- case "diamond":
20513
- pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
20514
- break;
20515
- case "rect":
20516
- pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
20517
- break;
20518
- case "vertical-line":
20519
- pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
20520
- break;
20521
- case "horizontal-line":
20522
- pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
20523
- break;
20524
- case "bias-lr":
20525
- pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
20526
- break;
20527
- case "bias-rl":
20528
- pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
20529
- break;
20530
- case "grid":
20531
- pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
20401
+ let pattern = null;
20402
+ const patternKey = this.getPatternCacheKey(texture, textureSize, texturePadding, textureColor, context.dpr);
20403
+ if (null !== patternKey && (pattern = this.textureMap.get(patternKey)), !pattern) {
20404
+ if ("string" == typeof texture) switch (texture) {
20405
+ case "circle":
20406
+ pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
20407
+ break;
20408
+ case "diamond":
20409
+ pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
20410
+ break;
20411
+ case "rect":
20412
+ pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
20413
+ break;
20414
+ case "vertical-line":
20415
+ pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
20416
+ break;
20417
+ case "horizontal-line":
20418
+ pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
20419
+ break;
20420
+ case "bias-lr":
20421
+ pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
20422
+ break;
20423
+ case "bias-rl":
20424
+ pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
20425
+ break;
20426
+ case "grid":
20427
+ pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
20428
+ }
20429
+ pattern || (pattern = this.createResourcePattern(texture, graphic, context)), pattern && null !== patternKey && this.textureMap.set(patternKey, pattern);
20532
20430
  }
20533
- if (textureOptions && textureOptions.dynamicTexture) {
20431
+ if ("string" == typeof texture && textureOptions && textureOptions.dynamicTexture) {
20534
20432
  const {
20535
20433
  gridConfig = {},
20536
20434
  useNewCanvas: useNewCanvas
@@ -20586,6 +20484,17 @@ class DefaultBaseTextureRenderContribution {
20586
20484
  }), x + b.x1 - x, y + b.y1 - y), context.restore();
20587
20485
  }
20588
20486
  }
20487
+ getPatternCacheKey(texture, textureSize, texturePadding, textureColor, dpr) {
20488
+ return "string" != typeof texture ? texture : "wave" === texture ? null : `${texture}-${textureSize}-${texturePadding}-${textureColor}-${dpr}`;
20489
+ }
20490
+ createResourcePattern(texture, graphic, context) {
20491
+ var _a;
20492
+ const resource = null === (_a = graphic.resources) || void 0 === _a ? void 0 : _a.get(texture),
20493
+ data = "success" === (null == resource ? void 0 : resource.state) ? resource.data : "object" == typeof texture ? texture : null;
20494
+ if (!data) return null;
20495
+ const pattern = context.createPattern(data, "repeat");
20496
+ return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), pattern;
20497
+ }
20589
20498
  }
20590
20499
  const defaultBaseTextureRenderContribution = new DefaultBaseTextureRenderContribution();
20591
20500
 
@@ -20697,32 +20606,27 @@ class DefaultGroupBackgroundRenderContribution extends DefaultBaseBackgroundRend
20697
20606
  drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
20698
20607
  const {
20699
20608
  background: background,
20700
- backgroundOpacity = graphicAttribute.backgroundOpacity,
20701
- opacity = graphicAttribute.opacity,
20702
20609
  backgroundMode = graphicAttribute.backgroundMode,
20703
20610
  backgroundFit = graphicAttribute.backgroundFit,
20704
20611
  backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
20705
20612
  backgroundScale = graphicAttribute.backgroundScale,
20706
20613
  backgroundOffsetX = graphicAttribute.backgroundOffsetX,
20707
- backgroundOffsetY = graphicAttribute.backgroundOffsetY,
20708
- backgroundClip = graphicAttribute.backgroundClip,
20709
- backgroundPosition = graphicAttribute.backgroundPosition
20614
+ backgroundOffsetY = graphicAttribute.backgroundOffsetY
20710
20615
  } = graphic.attribute;
20711
20616
  if (background) if (graphic.backgroundImg && graphic.resources) {
20712
- const res = graphic.resources.get(getBackgroundImage(background));
20713
- if (!res || "success" !== res.state || !res.data) return;
20617
+ const res = graphic.resources.get(background);
20618
+ if ("success" !== res.state || !res.data) return;
20714
20619
  context.highPerformanceSave(), context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0);
20715
20620
  const b = graphic.AABBBounds;
20716
- context.globalAlpha = backgroundOpacity * opacity, backgroundClip && context.clip(), this.doDrawImage(context, res.data, b, {
20621
+ this.doDrawImage(context, res.data, b, {
20717
20622
  backgroundMode: backgroundMode,
20718
20623
  backgroundFit: backgroundFit,
20719
20624
  backgroundKeepAspectRatio: backgroundKeepAspectRatio,
20720
20625
  backgroundScale: backgroundScale,
20721
20626
  backgroundOffsetX: backgroundOffsetX,
20722
- backgroundOffsetY: backgroundOffsetY,
20723
- backgroundPosition: backgroundPosition
20627
+ backgroundOffsetY: backgroundOffsetY
20724
20628
  }), context.highPerformanceRestore(), context.setTransformForCurrent();
20725
- } else context.highPerformanceSave(), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, context.fill(), context.highPerformanceRestore();
20629
+ } else context.highPerformanceSave(), context.fillStyle = background, context.fill(), context.highPerformanceRestore();
20726
20630
  }
20727
20631
  }
20728
20632
  const defaultGroupBackgroundRenderContribution = new DefaultGroupBackgroundRenderContribution();
@@ -22204,17 +22108,9 @@ class DefaultTextBackgroundRenderContribution extends DefaultBaseBackgroundRende
22204
22108
  drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
22205
22109
  var _a, _c, _d, _e, _f, _g, _h, _j, _k, _l;
22206
22110
  const {
22207
- backgroundOpacity = graphicAttribute.backgroundOpacity,
22208
- opacity = graphicAttribute.opacity,
22209
22111
  backgroundMode = graphicAttribute.backgroundMode,
22210
22112
  backgroundFit = graphicAttribute.backgroundFit,
22211
- backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
22212
- backgroundScale = graphicAttribute.backgroundScale,
22213
- backgroundOffsetX = graphicAttribute.backgroundOffsetX,
22214
- backgroundOffsetY = graphicAttribute.backgroundOffsetY,
22215
- backgroundPosition = graphicAttribute.backgroundPosition,
22216
- backgroundClip = graphicAttribute.backgroundClip,
22217
- backgroundCornerRadius = graphicAttribute.backgroundCornerRadius
22113
+ backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio
22218
22114
  } = graphic.attribute;
22219
22115
  let matrix,
22220
22116
  {
@@ -22226,18 +22122,18 @@ class DefaultTextBackgroundRenderContribution extends DefaultBaseBackgroundRende
22226
22122
  };
22227
22123
  let b;
22228
22124
  "richtext" === graphic.type && (matrix = context.currentMatrix.clone(), context.restore(), context.save(), context.setTransformForCurrent());
22229
- const backgroundConfig = isObject$2(background) && background.background ? background : null,
22125
+ const shouldReCalBounds = isObject$2(background) && background.background,
22230
22126
  onlyTranslate = graphic.transMatrix.onlyTranslate();
22231
- if (backgroundConfig) {
22127
+ if (shouldReCalBounds) {
22232
22128
  const _b = graphic.AABBBounds,
22233
- x = (null !== (_a = backgroundConfig.x) && void 0 !== _a ? _a : _b.x1) + (null !== (_c = backgroundConfig.dx) && void 0 !== _c ? _c : 0),
22234
- y = (null !== (_d = backgroundConfig.y) && void 0 !== _d ? _d : _b.y1) + (null !== (_e = backgroundConfig.dy) && void 0 !== _e ? _e : 0),
22235
- w = null !== (_f = backgroundConfig.width) && void 0 !== _f ? _f : _b.width(),
22236
- h = null !== (_g = backgroundConfig.height) && void 0 !== _g ? _g : _b.height();
22237
- if (b = boundsAllocate.allocate(x, y, x + w, y + h), background = backgroundConfig.background, !onlyTranslate) {
22129
+ x = (null !== (_a = background.x) && void 0 !== _a ? _a : _b.x1) + (null !== (_c = background.dx) && void 0 !== _c ? _c : 0),
22130
+ y = (null !== (_d = background.y) && void 0 !== _d ? _d : _b.y1) + (null !== (_e = background.dy) && void 0 !== _e ? _e : 0),
22131
+ w = null !== (_f = background.width) && void 0 !== _f ? _f : _b.width(),
22132
+ h = null !== (_g = background.height) && void 0 !== _g ? _g : _b.height();
22133
+ if (b = boundsAllocate.allocate(x, y, x + w, y + h), background = background.background, !onlyTranslate) {
22238
22134
  const w = b.width(),
22239
22135
  h = b.height();
22240
- b.set((null !== (_h = backgroundConfig.x) && void 0 !== _h ? _h : 0) + (null !== (_j = backgroundConfig.dx) && void 0 !== _j ? _j : 0), (null !== (_k = backgroundConfig.y) && void 0 !== _k ? _k : 0) + (null !== (_l = backgroundConfig.dy) && void 0 !== _l ? _l : 0), w, h);
22136
+ b.set((null !== (_h = background.x) && void 0 !== _h ? _h : 0) + (null !== (_j = background.dx) && void 0 !== _j ? _j : 0), (null !== (_k = background.y) && void 0 !== _k ? _k : 0) + (null !== (_l = background.dy) && void 0 !== _l ? _l : 0), w, h);
22241
22137
  }
22242
22138
  } else b = graphic.AABBBounds, onlyTranslate || (b = getTextBounds(Object.assign(Object.assign({}, graphic.attribute), {
22243
22139
  angle: 0,
@@ -22250,18 +22146,20 @@ class DefaultTextBackgroundRenderContribution extends DefaultBaseBackgroundRende
22250
22146
  })).clone());
22251
22147
  if (graphic.backgroundImg && graphic.resources) {
22252
22148
  const res = graphic.resources.get(background);
22253
- if (!res || "success" !== res.state || !res.data) return void restore();
22254
- context.highPerformanceSave(), onlyTranslate && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.globalAlpha = backgroundOpacity * opacity, backgroundClip && (context.beginPath(), backgroundCornerRadius ? createRectPath(context, b.x1, b.y1, b.width(), b.height(), backgroundCornerRadius, !0) : context.rect(b.x1, b.y1, b.width(), b.height()), context.clip()), this.doDrawImage(context, res.data, b, {
22149
+ if ("success" !== res.state || !res.data) return void restore();
22150
+ context.highPerformanceSave(), onlyTranslate && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), this.doDrawImage(context, res.data, b, {
22255
22151
  backgroundMode: backgroundMode,
22256
22152
  backgroundFit: backgroundFit,
22257
- backgroundKeepAspectRatio: backgroundKeepAspectRatio,
22258
- backgroundScale: backgroundScale,
22259
- backgroundOffsetX: backgroundOffsetX,
22260
- backgroundOffsetY: backgroundOffsetY,
22261
- backgroundPosition: backgroundPosition
22153
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio
22262
22154
  }), context.highPerformanceRestore(), context.setTransformForCurrent();
22263
- } else context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, backgroundCornerRadius ? (createRectPath(context, b.x1, b.y1, b.width(), b.height(), backgroundCornerRadius, !0), context.fill()) : context.fillRect(b.x1, b.y1, b.width(), b.height()), context.highPerformanceRestore();
22264
- backgroundConfig && boundsAllocate.free(b), restore();
22155
+ } else {
22156
+ const {
22157
+ backgroundCornerRadius: backgroundCornerRadius,
22158
+ backgroundOpacity = 1
22159
+ } = graphic.attribute;
22160
+ context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.globalAlpha = backgroundOpacity, context.fillStyle = background, backgroundCornerRadius ? (createRectPath(context, b.x1, b.y1, b.width(), b.height(), backgroundCornerRadius, !0), context.fill()) : context.fillRect(b.x1, b.y1, b.width(), b.height()), context.highPerformanceRestore();
22161
+ }
22162
+ shouldReCalBounds && boundsAllocate.free(b), restore();
22265
22163
  }
22266
22164
  }
22267
22165
  const defaultTextBackgroundRenderContribution = new DefaultTextBackgroundRenderContribution();
@@ -22688,92 +22586,6 @@ var __decorate$1h = undefined && undefined.__decorate || function (decorators, t
22688
22586
  };
22689
22587
  };
22690
22588
  const repeatStr = ["", "repeat-x", "repeat-y", "repeat"];
22691
- function resolveImageMode({
22692
- repeatX = "no-repeat",
22693
- repeatY = "no-repeat",
22694
- imageMode: imageMode
22695
- }) {
22696
- const repeatMode = resolveImageRepeatMode(repeatX, repeatY);
22697
- return {
22698
- repeatMode: repeatMode,
22699
- sizingMode: "no-repeat" === repeatMode && null != imageMode ? imageMode : "fill"
22700
- };
22701
- }
22702
- const IMAGE_MODE_TO_BACKGROUND_MODE = {
22703
- cover: "no-repeat-cover",
22704
- contain: "no-repeat-contain",
22705
- fill: "no-repeat-fill",
22706
- auto: "no-repeat-auto"
22707
- };
22708
- function resolveBackgroundParamsByImageSizing(sizingMode) {
22709
- return {
22710
- backgroundMode: IMAGE_MODE_TO_BACKGROUND_MODE[sizingMode],
22711
- backgroundFit: !1,
22712
- backgroundKeepAspectRatio: !1
22713
- };
22714
- }
22715
- function resolveImageRepeatMode(repeatX, repeatY) {
22716
- let repeat = 0;
22717
- return "repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat ? repeatStr[repeat] : "no-repeat";
22718
- }
22719
- function shouldClipImageByLayout({
22720
- repeatX = "no-repeat",
22721
- repeatY = "no-repeat",
22722
- imageMode: imageMode,
22723
- imageScale = 1,
22724
- imageOffsetX = 0,
22725
- imageOffsetY = 0,
22726
- imagePosition = "top-left"
22727
- }) {
22728
- const {
22729
- repeatMode: repeatMode,
22730
- sizingMode: sizingMode
22731
- } = resolveImageMode({
22732
- repeatX: repeatX,
22733
- repeatY: repeatY,
22734
- imageMode: imageMode
22735
- });
22736
- return "no-repeat" === repeatMode && ("cover" === sizingMode || "auto" === sizingMode || 1 !== imageScale || 0 !== imageOffsetX || 0 !== imageOffsetY);
22737
- }
22738
- function drawImageWithLayout(context, data, x, y, width, height, {
22739
- repeatX = "no-repeat",
22740
- repeatY = "no-repeat",
22741
- imageMode: imageMode,
22742
- imageScale = 1,
22743
- imageOffsetX = 0,
22744
- imageOffsetY = 0,
22745
- imagePosition = "top-left"
22746
- }) {
22747
- const {
22748
- repeatMode: repeatMode,
22749
- sizingMode: sizingMode
22750
- } = resolveImageMode({
22751
- repeatX: repeatX,
22752
- repeatY: repeatY,
22753
- imageMode: imageMode
22754
- }),
22755
- imageBackgroundParams = "no-repeat" === repeatMode ? resolveBackgroundParamsByImageSizing(sizingMode) : {
22756
- backgroundMode: repeatMode,
22757
- backgroundFit: !1,
22758
- backgroundKeepAspectRatio: !1
22759
- };
22760
- drawBackgroundImage(context, data, {
22761
- x1: x,
22762
- y1: y,
22763
- x2: x + width,
22764
- y2: y + height,
22765
- width: () => width,
22766
- height: () => height
22767
- }, {
22768
- backgroundMode: imageBackgroundParams.backgroundMode,
22769
- backgroundFit: imageBackgroundParams.backgroundFit,
22770
- backgroundKeepAspectRatio: imageBackgroundParams.backgroundKeepAspectRatio,
22771
- backgroundScale: imageScale,
22772
- backgroundOffsetX: imageOffsetX,
22773
- backgroundOffsetY: imageOffsetY,
22774
- backgroundPosition: imagePosition
22775
- });
22776
- }
22777
22589
  let DefaultCanvasImageRender = class extends BaseRender {
22778
22590
  constructor(graphicRenderContributions) {
22779
22591
  super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = IMAGE_NUMBER_TYPE, this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution], this.init(graphicRenderContributions);
@@ -22788,11 +22600,6 @@ let DefaultCanvasImageRender = class extends BaseRender {
22788
22600
  cornerRadius = imageAttribute.cornerRadius,
22789
22601
  fillStrokeOrder = imageAttribute.fillStrokeOrder,
22790
22602
  cornerType = imageAttribute.cornerType,
22791
- imageMode = imageAttribute.imageMode,
22792
- imageScale = imageAttribute.imageScale,
22793
- imageOffsetX = imageAttribute.imageOffsetX,
22794
- imageOffsetY = imageAttribute.imageOffsetY,
22795
- imagePosition = imageAttribute.imagePosition,
22796
22603
  image: url
22797
22604
  } = image.attribute,
22798
22605
  data = this.valid(image, imageAttribute, fillCb);
@@ -22809,33 +22616,22 @@ let DefaultCanvasImageRender = class extends BaseRender {
22809
22616
  const width = image.width,
22810
22617
  height = image.height;
22811
22618
  context.beginPath();
22812
- let needCornerClip = !1;
22813
- 0 === cornerRadius || isArray$1(cornerRadius) && cornerRadius.every(num => 0 === num) ? context.rect(x, y, width, height) : (createRectPath(context, x, y, width, height, cornerRadius, "bevel" !== cornerType), needCornerClip = !0), context.setShadowBlendStyle && context.setShadowBlendStyle(image, image.attribute, imageAttribute);
22619
+ let needRestore = !1;
22620
+ 0 === cornerRadius || isArray$1(cornerRadius) && cornerRadius.every(num => 0 === num) ? context.rect(x, y, width, height) : (createRectPath(context, x, y, width, height, cornerRadius, "bevel" !== cornerType), needRestore = !0), context.setShadowBlendStyle && context.setShadowBlendStyle(image, image.attribute, imageAttribute);
22814
22621
  const _runFill = () => {
22815
- doFill && (fillCb ? fillCb(context, image.attribute, imageAttribute) : fVisible && (context.setCommonStyle(image, image.attribute, x, y, imageAttribute), drawImageWithLayout(context, res.data, x, y, width, height, {
22816
- repeatX: repeatX,
22817
- repeatY: repeatY,
22818
- imageMode: imageMode,
22819
- imageScale: imageScale,
22820
- imageOffsetX: imageOffsetX,
22821
- imageOffsetY: imageOffsetY,
22822
- imagePosition: imagePosition
22823
- })));
22622
+ if (doFill) if (fillCb) fillCb(context, image.attribute, imageAttribute);else if (fVisible) {
22623
+ context.setCommonStyle(image, image.attribute, x, y, imageAttribute);
22624
+ let repeat = 0;
22625
+ if ("repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat) {
22626
+ const pattern = context.createPattern(res.data, repeatStr[repeat]);
22627
+ context.fillStyle = pattern, context.translate(x, y, !0), context.fillRect(0, 0, width, height), context.translate(-x, -y, !0);
22628
+ } else context.drawImage(res.data, x, y, width, height);
22629
+ }
22824
22630
  },
22825
22631
  _runStroke = () => {
22826
22632
  doStroke && (strokeCb ? strokeCb(context, image.attribute, imageAttribute) : sVisible && (context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute), context.stroke()));
22827
- },
22828
- needLayoutClip = shouldClipImageByLayout({
22829
- repeatX: repeatX,
22830
- repeatY: repeatY,
22831
- imageMode: imageMode,
22832
- imageScale: imageScale,
22833
- imageOffsetX: imageOffsetX,
22834
- imageOffsetY: imageOffsetY,
22835
- imagePosition: imagePosition
22836
- }),
22837
- needClip = needCornerClip || needLayoutClip;
22838
- fillStrokeOrder ? (_runStroke(), needClip && (context.save(), context.clip()), this.beforeRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb), _runFill(), needClip && context.restore()) : (needClip && (context.save(), context.clip()), this.beforeRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb), _runFill(), needClip && context.restore(), _runStroke()), this.afterRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb);
22633
+ };
22634
+ fillStrokeOrder ? (_runStroke(), needRestore && (context.save(), context.clip()), this.beforeRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb), _runFill(), needRestore && context.restore()) : (needRestore && (context.save(), context.clip()), this.beforeRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb), _runFill(), needRestore && context.restore(), _runStroke()), this.afterRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb);
22839
22635
  }
22840
22636
  draw(image, renderService, drawContext) {
22841
22637
  const {
@@ -23694,7 +23490,7 @@ let DefaultDrawContribution = class {
23694
23490
  return data || this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);
23695
23491
  }
23696
23492
  clearScreen(renderService, context, drawContext) {
23697
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
23493
+ var _a, _b, _c;
23698
23494
  const {
23699
23495
  clear: clear,
23700
23496
  viewBox: viewBox
@@ -23704,20 +23500,9 @@ let DefaultDrawContribution = class {
23704
23500
  if (clear) {
23705
23501
  context.clearRect(0, 0, width, height), (null === (_a = renderService.drawParams) || void 0 === _a ? void 0 : _a.stage) && renderService.drawParams.stage.hooks.afterClearRect.call(renderService.drawParams);
23706
23502
  const stage = null === (_b = renderService.drawParams) || void 0 === _b ? void 0 : _b.stage;
23707
- if (stage && (context.globalAlpha = (null !== (_c = stage.attribute.opacity) && void 0 !== _c ? _c : 1) * (null !== (_d = stage.attribute.backgroundOpacity) && void 0 !== _d ? _d : 1)), stage && stage.backgroundImg && stage.resources) {
23708
- const res = stage.resources.get(getBackgroundImage(clear));
23709
- if (res && "success" === res.state && res.data) {
23710
- const backgroundBounds = boundsAllocate.allocate(0, 0, 0 + width, 0 + height);
23711
- drawBackgroundImage(context, res.data, backgroundBounds, {
23712
- backgroundMode: null !== (_e = stage.attribute.backgroundMode) && void 0 !== _e ? _e : DefaultAttribute.backgroundMode,
23713
- backgroundFit: null !== (_f = stage.attribute.backgroundFit) && void 0 !== _f ? _f : DefaultAttribute.backgroundFit,
23714
- backgroundKeepAspectRatio: null !== (_g = stage.attribute.backgroundKeepAspectRatio) && void 0 !== _g ? _g : DefaultAttribute.backgroundKeepAspectRatio,
23715
- backgroundScale: null !== (_h = stage.attribute.backgroundScale) && void 0 !== _h ? _h : DefaultAttribute.backgroundScale,
23716
- backgroundOffsetX: null !== (_j = stage.attribute.backgroundOffsetX) && void 0 !== _j ? _j : DefaultAttribute.backgroundOffsetX,
23717
- backgroundOffsetY: null !== (_k = stage.attribute.backgroundOffsetY) && void 0 !== _k ? _k : DefaultAttribute.backgroundOffsetY,
23718
- backgroundPosition: null !== (_l = stage.attribute.backgroundPosition) && void 0 !== _l ? _l : DefaultAttribute.backgroundPosition
23719
- }), boundsAllocate.free(backgroundBounds);
23720
- }
23503
+ if (stage && (context.globalAlpha = null !== (_c = stage.attribute.opacity) && void 0 !== _c ? _c : 1), stage && stage.backgroundImg && stage.resources) {
23504
+ const res = stage.resources.get(clear);
23505
+ res && "success" === res.state && res.data && context.drawImage(res.data, 0, 0, width, height);
23721
23506
  } else context.fillStyle = createColor(context, clear, {
23722
23507
  AABBBounds: {
23723
23508
  x1: 0,
@@ -24215,7 +24000,7 @@ class Stage extends Group$1 {
24215
24000
  return null !== (_a = this._background) && void 0 !== _a ? _a : DefaultConfig.BACKGROUND;
24216
24001
  }
24217
24002
  set background(b) {
24218
- this._background = b, this.syncBackgroundImage(b);
24003
+ this._background = b;
24219
24004
  }
24220
24005
  get defaultLayer() {
24221
24006
  return this.at(0);
@@ -24229,18 +24014,6 @@ class Stage extends Group$1 {
24229
24014
  set ticker(ticker) {
24230
24015
  ticker.bindStage(this), this._ticker && this._ticker.removeListener("tick", this.afterTickCb), ticker.addTimeline(this.timeline), this._ticker = ticker, this._ticker.on("tick", this.afterTickCb);
24231
24016
  }
24232
- syncBackgroundImage(background) {
24233
- var _a;
24234
- const source = null !== (_a = null == background ? void 0 : background.background) && void 0 !== _a ? _a : background;
24235
- this.backgroundImg = !1, this.isImageBackgroundSource(source) && this.loadImage(source, !0);
24236
- }
24237
- isImageBackgroundSource(source) {
24238
- if (!source) return !1;
24239
- if ("string" == typeof source) return source.startsWith("<svg") || isValidUrl$1(source) || source.includes("/") || isBase64$1(source);
24240
- if (!isObject$2(source)) return !1;
24241
- const gradientSource = source;
24242
- return "string" != typeof gradientSource.gradient || !Array.isArray(gradientSource.stops);
24243
- }
24244
24017
  constructor(params = {}) {
24245
24018
  var _a, _b;
24246
24019
  super({}), this.tickedBeforeRender = !0, this._onVisibleChange = visible => {
@@ -24279,7 +24052,9 @@ class Stage extends Group$1 {
24279
24052
  main: !0
24280
24053
  })), 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), params.beforeRender && this._beforeRenderList.push(params.beforeRender), params.afterRender && this._afterRenderList.push(params.afterRender), this.hooks.afterClearScreen.tap("constructor", this.afterClearScreen), this.hooks.afterClearRect.tap("constructor", this.afterClearRect), this._afterClearScreen = params.afterClearScreen, this._afterClearRect = params.afterClearRect, this.supportInteractiveLayer = !1 !== params.interactiveLayer, params.optimize || (params.optimize = {
24281
24054
  tickRenderMode: "effect"
24282
- }), this.optmize(params.optimize), params.background && this.syncBackgroundImage(this._background), this.initAnimate(params), this.rafId = null !== (_b = params.rafId) && void 0 !== _b ? _b : Math.floor(6 * Math.random());
24055
+ }), this.optmize(params.optimize), params.background && isString$1(this._background) && this._background.includes("/") && this.setAttributes({
24056
+ background: this._background
24057
+ }), this.initAnimate(params), this.rafId = null !== (_b = params.rafId) && void 0 !== _b ? _b : Math.floor(6 * Math.random());
24283
24058
  }
24284
24059
  initAnimate(params) {
24285
24060
  var _a;
@@ -35437,7 +35212,6 @@ function getCustomType(custom) {
35437
35212
  if (custom.prototype.constructor === custom) {
35438
35213
  const descriptor = Object.getOwnPropertyDescriptor(custom, "prototype");
35439
35214
  if (descriptor && !descriptor.writable) return 1;
35440
- if (Object.getOwnPropertyNames(custom.prototype).length > 1) return 1;
35441
35215
  }
35442
35216
  return 2;
35443
35217
  }