@visactor/vtable-gantt 1.22.13-alpha.10 → 1.22.13-alpha.11

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.
@@ -4633,6 +4633,7 @@
4633
4633
  backgroundScale: 1,
4634
4634
  backgroundOffsetX: 0,
4635
4635
  backgroundOffsetY: 0,
4636
+ backgroundPosition: "top-left",
4636
4637
  blur: 0,
4637
4638
  filter: "",
4638
4639
  cursor: null,
@@ -4805,11 +4806,16 @@
4805
4806
  const DefaultImageAttribute = Object.assign(Object.assign({
4806
4807
  repeatX: "no-repeat",
4807
4808
  repeatY: "no-repeat",
4809
+ imageMode: void 0,
4808
4810
  image: "",
4809
4811
  width: 0,
4810
4812
  height: 0,
4811
4813
  maxWidth: 500,
4812
- maxHeight: 500
4814
+ maxHeight: 500,
4815
+ imagePosition: "top-left",
4816
+ imageScale: 1,
4817
+ imageOffsetX: 0,
4818
+ imageOffsetY: 0
4813
4819
  }, DefaultAttribute), {
4814
4820
  fill: !0,
4815
4821
  cornerRadius: 0,
@@ -9210,6 +9216,7 @@
9210
9216
  const tempConstantXYKey = ["x", "y"],
9211
9217
  tempConstantScaleXYKey = ["scaleX", "scaleY"],
9212
9218
  tempConstantAngleKey = ["angle"],
9219
+ builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
9213
9220
  point = new Point();
9214
9221
  const NOWORK_ANIMATE_ATTR = {
9215
9222
  strokeSeg: 1,
@@ -9266,7 +9273,7 @@
9266
9273
  }
9267
9274
  constructor(params = {}) {
9268
9275
  var _a;
9269
- 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);
9276
+ 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);
9270
9277
  }
9271
9278
  getGraphicService() {
9272
9279
  var _a, _b;
@@ -9455,7 +9462,7 @@
9455
9462
  });
9456
9463
  }
9457
9464
  setAttributes(params, forceUpdateTag = !1, context) {
9458
- 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));
9465
+ 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));
9459
9466
  }
9460
9467
  _setAttributes(params, forceUpdateTag = !1, context) {
9461
9468
  const keys = Object.keys(params);
@@ -9470,7 +9477,7 @@
9470
9477
  const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
9471
9478
  [key]: value
9472
9479
  }, this.attribute, key, context);
9473
- 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);
9480
+ 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);
9474
9481
  }
9475
9482
  needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
9476
9483
  for (let i = 0; i < k.length; i++) {
@@ -9489,7 +9496,7 @@
9489
9496
  const context = {
9490
9497
  type: AttributeUpdateType.INIT
9491
9498
  };
9492
- 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);
9499
+ 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);
9493
9500
  }
9494
9501
  translate(x, y) {
9495
9502
  var _a, _b;
@@ -9822,7 +9829,8 @@
9822
9829
  return isString$2(path, !0) ? this.pathProxy = new CustomPath2D().fromString(path) : this.pathProxy = new CustomPath2D(), this.pathProxy;
9823
9830
  }
9824
9831
  loadImage(image, background = !1) {
9825
- if (!image || background && backgroundNotImage(image)) return;
9832
+ if (background && (null == image ? void 0 : image.background) && (image = image.background), background && (!image || backgroundNotImage(image))) return void (this.backgroundImg = !1);
9833
+ if (!image) return;
9826
9834
  const url = image;
9827
9835
  this.resources || (this.resources = new Map());
9828
9836
  const cache = {
@@ -9877,7 +9885,10 @@
9877
9885
  }
9878
9886
  }
9879
9887
  function backgroundNotImage(image) {
9880
- return !(!image.fill && !image.stroke);
9888
+ 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));
9889
+ }
9890
+ function isExternalTexture(texture) {
9891
+ return !!texture && ("string" == typeof texture ? !builtinTextureTypes.has(texture) && (texture.startsWith("<svg") || isValidUrl$1(texture) || texture.includes("/") || isBase64$1(texture)) : isObject$8(texture));
9881
9892
  }
9882
9893
  Graphic.userSymbolMap = {}, Graphic.mixin(EventTarget$3);
9883
9894
 
@@ -11971,7 +11982,7 @@
11971
11982
  return [new Paragraph(text1, paragraph.newLine, paragraph.character, paragraph.ascentDescentMode), new Paragraph(text2, !0, paragraph.character, paragraph.ascentDescentMode)];
11972
11983
  }
11973
11984
 
11974
- const IMAGE_UPDATE_TAG_KEY = ["width", "height", "image", ...GRAPHIC_UPDATE_TAG_KEY];
11985
+ const IMAGE_UPDATE_TAG_KEY = ["width", "height", "image", "imageMode", "imagePosition", "imageScale", "imageOffsetX", "imageOffsetY", ...GRAPHIC_UPDATE_TAG_KEY];
11975
11986
  let Image$2 = class Image extends Graphic {
11976
11987
  constructor(params) {
11977
11988
  super(params), this.type = "image", this.numberType = IMAGE_NUMBER_TYPE, this.loadImage(this.attribute.image);
@@ -12076,6 +12087,7 @@
12076
12087
  };
12077
12088
  Image$2.NOWORK_ANIMATE_ATTR = Object.assign({
12078
12089
  image: 1,
12090
+ imageMode: 1,
12079
12091
  repeatX: 1,
12080
12092
  repeatY: 1
12081
12093
  }, NOWORK_ANIMATE_ATTR);
@@ -13150,11 +13162,12 @@
13150
13162
  backgroundScale = graphicAttribute.backgroundScale,
13151
13163
  backgroundOffsetX = graphicAttribute.backgroundOffsetX,
13152
13164
  backgroundOffsetY = graphicAttribute.backgroundOffsetY,
13153
- backgroundClip = graphicAttribute.backgroundClip
13165
+ backgroundClip = graphicAttribute.backgroundClip,
13166
+ backgroundPosition = graphicAttribute.backgroundPosition
13154
13167
  } = graphic.attribute;
13155
13168
  if (background) if (graphic.backgroundImg && graphic.resources) {
13156
- const res = graphic.resources.get(background);
13157
- if ("success" !== res.state || !res.data) return;
13169
+ const res = graphic.resources.get(getBackgroundImage(background));
13170
+ if (!res || "success" !== res.state || !res.data) return;
13158
13171
  if (context.save(), graphic.parent && !graphic.transMatrix.onlyTranslate()) {
13159
13172
  const groupAttribute = getTheme(graphic.parent).group,
13160
13173
  {
@@ -13171,59 +13184,160 @@
13171
13184
  backgroundKeepAspectRatio: backgroundKeepAspectRatio,
13172
13185
  backgroundScale: backgroundScale,
13173
13186
  backgroundOffsetX: backgroundOffsetX,
13174
- backgroundOffsetY: backgroundOffsetY
13187
+ backgroundOffsetY: backgroundOffsetY,
13188
+ backgroundPosition: backgroundPosition
13175
13189
  }), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
13176
13190
  } else context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, context.fill(), context.highPerformanceRestore();
13177
13191
  }
13178
13192
  doDrawImage(context, data, b, params) {
13179
- const {
13180
- backgroundMode: backgroundMode,
13181
- backgroundFit: backgroundFit,
13182
- backgroundKeepAspectRatio: backgroundKeepAspectRatio,
13183
- backgroundScale = 1,
13184
- backgroundOffsetX = 0,
13185
- backgroundOffsetY = 0
13186
- } = params,
13187
- targetW = b.width(),
13188
- targetH = b.height();
13189
- let w = targetW,
13190
- h = targetH;
13191
- if ("no-repeat" === backgroundMode) {
13192
- if (backgroundFit) {
13193
- if (backgroundKeepAspectRatio) {
13194
- const maxScale = Math.max(targetW / data.width, targetH / data.height);
13195
- context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, data.width * maxScale * backgroundScale, data.height * maxScale * backgroundScale);
13196
- } else context.drawImage(data, b.x1, b.y1, b.width(), b.height());
13197
- } else {
13198
- const resW = data.width * backgroundScale,
13199
- resH = data.height * backgroundScale;
13200
- context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, resW, resH);
13201
- }
13202
- } else {
13203
- if (backgroundFit && "repeat" !== backgroundMode && (data.width || data.height)) {
13204
- const resW = data.width,
13205
- resH = data.height;
13206
- if ("repeat-x" === backgroundMode) {
13207
- w = resW * (targetH / resH), h = targetH;
13208
- } else if ("repeat-y" === backgroundMode) {
13209
- h = resH * (targetW / resW), w = targetW;
13210
- }
13211
- const dpr = context.dpr,
13212
- canvas = canvasAllocate.allocate({
13213
- width: w,
13214
- height: h,
13215
- dpr: dpr
13216
- }),
13217
- ctx = canvas.getContext("2d");
13218
- 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);
13219
- }
13220
- const dpr = context.dpr,
13221
- pattern = context.createPattern(data, backgroundMode);
13222
- 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);
13223
- }
13193
+ drawBackgroundImage(context, data, b, params);
13224
13194
  }
