@visactor/react-vchart 2.0.23-alpha.3 → 2.0.23-alpha.5

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.js CHANGED
@@ -51954,8 +51954,7 @@
51954
51954
  this._option.layout = layout, null === (_a = this._chart) || void 0 === _a || _a.setLayout(layout);
51955
51955
  }
51956
51956
  reLayout() {
51957
- var _a, _b, _c;
51958
- null === (_a = this._chart) || void 0 === _a || _a.resetLayoutItemTag(), null === (_b = this._chart) || void 0 === _b || _b.setLayoutTag(!0, null, !1), null === (_c = this._compiler) || void 0 === _c || _c.render();
51957
+ this._chart && this._compiler && !this._isReleased && (this._chart.resetLayoutItemTag(), this._chart.setLayoutTag(!0, null, !1), this._compiler.render(), this._chart.onEvaluateEnd());
51959
51958
  }
51960
51959
  getCompiler() {
51961
51960
  return this._compiler;
@@ -60568,7 +60567,7 @@
60568
60567
  visible: !0
60569
60568
  }, "normal", AttributeLevel.Series) : this.setMarkStyle(this._symbolMark, {
60570
60569
  visible: this._getInvalidDefined.bind(this)
60571
- }, "normal", AttributeLevel.Series), this._symbolMark.getProduct() && this._symbolMark.compileEncode();
60570
+ }, "normal", AttributeLevel.Series), this._symbolMark.getProduct() && this._symbolMark.compileEncode(), this._isGeoCoordinateSeries() && (this._updateSymbolGraphicPosition(), this._refreshLabelComponent(!0, !0));
60572
60571
  }
60573
60572
  initLabelMarkStyle(labelMark) {
60574
60573
  labelMark && (this._labelMark = labelMark, this.setMarkStyle(labelMark, {
@@ -60579,29 +60578,68 @@
60579
60578
  visible: this._getInvalidDefined.bind(this)
60580
60579
  }, STATE_VALUE_ENUM.STATE_NORMAL, AttributeLevel.Series));
60581
60580
  }
