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

removed LociHighligh command extend

parent 4d5d9be3
Branches
No related tags found
No related merge requests found
...@@ -258,12 +258,8 @@ class StructureComponentGroup extends PurePluginUIComponent<{ group: StructureCo ...@@ -258,12 +258,8 @@ class StructureComponentGroup extends PurePluginUIComponent<{ group: StructureCo
highlight = (e: React.MouseEvent<HTMLElement>) => { highlight = (e: React.MouseEvent<HTMLElement>) => {
e.preventDefault(); e.preventDefault();
PluginCommands.State.Highlight(this.plugin, { state: this.props.group[0].cell.parent, ref: this.props.group[0].cell.transform.ref });
let first = true;
for (const c of this.props.group) { for (const c of this.props.group) {
if (first) { first = false; continue; } PluginCommands.State.Highlight(this.plugin, { state: c.cell.parent, ref: c.cell.transform.ref });
PluginCommands.State.Highlight(this.plugin, { state: c.cell.parent, ref: c.cell.transform.ref, extend: true });
} }
} }
......
...@@ -104,16 +104,14 @@ function setVisibilityVisitor(t: StateTransform, tree: StateTree, ctx: { state: ...@@ -104,16 +104,14 @@ function setVisibilityVisitor(t: StateTransform, tree: StateTree, ctx: { state:
} }
export function Highlight(ctx: PluginContext) { export function Highlight(ctx: PluginContext) {
PluginCommands.State.Highlight.subscribe(ctx, ({ state, ref, extend }) => { PluginCommands.State.Highlight.subscribe(ctx, ({ state, ref }) => {
const cell = state.select(ref)[0]; const cell = state.select(ref)[0];
if (!cell) return; if (!cell) return;
if (SO.Molecule.Structure.is(cell.obj)) { if (SO.Molecule.Structure.is(cell.obj)) {
if (extend) ctx.managers.interactivity.lociHighlights.highlightOnlyExtend({ loci: Structure.Loci(cell.obj.data) }, false); ctx.managers.interactivity.lociHighlights.highlightOnly({ loci: Structure.Loci(cell.obj.data) }, false);
else ctx.managers.interactivity.lociHighlights.highlightOnly({ loci: Structure.Loci(cell.obj.data) }, false);
} else if (cell && SO.isRepresentation3D(cell.obj)) { } else if (cell && SO.isRepresentation3D(cell.obj)) {
const { repr } = cell.obj.data const { repr } = cell.obj.data
if (extend) ctx.managers.interactivity.lociHighlights.highlightOnlyExtend({ loci: repr.getLoci(), repr }, false); ctx.managers.interactivity.lociHighlights.highlightOnly({ loci: repr.getLoci(), repr }, false);
else ctx.managers.interactivity.lociHighlights.highlightOnly({ loci: repr.getLoci(), repr }, false);
} else if (SO.Molecule.Structure.Selections.is(cell.obj)) { } else if (SO.Molecule.Structure.Selections.is(cell.obj)) {
ctx.managers.interactivity.lociHighlights.clearHighlights(); ctx.managers.interactivity.lociHighlights.clearHighlights();
for (const entry of cell.obj.data) { for (const entry of cell.obj.data) {
......
...@@ -24,7 +24,7 @@ export const PluginCommands = { ...@@ -24,7 +24,7 @@ export const PluginCommands = {
ToggleExpanded: PluginCommand<{ state: State, ref: StateTransform.Ref }>(), ToggleExpanded: PluginCommand<{ state: State, ref: StateTransform.Ref }>(),
ToggleVisibility: PluginCommand<{ state: State, ref: StateTransform.Ref }>(), ToggleVisibility: PluginCommand<{ state: State, ref: StateTransform.Ref }>(),
Highlight: PluginCommand<{ state: State, ref: StateTransform.Ref, extend?: boolean }>(), Highlight: PluginCommand<{ state: State, ref: StateTransform.Ref }>(),
ClearHighlight: PluginCommand<{ state: State, ref: StateTransform.Ref }>(), ClearHighlight: PluginCommand<{ state: State, ref: StateTransform.Ref }>(),
Snapshots: { Snapshots: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment