@visactor/vchart 2.0.20-alpha.7 → 2.0.21

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 (62) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +352 -102
  3. package/build/index.js +352 -102
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/animation/index.js +2 -1
  7. package/cjs/animation/utils.js +1 -2
  8. package/cjs/compile/util.js +2 -1
  9. package/cjs/component/data-zoom/scroll-bar/scroll-bar.js +2 -2
  10. package/cjs/component/data-zoom/scroll-bar/scroll-bar.js.map +1 -1
  11. package/cjs/component/util.js +1 -2
  12. package/cjs/constant/correlation.js +1 -2
  13. package/cjs/constant/marker.js +1 -1
  14. package/cjs/constant/polar.js +1 -1
  15. package/cjs/constant/scatter.js +1 -1
  16. package/cjs/constant/scroll-bar.js +2 -1
  17. package/cjs/constant/sunburst.js +1 -1
  18. package/cjs/constant/waterfall.js +1 -1
  19. package/cjs/constant/word-cloud.js +1 -1
  20. package/cjs/core/index.d.ts +1 -1
  21. package/cjs/core/index.js +1 -1
  22. package/cjs/core/index.js.map +1 -1
  23. package/cjs/core/interface.js +1 -1
  24. package/cjs/core/util.js +1 -1
  25. package/cjs/core/vchart.js +1 -1
  26. package/cjs/data/initialize.js +1 -1
  27. package/cjs/data/register.js +1 -1
  28. package/cjs/env/env.js +1 -1
  29. package/cjs/env/index.js +1 -1
  30. package/cjs/mark/base/base-mark.js +2 -2
  31. package/cjs/mark/base/base-mark.js.map +1 -1
  32. package/cjs/typings/visual.d.ts +19 -1
  33. package/cjs/typings/visual.js.map +1 -1
  34. package/esm/animation/index.js +2 -1
  35. package/esm/animation/utils.js +1 -2
  36. package/esm/compile/util.js +2 -1
  37. package/esm/component/data-zoom/scroll-bar/scroll-bar.js +2 -2
  38. package/esm/component/data-zoom/scroll-bar/scroll-bar.js.map +1 -1
  39. package/esm/component/util.js +1 -2
  40. package/esm/constant/correlation.js +1 -2
  41. package/esm/constant/marker.js +1 -1
  42. package/esm/constant/polar.js +1 -1
  43. package/esm/constant/scatter.js +1 -1
  44. package/esm/constant/scroll-bar.js +2 -1
  45. package/esm/constant/sunburst.js +1 -1
  46. package/esm/constant/waterfall.js +1 -1
  47. package/esm/constant/word-cloud.js +1 -1
  48. package/esm/core/index.d.ts +1 -1
  49. package/esm/core/index.js +1 -1
  50. package/esm/core/index.js.map +1 -1
  51. package/esm/core/interface.js +1 -1
  52. package/esm/core/util.js +1 -1
  53. package/esm/core/vchart.js +1 -1
  54. package/esm/data/initialize.js +1 -1
  55. package/esm/data/register.js +1 -1
  56. package/esm/env/env.js +1 -1
  57. package/esm/env/index.js +1 -1
  58. package/esm/mark/base/base-mark.js +2 -2
  59. package/esm/mark/base/base-mark.js.map +1 -1
  60. package/esm/typings/visual.d.ts +19 -1
  61. package/esm/typings/visual.js.map +1 -1
  62. package/package.json +6 -6
