mirror of
https://github.com/VisActor/VChart
synced 2024-11-22 17:26:19 +00:00
fix: fixed the problem of unreasonable automatic indentation being triggered after modifying the axis range in datazoom
This commit is contained in:
parent
440b8048aa
commit
4f34d7528c
@ -78,6 +78,12 @@ export abstract class CartesianAxis<T extends ICartesianAxisCommonSpec = ICartes
|
||||
this._layoutOrient = v;
|
||||
}
|
||||
|
||||
protected _autoIndentOnce: boolean = false;
|
||||
protected _hasAutoIndent: boolean = false;
|
||||
set autoIndentOnce(v: boolean) {
|
||||
this._autoIndentOnce = v;
|
||||
}
|
||||
|
||||
protected _scales: IBaseScale[] = [];
|
||||
getScales() {
|
||||
return this._scales;
|
||||
@ -837,18 +843,27 @@ export abstract class CartesianAxis<T extends ICartesianAxisCommonSpec = ICartes
|
||||
});
|
||||
|
||||
// outBounds
|
||||
['x1', 'x2', 'y1', 'y2'].forEach(key => {
|
||||
if (this._lastComputeOutBounds[key] < this._layoutCache._lastComputeOutBounds[key]) {
|
||||
this._lastComputeOutBounds[key] = this._layoutCache._lastComputeOutBounds[key];
|
||||
} else {
|
||||
this._layoutCache._lastComputeOutBounds[key] = this._lastComputeOutBounds[key];
|
||||
}
|
||||
});
|
||||
if (this._autoIndentOnce && this._hasAutoIndent) {
|
||||
// use cache
|
||||
['x1', 'x2', 'y1', 'y2'].forEach(key => {
|
||||
this.getLastComputeOutBounds()[key] = this._layoutCache._lastComputeOutBounds[key];
|
||||
});
|
||||
} else {
|
||||
this._hasAutoIndent = true;
|
||||
['x1', 'x2', 'y1', 'y2'].forEach(key => {
|
||||
if (this.getLastComputeOutBounds()[key] < this._layoutCache._lastComputeOutBounds[key]) {
|
||||
this.getLastComputeOutBounds()[key] = this._layoutCache._lastComputeOutBounds[key];
|
||||
} else {
|
||||
this._layoutCache._lastComputeOutBounds[key] = this.getLastComputeOutBounds()[key];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
_clearLayoutCache() {
|
||||
this._hasAutoIndent = false;
|
||||
this._layoutCache.width = 0;
|
||||
this._layoutCache.height = 0;
|
||||
this._layoutCache._lastComputeOutBounds = { x1: 0, x2: 0, y1: 0, y2: 0 };
|
||||
|
@ -264,6 +264,10 @@ export abstract class DataFilterBaseComponent<T extends IDataFilterComponentSpec
|
||||
this._relatedAxisComponent = bandAxis;
|
||||
}
|
||||
}
|
||||
|
||||
if (this._relatedAxisComponent && this._filterMode === IFilterMode.axis) {
|
||||
(this._relatedAxisComponent as CartesianAxis<any>).autoIndentOnce = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected _setRegionsFromSpec() {
|
||||
|
Loading…
Reference in New Issue
Block a user