@vitessce/heatmap 3.2.2 → 3.3.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.
@@ -1,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-68f84e2a.js";
2
- import { B as BaseDecoder } from "./index-99684608.js";
2
+ import { B as BaseDecoder } from "./index-6515eb5d.js";
3
3
  import "react";
4
4
  import "@vitessce/vit-s";
5
5
  import "react-dom";
@@ -1,3 +1,9 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
1
7
  import * as React from "react";
2
8
  import React__default, { Children, isValidElement, cloneElement, useRef, useMemo, useEffect, useLayoutEffect, createElement, forwardRef, useState, useImperativeHandle, useReducer, useCallback, useContext } from "react";
3
9
  import { useVitessceContainer, useComponentHover, useComponentViewInfo, usePlotOptionsStyles, OptionsContainer, OptionSelect, useLoaders, useSetComponentHover, useSetComponentViewInfo, useCoordination, useDeckCanvasSize, useMultiObsLabels, useFeatureLabelsData, useObsFeatureMatrixData, useObsSetsData, useReady, useUrls, useUint8ObsFeatureMatrix, useGetObsInfo, useGetObsMembership, TitleInfo } from "@vitessce/vit-s";
@@ -10867,6 +10873,7 @@ const DataType$2 = {
10867
10873
  const FileType$1 = {
10868
10874
  // Joint file types
10869
10875
  ANNDATA_ZARR: "anndata.zarr",
10876
+ SPATIALDATA_ZARR: "spatialdata.zarr",
10870
10877
  // Atomic file types
10871
10878
  OBS_EMBEDDING_CSV: "obsEmbedding.csv",
10872
10879
  OBS_SPOTS_CSV: "obsSpots.csv",
@@ -10889,6 +10896,16 @@ const FileType$1 = {
10889
10896
  OBS_SEGMENTATIONS_ANNDATA_ZARR: "obsSegmentations.anndata.zarr",
10890
10897
  OBS_LABELS_ANNDATA_ZARR: "obsLabels.anndata.zarr",
10891
10898
  FEATURE_LABELS_ANNDATA_ZARR: "featureLabels.anndata.zarr",
10899
+ // SpatialData
10900
+ IMAGE_SPATIALDATA_ZARR: "image.spatialdata.zarr",
10901
+ LABELS_SPATIALDATA_ZARR: "labels.spatialdata.zarr",
10902
+ SHAPES_SPATIALDATA_ZARR: "shapes.spatialdata.zarr",
10903
+ OBS_FEATURE_MATRIX_SPATIALDATA_ZARR: "obsFeatureMatrix.spatialdata.zarr",
10904
+ OBS_SETS_SPATIALDATA_ZARR: "obsSets.spatialdata.zarr",
10905
+ OBS_SPOTS_SPATIALDATA_ZARR: "obsSpots.spatialdata.zarr",
10906
+ // TODO:
10907
+ // OBS_POINTS_SPATIALDATA_ZARR: 'obsPoints.spatialdata.zarr',
10908
+ // OBS_LOCATIONS_SPATIALDATA_ZARR: 'obsLocations.spatialdata.zarr',
10892
10909
  // MuData
10893
10910
  OBS_FEATURE_MATRIX_MUDATA_ZARR: "obsFeatureMatrix.mudata.zarr",
10894
10911
  OBS_SETS_MUDATA_ZARR: "obsSets.mudata.zarr",
@@ -11690,9 +11707,30 @@ z.object({
11690
11707
  offsetsUrl: z.string().optional(),
11691
11708
  coordinateTransformations: omeCoordinateTransformations.optional()
11692
11709
  });
11693
- z.object({
11710
+ const imageOmeZarrSchema = z.object({
11694
11711
  coordinateTransformations: omeCoordinateTransformations.optional()
11695
11712
  });
11713
+ imageOmeZarrSchema.extend({
11714
+ path: z.string()
11715
+ });
11716
+ z.object({
11717
+ path: z.string()
11718
+ });
11719
+ z.object({
11720
+ path: z.string()
11721
+ });
11722
+ z.object({
11723
+ path: z.string(),
11724
+ tablePath: z.string().optional().describe("The path to a table which annotates the spots. If available but not specified, the spot identifiers may not be aligned with associated tabular data as expected.")
11725
+ });
11726
+ annDataObsFeatureMatrix.extend({
11727
+ region: z.string().describe("The name of a region to use to filter instances (i.e., rows) in the table").optional()
11728
+ });
11729
+ z.object({
11730
+ region: z.string().describe("The name of a region to use to filter instances (i.e., rows) in the table").optional(),
11731
+ tablePath: z.string().optional().describe("The path to a table which contains the index for the set values."),
11732
+ obsSets: annDataObsSets
11733
+ });
11696
11734
  z.object({
11697
11735
  obsIndex: z.string(),
11698
11736
  obsEmbedding: z.array(z.string()).length(2)
@@ -18354,9 +18392,9 @@ const schemePlasma = [[13, 8, 135], [16, 7, 136], [19, 7, 137], [22, 7, 138], [2
18354
18392
  function rgbSpline(spline) {
18355
18393
  return (colors) => {
18356
18394
  const n2 = colors.length;
18357
- let r2 = new Array(n2);
18358
- let g2 = new Array(n2);
18359
- let b = new Array(n2);
18395
+ const r2 = new Array(n2);
18396
+ const g2 = new Array(n2);
18397
+ const b = new Array(n2);
18360
18398
  let i2;
18361
18399
  let color2;
18362
18400
  for (i2 = 0; i2 < n2; ++i2) {
@@ -18365,10 +18403,10 @@ function rgbSpline(spline) {
18365
18403
  g2[i2] = color2[1] || 0;
18366
18404
  b[i2] = color2[2] || 0;
18367
18405
  }
18368
- r2 = spline(r2);
18369
- g2 = spline(g2);
18370
- b = spline(b);
18371
- return (t2) => [r2(t2), g2(t2), b(t2)];
18406
+ const rFunc = spline(r2);
18407
+ const gFunc = spline(g2);
18408
+ const bFunc = spline(b);
18409
+ return (t2) => [rFunc(t2), gFunc(t2), bFunc(t2)];
18372
18410
  };
18373
18411
  }
18374
18412
  function basis(values2) {
@@ -18404,17 +18442,19 @@ function getCellColors(params) {
18404
18442
  }
18405
18443
  return /* @__PURE__ */ new Map();
18406
18444
  }
18407
- const defaultPoolSize = typeof navigator !== "undefined" ? navigator.hardwareConcurrency || 4 : null;
18445
+ const defaultPoolSize = typeof navigator !== "undefined" ? navigator.hardwareConcurrency || 4 : 1;
18408
18446
  class Pool {
18409
18447
  /**
18410
18448
  * @constructor
18411
18449
  * @param {object} Worker The worker class to be used for processing.
18412
18450
  */
18413
18451
  constructor(createWorker2) {
18452
+ __publicField(this, "workers");
18453
+ __publicField(this, "idleWorkers");
18454
+ __publicField(this, "waitQueue");
18414
18455
  this.workers = [];
18415
18456
  this.idleWorkers = [];
18416
18457
  this.waitQueue = [];
18417
- this.decoder = null;
18418
18458
  for (let i2 = 0; i2 < defaultPoolSize; ++i2) {
18419
18459
  const w2 = createWorker2();
18420
18460
  this.workers.push(w2);
@@ -18439,7 +18479,7 @@ class Pool {
18439
18479
  }
18440
18480
  async finishTask(currentWorker) {
18441
18481
  const waiter = this.waitQueue.pop();
18442
- if (waiter) {
18482
+ if (waiter && waiter.resolve) {
18443
18483
  waiter.resolve(currentWorker);
18444
18484
  } else {
18445
18485
  this.idleWorkers.push(currentWorker);
@@ -30597,9 +30637,9 @@ function Legend(props2) {
30597
30637
  const hasSubLabel = subLabel !== null;
30598
30638
  if (!isSetColor) {
30599
30639
  g2.append("text").attr("text-anchor", hasSubLabel ? "start" : "end").attr("dominant-baseline", "hanging").attr("x", hasSubLabel ? 0 : width).attr("y", 0).text(mainLabel).style("font-size", "10px").style("fill", foregroundColor);
30600
- }
30601
- if (hasSubLabel) {
30602
- g2.append("text").attr("text-anchor", "end").attr("dominant-baseline", "hanging").attr("x", width).attr("y", titleHeight).text(subLabel).style("font-size", "9px").style("fill", foregroundColor);
30640
+ if (hasSubLabel) {
30641
+ g2.append("text").attr("text-anchor", "end").attr("dominant-baseline", "hanging").attr("x", width).attr("y", titleHeight).text(subLabel).style("font-size", "9px").style("fill", foregroundColor);
30642
+ }
30603
30643
  }
30604
30644
  }, [
30605
30645
  width,
@@ -33558,7 +33598,7 @@ const jsonLoader = {
33558
33598
  testText: isJSON,
33559
33599
  parseTextSync: JSON.parse
33560
33600
  };
33561
- const version = "8.8.20";
33601
+ const version = "8.8.27";
33562
33602
  const existingVersion = globalThis.deck && globalThis.deck.VERSION;
33563
33603
  if (existingVersion && existingVersion !== version) {
33564
33604
  throw new Error("deck.gl - multiple versions detected: ".concat(existingVersion, " vs ").concat(version));
@@ -34757,9 +34797,8 @@ function cssToDeviceRatio(gl) {
34757
34797
  luma
34758
34798
  } = gl;
34759
34799
  if (gl.canvas && luma) {
34760
- const {
34761
- clientWidth
34762
- } = luma.canvasSizeInfo;
34800
+ const cachedSize = luma.canvasSizeInfo;
34801
+ const clientWidth = "clientWidth" in cachedSize ? cachedSize.clientWidth : gl.canvas.clientWidth;
34763
34802
  return clientWidth ? gl.drawingBufferWidth / clientWidth : 1;
34764
34803
  }
34765
34804
  return 1;
@@ -35015,7 +35054,7 @@ function setDevicePixelRatio(gl, devicePixelRatio, options) {
35015
35054
  });
35016
35055
  }
35017
35056
  }
35018
- const VERSION$7 = "8.5.16";
35057
+ const VERSION$7 = "8.5.21";
35019
35058
  const STARTUP_MESSAGE = "set luma.log.level=1 (or higher) to trace rendering";
35020
35059
  class StatsManager {
35021
35060
  constructor() {
@@ -35136,7 +35175,6 @@ let Resource$1 = class Resource {
35136
35175
  this._handle = this._createHandle();
35137
35176
  }
35138
35177
  this.byteLength = 0;
35139
- this._initStats();
35140
35178
  this._addStats();
35141
35179
  }
35142
35180
  toString() {
@@ -35272,9 +35310,6 @@ let Resource$1 = class Resource {
35272
35310
  this.gl.luma = this.gl.luma || {};
35273
35311
  return this.gl.luma;
35274
35312
  }
35275
- _initStats() {
35276
- this.gl.stats = this.gl.stats || new StatsManager();
35277
- }
35278
35313
  _addStats() {
35279
35314
  const name2 = this[Symbol.toStringTag];
35280
35315
  const stats = lumaStats.get("Resource Counts");
@@ -35289,27 +35324,29 @@ let Resource$1 = class Resource {
35289
35324
  }
35290
35325
  _trackAllocatedMemory(bytes) {
35291
35326
  let name2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this[Symbol.toStringTag];
35292
- this._doTrackAllocatedMemory(bytes, name2);
35293
- this._doTrackAllocatedMemory(bytes, name2, this.gl.stats.get("Memory Usage"));
35327
+ this._trackAllocatedMemoryForContext(bytes, name2);
35328
+ this._trackAllocatedMemoryForContext(bytes, name2, this.gl.canvas && this.gl.canvas.id);
35329
+ this.byteLength = bytes;
35294
35330
  }
35295
- _doTrackAllocatedMemory(bytes) {
35331
+ _trackAllocatedMemoryForContext(bytes) {
35296
35332
  let name2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this[Symbol.toStringTag];
35297
- let stats = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : lumaStats.get("Memory Usage");
35333
+ let id = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
35334
+ const stats = lumaStats.get("Memory Usage".concat(id));
35298
35335
  stats.get("GPU Memory").addCount(bytes);
35299
35336
  stats.get("".concat(name2, " Memory")).addCount(bytes);
35300
- this.byteLength = bytes;
35301
35337
  }
35302
35338
  _trackDeallocatedMemory() {
35303
35339
  let name2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this[Symbol.toStringTag];
35304
- this._doTrackDeallocatedMemory(name2);
35305
- this._doTrackDeallocatedMemory(name2, this.gl.stats.get("Memory Usage"));
35340
+ this._trackDeallocatedMemoryForContext(name2);
35341
+ this._trackDeallocatedMemoryForContext(name2, this.gl.canvas && this.gl.canvas.id);
35342
+ this.byteLength = 0;
35306
35343
  }
35307
- _doTrackDeallocatedMemory() {
35344
+ _trackDeallocatedMemoryForContext() {
35308
35345
  let name2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this[Symbol.toStringTag];
35309
- let stats = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : lumaStats.get("Memory Usage");
35346
+ let id = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
35347
+ const stats = lumaStats.get("Memory Usage".concat(id));
35310
35348
  stats.get("GPU Memory").subtractCount(this.byteLength);
35311
35349
  stats.get("".concat(name2, " Memory")).subtractCount(this.byteLength);
35312
- this.byteLength = 0;
35313
35350
  }
35314
35351
  };
35315
35352
  const ERR_TYPE_DEDUCTION = "Failed to deduce GL constant from typed array";
@@ -48525,6 +48562,7 @@ const picking = {
48525
48562
  inject: {
48526
48563
  "vs:DECKGL_FILTER_GL_POSITION": "\n // for picking depth values\n picking_setPickingAttribute(position.z / position.w);\n ",
48527
48564
  "vs:DECKGL_FILTER_COLOR": "\n picking_setPickingColor(geometry.pickingColor);\n ",
48565
+ "fs:#decl": "\nuniform bool picking_uAttribute;\n ",
48528
48566
  "fs:DECKGL_FILTER_COLOR": {
48529
48567
  order: 99,
48530
48568
  injection: "\n // use highlight color if this fragment belongs to the selected object.\n color = picking_filterHighlightColor(color);\n\n // use picking color if rendering to picking FBO.\n color = picking_filterPickingColor(color);\n "
@@ -49335,6 +49373,9 @@ class Viewport {
49335
49373
  this.projectFlat = this.projectFlat.bind(this);
49336
49374
  this.unprojectFlat = this.unprojectFlat.bind(this);
49337
49375
  }
49376
+ get subViewports() {
49377
+ return null;
49378
+ }
49338
49379
  get metersPerPixel() {
49339
49380
  return this.distanceScales.metersPerUnit[2] / this.scale;
49340
49381
  }
@@ -58226,7 +58267,7 @@ class Attribute extends DataColumn {
58226
58267
  const {
58227
58268
  startIndices
58228
58269
  } = this;
58229
- const vertexIndex = startIndices ? startIndices[row] : row;
58270
+ const vertexIndex = startIndices ? row < startIndices.length ? startIndices[row] : this.numInstances : row;
58230
58271
  return vertexIndex * this.size;
58231
58272
  }
58232
58273
  getShaderAttributes() {
@@ -60870,7 +60911,7 @@ class Layer extends Component {
60870
60911
  if (Array.isArray(highlightColor)) {
60871
60912
  parameters.pickingHighlightColor = highlightColor;
60872
60913
  }
60873
- if (Number.isInteger(highlightedObjectIndex)) {
60914
+ if (forceUpdate || highlightedObjectIndex !== oldProps.highlightedObjectIndex) {
60874
60915
  parameters.pickingSelectedColor = Number.isFinite(highlightedObjectIndex) && highlightedObjectIndex >= 0 ? this.encodePickingColor(highlightedObjectIndex) : null;
60875
60916
  }
60876
60917
  this.setModuleParameters(parameters);
@@ -62233,7 +62274,7 @@ function interpolateQuad(quad, ut, vt) {
62233
62274
  }
62234
62275
  const vs$g = "\n#define SHADER_NAME bitmap-layer-vertex-shader\n\nattribute vec2 texCoords;\nattribute vec3 positions;\nattribute vec3 positions64Low;\n\nvarying vec2 vTexCoord;\nvarying vec2 vTexPos;\n\nuniform float coordinateConversion;\n\nconst vec3 pickingColor = vec3(1.0, 0.0, 0.0);\n\nvoid main(void) {\n geometry.worldPosition = positions;\n geometry.uv = texCoords;\n geometry.pickingColor = pickingColor;\n\n gl_Position = project_position_to_clipspace(positions, positions64Low, vec3(0.0), geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n\n vTexCoord = texCoords;\n\n if (coordinateConversion < -0.5) {\n vTexPos = geometry.position.xy + project_uCommonOrigin.xy;\n } else if (coordinateConversion > 0.5) {\n vTexPos = geometry.worldPosition.xy;\n }\n\n vec4 color = vec4(0.0);\n DECKGL_FILTER_COLOR(color, geometry);\n}\n";
62235
62276
  const packUVsIntoRGB = "\nvec3 packUVsIntoRGB(vec2 uv) {\n // Extract the top 8 bits. We want values to be truncated down so we can add a fraction\n vec2 uv8bit = floor(uv * 256.);\n\n // Calculate the normalized remainders of u and v parts that do not fit into 8 bits\n // Scale and clamp to 0-1 range\n vec2 uvFraction = fract(uv * 256.);\n vec2 uvFraction4bit = floor(uvFraction * 16.);\n\n // Remainder can be encoded in blue channel, encode as 4 bits for pixel coordinates\n float fractions = uvFraction4bit.x + uvFraction4bit.y * 16.;\n\n return vec3(uv8bit, fractions) / 255.;\n}\n";
62236
- const fs$i = "\n#define SHADER_NAME bitmap-layer-fragment-shader\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform sampler2D bitmapTexture;\n\nvarying vec2 vTexCoord;\nvarying vec2 vTexPos;\n\nuniform float desaturate;\nuniform vec4 transparentColor;\nuniform vec3 tintColor;\nuniform float opacity;\n\nuniform float coordinateConversion;\nuniform vec4 bounds;\n\n/* projection utils */\nconst float TILE_SIZE = 512.0;\nconst float PI = 3.1415926536;\nconst float WORLD_SCALE = TILE_SIZE / PI / 2.0;\n\n// from degrees to Web Mercator\nvec2 lnglat_to_mercator(vec2 lnglat) {\n float x = lnglat.x;\n float y = clamp(lnglat.y, -89.9, 89.9);\n return vec2(\n radians(x) + PI,\n PI + log(tan(PI * 0.25 + radians(y) * 0.5))\n ) * WORLD_SCALE;\n}\n\n// from Web Mercator to degrees\nvec2 mercator_to_lnglat(vec2 xy) {\n xy /= WORLD_SCALE;\n return degrees(vec2(\n xy.x - PI,\n atan(exp(xy.y - PI)) * 2.0 - PI * 0.5\n ));\n}\n/* End projection utils */\n\n// apply desaturation\nvec3 color_desaturate(vec3 color) {\n float luminance = (color.r + color.g + color.b) * 0.333333333;\n return mix(color, vec3(luminance), desaturate);\n}\n\n// apply tint\nvec3 color_tint(vec3 color) {\n return color * tintColor;\n}\n\n// blend with background color\nvec4 apply_opacity(vec3 color, float alpha) {\n return mix(transparentColor, vec4(color, 1.0), alpha);\n}\n\nvec2 getUV(vec2 pos) {\n return vec2(\n (pos.x - bounds[0]) / (bounds[2] - bounds[0]),\n (pos.y - bounds[3]) / (bounds[1] - bounds[3])\n );\n}\n\n".concat(packUVsIntoRGB, "\n\nvoid main(void) {\n vec2 uv = vTexCoord;\n if (coordinateConversion < -0.5) {\n vec2 lnglat = mercator_to_lnglat(vTexPos);\n uv = getUV(lnglat);\n } else if (coordinateConversion > 0.5) {\n vec2 commonPos = lnglat_to_mercator(vTexPos);\n uv = getUV(commonPos);\n }\n vec4 bitmapColor = texture2D(bitmapTexture, uv);\n\n gl_FragColor = apply_opacity(color_tint(color_desaturate(bitmapColor.rgb)), bitmapColor.a * opacity);\n\n geometry.uv = uv;\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n\n if (picking_uActive) {\n // Since instance information is not used, we can use picking color for pixel index\n gl_FragColor.rgb = packUVsIntoRGB(uv);\n }\n}\n");
62277
+ const fs$i = "\n#define SHADER_NAME bitmap-layer-fragment-shader\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform sampler2D bitmapTexture;\n\nvarying vec2 vTexCoord;\nvarying vec2 vTexPos;\n\nuniform float desaturate;\nuniform vec4 transparentColor;\nuniform vec3 tintColor;\nuniform float opacity;\n\nuniform float coordinateConversion;\nuniform vec4 bounds;\n\n/* projection utils */\nconst float TILE_SIZE = 512.0;\nconst float PI = 3.1415926536;\nconst float WORLD_SCALE = TILE_SIZE / PI / 2.0;\n\n// from degrees to Web Mercator\nvec2 lnglat_to_mercator(vec2 lnglat) {\n float x = lnglat.x;\n float y = clamp(lnglat.y, -89.9, 89.9);\n return vec2(\n radians(x) + PI,\n PI + log(tan(PI * 0.25 + radians(y) * 0.5))\n ) * WORLD_SCALE;\n}\n\n// from Web Mercator to degrees\nvec2 mercator_to_lnglat(vec2 xy) {\n xy /= WORLD_SCALE;\n return degrees(vec2(\n xy.x - PI,\n atan(exp(xy.y - PI)) * 2.0 - PI * 0.5\n ));\n}\n/* End projection utils */\n\n// apply desaturation\nvec3 color_desaturate(vec3 color) {\n float luminance = (color.r + color.g + color.b) * 0.333333333;\n return mix(color, vec3(luminance), desaturate);\n}\n\n// apply tint\nvec3 color_tint(vec3 color) {\n return color * tintColor;\n}\n\n// blend with background color\nvec4 apply_opacity(vec3 color, float alpha) {\n return mix(transparentColor, vec4(color, 1.0), alpha);\n}\n\nvec2 getUV(vec2 pos) {\n return vec2(\n (pos.x - bounds[0]) / (bounds[2] - bounds[0]),\n (pos.y - bounds[3]) / (bounds[1] - bounds[3])\n );\n}\n\n".concat(packUVsIntoRGB, "\n\nvoid main(void) {\n vec2 uv = vTexCoord;\n if (coordinateConversion < -0.5) {\n vec2 lnglat = mercator_to_lnglat(vTexPos);\n uv = getUV(lnglat);\n } else if (coordinateConversion > 0.5) {\n vec2 commonPos = lnglat_to_mercator(vTexPos);\n uv = getUV(commonPos);\n }\n vec4 bitmapColor = texture2D(bitmapTexture, uv);\n\n gl_FragColor = apply_opacity(color_tint(color_desaturate(bitmapColor.rgb)), bitmapColor.a * opacity);\n\n geometry.uv = uv;\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n\n if (picking_uActive && !picking_uAttribute) {\n // Since instance information is not used, we can use picking color for pixel index\n gl_FragColor.rgb = packUVsIntoRGB(uv);\n }\n}\n");
62237
62278
  const defaultProps$I = {
62238
62279
  image: {
62239
62280
  type: "image",
@@ -70373,18 +70414,22 @@ function getBoundingBox(viewport, zRange, extent2) {
70373
70414
  }
70374
70415
  function getCullBounds({
70375
70416
  viewport,
70376
- z: z2,
70417
+ z: z2 = 0,
70377
70418
  cullRect
70378
70419
  }) {
70379
- const x2 = cullRect.x - viewport.x;
70380
- const y2 = cullRect.y - viewport.y;
70381
- const {
70382
- width,
70383
- height
70384
- } = cullRect;
70420
+ const subViewports = viewport.subViewports || [viewport];
70421
+ return subViewports.map((v) => getCullBoundsInViewport(v, z2, cullRect));
70422
+ }
70423
+ function getCullBoundsInViewport(viewport, z2, cullRect) {
70385
70424
  if (!Array.isArray(z2)) {
70425
+ const x2 = cullRect.x - viewport.x;
70426
+ const y2 = cullRect.y - viewport.y;
70427
+ const {
70428
+ width,
70429
+ height
70430
+ } = cullRect;
70386
70431
  const unprojectOption = {
70387
- targetZ: z2 || 0
70432
+ targetZ: z2
70388
70433
  };
70389
70434
  const topLeft = viewport.unproject([x2, y2], unprojectOption);
70390
70435
  const topRight = viewport.unproject([x2 + width, y2], unprojectOption);
@@ -70392,16 +70437,8 @@ function getCullBounds({
70392
70437
  const bottomRight = viewport.unproject([x2 + width, y2 + height], unprojectOption);
70393
70438
  return [Math.min(topLeft[0], topRight[0], bottomLeft[0], bottomRight[0]), Math.min(topLeft[1], topRight[1], bottomLeft[1], bottomRight[1]), Math.max(topLeft[0], topRight[0], bottomLeft[0], bottomRight[0]), Math.max(topLeft[1], topRight[1], bottomLeft[1], bottomRight[1])];
70394
70439
  }
70395
- const bounds0 = getCullBounds({
70396
- viewport,
70397
- z: z2[0],
70398
- cullRect
70399
- });
70400
- const bounds1 = getCullBounds({
70401
- viewport,
70402
- z: z2[1],
70403
- cullRect
70404
- });
70440
+ const bounds0 = getCullBoundsInViewport(viewport, z2[0], cullRect);
70441
+ const bounds1 = getCullBoundsInViewport(viewport, z2[1], cullRect);
70405
70442
  return [Math.min(bounds0[0], bounds1[0]), Math.min(bounds0[1], bounds1[1]), Math.max(bounds0[2], bounds1[2]), Math.max(bounds0[3], bounds1[3])];
70406
70443
  }
70407
70444
  function getIndexingCoords(bbox2, scale2, modelMatrixInverse) {
@@ -70631,7 +70668,7 @@ class Tileset2D {
70631
70668
  return false;
70632
70669
  }
70633
70670
  if (cullRect && this._viewport) {
70634
- const [minX, minY, maxX, maxY] = getCullBounds({
70671
+ const boundsArr = this._getCullBounds({
70635
70672
  viewport: this._viewport,
70636
70673
  z: this._zRange,
70637
70674
  cullRect
@@ -70639,12 +70676,20 @@ class Tileset2D {
70639
70676
  const {
70640
70677
  bbox: bbox2
70641
70678
  } = tile;
70642
- if ("west" in bbox2) {
70643
- return bbox2.west < maxX && bbox2.east > minX && bbox2.south < maxY && bbox2.north > minY;
70679
+ for (const [minX, minY, maxX, maxY] of boundsArr) {
70680
+ let overlaps;
70681
+ if ("west" in bbox2) {
70682
+ overlaps = bbox2.west < maxX && bbox2.east > minX && bbox2.south < maxY && bbox2.north > minY;
70683
+ } else {
70684
+ const y02 = Math.min(bbox2.top, bbox2.bottom);
70685
+ const y12 = Math.max(bbox2.top, bbox2.bottom);
70686
+ overlaps = bbox2.left < maxX && bbox2.right > minX && y02 < maxY && y12 > minY;
70687
+ }
70688
+ if (overlaps) {
70689
+ return true;
70690
+ }
70644
70691
  }
70645
- const y02 = Math.min(bbox2.top, bbox2.bottom);
70646
- const y12 = Math.max(bbox2.top, bbox2.bottom);
70647
- return bbox2.left < maxX && bbox2.right > minX && y02 < maxY && y12 > minY;
70692
+ return false;
70648
70693
  }
70649
70694
  return true;
70650
70695
  }
@@ -71093,14 +71138,19 @@ class TileLayer extends CompositeLayer {
71093
71138
  info,
71094
71139
  sourceLayer
71095
71140
  }) {
71141
+ const sourceTile = sourceLayer.props.tile;
71096
71142
  if (info.picked) {
71097
- info.tile = sourceLayer.props.tile;
71143
+ info.tile = sourceTile;
71098
71144
  }
71145
+ info.sourceTile = sourceTile;
71099
71146
  return info;
71100
71147
  }
71101
71148
  _updateAutoHighlight(info) {
71102
- if (info.sourceLayer) {
71103
- info.sourceLayer.updateAutoHighlight(info);
71149
+ const sourceTile = info.sourceTile;
71150
+ if (sourceTile && sourceTile.layers) {
71151
+ for (const layer of sourceTile.layers) {
71152
+ layer.updateAutoHighlight(info);
71153
+ }
71104
71154
  }
71105
71155
  }
71106
71156
  renderLayers() {
@@ -83418,6 +83468,9 @@ class ScenegraphNode {
83418
83468
  toString() {
83419
83469
  return "{type: ScenegraphNode, id: ".concat(this.id, ")}");
83420
83470
  }
83471
+ getBounds() {
83472
+ return null;
83473
+ }
83421
83474
  setPosition(position) {
83422
83475
  assert$8(position.length === 3, "setPosition requires vector argument");
83423
83476
  this.position = position;
@@ -83568,6 +83621,34 @@ class GroupNode extends ScenegraphNode {
83568
83621
  this.removeAll();
83569
83622
  super.delete();
83570
83623
  }
83624
+ getBounds() {
83625
+ const result = [[Infinity, Infinity, Infinity], [-Infinity, -Infinity, -Infinity]];
83626
+ this.traverse((node, _ref) => {
83627
+ let {
83628
+ worldMatrix
83629
+ } = _ref;
83630
+ const bounds2 = node.getBounds();
83631
+ if (!bounds2) {
83632
+ return;
83633
+ }
83634
+ const [min, max] = bounds2;
83635
+ const center2 = new Vector3(min).add(max).divide([2, 2, 2]);
83636
+ worldMatrix.transformAsPoint(center2, center2);
83637
+ const halfSize = new Vector3(max).subtract(min).divide([2, 2, 2]);
83638
+ worldMatrix.transformAsVector(halfSize, halfSize);
83639
+ for (let v = 0; v < 8; v++) {
83640
+ const position = new Vector3(v & 1 ? -1 : 1, v & 2 ? -1 : 1, v & 4 ? -1 : 1).multiply(halfSize).add(center2);
83641
+ for (let i2 = 0; i2 < 3; i2++) {
83642
+ result[0][i2] = Math.min(result[0][i2], position[i2]);
83643
+ result[1][i2] = Math.max(result[1][i2], position[i2]);
83644
+ }
83645
+ }
83646
+ });
83647
+ if (!Number.isFinite(result[0][0])) {
83648
+ return null;
83649
+ }
83650
+ return result;
83651
+ }
83571
83652
  traverse(visitor) {
83572
83653
  let {
83573
83654
  worldMatrix = new Matrix4()
@@ -83817,6 +83898,7 @@ class ModelNode extends ScenegraphNode {
83817
83898
  } else {
83818
83899
  this.model = new Model(gl, props2);
83819
83900
  }
83901
+ this.bounds = null;
83820
83902
  this.managedResources = props2.managedResources || [];
83821
83903
  }
83822
83904
  setProps(props2) {
@@ -83824,6 +83906,9 @@ class ModelNode extends ScenegraphNode {
83824
83906
  this._setModelNodeProps(props2);
83825
83907
  return this;
83826
83908
  }
83909
+ getBounds() {
83910
+ return this.bounds;
83911
+ }
83827
83912
  delete() {
83828
83913
  if (this.model) {
83829
83914
  this.model.delete();
@@ -84008,17 +84093,21 @@ function createGLTFModel(gl, options) {
84008
84093
  const managedResources = [];
84009
84094
  managedResources.push(...materialParser.generatedTextures);
84010
84095
  managedResources.push(...Object.values(attributes).map((attribute) => attribute.buffer));
84011
- const model = new ModelNode(gl, Object.assign({
84096
+ const model = new ModelNode(gl, {
84012
84097
  id,
84013
84098
  drawMode,
84014
84099
  vertexCount,
84015
84100
  modules: [pbr],
84016
- defines: materialParser.defines,
84017
84101
  parameters: materialParser.parameters,
84018
84102
  vs: addVersionToShader(gl, vs$7),
84019
84103
  fs: addVersionToShader(gl, fs$7),
84020
- managedResources
84021
- }, modelOptions));
84104
+ managedResources,
84105
+ ...modelOptions,
84106
+ defines: {
84107
+ ...materialParser.defines,
84108
+ ...modelOptions.defines
84109
+ }
84110
+ });
84022
84111
  model.setProps({
84023
84112
  attributes
84024
84113
  });
@@ -84113,13 +84202,15 @@ class GLTFInstantiator {
84113
84202
  log$2.warn("getVertexCount() not found")();
84114
84203
  }
84115
84204
  createPrimitive(gltfPrimitive, i2, gltfMesh) {
84116
- return createGLTFModel(this.gl, Object.assign({
84205
+ const model = createGLTFModel(this.gl, Object.assign({
84117
84206
  id: gltfPrimitive.name || "".concat(gltfMesh.name || gltfMesh.id, "-primitive-").concat(i2),
84118
84207
  drawMode: gltfPrimitive.mode || 4,
84119
84208
  vertexCount: gltfPrimitive.indices ? gltfPrimitive.indices.count : this.getVertexCount(gltfPrimitive.attributes),
84120
84209
  attributes: this.createAttributes(gltfPrimitive.attributes, gltfPrimitive.indices),
84121
84210
  material: gltfPrimitive.material
84122
84211
  }, this.options));
84212
+ model.bounds = [gltfPrimitive.attributes.POSITION.min, gltfPrimitive.attributes.POSITION.max];
84213
+ return model;
84123
84214
  }
84124
84215
  createAttributes(attributes, indices) {
84125
84216
  const loadedAttributes = {};
@@ -92047,15 +92138,11 @@ class Tile3DLayer extends CompositeLayer {
92047
92138
  info,
92048
92139
  sourceLayer
92049
92140
  }) {
92050
- const {
92051
- layerMap
92052
- } = this.state;
92053
- const layerId = sourceLayer && sourceLayer.id;
92054
- if (layerId) {
92055
- const substr = layerId.substring(this.id.length + 1);
92056
- const tileId = substr.substring(substr.indexOf("-") + 1);
92057
- info.object = layerMap[tileId] && layerMap[tileId].tile;
92141
+ const sourceTile = sourceLayer && sourceLayer.props.tile;
92142
+ if (info.picked) {
92143
+ info.object = sourceTile;
92058
92144
  }
92145
+ info.sourceTile = sourceTile;
92059
92146
  return info;
92060
92147
  }
92061
92148
  filterSubLayer({
@@ -92071,8 +92158,10 @@ class Tile3DLayer extends CompositeLayer {
92071
92158
  return tile.selected && tile.viewportIds.includes(viewportId);
92072
92159
  }
92073
92160
  _updateAutoHighlight(info) {
92074
- if (info.sourceLayer) {
92075
- info.sourceLayer.updateAutoHighlight(info);
92161
+ const sourceTile = info.sourceTile;
92162
+ const layerCache = this.state.layerMap[sourceTile === null || sourceTile === void 0 ? void 0 : sourceTile.id];
92163
+ if (layerCache && layerCache.layer) {
92164
+ layerCache.layer.updateAutoHighlight(info);
92076
92165
  }
92077
92166
  }
92078
92167
  async _loadTileset(tilesetUrl) {
@@ -132521,16 +132610,16 @@ function addDecoder(cases, importFn) {
132521
132610
  }
132522
132611
  cases.forEach((c) => registry$1.set(c, importFn));
132523
132612
  }
132524
- addDecoder([void 0, 1], () => import("./raw-ed466def.js").then((m) => m.default));
132525
- addDecoder(5, () => import("./lzw-dcec678f.js").then((m) => m.default));
132613
+ addDecoder([void 0, 1], () => import("./raw-70e6b59a.js").then((m) => m.default));
132614
+ addDecoder(5, () => import("./lzw-a69646f9.js").then((m) => m.default));
132526
132615
  addDecoder(6, () => {
132527
132616
  throw new Error("old style JPEG compression is not supported.");
132528
132617
  });
132529
- addDecoder(7, () => import("./jpeg-91201fe5.js").then((m) => m.default));
132530
- addDecoder([8, 32946], () => import("./deflate-54e8a983.js").then((m) => m.default));
132531
- addDecoder(32773, () => import("./packbits-1f0b4f8a.js").then((m) => m.default));
132532
- addDecoder(34887, () => import("./lerc-ede29ce8.js").then((m) => m.default));
132533
- addDecoder(50001, () => import("./webimage-892fe81d.js").then((m) => m.default));
132618
+ addDecoder(7, () => import("./jpeg-aa77b6ec.js").then((m) => m.default));
132619
+ addDecoder([8, 32946], () => import("./deflate-9263f588.js").then((m) => m.default));
132620
+ addDecoder(32773, () => import("./packbits-fe4063d1.js").then((m) => m.default));
132621
+ addDecoder(34887, () => import("./lerc-1fcb6280.js").then((m) => m.default));
132622
+ addDecoder(50001, () => import("./webimage-093820b7.js").then((m) => m.default));
132534
132623
  function decodeRowAcc(row, stride) {
132535
132624
  let length2 = row.length - stride;
132536
132625
  let offset5 = 0;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a, H } from "./index-99684608.js";
1
+ import { a, H } from "./index-6515eb5d.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-99684608.js";
1
+ import { B as BaseDecoder } from "./index-6515eb5d.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-68f84e2a.js";
2
- import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-99684608.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-6515eb5d.js";
3
3
  import "react";
4
4
  import "@vitessce/vit-s";
5
5
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-99684608.js";
1
+ import { B as BaseDecoder } from "./index-6515eb5d.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-99684608.js";
1
+ import { B as BaseDecoder } from "./index-6515eb5d.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-99684608.js";
1
+ import { B as BaseDecoder } from "./index-6515eb5d.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-99684608.js";
1
+ import { B as BaseDecoder } from "./index-6515eb5d.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/heatmap",
3
- "version": "3.2.2",
3
+ "version": "3.3.1",
4
4
  "author": "Gehlenborg Lab",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -20,14 +20,14 @@
20
20
  "lodash-es": "^4.17.21",
21
21
  "uuid": "^9.0.0",
22
22
  "react-aria": "^3.28.0",
23
- "@vitessce/constants-internal": "3.2.2",
24
- "@vitessce/gl": "3.2.2",
25
- "@vitessce/legend": "3.2.2",
26
- "@vitessce/sets-utils": "3.2.2",
27
- "@vitessce/tooltip": "3.2.2",
28
- "@vitessce/utils": "3.2.2",
29
- "@vitessce/vit-s": "3.2.2",
30
- "@vitessce/workers": "3.2.2"
23
+ "@vitessce/constants-internal": "3.3.1",
24
+ "@vitessce/legend": "3.3.1",
25
+ "@vitessce/sets-utils": "3.3.1",
26
+ "@vitessce/gl": "3.3.1",
27
+ "@vitessce/tooltip": "3.3.1",
28
+ "@vitessce/utils": "3.3.1",
29
+ "@vitessce/workers": "3.3.1",
30
+ "@vitessce/vit-s": "3.3.1"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@testing-library/jest-dom": "^5.16.4",