Skip to content

Commit

Permalink
fix: problems in scale align
Browse files Browse the repository at this point in the history
  • Loading branch information
zamhown committed Nov 23, 2023
1 parent 74cea75 commit b261b37
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/vscale/src/band-scale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,7 @@ export class BandScale extends OrdinalScale implements IBandLikeScale {
this._rangeFactorStart = this._rangeFactorEnd - rangeFactorSize;
} else {
// 判断 scale 方向来决定边界检测顺序
if (range[1] > range[0]) {
if (canAlignEnd) {
this._rangeFactorStart = this._rangeFactorEnd - rangeFactorSize;
} else if (canAlignStart) {
this._rangeFactorEnd = this._rangeFactorStart + rangeFactorSize;
} else {
this._rangeFactorStart = 1 - rangeFactorSize;
this._rangeFactorEnd = 1;
}
} else {
if (range[0] <= range[1]) {
if (canAlignStart) {
this._rangeFactorEnd = this._rangeFactorStart + rangeFactorSize;
} else if (canAlignEnd) {
Expand All @@ -159,6 +150,15 @@ export class BandScale extends OrdinalScale implements IBandLikeScale {
this._rangeFactorStart = 0;
this._rangeFactorEnd = rangeFactorSize;
}
} else {
if (canAlignEnd) {
this._rangeFactorStart = this._rangeFactorEnd - rangeFactorSize;
} else if (canAlignStart) {
this._rangeFactorEnd = this._rangeFactorStart + rangeFactorSize;
} else {
this._rangeFactorStart = 1 - rangeFactorSize;
this._rangeFactorEnd = 1;
}
}
}
} else {
Expand Down

0 comments on commit b261b37

Please sign in to comment.