From 3bcadd92532207260ff30bc992c4b36676d53910 Mon Sep 17 00:00:00 2001 From: martina Date: Tue, 22 Mar 2022 15:53:24 +0100 Subject: [PATCH] fix indexes bug --- dist/sqv-bundle.js | 21 +++++++++------------ package.json | 2 +- src/lib/proseqviewer.ts | 16 ++++++---------- 3 files changed, 16 insertions(+), 23 deletions(-) diff --git a/dist/sqv-bundle.js b/dist/sqv-bundle.js index e73cddc..867d76e 100644 --- a/dist/sqv-bundle.js +++ b/dist/sqv-bundle.js @@ -1116,7 +1116,7 @@ class ProSeqViewer { let labelsContainer = ''; const noGapsLabels = []; if (labels.length > 0) { - if (indexesLocation == 'top' || 'both') { + if (indexesLocation != 'lateral') { labelshtml += ``; } let flag; @@ -1250,7 +1250,7 @@ class ProSeqViewer { let idx; let cells = ''; for (let x = 1; x <= maxIdx; x++) { - if (indexesLocation == 'top' || 'both') { + if (indexesLocation != 'lateral') { cells = this.addTopIndexes(chunkSize, x, maxTop, lineSeparation); } ; @@ -1285,7 +1285,7 @@ class ProSeqViewer { cells = ''; if (chunkSize > 0 && x % chunkSize === 0) { // considering the row of top indexes - if (indexesLocation != 'top' || 'both') { + if (indexesLocation != 'top') { idxNum += chunkSize; // lateral index (set only if top indexes missing) idx = idxNum - (chunkSize - 1); // adding labels @@ -1300,16 +1300,13 @@ class ProSeqViewer { index = gapsContainer; // lateral number indexes } else { - if (indexesLocation == 'lateral' || 'both') { - index = labelsContainer + gapsContainer; // lateral number indexes + labels - } - else { - index = labelsContainer; // lateral number indexes + labels - } + // if(indexesLocation == 'both'){ + index = labelsContainer + gapsContainer; // lateral number indexes + labels + // } } } else { - index = labelsContainer; + index = labelsContainer; // top } index = ``; style = `font-size: ${fontSize};`; @@ -1320,11 +1317,11 @@ class ProSeqViewer { style += 'margin-right: ' + chunkSeparation + 'em;'; } let chunk = ''; - if (labelsFlag || options.consensusType || indexesLocation == 'lateral' || indexesLocation == 'both') { + if (labelsFlag || options.consensusType || indexesLocation == 'both' || indexesLocation == 'lateral') { // both chunk = `
${index}
${cards}
`; } else { - chunk = `
${cards}
`; + chunk = `
${cards}
`; // top } cards = ''; index = ''; diff --git a/package.json b/package.json index 45198c2..c4cc382 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "proseqviewer", - "version": "1.1.7", + "version": "1.1.9", "main": "index.js", "types": "index.d.ts", "repository": { diff --git a/src/lib/proseqviewer.ts b/src/lib/proseqviewer.ts index b3822cb..5505dc7 100644 --- a/src/lib/proseqviewer.ts +++ b/src/lib/proseqviewer.ts @@ -142,7 +142,7 @@ export class ProSeqViewer { const noGapsLabels = []; if (labels.length > 0) { - if (indexesLocation == 'top' || 'both') { + if (indexesLocation != 'lateral') { labelshtml += ``; } let flag; @@ -285,7 +285,7 @@ export class ProSeqViewer { let idx; let cells = ''; for (let x = 1; x <= maxIdx; x++) { - if (indexesLocation == 'top' || 'both') {cells = this.addTopIndexes(chunkSize, x, maxTop, lineSeparation)}; + if (indexesLocation != 'lateral') {cells = this.addTopIndexes(chunkSize, x, maxTop, lineSeparation)}; for (let y = 0; y < data.length; y++) { entity = data[y][x]; @@ -316,7 +316,7 @@ export class ProSeqViewer { if (chunkSize > 0 && x % chunkSize === 0) { // considering the row of top indexes - if (indexesLocation != 'top' || 'both') { + if (indexesLocation != 'top') { idxNum += chunkSize; // lateral index (set only if top indexes missing) idx = idxNum - (chunkSize - 1); // adding labels @@ -332,14 +332,10 @@ export class ProSeqViewer { if (!labelsFlag) { index = gapsContainer; // lateral number indexes } else { - if(indexesLocation == 'lateral' || 'both'){ index = labelsContainer + gapsContainer; // lateral number indexes + labels - } else { - index = labelsContainer; // lateral number indexes + labels - } } } else { - index = labelsContainer; + index = labelsContainer; // top } index = ``; @@ -349,10 +345,10 @@ export class ProSeqViewer { let chunk = ''; - if (labelsFlag || options.consensusType || indexesLocation == 'lateral' || indexesLocation == 'both') { + if (labelsFlag || options.consensusType || indexesLocation == 'both' || indexesLocation == 'lateral') { // both chunk = `
${index}
${cards}
`; } else { - chunk = `
${cards}
`; + chunk = `
${cards}
`; // top } cards = ''; index = '';