Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#4636 - In the Sequence mode, when selecting elements on the canvas, the total number of elements is not displayed in the Right-click menu #4808

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ const generateLabeledNodes = (
return labeledNodes;
};

function isNucleotideNucleosideOrPhosphate(selection: NodeSelection): boolean {
const { node } = selection;
return (
node instanceof Nucleotide ||
node instanceof Nucleoside ||
node?.monomer instanceof Phosphate
);
}

// Generate menu title if selected:
// one nucleotide
// one nucleoside
Expand Down Expand Up @@ -112,6 +121,11 @@ export const generateSequenceContextMenuProps = (
isSelectedOnlyNucleoelements = false;
}
}
if (countOfSelections > countOfNucleoelements) {
if (!selectionsFlatten.every(isNucleotideNucleosideOrPhosphate)) {
isSelectedOnlyNucleoelements = false;
}
}

// Set title based on selected elements
if (
Expand Down
Loading