@visactor/vchart 2.0.20-alpha.1 → 2.0.20-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +29 -16
  3. package/build/index.js +29 -16
  4. package/build/index.min.js +1 -1
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/compile/compiler.d.ts +2 -0
  7. package/cjs/compile/compiler.js +14 -2
  8. package/cjs/compile/compiler.js.map +1 -1
  9. package/cjs/compile/mark/interface.d.ts +0 -1
  10. package/cjs/compile/mark/interface.js.map +1 -1
  11. package/cjs/compile/mark/mark-state-manager.d.ts +0 -1
  12. package/cjs/compile/mark/mark-state-manager.js +0 -3
  13. package/cjs/compile/mark/mark-state-manager.js.map +1 -1
  14. package/cjs/mark/base/base-mark.d.ts +0 -1
  15. package/cjs/mark/base/base-mark.js +2 -9
  16. package/cjs/mark/base/base-mark.js.map +1 -1
  17. package/cjs/mark/interface/common.d.ts +0 -1
  18. package/cjs/mark/interface/common.js.map +1 -1
  19. package/cjs/series/base/base-series.js +1 -1
  20. package/cjs/series/base/base-series.js.map +1 -1
  21. package/esm/compile/compiler.d.ts +2 -0
  22. package/esm/compile/compiler.js +14 -2
  23. package/esm/compile/compiler.js.map +1 -1
  24. package/esm/compile/mark/interface.d.ts +0 -1
  25. package/esm/compile/mark/interface.js.map +1 -1
  26. package/esm/compile/mark/mark-state-manager.d.ts +0 -1
  27. package/esm/compile/mark/mark-state-manager.js +0 -3
  28. package/esm/compile/mark/mark-state-manager.js.map +1 -1
  29. package/esm/mark/base/base-mark.d.ts +0 -1
  30. package/esm/mark/base/base-mark.js +2 -9
  31. package/esm/mark/base/base-mark.js.map +1 -1
  32. package/esm/mark/interface/common.d.ts +0 -1
  33. package/esm/mark/interface/common.js.map +1 -1
  34. package/esm/series/base/base-series.js +1 -1
  35. package/esm/series/base/base-series.js.map +1 -1
  36. package/package.json +4 -4
package/build/index.es.js CHANGED
@@ -55091,6 +55091,33 @@ class Compiler {
55091
55091
  updateLayoutTag() {
55092
55092
  this._layoutState = LayoutState.before;
55093
55093
  }
55094
+ _isGeoRegionRoamDragEnabled() {
55095
+ var _a, _b;
55096
+ const chartSpec = (_b = (_a = this._compileChart) === null || _a === void 0 ? void 0 : _a.getSpec) === null || _b === void 0 ? void 0 : _b.call(_a);
55097
+ const regions = chartSpec === null || chartSpec === void 0 ? void 0 : chartSpec.region;
55098
+ if (!isArray$1(regions)) {
55099
+ return false;
55100
+ }
55101
+ return regions.some((region) => {
55102
+ var _a;
55103
+ if ((region === null || region === void 0 ? void 0 : region.coordinate) !== 'geo' || !region.roam) {
55104
+ return false;
55105
+ }
55106
+ if (region.roam === true) {
55107
+ return true;
55108
+ }
55109
+ return (_a = region.roam.drag) !== null && _a !== void 0 ? _a : true;
55110
+ });
55111
+ }
55112
+ _shouldDisableCanvasTouchAction() {
55113
+ if (!isTrueBrowser(this._option.mode)) {
55114
+ return false;
55115
+ }
55116
+ const supportsTouchEvents = isValid$1(this._option.supportsTouchEvents)
55117
+ ? this._option.supportsTouchEvents
55118
+ : vglobal.supportsTouchEvents;
55119
+ return supportsTouchEvents === false && this._isGeoRegionRoamDragEnabled();
55120
+ }
55094
55121
  _setCanvasStyle() {
55095
55122
  if (!this._stage) {
55096
55123
  return;
@@ -55101,6 +55128,7 @@ class Compiler {
55101
55128
  const canvas = this.getCanvas();
55102
55129
  if (canvas) {
55103
55130
  canvas.style.display = 'block';
55131
+ canvas.style.touchAction = this._shouldDisableCanvasTouchAction() ? 'none' : '';
55104
55132
  }
55105
55133
  }
55106
55134
  }
@@ -55119,6 +55147,7 @@ class Compiler {
55119
55147
  this._cachedMarks = null;
55120
55148
  }
55121
55149
  chart.compile();
55150
+ this._setCanvasStyle();
55122
55151
  chart.afterCompile();
55123
55152
  }
55124
55153
  clearNextRender() {
@@ -57698,9 +57727,6 @@ class MarkStateManager extends StateManager {
57698
57727
  }
57699
57728
  });
57700
57729
  }
57701
- clearAllStateInfo() {
57702
- this._stateInfoList = [];
57703
- }
57704
57730
  _isMultiMark() {
57705
57731
  return !this._mark || isMultiDatumMark(this._mark.type);
57706
57732
  }
@@ -58714,11 +58740,7 @@ class BaseMark extends GrammarItem {
58714
58740
  return;
58715
58741
  }
58716
58742
  this._product = mark.getProduct();
58717
- this._product.clearStates();
58718
58743
  this._graphics = mark.getGraphics();
58719
- this._graphics.forEach(g => {
58720
- g.clearStates();
58721
- });
58722
58744
  this._graphicMap = mark._graphicMap;
