From 8e1d44fabce5ca7e8483a413e19b268d568eeb10 Mon Sep 17 00:00:00 2001 From: Alexander Rose <alex.rose@rcsb.org> Date: Thu, 19 Sep 2019 18:33:44 -0700 Subject: [PATCH] fixes, seq wrapper mark every loci, binding docs & cleanup --- src/mol-plugin/behavior/dynamic/camera.ts | 2 +- src/mol-plugin/behavior/dynamic/representation.ts | 11 +++-------- .../structure-representation-interaction.ts | 2 +- .../behavior/dynamic/volume-streaming/behavior.ts | 2 +- src/mol-plugin/ui/sequence/wrapper.ts | 14 +++++++++----- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/mol-plugin/behavior/dynamic/camera.ts b/src/mol-plugin/behavior/dynamic/camera.ts index 6441b9518..bc60d3687 100644 --- a/src/mol-plugin/behavior/dynamic/camera.ts +++ b/src/mol-plugin/behavior/dynamic/camera.ts @@ -16,7 +16,7 @@ const M = ModifiersKeys const Trigger = Binding.Trigger const DefaultFocusLociBindings = { - clickCenterFocus: Binding(Trigger(B.Flag.Primary, M.create()), 'Center and focus the clicked element.'), + clickCenterFocus: Binding(Trigger(B.Flag.Primary, M.create()), 'Center and focus the clicked element using ${trigger}.'), } const FocusLociParams = { minRadius: PD.Numeric(8, { min: 1, max: 50, step: 1 }), diff --git a/src/mol-plugin/behavior/dynamic/representation.ts b/src/mol-plugin/behavior/dynamic/representation.ts index 488d2540a..6df35c239 100644 --- a/src/mol-plugin/behavior/dynamic/representation.ts +++ b/src/mol-plugin/behavior/dynamic/representation.ts @@ -66,11 +66,10 @@ export const HighlightLoci = PluginBehavior.create({ const DefaultSelectLociBindings = { clickSelect: Binding.Empty, - clickSelectExtend: Binding(Trigger(B.Flag.Primary, M.create({ shift: true })), 'Try to extend selection to clicked element along polymer.'), - clickSelectOnly: Binding(Trigger(B.Flag.Secondary, M.create({ control: true })), 'Select only the clicked element.'), - clickSelectToggle: Binding(Trigger(B.Flag.Primary, M.create({ control: true })), 'Toggle clicked element.'), + clickSelectExtend: Binding(Trigger(B.Flag.Primary, M.create({ shift: true })), 'Extend selection to clicked element along polymer using ${trigger}.'), + clickSelectOnly: Binding(Trigger(B.Flag.Secondary, M.create({ control: true })), 'Select only the clicked element using ${trigger}.'), + clickSelectToggle: Binding(Trigger(B.Flag.Primary, M.create({ control: true })), 'Toggle selection of clicked element using ${trigger}.'), clickDeselect: Binding.Empty, - clickDeselectAllOnEmpty: Binding(Trigger(B.Flag.Secondary, M.create({ control: true })), 'Clear the selection when the clicked element is empty.'), } const SelectLociParams = { bindings: PD.Value(DefaultSelectLociBindings, { isHidden: true }), @@ -120,10 +119,6 @@ export const SelectLoci = PluginBehavior.create({ if (Binding.match(this.params.bindings.clickDeselect, buttons, modifiers)) { this.ctx.interactivity.lociSelects.deselect(current) } - - if (Binding.match(this.params.bindings.clickDeselectAllOnEmpty, buttons, modifiers)) { - this.ctx.interactivity.lociSelects.deselectAllOnEmpty(current) - } }); this.ctx.interactivity.lociSelects.addProvider(this.lociMarkProvider) diff --git a/src/mol-plugin/behavior/dynamic/selection/structure-representation-interaction.ts b/src/mol-plugin/behavior/dynamic/selection/structure-representation-interaction.ts index 3bc669889..c794c2b0a 100644 --- a/src/mol-plugin/behavior/dynamic/selection/structure-representation-interaction.ts +++ b/src/mol-plugin/behavior/dynamic/selection/structure-representation-interaction.ts @@ -27,7 +27,7 @@ const M = ModifiersKeys const Trigger = Binding.Trigger const DefaultStructureRepresentationInteractionBindings = { - clickInteractionAroundOnly: Binding(Trigger(B.Flag.Secondary, M.create()), 'Show the structure interaction around only the clicked element.'), + clickInteractionAroundOnly: Binding(Trigger(B.Flag.Secondary, M.create()), 'Show the structure interaction around only the clicked element using ${trigger}.'), } const StructureRepresentationInteractionParams = { bindings: PD.Value(DefaultStructureRepresentationInteractionBindings, { isHidden: true }), diff --git a/src/mol-plugin/behavior/dynamic/volume-streaming/behavior.ts b/src/mol-plugin/behavior/dynamic/volume-streaming/behavior.ts index d29d5fe3b..51b37fede 100644 --- a/src/mol-plugin/behavior/dynamic/volume-streaming/behavior.ts +++ b/src/mol-plugin/behavior/dynamic/volume-streaming/behavior.ts @@ -50,7 +50,7 @@ export namespace VolumeStreaming { }; const DefaultBindings = { - clickVolumeAroundOnly: Binding(Trigger(B.Flag.Secondary, M.create()), 'Show the volume around only the clicked element.'), + clickVolumeAroundOnly: Binding(Trigger(B.Flag.Secondary, M.create()), 'Show the volume around only the clicked element using ${trigger}.'), } export function createParams(data?: VolumeServerInfo.Data, defaultView?: ViewTypes) { diff --git a/src/mol-plugin/ui/sequence/wrapper.ts b/src/mol-plugin/ui/sequence/wrapper.ts index 275b315a1..fb04fecf4 100644 --- a/src/mol-plugin/ui/sequence/wrapper.ts +++ b/src/mol-plugin/ui/sequence/wrapper.ts @@ -4,8 +4,8 @@ * @author Alexander Rose <alexander.rose@weirdbyte.de> */ -import { OrderedSet } from '../../../mol-data/int'; -import { Loci } from '../../../mol-model/loci'; +import { OrderedSet, Interval } from '../../../mol-data/int'; +import { Loci, isEveryLoci } from '../../../mol-model/loci'; import { MarkerAction, applyMarkerAction } from '../../../mol-util/marker-action'; import { StructureElement, Structure, Unit } from '../../../mol-model/structure'; import { Color } from '../../../mol-util/color'; @@ -22,9 +22,13 @@ abstract class SequenceWrapper<D> { abstract getLoci(seqIdx: number): StructureElement.Loci markResidue(loci: Loci, action: MarkerAction) { - return this.eachResidue(loci, (set: OrderedSet) => { - return applyMarkerAction(this.markerArray, set, action) - }) + if (isEveryLoci(loci)) { + return applyMarkerAction(this.markerArray, Interval.ofLength(this.length), action) + } else { + return this.eachResidue(loci, (set: OrderedSet) => { + return applyMarkerAction(this.markerArray, set, action) + }) + } } constructor(readonly data: D, readonly markerArray: Uint8Array, readonly length: number) { -- GitLab