@molstudio/core 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MolStudio.js +9 -2
- package/package.json +1 -1
package/dist/MolStudio.js
CHANGED
|
@@ -70,7 +70,10 @@ export class MolStudio {
|
|
|
70
70
|
}));
|
|
71
71
|
}
|
|
72
72
|
static async create(target) {
|
|
73
|
-
const
|
|
73
|
+
const spec = DefaultPluginSpec();
|
|
74
|
+
// Mol*'s "auto" mode renders at 1x on mobile browsers, which blurs structures on high-DPI phones.
|
|
75
|
+
spec.config = [...(spec.config ?? []), [PluginConfig.General.ResolutionMode, "native"]];
|
|
76
|
+
const plugin = new PluginContext(spec);
|
|
74
77
|
await plugin.init();
|
|
75
78
|
// Only the pLDDT theme is needed; Mol*'s quality-assessment behaviour also pulls in its React UI.
|
|
76
79
|
plugin.representation.structure.themes.colorThemeRegistry.add(PLDDTConfidenceColorThemeProvider);
|
|
@@ -219,7 +222,11 @@ export class MolStudio {
|
|
|
219
222
|
}
|
|
220
223
|
async applyStructurePreset(raw, format) {
|
|
221
224
|
const trajectory = await this.plugin.builders.structure.parseTrajectory(raw, format);
|
|
222
|
-
await this.plugin.builders.structure.hierarchy.applyPreset(trajectory, "default");
|
|
225
|
+
const result = await this.plugin.builders.structure.hierarchy.applyPreset(trajectory, "default");
|
|
226
|
+
// Mol* parses some malformed input (e.g. text that is not SDF) into an empty structure without failing.
|
|
227
|
+
if (!result?.structure.data?.elementCount) {
|
|
228
|
+
throw new Error(`The ${format} data contains no atoms.`);
|
|
229
|
+
}
|
|
223
230
|
}
|
|
224
231
|
async applyVolumeVisuals(raw, format) {
|
|
225
232
|
const provider = this.plugin.dataFormats.get(format);
|