From 04de54d946f268a4d9d864e578c387a313de66c1 Mon Sep 17 00:00:00 2001 From: Acylation <532117255@qq.com> Date: Fri, 2 Feb 2024 16:55:21 +0800 Subject: [PATCH] Add options for explicit hydrogen --- src/lib/translations/en.json | 4 ++++ src/lib/translations/zh-CN.json | 4 ++++ src/settings/SettingTab.ts | 19 +++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/src/lib/translations/en.json b/src/lib/translations/en.json index 23d24f6..eb6bba5 100644 --- a/src/lib/translations/en.json +++ b/src/lib/translations/en.json @@ -55,6 +55,10 @@ "terminal-carbons": { "name": "Show terminal carbons", "description": "Explictly draw terminal carbons like methyl or methylene." + }, + "explicit-hydrogen": { + "name": "Explicit hydrogen", + "description": "Enable to show explicit hydrogen." } }, "copy": { diff --git a/src/lib/translations/zh-CN.json b/src/lib/translations/zh-CN.json index 33c6d95..6e68ec1 100644 --- a/src/lib/translations/zh-CN.json +++ b/src/lib/translations/zh-CN.json @@ -55,6 +55,10 @@ "terminal-carbons": { "name": "端基碳", "description": "显式绘出末端甲基、亚甲基等端基碳。" + }, + "explicit-hydrogen": { + "name": "显式氢", + "description": "启用以绘制显式氢原子。" } }, "copy": { diff --git a/src/settings/SettingTab.ts b/src/settings/SettingTab.ts index c5748a6..c5b73ac 100644 --- a/src/settings/SettingTab.ts +++ b/src/settings/SettingTab.ts @@ -181,6 +181,25 @@ export class ChemSettingTab extends PluginSettingTab { }) ); + new Setting(containerEl) + .setName(i18n.t('settings.advanced.explicit-hydrogen.name')) + .setDesc(i18n.t('settings.advanced.explicit-hydrogen.description')) + .addToggle((toggle) => + toggle + .setValue( + this.plugin.settings.options?.explicitHydrogens ?? false + ) + .onChange(async (value) => { + this.plugin.settings.options.explicitHydrogens = value; + await this.plugin.saveSettings(); + setDrawer({ + ...DEFAULT_SD_OPTIONS, + ...this.plugin.settings.options, + }); + onSettingsChange(); + }) + ); + new Setting(containerEl) .setName(i18n.t('settings.copy.title')) .setHeading();