Skip to content

Commit 5562c28

Browse files
committed
Revert "fix: fix issue of datazoom"
This reverts commit 401067d.
1 parent 401067d commit 5562c28

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

packages/vrender-components/src/data-zoom/renderer.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -592,8 +592,13 @@ export class DataZoomRenderer {
592592
});
593593
}
594594

595-
private _computeBasePoints() {
596-
const { orient, isReverse = false } = this.attribute as DataZoomAttributes;
595+
private _computeBasePoints(points: IPointLike[]) {
596+
const { orient } = this.attribute as DataZoomAttributes;
597+
const key = orient === 'bottom' || orient === 'top' ? 'x' : 'y';
598+
let lastPointSide = Math.sign(points[points.length - 1][key] - points[0][key]);
599+
if (lastPointSide === 0) {
600+
lastPointSide = 1;
601+
}
597602
const { position, width, height } = this._getLayoutAttrFromConfig();
598603
let basePointStart: any;
599604
let basePointEnd: any;
@@ -638,7 +643,7 @@ export class DataZoomRenderer {
638643
];
639644
}
640645

641-
if (isReverse) {
646+
if (Math.sign(basePointEnd[0][key] - basePointStart[0][key]) !== lastPointSide) {
642647
return {
643648
basePointStart: basePointEnd,
644649
basePointEnd: basePointStart
@@ -676,7 +681,7 @@ export class DataZoomRenderer {
676681
// 采样
677682
previewPoints = this._simplifyPoints(previewPoints);
678683

679-
const { basePointStart, basePointEnd } = this._computeBasePoints();
684+
const { basePointStart, basePointEnd } = this._computeBasePoints(previewPoints);
680685
return basePointStart.concat(previewPoints).concat(basePointEnd);
681686
}
682687

@@ -697,7 +702,7 @@ export class DataZoomRenderer {
697702
// 采样
698703
previewPoints = this._simplifyPoints(previewPoints);
699704

700-
const { basePointStart, basePointEnd } = this._computeBasePoints();
705+
const { basePointStart, basePointEnd } = this._computeBasePoints(previewPoints);
701706
return basePointStart.concat(previewPoints).concat(basePointEnd);
702707
}
703708

packages/vrender-components/src/data-zoom/type.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,6 @@ export interface DataZoomAttributes extends IGroupGraphicAttribute {
220220
* 参考: https://mourner.github.io/simplify-js/
221221
*/
222222
tolerance?: number;
223-
224-
/**
225-
* 是否反转DataZoom 作用于BasePoint的计算
226-
*/
227-
isReverse?: boolean;
228223
}
229224

230225
/**

0 commit comments

Comments
 (0)