@visactor/vchart 2.0.22-alpha.1 → 2.0.22-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.es.js CHANGED
@@ -11430,9 +11430,7 @@ const DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({
11430
11430
  background: null,
11431
11431
  autoAnimateTexture: !1,
11432
11432
  textureRatio: 1,
11433
- textureOptions: {
11434
- alignToGraphic: !0
11435
- },
11433
+ textureOptions: null,
11436
11434
  backgroundOpacity: 1,
11437
11435
  backgroundCornerRadius: 0,
11438
11436
  texture: null,
@@ -16067,7 +16065,6 @@ const GRAPHIC_UPDATE_TAG_KEY = ["lineWidth", "scaleX", "scaleY", "angle", "ancho
16067
16065
  const tempConstantXYKey = ["x", "y"],
16068
16066
  tempConstantScaleXYKey = ["scaleX", "scaleY"],
16069
16067
  tempConstantAngleKey = ["angle"],
16070
- builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
16071
16068
  point = new Point();
16072
16069
  const NOWORK_ANIMATE_ATTR = {
16073
16070
  strokeSeg: 1,
@@ -16124,7 +16121,7 @@ class Graphic extends Node {
16124
16121
  }
16125
16122
  constructor(params = {}) {
16126
16123
  var _a;
16127
- 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);
16124
+ super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background ? this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
16128
16125
  }
16129
16126
  getGraphicService() {
16130
16127
  var _a, _b;
@@ -16313,7 +16310,7 @@ class Graphic extends Node {
16313
16310
  });
16314
16311
  }
16315
16312
  setAttributes(params, forceUpdateTag = !1, context) {
16316
- 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));
16313
+ params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
16317
16314
  }
16318
16315
  _setAttributes(params, forceUpdateTag = !1, context) {
16319
16316
  const keys = Object.keys(params);
@@ -16328,7 +16325,7 @@ class Graphic extends Node {
16328
16325
  const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
16329
16326
  [key]: value
16330
16327
  }, this.attribute, key, context);
16331
- 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);
16328
+ params ? this._setAttributes(params, forceUpdateTag, context) : isNil$1(null === (_a = this.normalAttrs) || void 0 === _a ? void 0 : _a[key]) ? (this.attribute[key] = value, this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag(), this.onAttributeUpdate(context)) : this.normalAttrs[key] = value, "background" === key ? this.loadImage(value, !0) : "shadowGraphic" === key && this.setShadowGraphic(value);
16332
16329
  }
16333
16330
  needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
16334
16331
  for (let i = 0; i < k.length; i++) {
@@ -16347,7 +16344,7 @@ class Graphic extends Node {
16347
16344
  const context = {
16348
16345
  type: AttributeUpdateType.INIT
16349
16346
  };
16350
- 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);
16347
+ params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._updateTag = UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
16351
16348
  }
16352
16349
  translate(x, y) {
16353
16350
  var _a, _b;
@@ -16738,9 +16735,6 @@ class Graphic extends Node {
16738
16735
  function backgroundNotImage(image) {
16739
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));
16740
16737
  }
16741
- function isExternalTexture(texture) {
16742
- return !!texture && ("string" == typeof texture ? !builtinTextureTypes.has(texture) && (texture.startsWith("<svg") || isValidUrl$1(texture) || texture.includes("/") || isBase64$1(texture)) : isObject$2(texture));
16743
- }
16744
16738
  Graphic.userSymbolMap = {}, Graphic.mixin(EventTarget);
16745
16739
 
16746
16740
  var GroupUpdateAABBBoundsMode;
@@ -20505,42 +20499,38 @@ class DefaultBaseTextureRenderContribution {
20505
20499
  texture && this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);
20506
20500
  }
