-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsettings-tab.ts
More file actions
137 lines (121 loc) · 4.71 KB
/
Copy pathsettings-tab.ts
File metadata and controls
137 lines (121 loc) · 4.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
import { type App, PluginSettingTab, Setting } from 'obsidian';
import type Mols2BasesPlugin from './main';
export class Mols2BasesSettingTab extends PluginSettingTab {
plugin: Mols2BasesPlugin;
constructor(app: App, plugin: Mols2BasesPlugin) {
super(app, plugin);
this.plugin = plugin;
}
display(): void {
const { containerEl } = this;
containerEl.empty();
// --- Rendering ---
new Setting(containerEl).setName('Rendering').setHeading();
new Setting(containerEl)
.setName('Remove hydrogens')
.setDesc('Strip hydrogen atoms from molecules before rendering.')
.addToggle((toggle) =>
toggle.setValue(this.plugin.settings.removeHs).onChange(async (value) => {
this.plugin.settings.removeHs = value;
await this.plugin.saveSettings();
}),
);
new Setting(containerEl)
.setName('Use original coordinates')
.setDesc('Use coordinates from the input data. When off, generates clean 2D layouts.')
.addToggle((toggle) =>
toggle.setValue(this.plugin.settings.useCoords).onChange(async (value) => {
this.plugin.settings.useCoords = value;
await this.plugin.saveSettings();
}),
);
new Setting(containerEl)
.setName('Bond line width')
.setDesc('Thickness of bonds in molecule depictions.')
.addText((text) =>
text.setValue(String(this.plugin.settings.bondLineWidth)).onChange(async (value) => {
const num = parseFloat(value);
if (!Number.isNaN(num) && num > 0) {
this.plugin.settings.bondLineWidth = num;
await this.plugin.saveSettings();
}
}),
);
new Setting(containerEl)
.setName('Transparent background')
.setDesc('Remove white background from molecule SVGs. Works better with dark themes.')
.addToggle((toggle) =>
toggle.setValue(this.plugin.settings.transparentBg).onChange(async (value) => {
this.plugin.settings.transparentBg = value;
await this.plugin.saveSettings();
}),
);
new Setting(containerEl)
.setName('Comic mode')
.setDesc('Hand-drawn style molecule rendering.')
.addToggle((toggle) =>
toggle.setValue(this.plugin.settings.comicMode).onChange(async (value) => {
this.plugin.settings.comicMode = value;
await this.plugin.saveSettings();
}),
);
new Setting(containerEl)
.setName('Lazy render molecules')
.setDesc(
'Only render molecule images when they scroll into view. Improves performance for large datasets.',
)
.addToggle((toggle) =>
toggle.setValue(this.plugin.settings.lazyRender).onChange(async (value) => {
this.plugin.settings.lazyRender = value;
await this.plugin.saveSettings();
}),
);
// --- Search ---
new Setting(containerEl).setName('Search').setHeading();
new Setting(containerEl)
.setName('Highlight all SMARTS matches')
.setDesc(
'Highlight all substructure matches in a molecule. When off, only the first match is highlighted.',
)
.addToggle((toggle) =>
toggle.setValue(this.plugin.settings.smartsMatchAll).onChange(async (value) => {
this.plugin.settings.smartsMatchAll = value;
await this.plugin.saveSettings();
}),
);
new Setting(containerEl)
.setName('Align on SMARTS search')
.setDesc(
'Align molecules to the matched substructure for consistent orientation during SMARTS search.',
)
.addToggle((toggle) =>
toggle.setValue(this.plugin.settings.alignOnSmarts).onChange(async (value) => {
this.plugin.settings.alignOnSmarts = value;
await this.plugin.saveSettings();
}),
);
new Setting(containerEl)
.setName('Search delay (ms)')
.setDesc('Debounce delay for search input. Increase for large datasets.')
.addText((text) =>
text.setValue(String(this.plugin.settings.searchDelay)).onChange(async (value) => {
const num = parseInt(value, 10);
if (!Number.isNaN(num) && num >= 0) {
this.plugin.settings.searchDelay = num;
await this.plugin.saveSettings();
}
}),
);
// --- Import ---
new Setting(containerEl).setName('Import').setHeading();
new Setting(containerEl)
.setName('Store MOL block in frontmatter')
.setDesc('Include the full MOL block when importing SDF files. SMILES are always stored.')
.addToggle((toggle) =>
toggle.setValue(this.plugin.settings.storeMolblock).onChange(async (value) => {
this.plugin.settings.storeMolblock = value;
await this.plugin.saveSettings();
}),
);
}
}