13225
13195
  }
13226
13196
  const defaultBaseBackgroundRenderContribution = new DefaultBaseBackgroundRenderContribution();
13197
+ const verticalPositionKeywords = new Set(["top", "center", "bottom"]);
13198
+ function getBackgroundImage(background) {
13199
+ var _a;
13200
+ return null !== (_a = null == background ? void 0 : background.background) && void 0 !== _a ? _a : background;
13201
+ }
13202
+ function resolveBackgroundSizing({
13203
+ backgroundFit: backgroundFit,
13204
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio
13205
+ }) {
13206
+ return backgroundFit ? backgroundKeepAspectRatio ? "cover" : "fill" : "auto";
13207
+ }
13208
+ const NO_REPEAT_SIZING_MAP = {
13209
+ "no-repeat-cover": "cover",
13210
+ "no-repeat-contain": "contain",
13211
+ "no-repeat-fill": "fill",
13212
+ "no-repeat-auto": "auto"
13213
+ };
13214
+ function resolveBackgroundDrawMode({
13215
+ backgroundMode: backgroundMode,
13216
+ backgroundFit: backgroundFit,
13217
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio
13218
+ }) {
13219
+ const sizing = NO_REPEAT_SIZING_MAP[backgroundMode];
13220
+ return sizing ? {
13221
+ backgroundRepeatMode: "no-repeat",
13222
+ backgroundSizing: sizing
13223
+ } : {
13224
+ backgroundRepeatMode: backgroundMode,
13225
+ backgroundSizing: resolveBackgroundSizing({
13226
+ backgroundFit: backgroundFit,
13227
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio
13228
+ })
13229
+ };
13230
+ }
13231
+ function isPercentageValue(value) {
13232
+ return /^-?\d+(\.\d+)?%$/.test(value);
13233
+ }
13234
+ function parsePositionToken(value, remainSpace, startKeyword, centerKeyword, endKeyword) {
13235
+ if ("number" == typeof value && Number.isFinite(value)) return value;
13236
+ const normalizedValue = `${null != value ? value : ""}`.trim().toLowerCase();
13237
+ if (!normalizedValue || normalizedValue === startKeyword) return 0;
13238
+ if (normalizedValue === centerKeyword) return remainSpace / 2;
13239
+ if (normalizedValue === endKeyword) return remainSpace;
13240
+ if (isPercentageValue(normalizedValue)) return remainSpace * parseFloat(normalizedValue) / 100;
13241
+ const parsedValue = Number(normalizedValue);
13242
+ return Number.isFinite(parsedValue) ? parsedValue : 0;
13243
+ }
13244
+ function normalizeBackgroundPosition(position) {
13245
+ var _a, _b;
13246
+ if (Array.isArray(position)) return [null !== (_a = position[0]) && void 0 !== _a ? _a : "left", null !== (_b = position[1]) && void 0 !== _b ? _b : "top"];
13247
+ const tokens = `${null != position ? position : "top-left"}`.trim().toLowerCase().replace(/-/g, " ").split(/\s+/).filter(Boolean);
13248
+ if (0 === tokens.length) return ["left", "top"];
13249
+ if (1 === tokens.length) {
13250
+ const token = tokens[0];
13251
+ return "center" === token ? ["center", "center"] : verticalPositionKeywords.has(token) ? ["center", token] : [token, "center"];
13252
+ }
13253
+ let horizontal, vertical;
13254
+ const genericTokens = [];
13255
+ for (let i = 0; i < 2; i++) {
13256
+ const token = tokens[i];
13257
+ "left" !== token && "right" !== token ? "top" !== token && "bottom" !== token ? genericTokens.push(token) : vertical = token : horizontal = token;
13258
+ }
13259
+ return null == horizontal && genericTokens.length && (horizontal = genericTokens.shift()), null == vertical && genericTokens.length && (vertical = genericTokens.shift()), [null != horizontal ? horizontal : "left", null != vertical ? vertical : "top"];
13260
+ }
13261
+ function resolveBackgroundPosition(position, remainWidth, remainHeight) {
13262
+ const [horizontalPosition, verticalPosition] = normalizeBackgroundPosition(position);
13263
+ return {
13264
+ x: parsePositionToken(horizontalPosition, remainWidth, "left", "center", "right"),
13265
+ y: parsePositionToken(verticalPosition, remainHeight, "top", "center", "bottom")
13266
+ };
13267
+ }
13268
+ function pickRenderableDimension(...values) {
13269
+ for (const value of values) if ("number" == typeof value && Number.isFinite(value) && value > 0) return value;
13270
+ return null;
13271
+ }
13272
+ function resolveRenderableImageSize(data) {
13273
+ if (!data) return null;
13274
+ const width = pickRenderableDimension(data.naturalWidth, data.videoWidth, data.width),
13275
+ height = pickRenderableDimension(data.naturalHeight, data.videoHeight, data.height);
13276
+ return null == width || null == height ? null : {
13277
+ width: width,
13278
+ height: height
13279
+ };
13280
+ }
13281
+ function drawBackgroundImage(context, data, b, params) {
13282
+ var _a, _b;
13283
+ const {
13284
+ backgroundMode: backgroundMode,
13285
+ backgroundFit: backgroundFit,
13286
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio,
13287
+ backgroundScale = 1,
13288
+ backgroundOffsetX = 0,
13289
+ backgroundOffsetY = 0,
13290
+ backgroundPosition = "top-left"
13291
+ } = params,
13292
+ targetW = b.width(),
13293
+ targetH = b.height(),
13294
+ sourceSize = resolveRenderableImageSize(data),
13295
+ {
13296
+ backgroundRepeatMode: backgroundRepeatMode,
13297
+ backgroundSizing: resolvedBackgroundSizing
13298
+ } = resolveBackgroundDrawMode({
13299
+ backgroundMode: backgroundMode,
13300
+ backgroundFit: backgroundFit,
13301
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio
13302
+ });
13303
+ let w = targetW,
13304
+ h = targetH;
13305
+ if (targetW <= 0 || targetH <= 0) return;
13306
+ if ("no-repeat" === backgroundRepeatMode) {
13307
+ let drawWidth = null !== (_a = null == sourceSize ? void 0 : sourceSize.width) && void 0 !== _a ? _a : targetW,
13308
+ drawHeight = null !== (_b = null == sourceSize ? void 0 : sourceSize.height) && void 0 !== _b ? _b : targetH;
13309
+ if ("cover" !== resolvedBackgroundSizing && "contain" !== resolvedBackgroundSizing || !sourceSize) "fill" === resolvedBackgroundSizing && (drawWidth = targetW, drawHeight = targetH);else {
13310
+ const scale = "cover" === resolvedBackgroundSizing ? Math.max(targetW / sourceSize.width, targetH / sourceSize.height) : Math.min(targetW / sourceSize.width, targetH / sourceSize.height);
13311
+ drawWidth = sourceSize.width * scale, drawHeight = sourceSize.height * scale;
13312
+ }
13313
+ drawWidth *= backgroundScale, drawHeight *= backgroundScale;
13314
+ const {
13315
+ x: x,
13316
+ y: y
13317
+ } = resolveBackgroundPosition(backgroundPosition, targetW - drawWidth, targetH - drawHeight);
13318
+ return void context.drawImage(data, b.x1 + x + backgroundOffsetX, b.y1 + y + backgroundOffsetY, drawWidth, drawHeight);
13319
+ }
13320
+ if (backgroundFit && "repeat" !== backgroundRepeatMode && sourceSize) {
13321
+ const resW = sourceSize.width,
13322
+ resH = sourceSize.height;
13323
+ if ("repeat-x" === backgroundRepeatMode) {
13324
+ w = resW * (targetH / resH), h = targetH;
13325
+ } else if ("repeat-y" === backgroundRepeatMode) {
13326
+ h = resH * (targetW / resW), w = targetW;
13327
+ }
13328
+ const dpr = context.dpr,
13329
+ canvas = canvasAllocate.allocate({
13330
+ width: w,
13331
+ height: h,
13332
+ dpr: dpr
13333
+ }),
13334
+ ctx = canvas.getContext("2d");
13335
+ 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);
13336
+ }
13337
+ const dpr = context.dpr,
13338
+ pattern = context.createPattern(data, backgroundRepeatMode);
13339
+ 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);
13340
+ }
13227
13341
  let DefaultBaseInteractiveRenderContribution = class {
13228
13342
  constructor(subRenderContribitions) {
13229
13343
  this.subRenderContribitions = subRenderContribitions, this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
@@ -13269,6 +13383,7 @@
13269
13383
  }
13270
13384
  const defaultBaseClipRenderAfterContribution = new DefaultBaseClipRenderAfterContribution();
13271
13385
 
13386
+ const builtinProceduralTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid"]);
13272
13387
  function formatRatio(ratio) {
13273
13388
  return ratio <= .5 ? 4 * ratio - 1 : -4 * ratio + 3;
13274
13389
  }
@@ -13382,38 +13497,43 @@
13382
13497
  texture && this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);