package/build/index.es.js CHANGED
@@ -11444,6 +11444,7 @@ const DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({
11444
11444
  backgroundScale: 1,
11445
11445
  backgroundOffsetX: 0,
11446
11446
  backgroundOffsetY: 0,
11447
+ backgroundPosition: "top-left",
11447
11448
  blur: 0,
11448
11449
  filter: "",
11449
11450
  cursor: null,
@@ -11616,11 +11617,16 @@ const DefaultRichTextAttribute = Object.assign(Object.assign(Object.assign({}, D
11616
11617
  const DefaultImageAttribute = Object.assign(Object.assign({
11617
11618
  repeatX: "no-repeat",
11618
11619
  repeatY: "no-repeat",
11620
+ imageMode: void 0,
11619
11621
  image: "",
11620
11622
  width: 0,
11621
11623
  height: 0,
11622
11624
  maxWidth: 500,
11623
- maxHeight: 500
11625
+ maxHeight: 500,
11626
+ imagePosition: "top-left",
11627
+ imageScale: 1,
11628
+ imageOffsetX: 0,
11629
+ imageOffsetY: 0
11624
11630
  }, DefaultAttribute), {
11625
11631
  fill: !0,
11626
11632
  cornerRadius: 0,
@@ -16671,7 +16677,8 @@ class Graphic extends Node {
16671
16677
  return isString$1(path, !0) ? this.pathProxy = new CustomPath2D().fromString(path) : this.pathProxy = new CustomPath2D(), this.pathProxy;
16672
16678
  }
16673
16679
  loadImage(image, background = !1) {
16674
- if (!image || background && backgroundNotImage(image)) return;
16680
+ if (background && (null == image ? void 0 : image.background) && (image = image.background), background && (!image || backgroundNotImage(image))) return void (this.backgroundImg = !1);
16681
+ if (!image) return;
16675
16682
  const url = image;
16676
16683
  this.resources || (this.resources = new Map());
16677
16684
  const cache = {
@@ -16726,7 +16733,7 @@ class Graphic extends Node {
16726
16733
  }
16727
16734
  }
16728
16735
  function backgroundNotImage(image) {
16729
- return !(!image.fill && !image.stroke);
16736
+ return "string" == typeof image ? !(image.startsWith("<svg") || isValidUrl$1(image) || image.includes("/") || isBase64$1(image)) : !(!image.fill && !image.stroke) || !("string" != typeof image.gradient || !Array.isArray(image.stops));
16730
16737
  }
16731
16738
  Graphic.userSymbolMap = {}, Graphic.mixin(EventTarget);
16732
16739
 
@@ -18859,7 +18866,7 @@ function seperateParagraph(paragraph, index) {
18859
18866
  return [new Paragraph(text1, paragraph.newLine, paragraph.character, paragraph.ascentDescentMode), new Paragraph(text2, !0, paragraph.character, paragraph.ascentDescentMode)];
18860
18867
  }
18861
18868
 
18862
- const IMAGE_UPDATE_TAG_KEY = ["width", "height", "image", ...GRAPHIC_UPDATE_TAG_KEY];
18869
+ const IMAGE_UPDATE_TAG_KEY = ["width", "height", "image", "imageMode", "imagePosition", "imageScale", "imageOffsetX", "imageOffsetY", ...GRAPHIC_UPDATE_TAG_KEY];
18863
18870
  class Image extends Graphic {
18864
18871
  constructor(params) {
18865
18872
  super(params), this.type = "image", this.numberType = IMAGE_NUMBER_TYPE, this.loadImage(this.attribute.image);
@@ -18964,6 +18971,7 @@ class Image extends Graphic {
18964
18971
  }
18965
18972
  Image.NOWORK_ANIMATE_ATTR = Object.assign({
18966
18973
  image: 1,
18974
+ imageMode: 1,
18967
18975
  repeatX: 1,
18968
18976
  repeatY: 1
18969
18977
  }, NOWORK_ANIMATE_ATTR);
@@ -20157,11 +20165,12 @@ class DefaultBaseBackgroundRenderContribution {
20157
20165
  backgroundScale = graphicAttribute.backgroundScale,
20158
20166
  backgroundOffsetX = graphicAttribute.backgroundOffsetX,
20159
20167
  backgroundOffsetY = graphicAttribute.backgroundOffsetY,
20160
- backgroundClip = graphicAttribute.backgroundClip
20168
+ backgroundClip = graphicAttribute.backgroundClip,
20169
+ backgroundPosition = graphicAttribute.backgroundPosition
20161
20170
  } = graphic.attribute;
20162
20171
  if (background) if (graphic.backgroundImg && graphic.resources) {
20163
- const res = graphic.resources.get(background);
20164
- if ("success" !== res.state || !res.data) return;
20172
+ const res = graphic.resources.get(getBackgroundImage(background));
20173
+ if (!res || "success" !== res.state || !res.data) return;
20165
20174
  if (context.save(), graphic.parent && !graphic.transMatrix.onlyTranslate()) {
20166
20175
  const groupAttribute = getTheme$1(graphic.parent).group,
20167
20176
  {
@@ -20178,59 +20187,160 @@ class DefaultBaseBackgroundRenderContribution {
20178
20187
  backgroundKeepAspectRatio: backgroundKeepAspectRatio,
20179
20188
  backgroundScale: backgroundScale,
20180
20189
  backgroundOffsetX: backgroundOffsetX,
20181
- backgroundOffsetY: backgroundOffsetY
20190
+ backgroundOffsetY: backgroundOffsetY,
20191
+ backgroundPosition: backgroundPosition
20182
20192
  }), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
20183
20193
  } else context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, context.fill(), context.highPerformanceRestore();
20184
20194
  }
20185
20195
  doDrawImage(context, data, b, params) {
20186
- const {
20187
- backgroundMode: backgroundMode,
20188
- backgroundFit: backgroundFit,
20189
- backgroundKeepAspectRatio: backgroundKeepAspectRatio,
20190
- backgroundScale = 1,
20191
- backgroundOffsetX = 0,
20192
- backgroundOffsetY = 0
20193
- } = params,
20194
- targetW = b.width(),
20195
- targetH = b.height();
20196
- let w = targetW,
20197
- h = targetH;
20198
- if ("no-repeat" === backgroundMode) {
20199
- if (backgroundFit) {
20200
- if (backgroundKeepAspectRatio) {
20201
- const maxScale = Math.max(targetW / data.width, targetH / data.height);
20202
- context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, data.width * maxScale * backgroundScale, data.height * maxScale * backgroundScale);
20203
- } else context.drawImage(data, b.x1, b.y1, b.width(), b.height());
20204
- } else {
20205
- const resW = data.width * backgroundScale,
20206
- resH = data.height * backgroundScale;
20207
- context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, resW, resH);
20208
- }
20209
- } else {
20210
- if (backgroundFit && "repeat" !== backgroundMode && (data.width || data.height)) {
20211
- const resW = data.width,
20212
- resH = data.height;
20213
- if ("repeat-x" === backgroundMode) {
20214
- w = resW * (targetH / resH), h = targetH;
20215
- } else if ("repeat-y" === backgroundMode) {
20216
- h = resH * (targetW / resW), w = targetW;
20217
- }
20218
- const dpr = context.dpr,
20219
- canvas = canvasAllocate.allocate({
20220
- width: w,
20221
- height: h,
20222
- dpr: dpr
20223
- }),
20224
- ctx = canvas.getContext("2d");
20225
- 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);
20226
- }
20227
- const dpr = context.dpr,
20228
- pattern = context.createPattern(data, backgroundMode);
20229
- 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);
20230
- }
20196
+ drawBackgroundImage(context, data, b, params);
20231
20197
  }
20232
20198
  }
20233
20199
  const defaultBaseBackgroundRenderContribution = new DefaultBaseBackgroundRenderContribution();
20200
+ const verticalPositionKeywords = new Set(["top", "center", "bottom"]);
20201
+ function getBackgroundImage(background) {
20202
+ var _a;
20203
+ return null !== (_a = null == background ? void 0 : background.background) && void 0 !== _a ? _a : background;
20204
+ }
20205
+ function resolveBackgroundSizing({
20206
+ backgroundFit: backgroundFit,
20207
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio
20208
+ }) {
20209
+ return backgroundFit ? backgroundKeepAspectRatio ? "cover" : "fill" : "auto";
20210
+ }
20211
+ const NO_REPEAT_SIZING_MAP = {
20212
+ "no-repeat-cover": "cover",
20213
+ "no-repeat-contain": "contain",
20214
+ "no-repeat-fill": "fill",
20215
+ "no-repeat-auto": "auto"
20216
+ };
20217
+ function resolveBackgroundDrawMode({
20218
+ backgroundMode: backgroundMode,
20219
+ backgroundFit: backgroundFit,
20220
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio
20221
+ }) {
20222
+ const sizing = NO_REPEAT_SIZING_MAP[backgroundMode];
20223
+ return sizing ? {
20224
+ backgroundRepeatMode: "no-repeat",
20225
+ backgroundSizing: sizing
20226
+ } : {
20227
+ backgroundRepeatMode: backgroundMode,
20228
+ backgroundSizing: resolveBackgroundSizing({
20229
+ backgroundFit: backgroundFit,
20230
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio
20231
+ })
20232
+ };
20233
+ }
20234
+ function isPercentageValue(value) {
20235
+ return /^-?\d+(\.\d+)?%$/.test(value);
20236
+ }
20237
+ function parsePositionToken(value, remainSpace, startKeyword, centerKeyword, endKeyword) {
20238
+ if ("number" == typeof value && Number.isFinite(value)) return value;
20239
+ const normalizedValue = `${null != value ? value : ""}`.trim().toLowerCase();
20240
+ if (!normalizedValue || normalizedValue === startKeyword) return 0;
20241
+ if (normalizedValue === centerKeyword) return remainSpace / 2;
20242
+ if (normalizedValue === endKeyword) return remainSpace;
20243
+ if (isPercentageValue(normalizedValue)) return remainSpace * parseFloat(normalizedValue) / 100;
20244
+ const parsedValue = Number(normalizedValue);
20245
+ return Number.isFinite(parsedValue) ? parsedValue : 0;
20246
+ }
20247
+ function normalizeBackgroundPosition(position) {
20248
+ var _a, _b;
20249
+ if (Array.isArray(position)) return [null !== (_a = position[0]) && void 0 !== _a ? _a : "left", null !== (_b = position[1]) && void 0 !== _b ? _b : "top"];
20250
+ const tokens = `${null != position ? position : "top-left"}`.trim().toLowerCase().replace(/-/g, " ").split(/\s+/).filter(Boolean);
20251
+ if (0 === tokens.length) return ["left", "top"];
20252
+ if (1 === tokens.length) {
20253
+ const token = tokens[0];
20254
+ return "center" === token ? ["center", "center"] : verticalPositionKeywords.has(token) ? ["center", token] : [token, "center"];
20255
+ }
20256
+ let horizontal, vertical;
20257
+ const genericTokens = [];
20258
+ for (let i = 0; i < 2; i++) {
20259
+ const token = tokens[i];
20260
+ "left" !== token && "right" !== token ? "top" !== token && "bottom" !== token ? genericTokens.push(token) : vertical = token : horizontal = token;
20261
+ }
20262
+ return null == horizontal && genericTokens.length && (horizontal = genericTokens.shift()), null == vertical && genericTokens.length && (vertical = genericTokens.shift()), [null != horizontal ? horizontal : "left", null != vertical ? vertical : "top"];
20263
+ }
20264
+ function resolveBackgroundPosition(position, remainWidth, remainHeight) {
20265
+ const [horizontalPosition, verticalPosition] = normalizeBackgroundPosition(position);
20266
+ return {
20267
+ x: parsePositionToken(horizontalPosition, remainWidth, "left", "center", "right"),
20268
+ y: parsePositionToken(verticalPosition, remainHeight, "top", "center", "bottom")
20269
+ };
20270
+ }
20271
+ function pickRenderableDimension(...values) {
20272
+ for (const value of values) if ("number" == typeof value && Number.isFinite(value) && value > 0) return value;
20273
+ return null;
20274
+ }
20275
+ function resolveRenderableImageSize(data) {
20276
+ if (!data) return null;
20277
+ const width = pickRenderableDimension(data.naturalWidth, data.videoWidth, data.width),
20278
+ height = pickRenderableDimension(data.naturalHeight, data.videoHeight, data.height);
20279
+ return null == width || null == height ? null : {
20280
+ width: width,
20281
+ height: height
20282
+ };
20283
+ }
20284
+ function drawBackgroundImage(context, data, b, params) {
20285
+ var _a, _b;
20286
+ const {
20287
+ backgroundMode: backgroundMode,
20288
+ backgroundFit: backgroundFit,
20289
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio,
20290
+ backgroundScale = 1,
20291
+ backgroundOffsetX = 0,
20292
+ backgroundOffsetY = 0,
20293
+ backgroundPosition = "top-left"
20294
+ } = params,
20295
+ targetW = b.width(),
20296
+ targetH = b.height(),
20297
+ sourceSize = resolveRenderableImageSize(data),
20298
+ {
20299
+ backgroundRepeatMode: backgroundRepeatMode,
20300
+ backgroundSizing: resolvedBackgroundSizing
20301
+ } = resolveBackgroundDrawMode({
20302
+ backgroundMode: backgroundMode,
20303
+ backgroundFit: backgroundFit,
20304
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio
20305
+ });
20306
+ let w = targetW,
20307
+ h = targetH;
20308
+ if (targetW <= 0 || targetH <= 0) return;
20309
+ if ("no-repeat" === backgroundRepeatMode) {
20310
+ let drawWidth = null !== (_a = null == sourceSize ? void 0 : sourceSize.width) && void 0 !== _a ? _a : targetW,
20311
+ drawHeight = null !== (_b = null == sourceSize ? void 0 : sourceSize.height) && void 0 !== _b ? _b : targetH;
20312
+ if ("cover" !== resolvedBackgroundSizing && "contain" !== resolvedBackgroundSizing || !sourceSize) "fill" === resolvedBackgroundSizing && (drawWidth = targetW, drawHeight = targetH);else {
20313
+ const scale = "cover" === resolvedBackgroundSizing ? Math.max(targetW / sourceSize.width, targetH / sourceSize.height) : Math.min(targetW / sourceSize.width, targetH / sourceSize.height);
20314
+ drawWidth = sourceSize.width * scale, drawHeight = sourceSize.height * scale;
20315
+ }
20316
+ drawWidth *= backgroundScale, drawHeight *= backgroundScale;
20317
+ const {
20318
+ x: x,
20319
+ y: y
20320
+ } = resolveBackgroundPosition(backgroundPosition, targetW - drawWidth, targetH - drawHeight);
20321
+ return void context.drawImage(data, b.x1 + x + backgroundOffsetX, b.y1 + y + backgroundOffsetY, drawWidth, drawHeight);
20322
+ }
20323
+ if (backgroundFit && "repeat" !== backgroundRepeatMode && sourceSize) {
20324
+ const resW = sourceSize.width,
20325
+ resH = sourceSize.height;
20326
+ if ("repeat-x" === backgroundRepeatMode) {
20327
+ w = resW * (targetH / resH), h = targetH;
20328
+ } else if ("repeat-y" === backgroundRepeatMode) {
20329
+ h = resH * (targetW / resW), w = targetW;
20330
+ }
20331
+ const dpr = context.dpr,
20332
+ canvas = canvasAllocate.allocate({
20333
+ width: w,
20334
+ height: h,
20335
+ dpr: dpr
20336
+ }),
20337
+ ctx = canvas.getContext("2d");
20338
+ ctx && (ctx.inuse = !0, ctx.clearMatrix(), ctx.setTransformForCurrent(!0), ctx.clearRect(0, 0, w, h), ctx.drawImage(data, 0, 0, w, h), data = canvas.nativeCanvas), canvasAllocate.free(canvas);
20339
+ }
20340
+ const dpr = context.dpr,
20341
+ pattern = context.createPattern(data, backgroundRepeatMode);
20342
+ pattern.setTransform && pattern.setTransform(new DOMMatrix([1 / dpr, 0, 0, 1 / dpr, 0, 0])), context.fillStyle = pattern, context.translate(b.x1, b.y1), context.fillRect(0, 0, targetW, targetH), context.translate(-b.x1, -b.y1);
20343
+ }
20234
20344
  let DefaultBaseInteractiveRenderContribution = class {
20235
20345
  constructor(subRenderContribitions) {
20236
20346
  this.subRenderContribitions = subRenderContribitions, this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
@@ -20587,27 +20697,32 @@ class DefaultGroupBackgroundRenderContribution extends DefaultBaseBackgroundRend
20587
20697
  drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
20588
20698
  const {
20589
20699
  background: background,
20700
+ backgroundOpacity = graphicAttribute.backgroundOpacity,
20701
+ opacity = graphicAttribute.opacity,
20590
20702
  backgroundMode = graphicAttribute.backgroundMode,
20591
20703
  backgroundFit = graphicAttribute.backgroundFit,
20592
20704
  backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
20593
20705
  backgroundScale = graphicAttribute.backgroundScale,
20594
20706
  backgroundOffsetX = graphicAttribute.backgroundOffsetX,
20595
- backgroundOffsetY = graphicAttribute.backgroundOffsetY
20707
+ backgroundOffsetY = graphicAttribute.backgroundOffsetY,
20708
+ backgroundClip = graphicAttribute.backgroundClip,
20709
+ backgroundPosition = graphicAttribute.backgroundPosition
20596
20710
  } = graphic.attribute;
20597
20711
  if (background) if (graphic.backgroundImg && graphic.resources) {
20598
- const res = graphic.resources.get(background);
20599
- if ("success" !== res.state || !res.data) return;
20712
+ const res = graphic.resources.get(getBackgroundImage(background));
20713
+ if (!res || "success" !== res.state || !res.data) return;
20600
20714
  context.highPerformanceSave(), context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0);
20601
20715
  const b = graphic.AABBBounds;
20602
- this.doDrawImage(context, res.data, b, {
20716
+ context.globalAlpha = backgroundOpacity * opacity, backgroundClip && context.clip(), this.doDrawImage(context, res.data, b, {
20603
20717
  backgroundMode: backgroundMode,
20604
20718
  backgroundFit: backgroundFit,
20605
20719
  backgroundKeepAspectRatio: backgroundKeepAspectRatio,
20606
20720
  backgroundScale: backgroundScale,
20607
20721
  backgroundOffsetX: backgroundOffsetX,
20608
- backgroundOffsetY: backgroundOffsetY
20722
+ backgroundOffsetY: backgroundOffsetY,
20723
+ backgroundPosition: backgroundPosition
20609
20724
  }), context.highPerformanceRestore(), context.setTransformForCurrent();
20610
- } else context.highPerformanceSave(), context.fillStyle = background, context.fill(), context.highPerformanceRestore();
20725
+ } else context.highPerformanceSave(), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, context.fill(), context.highPerformanceRestore();
20611
20726
  }
20612
20727
  }
20613
20728
  const defaultGroupBackgroundRenderContribution = new DefaultGroupBackgroundRenderContribution();
@@ -22089,9 +22204,17 @@ class DefaultTextBackgroundRenderContribution extends DefaultBaseBackgroundRende
22089
22204
  drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
22090
22205
  var _a, _c, _d, _e, _f, _g, _h, _j, _k, _l;
22091
22206
  const {
22207
+ backgroundOpacity = graphicAttribute.backgroundOpacity,
22208
+ opacity = graphicAttribute.opacity,
22092
22209
  backgroundMode = graphicAttribute.backgroundMode,
22093
22210
  backgroundFit = graphicAttribute.backgroundFit,
22094
- backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio
22211
+ backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
22212
+ backgroundScale = graphicAttribute.backgroundScale,
22213
+ backgroundOffsetX = graphicAttribute.backgroundOffsetX,
22214
+ backgroundOffsetY = graphicAttribute.backgroundOffsetY,
22215
+ backgroundPosition = graphicAttribute.backgroundPosition,
22216
+ backgroundClip = graphicAttribute.backgroundClip,
22217
+ backgroundCornerRadius = graphicAttribute.backgroundCornerRadius
22095
22218
  } = graphic.attribute;
22096
22219
  let matrix,
22097
22220
  {
@@ -22103,18 +22226,18 @@ class DefaultTextBackgroundRenderContribution extends DefaultBaseBackgroundRende
22103
22226
  };
22104
22227
  let b;
22105
22228
  "richtext" === graphic.type && (matrix = context.currentMatrix.clone(), context.restore(), context.save(), context.setTransformForCurrent());
22106
- const shouldReCalBounds = isObject$2(background) && background.background,
22229
+ const backgroundConfig = isObject$2(background) && background.background ? background : null,
22107
22230
  onlyTranslate = graphic.transMatrix.onlyTranslate();
22108
- if (shouldReCalBounds) {
22231
+ if (backgroundConfig) {
22109
22232
  const _b = graphic.AABBBounds,
22110
- x = (null !== (_a = background.x) && void 0 !== _a ? _a : _b.x1) + (null !== (_c = background.dx) && void 0 !== _c ? _c : 0),
22111
- y = (null !== (_d = background.y) && void 0 !== _d ? _d : _b.y1) + (null !== (_e = background.dy) && void 0 !== _e ? _e : 0),
22112
- w = null !== (_f = background.width) && void 0 !== _f ? _f : _b.width(),
22113
- h = null !== (_g = background.height) && void 0 !== _g ? _g : _b.height();
22114
- if (b = boundsAllocate.allocate(x, y, x + w, y + h), background = background.background, !onlyTranslate) {
22233
+ x = (null !== (_a = backgroundConfig.x) && void 0 !== _a ? _a : _b.x1) + (null !== (_c = backgroundConfig.dx) && void 0 !== _c ? _c : 0),
22234
+ y = (null !== (_d = backgroundConfig.y) && void 0 !== _d ? _d : _b.y1) + (null !== (_e = backgroundConfig.dy) && void 0 !== _e ? _e : 0),
22235
+ w = null !== (_f = backgroundConfig.width) && void 0 !== _f ? _f : _b.width(),
22236
+ h = null !== (_g = backgroundConfig.height) && void 0 !== _g ? _g : _b.height();
22237
+ if (b = boundsAllocate.allocate(x, y, x + w, y + h), background = backgroundConfig.background, !onlyTranslate) {
22115
22238
  const w = b.width(),
22116
22239
  h = b.height();
22117
- 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);
22240
+ b.set((null !== (_h = backgroundConfig.x) && void 0 !== _h ? _h : 0) + (null !== (_j = backgroundConfig.dx) && void 0 !== _j ? _j : 0), (null !== (_k = backgroundConfig.y) && void 0 !== _k ? _k : 0) + (null !== (_l = backgroundConfig.dy) && void 0 !== _l ? _l : 0), w, h);
22118
22241
  }
22119
22242
  } else b = graphic.AABBBounds, onlyTranslate || (b = getTextBounds(Object.assign(Object.assign({}, graphic.attribute), {
22120
22243
  angle: 0,
@@ -22127,20 +22250,18 @@ class DefaultTextBackgroundRenderContribution extends DefaultBaseBackgroundRende
22127
22250
  })).clone());
22128
22251
  if (graphic.backgroundImg && graphic.resources) {
22129
22252
  const res = graphic.resources.get(background);
22130
- if ("success" !== res.state || !res.data) return void restore();
22131
- context.highPerformanceSave(), onlyTranslate && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), this.doDrawImage(context, res.data, b, {
22253
+ if (!res || "success" !== res.state || !res.data) return void restore();
22254
+ context.highPerformanceSave(), onlyTranslate && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.globalAlpha = backgroundOpacity * opacity, backgroundClip && (context.beginPath(), backgroundCornerRadius ? createRectPath(context, b.x1, b.y1, b.width(), b.height(), backgroundCornerRadius, !0) : context.rect(b.x1, b.y1, b.width(), b.height()), context.clip()), this.doDrawImage(context, res.data, b, {
22132
22255
  backgroundMode: backgroundMode,
22133
22256
  backgroundFit: backgroundFit,
22134
- backgroundKeepAspectRatio: backgroundKeepAspectRatio
22257
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio,
22258
+ backgroundScale: backgroundScale,
22259
+ backgroundOffsetX: backgroundOffsetX,
22260
+ backgroundOffsetY: backgroundOffsetY,
22261
+ backgroundPosition: backgroundPosition
22135
22262
  }), context.highPerformanceRestore(), context.setTransformForCurrent();
22136
- } else {
22137
- const {
22138
- backgroundCornerRadius: backgroundCornerRadius,
22139
- backgroundOpacity = 1
22140
- } = graphic.attribute;
22141
- 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();
22142
- }
22143
- shouldReCalBounds && boundsAllocate.free(b), restore();
22263
+ } else context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, backgroundCornerRadius ? (createRectPath(context, b.x1, b.y1, b.width(), b.height(), backgroundCornerRadius, !0), context.fill()) : context.fillRect(b.x1, b.y1, b.width(), b.height()), context.highPerformanceRestore();
22264
+ backgroundConfig && boundsAllocate.free(b), restore();
22144
22265
  }
22145
22266
  }
22146
22267
  const defaultTextBackgroundRenderContribution = new DefaultTextBackgroundRenderContribution();
@@ -22567,6 +22688,92 @@ var __decorate$1h = undefined && undefined.__decorate || function (decorators, t
22567
22688
  };
22568
22689
  };
22569
22690
  const repeatStr = ["", "repeat-x", "repeat-y", "repeat"];
22691
+ function resolveImageMode({
22692
+ repeatX = "no-repeat",
22693
+ repeatY = "no-repeat",
22694
+ imageMode: imageMode
22695
+ }) {
22696
+ const repeatMode = resolveImageRepeatMode(repeatX, repeatY);
22697
+ return {
22698
+ repeatMode: repeatMode,
22699
+ sizingMode: "no-repeat" === repeatMode && null != imageMode ? imageMode : "fill"
22700
+ };
22701
+ }
22702
+ const IMAGE_MODE_TO_BACKGROUND_MODE = {
22703
+ cover: "no-repeat-cover",
22704
+ contain: "no-repeat-contain",
22705
+ fill: "no-repeat-fill",
22706
+ auto: "no-repeat-auto"
22707
+ };
22708
+ function resolveBackgroundParamsByImageSizing(sizingMode) {
22709
+ return {
22710
+ backgroundMode: IMAGE_MODE_TO_BACKGROUND_MODE[sizingMode],
22711
+ backgroundFit: !1,
22712
+ backgroundKeepAspectRatio: !1
22713
+ };
22714
+ }
22715
+ function resolveImageRepeatMode(repeatX, repeatY) {
22716
+ let repeat = 0;
22717
+ return "repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat ? repeatStr[repeat] : "no-repeat";
22718
+ }
22719
+ function shouldClipImageByLayout({
22720
+ repeatX = "no-repeat",
22721
+ repeatY = "no-repeat",
22722
+ imageMode: imageMode,
22723
+ imageScale = 1,
22724
+ imageOffsetX = 0,
22725
+ imageOffsetY = 0,
22726
+ imagePosition = "top-left"
22727
+ }) {
22728
+ const {
22729
+ repeatMode: repeatMode,
22730
+ sizingMode: sizingMode
22731
+ } = resolveImageMode({
22732
+ repeatX: repeatX,
22733
+ repeatY: repeatY,
22734
+ imageMode: imageMode
22735
+ });
22736
+ return "no-repeat" === repeatMode && ("cover" === sizingMode || "auto" === sizingMode || 1 !== imageScale || 0 !== imageOffsetX || 0 !== imageOffsetY);
22737
+ }
22738
+ function drawImageWithLayout(context, data, x, y, width, height, {
22739
+ repeatX = "no-repeat",
22740
+ repeatY = "no-repeat",
22741
+ imageMode: imageMode,
22742
+ imageScale = 1,
22743
+ imageOffsetX = 0,
22744
+ imageOffsetY = 0,
22745
+ imagePosition = "top-left"
22746
+ }) {
22747
+ const {
22748
+ repeatMode: repeatMode,
22749
+ sizingMode: sizingMode
22750
+ } = resolveImageMode({
22751
+ repeatX: repeatX,
22752
+ repeatY: repeatY,
22753
+ imageMode: imageMode
22754
+ }),
22755
+ imageBackgroundParams = "no-repeat" === repeatMode ? resolveBackgroundParamsByImageSizing(sizingMode) : {
22756
+ backgroundMode: repeatMode,
22757
+ backgroundFit: !1,
22758
+ backgroundKeepAspectRatio: !1
22759
+ };
22760
+ drawBackgroundImage(context, data, {
22761
+ x1: x,
22762
+ y1: y,
22763
+ x2: x + width,
22764
+ y2: y + height,
22765
+ width: () => width,
22766
+ height: () => height
22767
+ }, {
22768
+ backgroundMode: imageBackgroundParams.backgroundMode,
22769
+ backgroundFit: imageBackgroundParams.backgroundFit,
22770
+ backgroundKeepAspectRatio: imageBackgroundParams.backgroundKeepAspectRatio,
22771
+ backgroundScale: imageScale,
22772
+ backgroundOffsetX: imageOffsetX,
22773
+ backgroundOffsetY: imageOffsetY,
22774
+ backgroundPosition: imagePosition
22775
+ });
22776
+ }
22570
22777
  let DefaultCanvasImageRender = class extends BaseRender {
22571
22778
  constructor(graphicRenderContributions) {
22572
22779
  super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = IMAGE_NUMBER_TYPE, this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution], this.init(graphicRenderContributions);
@@ -22581,6 +22788,11 @@ let DefaultCanvasImageRender = class extends BaseRender {
22581
22788
  cornerRadius = imageAttribute.cornerRadius,
22582
22789
  fillStrokeOrder = imageAttribute.fillStrokeOrder,
22583
22790
  cornerType = imageAttribute.cornerType,
22791
+ imageMode = imageAttribute.imageMode,
22792
+ imageScale = imageAttribute.imageScale,
22793
+ imageOffsetX = imageAttribute.imageOffsetX,
22794
+ imageOffsetY = imageAttribute.imageOffsetY,
22795
+ imagePosition = imageAttribute.imagePosition,
22584
22796
  image: url
22585
22797
  } = image.attribute,
22586
22798
  data = this.valid(image, imageAttribute, fillCb);
@@ -22597,22 +22809,33 @@ let DefaultCanvasImageRender = class extends BaseRender {
22597
22809
  const width = image.width,
22598
22810
  height = image.height;
22599
22811
  context.beginPath();
22600
- let needRestore = !1;
22601
- 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);
22812
+ let needCornerClip = !1;
22813
+ 0 === cornerRadius || isArray$1(cornerRadius) && cornerRadius.every(num => 0 === num) ? context.rect(x, y, width, height) : (createRectPath(context, x, y, width, height, cornerRadius, "bevel" !== cornerType), needCornerClip = !0), context.setShadowBlendStyle && context.setShadowBlendStyle(image, image.attribute, imageAttribute);
22602
22814
  const _runFill = () => {
22603
- if (doFill) if (fillCb) fillCb(context, image.attribute, imageAttribute);else if (fVisible) {
22604
- context.setCommonStyle(image, image.attribute, x, y, imageAttribute);
22605
- let repeat = 0;
22606
- if ("repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat) {
22607
- const pattern = context.createPattern(res.data, repeatStr[repeat]);
22608
- context.fillStyle = pattern, context.translate(x, y, !0), context.fillRect(0, 0, width, height), context.translate(-x, -y, !0);
22609
- } else context.drawImage(res.data, x, y, width, height);
22610
- }
22815
+ doFill && (fillCb ? fillCb(context, image.attribute, imageAttribute) : fVisible && (context.setCommonStyle(image, image.attribute, x, y, imageAttribute), drawImageWithLayout(context, res.data, x, y, width, height, {
22816
+ repeatX: repeatX,
22817
+ repeatY: repeatY,
22818
+ imageMode: imageMode,
22819
+ imageScale: imageScale,
22820
+ imageOffsetX: imageOffsetX,
22821
+ imageOffsetY: imageOffsetY,
22822
+ imagePosition: imagePosition
22823
+ })));
22611
22824
  },
22612
22825
  _runStroke = () => {
22613
22826
  doStroke && (strokeCb ? strokeCb(context, image.attribute, imageAttribute) : sVisible && (context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute), context.stroke()));
22614
- };
22615
- 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);
22827
+ },
22828
+ needLayoutClip = shouldClipImageByLayout({
22829
+ repeatX: repeatX,
22830
+ repeatY: repeatY,
22831
+ imageMode: imageMode,
22832
+ imageScale: imageScale,
22833
+ imageOffsetX: imageOffsetX,
22834
+ imageOffsetY: imageOffsetY,
22835
+ imagePosition: imagePosition
22836
+ }),
22837
+ needClip = needCornerClip || needLayoutClip;
22838
+ fillStrokeOrder ? (_runStroke(), needClip && (context.save(), context.clip()), this.beforeRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb), _runFill(), needClip && context.restore()) : (needClip && (context.save(), context.clip()), this.beforeRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb), _runFill(), needClip && context.restore(), _runStroke()), this.afterRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb);
22616
22839
  }
