فهرست منبع

StructureSelectionManager.clear also clears selection history

David Sehnal 5 سال پیش
والد
کامیت
12bb283b97
2فایلهای تغییر یافته به همراه10 افزوده شده و 3 حذف شده
  1. 9 2
      src/mol-plugin-state/manager/structure/selection.ts
  2. 1 1
      src/mol-plugin-ui/structure/measurements.tsx

+ 9 - 2
src/mol-plugin-state/manager/structure/selection.ts

@@ -198,11 +198,17 @@ export class StructureSelectionManager extends StatefulPluginComponent<Structure
         this.events.additionsHistoryUpdated.next();
     }
 
+    private clearHistory() {
+        if (this.state.additionsHistory.length !== 0) {
+            this.state.additionsHistory = [];
+            this.events.additionsHistoryUpdated.next();
+        }
+    }
+
     private onRemove(ref: string) {
         if (this.entries.has(ref)) {
             this.entries.delete(ref);
-            // TODO: property update the latest loci
-            this.state.additionsHistory = [];
+            this.clearHistory();
             this.referenceLoci = undefined;
         }
     }
@@ -243,6 +249,7 @@ export class StructureSelectionManager extends StatefulPluginComponent<Structure
         this.state.stats = void 0;
         this.events.changed.next();
         this.events.loci.clear.next();
+        this.clearHistory();
         return selections;
     }
 

+ 1 - 1
src/mol-plugin-ui/structure/measurements.tsx

@@ -172,7 +172,7 @@ export class MeasurementControls extends PurePluginUIComponent<{}, { isBusy: boo
                 {entries}
             </div>}
             {entries.length === 0 && <div className='msp-control-offset msp-help-text'>
-                <div className='msp-help-description' style={{ padding: 0 }}><Icon svg={HelpOutline} inline />Add <ToggleSelectionModeButton /> one or more selections</div>
+                <div className='msp-help-description' style={{ padding: 0 }}><Icon svg={HelpOutline} inline />Add one or more selections <ToggleSelectionModeButton /></div>
             </div>}
         </>;
     }