higlass 2.3.1 → 2.3.3

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.
@@ -90,6 +90,10 @@ class BarTrack extends HorizontalLine1DPixiTrack {
90
90
  }
91
91
 
92
92
  const { graphics } = tile;
93
+ const numBins =
94
+ this.tilesetInfo.tile_size ||
95
+ this.tilesetInfo.bins_per_dimension ||
96
+ tile.tileData.dense.length;
93
97
 
94
98
  // Reset svg data to avoid overplotting
95
99
  tile.svgData = undefined;
@@ -97,7 +101,7 @@ class BarTrack extends HorizontalLine1DPixiTrack {
97
101
  const { tileX, tileWidth } = this.getTilePosAndDimensions(
98
102
  tile.tileData.zoomLevel,
99
103
  tile.tileData.tilePos,
100
- this.tilesetInfo.bins_per_dimension || this.tilesetInfo.tile_size,
104
+ numBins,
101
105
  );
102
106
  const tileValues = tile.tileData.dense;
103
107
 
@@ -142,10 +146,7 @@ class BarTrack extends HorizontalLine1DPixiTrack {
142
146
  // this scale should go from an index in the data array to
143
147
  // a position in the genome coordinates
144
148
  const tileXScale = scaleLinear()
145
- .domain([
146
- 0,
147
- this.tilesetInfo.tile_size || this.tilesetInfo.bins_per_dimension,
148
- ])
149
+ .domain([0, numBins])
149
150
  .range([tileX, tileX + tileWidth]);
150
151
 
151
152
  const strokeWidth = 0;
@@ -212,13 +212,17 @@ class Tiled1DPixiTrack extends TiledPixiTrack {
212
212
  const { tileX, tileWidth } = this.getTilePosAndDimensions(
213
213
  tile.tileData.zoomLevel,
214
214
  tile.tileData.tilePos,
215
- this.tilesetInfo.bins_per_dimension || this.tilesetInfo.tile_size,
215
+ this.tilesetInfo.bins_per_dimension ||
216
+ this.tilesetInfo.tile_size ||
217
+ tile.tileData.dense.length,
216
218
  );
217
219
 
218
220
  const tileXScale = scaleLinear()
219
221
  .domain([
220
222
  0,
221
- this.tilesetInfo.tile_size || this.tilesetInfo.bins_per_dimension,
223
+ this.tilesetInfo.tile_size ||
224
+ this.tilesetInfo.bins_per_dimension ||
225
+ tile.tileData.dense.length,
222
226
  ])
223
227
  .range([tileX, tileX + tileWidth]);
224
228
 
@@ -1400,7 +1400,7 @@ export class TrackRenderer extends React.Component {
1400
1400
  if (!isWheelEvent(event.sourceEvent)) {
1401
1401
  return;
1402
1402
  }
1403
- const mdy = event.sourceEvent.deltaY;
1403
+ const mdy = event.sourceEvent.deltaY || event.sourceEvent.deltaX;
1404
1404
  const mdm = event.sourceEvent.deltaMode;
1405
1405
 
1406
1406
  /**
@@ -1467,7 +1467,11 @@ export class TrackRenderer extends React.Component {
1467
1467
  if (trackOrientation && event.sourceEvent) {
1468
1468
  // if somebody is holding down the shift key and is zooming over
1469
1469
  // a 1d track, try to apply value scale zooming
1470
- if (event.shiftKey || this.valueScaleZooming) {
1470
+ if (
1471
+ event.shiftKey ||
1472
+ this.valueScaleZooming ||
1473
+ event.sourceEvent?.shiftKey
1474
+ ) {
1471
1475
  if (event.sourceEvent.deltaY !== undefined) {
1472
1476
  this.valueScaleZoom(event, trackOrientation);
1473
1477
  return;
@@ -450,7 +450,7 @@ export default class DataFetcher {
450
450
  // we need to extract the row corresponding to the data we need
451
451
 
452
452
  const tilesetUid = dictValues(returnedTiles)[0].tilesetUid;
453
- // console.log('tilesetUid:', tilesetUid);
453
+
454
454
  /** @type {Record<string, Tile>} */
455
455
  const newTiles = {};
456
456
 
@@ -486,6 +486,7 @@ export default class DataFetcher {
486
486
  sliceIndex,
487
487
  1,
488
488
  );
489
+
489
490
  for (let j = 0; j < dataSlice.length; j++) {
490
491
  dataSlice[j] += mirroredDataSlice[j];
491
492
  }
@@ -483,7 +483,11 @@ export function calculateTileAndPosInTile(
483
483
  : 256;
484
484
 
485
485
  if (!isLegacyTilesetInfo(tilesetInfo)) {
486
- tileWidth = tilesetInfo.resolutions[zoomLevel] * pixelsPerTile;
486
+ const sortedResolutions = tilesetInfo.resolutions
487
+ .map((x) => +x)
488
+ .sort((a, b) => b - a);
489
+
490
+ tileWidth = sortedResolutions[zoomLevel] * pixelsPerTile;
487
491
  } else {
488
492
  tileWidth = maxDim / 2 ** zoomLevel;
489
493
  }
package/dist/hglib.js CHANGED
@@ -12606,7 +12606,7 @@
12606
12606
  /** @type {const} */
12607
12607
  [window, map$4((c) => c.charCodeAt(0))(
12608
12608
  // @ts-expect-error - A global added by `vite.config.js`.
12609
- "2.3.1"
12609
+ "2.3.3"
12610
12610
  ).map((number3) => number3 <= 999 ? `00${number3}`.slice(-3) : number3).join("")]
12611
12611
  );
12612
12612
  const gradient = (steps, width = 1, height = 100, fromX = 0, fromY = 0, toX = 0, toY = 100) => {
@@ -49038,7 +49038,8 @@
49038
49038
  let tileWidth = null;
49039
49039
  const pixelsPerTile = isLegacyTilesetInfo(tilesetInfo) ? tilesetInfo.bins_per_dimension ?? 256 : 256;
49040
49040
  if (!isLegacyTilesetInfo(tilesetInfo)) {
49041
- tileWidth = tilesetInfo.resolutions[zoomLevel] * pixelsPerTile;
49041
+ const sortedResolutions = tilesetInfo.resolutions.map((x) => +x).sort((a, b) => b - a);
49042
+ tileWidth = sortedResolutions[zoomLevel] * pixelsPerTile;
49042
49043
  } else {
49043
49044
  tileWidth = maxDim / 2 ** zoomLevel;
49044
49045
  }
@@ -78861,8 +78862,8 @@ ${x}` : x, "");
78861
78862
  const {
78862
78863
  tileX,
78863
78864
  tileWidth
78864
- } = this.getTilePosAndDimensions(tile.tileData.zoomLevel, tile.tileData.tilePos, this.tilesetInfo.bins_per_dimension || this.tilesetInfo.tile_size);
78865
- const tileXScale = linear().domain([0, this.tilesetInfo.tile_size || this.tilesetInfo.bins_per_dimension]).range([tileX, tileX + tileWidth]);
78865
+ } = this.getTilePosAndDimensions(tile.tileData.zoomLevel, tile.tileData.tilePos, this.tilesetInfo.bins_per_dimension || this.tilesetInfo.tile_size || tile.tileData.dense.length);
78866
+ const tileXScale = linear().domain([0, this.tilesetInfo.tile_size || this.tilesetInfo.bins_per_dimension || tile.tileData.dense.length]).range([tileX, tileX + tileWidth]);
78866
78867
  const start2 = Math.max(0, Math.round(tileXScale.invert(this._xScale.invert(visible[0]))));
78867
78868
  const end2 = Math.min(tile.tileData.dense.length, Math.round(tileXScale.invert(this._xScale.invert(visible[1]))));
78868
78869
  return [start2, end2];
@@ -83317,11 +83318,12 @@ ${x}` : x, "");
83317
83318
  const {
83318
83319
  graphics
83319
83320
  } = tile;
83321
+ const numBins = this.tilesetInfo.tile_size || this.tilesetInfo.bins_per_dimension || tile.tileData.dense.length;
83320
83322
  tile.svgData = void 0;
83321
83323
  const {
83322
83324
  tileX,
83323
83325
  tileWidth
83324
- } = this.getTilePosAndDimensions(tile.tileData.zoomLevel, tile.tileData.tilePos, this.tilesetInfo.bins_per_dimension || this.tilesetInfo.tile_size);
83326
+ } = this.getTilePosAndDimensions(tile.tileData.zoomLevel, tile.tileData.tilePos, numBins);
83325
83327
  const tileValues = tile.tileData.dense;
83326
83328
  if (tileValues.length === 0) return;
83327
83329
  const [valueScale, pseudocount] = this.makeValueScale(this.minValue(), this.medianVisibleValue, this.maxValue(), 0);
@@ -83337,7 +83339,7 @@ ${x}` : x, "");
83337
83339
  return;
83338
83340
  }
83339
83341
  const stroke = colorToHex(this.options.lineStrokeColor || "blue");
83340
- const tileXScale = linear().domain([0, this.tilesetInfo.tile_size || this.tilesetInfo.bins_per_dimension]).range([tileX, tileX + tileWidth]);
83342
+ const tileXScale = linear().domain([0, numBins]).range([tileX, tileX + tileWidth]);
83341
83343
  const strokeWidth = 0;
83342
83344
  graphics.lineStyle(strokeWidth, stroke, 1);
83343
83345
  const color2 = this.options.barFillColor || "grey";
@@ -93787,7 +93789,7 @@ ${x}` : x, "");
93787
93789
  toJSON,
93788
93790
  toString
93789
93791
  });