20507
20501
  drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding) {
20508
- var _a, _b, _c, _d, _e;
20502
+ var _a;
20509
20503
  const {
20510
20504
  textureRatio = graphicAttribute.textureRatio,
20511
20505
  textureOptions = null
20512
20506
  } = graphic.attribute;
20513
- let pattern = null;
20514
- const patternKey = this.getPatternCacheKey(texture, textureSize, texturePadding, textureColor, context.dpr);
20515
- if (null !== patternKey && (pattern = this.textureMap.get(patternKey)), !pattern) {
20516
- if ("string" == typeof texture) switch (texture) {
20517
- case "circle":
20518
- pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
20519
- break;
20520
- case "diamond":
20521
- pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
20522
- break;
20523
- case "rect":
20524
- pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
20525
- break;
20526
- case "vertical-line":
20527
- pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
20528
- break;
20529
- case "horizontal-line":
20530
- pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
20531
- break;
20532
- case "bias-lr":
20533
- pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
20534
- break;
20535
- case "bias-rl":
20536
- pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
20537
- break;
20538
- case "grid":
20539
- pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
20540
- }
20541
- pattern || (pattern = this.createResourcePattern(texture, graphic, context)), pattern && null !== patternKey && this.textureMap.set(patternKey, pattern);
20507
+ let pattern = this.textureMap.get(texture);
20508
+ if (!pattern) switch (texture) {
20509
+ case "circle":
20510
+ pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
20511
+ break;
20512
+ case "diamond":
20513
+ pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
20514
+ break;
20515
+ case "rect":
20516
+ pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
20517
+ break;
20518
+ case "vertical-line":
20519
+ pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
20520
+ break;
20521
+ case "horizontal-line":
20522
+ pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
20523
+ break;
20524
+ case "bias-lr":
20525
+ pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
20526
+ break;
20527
+ case "bias-rl":
20528
+ pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
20529
+ break;
20530
+ case "grid":
20531
+ pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
20542
20532
  }
20543
- if ("string" == typeof texture && textureOptions && textureOptions.dynamicTexture) {
20533
+ if (textureOptions && textureOptions.dynamicTexture) {
20544
20534
  const {
20545
20535
  gridConfig = {},
20546
20536
  useNewCanvas: useNewCanvas
@@ -20588,21 +20578,7 @@ class DefaultBaseTextureRenderContribution {
20588
20578
  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());
20589
20579
  }
20590
20580
  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();
20591
- } else if (pattern) {
20592
- if (pattern.setTransform) {
20593
- const alignToGraphic = !!(null == textureOptions ? void 0 : textureOptions.alignToGraphic),
20594
- alignOffsetX = null !== (_b = null == textureOptions ? void 0 : textureOptions.alignOffsetX) && void 0 !== _b ? _b : 0,
20595
- alignOffsetY = null !== (_c = null == textureOptions ? void 0 : textureOptions.alignOffsetY) && void 0 !== _c ? _c : 0;
20596
- let translateX = 0,
20597
- translateY = 0;
20598
- if (alignToGraphic) {
20599
- const m = context.currentMatrix;
20600
- translateX = (null !== (_d = null == m ? void 0 : m.e) && void 0 !== _d ? _d : 0) + x + alignOffsetX, translateY = (null !== (_e = null == m ? void 0 : m.f) && void 0 !== _e ? _e : 0) + y + alignOffsetY;
20601
- } else (alignOffsetX || alignOffsetY) && (translateX = alignOffsetX, translateY = alignOffsetY);
20602
- pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, translateX, translateY]));
20603
- }
20604
- context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = pattern, context.fill(), context.highPerformanceRestore();
20605
- } else if ("wave" === texture) {
20581
+ } else if (pattern) context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = pattern, context.fill(), context.highPerformanceRestore();else if ("wave" === texture) {
20606
20582
  context.save(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.clip();
20607
20583
  const b = graphic.AABBBounds;
20608
20584
  drawWave(context, textureRatio, b.width(), b.height(), Object.assign(Object.assign({}, textureOptions || {}), {
@@ -20610,17 +20586,6 @@ class DefaultBaseTextureRenderContribution {
20610
20586
  }), x + b.x1 - x, y + b.y1 - y), context.restore();
20611
20587
  }
20612
20588
  }
20613
- getPatternCacheKey(texture, textureSize, texturePadding, textureColor, dpr) {
20614
- return "string" != typeof texture ? texture : "wave" === texture ? null : `${texture}-${textureSize}-${texturePadding}-${textureColor}-${dpr}`;
20615
- }
20616
- createResourcePattern(texture, graphic, context) {
20617
- var _a;
20618
- const resource = null === (_a = graphic.resources) || void 0 === _a ? void 0 : _a.get(texture),
20619
- data = "success" === (null == resource ? void 0 : resource.state) ? resource.data : "object" == typeof texture ? texture : null;
20620
- if (!data) return null;
20621
- const pattern = context.createPattern(data, "repeat");
20622
- return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), pattern;
20623
- }
20624
20589
  }
