Explorar el Código

hide density toast upon first selection

JonStargaryen hace 4 años
padre
commit
ad255827d0
Se han modificado 1 ficheros con 8 adiciones y 0 borrados
  1. 8 0
      src/viewer/helpers/preset.ts

+ 8 - 0
src/viewer/helpers/preset.ts

@@ -21,6 +21,8 @@ import { ViewerState } from '../types';
 import { StateSelection } from 'molstar/lib/mol-state';
 import { VolumeStreaming } from 'molstar/lib/mol-plugin/behavior/dynamic/volume-streaming/behavior';
 import { PluginCommands } from 'molstar/lib/mol-plugin/commands';
+import { InteractivityManager } from 'molstar/lib/mol-plugin-state/manager/interactivity';
+import { PluginCommand } from 'molstar/lib/mol-plugin/command';
 
 type Target = {
     readonly auth_seq_id?: number
@@ -167,6 +169,12 @@ export const RcsbPreset = TrajectoryHierarchyPresetProvider({
                 volume: false
             })
 
+            plugin.behaviors.interaction.click.subscribe((e: InteractivityManager.ClickEvent) => {
+                if(e.current && e.current.loci && e.current.loci.kind !== 'empty-loci'){
+                    PluginCommands.Toast.Hide(plugin, { key: 'toast-density' });
+                }
+            });
+
             await PluginCommands.Toast.Show(plugin, {
                 title: 'Electron Density',
                 message: 'Click on a residue to display electron density, click background to reset.',