@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.js CHANGED
@@ -11450,7 +11450,6 @@
11450
11450
  backgroundScale: 1,
11451
11451
  backgroundOffsetX: 0,
11452
11452
  backgroundOffsetY: 0,
11453
- backgroundPosition: "top-left",
11454
11453
  blur: 0,
11455
11454
  filter: "",
11456
11455
  cursor: null,
@@ -11623,16 +11622,11 @@
11623
11622
  const DefaultImageAttribute = Object.assign(Object.assign({
11624
11623
  repeatX: "no-repeat",
11625
11624
  repeatY: "no-repeat",
11626
- imageMode: void 0,
11627
11625
  image: "",
11628
11626
  width: 0,
11629
11627
  height: 0,
11630
11628
  maxWidth: 500,
11631
- maxHeight: 500,
11632
- imagePosition: "top-left",
11633
- imageScale: 1,
11634
- imageOffsetX: 0,
11635
- imageOffsetY: 0
11629
+ maxHeight: 500
11636
11630
  }, DefaultAttribute), {
11637
11631
  fill: !0,
11638
11632
  cornerRadius: 0,
@@ -16071,6 +16065,7 @@
16071
16065
  const tempConstantXYKey = ["x", "y"],
16072
16066
  tempConstantScaleXYKey = ["scaleX", "scaleY"],
16073
16067
  tempConstantAngleKey = ["angle"],
16068
+ builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
16074
16069
  point = new Point();
16075
16070
  const NOWORK_ANIMATE_ATTR = {
16076
16071
  strokeSeg: 1,
@@ -16127,7 +16122,7 @@
16127
16122
  }
16128
16123
  constructor(params = {}) {
16129
16124
  var _a;
16130
- 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);
16125
+ 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);
16131
16126
  }
16132
16127
  getGraphicService() {
16133
16128
  var _a, _b;
@@ -16316,7 +16311,7 @@
16316
16311
  });
16317
16312
  }
16318
16313
  setAttributes(params, forceUpdateTag = !1, context) {
16319
- 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));
16314
+ 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));
16320
16315
  }
16321
16316
  _setAttributes(params, forceUpdateTag = !1, context) {
16322
16317
  const keys = Object.keys(params);
@@ -16331,7 +16326,7 @@
16331
16326
  const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
16332
16327
  [key]: value
16333
16328
  }, this.attribute, key, context);
16334
- 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);
16329
+ 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);
16335
16330
  }
16336
16331
  needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
16337
16332
  for (let i = 0; i < k.length; i++) {
@@ -16350,7 +16345,7 @@
16350
16345
  const context = {
16351
16346
  type: AttributeUpdateType.INIT
16352
16347
  };
16353
- 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);
16348
+ 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);
16354
16349
  }
16355
16350
  translate(x, y) {
16356
16351
  var _a, _b;
@@ -16683,8 +16678,7 @@
16683
16678
  return isString$1(path, !0) ? this.pathProxy = new CustomPath2D().fromString(path) : this.pathProxy = new CustomPath2D(), this.pathProxy;
16684
16679
  }
16685
16680
  loadImage(image, background = !1) {
16686
- if (background && (null == image ? void 0 : image.background) && (image = image.background), background && (!image || backgroundNotImage(image))) return void (this.backgroundImg = !1);
16687
- if (!image) return;
16681
+ if (!image || background && backgroundNotImage(image)) return;
16688
16682
  const url = image;
16689
16683
  this.resources || (this.resources = new Map());
16690
16684
  const cache = {
@@ -16739,7 +16733,10 @@
16739
16733
  }
16740
16734
  }
16741
16735
  function backgroundNotImage(image) {
16742
- 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));
16736
+ return !(!image.fill && !image.stroke);
16737
+ }
16738
+ function isExternalTexture(texture) {
16739
+ return !!texture && ("string" == typeof texture ? !builtinTextureTypes.has(texture) && (texture.startsWith("<svg") || isValidUrl$1(texture) || texture.includes("/") || isBase64$1(texture)) : isObject$2(texture));
16743
16740
  }
16744
16741
  Graphic.userSymbolMap = {}, Graphic.mixin(EventTarget);
16745
16742
 
@@ -18872,7 +18869,7 @@
18872
18869
  return [new Paragraph(text1, paragraph.newLine, paragraph.character, paragraph.ascentDescentMode), new Paragraph(text2, !0, paragraph.character, paragraph.ascentDescentMode)];
18873
18870
  }
18874
18871
 
