tvcharts 0.8.55 → 0.8.56

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/echarts.js CHANGED
@@ -25584,6 +25584,9 @@ ECharts.internalField = function() {
25584
25584
  markStatusToUpdate(ecIns);
25585
25585
  }
25586
25586
  }).on("mousedown", function(e2) {
25587
+ if (e2.event.zrByTouch) {
25588
+ return;
25589
+ }
25587
25590
  const el = e2.target;
25588
25591
  const dispatcher = findEventDispatcher(el, isHighDownDispatcher);
25589
25592
  handleGlobalMouseDownForHighDown(dispatcher, e2, ecIns._api);
@@ -25601,6 +25604,11 @@ ECharts.internalField = function() {
25601
25604
  isFromClick: true
25602
25605
  });
25603
25606
  }
25607
+ if (!e2.event.zrByTouch) {
25608
+ return;
25609
+ }
25610
+ const mobileDispatcher = findEventDispatcher(el, isHighDownDispatcher);
25611
+ handleGlobalMouseDownForHighDown(mobileDispatcher, e2, ecIns._api);
25604
25612
  }).on("globalout", function() {
25605
25613
  if (ecIns.mousemoveComponentGroupId) {
25606
25614
  ecIns.mousemoveComponentGroupId = "";
@@ -41935,6 +41943,9 @@ var RoamController = class extends Eventful_default {
41935
41943
  this._startX = x;
41936
41944
  this._startY = y;
41937
41945
  this._dragging = true;
41946
+ if (this.kineticScroll) {
41947
+ this.kineticScroll = null;
41948
+ }
41938
41949
  }
41939
41950
  }
41940
41951
  _mousemoveHandler(e2) {
@@ -41966,7 +41977,8 @@ var RoamController = class extends Eventful_default {
41966
41977
  oldY,
41967
41978
  newX: x,
41968
41979
  newY: y,
41969
- isAvailableBehavior: null
41980
+ isAvailableBehavior: null,
41981
+ isTouch: e2.event.zrByTouch
41970
41982
  });
41971
41983
  }
41972
41984
  _mouseupHandler(e2) {
@@ -41979,6 +41991,7 @@ var RoamController = class extends Eventful_default {
41979
41991
  const dy = y - oldY;
41980
41992
  if (this._dragging && (dx || dy)) {
41981
41993
  trigger(this, "dragEnd", "moveOnMouseMove", e2, {isAvailableBehavior: null});
41994
+ this._startKineticScroll();
41982
41995
  }
41983
41996
  this._dragging = false;
41984
41997
  }
@@ -42019,15 +42032,36 @@ var RoamController = class extends Eventful_default {
42019
42032
  if (isTaken(this._zr, "globalPan")) {
42020
42033
  return;
42021
42034
  }
42022
- const scale4 = e2.pinchScale > 1 ? 1.1 : 1 / 1.1;
42023
- checkPointerAndTrigger(this, "zoom", null, e2, {
42035
+ const scale4 = e2.pinchScale;
42036
+ checkPointerAndTrigger(this, "zoom", "zoomOnMouseWheel", e2, {
42024
42037
  scale: scale4,
42025
42038
  originX: e2.pinchX,
42026
42039
  originY: e2.pinchY,
42027
42040
  isAvailableBehavior: null,
42028
- inSitu: e2.event.ctrlKey
42041
+ inSitu: true
42029
42042
  });
42030
42043
  }
42044
+ _kineticScroll() {
42045
+ if (!this.kineticScroll) {
42046
+ return;
42047
+ }
42048
+ const now = Date.now();
42049
+ if (!this.kineticScroll.finished(now)) {
42050
+ const newPos = this.kineticScroll.getPosition(now);
42051
+ trigger(this, "kineticScroll", "moveOnMouseMove", null, {
42052
+ isAvailableBehavior: null,
42053
+ lastBarRightSideDiffBarCount: Math.round(newPos / this.minScrollUnit) * this.minScrollUnit
42054
+ });
42055
+ requestAnimationFrame_default(() => this._kineticScroll());
42056
+ }
42057
+ }
42058
+ _startKineticScroll() {
42059
+ if (!this.kineticScroll) {
42060
+ return;
42061
+ }
42062
+ this.kineticScroll.start(this.startPositionX, Date.now());
42063
+ this._kineticScroll();
42064
+ }
42031
42065
  };
42032
42066
  function checkPointerAndTrigger(controller, eventName, behaviorToCheck, e2, contollerEvent) {
42033
42067
  if (controller.pointerChecker && controller.pointerChecker(e2, contollerEvent.originX, contollerEvent.originY)) {
@@ -76103,7 +76137,8 @@ var MarkLabelView2 = class extends Component_default2 {
76103
76137
  markerGroupMap.set(item.name, el);
76104
76138
  this.group.add(el);
76105
76139
  }
76106
- if (item.countDown && item.countDown.show && item.countDown.value > 0) {
76140
+ const showCountDown = item.countDown && item.countDown.show && item.countDown.value > 0;
76141
+ if (showCountDown) {
76107
76142
  const key = seriesName + item.name;
76108
76143
  if (!timerMap.get(key)) {
76109
76144
  const countDownTextEl = el.childAt(3);
@@ -76111,7 +76146,7 @@ var MarkLabelView2 = class extends Component_default2 {
76111
76146
  }
76112
76147
  }
76113
76148
  inner21(el).yAxisIndex = yAxisModel.index;
76114
- inner21(el).isSort = item.showName;
76149
+ inner21(el).isSort = item.showName || showCountDown;
76115
76150
  });
76116
76151
  markerGroupMapBySeries.set(seriesName, markerGroupMap);
76117
76152
  });
@@ -76433,7 +76468,7 @@ function createLabel({x, y, labelData, markerModel, gridRect, position: position
76433
76468
  group.add(textEl);
76434
76469
  group.add(textNameEl);
76435
76470
  if (countDown) {
76436
- const show = countDown.show && !!countDown.value;
76471
+ const show = countDown.show && countDown.value > 0;
76437
76472
  const offsetY = showName && show ? textRect.height + paddings[0] + paddings[2] - 1 : 0;
76438
76473
  const fill = textStyle.fill === "#ffffff" ? "rgba(255,255,255,0.8)" : "rgba(0,0,0,0.8)";
76439
76474
  const countDownEl = new Text_default({
@@ -77647,6 +77682,122 @@ InsideZoomModel.defaultOption = inheritDefaultOption(DataZoomModel_default.defau
77647
77682
  });
77648
77683
  var InsideZoomModel_default = InsideZoomModel;
77649
77684
 
77685
+ // src/component/helper/kineticAnimation.ts
77686
+ var Constants;
77687
+ (function(Constants2) {
77688
+ Constants2[Constants2["MaxStartDelay"] = 50] = "MaxStartDelay";
77689
+ Constants2[Constants2["EpsilonDistance"] = 1] = "EpsilonDistance";
77690
+ })(Constants || (Constants = {}));
77691
+ function ensureNotNull(value) {
77692
+ if (value === null) {
77693
+ throw new Error("Value is null");
77694
+ }
77695
+ return value;
77696
+ }
77697
+ function distanceBetweenPoints(pos1, pos2) {
77698
+ return pos1.position - pos2.position;
77699
+ }
77700
+ function speedPxPerMSec(pos1, pos2, maxSpeed) {
77701
+ const speed = (pos1.position - pos2.position) / (pos1.time - pos2.time);
77702
+ return Math.sign(speed) * Math.min(Math.abs(speed), maxSpeed);
77703
+ }
77704
+ function durationMSec(speed, dumpingCoeff) {
77705
+ const lnDumpingCoeff = Math.log(dumpingCoeff);
77706
+ return Math.log(1 * lnDumpingCoeff / -speed) / lnDumpingCoeff;
77707
+ }
77708
+ var KineticScrollConstants;
77709
+ (function(KineticScrollConstants2) {
77710
+ KineticScrollConstants2[KineticScrollConstants2["MinScrollSpeed"] = 0.2] = "MinScrollSpeed";
77711
+ KineticScrollConstants2[KineticScrollConstants2["MaxScrollSpeed"] = 7] = "MaxScrollSpeed";
77712
+ KineticScrollConstants2[KineticScrollConstants2["DumpingCoeff"] = 0.997] = "DumpingCoeff";
77713
+ KineticScrollConstants2[KineticScrollConstants2["ScrollMinMove"] = 15] = "ScrollMinMove";
77714
+ })(KineticScrollConstants || (KineticScrollConstants = {}));
77715
+ var KineticAnimation = class {
77716
+ constructor(minSpeed, maxSpeed, dumpingCoeff, minMove) {
77717
+ this._position1 = null;
77718
+ this._position2 = null;
77719
+ this._position3 = null;
77720
+ this._position4 = null;
77721
+ this._animationStartPosition = null;
77722
+ this._durationMsecs = 0;
77723
+ this._speedPxPerMsec = 0;
77724
+ this._minSpeed = minSpeed;
77725
+ this._maxSpeed = maxSpeed;
77726
+ this._dumpingCoeff = dumpingCoeff;
77727
+ this._minMove = minMove;
77728
+ }
77729
+ addPosition(position2, time) {
77730
+ if (this._position1 !== null) {
77731
+ if (this._position1.time === time) {
77732
+ this._position1.position = position2;
77733
+ return;
77734
+ }
77735
+ if (Math.abs(this._position1.position - position2) < this._minMove) {
77736
+ return;
77737
+ }
77738
+ }
77739
+ this._position4 = this._position3;
77740
+ this._position3 = this._position2;
77741
+ this._position2 = this._position1;
77742
+ this._position1 = {time, position: position2};
77743
+ }
77744
+ start(position2, time) {
77745
+ if (this._position1 === null || this._position2 === null) {
77746
+ return;
77747
+ }
77748
+ if (time - this._position1.time > 50) {
77749
+ return;
77750
+ }
77751
+ let totalDistance = 0;
77752
+ const speed1 = speedPxPerMSec(this._position1, this._position2, this._maxSpeed);
77753
+ const distance1 = distanceBetweenPoints(this._position1, this._position2);
77754
+ const speedItems = [speed1];
77755
+ const distanceItems = [distance1];
77756
+ totalDistance += distance1;
77757
+ if (this._position3 !== null) {
77758
+ const speed2 = speedPxPerMSec(this._position2, this._position3, this._maxSpeed);
77759
+ if (Math.sign(speed2) === Math.sign(speed1)) {
77760
+ const distance2 = distanceBetweenPoints(this._position2, this._position3);
77761
+ speedItems.push(speed2);
77762
+ distanceItems.push(distance2);
77763
+ totalDistance += distance2;
77764
+ if (this._position4 !== null) {
77765
+ const speed3 = speedPxPerMSec(this._position3, this._position4, this._maxSpeed);
77766
+ if (Math.sign(speed3) === Math.sign(speed1)) {
77767
+ const distance3 = distanceBetweenPoints(this._position3, this._position4);
77768
+ speedItems.push(speed3);
77769
+ distanceItems.push(distance3);
77770
+ totalDistance += distance3;
77771
+ }
77772
+ }
77773
+ }
77774
+ }
77775
+ let resultSpeed = 0;
77776
+ for (let i = 0; i < speedItems.length; ++i) {
77777
+ resultSpeed += distanceItems[i] / totalDistance * speedItems[i];
77778
+ }
77779
+ if (Math.abs(resultSpeed) < this._minSpeed) {
77780
+ return;
77781
+ }
77782
+ this._animationStartPosition = {position: position2, time};
77783
+ this._speedPxPerMsec = resultSpeed;
77784
+ this._durationMsecs = durationMSec(Math.abs(resultSpeed), this._dumpingCoeff);
77785
+ }
77786
+ getPosition(time) {
77787
+ const startPosition = ensureNotNull(this._animationStartPosition);
77788
+ const durationMsecs = time - startPosition.time;
77789
+ return startPosition.position + this._speedPxPerMsec * (Math.pow(this._dumpingCoeff, durationMsecs) - 1) / Math.log(this._dumpingCoeff);
77790
+ }
77791
+ finished(time) {
77792
+ return this._animationStartPosition === null || this._progressDuration(time) === this._durationMsecs;
77793
+ }
77794
+ _progressDuration(time) {
77795
+ const startPosition = ensureNotNull(this._animationStartPosition);
77796
+ const progress = time - startPosition.time;
77797
+ return Math.min(progress, this._durationMsecs);
77798
+ }
77799
+ };
77800
+
77650
77801
  // src/component/dataZoom/roams.ts
77651
77802
  var inner22 = makeInner();
77652
77803
  function setViewInfoToCoordSysRecord(api2, dataZoomModel, getRange) {
@@ -77712,49 +77863,74 @@ function createCoordSysRecord(api2, coordSysModel) {
77712
77863
  const method = (dzInfo.getRange || {})[eventName];
77713
77864
  const range = method && method(dzInfo.dzReferCoordSysInfo, coordSysRecord.model.mainType, coordSysRecord.controller, event);
77714
77865
  const enabled = !dzInfo.model.get("disabled", true) && range;
77715
- if (enabled) {
77716
- const axisProxy = dzInfo.model.findRepresentativeAxisProxy();
77717
- const axisModal = axisProxy.getAxisModel();
77718
- const useValueRange = dzInfo.model.get("useValueRange");
77719
- const isDistanceMode = axisModal.axis.getIsDistanceMode();
77720
- if (isDistanceMode) {
77721
- const isDragging = controller.isDragging();
77722
- dzInfo.model.setDistanceRange(range);
77723
- dzInfo.model.isDragging = isDragging;
77724
- batch.push({
77725
- dataZoomId: dzInfo.model.id,
77726
- uid: dzInfo.model.uid,
77727
- barSpace: range[0],
77728
- lastBarRightSideDiffBarCount: range[1],
77729
- scale: 2 + event.scale * -1,
77730
- event,
77731
- isDragging
77732
- });
77733
- } else if (useValueRange) {
77734
- dzInfo.model.setRawRange({
77735
- startValue: range[0],
77736
- endValue: range[1]
77737
- });
77738
- batch.push({
77739
- dataZoomId: dzInfo.model.id,
77740
- uid: dzInfo.model.uid,
77741
- startValue: range[0],
77742
- endValue: range[1],
77743
- event
77744
- });
77745
- } else {
77746
- batch.push({
77747
- dataZoomId: dzInfo.model.id,
77748
- start: range[0],
77749
- end: range[1],
77750
- event
77751
- });
77866
+ if (!enabled) {
77867
+ return;
77868
+ }
77869
+ const axisProxy = dzInfo.model.findRepresentativeAxisProxy();
77870
+ const axisModal = axisProxy.getAxisModel();
77871
+ const useValueRange = dzInfo.model.get("useValueRange");
77872
+ const isDistanceMode = axisModal.axis.getIsDistanceMode();
77873
+ if (isDistanceMode) {
77874
+ const isDragging = controller.isDragging();
77875
+ dzInfo.model.setDistanceRange(range);
77876
+ dzInfo.model.isDragging = isDragging;
77877
+ const barSpace = range[0];
77878
+ const lastBarRightSideDiffBarCount = range[1];
77879
+ const now = Date.now();
77880
+ if (!controller.kineticScroll && eventName === "pan" && event.isTouch) {
77881
+ controller.kineticScroll = new KineticAnimation(KineticScrollConstants.MinScrollSpeed / barSpace, KineticScrollConstants.MaxScrollSpeed / barSpace, KineticScrollConstants.DumpingCoeff, KineticScrollConstants.ScrollMinMove / barSpace);
77882
+ controller.minScrollUnit = 1 / barSpace;
77883
+ controller.kineticScroll.addPosition(lastBarRightSideDiffBarCount, now);
77884
+ } else if (controller.kineticScroll) {
77885
+ controller.kineticScroll.addPosition(lastBarRightSideDiffBarCount, now);
77886
+ controller.startPositionX = lastBarRightSideDiffBarCount;
77752
77887
  }
77888
+ batch.push({
77889
+ dataZoomId: dzInfo.model.id,
77890
+ uid: dzInfo.model.uid,
77891
+ barSpace: range[0],
77892
+ lastBarRightSideDiffBarCount: range[1],
77893
+ scale: 2 + event.scale * -1,
77894
+ event,
77895
+ isDragging
77896
+ });
77897
+ } else if (useValueRange) {
77898
+ dzInfo.model.setRawRange({
77899
+ startValue: range[0],
77900
+ endValue: range[1]
77901
+ });
77902
+ batch.push({
77903
+ dataZoomId: dzInfo.model.id,
77904
+ uid: dzInfo.model.uid,
77905
+ startValue: range[0],
77906
+ endValue: range[1],
77907
+ event
77908
+ });
77909
+ } else {
77910
+ batch.push({
77911
+ dataZoomId: dzInfo.model.id,
77912
+ start: range[0],
77913
+ end: range[1],
77914
+ event
77915
+ });
77753
77916
  }
77754
77917
  });
77755
77918
  batch.length && coordSysRecord.dispatchAction(batch);
77756
77919
  });
77757
77920
  });
77921
+ controller.on("kineticScroll", (event) => {
77922
+ coordSysRecord.dataZoomInfoMap.each(function(dzInfo) {
77923
+ const axisProxy = dzInfo.model.findRepresentativeAxisProxy();
77924
+ const axisModal = axisProxy.getAxisModel();
77925
+ const isDistanceMode = axisModal.axis.getIsDistanceMode();
77926
+ if (isDistanceMode) {
77927
+ coordSysRecord.dispatchAction([{
77928
+ dataZoomId: dzInfo.model.id,
77929
+ lastBarRightSideDiffBarCount: event.lastBarRightSideDiffBarCount
77930
+ }]);
77931
+ }
77932
+ });
77933
+ });
77758
77934
  return coordSysRecord;
77759
77935
  }
77760
77936
  function dispatchAction2(api2, batch) {