private syncPercentageMode(
priceScale: PriceScale,
shouldEnablePercentageMode: boolean,
): void {
if (this.restoringInitialIndicators) {
this.percentageComparisonActive = shouldEnablePercentageMode;
return;
}
if (this.percentageComparisonActive === shouldEnablePercentageMode) {
return;
}
this.percentageComparisonActive = shouldEnablePercentageMode;
if (shouldEnablePercentageMode) {
priceScale.setMode(PriceScaleMode.Percentage);
return;
}
if (priceScale.getMode() === PriceScaleMode.Percentage) {
priceScale.setMode(PriceScaleMode.Normal);
}
}