18875
- const IMAGE_UPDATE_TAG_KEY = ["width", "height", "image", "imageMode", "imagePosition", "imageScale", "imageOffsetX", "imageOffsetY", ...GRAPHIC_UPDATE_TAG_KEY];
18872
+ const IMAGE_UPDATE_TAG_KEY = ["width", "height", "image", ...GRAPHIC_UPDATE_TAG_KEY];
18876
18873
  class Image extends Graphic {
18877
18874
  constructor(params) {
18878
18875
  super(params), this.type = "image", this.numberType = IMAGE_NUMBER_TYPE, this.loadImage(this.attribute.image);
@@ -18977,7 +18974,6 @@
18977
18974
  }
18978
18975
  Image.NOWORK_ANIMATE_ATTR = Object.assign({
18979
18976
  image: 1,
18980
- imageMode: 1,
18981
18977
  repeatX: 1,
18982
18978
  repeatY: 1
18983
18979
  }, NOWORK_ANIMATE_ATTR);
@@ -20171,12 +20167,11 @@
20171
20167
  backgroundScale = graphicAttribute.backgroundScale,
20172
20168
  backgroundOffsetX = graphicAttribute.backgroundOffsetX,
20173
20169
  backgroundOffsetY = graphicAttribute.backgroundOffsetY,
20174
- backgroundClip = graphicAttribute.backgroundClip,
20175
- backgroundPosition = graphicAttribute.backgroundPosition
20170
+ backgroundClip = graphicAttribute.backgroundClip
20176
20171
  } = graphic.attribute;
20177
20172
  if (background) if (graphic.backgroundImg && graphic.resources) {
20178
- const res = graphic.resources.get(getBackgroundImage(background));
20179
- if (!res || "success" !== res.state || !res.data) return;
20173
+ const res = graphic.resources.get(background);
20174
+ if ("success" !== res.state || !res.data) return;
20180
20175
  if (context.save(), graphic.parent && !graphic.transMatrix.onlyTranslate()) {
20181
20176
  const groupAttribute = getTheme$1(graphic.parent).group,
20182
20177
  {
@@ -20193,160 +20188,59 @@
20193
20188
  backgroundKeepAspectRatio: backgroundKeepAspectRatio,
20194
20189
  backgroundScale: backgroundScale,
20195
20190
  backgroundOffsetX: backgroundOffsetX,
20196
- backgroundOffsetY: backgroundOffsetY,
20197
- backgroundPosition: backgroundPosition
20191
+ backgroundOffsetY: backgroundOffsetY
20198
20192
  }), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
20199
20193
  } else context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, context.fill(), context.highPerformanceRestore();
20200
20194
  }
