@visactor/vtable 1.22.13-alpha.1 → 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.
package/dist/vtable.js CHANGED
@@ -627,28 +627,59 @@
627
627
  }
628
628
  addEventListener(type, listener, options) {
629
629
  if (!listener) return;
630
+ const capture = this._resolveCapture(options),
631
+ once = this._resolveOnce(options),
632
+ listenerTypeMap = this._getOrCreateListenerTypeMap(type),
633
+ wrappedMap = this._getOrCreateWrappedMap(listenerTypeMap, listener);
634
+ if (wrappedMap.has(capture)) return;
630
635
  const wrappedListener = event => {
631
636
  const transformedEvent = this._eventListenerTransformer(event);
632
- "function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent);
637
+ "function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent), once && this._deleteListenerRecord(type, listener, capture);
633
638
  };
634
- this._listenerMap.has(type) || this._listenerMap.set(type, new Map()), this._listenerMap.get(type).set(listener, wrappedListener), this._nativeAddEventListener(type, wrappedListener, options);
639
+ wrappedMap.set(capture, {
640
+ wrappedListener: wrappedListener,
641
+ options: options
642
+ }), this._nativeAddEventListener(type, wrappedListener, options);
635
643
  }
636
644
  removeEventListener(type, listener, options) {
637
- var _a;
645
+ var _a, _b;
638
646
  if (!listener) return;
639
- const wrappedListener = null === (_a = this._listenerMap.get(type)) || void 0 === _a ? void 0 : _a.get(listener);
640
- wrappedListener && (this._nativeRemoveEventListener(type, wrappedListener, options), this._listenerMap.get(type).delete(listener), 0 === this._listenerMap.get(type).size && this._listenerMap.delete(type));
647
+ const capture = this._resolveCapture(options),
648
+ wrappedRecord = null === (_b = null === (_a = this._listenerMap.get(type)) || void 0 === _a ? void 0 : _a.get(listener)) || void 0 === _b ? void 0 : _b.get(capture);
649
+ wrappedRecord && (this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture), this._deleteListenerRecord(type, listener, capture));
641
650
  }
642
651
  dispatchEvent(event) {
643
652
  return this._nativeDispatchEvent(event);
644
653
  }
645
654
  clearAllEventListeners() {
646
- this._listenerMap.forEach((listenersMap, type) => {
647
- listenersMap.forEach((wrappedListener, originalListener) => {
648
- this._nativeRemoveEventListener(type, wrappedListener, void 0);
655
+ this._listenerMap.forEach((listenerMap, type) => {
656
+ listenerMap.forEach(wrappedMap => {
657
+ wrappedMap.forEach((wrappedRecord, capture) => {
658
+ this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture);
659
+ });
649
660
  });
650
661
  }), this._listenerMap.clear();
651
662
  }
663
+ _resolveCapture(options) {
664
+ return "boolean" == typeof options ? options : !!(null == options ? void 0 : options.capture);
665
+ }
666
+ _resolveOnce(options) {
667
+ return "object" == typeof options && !!(null == options ? void 0 : options.once);
668
+ }
669
+ _getOrCreateListenerTypeMap(type) {
670
+ let listenerTypeMap = this._listenerMap.get(type);
671
+ return listenerTypeMap || (listenerTypeMap = new Map(), this._listenerMap.set(type, listenerTypeMap)), listenerTypeMap;
672
+ }
673
+ _getOrCreateWrappedMap(listenerTypeMap, listener) {
674
+ let wrappedMap = listenerTypeMap.get(listener);
675
+ return wrappedMap || (wrappedMap = new Map(), listenerTypeMap.set(listener, wrappedMap)), wrappedMap;
676
+ }
677
+ _deleteListenerRecord(type, listener, capture) {
678
+ const listenerTypeMap = this._listenerMap.get(type);
679
+ if (!listenerTypeMap) return;
680
+ const wrappedMap = listenerTypeMap.get(listener);
681
+ wrappedMap && (wrappedMap.delete(capture), 0 === wrappedMap.size && listenerTypeMap.delete(listener), 0 === listenerTypeMap.size && this._listenerMap.delete(type));
682
+ }
652
683
  _nativeAddEventListener(type, listener, options) {
653
684
  throw new Error("_nativeAddEventListener must be implemented by derived classes");
654
685
  }
@@ -4544,6 +4575,7 @@
4544
4575
  backgroundScale: 1,
4545
4576
  backgroundOffsetX: 0,
4546
4577
  backgroundOffsetY: 0,
4578
+ backgroundPosition: "top-left",
4547
4579
  blur: 0,
4548
4580
  filter: "",
4549
4581
  cursor: null,
@@ -4716,11 +4748,16 @@
4716
4748
  const DefaultImageAttribute = Object.assign(Object.assign({
4717
4749
  repeatX: "no-repeat",
4718
4750
  repeatY: "no-repeat",
4751
+ imageMode: void 0,
4719
4752
  image: "",
4720
4753
  width: 0,
4721
4754
  height: 0,
4722
4755
  maxWidth: 500,
4723
- maxHeight: 500
4756
+ maxHeight: 500,
4757
+ imagePosition: "top-left",
4758
+ imageScale: 1,
4759
+ imageOffsetX: 0,
4760
+ imageOffsetY: 0
4724
4761
  }, DefaultAttribute), {
4725
4762
  fill: !0,
4726
4763
  cornerRadius: 0,
@@ -7162,7 +7199,9 @@
7162
7199
  var _a;
7163
7200
  if (event.manager !== this) throw new Error("It is illegal to free an event not managed by this EventManager!");
7164
7201
  const constructor = event.constructor;
7165
- this.eventPool.has(constructor) || this.eventPool.set(constructor, []), null === (_a = this.eventPool.get(constructor)) || void 0 === _a || _a.push(event);
7202
+ this.eventPool.has(constructor) || (this.eventPool.get(constructor).forEach(e => {
7203
+ e.eventPhase = event.NONE, e.currentTarget = null, e.path = [], e.detailPath = [], e.target = null;
7204
+ }), this.eventPool.set(constructor, [])), null === (_a = this.eventPool.get(constructor)) || void 0 === _a || _a.push(event);
7166
7205
  }
7167
7206
  notifyListeners(e, type) {
7168
7207
  const listeners = e.currentTarget._events[type];
@@ -9119,6 +9158,7 @@
9119
9158
  const tempConstantXYKey = ["x", "y"],
9120
9159
  tempConstantScaleXYKey = ["scaleX", "scaleY"],
9121
9160
  tempConstantAngleKey = ["angle"],
9161
+ builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
9122
9162
  point = new Point();
9123
9163
  const NOWORK_ANIMATE_ATTR = {
9124
9164
  strokeSeg: 1,
@@ -9175,7 +9215,7 @@
9175
9215
  }
9176
9216
  constructor(params = {}) {
9177
9217
  var _a;
9178
- 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);
9218
+ 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);
9179
9219
  }
9180
9220
  getGraphicService() {
9181
9221
  var _a, _b;
@@ -9364,7 +9404,7 @@
9364
9404
  });
9365
9405
  }
9366
9406
  setAttributes(params, forceUpdateTag = !1, context) {
9367
- 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));
9407
+ 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));
9368
9408
  }
9369
9409
  _setAttributes(params, forceUpdateTag = !1, context) {
9370
9410
  const keys = Object.keys(params);
@@ -9379,7 +9419,7 @@
9379
9419
  const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
9380
9420
  [key]: value
9381
9421
  }, this.attribute, key, context);
9382
- 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);
9422
+ 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);
9383
9423
  }
9384
9424
  needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
9385
9425
  for (let i = 0; i < k.length; i++) {
@@ -9398,7 +9438,7 @@
9398
9438
  const context = {
9399
9439
  type: AttributeUpdateType.INIT
9400
9440
  };
9401
- 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);
9441
+ 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);
9402
9442
  }
9403
9443
  translate(x, y) {
9404
9444
  var _a, _b;
@@ -9731,7 +9771,8 @@
9731
9771
  return isString$2(path, !0) ? this.pathProxy = new CustomPath2D().fromString(path) : this.pathProxy = new CustomPath2D(), this.pathProxy;
9732
9772
  }
9733
9773
  loadImage(image, background = !1) {
9734
- if (!image || background && backgroundNotImage(image)) return;
9774
+ if (background && (null == image ? void 0 : image.background) && (image = image.background), background && (!image || backgroundNotImage(image))) return void (this.backgroundImg = !1);
9775
+ if (!image) return;
9735
9776
  const url = image;
9736
9777
  this.resources || (this.resources = new Map());
9737
9778
  const cache = {
@@ -9766,7 +9807,7 @@
9766
9807
  });
9767
9808
  }
9768
9809
  release() {
9769
- this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this);
9810
+ this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this), super.release();
9770
9811
  }
9771
9812
  _emitCustomEvent(type, context) {
9772
9813
  var _a, _b;
@@ -9786,7 +9827,10 @@
9786
9827
  }
9787
9828
  }
9788
9829
  function backgroundNotImage(image) {
9789
- return !(!image.fill && !image.stroke);
9830
+ 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));
9831
+ }
9832
+ function isExternalTexture(texture) {
9833
+ return !!texture && ("string" == typeof texture ? !builtinTextureTypes.has(texture) && (texture.startsWith("<svg") || isValidUrl$1(texture) || texture.includes("/") || isBase64$1(texture)) : isObject$7(texture));
9790
9834
  }
9791
9835
  Graphic.userSymbolMap = {}, Graphic.mixin(EventTarget$2);
9792
9836
 
@@ -11880,7 +11924,7 @@
11880
11924
  return [new Paragraph(text1, paragraph.newLine, paragraph.character, paragraph.ascentDescentMode), new Paragraph(text2, !0, paragraph.character, paragraph.ascentDescentMode)];
11881
11925
  }
11882
11926
 
11883
- const IMAGE_UPDATE_TAG_KEY = ["width", "height", "image", ...GRAPHIC_UPDATE_TAG_KEY];
11927
+ const IMAGE_UPDATE_TAG_KEY = ["width", "height", "image", "imageMode", "imagePosition", "imageScale", "imageOffsetX", "imageOffsetY", ...GRAPHIC_UPDATE_TAG_KEY];
11884
11928
  let Image$2 = class Image extends Graphic {
11885
11929
  constructor(params) {
11886
11930
  super(params), this.type = "image", this.numberType = IMAGE_NUMBER_TYPE, this.loadImage(this.attribute.image);
@@ -11985,6 +12029,7 @@
11985
12029
  };
11986
12030
  Image$2.NOWORK_ANIMATE_ATTR = Object.assign({
11987
12031
  image: 1,
12032
+ imageMode: 1,
11988
12033
  repeatX: 1,
11989
12034
  repeatY: 1
11990
12035
  }, NOWORK_ANIMATE_ATTR);
@@ -12961,11 +13006,12 @@
12961
13006
  backgroundScale = graphicAttribute.backgroundScale,
12962
13007
  backgroundOffsetX = graphicAttribute.backgroundOffsetX,
12963
13008
  backgroundOffsetY = graphicAttribute.backgroundOffsetY,
12964
- backgroundClip = graphicAttribute.backgroundClip
13009
+ backgroundClip = graphicAttribute.backgroundClip,
13010
+ backgroundPosition = graphicAttribute.backgroundPosition
12965
13011
  } = graphic.attribute;
12966
13012
  if (background) if (graphic.backgroundImg && graphic.resources) {
12967
- const res = graphic.resources.get(background);
12968
- if ("success" !== res.state || !res.data) return;
13013
+ const res = graphic.resources.get(getBackgroundImage(background));
13014
+ if (!res || "success" !== res.state || !res.data) return;
12969
13015
  if (context.save(), graphic.parent && !graphic.transMatrix.onlyTranslate()) {
12970
13016
  const groupAttribute = getTheme(graphic.parent).group,
12971
13017
  {
@@ -12982,59 +13028,160 @@
12982
13028
  backgroundKeepAspectRatio: backgroundKeepAspectRatio,
12983
13029
  backgroundScale: backgroundScale,
12984
13030
  backgroundOffsetX: backgroundOffsetX,
12985
- backgroundOffsetY: backgroundOffsetY
13031
+ backgroundOffsetY: backgroundOffsetY,
13032
+ backgroundPosition: backgroundPosition
12986
13033
  }), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
12987
13034
  } else context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, context.fill(), context.highPerformanceRestore();
12988
13035
  }
12989
13036
  doDrawImage(context, data, b, params) {
12990
- const {
12991
- backgroundMode: backgroundMode,
12992
- backgroundFit: backgroundFit,
12993
- backgroundKeepAspectRatio: backgroundKeepAspectRatio,
12994
- backgroundScale = 1,
12995
- backgroundOffsetX = 0,
12996
- backgroundOffsetY = 0
12997
- } = params,
12998
- targetW = b.width(),
12999
- targetH = b.height();
13000
- let w = targetW,
13001
- h = targetH;
13002
- if ("no-repeat" === backgroundMode) {
13003
- if (backgroundFit) {
13004
- if (backgroundKeepAspectRatio) {
13005
- const maxScale = Math.max(targetW / data.width, targetH / data.height);
13006
- context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, data.width * maxScale * backgroundScale, data.height * maxScale * backgroundScale);
13007
- } else context.drawImage(data, b.x1, b.y1, b.width(), b.height());
13008
- } else {
13009
- const resW = data.width * backgroundScale,
13010
- resH = data.height * backgroundScale;
13011
- context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, resW, resH);
13012
- }
13013
- } else {
13014
- if (backgroundFit && "repeat" !== backgroundMode && (data.width || data.height)) {
13015
- const resW = data.width,
13016
- resH = data.height;
13017
- if ("repeat-x" === backgroundMode) {
13018
- w = resW * (targetH / resH), h = targetH;
13019
- } else if ("repeat-y" === backgroundMode) {
13020
- h = resH * (targetW / resW), w = targetW;
13021
- }
13022
- const dpr = context.dpr,
13023
- canvas = canvasAllocate.allocate({
13024
- width: w,
13025
- height: h,
13026
- dpr: dpr
13027
- }),
13028
- ctx = canvas.getContext("2d");
13029
- 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);
13030
- }
13031
- const dpr = context.dpr,
13032
- pattern = context.createPattern(data, backgroundMode);
13033
- 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);
13034
- }
13037
+ drawBackgroundImage(context, data, b, params);
13035
13038
  }
13036
13039
  }
13037
13040
  const defaultBaseBackgroundRenderContribution = new DefaultBaseBackgroundRenderContribution();
