Skip to content

Commit

Permalink
Backmerge: #4740 - Delete of cycled sequnece from the canvas causes d…
Browse files Browse the repository at this point in the history
…elete of another cycled sequence bond that makes it non-cycled (#4762)

- skip handling of adding/deleteing phosphates and establishing bonds if selection if on the bound of chain
  • Loading branch information
rrodionov91 authored Jun 6, 2024
1 parent d86e93f commit b0ea8c2
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,8 @@ export class SequenceMode extends BaseMode {
const nodeAfterSelection = SequenceRenderer.getNextNode(selectionEndNode);
const nodeInSameChainBeforeSelection =
SequenceRenderer.getPreviousNodeInSameChain(selectionStartNode);
const nodeInSameChainAfterSelection =
SequenceRenderer.getNextNodeInSameChain(selectionEndNode);

if (
!nodeInSameChainBeforeSelection &&
Expand All @@ -553,9 +555,10 @@ export class SequenceMode extends BaseMode {
}

if (
nodeBeforeSelection === nodeInSameChainBeforeSelection &&
nodeBeforeSelection instanceof Nucleotide &&
!(nodeAfterSelection instanceof Nucleotide) &&
!(nodeAfterSelection instanceof Nucleoside)
!(nodeInSameChainAfterSelection instanceof Nucleotide) &&
!(nodeInSameChainAfterSelection instanceof Nucleoside)
) {
// delete phosphate from last nucleotide
modelChanges.merge(
Expand All @@ -569,7 +572,10 @@ export class SequenceMode extends BaseMode {

if (
!nodeAfterSelection ||
nodeAfterSelection instanceof EmptySequenceNode
nodeAfterSelection instanceof EmptySequenceNode ||
(!this.isEditMode &&
(nodeAfterSelection !== nodeInSameChainAfterSelection ||
nodeBeforeSelection !== nodeInSameChainBeforeSelection))
) {
return;
}
Expand Down

0 comments on commit b0ea8c2

Please sign in to comment.