20201
20195
  doDrawImage(context, data, b, params) {
20202
- drawBackgroundImage(context, data, b, params);
20203
- }
20204
- }
20205
- const defaultBaseBackgroundRenderContribution = new DefaultBaseBackgroundRenderContribution();
20206
- const verticalPositionKeywords = new Set(["top", "center", "bottom"]);
20207
- function getBackgroundImage(background) {
20208
- var _a;
20209
- return null !== (_a = null == background ? void 0 : background.background) && void 0 !== _a ? _a : background;
20210
- }
20211
- function resolveBackgroundSizing({
20212
- backgroundFit: backgroundFit,
20213
- backgroundKeepAspectRatio: backgroundKeepAspectRatio
20214
- }) {
20215
- return backgroundFit ? backgroundKeepAspectRatio ? "cover" : "fill" : "auto";
20216
- }
20217
- const NO_REPEAT_SIZING_MAP = {
20218
- "no-repeat-cover": "cover",
20219
- "no-repeat-contain": "contain",
20220
- "no-repeat-fill": "fill",
20221
- "no-repeat-auto": "auto"
20222
- };
20223
- function resolveBackgroundDrawMode({
20224
- backgroundMode: backgroundMode,
20225
- backgroundFit: backgroundFit,
20226
- backgroundKeepAspectRatio: backgroundKeepAspectRatio
20227
- }) {
20228
- const sizing = NO_REPEAT_SIZING_MAP[backgroundMode];
20229
- return sizing ? {
20230
- backgroundRepeatMode: "no-repeat",
20231
- backgroundSizing: sizing
20232
- } : {
20233
- backgroundRepeatMode: backgroundMode,
20234
- backgroundSizing: resolveBackgroundSizing({
20235
- backgroundFit: backgroundFit,
20236
- backgroundKeepAspectRatio: backgroundKeepAspectRatio
20237
- })
20238
- };
20239
- }
20240
- function isPercentageValue(value) {
20241
- return /^-?\d+(\.\d+)?%$/.test(value);
20242
- }
20243
- function parsePositionToken(value, remainSpace, startKeyword, centerKeyword, endKeyword) {
20244
- if ("number" == typeof value && Number.isFinite(value)) return value;
20245
- const normalizedValue = `${null != value ? value : ""}`.trim().toLowerCase();
20246
- if (!normalizedValue || normalizedValue === startKeyword) return 0;
20247
- if (normalizedValue === centerKeyword) return remainSpace / 2;
20248
- if (normalizedValue === endKeyword) return remainSpace;
20249
- if (isPercentageValue(normalizedValue)) return remainSpace * parseFloat(normalizedValue) / 100;
20250
- const parsedValue = Number(normalizedValue);
20251
- return Number.isFinite(parsedValue) ? parsedValue : 0;
20252
- }
20253
- function normalizeBackgroundPosition(position) {
20254
- var _a, _b;
20255
- if (Array.isArray(position)) return [null !== (_a = position[0]) && void 0 !== _a ? _a : "left", null !== (_b = position[1]) && void 0 !== _b ? _b : "top"];
20256
- const tokens = `${null != position ? position : "top-left"}`.trim().toLowerCase().replace(/-/g, " ").split(/\s+/).filter(Boolean);
20257
- if (0 === tokens.length) return ["left", "top"];
20258
- if (1 === tokens.length) {
20259
- const token = tokens[0];
20260
- return "center" === token ? ["center", "center"] : verticalPositionKeywords.has(token) ? ["center", token] : [token, "center"];
20261
- }
20262
- let horizontal, vertical;
20263
- const genericTokens = [];
20264
- for (let i = 0; i < 2; i++) {
20265
- const token = tokens[i];
20266
- "left" !== token && "right" !== token ? "top" !== token && "bottom" !== token ? genericTokens.push(token) : vertical = token : horizontal = token;
20267
- }
20268
- return null == horizontal && genericTokens.length && (horizontal = genericTokens.shift()), null == vertical && genericTokens.length && (vertical = genericTokens.shift()), [null != horizontal ? horizontal : "left", null != vertical ? vertical : "top"];
20269
- }
20270
- function resolveBackgroundPosition(position, remainWidth, remainHeight) {
20271
- const [horizontalPosition, verticalPosition] = normalizeBackgroundPosition(position);
20272
- return {
20273
- x: parsePositionToken(horizontalPosition, remainWidth, "left", "center", "right"),
20274
- y: parsePositionToken(verticalPosition, remainHeight, "top", "center", "bottom")
20275
- };
20276
- }
20277
- function pickRenderableDimension(...values) {
20278
- for (const value of values) if ("number" == typeof value && Number.isFinite(value) && value > 0) return value;
20279
- return null;
20280
- }
20281
- function resolveRenderableImageSize(data) {
20282
- if (!data) return null;
20283
- const width = pickRenderableDimension(data.naturalWidth, data.videoWidth, data.width),
20284
- height = pickRenderableDimension(data.naturalHeight, data.videoHeight, data.height);
20285
- return null == width || null == height ? null : {
20286
- width: width,
20287
- height: height
20288
- };
20289
- }
20290
- function drawBackgroundImage(context, data, b, params) {
20291
- var _a, _b;
20292
- const {
20293
- backgroundMode: backgroundMode,
20294
- backgroundFit: backgroundFit,
20295
- backgroundKeepAspectRatio: backgroundKeepAspectRatio,
20296
- backgroundScale = 1,
20297
- backgroundOffsetX = 0,
20298
- backgroundOffsetY = 0,
20299
- backgroundPosition = "top-left"
20300
- } = params,
20301
- targetW = b.width(),
20302
- targetH = b.height(),
20303
- sourceSize = resolveRenderableImageSize(data),
20304
- {
20305
- backgroundRepeatMode: backgroundRepeatMode,
20306
- backgroundSizing: resolvedBackgroundSizing
20307
- } = resolveBackgroundDrawMode({
20308
- backgroundMode: backgroundMode,
20309
- backgroundFit: backgroundFit,
20310
- backgroundKeepAspectRatio: backgroundKeepAspectRatio
20311
- });
20312
- let w = targetW,
20313
- h = targetH;
20314
- if (targetW <= 0 || targetH <= 0) return;
20315
- if ("no-repeat" === backgroundRepeatMode) {
20316
- let drawWidth = null !== (_a = null == sourceSize ? void 0 : sourceSize.width) && void 0 !== _a ? _a : targetW,
20317
- drawHeight = null !== (_b = null == sourceSize ? void 0 : sourceSize.height) && void 0 !== _b ? _b : targetH;
20318
- if ("cover" !== resolvedBackgroundSizing && "contain" !== resolvedBackgroundSizing || !sourceSize) "fill" === resolvedBackgroundSizing && (drawWidth = targetW, drawHeight = targetH);else {
20319
- const scale = "cover" === resolvedBackgroundSizing ? Math.max(targetW / sourceSize.width, targetH / sourceSize.height) : Math.min(targetW / sourceSize.width, targetH / sourceSize.height);
20320
- drawWidth = sourceSize.width * scale, drawHeight = sourceSize.height * scale;
20321
- }
20322
- drawWidth *= backgroundScale, drawHeight *= backgroundScale;
20323
20196
  const {
20324
- x: x,
20325
- y: y
20326
- } = resolveBackgroundPosition(backgroundPosition, targetW - drawWidth, targetH - drawHeight);
20327
- return void context.drawImage(data, b.x1 + x + backgroundOffsetX, b.y1 + y + backgroundOffsetY, drawWidth, drawHeight);
20328
- }
20329
- if (backgroundFit && "repeat" !== backgroundRepeatMode && sourceSize) {
20330
- const resW = sourceSize.width,
20331
- resH = sourceSize.height;
20332
- if ("repeat-x" === backgroundRepeatMode) {
20333
- w = resW * (targetH / resH), h = targetH;
20334
- } else if ("repeat-y" === backgroundRepeatMode) {
20335
- h = resH * (targetW / resW), w = targetW;
20336
- }
20337
- const dpr = context.dpr,
20338
- canvas = canvasAllocate.allocate({
20339
- width: w,
20340
- height: h,
20341
- dpr: dpr
20342
- }),
20343
- ctx = canvas.getContext("2d");
20344
- 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);
20197
+ backgroundMode: backgroundMode,
20198
+ backgroundFit: backgroundFit,
20199
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio,
20200
+ backgroundScale = 1,
20201
+ backgroundOffsetX = 0,
20202
+ backgroundOffsetY = 0
20203
+ } = params,
20204
+ targetW = b.width(),
20205
+ targetH = b.height();
20206
+ let w = targetW,
20207
+ h = targetH;
20208
+ if ("no-repeat" === backgroundMode) {
20209
+ if (backgroundFit) {
20210
+ if (backgroundKeepAspectRatio) {
20211
+ const maxScale = Math.max(targetW / data.width, targetH / data.height);
20212
+ context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, data.width * maxScale * backgroundScale, data.height * maxScale * backgroundScale);
20213
+ } else context.drawImage(data, b.x1, b.y1, b.width(), b.height());
20214
+ } else {
20215
+ const resW = data.width * backgroundScale,
20216
+ resH = data.height * backgroundScale;
20217
+ context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, resW, resH);
20218
+ }
20219
+ } else {
20220
+ if (backgroundFit && "repeat" !== backgroundMode && (data.width || data.height)) {
20221
+ const resW = data.width,
20222
+ resH = data.height;
20223
+ if ("repeat-x" === backgroundMode) {
20224
+ w = resW * (targetH / resH), h = targetH;
20225
+ } else if ("repeat-y" === backgroundMode) {
20226
+ h = resH * (targetW / resW), w = targetW;
20227
+ }
20228
+ const dpr = context.dpr,
20229
+ canvas = canvasAllocate.allocate({
20230
+ width: w,
20231
+ height: h,
20232
+ dpr: dpr
20233
+ }),
20234
+ ctx = canvas.getContext("2d");
20235
+ 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);
20236
+ }
20237
+ const dpr = context.dpr,
20238
+ pattern = context.createPattern(data, backgroundMode);
20239
+ 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);
20240
+ }
20345
20241
  }
