geneviewer-js 0.3.2 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3671,11 +3671,19 @@ function chart(spec) {
3671
3671
  x.legend = { group, show: group !== null, width };
3672
3672
  x.legend.style = { width: "100%", backgroundColor: style.backgroundColor ?? null };
3673
3673
  x.saveButton = saveButton;
3674
- const clusters = cluster2 === null ? ["cluster"] : [...new Set(data.get(cluster2))];
3674
+ const clusterRows = /* @__PURE__ */ new Map();
3675
+ if (cluster2 !== null) {
3676
+ data.get(cluster2).forEach((name, i) => {
3677
+ const rows = clusterRows.get(name);
3678
+ if (rows) rows.push(i);
3679
+ else clusterRows.set(name, [i]);
3680
+ });
3681
+ }
3682
+ const clusters = cluster2 === null ? ["cluster"] : [...clusterRows.keys()];
3675
3683
  const blast = columnNames.includes("BlastP") && columnNames.includes("protein_id");
3676
3684
  const series = /* @__PURE__ */ new Map();
3677
3685
  for (const name of clusters) {
3678
- const subset = cluster2 === null ? data.copy() : data.filter((i) => data.get(cluster2)[i] === name);
3686
+ const subset = cluster2 === null ? data.copy() : data.rows(clusterRows.get(name));
3679
3687
  subset.set("cluster", name);
3680
3688
  const clusterHeight = typeof height === "string" && /%$/.test(height) ? computeSize2(height, clusters.length) : Number(getRelativeHeight(height, height)) / clusters.length;
3681
3689
  const starts = subset.get("start");
@@ -7298,7 +7306,7 @@ function createSaveIcon(widgetId, el, container2, iconClass = null, save = downl
7298
7306
  }
7299
7307
 
7300
7308
  // src/lib/chart.js
7301
- var version = "0.3.2";
7309
+ var version = "0.3.4";
7302
7310
  var renderSequence = 0;
7303
7311
  var chartCount = 0;
7304
7312
  var activeShortcuts = null;
@@ -8616,7 +8624,30 @@ function newChart(target, renderModel, options) {
8616
8624
  redrawZoom(true);
8617
8625
  reportZoom("set");
8618
8626
  };
8627
+ var keepScroll = function(drawing) {
8628
+ var scrolled = [];
8629
+ for (var node = el.parentElement; node; node = node.parentElement) {
8630
+ if (node.scrollTop || node.scrollLeft) scrolled.push([node, node.scrollTop, node.scrollLeft]);
8631
+ }
8632
+ var page = el.ownerDocument.scrollingElement;
8633
+ if (page && !scrolled.some(function(item) {
8634
+ return item[0] === page;
8635
+ })) {
8636
+ scrolled.push([page, page.scrollTop, page.scrollLeft]);
8637
+ }
8638
+ try {
8639
+ drawing();
8640
+ } finally {
8641
+ scrolled.forEach(function(item) {
8642
+ if (item[0].scrollTop !== item[1]) item[0].scrollTop = item[1];
8643
+ if (item[0].scrollLeft !== item[2]) item[0].scrollLeft = item[2];
8644
+ });
8645
+ }
8646
+ };
8619
8647
  var draw = function() {
8648
+ keepScroll(drawChart);
8649
+ };
8650
+ var drawChart = function() {
8620
8651
  cancelDrag();
8621
8652
  zoomCharts = [];
8622
8653
  legendColorBar = null;
@@ -8755,26 +8786,6 @@ function newChart(target, renderModel, options) {
8755
8786
  makeColorBar(graphContainer2, links2, theme2, legendColorBar !== null);
8756
8787
  clipZoomLinks();
8757
8788
  };
8758
- var keepScroll = function(drawing) {
8759
- var scrolled = [];
8760
- for (var node = el.parentElement; node; node = node.parentElement) {
8761
- if (node.scrollTop || node.scrollLeft) scrolled.push([node, node.scrollTop, node.scrollLeft]);
8762
- }
8763
- var page = document.scrollingElement;
8764
- if (page && !scrolled.some(function(item) {
8765
- return item[0] === page;
8766
- })) {
8767
- scrolled.push([page, page.scrollTop, page.scrollLeft]);
8768
- }
8769
- try {
8770
- drawing();
8771
- } finally {
8772
- scrolled.forEach(function(item) {
8773
- if (item[0].scrollTop !== item[1]) item[0].scrollTop = item[1];
8774
- if (item[0].scrollLeft !== item[2]) item[0].scrollLeft = item[2];
8775
- });
8776
- }
8777
- };
8778
8789
  var redraw = function() {
8779
8790
  var focused = zoomBar && zoomBar.contains(document.activeElement) ? document.activeElement.getAttribute("data-zoom-part") : null;
8780
8791
  keepScroll(function() {