13383
13498
  }
13384
13499
  drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding) {
13385
- var _a;
13500
+ var _a, _b, _c, _d, _e, _f;
13386
13501
  const {
13387
13502
  textureRatio = graphicAttribute.textureRatio,
13388
13503
  textureOptions = null
13389
13504
  } = graphic.attribute;
13390
- let pattern = this.textureMap.get(texture);
13391
- if (!pattern) switch (texture) {
13392
- case "circle":
13393
- pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
13394
- break;
13395
- case "diamond":
13396
- pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
13397
- break;
13398
- case "rect":
13399
- pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
13400
- break;
13401
- case "vertical-line":
13402
- pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
13403
- break;
13404
- case "horizontal-line":
13405
- pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
13406
- break;
13407
- case "bias-lr":
13408
- pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
13409
- break;
13410
- case "bias-rl":
13411
- pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
13412
- break;
13413
- case "grid":
13414
- pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
13505
+ let pattern = null;
13506
+ const textureRadius = null !== (_a = null == textureOptions ? void 0 : textureOptions.radius) && void 0 !== _a ? _a : 0,
13507
+ patternKey = this.getPatternCacheKey(texture, textureSize, texturePadding, textureColor, context.dpr, textureRadius);
13508
+ if (null !== patternKey && (pattern = this.textureMap.get(patternKey)), !pattern) {
13509
+ if ("string" == typeof texture) switch (texture) {
13510
+ case "circle":
13511
+ pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
13512
+ break;
13513
+ case "diamond":
13514
+ pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
13515
+ break;
13516
+ case "rect":
13517
+ pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
13518
+ break;
13519
+ case "vertical-line":
13520
+ pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
13521
+ break;
13522
+ case "horizontal-line":
13523
+ pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
13524
+ break;
13525
+ case "bias-lr":
13526
+ pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
13527
+ break;
13528
+ case "bias-rl":
13529
+ pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
13530
+ break;
13531
+ case "grid":
13532
+ pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
13533
+ }
13534
+ pattern || (pattern = this.createResourcePattern(texture, graphic, context, texturePadding, textureRadius)), pattern && null !== patternKey && this.textureMap.set(patternKey, pattern);
13415
13535
  }
13416
- if (textureOptions && textureOptions.dynamicTexture) {
13536
+ if ("string" == typeof texture && textureOptions && textureOptions.dynamicTexture) {
13417
13537
  const {
13418
13538
  gridConfig = {},
13419
13539
  useNewCanvas: useNewCanvas
@@ -13458,10 +13578,24 @@
13458
13578
  for (let i = 0; i < gridRows; i++) for (let j = 0; j < gridColumns; j++) {
13459
13579
  const _x = x + cellSize / 2 + j * cellSize,
13460
13580
  _y = y + cellSize / 2 + i * cellSize;
13461
- null === (_a = textureOptions.beforeDynamicTexture) || void 0 === _a || _a.call(textureOptions, context, i, j, gridRows, gridColumns, textureRatio, graphic, b.width(), b.height()), context.beginPath(), !1 === parsedPath.draw(context, Math.min(sizeW - gutterColumn, sizeH - gutterRow), _x, _y, 0) && context.closePath(), context.fillStyle = textureColor, textureOptions.dynamicTexture(context, i, j, gridRows, gridColumns, textureRatio, graphic, b.width(), b.height());
13581
+ null === (_b = textureOptions.beforeDynamicTexture) || void 0 === _b || _b.call(textureOptions, context, i, j, gridRows, gridColumns, textureRatio, graphic, b.width(), b.height()), context.beginPath(), !1 === parsedPath.draw(context, Math.min(sizeW - gutterColumn, sizeH - gutterRow), _x, _y, 0) && context.closePath(), context.fillStyle = textureColor, textureOptions.dynamicTexture(context, i, j, gridRows, gridColumns, textureRatio, graphic, b.width(), b.height());
13462
13582
  }
13463
13583
  useNewCanvas && (originalContext.globalAlpha = 1, originalContext.drawImage(newCanvas.nativeCanvas, 0, 0, newCanvas.nativeCanvas.width, newCanvas.nativeCanvas.height, b.x1, b.y1, b.width() * originalContext.dpr, b.height() * originalContext.dpr)), originalContext.restore();
13464
- } else if (pattern) context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = pattern, context.fill(), context.highPerformanceRestore();else if ("wave" === texture) {
13584
+ } else if (pattern) {
13585
+ if (pattern.setTransform) {
13586
+ const alignToGraphic = !!(null == textureOptions ? void 0 : textureOptions.alignToGraphic),
13587
+ alignOffsetX = null !== (_c = null == textureOptions ? void 0 : textureOptions.alignOffsetX) && void 0 !== _c ? _c : 0,
13588
+ alignOffsetY = null !== (_d = null == textureOptions ? void 0 : textureOptions.alignOffsetY) && void 0 !== _d ? _d : 0;
13589
+ let translateX = 0,
13590
+ translateY = 0;
13591
+ if (alignToGraphic) {
13592
+ const m = context.currentMatrix;
13593
+ translateX = (null !== (_e = null == m ? void 0 : m.e) && void 0 !== _e ? _e : 0) + x + alignOffsetX, translateY = (null !== (_f = null == m ? void 0 : m.f) && void 0 !== _f ? _f : 0) + y + alignOffsetY;
13594
+ } else (alignOffsetX || alignOffsetY) && (translateX = alignOffsetX, translateY = alignOffsetY);
13595
+ pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, translateX, translateY]));
13596
+ }
13597
+ context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = pattern, context.fill(), context.highPerformanceRestore();
13598
+ } else if ("wave" === texture) {
13465
13599
  context.save(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.clip();
13466
13600
  const b = graphic.AABBBounds;
13467
13601
  drawWave(context, textureRatio, b.width(), b.height(), Object.assign(Object.assign({}, textureOptions || {}), {
@@ -13469,6 +13603,45 @@
13469
13603
  }), x + b.x1 - x, y + b.y1 - y), context.restore();
13470
13604
  }
13471
13605
  }
13606
+ getPatternCacheKey(texture, textureSize, texturePadding, textureColor, dpr, textureRadius) {
13607
+ return "string" != typeof texture ? texturePadding > 0 || textureRadius > 0 ? null : texture : "wave" === texture ? null : builtinProceduralTextureTypes.has(texture) ? `builtin:${texture}|size:${textureSize}|padding:${texturePadding}|color:${textureColor}|dpr:${dpr}` : `resource:${texture}|padding:${texturePadding}|radius:${textureRadius}|dpr:${dpr}`;
13608
+ }
13609
+ createResourcePattern(texture, graphic, context, texturePadding, textureRadius) {
13610
+ var _a;
13611
+ const resource = null === (_a = graphic.resources) || void 0 === _a ? void 0 : _a.get(texture),
13612
+ data = "success" === (null == resource ? void 0 : resource.state) ? resource.data : "object" == typeof texture ? texture : null;
13613
+ if (!data) return null;
13614
+ if (texturePadding > 0 || textureRadius > 0) {
13615
+ const w = data.naturalWidth || data.width,
13616
+ h = data.naturalHeight || data.height;
13617
+ if (w > 0 && h > 0) {
13618
+ const tileW = w + 2 * texturePadding,
13619
+ tileH = h + 2 * texturePadding,
13620
+ canvas = canvasAllocate.allocate({
13621
+ width: tileW,
13622
+ height: tileH,
13623
+ dpr: context.dpr
13624
+ }),
13625
+ ctx = canvas.getContext("2d");
13626
+ if (ctx) {
13627
+ if (ctx.inuse = !0, ctx.clearMatrix(), ctx.setTransformForCurrent(!0), ctx.clearRect(0, 0, tileW, tileH), textureRadius > 0) {
13628
+ const r = Math.max(0, Math.min(textureRadius, Math.min(w, h) / 2)),
13629
+ x0 = texturePadding,
13630
+ y0 = texturePadding,
13631
+ x1 = x0 + w,
13632
+ y1 = y0 + h;
13633
+ ctx.beginPath(), ctx.moveTo(x0 + r, y0), ctx.lineTo(x1 - r, y0), ctx.quadraticCurveTo(x1, y0, x1, y0 + r), ctx.lineTo(x1, y1 - r), ctx.quadraticCurveTo(x1, y1, x1 - r, y1), ctx.lineTo(x0 + r, y1), ctx.quadraticCurveTo(x0, y1, x0, y1 - r), ctx.lineTo(x0, y0 + r), ctx.quadraticCurveTo(x0, y0, x0 + r, y0), ctx.closePath(), ctx.clip();
13634
+ }
13635
+ ctx.drawImage(data, texturePadding, texturePadding, w, h);
13636
+ const pattern = context.createPattern(canvas.nativeCanvas, "repeat");
13637
+ return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), canvasAllocate.free(canvas), pattern;
13638
+ }
13639
+ canvasAllocate.free(canvas);
13640
+ }
13641
+ }
13642
+ const pattern = context.createPattern(data, "repeat");
13643
+ return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), pattern;
13644
+ }
13472
13645
  }