20346
- const dpr = context.dpr,
20347
- pattern = context.createPattern(data, backgroundRepeatMode);
20348
- 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);
20349
20242
  }
20243
+ const defaultBaseBackgroundRenderContribution = new DefaultBaseBackgroundRenderContribution();
20350
20244
  let DefaultBaseInteractiveRenderContribution = class {
20351
20245
  constructor(subRenderContribitions) {
20352
20246
  this.subRenderContribitions = subRenderContribitions, this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
@@ -20510,33 +20404,37 @@
20510
20404
  textureRatio = graphicAttribute.textureRatio,
20511
20405
  textureOptions = null
20512
20406
  } = graphic.attribute;
20513
- let pattern = this.textureMap.get(texture);
20514
- if (!pattern) switch (texture) {
20515
- case "circle":
20516
- pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
20517
- break;
20518
- case "diamond":
20519
- pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
20520
- break;
20521
- case "rect":
20522
- pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
20523
- break;
20524
- case "vertical-line":
20525
- pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
20526
- break;
20527
- case "horizontal-line":
20528
- pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
20529
- break;
20530
- case "bias-lr":
20531
- pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
20532
- break;
20533
- case "bias-rl":
20534
- pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
20535
- break;
20536
- case "grid":
20537
- pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
20407
+ let pattern = null;
20408
+ const patternKey = this.getPatternCacheKey(texture, textureSize, texturePadding, textureColor, context.dpr);
20409
+ if (null !== patternKey && (pattern = this.textureMap.get(patternKey)), !pattern) {
20410
+ if ("string" == typeof texture) switch (texture) {
20411
+ case "circle":
20412
+ pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
20413
+ break;
20414
+ case "diamond":
20415
+ pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
20416
+ break;
20417
+ case "rect":
20418
+ pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
20419
+ break;
20420
+ case "vertical-line":
20421
+ pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
20422
+ break;
20423
+ case "horizontal-line":
20424
+ pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
20425
+ break;
20426
+ case "bias-lr":
20427
+ pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
20428
+ break;
20429
+ case "bias-rl":
20430
+ pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
20431
+ break;
20432
+ case "grid":
20433
+ pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
20434
+ }
20435
+ pattern || (pattern = this.createResourcePattern(texture, graphic, context)), pattern && null !== patternKey && this.textureMap.set(patternKey, pattern);
20538
20436
  }
20539
- if (textureOptions && textureOptions.dynamicTexture) {
20437
+ if ("string" == typeof texture && textureOptions && textureOptions.dynamicTexture) {
20540
20438
  const {
20541
20439
  gridConfig = {},
20542
20440
  useNewCanvas: useNewCanvas
@@ -20592,6 +20490,17 @@
20592
20490
  }), x + b.x1 - x, y + b.y1 - y), context.restore();
20593
20491
  }
20594
20492
  }
20493
+ getPatternCacheKey(texture, textureSize, texturePadding, textureColor, dpr) {
20494
+ return "string" != typeof texture ? texture : "wave" === texture ? null : `${texture}-${textureSize}-${texturePadding}-${textureColor}-${dpr}`;
20495
+ }
20496
+ createResourcePattern(texture, graphic, context) {
20497
+ var _a;
20498
+ const resource = null === (_a = graphic.resources) || void 0 === _a ? void 0 : _a.get(texture),
20499
+ data = "success" === (null == resource ? void 0 : resource.state) ? resource.data : "object" == typeof texture ? texture : null;
20500
+ if (!data) return null;
20501
+ const pattern = context.createPattern(data, "repeat");
20502
+ return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), pattern;
20503
+ }
20595
20504
  }
