Skip to content

Commit 85a07c4

Browse files
authored
Add options for explicit hydrogen (#58)
1 parent 2612039 commit 85a07c4

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

src/lib/translations/en.json

+4
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@
5555
"terminal-carbons": {
5656
"name": "Show terminal carbons",
5757
"description": "Explictly draw terminal carbons like methyl or methylene."
58+
},
59+
"explicit-hydrogen": {
60+
"name": "Explicit hydrogen",
61+
"description": "Enable to show explicit hydrogen."
5862
}
5963
},
6064
"copy": {

src/lib/translations/zh-CN.json

+4
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@
5555
"terminal-carbons": {
5656
"name": "端基碳",
5757
"description": "显式绘出末端甲基、亚甲基等端基碳。"
58+
},
59+
"explicit-hydrogen": {
60+
"name": "显式氢",
61+
"description": "启用以绘制显式氢原子。"
5862
}
5963
},
6064
"copy": {

src/settings/SettingTab.ts

+19
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,25 @@ export class ChemSettingTab extends PluginSettingTab {
181181
})
182182
);
183183

184+
new Setting(containerEl)
185+
.setName(i18n.t('settings.advanced.explicit-hydrogen.name'))
186+
.setDesc(i18n.t('settings.advanced.explicit-hydrogen.description'))
187+
.addToggle((toggle) =>
188+
toggle
189+
.setValue(
190+
this.plugin.settings.options?.explicitHydrogens ?? false
191+
)
192+
.onChange(async (value) => {
193+
this.plugin.settings.options.explicitHydrogens = value;
194+
await this.plugin.saveSettings();
195+
setDrawer({
196+
...DEFAULT_SD_OPTIONS,
197+
...this.plugin.settings.options,
198+
});
199+
onSettingsChange();
200+
})
201+
);
202+
184203
new Setting(containerEl)
185204
.setName(i18n.t('settings.copy.title'))
186205
.setHeading();

0 commit comments

Comments
 (0)