20625
20590
  const defaultBaseTextureRenderContribution = new DefaultBaseTextureRenderContribution();
20626
20591
 
@@ -77577,13 +77542,13 @@ class BoxPlotSeries extends CartesianSeries {
77577
77542
  this.initBoxPlotMarkStyle();
77578
77543
  }
77579
77544
  _getMarkWidth() {
77580
- var _a;
77545
+ var _a, _b;
77581
77546
  if (this._autoBoxWidth) {
77582
77547
  return this._autoBoxWidth;
77583
77548
  }
77584
77549
  const bandAxisHelper = this._direction === "horizontal" ? this._yAxisHelper : this._xAxisHelper;
77585
77550
  const depthFromSpec = this._groups ? this._groups.fields.length : 1;
77586
- const bandWidth = (_a = bandAxisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(bandAxisHelper, depthFromSpec - 1);
77551
+ const bandWidth = (_b = (_a = bandAxisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(bandAxisHelper, depthFromSpec - 1)) !== null && _b !== void 0 ? _b : Math.max(this._boxWidth, this._shaftWidth);
77587
77552
  let width = bandWidth;
77588
77553
  if (isValid$1(this._spec.boxWidth)) {
77589
77554
  width = getActualNumValue(this._spec.boxWidth, bandWidth);
@@ -77598,7 +77563,7 @@ class BoxPlotSeries extends CartesianSeries {
77598
77563
  return this._autoBoxWidth;
77599
77564
  }
77600
77565
  _getPosition(direction, datum) {
77601
- var _a, _b, _c, _d;
77566
+ var _a, _b, _c, _d, _e, _f;
77602
77567
  let axisHelper;
77603
77568
  let sizeAttribute;
77604
77569
  let dataToPosition;
@@ -77615,7 +77580,7 @@ class BoxPlotSeries extends CartesianSeries {
77615
77580
  const scale = axisHelper.getScale(0);
77616
77581
  const depthFromSpec = this._groups ? this._groups.fields.length : 1;
77617
77582
  const depth = depthFromSpec;
77618
- const bandWidth = (_a = axisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(axisHelper, depth - 1);
77583
+ const bandWidth = (_b = (_a = axisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(axisHelper, depth - 1)) !== null && _b !== void 0 ? _b : Math.max(this._boxWidth, this._shaftWidth);
77619
77584
  const size = this._boxPlotMark.getAttribute(sizeAttribute, datum);
77620
77585
  if (depth > 1 && isValid$1(this._spec.boxGapInGroup)) {
77621
77586
  const groupFields = this._groups.fields;
@@ -77624,9 +77589,9 @@ class BoxPlotSeries extends CartesianSeries {
77624
77589
  let offSet = 0;
77625
77590
  for (let index = groupFields.length - 1; index >= 1; index--) {
77626
77591
  const groupField = groupFields[index];
77627
- const groupValues = (_c = (_b = axisHelper.getScale(index)) === null || _b === void 0 ? void 0 : _b.domain()) !== null && _c !== void 0 ? _c : [];
77592
+ const groupValues = (_d = (_c = axisHelper.getScale(index)) === null || _c === void 0 ? void 0 : _c.domain()) !== null && _d !== void 0 ? _d : [];
77628
77593
  const groupCount = groupValues.length;
77629
- const gap = getActualNumValue((_d = boxGapInGroup[index - 1]) !== null && _d !== void 0 ? _d : last(boxGapInGroup), bandWidth);
77594
+ const gap = getActualNumValue((_e = boxGapInGroup[index - 1]) !== null && _e !== void 0 ? _e : last(boxGapInGroup), bandWidth);
77630
77595
  const i = groupValues.indexOf(datum[groupField]);
77631
77596
  if (index === groupFields.length - 1) {
77632
77597
  totalWidth += groupCount * size + (groupCount - 1) * gap;
@@ -77637,7 +77602,8 @@ class BoxPlotSeries extends CartesianSeries {
77637
77602
  totalWidth += totalWidth + (groupCount - 1) * gap;
77638
77603
  }
77639
77604
  }
77640
- const center = scale.scale(datum[groupFields[0]]) + axisHelper.getBandwidth(0) / 2;
77605
+ const center = scale.scale(datum[groupFields[0]]) +
77606
+ ((_f = axisHelper.getBandwidth(0)) !== null && _f !== void 0 ? _f : Math.max(this._boxWidth, this._shaftWidth)) / 2;
77641
77607
  return center - totalWidth / 2 + offSet + size / 2;
77642
77608
  }
77643
77609
  const continuous = isContinuous(scale.type || 'band');
package/build/index.js CHANGED
@@ -11436,9 +11436,7 @@
11436
11436
  background: null,
11437
11437
  autoAnimateTexture: !1,
11438
11438
  textureRatio: 1,
11439
- textureOptions: {
11440
- alignToGraphic: !0
11441
- },
11439
+ textureOptions: null,
11442
11440
  backgroundOpacity: 1,
11443
11441
  backgroundCornerRadius: 0,
11444
11442
  texture: null,
@@ -16073,7 +16071,6 @@
16073
16071
  const tempConstantXYKey = ["x", "y"],
16074
16072
  tempConstantScaleXYKey = ["scaleX", "scaleY"],
16075
16073
  tempConstantAngleKey = ["angle"],
16076
- builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
16077
16074
  point = new Point();
16078
16075
  const NOWORK_ANIMATE_ATTR = {
16079
16076
  strokeSeg: 1,
@@ -16130,7 +16127,7 @@
16130
16127
  }
16131
16128
  constructor(params = {}) {
16132
16129
  var _a;
16133
- 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);
16130
+ super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background ? this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
16134
16131
  }
16135
16132
  getGraphicService() {
16136
16133
  var _a, _b;
@@ -16319,7 +16316,7 @@
16319
16316
  });
16320
16317
  }
16321
16318
  setAttributes(params, forceUpdateTag = !1, context) {
16322
- 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));
16319
+ params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
16323
16320
  }
16324
16321
  _setAttributes(params, forceUpdateTag = !1, context) {
16325
16322
  const keys = Object.keys(params);
@@ -16334,7 +16331,7 @@
16334
16331
  const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
16335
16332
  [key]: value
16336
16333
  }, this.attribute, key, context);
16337
- 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);
16334
+ params ? this._setAttributes(params, forceUpdateTag, context) : isNil$1(null === (_a = this.normalAttrs) || void 0 === _a ? void 0 : _a[key]) ? (this.attribute[key] = value, this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag(), this.onAttributeUpdate(context)) : this.normalAttrs[key] = value, "background" === key ? this.loadImage(value, !0) : "shadowGraphic" === key && this.setShadowGraphic(value);
16338
16335
  }
16339
16336
  needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
16340
16337
  for (let i = 0; i < k.length; i++) {
@@ -16353,7 +16350,7 @@
16353
16350
  const context = {
16354
16351
  type: AttributeUpdateType.INIT
16355
16352
  };
16356
- 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);
16353
+ params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._updateTag = UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
16357
16354
  }
16358
16355
  translate(x, y) {
16359
16356
  var _a, _b;
@@ -16744,9 +16741,6 @@
16744
16741
  function backgroundNotImage(image) {
16745
16742
  return "string" == typeof image ? !(image.startsWith("<svg") || isValidUrl$1(image) || image.includes("/") || isBase64$1(image)) : !(!image.fill && !image.stroke) || !("string" != typeof image.gradient || !Array.isArray(image.stops));
16746
16743
  }
16747
- function isExternalTexture(texture) {
16748
- return !!texture && ("string" == typeof texture ? !builtinTextureTypes.has(texture) && (texture.startsWith("<svg") || isValidUrl$1(texture) || texture.includes("/") || isBase64$1(texture)) : isObject$2(texture));
16749
- }
16750
16744
  Graphic.userSymbolMap = {}, Graphic.mixin(EventTarget);
16751
16745
 
16752
16746
  var GroupUpdateAABBBoundsMode;
@@ -20511,42 +20505,38 @@
20511
20505
  texture && this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);
20512
20506
  }