20596
20505
  const defaultBaseTextureRenderContribution = new DefaultBaseTextureRenderContribution();
20597
20506
 
@@ -20703,32 +20612,27 @@
20703
20612
  drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
20704
20613
  const {
20705
20614
  background: background,
20706
- backgroundOpacity = graphicAttribute.backgroundOpacity,
20707
- opacity = graphicAttribute.opacity,
20708
20615
  backgroundMode = graphicAttribute.backgroundMode,
20709
20616
  backgroundFit = graphicAttribute.backgroundFit,
20710
20617
  backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
20711
20618
  backgroundScale = graphicAttribute.backgroundScale,
20712
20619
  backgroundOffsetX = graphicAttribute.backgroundOffsetX,
20713
- backgroundOffsetY = graphicAttribute.backgroundOffsetY,
20714
- backgroundClip = graphicAttribute.backgroundClip,
20715
- backgroundPosition = graphicAttribute.backgroundPosition
20620
+ backgroundOffsetY = graphicAttribute.backgroundOffsetY
20716
20621
  } = graphic.attribute;
20717
20622
  if (background) if (graphic.backgroundImg && graphic.resources) {
20718
- const res = graphic.resources.get(getBackgroundImage(background));
20719
- if (!res || "success" !== res.state || !res.data) return;
20623
+ const res = graphic.resources.get(background);
20624
+ if ("success" !== res.state || !res.data) return;
20720
20625
  context.highPerformanceSave(), context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0);
20721
20626
  const b = graphic.AABBBounds;
20722
- context.globalAlpha = backgroundOpacity * opacity, backgroundClip && context.clip(), this.doDrawImage(context, res.data, b, {
20627
+ this.doDrawImage(context, res.data, b, {
20723
20628
  backgroundMode: backgroundMode,
20724
20629
  backgroundFit: backgroundFit,
20725
20630
  backgroundKeepAspectRatio: backgroundKeepAspectRatio,
20726
20631
  backgroundScale: backgroundScale,
20727
20632
  backgroundOffsetX: backgroundOffsetX,
20728
- backgroundOffsetY: backgroundOffsetY,
20729
- backgroundPosition: backgroundPosition
20633
+ backgroundOffsetY: backgroundOffsetY
20730
20634
  }), context.highPerformanceRestore(), context.setTransformForCurrent();
20731
- } else context.highPerformanceSave(), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, context.fill(), context.highPerformanceRestore();
20635
+ } else context.highPerformanceSave(), context.fillStyle = background, context.fill(), context.highPerformanceRestore();
20732
20636
  }
20733
20637
  }
20734
20638
  const defaultGroupBackgroundRenderContribution = new DefaultGroupBackgroundRenderContribution();
@@ -22210,17 +22114,9 @@
22210
22114
  drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
22211
22115
  var _a, _c, _d, _e, _f, _g, _h, _j, _k, _l;
22212
22116
  const {
22213
- backgroundOpacity = graphicAttribute.backgroundOpacity,
22214
- opacity = graphicAttribute.opacity,
22215
22117
  backgroundMode = graphicAttribute.backgroundMode,
22216
22118
  backgroundFit = graphicAttribute.backgroundFit,
22217
- backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
22218
- backgroundScale = graphicAttribute.backgroundScale,
22219
- backgroundOffsetX = graphicAttribute.backgroundOffsetX,
22220
- backgroundOffsetY = graphicAttribute.backgroundOffsetY,
22221
- backgroundPosition = graphicAttribute.backgroundPosition,
22222
- backgroundClip = graphicAttribute.backgroundClip,
22223
- backgroundCornerRadius = graphicAttribute.backgroundCornerRadius
22119
+ backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio
22224
22120
  } = graphic.attribute;
22225
22121
  let matrix,
22226
22122
  {
@@ -22232,18 +22128,18 @@
22232
22128
  };
22233
22129
  let b;
22234
22130
  "richtext" === graphic.type && (matrix = context.currentMatrix.clone(), context.restore(), context.save(), context.setTransformForCurrent());
22235
- const backgroundConfig = isObject$2(background) && background.background ? background : null,
22131
+ const shouldReCalBounds = isObject$2(background) && background.background,
22236
22132
  onlyTranslate = graphic.transMatrix.onlyTranslate();
22237
- if (backgroundConfig) {
22133
+ if (shouldReCalBounds) {
22238
22134
  const _b = graphic.AABBBounds,
22239
- x = (null !== (_a = backgroundConfig.x) && void 0 !== _a ? _a : _b.x1) + (null !== (_c = backgroundConfig.dx) && void 0 !== _c ? _c : 0),
22240
- y = (null !== (_d = backgroundConfig.y) && void 0 !== _d ? _d : _b.y1) + (null !== (_e = backgroundConfig.dy) && void 0 !== _e ? _e : 0),
22241
- w = null !== (_f = backgroundConfig.width) && void 0 !== _f ? _f : _b.width(),
22242
- h = null !== (_g = backgroundConfig.height) && void 0 !== _g ? _g : _b.height();
22243
- if (b = boundsAllocate.allocate(x, y, x + w, y + h), background = backgroundConfig.background, !onlyTranslate) {
22135
+ x = (null !== (_a = background.x) && void 0 !== _a ? _a : _b.x1) + (null !== (_c = background.dx) && void 0 !== _c ? _c : 0),
22136
+ y = (null !== (_d = background.y) && void 0 !== _d ? _d : _b.y1) + (null !== (_e = background.dy) && void 0 !== _e ? _e : 0),
22137
+ w = null !== (_f = background.width) && void 0 !== _f ? _f : _b.width(),
22138
+ h = null !== (_g = background.height) && void 0 !== _g ? _g : _b.height();
22139
+ if (b = boundsAllocate.allocate(x, y, x + w, y + h), background = background.background, !onlyTranslate) {
22244
22140
  const w = b.width(),
22245
22141
  h = b.height();
22246
- 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);
22142
+ 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);
22247
22143
  }
22248
22144
  } else b = graphic.AABBBounds, onlyTranslate || (b = getTextBounds(Object.assign(Object.assign({}, graphic.attribute), {
22249
22145
  angle: 0,
@@ -22256,18 +22152,20 @@
22256
22152
  })).clone());
22257
22153
  if (graphic.backgroundImg && graphic.resources) {
22258
22154
  const res = graphic.resources.get(background);
22259
- if (!res || "success" !== res.state || !res.data) return void restore();
22260
- 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, {
22155
+ if ("success" !== res.state || !res.data) return void restore();
22156
+ context.highPerformanceSave(), onlyTranslate && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), this.doDrawImage(context, res.data, b, {
22261
22157
  backgroundMode: backgroundMode,
22262
22158
  backgroundFit: backgroundFit,
22263
- backgroundKeepAspectRatio: backgroundKeepAspectRatio,
22264
- backgroundScale: backgroundScale,
22265
- backgroundOffsetX: backgroundOffsetX,
22266
- backgroundOffsetY: backgroundOffsetY,
22267
- backgroundPosition: backgroundPosition
22159
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio
22268
22160
  }), context.highPerformanceRestore(), context.setTransformForCurrent();
22269
- } 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();
22270
- backgroundConfig && boundsAllocate.free(b), restore();
22161
+ } else {
22162
+ const {
22163
+ backgroundCornerRadius: backgroundCornerRadius,
22164
+ backgroundOpacity = 1
22165
+ } = graphic.attribute;
22166
+ 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();
22167
+ }
22168
+ shouldReCalBounds && boundsAllocate.free(b), restore();
22271
22169
  }
22272
22170
  }
22273
22171
  const defaultTextBackgroundRenderContribution = new DefaultTextBackgroundRenderContribution();
@@ -22694,92 +22592,6 @@
22694
22592
  };
22695
22593
  };
22696
22594
  const repeatStr = ["", "repeat-x", "repeat-y", "repeat"];
