diff --git a/src/mol-plugin/behavior/dynamic/volume-streaming/behavior.ts b/src/mol-plugin/behavior/dynamic/volume-streaming/behavior.ts index 2ad87f7ff3b7a676dcd14d4d2298f06a267a7ecb..e7b357d9b7e3987edd704fcdd98559c4eed7bd73 100644 --- a/src/mol-plugin/behavior/dynamic/volume-streaming/behavior.ts +++ b/src/mol-plugin/behavior/dynamic/volume-streaming/behavior.ts @@ -22,6 +22,7 @@ import { VolumeServerHeader, VolumeServerInfo } from './model'; import { ButtonsType } from 'mol-util/input/input-observer'; import { PluginCommands } from 'mol-plugin/command'; import { StateSelection } from 'mol-state'; +import { Representation } from 'mol-repr/representation'; export class VolumeStreaming extends PluginStateObject.CreateBehavior<VolumeStreaming.Behavior>({ name: 'Volume Streaming' }) { } @@ -172,7 +173,21 @@ export namespace VolumeStreaming { } register(ref: string): void { - // this.ref = ref; + let lastLoci: Representation.Loci = Representation.Loci.Empty; + + this.subscribeObservable(this.plugin.events.state.object.removed, o => { + if (!PluginStateObject.Molecule.Structure.is(o.obj) || lastLoci.loci.kind !== 'element-loci') return; + if (lastLoci.loci.structure === o.obj.data) { + lastLoci = Representation.Loci.Empty; + } + }); + + this.subscribeObservable(this.plugin.events.state.object.updated, o => { + if (!PluginStateObject.Molecule.Structure.is(o.oldObj) || lastLoci.loci.kind !== 'element-loci') return; + if (lastLoci.loci.structure === o.oldObj.data) { + lastLoci = Representation.Loci.Empty; + } + }); this.subscribeObservable(this.plugin.behaviors.canvas3d.click, ({ current, buttons, modifiers }) => { if (buttons !== ButtonsType.Flag.Secondary || this.params.view.name !== 'selection-box') return; @@ -193,6 +208,13 @@ export namespace VolumeStreaming { const root = this.getStructureRoot(ref); if (!root || !root.obj || root.obj !== parent.obj) return; + if (Representation.Loci.areEqual(lastLoci, current)) { + lastLoci = Representation.Loci.Empty; + this.updateDynamicBox(ref, Box3D.empty()); + return; + } + lastLoci = current; + const loci = StructureElement.Loci.extendToWholeResidues(current.loci); const box = StructureElement.Loci.getBoundary(loci).box; this.updateDynamicBox(ref, box); diff --git a/src/mol-plugin/skin/base/components/temp.scss b/src/mol-plugin/skin/base/components/temp.scss index 8913fd5d31ccf465be9388fe3aa63820d001eac7..9d20d320fa4b0ca6cc344b6decb9b8b65a1ef6db 100644 --- a/src/mol-plugin/skin/base/components/temp.scss +++ b/src/mol-plugin/skin/base/components/temp.scss @@ -180,11 +180,15 @@ line-height: $row-height; float: left; margin-right: $control-spacing; - background-color: $msp-form-control-background; + + > button { + background-color: $msp-form-control-background; + } > select { display: inline-block; width: 200px; + margin-right: $control-spacing; } }