58723
58745
  this._graphicMap.forEach(g => {
58724
58746
  g.context = Object.assign(Object.assign({}, g.context), this._getCommonContext());
@@ -59427,14 +59449,6 @@ class BaseMark extends GrammarItem {
59427
59449
  runAnimation() {
59428
59450
  this._runStateAnimation(this.getGraphics());
59429
59451
  }
59430
- clearBeforeReInit() {
59431
- this.state.clearAllStateInfo();
59432
- this.uncommit();
59433
- this.stateStyle = {};
59434
- this.getGraphics().forEach(g => {
59435
- g.clearStates();
59436
- });
59437
- }
59438
59452
  }
59439
59453
 
59440
59454
  var MarkTypeEnum;
@@ -63534,7 +63548,6 @@ class BaseSeries extends BaseModel {
63534
63548
  super.reInit(spec);
63535
63549
  const marks = this.getMarksWithoutRoot();
63536
63550
  marks.forEach(mark => {
63537
- mark.clearBeforeReInit();
63538
63551
  this._spec[mark.name] && this.initMarkStyleWithSpec(mark, this._spec[mark.name]);
63539
63552
  });
63540
63553
  this.initMarkStyle();
package/build/index.js CHANGED
@@ -55097,6 +55097,33 @@
55097
55097
  updateLayoutTag() {
55098
55098
  this._layoutState = LayoutState.before;
55099
55099
  }
55100
+ _isGeoRegionRoamDragEnabled() {
55101
+ var _a, _b;
55102
+ const chartSpec = (_b = (_a = this._compileChart) === null || _a === void 0 ? void 0 : _a.getSpec) === null || _b === void 0 ? void 0 : _b.call(_a);
55103
+ const regions = chartSpec === null || chartSpec === void 0 ? void 0 : chartSpec.region;
55104
+ if (!isArray$1(regions)) {
55105
+ return false;
55106
+ }
55107
+ return regions.some((region) => {
55108
+ var _a;
55109
+ if ((region === null || region === void 0 ? void 0 : region.coordinate) !== 'geo' || !region.roam) {
55110
+ return false;
55111
+ }
55112
+ if (region.roam === true) {
55113
+ return true;
55114
+ }
55115
+ return (_a = region.roam.drag) !== null && _a !== void 0 ? _a : true;
55116
+ });
55117
+ }
55118
+ _shouldDisableCanvasTouchAction() {
55119
+ if (!isTrueBrowser(this._option.mode)) {
55120
+ return false;
55121
+ }
55122
+ const supportsTouchEvents = isValid$1(this._option.supportsTouchEvents)
55123
+ ? this._option.supportsTouchEvents
55124
+ : vglobal.supportsTouchEvents;
55125
+ return supportsTouchEvents === false && this._isGeoRegionRoamDragEnabled();
55126
+ }
55100
55127
  _setCanvasStyle() {
55101
55128
  if (!this._stage) {
55102
55129
  return;
@@ -55107,6 +55134,7 @@
55107
55134
  const canvas = this.getCanvas();
55108
55135
  if (canvas) {
55109
55136
  canvas.style.display = 'block';
55137
+ canvas.style.touchAction = this._shouldDisableCanvasTouchAction() ? 'none' : '';
55110
55138
  }
55111
55139
  }
55112
55140
  }
@@ -55125,6 +55153,7 @@
55125
55153
  this._cachedMarks = null;
55126
55154
  }
55127
55155
  chart.compile();
55156
+ this._setCanvasStyle();
55128
55157
  chart.afterCompile();
55129
55158
  }
55130
55159
  clearNextRender() {
@@ -57704,9 +57733,6 @@
57704
57733
  }
57705
57734
  });
57706
57735
  }
57707
- clearAllStateInfo() {
57708
- this._stateInfoList = [];
57709
- }
57710
57736
  _isMultiMark() {
57711
57737
  return !this._mark || isMultiDatumMark(this._mark.type);
57712
57738
  }
@@ -58720,11 +58746,7 @@
58720
58746
  return;
58721
58747
  }
58722
58748
  this._product = mark.getProduct();
58723
- this._product.clearStates();
58724
58749
  this._graphics = mark.getGraphics();
58725
- this._graphics.forEach(g => {
58726
- g.clearStates();
58727
- });
58728
58750
  this._graphicMap = mark._graphicMap;
58729
58751
  this._graphicMap.forEach(g => {
58730
58752
  g.context = Object.assign(Object.assign({}, g.context), this._getCommonContext());
@@ -59433,14 +59455,6 @@
59433
59455
  runAnimation() {
59434
59456
  this._runStateAnimation(this.getGraphics());
59435
59457
  }
59436
- clearBeforeReInit() {
59437
- this.state.clearAllStateInfo();
59438
- this.uncommit();
59439
- this.stateStyle = {};
59440
- this.getGraphics().forEach(g => {
59441
- g.clearStates();
59442
- });
59443
- }
59444
59458
  }
59445
59459
 
59446
59460
  exports.MarkTypeEnum = void 0;
@@ -63540,7 +63554,6 @@
63540
63554
  super.reInit(spec);
63541
63555
  const marks = this.getMarksWithoutRoot();
63542
63556
  marks.forEach(mark => {
63543
- mark.clearBeforeReInit();
63544
63557
  this._spec[mark.name] && this.initMarkStyleWithSpec(mark, this._spec[mark.name]);
63545
63558
  });
63546
63559
  this.initMarkStyle();