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.
- package/.turbo/turbo-build.log +3 -3
- package/dist/index.es.js +24 -6
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +24 -6
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/js/oncoprintmodel.ts +28 -6
package/dist/index.js
CHANGED
|
@@ -2862,18 +2862,36 @@ var OncoprintModel = /** @class */ (function () {
|
|
|
2862
2862
|
if (nearest_id_index === -1) {
|
|
2863
2863
|
return null;
|
|
2864
2864
|
}
|
|
2865
|
-
// Next, see if it's in a track
|
|
2865
|
+
// Next, see if it's in a track.
|
|
2866
|
+
// Try binary search first for performance, but fall back to linear
|
|
2867
|
+
// scan if the result is invalid. cell_tops may not be monotonically
|
|
2868
|
+
// ordered relative to the tracks array during async clustering
|
|
2869
|
+
// transitions, which causes binary search to return wrong results.
|
|
2866
2870
|
var tracks = this.getTracks();
|
|
2867
2871
|
var cell_tops = this.getCellTops();
|
|
2872
|
+
var nearest_track;
|
|
2868
2873
|
var nearest_track_index = binarysearch(tracks, y, function (track) {
|
|
2869
2874
|
return cell_tops[track];
|
|
2870
2875
|
}, true);
|
|
2871
|
-
if (nearest_track_index
|
|
2872
|
-
|
|
2876
|
+
if (nearest_track_index !== -1) {
|
|
2877
|
+
var candidate = tracks[nearest_track_index];
|
|
2878
|
+
if (y >= cell_tops[candidate] &&
|
|
2879
|
+
y < cell_tops[candidate] + this.getCellHeight(candidate)) {
|
|
2880
|
+
nearest_track = candidate;
|
|
2881
|
+
}
|
|
2882
|
+
}
|
|
2883
|
+
if (nearest_track === undefined) {
|
|
2884
|
+
// Binary search failed (tracks out of order) - linear fallback
|
|
2885
|
+
for (var t = 0; t < tracks.length; t++) {
|
|
2886
|
+
var top_1 = cell_tops[tracks[t]];
|
|
2887
|
+
if (y >= top_1 &&
|
|
2888
|
+
y < top_1 + this.getCellHeight(tracks[t])) {
|
|
2889
|
+
nearest_track = tracks[t];
|
|
2890
|
+
break;
|
|
2891
|
+
}
|
|
2892
|
+
}
|
|
2873
2893
|
}
|
|
2874
|
-
|
|
2875
|
-
if (y >= cell_tops[nearest_track] + this.getCellHeight(nearest_track)) {
|
|
2876
|
-
// 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
|
|
2894
|
+
if (nearest_track === undefined) {
|
|
2877
2895
|
return null;
|
|
2878
2896
|
}
|
|
2879
2897
|
// At this point, we know y is inside a track
|