13041
+ const verticalPositionKeywords = new Set(["top", "center", "bottom"]);
13042
+ function getBackgroundImage(background) {
13043
+ var _a;
13044
+ return null !== (_a = null == background ? void 0 : background.background) && void 0 !== _a ? _a : background;
13045
+ }
13046
+ function resolveBackgroundSizing({
13047
+ backgroundFit: backgroundFit,
13048
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio
13049
+ }) {
13050
+ return backgroundFit ? backgroundKeepAspectRatio ? "cover" : "fill" : "auto";
13051
+ }
13052
+ const NO_REPEAT_SIZING_MAP = {
13053
+ "no-repeat-cover": "cover",
13054
+ "no-repeat-contain": "contain",
13055
+ "no-repeat-fill": "fill",
13056
+ "no-repeat-auto": "auto"
13057
+ };
13058
+ function resolveBackgroundDrawMode({
13059
+ backgroundMode: backgroundMode,
13060
+ backgroundFit: backgroundFit,
13061
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio
13062
+ }) {
13063
+ const sizing = NO_REPEAT_SIZING_MAP[backgroundMode];
13064
+ return sizing ? {
13065
+ backgroundRepeatMode: "no-repeat",
13066
+ backgroundSizing: sizing
13067
+ } : {
13068
+ backgroundRepeatMode: backgroundMode,
13069
+ backgroundSizing: resolveBackgroundSizing({
13070
+ backgroundFit: backgroundFit,
13071
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio
13072
+ })
13073
+ };
13074
+ }
13075
+ function isPercentageValue(value) {
13076
+ return /^-?\d+(\.\d+)?%$/.test(value);
13077
+ }
13078
+ function parsePositionToken(value, remainSpace, startKeyword, centerKeyword, endKeyword) {
13079
+ if ("number" == typeof value && Number.isFinite(value)) return value;
13080
+ const normalizedValue = `${null != value ? value : ""}`.trim().toLowerCase();
13081
+ if (!normalizedValue || normalizedValue === startKeyword) return 0;
13082
+ if (normalizedValue === centerKeyword) return remainSpace / 2;
13083
+ if (normalizedValue === endKeyword) return remainSpace;
13084
+ if (isPercentageValue(normalizedValue)) return remainSpace * parseFloat(normalizedValue) / 100;
13085
+ const parsedValue = Number(normalizedValue);
13086
+ return Number.isFinite(parsedValue) ? parsedValue : 0;
13087
+ }
13088
+ function normalizeBackgroundPosition(position) {
13089
+ var _a, _b;
13090
+ if (Array.isArray(position)) return [null !== (_a = position[0]) && void 0 !== _a ? _a : "left", null !== (_b = position[1]) && void 0 !== _b ? _b : "top"];
13091
+ const tokens = `${null != position ? position : "top-left"}`.trim().toLowerCase().replace(/-/g, " ").split(/\s+/).filter(Boolean);
13092
+ if (0 === tokens.length) return ["left", "top"];
13093
+ if (1 === tokens.length) {
13094
+ const token = tokens[0];
13095
+ return "center" === token ? ["center", "center"] : verticalPositionKeywords.has(token) ? ["center", token] : [token, "center"];
13096
+ }
13097
+ let horizontal, vertical;
13098
+ const genericTokens = [];
13099
+ for (let i = 0; i < 2; i++) {
13100
+ const token = tokens[i];
13101
+ "left" !== token && "right" !== token ? "top" !== token && "bottom" !== token ? genericTokens.push(token) : vertical = token : horizontal = token;
13102
+ }
13103
+ return null == horizontal && genericTokens.length && (horizontal = genericTokens.shift()), null == vertical && genericTokens.length && (vertical = genericTokens.shift()), [null != horizontal ? horizontal : "left", null != vertical ? vertical : "top"];
13104
+ }
13105
+ function resolveBackgroundPosition(position, remainWidth, remainHeight) {
13106
+ const [horizontalPosition, verticalPosition] = normalizeBackgroundPosition(position);
13107
+ return {
13108
+ x: parsePositionToken(horizontalPosition, remainWidth, "left", "center", "right"),
13109
+ y: parsePositionToken(verticalPosition, remainHeight, "top", "center", "bottom")
13110
+ };
13111
+ }
13112
+ function pickRenderableDimension(...values) {
13113
+ for (const value of values) if ("number" == typeof value && Number.isFinite(value) && value > 0) return value;
13114
+ return null;
13115
+ }
13116
+ function resolveRenderableImageSize(data) {
13117
+ if (!data) return null;
13118
+ const width = pickRenderableDimension(data.naturalWidth, data.videoWidth, data.width),
13119
+ height = pickRenderableDimension(data.naturalHeight, data.videoHeight, data.height);
13120
+ return null == width || null == height ? null : {
13121
+ width: width,
13122
+ height: height
13123
+ };
13124
+ }
13125
+ function drawBackgroundImage(context, data, b, params) {
13126
+ var _a, _b;
13127
+ const {
13128
+ backgroundMode: backgroundMode,
13129
+ backgroundFit: backgroundFit,
13130
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio,
13131
+ backgroundScale = 1,
13132
+ backgroundOffsetX = 0,
13133
+ backgroundOffsetY = 0,
13134
+ backgroundPosition = "top-left"
13135
+ } = params,
13136
+ targetW = b.width(),
13137
+ targetH = b.height(),
13138
+ sourceSize = resolveRenderableImageSize(data),
13139
+ {
13140
+ backgroundRepeatMode: backgroundRepeatMode,
13141
+ backgroundSizing: resolvedBackgroundSizing
13142
+ } = resolveBackgroundDrawMode({
13143
+ backgroundMode: backgroundMode,
13144
+ backgroundFit: backgroundFit,
13145
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio
13146
+ });
13147
+ let w = targetW,
13148
+ h = targetH;
13149
+ if (targetW <= 0 || targetH <= 0) return;
13150
+ if ("no-repeat" === backgroundRepeatMode) {
13151
+ let drawWidth = null !== (_a = null == sourceSize ? void 0 : sourceSize.width) && void 0 !== _a ? _a : targetW,
13152
+ drawHeight = null !== (_b = null == sourceSize ? void 0 : sourceSize.height) && void 0 !== _b ? _b : targetH;
13153
+ if ("cover" !== resolvedBackgroundSizing && "contain" !== resolvedBackgroundSizing || !sourceSize) "fill" === resolvedBackgroundSizing && (drawWidth = targetW, drawHeight = targetH);else {
13154
+ const scale = "cover" === resolvedBackgroundSizing ? Math.max(targetW / sourceSize.width, targetH / sourceSize.height) : Math.min(targetW / sourceSize.width, targetH / sourceSize.height);
13155
+ drawWidth = sourceSize.width * scale, drawHeight = sourceSize.height * scale;
13156
+ }
13157
+ drawWidth *= backgroundScale, drawHeight *= backgroundScale;
13158
+ const {
13159
+ x: x,
13160
+ y: y
13161
+ } = resolveBackgroundPosition(backgroundPosition, targetW - drawWidth, targetH - drawHeight);
13162
+ return void context.drawImage(data, b.x1 + x + backgroundOffsetX, b.y1 + y + backgroundOffsetY, drawWidth, drawHeight);
13163
+ }
13164
+ if (backgroundFit && "repeat" !== backgroundRepeatMode && sourceSize) {
13165
+ const resW = sourceSize.width,
13166
+ resH = sourceSize.height;
13167
+ if ("repeat-x" === backgroundRepeatMode) {
13168
+ w = resW * (targetH / resH), h = targetH;
13169
+ } else if ("repeat-y" === backgroundRepeatMode) {
13170
+ h = resH * (targetW / resW), w = targetW;
13171
+ }
13172
+ const dpr = context.dpr,
13173
+ canvas = canvasAllocate.allocate({
13174
+ width: w,
13175
+ height: h,
13176
+ dpr: dpr
13177
+ }),
13178
+ ctx = canvas.getContext("2d");
13179
+ 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);
13180
+ }
13181
+ const dpr = context.dpr,
13182
+ pattern = context.createPattern(data, backgroundRepeatMode);
13183
+ 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);
13184
+ }
13038
13185
  let DefaultBaseInteractiveRenderContribution = class {
13039
13186
  constructor(subRenderContribitions) {
13040
13187
  this.subRenderContribitions = subRenderContribitions, this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
@@ -13080,6 +13227,7 @@
13080
13227
  }
13081
13228
  const defaultBaseClipRenderAfterContribution = new DefaultBaseClipRenderAfterContribution();
13082
13229
 
13230
+ const builtinProceduralTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid"]);
13083
13231
  function formatRatio(ratio) {
13084
13232
  return ratio <= .5 ? 4 * ratio - 1 : -4 * ratio + 3;
13085
13233
  }
@@ -13193,38 +13341,43 @@
13193
13341
  texture && this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);
13194
13342
  }
13195
13343
  drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding) {
13196
- var _a;
13344
+ var _a, _b, _c, _d, _e, _f;
13197
13345
  const {
13198
13346
  textureRatio = graphicAttribute.textureRatio,
13199
13347
  textureOptions = null
13200
13348
  } = graphic.attribute;
13201
- let pattern = this.textureMap.get(texture);
13202
- if (!pattern) switch (texture) {
13203
- case "circle":
13204
- pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
13205
- break;
13206
- case "diamond":
13207
- pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
13208
- break;
13209
- case "rect":
13210
- pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
13211
- break;
13212
- case "vertical-line":
13213
- pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
13214
- break;
13215
- case "horizontal-line":
13216
- pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
13217
- break;
13218
- case "bias-lr":
13219
- pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
13220
- break;
13221
- case "bias-rl":
13222
- pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
13223
- break;
13224
- case "grid":
13225
- pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
13349
+ let pattern = null;
13350
+ const textureRadius = null !== (_a = null == textureOptions ? void 0 : textureOptions.radius) && void 0 !== _a ? _a : 0,
13351
+ patternKey = this.getPatternCacheKey(texture, textureSize, texturePadding, textureColor, context.dpr, textureRadius);
13352
+ if (null !== patternKey && (pattern = this.textureMap.get(patternKey)), !pattern) {
13353
+ if ("string" == typeof texture) switch (texture) {
13354
+ case "circle":
13355
+ pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
13356
+ break;
13357
+ case "diamond":
13358
+ pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
13359
+ break;
13360
+ case "rect":
13361
+ pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
13362
+ break;
13363
+ case "vertical-line":
13364
+ pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
13365
+ break;
13366
+ case "horizontal-line":
13367
+ pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
13368
+ break;
13369
+ case "bias-lr":
13370
+ pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
13371
+ break;
13372
+ case "bias-rl":
13373
+ pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
13374
+ break;
13375
+ case "grid":
13376
+ pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
13377
+ }
13378
+ pattern || (pattern = this.createResourcePattern(texture, graphic, context, texturePadding, textureRadius)), pattern && null !== patternKey && this.textureMap.set(patternKey, pattern);
13226
13379
  }
13227
- if (textureOptions && textureOptions.dynamicTexture) {
13380
+ if ("string" == typeof texture && textureOptions && textureOptions.dynamicTexture) {
13228
13381
  const {
13229
13382
  gridConfig = {},
13230
13383
  useNewCanvas: useNewCanvas
@@ -13269,10 +13422,24 @@
13269
13422
  for (let i = 0; i < gridRows; i++) for (let j = 0; j < gridColumns; j++) {
13270
13423
  const _x = x + cellSize / 2 + j * cellSize,
13271
13424
  _y = y + cellSize / 2 + i * cellSize;
13272
- 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());
13425
+ 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());
13273
13426
  }
13274
13427
  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();
13275
- } else if (pattern) context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = pattern, context.fill(), context.highPerformanceRestore();else if ("wave" === texture) {
13428
+ } else if (pattern) {
13429
+ if (pattern.setTransform) {
13430
+ const alignToGraphic = !!(null == textureOptions ? void 0 : textureOptions.alignToGraphic),
13431
+ alignOffsetX = null !== (_c = null == textureOptions ? void 0 : textureOptions.alignOffsetX) && void 0 !== _c ? _c : 0,
13432
+ alignOffsetY = null !== (_d = null == textureOptions ? void 0 : textureOptions.alignOffsetY) && void 0 !== _d ? _d : 0;
13433
+ let translateX = 0,
13434
+ translateY = 0;
13435
+ if (alignToGraphic) {
13436
+ const m = context.currentMatrix;
13437
+ 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;
13438
+ } else (alignOffsetX || alignOffsetY) && (translateX = alignOffsetX, translateY = alignOffsetY);
13439
+ pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, translateX, translateY]));
13440
+ }
13441
+ context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = pattern, context.fill(), context.highPerformanceRestore();
13442
+ } else if ("wave" === texture) {
13276
13443
  context.save(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.clip();
13277
13444
  const b = graphic.AABBBounds;
13278
13445
  drawWave(context, textureRatio, b.width(), b.height(), Object.assign(Object.assign({}, textureOptions || {}), {
@@ -13280,6 +13447,45 @@
13280
13447
  }), x + b.x1 - x, y + b.y1 - y), context.restore();
13281
13448
  }
13282
13449
  }
13450
+ getPatternCacheKey(texture, textureSize, texturePadding, textureColor, dpr, textureRadius) {
13451
+ 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}`;
13452
+ }
13453
+ createResourcePattern(texture, graphic, context, texturePadding, textureRadius) {
13454
+ var _a;
13455
+ const resource = null === (_a = graphic.resources) || void 0 === _a ? void 0 : _a.get(texture),
13456
+ data = "success" === (null == resource ? void 0 : resource.state) ? resource.data : "object" == typeof texture ? texture : null;
13457
+ if (!data) return null;
13458
+ if (texturePadding > 0 || textureRadius > 0) {
13459
+ const w = data.naturalWidth || data.width,
13460
+ h = data.naturalHeight || data.height;
13461
+ if (w > 0 && h > 0) {
13462
+ const tileW = w + 2 * texturePadding,
13463
+ tileH = h + 2 * texturePadding,
13464
+ canvas = canvasAllocate.allocate({
13465
+ width: tileW,
13466
+ height: tileH,
13467
+ dpr: context.dpr
13468
+ }),
13469
+ ctx = canvas.getContext("2d");
13470
+ if (ctx) {
13471
+ if (ctx.inuse = !0, ctx.clearMatrix(), ctx.setTransformForCurrent(!0), ctx.clearRect(0, 0, tileW, tileH), textureRadius > 0) {
13472
+ const r = Math.max(0, Math.min(textureRadius, Math.min(w, h) / 2)),
13473
+ x0 = texturePadding,
13474
+ y0 = texturePadding,
13475
+ x1 = x0 + w,
13476
+ y1 = y0 + h;
13477
+ 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();
13478
+ }
13479
+ ctx.drawImage(data, texturePadding, texturePadding, w, h);
13480
+ const pattern = context.createPattern(canvas.nativeCanvas, "repeat");
13481
+ 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;
13482
+ }
13483
+ canvasAllocate.free(canvas);
13484
+ }
13485
+ }
13486
+ const pattern = context.createPattern(data, "repeat");
13487
+ return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), pattern;
13488
+ }
13283
13489
  }
13284
13490
  const defaultBaseTextureRenderContribution = new DefaultBaseTextureRenderContribution();
13285
13491
 
@@ -13391,27 +13597,32 @@
13391
13597
  drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
13392
13598
  const {
13393
13599
  background: background,
13600
+ backgroundOpacity = graphicAttribute.backgroundOpacity,
13601
+ opacity = graphicAttribute.opacity,
13394
13602
  backgroundMode = graphicAttribute.backgroundMode,
13395
13603
  backgroundFit = graphicAttribute.backgroundFit,
13396
13604
  backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
13397
13605
  backgroundScale = graphicAttribute.backgroundScale,
13398
13606
  backgroundOffsetX = graphicAttribute.backgroundOffsetX,
13399
- backgroundOffsetY = graphicAttribute.backgroundOffsetY
13607
+ backgroundOffsetY = graphicAttribute.backgroundOffsetY,
13608
+ backgroundClip = graphicAttribute.backgroundClip,
13609
+ backgroundPosition = graphicAttribute.backgroundPosition
13400
13610
  } = graphic.attribute;
13401
13611
  if (background) if (graphic.backgroundImg && graphic.resources) {
13402
- const res = graphic.resources.get(background);
13403
- if ("success" !== res.state || !res.data) return;
13612
+ const res = graphic.resources.get(getBackgroundImage(background));
13613
+ if (!res || "success" !== res.state || !res.data) return;
13404
13614
  context.highPerformanceSave(), context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0);
13405
13615
  const b = graphic.AABBBounds;
13406
- this.doDrawImage(context, res.data, b, {
13616
+ context.globalAlpha = backgroundOpacity * opacity, backgroundClip && context.clip(), this.doDrawImage(context, res.data, b, {
13407
13617
  backgroundMode: backgroundMode,
13408
13618
  backgroundFit: backgroundFit,
13409
13619
  backgroundKeepAspectRatio: backgroundKeepAspectRatio,
13410
13620
  backgroundScale: backgroundScale,
13411
13621
  backgroundOffsetX: backgroundOffsetX,
13412
- backgroundOffsetY: backgroundOffsetY
13622
+ backgroundOffsetY: backgroundOffsetY,
13623
+ backgroundPosition: backgroundPosition
13413
13624
  }), context.highPerformanceRestore(), context.setTransformForCurrent();
13414
- } else context.highPerformanceSave(), context.fillStyle = background, context.fill(), context.highPerformanceRestore();
13625
+ } else context.highPerformanceSave(), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, context.fill(), context.highPerformanceRestore();
13415
13626
  }
13416
13627
  }
13417
13628
  const defaultGroupBackgroundRenderContribution = new DefaultGroupBackgroundRenderContribution();
@@ -14893,9 +15104,17 @@
14893
15104
  drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
14894
15105
  var _a, _c, _d, _e, _f, _g, _h, _j, _k, _l;
14895
15106
  const {
15107
+ backgroundOpacity = graphicAttribute.backgroundOpacity,
15108
+ opacity = graphicAttribute.opacity,
14896
15109
  backgroundMode = graphicAttribute.backgroundMode,
14897
15110
  backgroundFit = graphicAttribute.backgroundFit,
14898
- backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio
15111
+ backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
15112
+ backgroundScale = graphicAttribute.backgroundScale,
15113
+ backgroundOffsetX = graphicAttribute.backgroundOffsetX,
15114
+ backgroundOffsetY = graphicAttribute.backgroundOffsetY,
15115
+ backgroundPosition = graphicAttribute.backgroundPosition,
15116
+ backgroundClip = graphicAttribute.backgroundClip,
15117
+ backgroundCornerRadius = graphicAttribute.backgroundCornerRadius
14899
15118
  } = graphic.attribute;
14900
15119
  let matrix,
14901
15120
  {
@@ -14907,18 +15126,18 @@
14907
15126
  };
14908
15127
  let b;
14909
15128
  "richtext" === graphic.type && (matrix = context.currentMatrix.clone(), context.restore(), context.save(), context.setTransformForCurrent());
14910
- const shouldReCalBounds = isObject$7(background) && background.background,
15129
+ const backgroundConfig = isObject$7(background) && background.background ? background : null,
14911
15130
  onlyTranslate = graphic.transMatrix.onlyTranslate();
14912
- if (shouldReCalBounds) {
15131
+ if (backgroundConfig) {
14913
15132
  const _b = graphic.AABBBounds,
14914
- x = (null !== (_a = background.x) && void 0 !== _a ? _a : _b.x1) + (null !== (_c = background.dx) && void 0 !== _c ? _c : 0),
14915
- y = (null !== (_d = background.y) && void 0 !== _d ? _d : _b.y1) + (null !== (_e = background.dy) && void 0 !== _e ? _e : 0),
14916
- w = null !== (_f = background.width) && void 0 !== _f ? _f : _b.width(),
14917
- h = null !== (_g = background.height) && void 0 !== _g ? _g : _b.height();
14918
- if (b = boundsAllocate.allocate(x, y, x + w, y + h), background = background.background, !onlyTranslate) {
15133
+ x = (null !== (_a = backgroundConfig.x) && void 0 !== _a ? _a : _b.x1) + (null !== (_c = backgroundConfig.dx) && void 0 !== _c ? _c : 0),
15134
+ y = (null !== (_d = backgroundConfig.y) && void 0 !== _d ? _d : _b.y1) + (null !== (_e = backgroundConfig.dy) && void 0 !== _e ? _e : 0),
15135
+ w = null !== (_f = backgroundConfig.width) && void 0 !== _f ? _f : _b.width(),
15136
+ h = null !== (_g = backgroundConfig.height) && void 0 !== _g ? _g : _b.height();
15137
+ if (b = boundsAllocate.allocate(x, y, x + w, y + h), background = backgroundConfig.background, !onlyTranslate) {
14919
15138
  const w = b.width(),
14920
15139
  h = b.height();
14921
- 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);
15140
+ 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);
14922
15141
  }
14923
15142
  } else b = graphic.AABBBounds, onlyTranslate || (b = getTextBounds(Object.assign(Object.assign({}, graphic.attribute), {
14924
15143
  angle: 0,
@@ -14931,19 +15150,18 @@
14931
15150
  })).clone());
14932
15151
  if (graphic.backgroundImg && graphic.resources) {
14933
15152
  const res = graphic.resources.get(background);
14934
- if ("success" !== res.state || !res.data) return void restore();
14935
- context.highPerformanceSave(), onlyTranslate && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), this.doDrawImage(context, res.data, b, {
15153
+ if (!res || "success" !== res.state || !res.data) return void restore();
15154
+ 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, {
14936
15155
  backgroundMode: backgroundMode,
14937
15156
  backgroundFit: backgroundFit,
14938
- backgroundKeepAspectRatio: backgroundKeepAspectRatio
15157
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio,
15158
+ backgroundScale: backgroundScale,
15159
+ backgroundOffsetX: backgroundOffsetX,
15160
+ backgroundOffsetY: backgroundOffsetY,
15161
+ backgroundPosition: backgroundPosition
14939
15162
  }), context.highPerformanceRestore(), context.setTransformForCurrent();
14940
- } else {
14941
- const {
14942
- backgroundCornerRadius: backgroundCornerRadius
14943
- } = graphic.attribute;
14944
- 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();
14945
- }
14946
- shouldReCalBounds && boundsAllocate.free(b), restore();
15163
+ } 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();
15164
+ backgroundConfig && boundsAllocate.free(b), restore();
14947
15165
  }
14948
15166
  }
14949
15167
  const defaultTextBackgroundRenderContribution = new DefaultTextBackgroundRenderContribution();
@@ -15370,6 +15588,92 @@
15370
15588
  };
15371
15589
  };
15372
15590
  const repeatStr = ["", "repeat-x", "repeat-y", "repeat"];
15591
+ function resolveImageMode({
15592
+ repeatX = "no-repeat",
15593
+ repeatY = "no-repeat",
15594
+ imageMode: imageMode
15595
+ }) {
15596
+ const repeatMode = resolveImageRepeatMode(repeatX, repeatY);
15597
+ return {
15598
+ repeatMode: repeatMode,
15599
+ sizingMode: "no-repeat" === repeatMode && null != imageMode ? imageMode : "fill"
15600
+ };
15601
+ }
15602
+ const IMAGE_MODE_TO_BACKGROUND_MODE = {
15603
+ cover: "no-repeat-cover",
15604
+ contain: "no-repeat-contain",
15605
+ fill: "no-repeat-fill",
15606
+ auto: "no-repeat-auto"
15607
+ };
15608
+ function resolveBackgroundParamsByImageSizing(sizingMode) {
15609
+ return {
15610
+ backgroundMode: IMAGE_MODE_TO_BACKGROUND_MODE[sizingMode],
15611
+ backgroundFit: !1,
15612
+ backgroundKeepAspectRatio: !1
15613
+ };
15614
+ }
15615
+ function resolveImageRepeatMode(repeatX, repeatY) {
15616
+ let repeat = 0;
15617
+ return "repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat ? repeatStr[repeat] : "no-repeat";
15618
+ }
15619
+ function shouldClipImageByLayout({
15620
+ repeatX = "no-repeat",
15621
+ repeatY = "no-repeat",
15622
+ imageMode: imageMode,
15623
+ imageScale = 1,
15624
+ imageOffsetX = 0,
15625
+ imageOffsetY = 0,
15626
+ imagePosition = "top-left"
15627
+ }) {
15628
+ const {
15629
+ repeatMode: repeatMode,
15630
+ sizingMode: sizingMode
15631
+ } = resolveImageMode({
15632
+ repeatX: repeatX,
15633
+ repeatY: repeatY,
15634
+ imageMode: imageMode
15635
+ });
15636
+ return "no-repeat" === repeatMode && ("cover" === sizingMode || "auto" === sizingMode || 1 !== imageScale || 0 !== imageOffsetX || 0 !== imageOffsetY);
15637
+ }
15638
+ function drawImageWithLayout(context, data, x, y, width, height, {
15639
+ repeatX = "no-repeat",
15640
+ repeatY = "no-repeat",
15641
+ imageMode: imageMode,
15642
+ imageScale = 1,
15643
+ imageOffsetX = 0,
15644
+ imageOffsetY = 0,
15645
+ imagePosition = "top-left"
15646
+ }) {
15647
+ const {
15648
+ repeatMode: repeatMode,
15649
+ sizingMode: sizingMode
15650
+ } = resolveImageMode({
15651
+ repeatX: repeatX,
15652
+ repeatY: repeatY,
15653
+ imageMode: imageMode
15654
+ }),
15655
+ imageBackgroundParams = "no-repeat" === repeatMode ? resolveBackgroundParamsByImageSizing(sizingMode) : {
15656
+ backgroundMode: repeatMode,
15657
+ backgroundFit: !1,
15658
+ backgroundKeepAspectRatio: !1
15659
+ };
15660
+ drawBackgroundImage(context, data, {
15661
+ x1: x,
15662
+ y1: y,
15663
+ x2: x + width,
15664
+ y2: y + height,
15665
+ width: () => width,
15666
+ height: () => height
15667
+ }, {
15668
+ backgroundMode: imageBackgroundParams.backgroundMode,
15669
+ backgroundFit: imageBackgroundParams.backgroundFit,
15670
+ backgroundKeepAspectRatio: imageBackgroundParams.backgroundKeepAspectRatio,
15671
+ backgroundScale: imageScale,
15672
+ backgroundOffsetX: imageOffsetX,
15673
+ backgroundOffsetY: imageOffsetY,
15674
+ backgroundPosition: imagePosition
15675
+ });
15676
+ }
15373
15677
  let DefaultCanvasImageRender = class extends BaseRender {
15374
15678
  constructor(graphicRenderContributions) {
15375
15679
  super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = IMAGE_NUMBER_TYPE, this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution], this.init(graphicRenderContributions);
@@ -15384,6 +15688,11 @@
15384
15688
  cornerRadius = imageAttribute.cornerRadius,
15385
15689
  fillStrokeOrder = imageAttribute.fillStrokeOrder,
15386
15690
  cornerType = imageAttribute.cornerType,
15691
+ imageMode = imageAttribute.imageMode,
15692
+ imageScale = imageAttribute.imageScale,
15693
+ imageOffsetX = imageAttribute.imageOffsetX,
15694
+ imageOffsetY = imageAttribute.imageOffsetY,
15695
+ imagePosition = imageAttribute.imagePosition,
15387
15696
  image: url
15388
15697
  } = image.attribute,
15389
15698
  data = this.valid(image, imageAttribute, fillCb);
@@ -15400,22 +15709,33 @@
15400
15709
  const width = image.width,
15401
15710
  height = image.height;
15402
15711
  context.beginPath();
15403
- let needRestore = !1;
15404
- 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);
15712
+ let needCornerClip = !1;
15713
+ 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);
15405
15714
  const _runFill = () => {
15406
- if (doFill) if (fillCb) fillCb(context, image.attribute, imageAttribute);else if (fVisible) {
15407
- context.setCommonStyle(image, image.attribute, x, y, imageAttribute);
15408
- let repeat = 0;
15409
- if ("repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat) {
15410
- const pattern = context.createPattern(res.data, repeatStr[repeat]);
15411
- context.fillStyle = pattern, context.translate(x, y, !0), context.fillRect(0, 0, width, height), context.translate(-x, -y, !0);
15412
- } else context.drawImage(res.data, x, y, width, height);
15413
- }
15715
+ doFill && (fillCb ? fillCb(context, image.attribute, imageAttribute) : fVisible && (context.setCommonStyle(image, image.attribute, x, y, imageAttribute), drawImageWithLayout(context, res.data, x, y, width, height, {
15716
+ repeatX: repeatX,
15717
+ repeatY: repeatY,
15718
+ imageMode: imageMode,
15719
+ imageScale: imageScale,
15720
+ imageOffsetX: imageOffsetX,
15721
+ imageOffsetY: imageOffsetY,
15722
+ imagePosition: imagePosition
15723
+ })));
15414
15724
  },
15415
15725
  _runStroke = () => {
15416
15726
  doStroke && (strokeCb ? strokeCb(context, image.attribute, imageAttribute) : sVisible && (context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute), context.stroke()));
15417
- };
15418
- 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);
15727
+ },
15728
+ needLayoutClip = shouldClipImageByLayout({
15729
+ repeatX: repeatX,
15730
+ repeatY: repeatY,
15731
+ imageMode: imageMode,
15732
+ imageScale: imageScale,
15733
+ imageOffsetX: imageOffsetX,
15734
+ imageOffsetY: imageOffsetY,
15735
+ imagePosition: imagePosition
15736
+ }),
15737
+ needClip = needCornerClip || needLayoutClip;
15738
+ 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);
15419
15739
  }
15420
15740
  draw(image, renderService, drawContext) {
15421
15741
  const {
@@ -16269,7 +16589,7 @@
16269
16589
  return data || this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);
16270
16590
  }
16271
16591
  clearScreen(renderService, context, drawContext) {
16272
- var _a, _b, _c;
16592
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
16273
16593
  const {
16274
16594
  clear: clear,
16275
16595
  viewBox: viewBox
@@ -16279,9 +16599,20 @@
16279
16599
  if (clear) {
16280
16600
  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);
16281
16601
  const stage = null === (_b = renderService.drawParams) || void 0 === _b ? void 0 : _b.stage;
16282
- if (stage && (context.globalAlpha = null !== (_c = stage.attribute.opacity) && void 0 !== _c ? _c : 1), stage && stage.backgroundImg && stage.resources) {
16283
- const res = stage.resources.get(clear);
16284
- res && "success" === res.state && res.data && context.drawImage(res.data, 0, 0, width, height);
16602
+ 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) {
16603
+ const res = stage.resources.get(getBackgroundImage(clear));
16604
+ if (res && "success" === res.state && res.data) {
16605
+ const backgroundBounds = boundsAllocate.allocate(0, 0, 0 + width, 0 + height);
16606
+ drawBackgroundImage(context, res.data, backgroundBounds, {
16607
+ backgroundMode: null !== (_e = stage.attribute.backgroundMode) && void 0 !== _e ? _e : DefaultAttribute.backgroundMode,
16608
+ backgroundFit: null !== (_f = stage.attribute.backgroundFit) && void 0 !== _f ? _f : DefaultAttribute.backgroundFit,
16609
+ backgroundKeepAspectRatio: null !== (_g = stage.attribute.backgroundKeepAspectRatio) && void 0 !== _g ? _g : DefaultAttribute.backgroundKeepAspectRatio,
16610
+ backgroundScale: null !== (_h = stage.attribute.backgroundScale) && void 0 !== _h ? _h : DefaultAttribute.backgroundScale,
16611
+ backgroundOffsetX: null !== (_j = stage.attribute.backgroundOffsetX) && void 0 !== _j ? _j : DefaultAttribute.backgroundOffsetX,
16612
+ backgroundOffsetY: null !== (_k = stage.attribute.backgroundOffsetY) && void 0 !== _k ? _k : DefaultAttribute.backgroundOffsetY,
16613
+ backgroundPosition: null !== (_l = stage.attribute.backgroundPosition) && void 0 !== _l ? _l : DefaultAttribute.backgroundPosition
16614
+ }), boundsAllocate.free(backgroundBounds);
16615
+ }
16285
16616
  } else context.fillStyle = createColor(context, clear, {
16286
16617
  AABBBounds: {
16287
16618
  x1: 0,
@@ -16784,7 +17115,7 @@
16784
17115
  return null !== (_a = this._background) && void 0 !== _a ? _a : DefaultConfig.BACKGROUND;
16785
17116
  }
16786
17117
  set background(b) {
16787
- this._background = b;
17118
+ this._background = b, this.syncBackgroundImage(b);
16788
17119
  }
16789
17120
  get defaultLayer() {
16790
17121
  return this.at(0);
@@ -16798,6 +17129,18 @@
16798
17129
  set ticker(ticker) {
16799
17130
  ticker.bindStage(this), this._ticker && this._ticker.removeListener("tick", this.afterTickCb), ticker.addTimeline(this.timeline), this._ticker = ticker, this._ticker.on("tick", this.afterTickCb);
16800
17131
  }
17132
+ syncBackgroundImage(background) {
17133
+ var _a;
17134
+ const source = null !== (_a = null == background ? void 0 : background.background) && void 0 !== _a ? _a : background;
17135
+ this.backgroundImg = !1, this.isImageBackgroundSource(source) && this.loadImage(source, !0);
17136
+ }
17137
+ isImageBackgroundSource(source) {
17138
+ if (!source) return !1;
17139
+ if ("string" == typeof source) return source.startsWith("<svg") || isValidUrl$1(source) || source.includes("/") || isBase64$1(source);
17140
+ if (!isObject$7(source)) return !1;
17141
+ const gradientSource = source;
17142
+ return "string" != typeof gradientSource.gradient || !Array.isArray(gradientSource.stops);
17143
+ }
16801
17144
  constructor(params = {}) {
16802
17145
  var _a, _b;
16803
17146
  super({}), this.tickedBeforeRender = !0, this._onVisibleChange = visible => {
@@ -16836,9 +17179,7 @@
16836
17179
  main: !0
16837
17180
  })), 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 = {
16838
17181
  tickRenderMode: "effect"
16839
- }), this.optmize(params.optimize), params.background && isString$2(this._background) && this._background.includes("/") && this.setAttributes({
16840
- background: this._background
16841
- }), this.initAnimate(params), this.rafId = null !== (_b = params.rafId) && void 0 !== _b ? _b : Math.floor(6 * Math.random());
17182
+ }), 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());
16842
17183
  }
16843
17184
  initAnimate(params) {
16844
17185
  var _a;
@@ -17173,12 +17514,12 @@
17173
17514
  throw new Error("暂不支持");
17174
17515
  }
17175
17516
  release() {
17176
- var _a, _b;
17517
+ var _a, _b, _d;
17177
17518
  super.release(), this.hooks.beforeRender.unTap("constructor", this.beforeRender), this.hooks.afterRender.unTap("constructor", this.afterRender), this.eventSystem && this.eventSystem.release(), this.layerService.releaseStage(this), this.pluginService.release(), this.forEach(layer => {
17178
17519
  layer.release();
17179
17520
  }), this.interactiveLayer && (this.interactiveLayer.forEachChildren(item => {
17180
17521
  item.setStage && item.setStage(null, null), this.interactiveLayer.removeChild(item);
17181
- }), this.interactiveLayer.release()), this.window.release(), null === (_a = this._ticker) || void 0 === _a || _a.remTimeline(null == this ? void 0 : this.timeline), null === (_b = this._ticker) || void 0 === _b || _b.removeListener("tick", this.afterTickCb), this.renderService.renderTreeRoots = [];
17522
+ }), this.interactiveLayer.release()), this.window.release(), null === (_a = this._ticker) || void 0 === _a || _a.remTimeline(null == this ? void 0 : this.timeline), null === (_b = this._ticker) || void 0 === _b || _b.removeListener("tick", this.afterTickCb), this.params.ticker || null === (_d = this._ticker) || void 0 === _d || _d.release(), this.renderService.renderTreeRoots = [];
17182
17523
  }
17183
17524
  setStage(stage) {}
17184
17525
  dirty(b, matrix) {
@@ -21499,7 +21840,7 @@
21499
21840
  this._sliderRenderBounds = null, this._sliderLimitRange = null;
21500
21841
  }
21501
21842
  release(all) {
21502
- super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
21843
+ super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).removeEventListener("touchmove", this._handleTouchMove, {
21503
21844
  passive: !1
21504
21845
  }), this._clearDragEvents();
21505
21846
  }
@@ -23082,17 +23423,21 @@
23082
23423
  } = this.attribute.label;
23083
23424
  textStyle = isFunction$3(textStyle) ? merge({}, DEFAULT_AXIS_THEME.label.style, textStyle(tickDatum, index, tickData, layer)) : textStyle;
23084
23425
  const labelAlign = this.getLabelAlign(vector, inside, textStyle.angle);
23085
- return textStyle = merge(labelAlign, textStyle), isFunction$3(textStyle.text) && (textStyle.text = textStyle.text({
23426
+ textStyle = merge(labelAlign, textStyle), isFunction$3(textStyle.text) && (textStyle.text = textStyle.text({
23086
23427
  label: tickDatum.label,
23087
23428
  value: tickDatum.rawValue,
23088
23429
  index: tickDatum.index,
23089
23430
  layer: layer
23090
- })), Object.assign(Object.assign(Object.assign({}, this.getLabelPosition(point, vector, textContent, textStyle)), {
23431
+ }));
23432
+ let reactStyle = textStyle.react;
23433
+ return isFunction$3(reactStyle) && (reactStyle = reactStyle(tickDatum, index, tickData, layer)), Object.assign(Object.assign(Object.assign(Object.assign({}, this.getLabelPosition(point, vector, textContent, textStyle)), {
23091
23434
  text: null != text ? text : textContent,
23092
23435
  _originText: tickDatum.label,
23093
23436
  lineHeight: null == textStyle ? void 0 : textStyle.fontSize,
23094
23437
  type: type
23095
- }), textStyle);
23438
+ }), textStyle), {
23439
+ react: reactStyle
23440
+ });
23096
23441
  }
23097
23442
  getLabelPosition(point, vector, text, style) {
23098
23443
  return point;
@@ -24121,6 +24466,8 @@
24121
24466
  this.status === STATUS$1.RUNNING && (this.tickCounts++, this.timelines.forEach(timeline => {
24122
24467
  timeline.tick(delta);
24123
24468
  }), this.emit("tick", delta));
24469
+ }, this._handleGraphTick = () => {
24470
+ this.initHandler(!1);
24124
24471
  }, this.init(), this.lastFrameTime = -1, this.tickCounts = 0, this.stage = stage, this.autoStop = !0, this.interval = 16, this.computeTimeOffsetAndJitter();
24125
24472
  }
24126
24473
  bindStage(stage) {
@@ -24130,9 +24477,7 @@
24130
24477
  this.timeOffset = Math.floor(Math.random() * this.interval), this._jitter = Math.min(Math.max(.2 * this.interval, 6), .7 * this.interval);
24131
24478
  }
24132
24479
  init() {
24133
- this.interval = 16, this.status = STATUS$1.INITIAL, application.global.hooks.onSetEnv.tap("graph-ticker", () => {
24134
- this.initHandler(!1);
24135
- }), application.global.env && this.initHandler(!1);
24480
+ this.interval = 16, this.status = STATUS$1.INITIAL, application.global.hooks.onSetEnv.tap("graph-ticker", this._handleGraphTick), application.global.env && this.initHandler(!1);
24136
24481
  }
24137
24482
  addTimeline(timeline) {
24138
24483
  this.timelines.push(timeline);
@@ -24205,7 +24550,7 @@
24205
24550
  }
24206
24551
  release() {
24207
24552
  var _a;
24208
- this.stop(), this.timelines = [], null === (_a = this.tickerHandler) || void 0 === _a || _a.release(), this.tickerHandler = null, this.lastFrameTime = -1;
24553
+ this.stop(), this.timelines = [], null === (_a = this.tickerHandler) || void 0 === _a || _a.release(), this.tickerHandler = null, this.lastFrameTime = -1, application.global.hooks.onSetEnv.unTap("graph-ticker", this._handleGraphTick);
24209
24554
  }
24210
24555
  checkSkip(delta) {
24211
24556
  var _a, _b, _c;
@@ -24319,6 +24664,7 @@
24319
24664
  if (custom.prototype.constructor === custom) {
24320
24665
  const descriptor = Object.getOwnPropertyDescriptor(custom, "prototype");
24321
24666
  if (descriptor && !descriptor.writable) return 1;
24667
+ if (Object.getOwnPropertyNames(custom.prototype).length > 1) return 1;
24322
24668
  }
24323
24669
  return 2;
24324
24670
  }
@@ -24465,7 +24811,7 @@
24465
24811
  let parsedFromProps = null,
24466
24812
  props = params.to,
24467
24813
  from = params.from;
24468
- props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from), this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
24814
+ props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from), parsedFromProps.attrOutChannel && graphic.setAttributes(parsedFromProps.attrOutChannel), this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
24469
24815
  let totalDelay = 0;
24470
24816
  oneByOneDelay && (totalDelay = oneByOneDelay * (count - index - 1));
24471
24817
  const delayAfterValue = isFunction$3(delayAfter) ? delayAfter(null === (_h = null === (_g = graphic.context) || void 0 === _g ? void 0 : _g.data) || void 0 === _h ? void 0 : _h[0], graphic, {}) : delayAfter;
@@ -24528,7 +24874,7 @@
24528
24874
  let parsedFromProps = null,
24529
24875
  props = effect.to,
24530
24876
  from = effect.from;
24531
- props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from);
24877
+ props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from), parsedFromProps.attrOutChannel && graphic.setAttributes(parsedFromProps.attrOutChannel);
24532
24878
  const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[type],
24533
24879
  customType = effect.custom ? effect.customType : getCustomType(custom);
24534
24880
  this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
@@ -24547,22 +24893,31 @@
24547
24893
  animate.play(customAnimate);
24548
24894
  }
24549
24895
  createPropsFromChannel(channel, graphic) {
24896
+ var _a;
24550
24897
  const props = {};
24551
24898
  let from = null;
24552
- return channel ? (Array.isArray(channel) ? channel.forEach(key => {
24553
- var _a, _b;
24554
- const value = null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.diffAttrs) || void 0 === _b ? void 0 : _b[key];
24555
- void 0 !== value && (props[key] = value);
24556
- }) : Object.keys(channel).forEach(key => {
24899
+ if (!channel) return {
24900
+ from: from,
24901
+ props: props,
24902
+ attrOutChannel: null
24903
+ };
24904
+ const attrOutChannel = {};
24905
+ let hasAttrs = !1;
24906
+ const diffAttrs = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.diffAttrs;
24907
+ if (Array.isArray(channel) && (channel = channel.reduce((res, key) => (void 0 === diffAttrs[key] || (res[key] = {
24908
+ to: diffAttrs[key]
24909
+ }), res), {})), Object.keys(channel).forEach(key => {
24557
24910
  var _a, _b, _c, _d;
24558
24911
  const config = channel[key];
24559
24912
  void 0 !== config.to && ("function" == typeof config.to ? props[key] = config.to(null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], graphic, {}) : props[key] = config.to), void 0 !== config.from && (from || (from = {}), "function" == typeof config.from ? from[key] = config.from(null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, {}) : from[key] = config.from);
24560
- }), {
24561
- from: from,
24562
- props: props
24563
- }) : {
24913
+ }), diffAttrs) for (const key in diffAttrs) {
24914
+ const value = diffAttrs[key];
24915
+ void 0 !== value && (props.hasOwnProperty(key) || (attrOutChannel[key] = value, hasAttrs = !0));
24916
+ }
24917
+ return {
24564
24918
  from: from,
24565
- props: props
24919
+ props: props,
24920
+ attrOutChannel: hasAttrs ? attrOutChannel : null
24566
24921
  };
24567
24922
  }
24568
24923
  resolveValue(value, graphic, defaultValue) {
@@ -32469,7 +32824,31 @@
32469
32824
  return graphicCreator.symbol(style);
32470
32825
  }
32471
32826
  _renderHandlerText(value, position) {
32472
- var _a, _b, _c;
32827
+ return graphicCreator.text(this._getHandlerTextAttributes(value, position));
32828
+ }
32829
+ _getHandlerPosition(isStart) {
32830
+ return this.attribute.range && isStart ? "start" : "end";
32831
+ }
32832
+ _getHandlerTextStyle(value, position) {
32833
+ const {
32834
+ align: align,
32835
+ handlerSize = 14,
32836
+ handlerText = {},
32837
+ railHeight: railHeight,
32838
+ railWidth: railWidth,
32839
+ slidable: slidable
32840
+ } = this.attribute;
32841
+ return isFunction$3(handlerText.style) ? handlerText.style(value, position, {
32842
+ layout: this.attribute.layout,
32843
+ align: align,
32844
+ railWidth: railWidth,
32845
+ railHeight: railHeight,
32846
+ handlerSize: handlerSize,
32847
+ slidable: slidable
32848
+ }) : handlerText.style;
32849
+ }
32850
+ _getHandlerTextAttributes(value, position) {
32851
+ var _a, _b;
32473
32852
  const {
32474
32853
  align: align,
32475
32854
  handlerSize = 14,
@@ -32481,13 +32860,13 @@
32481
32860
  isHorizontal = this._isHorizontal,
32482
32861
  pos = this.calculatePosByValue(value, position),
32483
32862
  textSpace = null !== (_a = handlerText.space) && void 0 !== _a ? _a : 4,
32863
+ handlerTextStyle = this._getHandlerTextStyle(value, position),
32484
32864
  textStyle = {
32485
32865
  text: handlerText.formatter ? handlerText.formatter(value) : value.toFixed(null !== (_b = handlerText.precision) && void 0 !== _b ? _b : 0),
32486
- lineHeight: null === (_c = handlerText.style) || void 0 === _c ? void 0 : _c.lineHeight,
32866
+ lineHeight: null == handlerTextStyle ? void 0 : handlerTextStyle.lineHeight,
32487
32867
  cursor: !1 === slidable ? "default" : getDefaultCursor(isHorizontal)
32488
32868
  };
32489
- 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);
32490
- return graphicCreator.text(Object.assign(Object.assign({}, textStyle), handlerText.style));
32869
+ 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);
32491
32870
  }
32492
32871
  _renderTooltip() {
32493
32872
  var _a;
@@ -32615,31 +32994,19 @@
32615
32994
  }
32616
32995
  }
32617
32996
  _updateHandler(handler, position, value) {
32618
- var _a;
32619
32997
  const isHorizontal = this._isHorizontal;
32620
32998
  handler.setAttribute(isHorizontal ? "x" : "y", position);
32621
32999
  const updateHandlerText = handler.name === SLIDER_ELEMENT_NAME.startHandler ? this._startHandlerText : this._endHandlerText;
32622
33000
  if (updateHandlerText) {
32623
- const {
32624
- handlerText = {}
32625
- } = this.attribute;
32626
- updateHandlerText.setAttributes({
32627
- text: handlerText.formatter ? handlerText.formatter(value) : value.toFixed(null !== (_a = handlerText.precision) && void 0 !== _a ? _a : 0),
32628
- [isHorizontal ? "x" : "y"]: position
32629
- });
33001
+ const handlerPosition = this._getHandlerPosition(handler.name === SLIDER_ELEMENT_NAME.startHandler);
33002
+ updateHandlerText.setAttributes(this._getHandlerTextAttributes(value, handlerPosition));
32630
33003
  }
32631
33004
  handler.name === SLIDER_ELEMENT_NAME.startHandler ? (this._currentValue.startValue = value, this._currentValue.startPos = position) : (this._currentValue.endValue = value, this._currentValue.endPos = position);
32632
33005
  }
32633
33006
  _updateHandlerText(handlerText, position, value) {
32634
- var _a;
32635
33007
  const isHorizontal = this._isHorizontal,
32636
- {
32637
- handlerText: handlerTextAttr = {}
32638
- } = this.attribute;
32639
- handlerText.setAttributes({
32640
- [isHorizontal ? "x" : "y"]: position,
32641
- text: handlerTextAttr.formatter ? handlerTextAttr.formatter(value) : value.toFixed(null !== (_a = handlerTextAttr.precision) && void 0 !== _a ? _a : 0)
32642
- });
33008
+ handlerPosition = this._getHandlerPosition(handlerText.name === SLIDER_ELEMENT_NAME.startHandlerText);
33009
+ handlerText.setAttributes(this._getHandlerTextAttributes(value, handlerPosition));
32643
33010
  const updateHandler = handlerText.name === SLIDER_ELEMENT_NAME.startHandlerText ? this._startHandler : this._endHandler;
32644
33011
  updateHandler && updateHandler.setAttributes({
32645
33012
  [isHorizontal ? "x" : "y"]: position
@@ -32675,7 +33042,7 @@
32675
33042
  };
32676
33043
  }
32677
33044
  release(all) {
32678
- super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
33045
+ super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).removeEventListener("touchmove", this._handleTouchMove, {
32679
33046
  passive: !1
32680
33047
  }), this._clearAllDragEvents();
32681
33048
  }
@@ -70540,10 +70907,16 @@
70540
70907
  if (this.from.x !== this.to.x) {
70541
70908
  const x = end ? this.to.x : this.from.x + Math.floor((this.to.x - this.from.x) * ratio);
70542
70909
  this.params.table.scrollLeft = x;
70910
+ if (ratio === 1 && this.to.targetCol !== -1) {
70911
+ this.params.table.scrollToCol(this.to.targetCol, false);
70912
+ }
70543
70913
  }
70544
70914
  if (this.from.y !== this.to.y) {
70545
70915
  const y = end ? this.to.y : this.from.y + Math.floor((this.to.y - this.from.y) * ratio);
70546
70916
  this.params.table.scrollTop = y;
70917
+ if (ratio === 1 && this.to.targetRow !== -1) {
70918
+ this.params.table.scrollToRow(this.to.targetRow, false);
70919
+ }
70547
70920
  }
70548
70921
  }
70549
70922
  }
@@ -70590,7 +70963,9 @@
70590
70963
  }
70591
70964
  const to = {
70592
70965
  x: isNumber$2(col) ? left - this.table.getFrozenColsWidth() : this.table.scrollLeft,
70593
- y: isNumber$2(row) ? top - this.table.getFrozenRowsHeight() : this.table.scrollTop
70966
+ y: isNumber$2(row) ? top - this.table.getFrozenRowsHeight() : this.table.scrollTop,
70967
+ targetCol: col ?? -1,
70968
+ targetRow: row ?? -1
70594
70969
  };
70595
70970
  const duration = !isBoolean$2(animationOption) ? animationOption?.duration ?? 3000 : animationOption ? 3000 : 0;
70596
70971
  const easing = !isBoolean$2(animationOption) ? animationOption?.easing ?? 'linear' : animationOption ? 'linear' : '';
@@ -70720,7 +71095,7 @@
70720
71095
  return TABLE_EVENT_TYPE;
70721
71096
  }
70722
71097
  options;
70723
- version = "1.22.13-alpha.1";
71098
+ version = "1.22.13-alpha.11";
70724
71099
  pagination;
70725
71100
  id = `VTable${Date.now()}`;
70726
71101
  headerStyleCache;
@@ -72283,6 +72658,11 @@
72283
72658
  this.release();
72284
72659
  }
72285
72660
  release() {
72661
+ this.scenegraph?.component?.vScrollBar?.release();
72662
+ this.scenegraph?.component?.hScrollBar?.release();
72663
+ this.animationManager.clear();
72664
+ this.animationManager.ticker.release();
72665
+ this.scenegraph?.stage?.ticker?.release();
72286
72666
  const internalProps = this.internalProps;
72287
72667
  if (this.isReleased) {
72288
72668
  return;
@@ -73911,7 +74291,12 @@
73911
74291
  }
73912
74292
  if (isValid$1(cellAddr.row) && cellAddr.row >= this.frozenRowCount) {
73913
74293
  const frozenHeight = this.getFrozenRowsHeight();
73914
- const top = this.getRowsHeight(0, cellAddr.row - 1);
74294
+ const rowInt = Math.floor(cellAddr.row);
74295
+ const rowFloat = cellAddr.row - rowInt;
74296
+ let top = this.internalProps._rowHeightsMap.getSumInRange(0, rowInt - 1);
74297
+ if (rowFloat > 0) {
74298
+ top += (this.internalProps._rowHeightsMap.get(rowInt) ?? this.getRowHeight(rowInt)) * rowFloat;
74299
+ }
73915
74300
  this.scrollTop = Math.min(top - frozenHeight, this.getAllRowsHeight() - drawRange.height);
73916
74301
  }
73917
74302
  this.render();
@@ -93979,7 +94364,7 @@
93979
94364
  }
93980
94365
 
93981
94366
  registerForVrender();
93982
- const version = "1.22.13-alpha.1";
94367
+ const version = "1.22.13-alpha.11";
93983
94368
  function getIcons() {
93984
94369
  return get$2();
93985
94370
  }