higlass 2.1.5 → 2.2.0

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.
@@ -241,6 +241,29 @@ class CombinedTrack {
241
241
 
242
242
  return mouseOverHtml;
243
243
  }
244
+
245
+ /**
246
+ * Get the uids of any items that are below the mouse
247
+ *
248
+ * @param {*} trackX
249
+ * @param {*} trackY
250
+ * @returns
251
+ */
252
+ getMouseOverUids(trackX, trackY) {
253
+ const mouseOverUids = [];
254
+
255
+ for (const childTrack of this.childTracks) {
256
+ if (childTrack.getMouseOverUids) {
257
+ const trackMouseOverUids = childTrack.getMouseOverUids(trackX, trackY);
258
+
259
+ if (trackMouseOverUids) {
260
+ mouseOverUids.push(...trackMouseOverUids);
261
+ }
262
+ }
263
+ }
264
+
265
+ return mouseOverUids;
266
+ }
244
267
  }
245
268
 
246
269
  export default CombinedTrack;
@@ -4535,6 +4535,7 @@ class HiGlassComponent extends React.Component {
4535
4535
  });
4536
4536
 
4537
4537
  this.showHoverMenu(evt);
4538
+ this.showHoverUids(evt);
4538
4539
  }
4539
4540
 
4540
4541
  getMinMaxValue(viewId, trackId, ignoreOffScreenValues, ignoreFixedScale) {
@@ -4565,6 +4566,28 @@ class HiGlassComponent extends React.Component {
4565
4566
  ];
4566
4567
  }
4567
4568
 
4569
+ /*
4570
+ * Someone has hovered over an item in sourceTrack so we need to inform
4571
+ * any other track that has that item that it's been hovered over.
4572
+ */
4573
+ showHoverUids(evt) {
4574
+ const mouseOverUids = evt.track?.getMouseOverUids
4575
+ ? evt.track.getMouseOverUids(evt.relTrackX, evt.relTrackY)
4576
+ : null;
4577
+
4578
+ for (const track of this.iterateOverTracks()) {
4579
+ const trackObj = getTrackObjById(
4580
+ this.tiledPlots,
4581
+ track.viewId,
4582
+ track.trackId,
4583
+ );
4584
+
4585
+ if (trackObj.itemsHovered) {
4586
+ trackObj.itemsHovered(mouseOverUids);
4587
+ }
4588
+ }
4589
+ }
4590
+
4568
4591
  /**
4569
4592
  * Show a menu displaying some information about the track under it
4570
4593
  */
@@ -106,6 +106,7 @@ class Tiled1DPixiTrack extends TiledPixiTrack {
106
106
  this._xScale,
107
107
  this.tilesetInfo.min_pos[0],
108
108
  this.tilesetInfo.max_pos[0],
109
+ this.tilesetInfo.bins_per_dimension || this.tilesetInfo.tile_size,
109
110
  );
110
111
 
111
112
  const tiles = xTiles.map((x) => [this.zoomLevel, x]);
@@ -238,6 +238,7 @@ const calculate1DVisibleTiles = (tilesetInfo, scale) => {
238
238
  scale,
239
239
  tilesetInfo.min_pos[0],
240
240
  tilesetInfo.max_pos[0],
241
+ tilesetInfo.bins_per_dimension || tilesetInfo.tile_size,
241
242
  );
242
243
 
243
244
  const tiles = xTiles.map((x) => [zoomLevel, x]);
@@ -29,4 +29,12 @@ declare class CombinedTrack {
29
29
  respondsToPosition(x: any, y: any): boolean;
30
30
  stopHover(): void;
31
31
  getMouseOverHtml(trackX: any, trackY: any): string;
32
+ /**
33
+ * Get the uids of any items that are below the mouse
34
+ *
35
+ * @param {*} trackX
36
+ * @param {*} trackY
37
+ * @returns
38
+ */
39
+ getMouseOverUids(trackX: any, trackY: any): any[];
32
40
  }
@@ -667,6 +667,7 @@ declare class HiGlassComponent extends React.Component<any, any, any> {
667
667
  */
668
668
  mouseMoveHandler(e: object): void;
669
669
  getMinMaxValue(viewId: any, trackId: any, ignoreOffScreenValues: any, ignoreFixedScale: any): any[] | undefined;
670
+ showHoverUids(evt: any): void;
670
671
  /**
671
672
  * Show a menu displaying some information about the track under it
672
673
  */
package/dist/hglib.js CHANGED
@@ -13800,7 +13800,7 @@
13800
13800
  /** @type {const} */
13801
13801
  [window, map$5((c) => c.charCodeAt(0))(
13802
13802
  // @ts-expect-error - A global added by `vite.config.js`.
13803
- "2.1.5"
13803
+ "2.2.0"
13804
13804
  ).map((number3) => number3 <= 999 ? `00${number3}`.slice(-3) : number3).join("")]
13805
13805
  );
13806
13806
  const gradient = (steps, width = 1, height = 100, fromX = 0, fromY = 0, toX = 0, toY = 100) => {
@@ -14054,6 +14054,27 @@
14054
14054
  }