13473
13646
  const defaultBaseTextureRenderContribution = new DefaultBaseTextureRenderContribution();
13474
13647
 
@@ -13580,27 +13753,32 @@
13580
13753
  drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
13581
13754
  const {
13582
13755
  background: background,
13756
+ backgroundOpacity = graphicAttribute.backgroundOpacity,
13757
+ opacity = graphicAttribute.opacity,
13583
13758
  backgroundMode = graphicAttribute.backgroundMode,
13584
13759
  backgroundFit = graphicAttribute.backgroundFit,
13585
13760
  backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
13586
13761
  backgroundScale = graphicAttribute.backgroundScale,
13587
13762
  backgroundOffsetX = graphicAttribute.backgroundOffsetX,
13588
- backgroundOffsetY = graphicAttribute.backgroundOffsetY
13763
+ backgroundOffsetY = graphicAttribute.backgroundOffsetY,
13764
+ backgroundClip = graphicAttribute.backgroundClip,
13765
+ backgroundPosition = graphicAttribute.backgroundPosition
13589
13766
  } = graphic.attribute;
13590
13767
  if (background) if (graphic.backgroundImg && graphic.resources) {
13591
- const res = graphic.resources.get(background);
13592
- if ("success" !== res.state || !res.data) return;
13768
+ const res = graphic.resources.get(getBackgroundImage(background));
13769
+ if (!res || "success" !== res.state || !res.data) return;
13593
13770
  context.highPerformanceSave(), context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0);
13594
13771
  const b = graphic.AABBBounds;
13595
- this.doDrawImage(context, res.data, b, {
13772
+ context.globalAlpha = backgroundOpacity * opacity, backgroundClip && context.clip(), this.doDrawImage(context, res.data, b, {
13596
13773
  backgroundMode: backgroundMode,
13597
13774
  backgroundFit: backgroundFit,
13598
13775
  backgroundKeepAspectRatio: backgroundKeepAspectRatio,
13599
13776
  backgroundScale: backgroundScale,
13600
13777
  backgroundOffsetX: backgroundOffsetX,
13601
- backgroundOffsetY: backgroundOffsetY
13778
+ backgroundOffsetY: backgroundOffsetY,
13779
+ backgroundPosition: backgroundPosition
13602
13780
  }), context.highPerformanceRestore(), context.setTransformForCurrent();
13603
- } else context.highPerformanceSave(), context.fillStyle = background, context.fill(), context.highPerformanceRestore();
13781
+ } else context.highPerformanceSave(), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, context.fill(), context.highPerformanceRestore();
13604
13782
  }
13605
13783
  }
13606
13784
  const defaultGroupBackgroundRenderContribution = new DefaultGroupBackgroundRenderContribution();
@@ -15082,9 +15260,17 @@
15082
15260
  drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
15083
15261
  var _a, _c, _d, _e, _f, _g, _h, _j, _k, _l;
15084
15262
  const {
15263
+ backgroundOpacity = graphicAttribute.backgroundOpacity,
15264
+ opacity = graphicAttribute.opacity,
15085
15265
  backgroundMode = graphicAttribute.backgroundMode,
15086
15266
  backgroundFit = graphicAttribute.backgroundFit,
15087
- backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio
15267
+ backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
15268
+ backgroundScale = graphicAttribute.backgroundScale,
15269
+ backgroundOffsetX = graphicAttribute.backgroundOffsetX,
15270
+ backgroundOffsetY = graphicAttribute.backgroundOffsetY,
15271
+ backgroundPosition = graphicAttribute.backgroundPosition,
15272
+ backgroundClip = graphicAttribute.backgroundClip,
15273
+ backgroundCornerRadius = graphicAttribute.backgroundCornerRadius
15088
15274
  } = graphic.attribute;
15089
15275
  let matrix,
15090
15276
  {
@@ -15096,18 +15282,18 @@
15096
15282
  };
15097
15283
  let b;
15098
15284
  "richtext" === graphic.type && (matrix = context.currentMatrix.clone(), context.restore(), context.save(), context.setTransformForCurrent());
15099
- const shouldReCalBounds = isObject$8(background) && background.background,
15285
+ const backgroundConfig = isObject$8(background) && background.background ? background : null,
15100
15286
  onlyTranslate = graphic.transMatrix.onlyTranslate();
15101
- if (shouldReCalBounds) {
15287
+ if (backgroundConfig) {
15102
15288
  const _b = graphic.AABBBounds,
15103
- x = (null !== (_a = background.x) && void 0 !== _a ? _a : _b.x1) + (null !== (_c = background.dx) && void 0 !== _c ? _c : 0),
15104
- y = (null !== (_d = background.y) && void 0 !== _d ? _d : _b.y1) + (null !== (_e = background.dy) && void 0 !== _e ? _e : 0),
15105
- w = null !== (_f = background.width) && void 0 !== _f ? _f : _b.width(),
15106
- h = null !== (_g = background.height) && void 0 !== _g ? _g : _b.height();
15107
- if (b = boundsAllocate.allocate(x, y, x + w, y + h), background = background.background, !onlyTranslate) {
15289
+ x = (null !== (_a = backgroundConfig.x) && void 0 !== _a ? _a : _b.x1) + (null !== (_c = backgroundConfig.dx) && void 0 !== _c ? _c : 0),
15290
+ y = (null !== (_d = backgroundConfig.y) && void 0 !== _d ? _d : _b.y1) + (null !== (_e = backgroundConfig.dy) && void 0 !== _e ? _e : 0),
15291
+ w = null !== (_f = backgroundConfig.width) && void 0 !== _f ? _f : _b.width(),
15292
+ h = null !== (_g = backgroundConfig.height) && void 0 !== _g ? _g : _b.height();
15293
+ if (b = boundsAllocate.allocate(x, y, x + w, y + h), background = backgroundConfig.background, !onlyTranslate) {
15108
15294
  const w = b.width(),
15109
15295
  h = b.height();
15110
- 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);
15296
+ 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);
15111
15297
  }
15112
15298
  } else b = graphic.AABBBounds, onlyTranslate || (b = getTextBounds(Object.assign(Object.assign({}, graphic.attribute), {
15113
15299
  angle: 0,
@@ -15120,19 +15306,18 @@
15120
15306
  })).clone());
15121
15307
  if (graphic.backgroundImg && graphic.resources) {
15122
15308
  const res = graphic.resources.get(background);
15123
- if ("success" !== res.state || !res.data) return void restore();
15124
- context.highPerformanceSave(), onlyTranslate && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), this.doDrawImage(context, res.data, b, {
15309
+ if (!res || "success" !== res.state || !res.data) return void restore();
15310
+ 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, {
15125
15311
  backgroundMode: backgroundMode,
15126
15312
  backgroundFit: backgroundFit,
15127
- backgroundKeepAspectRatio: backgroundKeepAspectRatio
15313
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio,
15314
+ backgroundScale: backgroundScale,
15315
+ backgroundOffsetX: backgroundOffsetX,
15316
+ backgroundOffsetY: backgroundOffsetY,
15317
+ backgroundPosition: backgroundPosition
15128
15318
  }), context.highPerformanceRestore(), context.setTransformForCurrent();
15129
- } else {
15130
- const {
15131
- backgroundCornerRadius: backgroundCornerRadius
15132
- } = graphic.attribute;
15133
- context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = background, backgroundCornerRadius ? (createRectPath(context, b.x1, b.y1, b.width(), b.height(), backgroundCornerRadius, !0), context.fill()) : context.fillRect(b.x1, b.y1, b.width(), b.height()), context.highPerformanceRestore();
15134
- }
15135
- shouldReCalBounds && boundsAllocate.free(b), restore();
15319
+ } 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();
15320
+ backgroundConfig && boundsAllocate.free(b), restore();
15136
15321
  }
