Skip to content
Snippets Groups Projects
Commit 8214f0f9 authored by David Sehnal's avatar David Sehnal
Browse files

mol-plugin: UI tweak, remove dynamic density on "double click"

parent 1125c490
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
......@@ -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;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment