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

mol-plugin: structure selection fix

parent 3d4f40f6
No related branches found
No related tags found
No related merge requests found
...@@ -77,12 +77,17 @@ class StructureElementSelectionManager { ...@@ -77,12 +77,17 @@ class StructureElementSelectionManager {
} }
if (!e) return; if (!e) return;
const predIdx = OrderedSet.findPredecessorIndex(e.indices, OrderedSet.min(xs.indices)); let predIdx = OrderedSet.findPredecessorIndex(e.indices, OrderedSet.min(xs.indices));
if (predIdx === 0) return; if (predIdx === 0) return;
const fst = predIdx < OrderedSet.size(e.indices) let fst;
? OrderedSet.getAt(e.indices, predIdx)
: OrderedSet.getAt(e.indices, predIdx - 1) + 1 as StructureElement.UnitIndex; if (predIdx < OrderedSet.size(e.indices)) {
fst = OrderedSet.getAt(e.indices, predIdx)
if (fst > OrderedSet.min(xs.indices)) fst = OrderedSet.getAt(e.indices, predIdx - 1) + 1 as StructureElement.UnitIndex;
} else {
fst = OrderedSet.getAt(e.indices, predIdx - 1) + 1 as StructureElement.UnitIndex;
}
return StructureElement.Loci(entry.selection.structure, [{ return StructureElement.Loci(entry.selection.structure, [{
unit: e.unit, unit: e.unit,
......
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