15137
15322
  }
15138
15323
  const defaultTextBackgroundRenderContribution = new DefaultTextBackgroundRenderContribution();
@@ -15559,6 +15744,92 @@
15559
15744
  };
15560
15745
  };
15561
15746
  const repeatStr = ["", "repeat-x", "repeat-y", "repeat"];
15747
+ function resolveImageMode({
15748
+ repeatX = "no-repeat",
15749
+ repeatY = "no-repeat",
15750
+ imageMode: imageMode
15751
+ }) {
15752
+ const repeatMode = resolveImageRepeatMode(repeatX, repeatY);
15753
+ return {
15754
+ repeatMode: repeatMode,
15755
+ sizingMode: "no-repeat" === repeatMode && null != imageMode ? imageMode : "fill"
15756
+ };
15757
+ }
15758
+ const IMAGE_MODE_TO_BACKGROUND_MODE = {
15759
+ cover: "no-repeat-cover",
15760
+ contain: "no-repeat-contain",
15761
+ fill: "no-repeat-fill",
15762
+ auto: "no-repeat-auto"
15763
+ };
15764
+ function resolveBackgroundParamsByImageSizing(sizingMode) {
15765
+ return {
15766
+ backgroundMode: IMAGE_MODE_TO_BACKGROUND_MODE[sizingMode],
15767
+ backgroundFit: !1,
15768
+ backgroundKeepAspectRatio: !1
15769
+ };
15770
+ }
15771
+ function resolveImageRepeatMode(repeatX, repeatY) {
15772
+ let repeat = 0;
15773
+ return "repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat ? repeatStr[repeat] : "no-repeat";
15774
+ }
15775
+ function shouldClipImageByLayout({
15776
+ repeatX = "no-repeat",
15777
+ repeatY = "no-repeat",
15778
+ imageMode: imageMode,
15779
+ imageScale = 1,
15780
+ imageOffsetX = 0,
15781
+ imageOffsetY = 0,
15782
+ imagePosition = "top-left"
15783
+ }) {
15784
+ const {
15785
+ repeatMode: repeatMode,
15786
+ sizingMode: sizingMode
15787
+ } = resolveImageMode({
15788
+ repeatX: repeatX,
15789
+ repeatY: repeatY,
15790
+ imageMode: imageMode
15791
+ });
15792
+ return "no-repeat" === repeatMode && ("cover" === sizingMode || "auto" === sizingMode || 1 !== imageScale || 0 !== imageOffsetX || 0 !== imageOffsetY);
15793
+ }
15794
+ function drawImageWithLayout(context, data, x, y, width, height, {
15795
+ repeatX = "no-repeat",
15796
+ repeatY = "no-repeat",
15797
+ imageMode: imageMode,
15798
+ imageScale = 1,
15799
+ imageOffsetX = 0,
15800
+ imageOffsetY = 0,
15801
+ imagePosition = "top-left"
15802
+ }) {
15803
+ const {
15804
+ repeatMode: repeatMode,
15805
+ sizingMode: sizingMode
15806
+ } = resolveImageMode({
15807
+ repeatX: repeatX,
15808
+ repeatY: repeatY,
15809
+ imageMode: imageMode
15810
+ }),
15811
+ imageBackgroundParams = "no-repeat" === repeatMode ? resolveBackgroundParamsByImageSizing(sizingMode) : {
15812
+ backgroundMode: repeatMode,
15813
+ backgroundFit: !1,
15814
+ backgroundKeepAspectRatio: !1
15815
+ };
15816
+ drawBackgroundImage(context, data, {
15817
+ x1: x,
15818
+ y1: y,
15819
+ x2: x + width,
15820
+ y2: y + height,
15821
+ width: () => width,
15822
+ height: () => height
15823
+ }, {
15824
+ backgroundMode: imageBackgroundParams.backgroundMode,
15825
+ backgroundFit: imageBackgroundParams.backgroundFit,
15826
+ backgroundKeepAspectRatio: imageBackgroundParams.backgroundKeepAspectRatio,
15827
+ backgroundScale: imageScale,
15828
+ backgroundOffsetX: imageOffsetX,
15829
+ backgroundOffsetY: imageOffsetY,
15830
+ backgroundPosition: imagePosition
15831
+ });
15832
+ }
15562
15833
  let DefaultCanvasImageRender = class extends BaseRender {
15563
15834
  constructor(graphicRenderContributions) {
15564
15835
  super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = IMAGE_NUMBER_TYPE, this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution], this.init(graphicRenderContributions);
@@ -15573,6 +15844,11 @@
15573
15844
  cornerRadius = imageAttribute.cornerRadius,
15574
15845
  fillStrokeOrder = imageAttribute.fillStrokeOrder,
15575
15846
  cornerType = imageAttribute.cornerType,
15847
+ imageMode = imageAttribute.imageMode,
15848
+ imageScale = imageAttribute.imageScale,
15849
+ imageOffsetX = imageAttribute.imageOffsetX,
15850
+ imageOffsetY = imageAttribute.imageOffsetY,
15851
+ imagePosition = imageAttribute.imagePosition,
15576
15852
  image: url
15577
15853
  } = image.attribute,
15578
15854
  data = this.valid(image, imageAttribute, fillCb);
@@ -15589,22 +15865,33 @@
15589
15865
  const width = image.width,
15590
15866
  height = image.height;
15591
15867
  context.beginPath();
15592
- let needRestore = !1;
15593
- 0 === cornerRadius || isArray$5(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);
15868
+ let needCornerClip = !1;
15869
+ 0 === cornerRadius || isArray$5(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);
15594
15870
  const _runFill = () => {
15595
- if (doFill) if (fillCb) fillCb(context, image.attribute, imageAttribute);else if (fVisible) {
15596
- context.setCommonStyle(image, image.attribute, x, y, imageAttribute);
15597
- let repeat = 0;
15598
- if ("repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat) {
15599
- const pattern = context.createPattern(res.data, repeatStr[repeat]);
15600
- context.fillStyle = pattern, context.translate(x, y, !0), context.fillRect(0, 0, width, height), context.translate(-x, -y, !0);
15601
- } else context.drawImage(res.data, x, y, width, height);
15602
- }
15871
+ doFill && (fillCb ? fillCb(context, image.attribute, imageAttribute) : fVisible && (context.setCommonStyle(image, image.attribute, x, y, imageAttribute), drawImageWithLayout(context, res.data, x, y, width, height, {
15872
+ repeatX: repeatX,
15873
+ repeatY: repeatY,
15874
+ imageMode: imageMode,
15875
+ imageScale: imageScale,
15876
+ imageOffsetX: imageOffsetX,
15877
+ imageOffsetY: imageOffsetY,
15878
+ imagePosition: imagePosition
15879
+ })));
15603
15880
  },
15604
15881
  _runStroke = () => {
15605
15882
  doStroke && (strokeCb ? strokeCb(context, image.attribute, imageAttribute) : sVisible && (context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute), context.stroke()));
15606
- };
15607
- 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);
15883
+ },
15884
+ needLayoutClip = shouldClipImageByLayout({
15885
+ repeatX: repeatX,
15886
+ repeatY: repeatY,
15887
+ imageMode: imageMode,
15888
+ imageScale: imageScale,
15889
+ imageOffsetX: imageOffsetX,
15890
+ imageOffsetY: imageOffsetY,
15891
+ imagePosition: imagePosition
15892
+ }),
15893
+ needClip = needCornerClip || needLayoutClip;
15894
+ 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);
15608
15895
  }
15609
15896
  draw(image, renderService, drawContext) {
15610
15897
  const {
@@ -16459,7 +16746,7 @@
16459
16746
  return data || this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);
16460
16747
  }
16461
16748
  clearScreen(renderService, context, drawContext) {
16462
- var _a, _b, _c;
16749
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
16463
16750
  const {
16464
16751
  clear: clear,
16465
16752
  viewBox: viewBox
@@ -16469,9 +16756,20 @@
16469
16756
  if (clear) {
16470
16757
  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);
16471
16758
  const stage = null === (_b = renderService.drawParams) || void 0 === _b ? void 0 : _b.stage;
16472
- if (stage && (context.globalAlpha = null !== (_c = stage.attribute.opacity) && void 0 !== _c ? _c : 1), stage && stage.backgroundImg && stage.resources) {
16473
- const res = stage.resources.get(clear);
16474
- res && "success" === res.state && res.data && context.drawImage(res.data, 0, 0, width, height);
16759
+ 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) {
16760
+ const res = stage.resources.get(getBackgroundImage(clear));
16761
+ if (res && "success" === res.state && res.data) {
16762
+ const backgroundBounds = boundsAllocate.allocate(0, 0, 0 + width, 0 + height);
16763
+ drawBackgroundImage(context, res.data, backgroundBounds, {
16764
+ backgroundMode: null !== (_e = stage.attribute.backgroundMode) && void 0 !== _e ? _e : DefaultAttribute.backgroundMode,
16765
+ backgroundFit: null !== (_f = stage.attribute.backgroundFit) && void 0 !== _f ? _f : DefaultAttribute.backgroundFit,
16766
+ backgroundKeepAspectRatio: null !== (_g = stage.attribute.backgroundKeepAspectRatio) && void 0 !== _g ? _g : DefaultAttribute.backgroundKeepAspectRatio,
16767
+ backgroundScale: null !== (_h = stage.attribute.backgroundScale) && void 0 !== _h ? _h : DefaultAttribute.backgroundScale,
16768
+ backgroundOffsetX: null !== (_j = stage.attribute.backgroundOffsetX) && void 0 !== _j ? _j : DefaultAttribute.backgroundOffsetX,
16769
+ backgroundOffsetY: null !== (_k = stage.attribute.backgroundOffsetY) && void 0 !== _k ? _k : DefaultAttribute.backgroundOffsetY,
16770
+ backgroundPosition: null !== (_l = stage.attribute.backgroundPosition) && void 0 !== _l ? _l : DefaultAttribute.backgroundPosition
16771
+ }), boundsAllocate.free(backgroundBounds);
16772
+ }
16475
16773
  } else context.fillStyle = createColor(context, clear, {
16476
16774
  AABBBounds: {
16477
16775
  x1: 0,
@@ -16974,7 +17272,7 @@
16974
17272
  return null !== (_a = this._background) && void 0 !== _a ? _a : DefaultConfig.BACKGROUND;
16975
17273
  }
16976
17274
  set background(b) {
16977
- this._background = b;
17275
+ this._background = b, this.syncBackgroundImage(b);
16978
17276
  }
16979
17277
  get defaultLayer() {
16980
17278
  return this.at(0);
@@ -16988,6 +17286,18 @@
16988
17286
  set ticker(ticker) {
16989
17287
  ticker.bindStage(this), this._ticker && this._ticker.removeListener("tick", this.afterTickCb), ticker.addTimeline(this.timeline), this._ticker = ticker, this._ticker.on("tick", this.afterTickCb);
16990
17288
  }
17289
+ syncBackgroundImage(background) {
17290
+ var _a;
17291
+ const source = null !== (_a = null == background ? void 0 : background.background) && void 0 !== _a ? _a : background;
17292
+ this.backgroundImg = !1, this.isImageBackgroundSource(source) && this.loadImage(source, !0);
17293
+ }
17294
+ isImageBackgroundSource(source) {
17295
+ if (!source) return !1;
17296
+ if ("string" == typeof source) return source.startsWith("<svg") || isValidUrl$1(source) || source.includes("/") || isBase64$1(source);
17297
+ if (!isObject$8(source)) return !1;
17298
+ const gradientSource = source;
17299
+ return "string" != typeof gradientSource.gradient || !Array.isArray(gradientSource.stops);
17300
+ }
16991
17301
  constructor(params = {}) {
16992
17302
  var _a, _b;
16993
17303
  super({}), this.tickedBeforeRender = !0, this._onVisibleChange = visible => {
@@ -17026,9 +17336,7 @@
17026
17336
  main: !0
17027
17337
  })), 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 = {
17028
17338
  tickRenderMode: "effect"
17029
- }), this.optmize(params.optimize), params.background && isString$2(this._background) && this._background.includes("/") && this.setAttributes({
17030
- background: this._background
17031
- }), this.initAnimate(params), this.rafId = null !== (_b = params.rafId) && void 0 !== _b ? _b : Math.floor(6 * Math.random());
17339
+ }), 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());
17032
17340
  }
17033
17341
  initAnimate(params) {
17034
17342
  var _a;
@@ -24503,6 +24811,7 @@
24503
24811
  if (custom.prototype.constructor === custom) {
24504
24812
  const descriptor = Object.getOwnPropertyDescriptor(custom, "prototype");
24505
24813
  if (descriptor && !descriptor.writable) return 1;
24814
+ if (Object.getOwnPropertyNames(custom.prototype).length > 1) return 1;
24506
24815
  }
24507
24816
  return 2;
24508
24817
  }
@@ -31329,6 +31638,16 @@
31329
31638
  strokeBoundsBuffer: 0
31330
31639
  }
31331
31640
  };
31641
+ const LAYOUT_LEVEL = {
31642
+ background: 0,
31643
+ preview: 1,
31644
+ dragMask: 2,
31645
+ selectedBackground: 3,
31646
+ selectedPreview: 4,
31647
+ handler: 5,
31648
+ handlerText: 5,
31649
+ handlerMask: 999
31650
+ };
31332
31651
 
31333
31652
  const isTextOverflow = (componentBoundsLike, textBounds, layout, isHorizontal) => {
31334
31653
  if (!textBounds) return !1;
@@ -31459,12 +31778,14 @@
31459
31778
  x: position.x + start * width,
31460
31779
  y: position.y,
31461
31780
  width: (end - start) * width,
31462
- height: height
31781
+ height: height,
31782
+ zIndex: LAYOUT_LEVEL.dragMask
31463
31783
  }, dragMaskStyle), "rect") : this._dragMask = this._getContainer().createOrUpdateChild("dragMask", Object.assign({
31464
31784
  x: position.x,
31465
31785
  y: position.y + start * height,
31466
31786
  width: width,
31467
- height: (end - start) * height
31787
+ height: (end - start) * height,
31788
+ zIndex: LAYOUT_LEVEL.dragMask
31468
31789
  }, dragMaskStyle), "rect"), {
31469
31790
  start: start,
31470
31791
  end: end
@@ -31488,7 +31809,8 @@
31488
31809
  y: position.y,
31489
31810
  width: width,
31490
31811
  height: height,
31491
- cursor: brushSelect ? "crosshair" : "auto"
31812
+ cursor: brushSelect ? "crosshair" : "auto",
31813
+ zIndex: LAYOUT_LEVEL.background
31492
31814
  }, backgroundStyle), {
31493
31815
  pickable: !zoomLock && (null === (_a = backgroundStyle.pickable) || void 0 === _a || _a)
31494
31816
  }), "rect");
@@ -31521,7 +31843,8 @@
31521
31843
  x: position.x + start * width,
31522
31844
  y: position.y - middleHandlerBackgroundSize,
31523
31845
  width: (end - start) * width,
31524
- height: middleHandlerBackgroundSize
31846
+ height: middleHandlerBackgroundSize,
31847
+ zIndex: LAYOUT_LEVEL.handler
31525
31848
  }, null === (_d = middleHandlerStyle.background) || void 0 === _d ? void 0 : _d.style), {
31526
31849
  pickable: !zoomLock && (null === (_g = null === (_f = null === (_e = middleHandlerStyle.background) || void 0 === _e ? void 0 : _e.style) || void 0 === _f ? void 0 : _f.pickable) || void 0 === _g || _g)
31527
31850
  }), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
@@ -31529,24 +31852,29 @@
31529
31852
  y: position.y - middleHandlerBackgroundSize / 2,
31530
31853
  strokeBoundsBuffer: 0,
31531
31854
  angle: 0,
31532
- symbolType: null !== (_j = null === (_h = middleHandlerStyle.icon) || void 0 === _h ? void 0 : _h.symbolType) && void 0 !== _j ? _j : "square"
31855
+ symbolType: null !== (_j = null === (_h = middleHandlerStyle.icon) || void 0 === _h ? void 0 : _h.symbolType) && void 0 !== _j ? _j : "square",
31856
+ zIndex: LAYOUT_LEVEL.handler
31533
31857
  }, middleHandlerStyle.icon), {
31534
31858
  pickable: !zoomLock && (null === (_k = middleHandlerStyle.icon.pickable) || void 0 === _k || _k)
31535
31859
  }), "symbol");
