@visactor/vchart 2.0.23-alpha.3 → 2.0.23-alpha.4

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
@@ -61784,10 +61784,13 @@ class VChart {
61784
61784
  (_a = this._chart) === null || _a === void 0 ? void 0 : _a.setLayout(layout);
61785
61785
  }
61786
61786
  reLayout() {
61787
- var _a, _b, _c;
61788
- (_a = this._chart) === null || _a === void 0 ? void 0 : _a.resetLayoutItemTag();
61789
- (_b = this._chart) === null || _b === void 0 ? void 0 : _b.setLayoutTag(true, null, false);
61790
- (_c = this._compiler) === null || _c === void 0 ? void 0 : _c.render();
61787
+ if (!this._chart || !this._compiler || this._isReleased) {
61788
+ return;
61789
+ }
61790
+ this._chart.resetLayoutItemTag();
61791
+ this._chart.setLayoutTag(true, null, false);
61792
+ this._compiler.render();
61793
+ this._chart.onEvaluateEnd();
61791
61794
  }
61792
61795
  getCompiler() {
61793
61796
  return this._compiler;
@@ -74023,45 +74026,70 @@ class ScatterSeries extends CartesianSeries {
74023
74026
  }, STATE_VALUE_ENUM.STATE_NORMAL, AttributeLevel.Series);
74024
74027
  }
74025
74028
  }
74026
- handleZoom(e) {
74027
- var _a, _b, _c, _d;
74028
- this.getMarksWithoutRoot().forEach(mark => {
74029
- if (!mark) {
74030
- return;
74031
- }
74032
- const graphics = mark.getGraphics();
74033
- if (!graphics || !graphics.length) {
74034
- return;
74029
+ _updateSymbolGraphicPosition() {
74030
+ var _a;
74031
+ const graphics = (_a = this._symbolMark) === null || _a === void 0 ? void 0 : _a.getGraphics();
74032
+ if (!graphics || !graphics.length) {
74033
+ return;
74034
+ }
74035
+ graphics.forEach((graphicItem) => {
74036
+ var _a, _b;
74037
+ const datum = (_b = (_a = graphicItem === null || graphicItem === void 0 ? void 0 : graphicItem.context) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[0];
74038
+ const newPosition = this.dataToPosition(datum);
74039
+ if (newPosition && graphicItem) {
74040
+ graphicItem.setAttributes({
74041
+ x: newPosition.x,
74042
+ y: newPosition.y
74043
+ });
74035
74044
  }
74036
- graphics.forEach((graphicItem, i) => {
74037
- var _a, _b;
74038
- const datum = (_b = (_a = graphicItem === null || graphicItem === void 0 ? void 0 : graphicItem.context) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[0];
74039
- const newPosition = this.dataToPosition(datum);
74040
- if (newPosition && graphicItem) {
74041
- graphicItem.translateTo(newPosition.x, newPosition.y);
74042
- }
74043
- });
74044
74045
  });
74045
- const labelComponent = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent();
74046
- if (labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.renderInner) {
74047
- labelComponent.renderInner();
74046
+ }
74047
+ _ensureLabelGraphicPostMatrix() {
74048
+ var _a, _b;
74049
+ const labelGraphic = (_b = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent()) === null || _b === void 0 ? void 0 : _b.getComponent();
74050
+ if (labelGraphic && !labelGraphic.attribute.postMatrix) {
74051
+ labelGraphic.setAttributes({
74052
+ postMatrix: new Matrix()
74053
+ });
74048
74054
  }
74049
- const vgrammarLabel = (_b = labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.getComponent) === null || _b === void 0 ? void 0 : _b.call(labelComponent);
74050
- if (vgrammarLabel === null || vgrammarLabel === void 0 ? void 0 : vgrammarLabel.evaluate) {
74051
- vgrammarLabel.evaluate(null, null);
74055
+ return labelGraphic;
74056
+ }
74057
+ handleZoom(e) {
74058
+ const { scale, scaleCenter } = e;
74059
+ if (scale === 1) {
74060
+ return;
74052
74061
  }
74053
- const labelGroup = (_c = labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.getProduct) === null || _c === void 0 ? void 0 : _c.call(labelComponent);
74054
- if (labelGroup && (e === null || e === void 0 ? void 0 : e.scale) && (e === null || e === void 0 ? void 0 : e.scaleCenter)) {
74055
- if (!((_d = labelGroup.attribute) === null || _d === void 0 ? void 0 : _d.postMatrix)) {
74056
- labelGroup.setAttributes({
74057
- postMatrix: new Matrix()
74058
- });
74059
- }
74060
- labelGroup.scale(e.scale, e.scale, e.scaleCenter);
74062
+ this._updateSymbolGraphicPosition();
74063
+ const labelGraphic = this._ensureLabelGraphicPostMatrix();
74064
+ if (labelGraphic) {
74065
+ labelGraphic.scale(scale, scale, scaleCenter);
74061
74066
  }
74062
74067
  }
74063
74068
  handlePan(e) {
74064
- this.handleZoom(e);
74069
+ const { delta } = e;
74070
+ if ((delta === null || delta === void 0 ? void 0 : delta[0]) === 0 && (delta === null || delta === void 0 ? void 0 : delta[1]) === 0) {
74071
+ return;
74072
+ }
74073
+ this._updateSymbolGraphicPosition();
74074
+ const labelGraphic = this._ensureLabelGraphicPostMatrix();
74075
+ if (labelGraphic) {
74076
+ labelGraphic.translate(delta[0], delta[1]);
74077
+ }
74078
+ }
74079
+ onLayoutEnd() {
74080
+ var _a, _b, _c;
74081
+ super.onLayoutEnd();
74082
+ this._updateSymbolGraphicPosition();
74083
+ const labelGraphic = (_b = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent()) === null || _b === void 0 ? void 0 : _b.getComponent();
74084
+ if (labelGraphic === null || labelGraphic === void 0 ? void 0 : labelGraphic.attribute.postMatrix) {
74085
+ labelGraphic.setAttributes({
74086
+ postMatrix: new Matrix()
74087
+ });
74088
+ }
74089
+ const vgrammarLabel = (_c = this._labelMark) === null || _c === void 0 ? void 0 : _c.getComponent();
74090
+ if (vgrammarLabel) {
74091
+ vgrammarLabel.renderInner();
74092
+ }
74065
74093
  }
74066
74094
  getDefaultShapeType() {
74067
74095
  return 'circle';
@@ -75320,7 +75348,7 @@ class MapSeries extends GeoSeries {
75320
75348
  this._mapViewData = null;
75321
75349
  }
75322
75350
  handleZoom(e) {
75323
- var _a, _b, _c, _d;
75351
+ var _a;
75324
75352
  const { scale, scaleCenter } = e;
75325
75353
  if (scale === 1) {
75326
75354
  return;
@@ -75334,26 +75362,13 @@ class MapSeries extends GeoSeries {
75334
75362
  }
75335
75363
  pathGroup.scale(scale, scale, scaleCenter);
75336
75364
  }
75337
- const labelComponent = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent();
75338
- if (labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.renderInner) {
75339
- labelComponent.renderInner();
75340
- }
75341
- const vgrammarLabel = (_b = labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.getComponent) === null || _b === void 0 ? void 0 : _b.call(labelComponent);
75342
- if (vgrammarLabel === null || vgrammarLabel === void 0 ? void 0 : vgrammarLabel.evaluate) {
75343
- vgrammarLabel.evaluate(null, null);
75344
- }
75345
- const labelGroup = (_c = labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.getProduct) === null || _c === void 0 ? void 0 : _c.call(labelComponent);
75346
- if (labelGroup && scale && scaleCenter) {
75347
- if (!((_d = labelGroup.attribute) === null || _d === void 0 ? void 0 : _d.postMatrix)) {
75348
- labelGroup.setAttributes({
75349
- postMatrix: new Matrix()
75350
- });
75351
- }
75352
- labelGroup.scale(scale, scale, scaleCenter);
75365
+ const vgrammarLabel = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent();
75366
+ if (vgrammarLabel) {
75367
+ vgrammarLabel.renderInner();
75353
75368
  }
75354
75369
  }
75355
75370
  handlePan(e) {
75356
- var _a, _b, _c, _d;
75371
+ var _a;
75357
75372
  const { delta } = e;
75358
75373
  if (delta[0] === 0 && delta[1] === 0) {
75359
75374
  return;
@@ -75367,22 +75382,9 @@ class MapSeries extends GeoSeries {
75367
75382
  }
75368
75383
  pathGroup.translate(delta[0], delta[1]);
75369
75384
  }
75370
- const labelComponent = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent();
75371
- if (labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.renderInner) {
75372
- labelComponent.renderInner();
75373
- }
75374
- const vgrammarLabel = (_b = labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.getComponent) === null || _b === void 0 ? void 0 : _b.call(labelComponent);
75375
- if (vgrammarLabel === null || vgrammarLabel === void 0 ? void 0 : vgrammarLabel.evaluate) {
75376
- vgrammarLabel.evaluate(null, null);
75377
- }
75378
- const labelGroup = (_c = labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.getProduct) === null || _c === void 0 ? void 0 : _c.call(labelComponent);
75379
- if (labelGroup && delta) {
75380
- if (!((_d = labelGroup.attribute) === null || _d === void 0 ? void 0 : _d.postMatrix)) {
75381
- labelGroup.setAttributes({
75382
- postMatrix: new Matrix()
75383
- });
75384
- }
75385
- labelGroup.translate(delta[0], delta[1]);
75385
+ const vgrammarLabel = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent();
75386
+ if (vgrammarLabel) {
75387
+ vgrammarLabel.renderInner();
75386
75388
  }
75387
75389
  }
75388
75390
  getDatumCenter(datum) {
@@ -95603,7 +95605,6 @@ class BaseLegend extends BaseComponent {
95603
95605
  }
95604
95606
  clear() {
95605
95607
  super.clear();
95606
- this._legendComponent = null;
95607
95608
  this._cacheAttrs = null;
95608
95609
  this._preSelectedData = null;
95609
95610
  }
package/build/index.js CHANGED
@@ -61790,10 +61790,13 @@
61790
61790
  (_a = this._chart) === null || _a === void 0 ? void 0 : _a.setLayout(layout);
61791
61791
  }
61792
61792
  reLayout() {
61793
- var _a, _b, _c;
61794
- (_a = this._chart) === null || _a === void 0 ? void 0 : _a.resetLayoutItemTag();
61795
- (_b = this._chart) === null || _b === void 0 ? void 0 : _b.setLayoutTag(true, null, false);
61796
- (_c = this._compiler) === null || _c === void 0 ? void 0 : _c.render();
61793
+ if (!this._chart || !this._compiler || this._isReleased) {
61794
+ return;
61795
+ }
61796
+ this._chart.resetLayoutItemTag();
61797
+ this._chart.setLayoutTag(true, null, false);
61798
+ this._compiler.render();
61799
+ this._chart.onEvaluateEnd();
61797
61800
  }
61798
61801
  getCompiler() {
61799
61802
  return this._compiler;
@@ -74029,45 +74032,70 @@
74029
74032
  }, exports.STATE_VALUE_ENUM.STATE_NORMAL, exports.AttributeLevel.Series);
74030
74033
  }
74031
74034
  }
74032
- handleZoom(e) {
74033
- var _a, _b, _c, _d;
74034
- this.getMarksWithoutRoot().forEach(mark => {
74035
- if (!mark) {
74036
- return;
74037
- }
74038
- const graphics = mark.getGraphics();
74039
- if (!graphics || !graphics.length) {
74040
- return;
74035
+ _updateSymbolGraphicPosition() {
74036
+ var _a;
74037
+ const graphics = (_a = this._symbolMark) === null || _a === void 0 ? void 0 : _a.getGraphics();
74038
+ if (!graphics || !graphics.length) {
74039
+ return;
74040
+ }
74041
+ graphics.forEach((graphicItem) => {
74042
+ var _a, _b;
74043
+ const datum = (_b = (_a = graphicItem === null || graphicItem === void 0 ? void 0 : graphicItem.context) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[0];
74044
+ const newPosition = this.dataToPosition(datum);
74045
+ if (newPosition && graphicItem) {
74046
+ graphicItem.setAttributes({
74047
+ x: newPosition.x,
74048
+ y: newPosition.y
74049
+ });
74041
74050
  }
74042
- graphics.forEach((graphicItem, i) => {
74043
- var _a, _b;
74044
- const datum = (_b = (_a = graphicItem === null || graphicItem === void 0 ? void 0 : graphicItem.context) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[0];
74045
- const newPosition = this.dataToPosition(datum);
74046
- if (newPosition && graphicItem) {
74047
- graphicItem.translateTo(newPosition.x, newPosition.y);
74048
- }
74049
- });
74050
74051
  });
74051
- const labelComponent = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent();
74052
- if (labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.renderInner) {
74053
- labelComponent.renderInner();
74052
+ }
74053
+ _ensureLabelGraphicPostMatrix() {
74054
+ var _a, _b;
74055
+ const labelGraphic = (_b = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent()) === null || _b === void 0 ? void 0 : _b.getComponent();
74056
+ if (labelGraphic && !labelGraphic.attribute.postMatrix) {
74057
+ labelGraphic.setAttributes({
74058
+ postMatrix: new Matrix()
74059
+ });
74054
74060
  }
74055
- const vgrammarLabel = (_b = labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.getComponent) === null || _b === void 0 ? void 0 : _b.call(labelComponent);
74056
- if (vgrammarLabel === null || vgrammarLabel === void 0 ? void 0 : vgrammarLabel.evaluate) {
74057
- vgrammarLabel.evaluate(null, null);
74061
+ return labelGraphic;
74062
+ }
74063
+ handleZoom(e) {
74064
+ const { scale, scaleCenter } = e;
74065
+ if (scale === 1) {
74066
+ return;
74058
74067
  }
74059
- const labelGroup = (_c = labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.getProduct) === null || _c === void 0 ? void 0 : _c.call(labelComponent);
74060
- if (labelGroup && (e === null || e === void 0 ? void 0 : e.scale) && (e === null || e === void 0 ? void 0 : e.scaleCenter)) {
74061
- if (!((_d = labelGroup.attribute) === null || _d === void 0 ? void 0 : _d.postMatrix)) {
74062
- labelGroup.setAttributes({
74063
- postMatrix: new Matrix()
74064
- });
74065
- }
74066
- labelGroup.scale(e.scale, e.scale, e.scaleCenter);
74068
+ this._updateSymbolGraphicPosition();
74069
+ const labelGraphic = this._ensureLabelGraphicPostMatrix();
74070
+ if (labelGraphic) {
74071
+ labelGraphic.scale(scale, scale, scaleCenter);
74067
74072
  }
74068
74073
  }
74069
74074
  handlePan(e) {
74070
- this.handleZoom(e);
74075
+ const { delta } = e;
74076
+ if ((delta === null || delta === void 0 ? void 0 : delta[0]) === 0 && (delta === null || delta === void 0 ? void 0 : delta[1]) === 0) {
74077
+ return;
74078
+ }
74079
+ this._updateSymbolGraphicPosition();
74080
+ const labelGraphic = this._ensureLabelGraphicPostMatrix();
74081
+ if (labelGraphic) {
74082
+ labelGraphic.translate(delta[0], delta[1]);
74083
+ }
74084
+ }
74085
+ onLayoutEnd() {
74086
+ var _a, _b, _c;
74087
+ super.onLayoutEnd();
74088
+ this._updateSymbolGraphicPosition();
74089
+ const labelGraphic = (_b = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent()) === null || _b === void 0 ? void 0 : _b.getComponent();
74090
+ if (labelGraphic === null || labelGraphic === void 0 ? void 0 : labelGraphic.attribute.postMatrix) {
74091
+ labelGraphic.setAttributes({
74092
+ postMatrix: new Matrix()
74093
+ });
74094
+ }
74095
+ const vgrammarLabel = (_c = this._labelMark) === null || _c === void 0 ? void 0 : _c.getComponent();
74096
+ if (vgrammarLabel) {
74097
+ vgrammarLabel.renderInner();
74098
+ }
74071
74099
  }
74072
74100
  getDefaultShapeType() {
74073
74101
  return 'circle';
@@ -75326,7 +75354,7 @@
75326
75354
  this._mapViewData = null;
75327
75355
  }
75328
75356
  handleZoom(e) {
75329
- var _a, _b, _c, _d;
75357
+ var _a;
75330
75358
  const { scale, scaleCenter } = e;
75331
75359
  if (scale === 1) {
75332
75360
  return;
@@ -75340,26 +75368,13 @@
75340
75368
  }
75341
75369
  pathGroup.scale(scale, scale, scaleCenter);
75342
75370
  }
75343
- const labelComponent = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent();
75344
- if (labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.renderInner) {
75345
- labelComponent.renderInner();
75346
- }
75347
- const vgrammarLabel = (_b = labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.getComponent) === null || _b === void 0 ? void 0 : _b.call(labelComponent);
75348
- if (vgrammarLabel === null || vgrammarLabel === void 0 ? void 0 : vgrammarLabel.evaluate) {
75349
- vgrammarLabel.evaluate(null, null);
75350
- }
75351
- const labelGroup = (_c = labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.getProduct) === null || _c === void 0 ? void 0 : _c.call(labelComponent);
75352
- if (labelGroup && scale && scaleCenter) {
75353
- if (!((_d = labelGroup.attribute) === null || _d === void 0 ? void 0 : _d.postMatrix)) {
75354
- labelGroup.setAttributes({
75355
- postMatrix: new Matrix()
75356
- });
75357
- }
75358
- labelGroup.scale(scale, scale, scaleCenter);
75371
+ const vgrammarLabel = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent();
75372
+ if (vgrammarLabel) {
75373
+ vgrammarLabel.renderInner();
75359
75374
  }
75360
75375
  }
75361
75376
  handlePan(e) {
75362
- var _a, _b, _c, _d;
75377
+ var _a;
75363
75378
  const { delta } = e;
75364
75379
  if (delta[0] === 0 && delta[1] === 0) {
75365
75380
  return;
@@ -75373,22 +75388,9 @@
75373
75388
  }
75374
75389
  pathGroup.translate(delta[0], delta[1]);
75375
75390
  }
75376
- const labelComponent = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent();
75377
- if (labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.renderInner) {
75378
- labelComponent.renderInner();
75379
- }
75380
- const vgrammarLabel = (_b = labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.getComponent) === null || _b === void 0 ? void 0 : _b.call(labelComponent);
75381
- if (vgrammarLabel === null || vgrammarLabel === void 0 ? void 0 : vgrammarLabel.evaluate) {
75382
- vgrammarLabel.evaluate(null, null);
75383
- }
75384
- const labelGroup = (_c = labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.getProduct) === null || _c === void 0 ? void 0 : _c.call(labelComponent);
75385
- if (labelGroup && delta) {
75386
- if (!((_d = labelGroup.attribute) === null || _d === void 0 ? void 0 : _d.postMatrix)) {
75387
- labelGroup.setAttributes({
75388
- postMatrix: new Matrix()
75389
- });
75390
- }
75391
- labelGroup.translate(delta[0], delta[1]);
75391
+ const vgrammarLabel = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent();
75392
+ if (vgrammarLabel) {
75393
+ vgrammarLabel.renderInner();
75392
75394
  }
75393
75395
  }
75394
75396
  getDatumCenter(datum) {
@@ -95609,7 +95611,6 @@
95609
95611
  }
95610
95612
  clear() {
95611
95613
  super.clear();
95612
- this._legendComponent = null;
95613
95614
  this._cacheAttrs = null;
95614
95615
  this._preSelectedData = null;
95615
95616
  }