22697
- function resolveImageMode({
22698
- repeatX = "no-repeat",
22699
- repeatY = "no-repeat",
22700
- imageMode: imageMode
22701
- }) {
22702
- const repeatMode = resolveImageRepeatMode(repeatX, repeatY);
22703
- return {
22704
- repeatMode: repeatMode,
22705
- sizingMode: "no-repeat" === repeatMode && null != imageMode ? imageMode : "fill"
22706
- };
22707
- }
22708
- const IMAGE_MODE_TO_BACKGROUND_MODE = {
22709
- cover: "no-repeat-cover",
22710
- contain: "no-repeat-contain",
22711
- fill: "no-repeat-fill",
22712
- auto: "no-repeat-auto"
22713
- };
22714
- function resolveBackgroundParamsByImageSizing(sizingMode) {
22715
- return {
22716
- backgroundMode: IMAGE_MODE_TO_BACKGROUND_MODE[sizingMode],
22717
- backgroundFit: !1,
22718
- backgroundKeepAspectRatio: !1
22719
- };
22720
- }
22721
- function resolveImageRepeatMode(repeatX, repeatY) {
22722
- let repeat = 0;
22723
- return "repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat ? repeatStr[repeat] : "no-repeat";
22724
- }
22725
- function shouldClipImageByLayout({
22726
- repeatX = "no-repeat",
22727
- repeatY = "no-repeat",
22728
- imageMode: imageMode,
22729
- imageScale = 1,
22730
- imageOffsetX = 0,
22731
- imageOffsetY = 0,
22732
- imagePosition = "top-left"
22733
- }) {
22734
- const {
22735
- repeatMode: repeatMode,
22736
- sizingMode: sizingMode
22737
- } = resolveImageMode({
22738
- repeatX: repeatX,
22739
- repeatY: repeatY,
22740
- imageMode: imageMode
22741
- });
22742
- return "no-repeat" === repeatMode && ("cover" === sizingMode || "auto" === sizingMode || 1 !== imageScale || 0 !== imageOffsetX || 0 !== imageOffsetY);
22743
- }
22744
- function drawImageWithLayout(context, data, x, y, width, height, {
22745
- repeatX = "no-repeat",
22746
- repeatY = "no-repeat",
22747
- imageMode: imageMode,
22748
- imageScale = 1,
22749
- imageOffsetX = 0,
22750
- imageOffsetY = 0,
22751
- imagePosition = "top-left"
22752
- }) {
22753
- const {
22754
- repeatMode: repeatMode,
22755
- sizingMode: sizingMode
22756
- } = resolveImageMode({
22757
- repeatX: repeatX,
22758
- repeatY: repeatY,
22759
- imageMode: imageMode
22760
- }),
22761
- imageBackgroundParams = "no-repeat" === repeatMode ? resolveBackgroundParamsByImageSizing(sizingMode) : {
22762
- backgroundMode: repeatMode,
22763
- backgroundFit: !1,
22764
- backgroundKeepAspectRatio: !1
22765
- };
22766
- drawBackgroundImage(context, data, {
22767
- x1: x,
22768
- y1: y,
22769
- x2: x + width,
22770
- y2: y + height,
22771
- width: () => width,
22772
- height: () => height
22773
- }, {
22774
- backgroundMode: imageBackgroundParams.backgroundMode,
22775
- backgroundFit: imageBackgroundParams.backgroundFit,
22776
- backgroundKeepAspectRatio: imageBackgroundParams.backgroundKeepAspectRatio,
22777
- backgroundScale: imageScale,
22778
- backgroundOffsetX: imageOffsetX,
22779
- backgroundOffsetY: imageOffsetY,
22780
- backgroundPosition: imagePosition
22781
- });
22782
- }
22783
22595
  let DefaultCanvasImageRender = class extends BaseRender {
22784
22596
  constructor(graphicRenderContributions) {
22785
22597
  super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = IMAGE_NUMBER_TYPE, this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution], this.init(graphicRenderContributions);
@@ -22794,11 +22606,6 @@
22794
22606
  cornerRadius = imageAttribute.cornerRadius,
22795
22607
  fillStrokeOrder = imageAttribute.fillStrokeOrder,
22796
22608
  cornerType = imageAttribute.cornerType,
22797
- imageMode = imageAttribute.imageMode,
22798
- imageScale = imageAttribute.imageScale,
22799
- imageOffsetX = imageAttribute.imageOffsetX,
22800
- imageOffsetY = imageAttribute.imageOffsetY,
22801
- imagePosition = imageAttribute.imagePosition,
22802
22609
  image: url
22803
22610
  } = image.attribute,
22804
22611
  data = this.valid(image, imageAttribute, fillCb);
@@ -22815,33 +22622,22 @@
22815
22622
  const width = image.width,
22816
22623
  height = image.height;
22817
22624
  context.beginPath();
22818
- let needCornerClip = !1;
22819
- 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);
22625
+ let needRestore = !1;
22626
+ 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);
22820
22627
  const _runFill = () => {
22821
- doFill && (fillCb ? fillCb(context, image.attribute, imageAttribute) : fVisible && (context.setCommonStyle(image, image.attribute, x, y, imageAttribute), drawImageWithLayout(context, res.data, x, y, width, height, {
22822
- repeatX: repeatX,
22823
- repeatY: repeatY,
22824
- imageMode: imageMode,
22825
- imageScale: imageScale,
22826
- imageOffsetX: imageOffsetX,
22827
- imageOffsetY: imageOffsetY,
22828
- imagePosition: imagePosition
22829
- })));
22628
+ if (doFill) if (fillCb) fillCb(context, image.attribute, imageAttribute);else if (fVisible) {
22629
+ context.setCommonStyle(image, image.attribute, x, y, imageAttribute);
22630
+ let repeat = 0;
22631
+ if ("repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat) {
22632
+ const pattern = context.createPattern(res.data, repeatStr[repeat]);
22633
+ context.fillStyle = pattern, context.translate(x, y, !0), context.fillRect(0, 0, width, height), context.translate(-x, -y, !0);
22634
+ } else context.drawImage(res.data, x, y, width, height);
22635
+ }
22830
22636
  },
22831
22637
  _runStroke = () => {
22832
22638
  doStroke && (strokeCb ? strokeCb(context, image.attribute, imageAttribute) : sVisible && (context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute), context.stroke()));
22833
- },
22834
- needLayoutClip = shouldClipImageByLayout({
22835
- repeatX: repeatX,
22836
- repeatY: repeatY,
22837
- imageMode: imageMode,
22838
- imageScale: imageScale,
22839
- imageOffsetX: imageOffsetX,
22840
- imageOffsetY: imageOffsetY,
22841
- imagePosition: imagePosition
22842
- }),
22843
- needClip = needCornerClip || needLayoutClip;
22844
- 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);
22639
+ };
22640
+ 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);
22845
22641
  }
22846
22642
  draw(image, renderService, drawContext) {
22847
22643
  const {
@@ -23700,7 +23496,7 @@
23700
23496
  return data || this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);
23701
23497
  }
23702
23498
  clearScreen(renderService, context, drawContext) {
23703
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
23499
+ var _a, _b, _c;
23704
23500
  const {
23705
23501
  clear: clear,
23706
23502
  viewBox: viewBox
@@ -23710,20 +23506,9 @@
23710
23506
  if (clear) {
23711
23507
  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);
23712
23508
  const stage = null === (_b = renderService.drawParams) || void 0 === _b ? void 0 : _b.stage;
23713
- 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) {
23714
- const res = stage.resources.get(getBackgroundImage(clear));
23715
- if (res && "success" === res.state && res.data) {
23716
- const backgroundBounds = boundsAllocate.allocate(0, 0, 0 + width, 0 + height);
23717
- drawBackgroundImage(context, res.data, backgroundBounds, {
23718
- backgroundMode: null !== (_e = stage.attribute.backgroundMode) && void 0 !== _e ? _e : DefaultAttribute.backgroundMode,
23719
- backgroundFit: null !== (_f = stage.attribute.backgroundFit) && void 0 !== _f ? _f : DefaultAttribute.backgroundFit,
23720
- backgroundKeepAspectRatio: null !== (_g = stage.attribute.backgroundKeepAspectRatio) && void 0 !== _g ? _g : DefaultAttribute.backgroundKeepAspectRatio,
23721
- backgroundScale: null !== (_h = stage.attribute.backgroundScale) && void 0 !== _h ? _h : DefaultAttribute.backgroundScale,
23722
- backgroundOffsetX: null !== (_j = stage.attribute.backgroundOffsetX) && void 0 !== _j ? _j : DefaultAttribute.backgroundOffsetX,
23723
- backgroundOffsetY: null !== (_k = stage.attribute.backgroundOffsetY) && void 0 !== _k ? _k : DefaultAttribute.backgroundOffsetY,
23724
- backgroundPosition: null !== (_l = stage.attribute.backgroundPosition) && void 0 !== _l ? _l : DefaultAttribute.backgroundPosition
23725
- }), boundsAllocate.free(backgroundBounds);
23726
- }
23509
+ if (stage && (context.globalAlpha = null !== (_c = stage.attribute.opacity) && void 0 !== _c ? _c : 1), stage && stage.backgroundImg && stage.resources) {
23510
+ const res = stage.resources.get(clear);
23511
+ res && "success" === res.state && res.data && context.drawImage(res.data, 0, 0, width, height);
23727
23512
  } else context.fillStyle = createColor(context, clear, {
23728
23513
  AABBBounds: {
23729
23514
  x1: 0,
@@ -24221,7 +24006,7 @@
24221
24006
  return null !== (_a = this._background) && void 0 !== _a ? _a : DefaultConfig.BACKGROUND;
24222
24007
  }
24223
24008
  set background(b) {
24224
- this._background = b, this.syncBackgroundImage(b);
24009
+ this._background = b;
24225
24010
  }
24226
24011
  get defaultLayer() {
24227
24012
  return this.at(0);
@@ -24235,18 +24020,6 @@
24235
24020
  set ticker(ticker) {
24236
24021
  ticker.bindStage(this), this._ticker && this._ticker.removeListener("tick", this.afterTickCb), ticker.addTimeline(this.timeline), this._ticker = ticker, this._ticker.on("tick", this.afterTickCb);
24237
24022
  }
24238
- syncBackgroundImage(background) {
24239
- var _a;
24240
- const source = null !== (_a = null == background ? void 0 : background.background) && void 0 !== _a ? _a : background;
24241
- this.backgroundImg = !1, this.isImageBackgroundSource(source) && this.loadImage(source, !0);
24242
- }
24243
- isImageBackgroundSource(source) {
24244
- if (!source) return !1;
24245
- if ("string" == typeof source) return source.startsWith("<svg") || isValidUrl$1(source) || source.includes("/") || isBase64$1(source);
24246
- if (!isObject$2(source)) return !1;
24247
- const gradientSource = source;
24248
- return "string" != typeof gradientSource.gradient || !Array.isArray(gradientSource.stops);
24249
- }
24250
24023
  constructor(params = {}) {
24251
24024
  var _a, _b;
24252
24025
  super({}), this.tickedBeforeRender = !0, this._onVisibleChange = visible => {
@@ -24285,7 +24058,9 @@
24285
24058
  main: !0
24286
24059
  })), 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 = {
24287
24060
  tickRenderMode: "effect"
24288
- }), 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());
24061
+ }), this.optmize(params.optimize), params.background && isString$1(this._background) && this._background.includes("/") && this.setAttributes({
24062
+ background: this._background
24063
+ }), this.initAnimate(params), this.rafId = null !== (_b = params.rafId) && void 0 !== _b ? _b : Math.floor(6 * Math.random());
24289
24064
  }
24290
24065
  initAnimate(params) {
24291
24066
  var _a;
@@ -35443,7 +35218,6 @@
35443
35218
  if (custom.prototype.constructor === custom) {
35444
35219
  const descriptor = Object.getOwnPropertyDescriptor(custom, "prototype");
35445
35220
  if (descriptor && !descriptor.writable) return 1;
35446
- if (Object.getOwnPropertyNames(custom.prototype).length > 1) return 1;
35447
35221
  }
35448
35222
  return 2;
35449
35223
  }