20513
20507
  drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding) {
20514
- var _a, _b, _c, _d, _e;
20508
+ var _a;
20515
20509
  const {
20516
20510
  textureRatio = graphicAttribute.textureRatio,
20517
20511
  textureOptions = null
20518
20512
  } = graphic.attribute;
20519
- let pattern = null;
20520
- const patternKey = this.getPatternCacheKey(texture, textureSize, texturePadding, textureColor, context.dpr);
20521
- if (null !== patternKey && (pattern = this.textureMap.get(patternKey)), !pattern) {
20522
- if ("string" == typeof texture) switch (texture) {
20523
- case "circle":
20524
- pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
20525
- break;
20526
- case "diamond":
20527
- pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
20528
- break;
20529
- case "rect":
20530
- pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
20531
- break;
20532
- case "vertical-line":
20533
- pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
20534
- break;
20535
- case "horizontal-line":
20536
- pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
20537
- break;
20538
- case "bias-lr":
20539
- pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
20540
- break;
20541
- case "bias-rl":
20542
- pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
20543
- break;
20544
- case "grid":
20545
- pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
20546
- }
20547
- pattern || (pattern = this.createResourcePattern(texture, graphic, context)), pattern && null !== patternKey && this.textureMap.set(patternKey, pattern);
20513
+ let pattern = this.textureMap.get(texture);
20514
+ if (!pattern) switch (texture) {
20515
+ case "circle":
20516
+ pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
20517
+ break;
20518
+ case "diamond":
20519
+ pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
20520
+ break;
20521
+ case "rect":
20522
+ pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
20523
+ break;
20524
+ case "vertical-line":
20525
+ pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
20526
+ break;
20527
+ case "horizontal-line":
20528
+ pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
20529
+ break;
20530
+ case "bias-lr":
20531
+ pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
20532
+ break;
20533
+ case "bias-rl":
20534
+ pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
20535
+ break;
20536
+ case "grid":
20537
+ pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
20548
20538
  }
20549
- if ("string" == typeof texture && textureOptions && textureOptions.dynamicTexture) {
20539
+ if (textureOptions && textureOptions.dynamicTexture) {
20550
20540
  const {
20551
20541
  gridConfig = {},
20552
20542
  useNewCanvas: useNewCanvas
@@ -20594,21 +20584,7 @@
20594
20584
  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());
20595
20585
  }
20596
20586
  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();
20597
- } else if (pattern) {
20598
- if (pattern.setTransform) {
20599
- const alignToGraphic = !!(null == textureOptions ? void 0 : textureOptions.alignToGraphic),
20600
- alignOffsetX = null !== (_b = null == textureOptions ? void 0 : textureOptions.alignOffsetX) && void 0 !== _b ? _b : 0,
20601
- alignOffsetY = null !== (_c = null == textureOptions ? void 0 : textureOptions.alignOffsetY) && void 0 !== _c ? _c : 0;
20602
- let translateX = 0,
20603
- translateY = 0;
20604
- if (alignToGraphic) {
20605
- const m = context.currentMatrix;
20606
- translateX = (null !== (_d = null == m ? void 0 : m.e) && void 0 !== _d ? _d : 0) + x + alignOffsetX, translateY = (null !== (_e = null == m ? void 0 : m.f) && void 0 !== _e ? _e : 0) + y + alignOffsetY;
20607
- } else (alignOffsetX || alignOffsetY) && (translateX = alignOffsetX, translateY = alignOffsetY);
20608
- pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, translateX, translateY]));
20609
- }
20610
- context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = pattern, context.fill(), context.highPerformanceRestore();
20611
- } else if ("wave" === texture) {
20587
+ } else if (pattern) context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = pattern, context.fill(), context.highPerformanceRestore();else if ("wave" === texture) {
20612
20588
  context.save(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.clip();
20613
20589
  const b = graphic.AABBBounds;
20614
20590
  drawWave(context, textureRatio, b.width(), b.height(), Object.assign(Object.assign({}, textureOptions || {}), {
@@ -20616,17 +20592,6 @@
20616
20592
  }), x + b.x1 - x, y + b.y1 - y), context.restore();
20617
20593
  }
20618
20594
  }