60582
- handleZoom(e) {
60583
- var _a, _b, _c, _d;
60584
- this.getMarksWithoutRoot().forEach(mark => {
60585
- if (!mark) return;
60586
- const graphics = mark.getGraphics();
60587
- graphics && graphics.length && graphics.forEach((graphicItem, i) => {
60588
- var _a, _b;
60589
- const datum = null === (_b = null === (_a = null == graphicItem ? void 0 : graphicItem.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0],
60590
- newPosition = this.dataToPosition(datum);
60591
- newPosition && graphicItem && graphicItem.translateTo(newPosition.x, newPosition.y);
60581
+ _updateSymbolGraphicPosition() {
60582
+ var _a;
60583
+ const graphics = null === (_a = this._symbolMark) || void 0 === _a ? void 0 : _a.getGraphics();
60584
+ graphics && graphics.length && graphics.forEach(graphicItem => {
60585
+ var _a, _b;
60586
+ const datum = null === (_b = null === (_a = null == graphicItem ? void 0 : graphicItem.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0],
60587
+ newPosition = this.dataToPosition(datum);
60588
+ newPosition && graphicItem && graphicItem.setAttributes({
60589
+ x: newPosition.x,
60590
+ y: newPosition.y
60592
60591
  });
60593
60592
  });
60594
- const labelComponent = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent();
60595
- (null == labelComponent ? void 0 : labelComponent.renderInner) && labelComponent.renderInner();
60596
- const vgrammarLabel = null === (_b = null == labelComponent ? void 0 : labelComponent.getComponent) || void 0 === _b ? void 0 : _b.call(labelComponent);
60597
- (null == vgrammarLabel ? void 0 : vgrammarLabel.evaluate) && vgrammarLabel.evaluate(null, null);
60598
- const labelGroup = null === (_c = null == labelComponent ? void 0 : labelComponent.getProduct) || void 0 === _c ? void 0 : _c.call(labelComponent);
60599
- labelGroup && (null == e ? void 0 : e.scale) && (null == e ? void 0 : e.scaleCenter) && ((null === (_d = labelGroup.attribute) || void 0 === _d ? void 0 : _d.postMatrix) || labelGroup.setAttributes({
60593
+ }
60594
+ _ensureLabelGraphicPostMatrix() {
60595
+ var _a, _b;
60596
+ const labelGraphic = null === (_b = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent()) || void 0 === _b ? void 0 : _b.getComponent();
60597
+ return labelGraphic && !labelGraphic.attribute.postMatrix && labelGraphic.setAttributes({
60600
60598
  postMatrix: new Matrix()
60601
- }), labelGroup.scale(e.scale, e.scale, e.scaleCenter));
60599
+ }), labelGraphic;
60600
+ }
60601
+ _isGeoCoordinateSeries() {
60602
+ var _a, _b;
60603
+ return (null === (_b = null === (_a = this.getXAxisHelper()) || void 0 === _a ? void 0 : _a.getAxisType) || void 0 === _b ? void 0 : _b.call(_a)) === ComponentTypeEnum.geoCoordinate;
60604
+ }
60605
+ _refreshLabelComponent(resetPostMatrix = !1, disableAnimation = !1) {
60606
+ var _a, _b;
60607
+ const vgrammarLabel = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent(),
60608
+ labelGraphic = null === (_b = null == vgrammarLabel ? void 0 : vgrammarLabel.getComponent) || void 0 === _b ? void 0 : _b.call(vgrammarLabel);
60609
+ resetPostMatrix && (null == labelGraphic ? void 0 : labelGraphic.attribute.postMatrix) && labelGraphic.setAttributes({
60610
+ postMatrix: new Matrix()
60611
+ }), disableAnimation && (null == labelGraphic ? void 0 : labelGraphic.disableAnimation) && (labelGraphic.disableAnimation(), this._enableLabelAnimationHook || (this._enableLabelAnimationHook = () => {
60612
+ var _a, _b, _c, _d;
60613
+ const currentLabelGraphic = null === (_c = null === (_b = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent()) || void 0 === _b ? void 0 : _b.getComponent) || void 0 === _c ? void 0 : _c.call(_b);
60614
+ null === (_d = null == currentLabelGraphic ? void 0 : currentLabelGraphic.enableAnimation) || void 0 === _d || _d.call(currentLabelGraphic), this.event.off(HOOK_EVENT.AFTER_MARK_RENDER_END, this._enableLabelAnimationHook), this._enableLabelAnimationHook = void 0;
60615
+ }, this.event.on(HOOK_EVENT.AFTER_MARK_RENDER_END, this._enableLabelAnimationHook))), (null == vgrammarLabel ? void 0 : vgrammarLabel.getProduct()) && vgrammarLabel.renderInner();
60616
+ }
60617
+ handleZoom(e) {
60618
+ const {
60619
+ scale: scale,
60620
+ scaleCenter: scaleCenter
60621
+ } = e;
60622
+ if (1 === scale) return;
60623
+ this._updateSymbolGraphicPosition();
60624
+ const labelGraphic = this._ensureLabelGraphicPostMatrix();
60625
+ labelGraphic && labelGraphic.scale(scale, scale, scaleCenter);
60602
60626
  }
60603
60627
  handlePan(e) {
60604
- this.handleZoom(e);
60628
+ const {
60629
+ delta: delta
60630
+ } = e;
60631
+ if (0 === (null == delta ? void 0 : delta[0]) && 0 === (null == delta ? void 0 : delta[1])) return;
60632
+ this._updateSymbolGraphicPosition();
60633
+ const labelGraphic = this._ensureLabelGraphicPostMatrix();
60634
+ labelGraphic && labelGraphic.translate(delta[0], delta[1]);
60635
+ }
60636
+ onLayoutEnd() {
60637
+ var _a, _b;
60638
+ super.onLayoutEnd(), this._updateSymbolGraphicPosition();
60639
+ const labelGraphic = null === (_b = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent()) || void 0 === _b ? void 0 : _b.getComponent();
60640
+ (null == labelGraphic ? void 0 : labelGraphic.attribute.postMatrix) && labelGraphic.setAttributes({
60641
+ postMatrix: new Matrix()
60642
+ }), this._refreshLabelComponent();
60605
60643
  }
60606
60644
  getDefaultShapeType() {
60607
60645
  return "circle";
@@ -61625,7 +61663,7 @@
61625
61663
  super.release(), this._areaCache.clear(), this._nameMap = {}, this._mapViewData = null;
61626
61664
  }
61627
61665
  handleZoom(e) {
61628
- var _a, _b, _c, _d;
61666
+ var _a;
61629
61667
  const {
61630
61668
  scale: scale,
61631
61669
  scaleCenter: scaleCenter
@@ -61635,17 +61673,11 @@
61635
61673
  pathGroup && (pathGroup.attribute.postMatrix || pathGroup.setAttributes({
61636
61674
  postMatrix: new Matrix()
61637
61675
  }), pathGroup.scale(scale, scale, scaleCenter));
61638
- const labelComponent = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent();
61639
- (null == labelComponent ? void 0 : labelComponent.renderInner) && labelComponent.renderInner();
61640
- const vgrammarLabel = null === (_b = null == labelComponent ? void 0 : labelComponent.getComponent) || void 0 === _b ? void 0 : _b.call(labelComponent);
61641
- (null == vgrammarLabel ? void 0 : vgrammarLabel.evaluate) && vgrammarLabel.evaluate(null, null);
61642
- const labelGroup = null === (_c = null == labelComponent ? void 0 : labelComponent.getProduct) || void 0 === _c ? void 0 : _c.call(labelComponent);
61643
- labelGroup && scale && scaleCenter && ((null === (_d = labelGroup.attribute) || void 0 === _d ? void 0 : _d.postMatrix) || labelGroup.setAttributes({
61644
- postMatrix: new Matrix()
61645
- }), labelGroup.scale(scale, scale, scaleCenter));
61676
+ const vgrammarLabel = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent();
61677
+ vgrammarLabel && vgrammarLabel.renderInner();
61646
61678
  }
61647
61679
  handlePan(e) {
61648
- var _a, _b, _c, _d;
61680
+ var _a;
61649
61681
  const {
61650
61682
  delta: delta
61651
61683
  } = e;
@@ -61654,14 +61686,8 @@
61654
61686
  pathGroup && (pathGroup.attribute.postMatrix || pathGroup.setAttributes({
61655
61687
  postMatrix: new Matrix()
61656
61688
  }), pathGroup.translate(delta[0], delta[1]));
61657
- const labelComponent = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent();
61658
- (null == labelComponent ? void 0 : labelComponent.renderInner) && labelComponent.renderInner();
61659
- const vgrammarLabel = null === (_b = null == labelComponent ? void 0 : labelComponent.getComponent) || void 0 === _b ? void 0 : _b.call(labelComponent);
61660
- (null == vgrammarLabel ? void 0 : vgrammarLabel.evaluate) && vgrammarLabel.evaluate(null, null);
61661
- const labelGroup = null === (_c = null == labelComponent ? void 0 : labelComponent.getProduct) || void 0 === _c ? void 0 : _c.call(labelComponent);
61662
- labelGroup && delta && ((null === (_d = labelGroup.attribute) || void 0 === _d ? void 0 : _d.postMatrix) || labelGroup.setAttributes({
61663
- postMatrix: new Matrix()
61664
- }), labelGroup.translate(delta[0], delta[1]));
61689
+ const vgrammarLabel = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent();
61690
+ vgrammarLabel && vgrammarLabel.renderInner();
61665
61691
  }
61666
61692
  getDatumCenter(datum) {
61667
61693
  var _a, _b, _c, _d;
@@ -77157,7 +77183,7 @@
77157
77183
  return [this._legendComponent];
77158
77184
  }
77159
77185
  clear() {
77160
- super.clear(), this._legendComponent = null, this._cacheAttrs = null, this._preSelectedData = null;
77186
+ super.clear(), this._cacheAttrs = null, this._preSelectedData = null;
77161
77187
  }
77162
77188
  }
77163
77189
  BaseLegend.specKey = "legends";