22617
22840
  draw(image, renderService, drawContext) {
22618
22841
  const {
@@ -23471,7 +23694,7 @@ let DefaultDrawContribution = class {
23471
23694
  return data || this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);
23472
23695
  }
23473
23696
  clearScreen(renderService, context, drawContext) {
23474
- var _a, _b, _c;
23697
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
23475
23698
  const {
23476
23699
  clear: clear,
23477
23700
  viewBox: viewBox
@@ -23481,9 +23704,20 @@ let DefaultDrawContribution = class {
23481
23704
  if (clear) {
23482
23705
  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);
23483
23706
  const stage = null === (_b = renderService.drawParams) || void 0 === _b ? void 0 : _b.stage;
23484
- if (stage && (context.globalAlpha = null !== (_c = stage.attribute.opacity) && void 0 !== _c ? _c : 1), stage && stage.backgroundImg && stage.resources) {
23485
- const res = stage.resources.get(clear);
23486
- res && "success" === res.state && res.data && context.drawImage(res.data, 0, 0, width, height);
23707
+ if (stage && (context.globalAlpha = (null !== (_c = stage.attribute.opacity) && void 0 !== _c ? _c : 1) * (null !== (_d = stage.attribute.backgroundOpacity) && void 0 !== _d ? _d : 1)), stage && stage.backgroundImg && stage.resources) {
23708
+ const res = stage.resources.get(getBackgroundImage(clear));
23709
+ if (res && "success" === res.state && res.data) {
23710
+ const backgroundBounds = boundsAllocate.allocate(0, 0, 0 + width, 0 + height);
23711
+ drawBackgroundImage(context, res.data, backgroundBounds, {
23712
+ backgroundMode: null !== (_e = stage.attribute.backgroundMode) && void 0 !== _e ? _e : DefaultAttribute.backgroundMode,
23713
+ backgroundFit: null !== (_f = stage.attribute.backgroundFit) && void 0 !== _f ? _f : DefaultAttribute.backgroundFit,
23714
+ backgroundKeepAspectRatio: null !== (_g = stage.attribute.backgroundKeepAspectRatio) && void 0 !== _g ? _g : DefaultAttribute.backgroundKeepAspectRatio,
23715
+ backgroundScale: null !== (_h = stage.attribute.backgroundScale) && void 0 !== _h ? _h : DefaultAttribute.backgroundScale,
23716
+ backgroundOffsetX: null !== (_j = stage.attribute.backgroundOffsetX) && void 0 !== _j ? _j : DefaultAttribute.backgroundOffsetX,
23717
+ backgroundOffsetY: null !== (_k = stage.attribute.backgroundOffsetY) && void 0 !== _k ? _k : DefaultAttribute.backgroundOffsetY,
23718
+ backgroundPosition: null !== (_l = stage.attribute.backgroundPosition) && void 0 !== _l ? _l : DefaultAttribute.backgroundPosition
23719
+ }), boundsAllocate.free(backgroundBounds);
23720
+ }
23487
23721
  } else context.fillStyle = createColor(context, clear, {
23488
23722
  AABBBounds: {
23489
23723
  x1: 0,
@@ -23981,7 +24215,7 @@ class Stage extends Group$1 {
23981
24215
  return null !== (_a = this._background) && void 0 !== _a ? _a : DefaultConfig.BACKGROUND;
23982
24216
  }
23983
24217
  set background(b) {
23984
- this._background = b;
24218
+ this._background = b, this.syncBackgroundImage(b);
23985
24219
  }
23986
24220
  get defaultLayer() {
23987
24221
  return this.at(0);
@@ -23995,6 +24229,18 @@ class Stage extends Group$1 {
23995
24229
  set ticker(ticker) {
23996
24230
  ticker.bindStage(this), this._ticker && this._ticker.removeListener("tick", this.afterTickCb), ticker.addTimeline(this.timeline), this._ticker = ticker, this._ticker.on("tick", this.afterTickCb);
23997
24231
  }
24232
+ syncBackgroundImage(background) {
24233
+ var _a;
24234
+ const source = null !== (_a = null == background ? void 0 : background.background) && void 0 !== _a ? _a : background;
24235
+ this.backgroundImg = !1, this.isImageBackgroundSource(source) && this.loadImage(source, !0);
24236
+ }
24237
+ isImageBackgroundSource(source) {
24238
+ if (!source) return !1;
24239
+ if ("string" == typeof source) return source.startsWith("<svg") || isValidUrl$1(source) || source.includes("/") || isBase64$1(source);
24240
+ if (!isObject$2(source)) return !1;
24241
+ const gradientSource = source;
24242
+ return "string" != typeof gradientSource.gradient || !Array.isArray(gradientSource.stops);
24243
+ }
23998
24244
  constructor(params = {}) {
23999
24245
  var _a, _b;
24000
24246
  super({}), this.tickedBeforeRender = !0, this._onVisibleChange = visible => {
@@ -24033,9 +24279,7 @@ class Stage extends Group$1 {
24033
24279
  main: !0
24034
24280
  })), 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 = {
24035
24281
  tickRenderMode: "effect"
24036
- }), this.optmize(params.optimize), params.background && isString$1(this._background) && this._background.includes("/") && this.setAttributes({
24037
- background: this._background
24038
- }), this.initAnimate(params), this.rafId = null !== (_b = params.rafId) && void 0 !== _b ? _b : Math.floor(6 * Math.random());
24282
+ }), this.optmize(params.optimize), params.background && this.syncBackgroundImage(this._background), this.initAnimate(params), this.rafId = null !== (_b = params.rafId) && void 0 !== _b ? _b : Math.floor(6 * Math.random());
24039
24283
  }
24040
24284
  initAnimate(params) {
24041
24285
  var _a;
@@ -35193,6 +35437,7 @@ function getCustomType(custom) {
35193
35437
  if (custom.prototype.constructor === custom) {
35194
35438
  const descriptor = Object.getOwnPropertyDescriptor(custom, "prototype");
35195
35439
  if (descriptor && !descriptor.writable) return 1;
35440
+ if (Object.getOwnPropertyNames(custom.prototype).length > 1) return 1;
35196
35441
  }
35197
35442
  return 2;
35198
35443
  }
@@ -58776,6 +59021,9 @@ class BaseMark extends GrammarItem {
58776
59021
  return;
58777
59022
  }
58778
59023
  this._product = mark.getProduct();
59024
+ if (!this._product) {
59025
+ return;
59026
+ }
58779
59027
  this._product.clearStates();
58780
59028
  this._graphics = mark.getGraphics();
58781
59029
  this._graphics.forEach(g => {
@@ -61926,7 +62174,7 @@ const lookup = (data, opt) => {
61926
62174
  });
61927
62175
  };
61928
62176
 
61929
- const version = "2.0.19";
62177
+ const version = "2.0.21";
61930
62178
 
61931
62179
  const addVChartProperty = (data, op) => {
61932
62180
  const context = op.beforeCall();
@@ -99755,8 +100003,10 @@ class ScrollBar extends DataFilterBaseComponent {
99755
100003
  }
99756
100004
  this._start = start;
99757
100005
  this._end = end;
99758
- const startValue = statePointToData(start, this._stateScale, false);
99759
- const endValue = statePointToData(end, this._stateScale, false);
100006
+ const axis = this._relatedAxisComponent;
100007
+ const reverse = isReverse(axis, this._isHorizontal);
100008
+ const startValue = statePointToData(start, this._stateScale, reverse);
100009
+ const endValue = statePointToData(end, this._stateScale, reverse);
99760
100010
  const hasChange = isFunction$1(this._spec.updateDataAfterChange)
99761
100011
  ? this._spec.updateDataAfterChange(start, end, startValue, endValue)
99762
100012
  : this._handleStateChange(startValue, endValue);