14055
14055
  return mouseOverHtml;
14056
14056
  }
14057
+ /**
14058
+ * Get the uids of any items that are below the mouse
14059
+ *
14060
+ * @param {*} trackX
14061
+ * @param {*} trackY
14062
+ * @returns
14063
+ */
14064
+ }, {
14065
+ key: "getMouseOverUids",
14066
+ value: function getMouseOverUids(trackX, trackY) {
14067
+ const mouseOverUids = [];
14068
+ for (const childTrack of this.childTracks) {
14069
+ if (childTrack.getMouseOverUids) {
14070
+ const trackMouseOverUids = childTrack.getMouseOverUids(trackX, trackY);
14071
+ if (trackMouseOverUids) {
14072
+ mouseOverUids.push(...trackMouseOverUids);
14073
+ }
14074
+ }
14075
+ }
14076
+ return mouseOverUids;
14077
+ }
14057
14078
  }]);
14058
14079
  }();
14059
14080
  const isTrackOrChildTrack = (testTrack, track) => {
@@ -47706,7 +47727,7 @@
47706
47727
  const zoomLevel = calculate1DZoomLevel(tilesetInfo, scale, tilesetInfo.max_zoom);
47707
47728
  if (tilesetInfo.resolutions) {
47708
47729
  const sortedResolutions = tilesetInfo.resolutions.map((x) => +x).sort((a, b) => b - a);
47709
- const xTiles2 = calculateTilesFromResolution$1(sortedResolutions[zoomLevel], scale, tilesetInfo.min_pos[0], tilesetInfo.max_pos[0]);
47730
+ const xTiles2 = calculateTilesFromResolution$1(sortedResolutions[zoomLevel], scale, tilesetInfo.min_pos[0], tilesetInfo.max_pos[0], tilesetInfo.bins_per_dimension || tilesetInfo.tile_size);
47710
47731
  const tiles2 = xTiles2.map((x) => [zoomLevel, x]);
47711
47732
  return tiles2;
47712
47733
  }
@@ -75316,7 +75337,7 @@ ${x}` : x, "");
75316
75337
  this.zoomLevel = this.calculateZoomLevel();
75317
75338
  if (this.tilesetInfo.resolutions) {
75318
75339
  const sortedResolutions = this.tilesetInfo.resolutions.map((x) => +x).sort((a, b) => b - a);
75319
- const xTiles2 = api.calculateTilesFromResolution(sortedResolutions[this.zoomLevel], this._xScale, this.tilesetInfo.min_pos[0], this.tilesetInfo.max_pos[0]);
75340
+ const xTiles2 = api.calculateTilesFromResolution(sortedResolutions[this.zoomLevel], this._xScale, this.tilesetInfo.min_pos[0], this.tilesetInfo.max_pos[0], this.tilesetInfo.bins_per_dimension || this.tilesetInfo.tile_size);
75320
75341
  const tiles2 = xTiles2.map((x) => [this.zoomLevel, x]);
75321
75342
  this.setVisibleTiles(tiles2);
75322
75343
  return;
@@ -90327,7 +90348,7 @@ ${x}` : x, "");
90327
90348
  toJSON,
90328
90349
  toString
90329
90350
  });
90330
- const version = "2.1.5";
90351
+ const version = "2.2.0";
90331
90352
  const configs = {
90332
90353
  ..._configs,
90333
90354
  IS_TRACK_RANGE_SELECTABLE,
@@ -107797,6 +107818,7 @@ ${svgString}`;
107797
107818
  isFromVerticalTrack: evt.isFromVerticalTrack
107798
107819
  });
107799
107820
  this.showHoverMenu(evt);
107821
+ this.showHoverUids(evt);
107800
107822
  }
107801
107823
  }, {
107802
107824
  key: "getMinMaxValue",
@@ -107815,6 +107837,22 @@ ${svgString}`;
107815
107837
  }
107816
107838
  return [track.minVisibleValueInTiles(ignoreFixedScale), track.maxVisibleValueInTiles(ignoreFixedScale)];
107817
107839
  }
107840
+ /*
107841
+ * Someone has hovered over an item in sourceTrack so we need to inform
107842
+ * any other track that has that item that it's been hovered over.
107843
+ */
107844
+ }, {
107845
+ key: "showHoverUids",
107846
+ value: function showHoverUids(evt) {
107847
+ var _a;
107848
+ const mouseOverUids = ((_a = evt.track) == null ? void 0 : _a.getMouseOverUids) ? evt.track.getMouseOverUids(evt.relTrackX, evt.relTrackY) : null;
107849
+ for (const track of this.iterateOverTracks()) {
107850
+ const trackObj = getTrackObjById(this.tiledPlots, track.viewId, track.trackId);
107851
+ if (trackObj.itemsHovered) {
107852
+ trackObj.itemsHovered(mouseOverUids);
107853
+ }
107854
+ }
107855
+ }
107818
107856
  /**
107819
107857
  * Show a menu displaying some information about the track under it
107820
107858
  */