31536
31860
  }
31537
- this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign({
31861
+ this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign(Object.assign({
31538
31862
  x: position.x + start * width,
31539
31863
  y: position.y + height / 2,
31540
31864
  size: height,
31541
31865
  symbolType: null !== (_l = startHandlerStyle.symbolType) && void 0 !== _l ? _l : "square"
31542
- }, DEFAULT_HANDLER_ATTR_MAP.horizontal), startHandlerStyle), {
31866
+ }, DEFAULT_HANDLER_ATTR_MAP.horizontal), {
31867
+ zIndex: LAYOUT_LEVEL.handler
31868
+ }), startHandlerStyle), {
31543
31869
  pickable: !zoomLock && (null === (_m = startHandlerStyle.pickable) || void 0 === _m || _m)
31544
- }), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
31870
+ }), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign(Object.assign({
31545
31871
  x: position.x + end * width,
31546
31872
  y: position.y + height / 2,
31547
31873
  size: height,
31548
31874
  symbolType: null !== (_o = endHandlerStyle.symbolType) && void 0 !== _o ? _o : "square"
31549
- }, DEFAULT_HANDLER_ATTR_MAP.horizontal), endHandlerStyle), {
31875
+ }, DEFAULT_HANDLER_ATTR_MAP.horizontal), {
31876
+ zIndex: LAYOUT_LEVEL.handler
31877
+ }), endHandlerStyle), {
31550
31878
  pickable: !zoomLock && (null === (_p = endHandlerStyle.pickable) || void 0 === _p || _p)
31551
31879
  }), "symbol");
31552
31880
  const startHandlerWidth = Math.max(this._startHandler.AABBBounds.width(), startHandlerMinSize),
@@ -31560,7 +31888,7 @@
31560
31888
  height: startHandlerHeight,
31561
31889
  fill: "white",
31562
31890
  fillOpacity: 0,
31563
- zIndex: 999
31891
+ zIndex: LAYOUT_LEVEL.handlerMask
31564
31892
  }, DEFAULT_HANDLER_ATTR_MAP.horizontal), {
31565
31893
  pickable: !zoomLock
31566
31894
  }), "rect"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign(Object.assign({
@@ -31570,7 +31898,7 @@
31570
31898
  height: endHandlerHeight,
31571
31899
  fill: "white",
31572
31900
  fillOpacity: 0,
31573
- zIndex: 999
31901
+ zIndex: LAYOUT_LEVEL.handlerMask
31574
31902
  }, DEFAULT_HANDLER_ATTR_MAP.horizontal), {
31575
31903
  pickable: !zoomLock
31576
31904
  }), "rect");
@@ -31581,7 +31909,8 @@
31581
31909
  x: "left" === orient ? position.x - middleHandlerBackgroundSize : position.x + width,
31582
31910
  y: position.y + start * height,
31583
31911
  width: middleHandlerBackgroundSize,
31584
- height: (end - start) * height
31912
+ height: (end - start) * height,
31913
+ zIndex: LAYOUT_LEVEL.handler
31585
31914
  }, null === (_r = middleHandlerStyle.background) || void 0 === _r ? void 0 : _r.style), {
31586
31915
  pickable: !zoomLock && (null === (_u = null === (_t = null === (_s = middleHandlerStyle.background) || void 0 === _s ? void 0 : _s.style) || void 0 === _t ? void 0 : _t.pickable) || void 0 === _u || _u)
31587
31916
  }), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
@@ -31589,23 +31918,27 @@
31589
31918
  y: position.y + (start + end) / 2 * height,
31590
31919
  angle: Math.PI / 180 * 90,
31591
31920
  symbolType: null !== (_w = null === (_v = middleHandlerStyle.icon) || void 0 === _v ? void 0 : _v.symbolType) && void 0 !== _w ? _w : "square",
31592
- strokeBoundsBuffer: 0
31921
+ strokeBoundsBuffer: 0,
31922
+ zIndex: LAYOUT_LEVEL.handler
31593
31923
  }, middleHandlerStyle.icon), {
31594
31924
  pickable: !zoomLock && (null === (_y = null === (_x = middleHandlerStyle.icon) || void 0 === _x ? void 0 : _x.pickable) || void 0 === _y || _y)
31595
31925
  }), "symbol");
31596
31926
  }
31597
- this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign({
31927
+ this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign(Object.assign({
31598
31928
  x: position.x + width / 2,
31599
31929
  y: position.y + start * height,
31600
31930
  size: width,
31601
31931
  symbolType: null !== (_z = startHandlerStyle.symbolType) && void 0 !== _z ? _z : "square"
31602
- }, DEFAULT_HANDLER_ATTR_MAP.vertical), startHandlerStyle), {
31932
+ }, DEFAULT_HANDLER_ATTR_MAP.vertical), {
31933
+ zIndex: LAYOUT_LEVEL.handler
31934
+ }), startHandlerStyle), {
31603
31935
  pickable: !zoomLock && (null === (_0 = startHandlerStyle.pickable) || void 0 === _0 || _0)
31604
31936
  }), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
31605
31937
  x: position.x + width / 2,
31606
31938
  y: position.y + end * height,
31607
31939
  size: width,
31608
- symbolType: null !== (_1 = endHandlerStyle.symbolType) && void 0 !== _1 ? _1 : "square"
31940
+ symbolType: null !== (_1 = endHandlerStyle.symbolType) && void 0 !== _1 ? _1 : "square",
31941
+ zIndex: LAYOUT_LEVEL.handler
31609
31942
  }, DEFAULT_HANDLER_ATTR_MAP.vertical), endHandlerStyle), {
31610
31943
  pickable: !zoomLock && (null === (_2 = endHandlerStyle.pickable) || void 0 === _2 || _2)
31611
31944
  }), "symbol");
@@ -31620,7 +31953,7 @@
31620
31953
  height: endHandlerWidth,
31621
31954
  fill: "white",
31622
31955
  fillOpacity: 0,
31623
- zIndex: 999
31956
+ zIndex: LAYOUT_LEVEL.handlerMask
31624
31957
  }, DEFAULT_HANDLER_ATTR_MAP.vertical), {
31625
31958
  pickable: !zoomLock
31626
31959
  }), "rect"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign(Object.assign({
@@ -31630,7 +31963,7 @@
31630
31963
  height: endHandlerWidth,
31631
31964
  fill: "white",
31632
31965
  fillOpacity: 0,
31633
- zIndex: 999
31966
+ zIndex: LAYOUT_LEVEL.handlerMask
31634
31967
  }, DEFAULT_HANDLER_ATTR_MAP.vertical), {
31635
31968
  pickable: !zoomLock
31636
31969
  }), "rect");
@@ -31659,7 +31992,8 @@
31659
31992
  y: position.y,
31660
31993
  width: (end - start) * width,
31661
31994
  height: height,
31662
- cursor: brushSelect ? "crosshair" : "move"
31995
+ cursor: brushSelect ? "crosshair" : "move",
31996
+ zIndex: LAYOUT_LEVEL.selectedBackground
31663
31997
  }, selectedBackgroundStyle), {
31664
31998
  pickable: !zoomLock && (null === (_a = selectedBackgroundChartStyle.pickable) || void 0 === _a || _a)
31665
31999
  }), "rect") : this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign(Object.assign({
@@ -31667,14 +32001,16 @@
31667
32001
  y: position.y + start * height,
31668
32002
  width: width,
31669
32003
  height: (end - start) * height,
31670
- cursor: brushSelect ? "crosshair" : "move"
32004
+ cursor: brushSelect ? "crosshair" : "move",
32005
+ zIndex: LAYOUT_LEVEL.selectedBackground
31671
32006
  }, selectedBackgroundStyle), {
31672
32007
  pickable: !zoomLock && (null === (_b = selectedBackgroundStyle.pickable) || void 0 === _b || _b)
31673
32008
  }), "rect");
31674
32009
  }
31675
32010
  _setPreviewAttributes(type, group) {
31676
32011
  this._previewGroup || (this._previewGroup = group.createOrUpdateChild("previewGroup", {
31677
- pickable: !1
32012
+ pickable: !1,
32013
+ zIndex: LAYOUT_LEVEL.preview
31678
32014
  }, "group")), "line" === type ? this._previewLine = this._previewGroup.createOrUpdateChild("previewLine", {}, "line") : this._previewArea = this._previewGroup.createOrUpdateChild("previewArea", {
31679
32015
  curveType: "basis"
31680
32016
  }, "area");
@@ -31693,7 +32029,8 @@
31693
32029
  }