20619
- getPatternCacheKey(texture, textureSize, texturePadding, textureColor, dpr) {
20620
- return "string" != typeof texture ? texture : "wave" === texture ? null : `${texture}-${textureSize}-${texturePadding}-${textureColor}-${dpr}`;
20621
- }
20622
- createResourcePattern(texture, graphic, context) {
20623
- var _a;
20624
- const resource = null === (_a = graphic.resources) || void 0 === _a ? void 0 : _a.get(texture),
20625
- data = "success" === (null == resource ? void 0 : resource.state) ? resource.data : "object" == typeof texture ? texture : null;
20626
- if (!data) return null;
20627
- const pattern = context.createPattern(data, "repeat");
20628
- return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), pattern;
20629
- }
20630
20595
  }
20631
20596
  const defaultBaseTextureRenderContribution = new DefaultBaseTextureRenderContribution();
20632
20597
 
@@ -77583,13 +77548,13 @@
77583
77548
  this.initBoxPlotMarkStyle();
77584
77549
  }
77585
77550
  _getMarkWidth() {
77586
- var _a;
77551
+ var _a, _b;
77587
77552
  if (this._autoBoxWidth) {
77588
77553
  return this._autoBoxWidth;
77589
77554
  }
77590
77555
  const bandAxisHelper = this._direction === "horizontal" ? this._yAxisHelper : this._xAxisHelper;
77591
77556
  const depthFromSpec = this._groups ? this._groups.fields.length : 1;
77592
- const bandWidth = (_a = bandAxisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(bandAxisHelper, depthFromSpec - 1);
77557
+ const bandWidth = (_b = (_a = bandAxisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(bandAxisHelper, depthFromSpec - 1)) !== null && _b !== void 0 ? _b : Math.max(this._boxWidth, this._shaftWidth);
77593
77558
  let width = bandWidth;
77594
77559
  if (isValid$1(this._spec.boxWidth)) {
77595
77560
  width = getActualNumValue(this._spec.boxWidth, bandWidth);
@@ -77604,7 +77569,7 @@
77604
77569
  return this._autoBoxWidth;
77605
77570
  }
77606
77571
  _getPosition(direction, datum) {
77607
- var _a, _b, _c, _d;
77572
+ var _a, _b, _c, _d, _e, _f;
77608
77573
  let axisHelper;
77609
77574
  let sizeAttribute;
77610
77575
  let dataToPosition;
@@ -77621,7 +77586,7 @@
77621
77586
  const scale = axisHelper.getScale(0);
77622
77587
  const depthFromSpec = this._groups ? this._groups.fields.length : 1;
77623
77588
  const depth = depthFromSpec;
77624
- const bandWidth = (_a = axisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(axisHelper, depth - 1);
77589
+ const bandWidth = (_b = (_a = axisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(axisHelper, depth - 1)) !== null && _b !== void 0 ? _b : Math.max(this._boxWidth, this._shaftWidth);
77625
77590
  const size = this._boxPlotMark.getAttribute(sizeAttribute, datum);
77626
77591
  if (depth > 1 && isValid$1(this._spec.boxGapInGroup)) {
77627
77592
  const groupFields = this._groups.fields;
@@ -77630,9 +77595,9 @@
77630
77595
  let offSet = 0;
77631
77596
  for (let index = groupFields.length - 1; index >= 1; index--) {
77632
77597
  const groupField = groupFields[index];
77633
- const groupValues = (_c = (_b = axisHelper.getScale(index)) === null || _b === void 0 ? void 0 : _b.domain()) !== null && _c !== void 0 ? _c : [];
77598
+ const groupValues = (_d = (_c = axisHelper.getScale(index)) === null || _c === void 0 ? void 0 : _c.domain()) !== null && _d !== void 0 ? _d : [];
77634
77599
  const groupCount = groupValues.length;
77635
- const gap = getActualNumValue((_d = boxGapInGroup[index - 1]) !== null && _d !== void 0 ? _d : last(boxGapInGroup), bandWidth);
77600
+ const gap = getActualNumValue((_e = boxGapInGroup[index - 1]) !== null && _e !== void 0 ? _e : last(boxGapInGroup), bandWidth);
77636
77601
  const i = groupValues.indexOf(datum[groupField]);
77637
77602
  if (index === groupFields.length - 1) {
77638
77603
  totalWidth += groupCount * size + (groupCount - 1) * gap;
@@ -77643,7 +77608,8 @@
77643
77608
  totalWidth += totalWidth + (groupCount - 1) * gap;
77644
77609
  }
77645
77610
  }
77646
- const center = scale.scale(datum[groupFields[0]]) + axisHelper.getBandwidth(0) / 2;
77611
+ const center = scale.scale(datum[groupFields[0]]) +
77612
+ ((_f = axisHelper.getBandwidth(0)) !== null && _f !== void 0 ? _f : Math.max(this._boxWidth, this._shaftWidth)) / 2;
77647
77613
  return center - totalWidth / 2 + offSet + size / 2;
77648
77614
  }
77649
77615
  const continuous = isContinuous(scale.type || 'band');