Browse Source

multiple selection bug fix

bioinsilico 3 years ago
parent
commit
a93910c93a
3 changed files with 7 additions and 3 deletions
  1. 4 0
      CHANGELOG.md
  2. 1 1
      package.json
  3. 2 2
      src/viewer/helpers/viewer.ts

+ 4 - 0
CHANGELOG.md

@@ -2,6 +2,10 @@
 
 [Semantic Versioning](https://semver.org/)
 
+## [1.6.1] - 2021-05-04
+### Bug fixes
+- Multiple region selection (only last one was selected) bug fixed
+
 ## [1.6.0] - 2021-05-03
 ### Viewer class new methods
 - Added new methods for selection, creating components and focus

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
     "name": "@rcsb/rcsb-molstar",
-    "version": "1.6.0",
+    "version": "1.6.1",
     "description": "RCSB PDB apps and props based on Mol*.",
     "homepage": "https://github.com/rcsb/rcsb-molstar#readme",
     "repository": {

+ 2 - 2
src/viewer/helpers/viewer.ts

@@ -18,13 +18,13 @@ import {StructureSelectionQuery} from 'molstar/lib/mol-plugin-state/helpers/stru
 export namespace ViewerMethods {
 
     export function selectMultipleSegments(plugin: PluginContext, selection: Array<{modelId: string; asymId: string; begin: number; end: number;}>, mode: 'select'|'hover', modifier: 'add'|'set' ): void {
-        if(mode === 'select'){
+        if(modifier === 'set'){
             selection.forEach(sel=>{
                 clearSelection(plugin, mode, {modelId: sel.modelId, labelAsymId: sel.asymId});
             });
         }
         selection.forEach(sel=>{
-            selectSegment(plugin, sel.modelId, sel.asymId, sel.begin, sel.end, mode, modifier);
+            selectSegment(plugin, sel.modelId, sel.asymId, sel.begin, sel.end, mode, 'add');
         });
     }