31694
32030
  _setSelectedPreviewClipAttributes(type, group) {
31695
32031
  this._selectedPreviewGroupClip || (this._selectedPreviewGroupClip = group.createOrUpdateChild("selectedPreviewGroupClip", {
31696
- pickable: !1
32032
+ pickable: !1,
32033
+ zIndex: LAYOUT_LEVEL.selectedPreview
31697
32034
  }, "group"), this._selectedPreviewGroup = this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup", {}, "group"));
31698
32035
  const {
31699
32036
  start: start,
@@ -31895,7 +32232,8 @@
31895
32232
  visible: this._showText,
31896
32233
  pickable: !1,
31897
32234
  childrenPickable: !1,
31898
- textStyle: startTextAlignStyle
32235
+ textStyle: startTextAlignStyle,
32236
+ zIndex: LAYOUT_LEVEL.handlerText
31899
32237
  }), "data-zoom-start-text"), this._endText = this._maybeAddLabel(this._getContainer(), merge({}, restEndTextStyle, {
31900
32238
  text: endTextValue,
31901
32239
  x: endTextPosition.x,
@@ -31903,7 +32241,8 @@
31903
32241
  visible: this._showText,
31904
32242
  pickable: !1,
31905
32243
  childrenPickable: !1,
31906
- textStyle: endTextAlignStyle
32244
+ textStyle: endTextAlignStyle,
32245
+ zIndex: LAYOUT_LEVEL.handlerText
31907
32246
  }), "data-zoom-end-text");
31908
32247
  }
31909
32248
  _maybeAddLabel(container, attributes, name) {
@@ -33747,7 +34086,31 @@
33747
34086
  return graphicCreator.symbol(style);
33748
34087
  }
33749
34088
  _renderHandlerText(value, position) {
33750
- var _a, _b, _c;
34089
+ return graphicCreator.text(this._getHandlerTextAttributes(value, position));
34090
+ }
34091
+ _getHandlerPosition(isStart) {
34092
+ return this.attribute.range && isStart ? "start" : "end";
34093
+ }
34094
+ _getHandlerTextStyle(value, position) {
34095
+ const {
34096
+ align: align,
34097
+ handlerSize = 14,
34098
+ handlerText = {},
34099
+ railHeight: railHeight,
34100
+ railWidth: railWidth,
34101
+ slidable: slidable
34102
+ } = this.attribute;
34103
+ return isFunction$3(handlerText.style) ? handlerText.style(value, position, {
34104
+ layout: this.attribute.layout,
34105
+ align: align,
34106
+ railWidth: railWidth,
34107
+ railHeight: railHeight,
34108
+ handlerSize: handlerSize,
34109
+ slidable: slidable
34110
+ }) : handlerText.style;
34111
+ }
34112
+ _getHandlerTextAttributes(value, position) {
34113
+ var _a, _b;
33751
34114
  const {
33752
34115
  align: align,
33753
34116
  handlerSize = 14,
@@ -33759,13 +34122,13 @@
33759
34122
  isHorizontal = this._isHorizontal,
33760
34123
  pos = this.calculatePosByValue(value, position),
33761
34124
  textSpace = null !== (_a = handlerText.space) && void 0 !== _a ? _a : 4,
34125
+ handlerTextStyle = this._getHandlerTextStyle(value, position),
33762
34126
  textStyle = {
33763
34127
  text: handlerText.formatter ? handlerText.formatter(value) : value.toFixed(null !== (_b = handlerText.precision) && void 0 !== _b ? _b : 0),
33764
- lineHeight: null === (_c = handlerText.style) || void 0 === _c ? void 0 : _c.lineHeight,
34128
+ lineHeight: null == handlerTextStyle ? void 0 : handlerTextStyle.lineHeight,
33765
34129
  cursor: !1 === slidable ? "default" : getDefaultCursor(isHorizontal)
33766
34130
  };
33767
- isHorizontal ? "top" === align ? (textStyle.textBaseline = "bottom", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight - handlerSize) / 2 - textSpace) : (textStyle.textBaseline = "top", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight + handlerSize) / 2 + textSpace) : "left" === align ? (textStyle.textBaseline = "middle", textStyle.textAlign = "end", textStyle.x = (railWidth - handlerSize) / 2 - textSpace, textStyle.y = pos) : (textStyle.textBaseline = "middle", textStyle.textAlign = "start", textStyle.x = (railWidth + handlerSize) / 2 + textSpace, textStyle.y = pos);
33768
- return graphicCreator.text(Object.assign(Object.assign({}, textStyle), handlerText.style));
34131
+ return isHorizontal ? "top" === align ? (textStyle.textBaseline = "bottom", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight - handlerSize) / 2 - textSpace) : (textStyle.textBaseline = "top", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight + handlerSize) / 2 + textSpace) : "left" === align ? (textStyle.textBaseline = "middle", textStyle.textAlign = "end", textStyle.x = (railWidth - handlerSize) / 2 - textSpace, textStyle.y = pos) : (textStyle.textBaseline = "middle", textStyle.textAlign = "start", textStyle.x = (railWidth + handlerSize) / 2 + textSpace, textStyle.y = pos), Object.assign(Object.assign({}, textStyle), handlerTextStyle);
33769
34132
  }
33770
34133
  _renderTooltip() {
33771
34134
  var _a;
@@ -33893,31 +34256,19 @@
33893
34256
  }
33894
34257
  }
33895
34258
  _updateHandler(handler, position, value) {
33896
- var _a;
33897
34259
  const isHorizontal = this._isHorizontal;
33898
34260
  handler.setAttribute(isHorizontal ? "x" : "y", position);
33899
34261
  const updateHandlerText = handler.name === SLIDER_ELEMENT_NAME.startHandler ? this._startHandlerText : this._endHandlerText;
33900
34262
  if (updateHandlerText) {
33901
- const {
33902
- handlerText = {}
33903
- } = this.attribute;
33904
- updateHandlerText.setAttributes({
33905
- text: handlerText.formatter ? handlerText.formatter(value) : value.toFixed(null !== (_a = handlerText.precision) && void 0 !== _a ? _a : 0),
33906
- [isHorizontal ? "x" : "y"]: position
33907
- });
34263
+ const handlerPosition = this._getHandlerPosition(handler.name === SLIDER_ELEMENT_NAME.startHandler);
34264
+ updateHandlerText.setAttributes(this._getHandlerTextAttributes(value, handlerPosition));
33908
34265
  }
33909
34266
  handler.name === SLIDER_ELEMENT_NAME.startHandler ? (this._currentValue.startValue = value, this._currentValue.startPos = position) : (this._currentValue.endValue = value, this._currentValue.endPos = position);
33910
34267
  }
33911
34268
  _updateHandlerText(handlerText, position, value) {
33912
- var _a;
33913
34269
  const isHorizontal = this._isHorizontal,
33914
- {
33915
- handlerText: handlerTextAttr = {}
33916
- } = this.attribute;
33917
- handlerText.setAttributes({
33918
- [isHorizontal ? "x" : "y"]: position,
33919
- text: handlerTextAttr.formatter ? handlerTextAttr.formatter(value) : value.toFixed(null !== (_a = handlerTextAttr.precision) && void 0 !== _a ? _a : 0)
33920
- });
34270
+ handlerPosition = this._getHandlerPosition(handlerText.name === SLIDER_ELEMENT_NAME.startHandlerText);
34271
+ handlerText.setAttributes(this._getHandlerTextAttributes(value, handlerPosition));
33921
34272
  const updateHandler = handlerText.name === SLIDER_ELEMENT_NAME.startHandlerText ? this._startHandler : this._endHandler;
33922
34273
  updateHandler && updateHandler.setAttributes({
33923
34274
  [isHorizontal ? "x" : "y"]: position
@@ -60262,7 +60613,7 @@
60262
60613
  }
60263
60614
  constructor(container, options = {}) {
60264
60615
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
60265
- if (super(), this.showFrozenIcon = !0, this.version = "1.22.13-alpha.10", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
60616
+ if (super(), this.showFrozenIcon = !0, this.version = "1.22.13-alpha.11", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
60266
60617
  this.pluginManager = new PluginManager$1(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
60267
60618
  options: options,
60268
60619
  container: container
@@ -76584,7 +76935,7 @@
76584
76935
  PluginManager: PluginManager
76585
76936
  });
76586
76937
 
76587
- const version = "1.22.13-alpha.10";
76938
+ const version = "1.22.13-alpha.11";
76588
76939
 
76589
76940
  exports.Gantt = Gantt;
76590
76941
  exports.TYPES = index$4;