oncoprintjs 6.1.2 → 6.1.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.
@@ -1,13 +1,13 @@
1
1
 
2
- > oncoprintjs@6.1.2 build /home/runner/work/cbioportal-frontend/cbioportal-frontend/packages/oncoprintjs
2
+ > oncoprintjs@6.1.4 build /home/runner/work/cbioportal-frontend/cbioportal-frontend/packages/oncoprintjs
3
3
  > cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=2048 pnpm run rollup
4
4
 
5
5
 
6
- > oncoprintjs@6.1.2 rollup /home/runner/work/cbioportal-frontend/cbioportal-frontend/packages/oncoprintjs
6
+ > oncoprintjs@6.1.4 rollup /home/runner/work/cbioportal-frontend/cbioportal-frontend/packages/oncoprintjs
7
7
  > rollup -c rollup.config.ts
8
8
 
9
9
  
10
10
  src/index.tsx → dist/index.js, dist/index.es.js...
11
11
  (!) Circular dependency
12
12
  src/js/oncoprinttrackoptionsview.ts -> src/js/oncoprintheaderview.ts -> src/js/oncoprinttrackoptionsview.ts
13
- created dist/index.js, dist/index.es.js in 20.2s
13
+ created dist/index.js, dist/index.es.js in 19.4s
package/dist/index.es.js CHANGED
@@ -2852,18 +2852,36 @@ var OncoprintModel = /** @class */ (function () {
2852
2852
  if (nearest_id_index === -1) {
2853
2853
  return null;
2854
2854
  }
2855
- // Next, see if it's in a track
2855
+ // Next, see if it's in a track.
2856
+ // Try binary search first for performance, but fall back to linear
2857
+ // scan if the result is invalid. cell_tops may not be monotonically
2858
+ // ordered relative to the tracks array during async clustering
2859
+ // transitions, which causes binary search to return wrong results.
2856
2860
  var tracks = this.getTracks();
2857
2861
  var cell_tops = this.getCellTops();
2862
+ var nearest_track;
2858
2863
  var nearest_track_index = binarysearch(tracks, y, function (track) {
2859
2864
  return cell_tops[track];
2860
2865
  }, true);
2861
- if (nearest_track_index === -1) {
2862
- return null;
2866
+ if (nearest_track_index !== -1) {
2867
+ var candidate = tracks[nearest_track_index];
2868
+ if (y >= cell_tops[candidate] &&
2869
+ y < cell_tops[candidate] + this.getCellHeight(candidate)) {
2870
+ nearest_track = candidate;
2871
+ }
2872
+ }
2873
+ if (nearest_track === undefined) {
2874
+ // Binary search failed (tracks out of order) - linear fallback
2875
+ for (var t = 0; t < tracks.length; t++) {
2876
+ var top_1 = cell_tops[tracks[t]];
2877
+ if (y >= top_1 &&
2878
+ y < top_1 + this.getCellHeight(tracks[t])) {
2879
+ nearest_track = tracks[t];
2880
+ break;
2881
+ }
2882
+ }
2863
2883
  }
2864
- var nearest_track = tracks[nearest_track_index];
2865
- if (y >= cell_tops[nearest_track] + this.getCellHeight(nearest_track)) {
2866
- // we know y is past the top of the track (>= cell_tops[nearest_track]), so this checks if y is past the bottom of the track
2884
+ if (nearest_track === undefined) {
2867
2885
  return null;
2868
2886
  }
2869
2887
  // At this point, we know y is inside a track