Browse Source

consolidate label name

Yana Rose 1 year ago
parent
commit
787ad6c8b0
2 changed files with 5 additions and 5 deletions
  1. 4 4
      src/viewer/helpers/model.ts
  2. 1 1
      src/viewer/index.ts

+ 4 - 4
src/viewer/helpers/model.ts

@@ -16,16 +16,16 @@ import { StateObjectRef } from 'molstar/lib/mol-state';
 import { ModelExport } from 'molstar/lib/extensions/model-export/export';
 
 export class ModelLoader {
-    async load<P = any, S = {}>(load: LoadParams, props?: PresetProps & { structureLabel?: string }, matrix?: Mat4, reprProvider?: TrajectoryHierarchyPresetProvider<P, S>, params?: P) {
+    async load<P = any, S = {}>(load: LoadParams, props?: PresetProps & { dataLabel?: string }, matrix?: Mat4, reprProvider?: TrajectoryHierarchyPresetProvider<P, S>, params?: P) {
         const { fileOrUrl, format, isBinary } = load;
 
         const data = fileOrUrl instanceof File
-            ? (await this.plugin.builders.data.readFile({ file: Asset.File(fileOrUrl), isBinary, label: props?.structureLabel })).data
-            : await this.plugin.builders.data.download({ url: fileOrUrl, isBinary, label: props?.structureLabel });
+            ? (await this.plugin.builders.data.readFile({ file: Asset.File(fileOrUrl), isBinary, label: props?.dataLabel })).data
+            : await this.plugin.builders.data.download({ url: fileOrUrl, isBinary, label: props?.dataLabel });
 
         const hierarchy = await this.handleTrajectory<P, S>(data, format, props, matrix, reprProvider, params) as any;
         const structureCell = StateObjectRef.resolveAndCheck(this.plugin.state.data, hierarchy.structure);
-        ModelExport.setStructureName(structureCell?.obj?.data, props?.structureLabel || '');
+        ModelExport.setStructureName(structureCell?.obj?.data, props?.dataLabel || '');
 
         return hierarchy;
     }

+ 1 - 1
src/viewer/index.ts

@@ -297,7 +297,7 @@ export class Viewer {
         return out;
     }
 
-    loadStructureFromUrl<P, S>(url: string, format: BuiltInTrajectoryFormat, isBinary: boolean, config?: {props?: PresetProps & { structureLabel?: string }; matrix?: Mat4; reprProvider?: TrajectoryHierarchyPresetProvider<P, S>, params?: P}) {
+    loadStructureFromUrl<P, S>(url: string, format: BuiltInTrajectoryFormat, isBinary: boolean, config?: {props?: PresetProps & { dataLabel?: string }; matrix?: Mat4; reprProvider?: TrajectoryHierarchyPresetProvider<P, S>, params?: P}) {
         return this.customState.modelLoader.load({ fileOrUrl: url, format, isBinary }, config?.props, config?.matrix, config?.reprProvider, config?.params);
     }