Compare commits

...

1 Commits

Author SHA1 Message Date
Alexander Rose
ba944769f5 Add loadUrl method and GET params to Viewer app 2026-06-06 08:38:54 -07:00
3 changed files with 18 additions and 1 deletions

View File

@@ -22,6 +22,7 @@ Note that since we don't clearly distinguish between a public and private interf
- Fix SSAO half/quarter resolution textures for multi-scale
- Non-covalent interactions: water bridge support
- Download Structure From AlphaFoldDB allows IDs with version suffix (version is ignored)
- Add `loadUrl` method and GET params to Viewer app
## [v5.9.0] - 2026-05-03
- Fix edge case when `PluginSpec.animations` is empty

View File

@@ -14,7 +14,7 @@ import { MVSData } from '../../extensions/mvs/mvs-data';
import { StringLike } from '../../mol-io/common/string-like';
import { Structure, StructureElement } from '../../mol-model/structure';
import { Volume } from '../../mol-model/volume';
import { OpenFiles } from '../../mol-plugin-state/actions/file';
import { DownloadFile, OpenFiles } from '../../mol-plugin-state/actions/file';
import { DownloadStructure, PdbDownloadProvider } from '../../mol-plugin-state/actions/structure';
import { DownloadDensity } from '../../mol-plugin-state/actions/volume';
import { PresetTrajectoryHierarchy } from '../../mol-plugin-state/builder/structure/hierarchy-preset';
@@ -523,6 +523,17 @@ export class Viewer {
}
}
loadUrl(url: string, format: string, isBinary = false) {
return this.plugin.runTask(Task.create('Load URL', async taskCtx => {
await this.plugin.state.data.applyAction(DownloadFile, {
url: Asset.Url(url),
format,
isBinary,
visuals: true
}).runInContext(taskCtx);
}));
}
handleResize() {
this.plugin.layout.events.updated.next(void 0);
}

View File

@@ -129,6 +129,11 @@
var modelArchive = getParam('model-archive', '[^&]+').trim();
if (modelArchive) viewer.loadModelArchive(modelArchive);
var url = getParam('url', '[^&]+').trim();
var urlFormat = getParam('url-format', '[^&]+').trim() || undefined;
var urlIsBinary = getParam('url-is-binary', '[^&]+').trim() === '1';
if (url && urlFormat) viewer.loadUrl(url, urlFormat, urlIsBinary);
window.addEventListener('unload', () => {
// to aid GC
viewer.dispose();