From d8f29ae466d3222a0a39081773b6df79263406bc Mon Sep 17 00:00:00 2001 From: Roman Rodionov Date: Mon, 14 Oct 2024 18:47:06 +0200 Subject: [PATCH] #5649 - Default values for bond settings (at least for bond) got corrupted and become wrong after ver 2.26 version installed (#5748) --- .../ketcher-core/src/utilities/SettingsManager.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/ketcher-core/src/utilities/SettingsManager.ts b/packages/ketcher-core/src/utilities/SettingsManager.ts index 3129277341..db10ea8400 100644 --- a/packages/ketcher-core/src/utilities/SettingsManager.ts +++ b/packages/ketcher-core/src/utilities/SettingsManager.ts @@ -56,9 +56,21 @@ export class SettingsManager { static getOptions(): SavedOptions { try { - return JSON.parse( + const optionsFromLocalStorage = JSON.parse( localStorage.getItem(KETCHER_SAVED_OPTIONS_KEY) || '{}', ); + + // In 2.25 default bondLength was set to 2.1 by mistake. + // Current code reset it to 40px + // Can be removed in future versions + if ( + optionsFromLocalStorage.bondLength === 2.1 && + optionsFromLocalStorage.bondLengthUnit === 'px' + ) { + optionsFromLocalStorage.bondLength = 40; + } + + return optionsFromLocalStorage; } catch (e) { KetcherLogger.error('SettingsManager.ts::SettingsManager::getOptions', e); return {} as SavedOptions;