higlass 2.1.9 → 2.2.1

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
  */
@@ -1,5 +1,6 @@
1
1
  // @ts-nocheck
2
2
  import { axisLeft } from 'd3-axis';
3
+ import { format } from 'd3-format';
3
4
 
4
5
  import SVGTrack from './SVGTrack';
5
6
 
@@ -25,6 +26,17 @@ class LeftAxisTrack extends SVGTrack {
25
26
 
26
27
  draw() {
27
28
  this.axis.scale(this._yScale);
29
+
30
+ if (
31
+ this.options.reverseAxis === 'yes' ||
32
+ this.options.reverseAxis === true
33
+ ) {
34
+ const defaultFormat = format(',');
35
+ this.axis.tickFormat((d) => defaultFormat(-d));
36
+ } else {
37
+ this.axis.tickFormat(null);
38
+ }
39
+
28
40
  this.gAxis.call(this.axis);
29
41
 
30
42
  return this;
@@ -108,9 +108,10 @@ export const TRACKS_INFO = [
108
108
  orientation: '1d-vertical',
109
109
  name: 'Left Axis',
110
110
  thumbnail: svgVertical1DAxisIcon,
111
- availableOptions: ['minWidth'],
111
+ availableOptions: ['minWidth', 'reverseAxis'],
112
112
  defaultOptions: {
113
113
  minWidth: 100,
114
+ reverseAxis: false,
114
115
  },
115
116
  },
116
117
  {
@@ -521,6 +521,11 @@ export const OPTIONS_INFO = {
521
521
  inlineOptions: sizesInPx([0, 10, 20, 30, 40, 50, 100, 200, 400], 'px'),
522
522
  },
523
523
 
524
+ reverseAxis: {
525
+ name: 'Reverse Axis',
526
+ inlineOptions: YES_NO,
527
+ },
528
+
524
529
  colorbarPosition: {
525
530
  name: 'Colorbar Position',
526
531
  inlineOptions: {
@@ -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
  */