Skip to content

Commit 1ea0e37

Browse files
committed
fixed ruler selection
1 parent fd4a96f commit 1ea0e37

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

ui/js/sealionviewer.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@
902902
let lo = Math.max(0, Math.min(a, b));
903903
let hi = Math.min((this.colOffsets && this.colOffsets.length > 0) ? this.colOffsets.length - 2 : Math.max(0, (a + b)), Math.max(a, b));
904904

905-
if (this.codonMode || this.aminoAcidMode) {
905+
if (this.displayMode === 'codon' || this.displayMode === 'translate') {
906906
lo = this.snapToCodonStart(lo);
907907
hi = this.snapToCodonEnd(hi);
908908
}
@@ -915,7 +915,7 @@
915915
let lo = Math.max(0, Math.min(a, b));
916916
let hi = Math.min((this.colOffsets && this.colOffsets.length > 0) ? this.colOffsets.length - 2 : Math.max(0, (a + b)), Math.max(a, b));
917917

918-
if (this.codonMode || this.aminoAcidMode) {
918+
if (this.displayMode === 'codon' || this.displayMode === 'translate') {
919919
lo = this.snapToCodonStart(lo);
920920
hi = this.snapToCodonEnd(hi);
921921
}
@@ -925,7 +925,7 @@
925925
this.expandColSelectionToInclude = (newPos) => {
926926
// Expand column selection to include newPos
927927
if (this.selectedCols.size === 0) {
928-
if (this.codonMode || this.aminoAcidMode) {
928+
if (this.displayMode === 'codon' || this.displayMode === 'translate') {
929929
const start = this.snapToCodonStart(newPos);
930930
const end = this.snapToCodonEnd(newPos);
931931
for (let c = start; c <= end; c++) this.selectedCols.add(c);
@@ -939,7 +939,7 @@
939939
let lo = Math.max(0, Math.min(currentMin, newPos));
940940
let hi = Math.min((this.colOffsets && this.colOffsets.length > 0) ? this.colOffsets.length - 2 : Math.max(0, currentMax), Math.max(currentMax, newPos));
941941

942-
if (this.codonMode || this.aminoAcidMode) {
942+
if (this.displayMode === 'codon' || this.displayMode === 'translate') {
943943
lo = this.snapToCodonStart(lo);
944944
hi = this.snapToCodonEnd(hi);
945945
}
@@ -956,7 +956,7 @@
956956
let chi = Math.min((this.colOffsets && this.colOffsets.length > 0) ? this.colOffsets.length - 2 : Math.max(c0, c1), Math.max(c0, c1));
957957

958958
// Snap to codon boundaries in codon or amino acid mode
959-
if (this.codonMode || this.aminoAcidMode) {
959+
if (this.displayMode === 'codon' || this.displayMode === 'translate') {
960960
clo = this.snapToCodonStart(clo);
961961
chi = this.snapToCodonEnd(chi);
962962
}
@@ -975,7 +975,7 @@
975975
let chi = Math.min((this.colOffsets && this.colOffsets.length > 0) ? this.colOffsets.length - 2 : Math.max(c0, c1), Math.max(c0, c1));
976976

977977
// Snap to codon boundaries in codon or amino acid mode
978-
if (this.codonMode || this.aminoAcidMode) {
978+
if (this.displayMode === 'codon' || this.displayMode === 'translate') {
979979
clo = this.snapToCodonStart(clo);
980980
chi = this.snapToCodonEnd(chi);
981981
}
@@ -1009,7 +1009,7 @@
10091009
let col = (cb.colFromClientX ? cb.colFromClientX(e.clientX) : (cb.colFromClientXLocal ? cb.colFromClientXLocal(e.clientX) : null)) || _colFromClientXLocal(e.clientX, headerCanvas);
10101010

10111011
// Snap to codon boundary in codon or amino acid mode
1012-
if (this.codonMode || this.aminoAcidMode) {
1012+
if (this.displayMode === 'codon' || this.displayMode === 'translate') {
10131013
col = this.snapToCodonStart(col);
10141014
}
10151015

@@ -1030,7 +1030,7 @@
10301030
// Already handled above
10311031
} else if (e.metaKey) {
10321032
// Cmd-click: toggle selection of codon (or single column in non-codon mode)
1033-
if (this.codonMode || this.aminoAcidMode) {
1033+
if (this.displayMode === 'codon' || this.displayMode === 'translate') {
10341034
const codonStart = this.snapToCodonStart(col);
10351035
const codonEnd = this.snapToCodonEnd(col);
10361036
// Check if any part of the codon is selected
@@ -1049,7 +1049,7 @@
10491049
} else {
10501050
try {
10511051
this.selectedCols.clear();
1052-
if (this.codonMode || this.aminoAcidMode) {
1052+
if (this.displayMode === 'codon' || this.displayMode === 'translate') {
10531053
const codonEnd = this.snapToCodonEnd(col);
10541054
for (let c = col; c <= codonEnd; c++) this.selectedCols.add(c);
10551055
} else {
@@ -1091,7 +1091,7 @@
10911091
let col = (cb.colFromClientX ? cb.colFromClientX(e.clientX) : (cb.colFromClientXLocal ? cb.colFromClientXLocal(e.clientX) : null)) || _colFromClientXLocal(e.clientX, consensusCanvas);
10921092

10931093
// Snap to codon boundary in codon or amino acid mode
1094-
if (this.codonMode || this.aminoAcidMode) {
1094+
if (this.displayMode === 'codon' || this.displayMode === 'translate') {
10951095
col = this.snapToCodonStart(col);
10961096
}
10971097

@@ -1112,7 +1112,7 @@
11121112
// Already handled above
11131113
} else if (e.metaKey) {
11141114
// Cmd-click: toggle selection of codon (or single column in non-codon mode)
1115-
if (this.codonMode || this.aminoAcidMode) {
1115+
if (this.displayMode === 'codon' || this.displayMode === 'translate') {
11161116
const codonStart = this.snapToCodonStart(col);
11171117
const codonEnd = this.snapToCodonEnd(col);
11181118
const isSelected = this.selectedCols.has(codonStart) || this.selectedCols.has(codonStart + 1) || this.selectedCols.has(codonEnd);
@@ -1128,7 +1128,7 @@
11281128
} else {
11291129
try {
11301130
this.selectedCols.clear();
1131-
if (this.codonMode || this.aminoAcidMode) {
1131+
if (this.displayMode === 'codon' || this.displayMode === 'translate') {
11321132
const codonEnd = this.snapToCodonEnd(col);
11331133
for (let c = col; c <= codonEnd; c++) this.selectedCols.add(c);
11341134
} else {
@@ -2852,8 +2852,8 @@
28522852
headerCtx.save();
28532853
headerCtx.fillStyle = this.HEADER_SELECTION;
28542854

2855-
// In amino acid or codon mode, group selections by codon and draw entire codon boxes
2856-
if (this.aminoAcidMode || this.codonMode) {
2855+
// In codon or translate mode, group selections by codon and draw entire codon boxes
2856+
if (this.displayMode === 'codon' || this.displayMode === 'translate') {
28572857
const drawnCodons = new Set();
28582858

28592859
for (const c of selectedCols) {
@@ -3481,8 +3481,8 @@
34813481
let clo = Math.max(0, Math.min(rectStartCol, rectEndCol));
34823482
let chi = Math.min(maxSeqLen - 1, Math.max(rectStartCol, rectEndCol));
34833483

3484-
// Snap visual rectangle to codon boundaries in amino acid or codon mode
3485-
if (aminoAcidMode || codonMode) {
3484+
// Snap visual rectangle to codon boundaries in codon or translate mode
3485+
if (displayMode === 'codon' || displayMode === 'translate') {
34863486
clo = this.snapToCodonStart(clo);
34873487
chi = this.snapToCodonEnd(chi);
34883488
}

0 commit comments

Comments
 (0)