93790
- const version = "2.3.1";
93792
+ const version = "2.3.3";
93791
93793
  const configs = {
93792
93794
  ..._configs,
93793
93795
  IS_TRACK_RANGE_SELECTABLE,
@@ -94629,7 +94631,7 @@ ${x}` : x, "");
94629
94631
  if (!isWheelEvent(event.sourceEvent)) {
94630
94632
  return;
94631
94633
  }
94632
- const mdy = event.sourceEvent.deltaY;
94634
+ const mdy = event.sourceEvent.deltaY || event.sourceEvent.deltaX;
94633
94635
  const mdm = event.sourceEvent.deltaMode;
94634
94636
  const myWheelDelta = (dy, dm) => dy * (dm ? 120 : 1) / 500;
94635
94637
  const mwd = myWheelDelta(mdy, mdm);
@@ -94669,7 +94671,7 @@ ${x}` : x, "");
94669
94671
  }
94670
94672
  }
94671
94673
  if (trackOrientation && event.sourceEvent) {
94672
- if (event.shiftKey || this.valueScaleZooming) {
94674
+ if (event.shiftKey || this.valueScaleZooming || event.sourceEvent?.shiftKey) {
94673
94675
  if (event.sourceEvent.deltaY !== void 0) {
94674
94676
  this.valueScaleZoom(event, trackOrientation);
94675
94677
  return;