Browse Source

fix StateTreeNode display bug

David Sehnal 5 years ago
parent
commit
38be00c0b7

+ 2 - 2
src/mol-plugin-state/builder/structure.ts

@@ -66,10 +66,10 @@ export class StructureBuilder {
         return model.selector;
     }
 
-    async insertModelProperties(model: StateObjectRef<SO.Molecule.Model>, params?: StateTransformer.Params<StateTransforms['Model']['CustomModelProperties']>) {
+    async insertModelProperties(model: StateObjectRef<SO.Molecule.Model>, params?: StateTransformer.Params<StateTransforms['Model']['CustomModelProperties']>, initialState?: Partial<StateTransform.State>) {
         const state = this.dataState;
         const props = state.build().to(model)
-            .apply(StateTransforms.Model.CustomModelProperties, params);
+            .apply(StateTransforms.Model.CustomModelProperties, params, { state: initialState });
         await this.plugin.updateDataState(props, { revertOnError: true });
         return props.selector;
     }

+ 2 - 2
src/mol-plugin-state/builder/structure/hierarchy-preset.ts

@@ -84,8 +84,8 @@ const allModels = TrajectoryHierarchyPresetProvider({
         const models = [], structures = [];
 
         for (let i = 0; i < tr.length; i++) {
-            const model = await builder.createModel(trajectory, { modelIndex: i }, { isCollapsed: true });
-            const modelProperties = await builder.insertModelProperties(model, params.modelProperties);
+            const model = await builder.createModel(trajectory, { modelIndex: i });
+            const modelProperties = await builder.insertModelProperties(model, params.modelProperties, { isCollapsed: true });
             const structure = await builder.createStructure(modelProperties || model, { name: 'deposited', params: {} });
             const structureProperties = await builder.insertStructureProperties(structure, params.structureProperties);
 

+ 1 - 1
src/mol-plugin-state/formats/trajectory.ts

@@ -36,7 +36,7 @@ export const MmcifProvider: TrajectoryFormatProvider = {
             .apply(StateTransforms.Data.ParseCif, void 0, { state: { isGhost: true } })
         const trajectory = cif.apply(StateTransforms.Model.TrajectoryFromMmCif, void 0, { tags: params?.trajectoryTags })
         await plugin.updateDataState(trajectory, { revertOnError: true });
-        if (cif.selector.cell?.obj?.data.blocks.length || 0 > 1) {
+        if ((cif.selector.cell?.obj?.data.blocks.length || 0) > 1) {
             plugin.state.data.updateCellState(cif.ref, { isGhost: false });
         }
         return { trajectory: trajectory.selector };

+ 2 - 2
src/mol-plugin-ui/state/tree.tsx

@@ -108,9 +108,9 @@ class StateTreeNode extends PluginUIComponent<{ cell: StateObjectCell, depth: nu
 
         if (!showLabel) {
             if (children.size === 0) return null;
-            return <div style={{ display: cellState.isCollapsed ? 'none' : 'block' }}>
+            return <>
                 {children.map(c => <StateTreeNode cell={cell.parent.cells.get(c!)!} key={c} depth={this.props.depth} />)}
-            </div>;
+            </>;
         }
 
         const newDepth = this.props.depth + 1;

+ 0 - 2
src/mol-util/color/palette.ts

@@ -64,8 +64,6 @@ export function getPalette(count: number, props: PaletteProps) {
         const { list, minLabel, maxLabel } = props.palette.params
         const domain: [number, number] = [0, count - 1]
 
-        console.log(list.colors);
-
         let colors = list.colors;
         if (colors.length === 0) colors = getColorListFromName(DefaultGetPaletteProps.colorList).list