private syncPercentageMode(priceScale: PriceScale, hasPercentageComparison: boolean): void {
if (this.restoringInitialIndicators) {
this.hasPercentageComparison = hasPercentageComparison;
return;
}
if (this.hasPercentageComparison === hasPercentageComparison) {
return;
}
const hadPercentageComparison = this.hasPercentageComparison;
this.hasPercentageComparison = hasPercentageComparison;
if (hasPercentageComparison && !hadPercentageComparison) {
priceScale.setMode(PriceScaleMode.Percentage);
return;
}
if (!hasPercentageComparison && hadPercentageComparison && priceScale.getMode() === PriceScaleMode.Percentage) {
priceScale.setMode(PriceScaleMode.Normal);
}
}