@vitessce/layer-controller 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-a79502da.js";
2
+ import { B as BaseDecoder } from "./index-1314685c.js";
3
3
  import "react";
4
4
  import "@vitessce/vit-s";
5
5
  import "react-dom";
@@ -16837,6 +16837,7 @@ const DataType$2 = {
16837
16837
  const FileType$1 = {
16838
16838
  // Joint file types
16839
16839
  ANNDATA_ZARR: "anndata.zarr",
16840
+ SPATIALDATA_ZARR: "spatialdata.zarr",
16840
16841
  // Atomic file types
16841
16842
  OBS_EMBEDDING_CSV: "obsEmbedding.csv",
16842
16843
  OBS_SPOTS_CSV: "obsSpots.csv",
@@ -16859,6 +16860,16 @@ const FileType$1 = {
16859
16860
  OBS_SEGMENTATIONS_ANNDATA_ZARR: "obsSegmentations.anndata.zarr",
16860
16861
  OBS_LABELS_ANNDATA_ZARR: "obsLabels.anndata.zarr",
16861
16862
  FEATURE_LABELS_ANNDATA_ZARR: "featureLabels.anndata.zarr",
16863
+ // SpatialData
16864
+ IMAGE_SPATIALDATA_ZARR: "image.spatialdata.zarr",
16865
+ LABELS_SPATIALDATA_ZARR: "labels.spatialdata.zarr",
16866
+ SHAPES_SPATIALDATA_ZARR: "shapes.spatialdata.zarr",
16867
+ OBS_FEATURE_MATRIX_SPATIALDATA_ZARR: "obsFeatureMatrix.spatialdata.zarr",
16868
+ OBS_SETS_SPATIALDATA_ZARR: "obsSets.spatialdata.zarr",
16869
+ OBS_SPOTS_SPATIALDATA_ZARR: "obsSpots.spatialdata.zarr",
16870
+ // TODO:
16871
+ // OBS_POINTS_SPATIALDATA_ZARR: 'obsPoints.spatialdata.zarr',
16872
+ // OBS_LOCATIONS_SPATIALDATA_ZARR: 'obsLocations.spatialdata.zarr',
16862
16873
  // MuData
16863
16874
  OBS_FEATURE_MATRIX_MUDATA_ZARR: "obsFeatureMatrix.mudata.zarr",
16864
16875
  OBS_SETS_MUDATA_ZARR: "obsSets.mudata.zarr",
@@ -27522,9 +27533,30 @@ z.object({
27522
27533
  offsetsUrl: z.string().optional(),
27523
27534
  coordinateTransformations: omeCoordinateTransformations.optional()
27524
27535
  });
27525
- z.object({
27536
+ const imageOmeZarrSchema = z.object({
27526
27537
  coordinateTransformations: omeCoordinateTransformations.optional()
27527
27538
  });
27539
+ imageOmeZarrSchema.extend({
27540
+ path: z.string()
27541
+ });
27542
+ z.object({
27543
+ path: z.string()
27544
+ });
27545
+ z.object({
27546
+ path: z.string()
27547
+ });
27548
+ z.object({
27549
+ path: z.string(),
27550
+ 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.")
27551
+ });
27552
+ annDataObsFeatureMatrix.extend({
27553
+ region: z.string().describe("The name of a region to use to filter instances (i.e., rows) in the table").optional()
27554
+ });
27555
+ z.object({
27556
+ region: z.string().describe("The name of a region to use to filter instances (i.e., rows) in the table").optional(),
27557
+ tablePath: z.string().optional().describe("The path to a table which contains the index for the set values."),
27558
+ obsSets: annDataObsSets
27559
+ });
27528
27560
  z.object({
27529
27561
  obsIndex: z.string(),
27530
27562
  obsEmbedding: z.array(z.string()).length(2)
@@ -34082,9 +34114,9 @@ const schemePlasma = [[13, 8, 135], [16, 7, 136], [19, 7, 137], [22, 7, 138], [2
34082
34114
  function rgbSpline(spline) {
34083
34115
  return (colors) => {
34084
34116
  const n2 = colors.length;
34085
- let r2 = new Array(n2);
34086
- let g2 = new Array(n2);
34087
- let b = new Array(n2);
34117
+ const r2 = new Array(n2);
34118
+ const g2 = new Array(n2);
34119
+ const b = new Array(n2);
34088
34120
  let i2;
34089
34121
  let color;
34090
34122
  for (i2 = 0; i2 < n2; ++i2) {
@@ -34093,10 +34125,10 @@ function rgbSpline(spline) {
34093
34125
  g2[i2] = color[1] || 0;
34094
34126
  b[i2] = color[2] || 0;
34095
34127
  }
34096
- r2 = spline(r2);
34097
- g2 = spline(g2);
34098
- b = spline(b);
34099
- return (t2) => [r2(t2), g2(t2), b(t2)];
34128
+ const rFunc = spline(r2);
34129
+ const gFunc = spline(g2);
34130
+ const bFunc = spline(b);
34131
+ return (t2) => [rFunc(t2), gFunc(t2), bFunc(t2)];
34100
34132
  };
34101
34133
  }
34102
34134
  function basis(values2) {
@@ -40661,7 +40693,7 @@ const jsonLoader = {
40661
40693
  testText: isJSON,
40662
40694
  parseTextSync: JSON.parse
40663
40695
  };
40664
- const version = "8.8.20";
40696
+ const version = "8.8.27";
40665
40697
  const existingVersion = globalThis.deck && globalThis.deck.VERSION;
40666
40698
  if (existingVersion && existingVersion !== version) {
40667
40699
  throw new Error("deck.gl - multiple versions detected: ".concat(existingVersion, " vs ").concat(version));
@@ -41860,9 +41892,8 @@ function cssToDeviceRatio(gl) {
41860
41892
  luma
41861
41893
  } = gl;
41862
41894
  if (gl.canvas && luma) {
41863
- const {
41864
- clientWidth
41865
- } = luma.canvasSizeInfo;
41895
+ const cachedSize = luma.canvasSizeInfo;
41896
+ const clientWidth = "clientWidth" in cachedSize ? cachedSize.clientWidth : gl.canvas.clientWidth;
41866
41897
  return clientWidth ? gl.drawingBufferWidth / clientWidth : 1;
41867
41898
  }
41868
41899
  return 1;
@@ -42118,7 +42149,7 @@ function setDevicePixelRatio(gl, devicePixelRatio, options) {
42118
42149
  });
42119
42150
  }
42120
42151
  }
42121
- const VERSION$7 = "8.5.16";
42152
+ const VERSION$7 = "8.5.21";
42122
42153
  const STARTUP_MESSAGE = "set luma.log.level=1 (or higher) to trace rendering";
42123
42154
  class StatsManager {
42124
42155
  constructor() {
@@ -42239,7 +42270,6 @@ let Resource$1 = class Resource {
42239
42270
  this._handle = this._createHandle();
42240
42271
  }
42241
42272
  this.byteLength = 0;
42242
- this._initStats();
42243
42273
  this._addStats();
42244
42274
  }
42245
42275
  toString() {
@@ -42375,9 +42405,6 @@ let Resource$1 = class Resource {
42375
42405
  this.gl.luma = this.gl.luma || {};
42376
42406
  return this.gl.luma;
42377
42407
  }
42378
- _initStats() {
42379
- this.gl.stats = this.gl.stats || new StatsManager();
42380
- }
42381
42408
  _addStats() {
42382
42409
  const name2 = this[Symbol.toStringTag];
42383
42410
  const stats = lumaStats.get("Resource Counts");
@@ -42392,27 +42419,29 @@ let Resource$1 = class Resource {
42392
42419
  }
42393
42420
  _trackAllocatedMemory(bytes) {
42394
42421
  let name2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this[Symbol.toStringTag];
42395
- this._doTrackAllocatedMemory(bytes, name2);
42396
- this._doTrackAllocatedMemory(bytes, name2, this.gl.stats.get("Memory Usage"));
42422
+ this._trackAllocatedMemoryForContext(bytes, name2);
42423
+ this._trackAllocatedMemoryForContext(bytes, name2, this.gl.canvas && this.gl.canvas.id);
42424
+ this.byteLength = bytes;
42397
42425
  }
42398
- _doTrackAllocatedMemory(bytes) {
42426
+ _trackAllocatedMemoryForContext(bytes) {
42399
42427
  let name2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this[Symbol.toStringTag];
42400
- let stats = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : lumaStats.get("Memory Usage");
42428
+ let id = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
42429
+ const stats = lumaStats.get("Memory Usage".concat(id));
42401
42430
  stats.get("GPU Memory").addCount(bytes);
42402
42431
  stats.get("".concat(name2, " Memory")).addCount(bytes);
42403
- this.byteLength = bytes;
42404
42432
  }
42405
42433
  _trackDeallocatedMemory() {
42406
42434
  let name2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this[Symbol.toStringTag];
42407
- this._doTrackDeallocatedMemory(name2);
42408
- this._doTrackDeallocatedMemory(name2, this.gl.stats.get("Memory Usage"));
42435
+ this._trackDeallocatedMemoryForContext(name2);
42436
+ this._trackDeallocatedMemoryForContext(name2, this.gl.canvas && this.gl.canvas.id);
42437
+ this.byteLength = 0;
42409
42438
  }
42410
- _doTrackDeallocatedMemory() {
42439
+ _trackDeallocatedMemoryForContext() {
42411
42440
  let name2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this[Symbol.toStringTag];
42412
- let stats = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : lumaStats.get("Memory Usage");
42441
+ let id = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
42442
+ const stats = lumaStats.get("Memory Usage".concat(id));
42413
42443
  stats.get("GPU Memory").subtractCount(this.byteLength);
42414
42444
  stats.get("".concat(name2, " Memory")).subtractCount(this.byteLength);
42415
- this.byteLength = 0;
42416
42445
  }
42417
42446
  };
42418
42447
  const ERR_TYPE_DEDUCTION = "Failed to deduce GL constant from typed array";
@@ -52027,6 +52056,7 @@ const picking = {
52027
52056
  inject: {
52028
52057
  "vs:DECKGL_FILTER_GL_POSITION": "\n // for picking depth values\n picking_setPickingAttribute(position.z / position.w);\n ",
52029
52058
  "vs:DECKGL_FILTER_COLOR": "\n picking_setPickingColor(geometry.pickingColor);\n ",
52059
+ "fs:#decl": "\nuniform bool picking_uAttribute;\n ",
52030
52060
  "fs:DECKGL_FILTER_COLOR": {
52031
52061
  order: 99,
52032
52062
  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 "
@@ -52837,6 +52867,9 @@ class Viewport {
52837
52867
  this.projectFlat = this.projectFlat.bind(this);
52838
52868
  this.unprojectFlat = this.unprojectFlat.bind(this);
52839
52869
  }
52870
+ get subViewports() {
52871
+ return null;
52872
+ }
52840
52873
  get metersPerPixel() {
52841
52874
  return this.distanceScales.metersPerUnit[2] / this.scale;
52842
52875
  }
@@ -61728,7 +61761,7 @@ class Attribute extends DataColumn {
61728
61761
  const {
61729
61762
  startIndices
61730
61763
  } = this;
61731
- const vertexIndex = startIndices ? startIndices[row] : row;
61764
+ const vertexIndex = startIndices ? row < startIndices.length ? startIndices[row] : this.numInstances : row;
61732
61765
  return vertexIndex * this.size;
61733
61766
  }
61734
61767
  getShaderAttributes() {
@@ -64372,7 +64405,7 @@ class Layer extends Component {
64372
64405
  if (Array.isArray(highlightColor)) {
64373
64406
  parameters.pickingHighlightColor = highlightColor;
64374
64407
  }
64375
- if (Number.isInteger(highlightedObjectIndex)) {
64408
+ if (forceUpdate || highlightedObjectIndex !== oldProps.highlightedObjectIndex) {
64376
64409
  parameters.pickingSelectedColor = Number.isFinite(highlightedObjectIndex) && highlightedObjectIndex >= 0 ? this.encodePickingColor(highlightedObjectIndex) : null;
64377
64410
  }
64378
64411
  this.setModuleParameters(parameters);
@@ -65735,7 +65768,7 @@ function interpolateQuad(quad, ut, vt) {
65735
65768
  }
65736
65769
  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";
65737
65770
  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";
65738
- 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");
65771
+ 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");
65739
65772
  const defaultProps$I = {
65740
65773
  image: {
65741
65774
  type: "image",
@@ -73875,18 +73908,22 @@ function getBoundingBox(viewport, zRange, extent2) {
73875
73908
  }
73876
73909
  function getCullBounds({
73877
73910
  viewport,
73878
- z: z2,
73911
+ z: z2 = 0,
73879
73912
  cullRect
73880
73913
  }) {
73881
- const x2 = cullRect.x - viewport.x;
73882
- const y2 = cullRect.y - viewport.y;
73883
- const {
73884
- width,
73885
- height
73886
- } = cullRect;
73914
+ const subViewports = viewport.subViewports || [viewport];
73915
+ return subViewports.map((v) => getCullBoundsInViewport(v, z2, cullRect));
73916
+ }
73917
+ function getCullBoundsInViewport(viewport, z2, cullRect) {
73887
73918
  if (!Array.isArray(z2)) {
73919
+ const x2 = cullRect.x - viewport.x;
73920
+ const y2 = cullRect.y - viewport.y;
73921
+ const {
73922
+ width,
73923
+ height
73924
+ } = cullRect;
73888
73925
  const unprojectOption = {
73889
- targetZ: z2 || 0
73926
+ targetZ: z2
73890
73927
  };
73891
73928
  const topLeft = viewport.unproject([x2, y2], unprojectOption);
73892
73929
  const topRight = viewport.unproject([x2 + width, y2], unprojectOption);
@@ -73894,16 +73931,8 @@ function getCullBounds({
73894
73931
  const bottomRight = viewport.unproject([x2 + width, y2 + height], unprojectOption);
73895
73932
  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])];
73896
73933
  }
73897
- const bounds0 = getCullBounds({
73898
- viewport,
73899
- z: z2[0],
73900
- cullRect
73901
- });
73902
- const bounds1 = getCullBounds({
73903
- viewport,
73904
- z: z2[1],
73905
- cullRect
73906
- });
73934
+ const bounds0 = getCullBoundsInViewport(viewport, z2[0], cullRect);
73935
+ const bounds1 = getCullBoundsInViewport(viewport, z2[1], cullRect);
73907
73936
  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])];
73908
73937
  }
73909
73938
  function getIndexingCoords(bbox2, scale2, modelMatrixInverse) {
@@ -74133,7 +74162,7 @@ class Tileset2D {
74133
74162
  return false;
74134
74163
  }
74135
74164
  if (cullRect && this._viewport) {
74136
- const [minX, minY, maxX, maxY] = getCullBounds({
74165
+ const boundsArr = this._getCullBounds({
74137
74166
  viewport: this._viewport,
74138
74167
  z: this._zRange,
74139
74168
  cullRect
@@ -74141,12 +74170,20 @@ class Tileset2D {
74141
74170
  const {
74142
74171
  bbox: bbox2
74143
74172
  } = tile;
74144
- if ("west" in bbox2) {
74145
- return bbox2.west < maxX && bbox2.east > minX && bbox2.south < maxY && bbox2.north > minY;
74173
+ for (const [minX, minY, maxX, maxY] of boundsArr) {
74174
+ let overlaps;
74175
+ if ("west" in bbox2) {
74176
+ overlaps = bbox2.west < maxX && bbox2.east > minX && bbox2.south < maxY && bbox2.north > minY;
74177
+ } else {
74178
+ const y02 = Math.min(bbox2.top, bbox2.bottom);
74179
+ const y12 = Math.max(bbox2.top, bbox2.bottom);
74180
+ overlaps = bbox2.left < maxX && bbox2.right > minX && y02 < maxY && y12 > minY;
74181
+ }
74182
+ if (overlaps) {
74183
+ return true;
74184
+ }
74146
74185
  }
74147
- const y02 = Math.min(bbox2.top, bbox2.bottom);
74148
- const y12 = Math.max(bbox2.top, bbox2.bottom);
74149
- return bbox2.left < maxX && bbox2.right > minX && y02 < maxY && y12 > minY;
74186
+ return false;
74150
74187
  }
74151
74188
  return true;
74152
74189
  }
@@ -74595,14 +74632,19 @@ class TileLayer extends CompositeLayer {
74595
74632
  info,
74596
74633
  sourceLayer
74597
74634
  }) {
74635
+ const sourceTile = sourceLayer.props.tile;
74598
74636
  if (info.picked) {
74599
- info.tile = sourceLayer.props.tile;
74637
+ info.tile = sourceTile;
74600
74638
  }
74639
+ info.sourceTile = sourceTile;
74601
74640
  return info;
74602
74641
  }
74603
74642
  _updateAutoHighlight(info) {
74604
- if (info.sourceLayer) {
74605
- info.sourceLayer.updateAutoHighlight(info);
74643
+ const sourceTile = info.sourceTile;
74644
+ if (sourceTile && sourceTile.layers) {
74645
+ for (const layer of sourceTile.layers) {
74646
+ layer.updateAutoHighlight(info);
74647
+ }
74606
74648
  }
74607
74649
  }
74608
74650
  renderLayers() {
@@ -86920,6 +86962,9 @@ class ScenegraphNode {
86920
86962
  toString() {
86921
86963
  return "{type: ScenegraphNode, id: ".concat(this.id, ")}");
86922
86964
  }
86965
+ getBounds() {
86966
+ return null;
86967
+ }
86923
86968
  setPosition(position) {
86924
86969
  assert$7(position.length === 3, "setPosition requires vector argument");
86925
86970
  this.position = position;
@@ -87070,6 +87115,34 @@ class GroupNode extends ScenegraphNode {
87070
87115
  this.removeAll();
87071
87116
  super.delete();
87072
87117
  }
87118
+ getBounds() {
87119
+ const result = [[Infinity, Infinity, Infinity], [-Infinity, -Infinity, -Infinity]];
87120
+ this.traverse((node2, _ref3) => {
87121
+ let {
87122
+ worldMatrix
87123
+ } = _ref3;
87124
+ const bounds2 = node2.getBounds();
87125
+ if (!bounds2) {
87126
+ return;
87127
+ }
87128
+ const [min, max] = bounds2;
87129
+ const center2 = new Vector3(min).add(max).divide([2, 2, 2]);
87130
+ worldMatrix.transformAsPoint(center2, center2);
87131
+ const halfSize = new Vector3(max).subtract(min).divide([2, 2, 2]);
87132
+ worldMatrix.transformAsVector(halfSize, halfSize);
87133
+ for (let v = 0; v < 8; v++) {
87134
+ const position = new Vector3(v & 1 ? -1 : 1, v & 2 ? -1 : 1, v & 4 ? -1 : 1).multiply(halfSize).add(center2);
87135
+ for (let i2 = 0; i2 < 3; i2++) {
87136
+ result[0][i2] = Math.min(result[0][i2], position[i2]);
87137
+ result[1][i2] = Math.max(result[1][i2], position[i2]);
87138
+ }
87139
+ }
87140
+ });
87141
+ if (!Number.isFinite(result[0][0])) {
87142
+ return null;
87143
+ }
87144
+ return result;
87145
+ }
87073
87146
  traverse(visitor) {
87074
87147
  let {
87075
87148
  worldMatrix = new Matrix4()
@@ -87319,6 +87392,7 @@ class ModelNode extends ScenegraphNode {
87319
87392
  } else {
87320
87393
  this.model = new Model(gl, props2);
87321
87394
  }
87395
+ this.bounds = null;
87322
87396
  this.managedResources = props2.managedResources || [];
87323
87397
  }
87324
87398
  setProps(props2) {
@@ -87326,6 +87400,9 @@ class ModelNode extends ScenegraphNode {
87326
87400
  this._setModelNodeProps(props2);
87327
87401
  return this;
87328
87402
  }
87403
+ getBounds() {
87404
+ return this.bounds;
87405
+ }
87329
87406
  delete() {
87330
87407
  if (this.model) {
87331
87408
  this.model.delete();
@@ -87510,17 +87587,21 @@ function createGLTFModel(gl, options) {
87510
87587
  const managedResources = [];
87511
87588
  managedResources.push(...materialParser.generatedTextures);
87512
87589
  managedResources.push(...Object.values(attributes).map((attribute) => attribute.buffer));
87513
- const model = new ModelNode(gl, Object.assign({
87590
+ const model = new ModelNode(gl, {
87514
87591
  id,
87515
87592
  drawMode,
87516
87593
  vertexCount,
87517
87594
  modules: [pbr],
87518
- defines: materialParser.defines,
87519
87595
  parameters: materialParser.parameters,
87520
87596
  vs: addVersionToShader(gl, vs$7),
87521
87597
  fs: addVersionToShader(gl, fs$7),
87522
- managedResources
87523
- }, modelOptions));
87598
+ managedResources,
87599
+ ...modelOptions,
87600
+ defines: {
87601
+ ...materialParser.defines,
87602
+ ...modelOptions.defines
87603
+ }
87604
+ });
87524
87605
  model.setProps({
87525
87606
  attributes
87526
87607
  });
@@ -87615,13 +87696,15 @@ class GLTFInstantiator {
87615
87696
  log$2.warn("getVertexCount() not found")();
87616
87697
  }
87617
87698
  createPrimitive(gltfPrimitive, i2, gltfMesh) {
87618
- return createGLTFModel(this.gl, Object.assign({
87699
+ const model = createGLTFModel(this.gl, Object.assign({
87619
87700
  id: gltfPrimitive.name || "".concat(gltfMesh.name || gltfMesh.id, "-primitive-").concat(i2),
87620
87701
  drawMode: gltfPrimitive.mode || 4,
87621
87702
  vertexCount: gltfPrimitive.indices ? gltfPrimitive.indices.count : this.getVertexCount(gltfPrimitive.attributes),
87622
87703
  attributes: this.createAttributes(gltfPrimitive.attributes, gltfPrimitive.indices),
87623
87704
  material: gltfPrimitive.material
87624
87705
  }, this.options));
87706
+ model.bounds = [gltfPrimitive.attributes.POSITION.min, gltfPrimitive.attributes.POSITION.max];
87707
+ return model;
87625
87708
  }
87626
87709
  createAttributes(attributes, indices) {
87627
87710
  const loadedAttributes = {};
@@ -95549,15 +95632,11 @@ class Tile3DLayer extends CompositeLayer {
95549
95632
  info,
95550
95633
  sourceLayer
95551
95634
  }) {
95552
- const {
95553
- layerMap
95554
- } = this.state;
95555
- const layerId = sourceLayer && sourceLayer.id;
95556
- if (layerId) {
95557
- const substr = layerId.substring(this.id.length + 1);
95558
- const tileId = substr.substring(substr.indexOf("-") + 1);
95559
- info.object = layerMap[tileId] && layerMap[tileId].tile;
95635
+ const sourceTile = sourceLayer && sourceLayer.props.tile;
95636
+ if (info.picked) {
95637
+ info.object = sourceTile;
95560
95638
  }
95639
+ info.sourceTile = sourceTile;
95561
95640
  return info;
95562
95641
  }
95563
95642
  filterSubLayer({
@@ -95573,8 +95652,10 @@ class Tile3DLayer extends CompositeLayer {
95573
95652
  return tile.selected && tile.viewportIds.includes(viewportId);
95574
95653
  }
95575
95654
  _updateAutoHighlight(info) {
95576
- if (info.sourceLayer) {
95577
- info.sourceLayer.updateAutoHighlight(info);
95655
+ const sourceTile = info.sourceTile;
95656
+ const layerCache = this.state.layerMap[sourceTile === null || sourceTile === void 0 ? void 0 : sourceTile.id];
95657
+ if (layerCache && layerCache.layer) {
95658
+ layerCache.layer.updateAutoHighlight(info);
95578
95659
  }
95579
95660
  }
95580
95661
  async _loadTileset(tilesetUrl) {
@@ -135596,16 +135677,16 @@ function addDecoder(cases, importFn) {
135596
135677
  }
135597
135678
  cases.forEach((c) => registry$1.set(c, importFn));
135598
135679
  }
135599
- addDecoder([void 0, 1], () => import("./raw-af4639cb.js").then((m) => m.default));
135600
- addDecoder(5, () => import("./lzw-b6a080bc.js").then((m) => m.default));
135680
+ addDecoder([void 0, 1], () => import("./raw-2b757edd.js").then((m) => m.default));
135681
+ addDecoder(5, () => import("./lzw-4c0c7a73.js").then((m) => m.default));
135601
135682
  addDecoder(6, () => {
135602
135683
  throw new Error("old style JPEG compression is not supported.");
135603
135684
  });
135604
- addDecoder(7, () => import("./jpeg-f13e87d5.js").then((m) => m.default));
135605
- addDecoder([8, 32946], () => import("./deflate-822f733b.js").then((m) => m.default));
135606
- addDecoder(32773, () => import("./packbits-fbb728f4.js").then((m) => m.default));
135607
- addDecoder(34887, () => import("./lerc-e0b9e6f7.js").then((m) => m.default));
135608
- addDecoder(50001, () => import("./webimage-cf240654.js").then((m) => m.default));
135685
+ addDecoder(7, () => import("./jpeg-92d14e62.js").then((m) => m.default));
135686
+ addDecoder([8, 32946], () => import("./deflate-40bcb0d2.js").then((m) => m.default));
135687
+ addDecoder(32773, () => import("./packbits-dbc1b105.js").then((m) => m.default));
135688
+ addDecoder(34887, () => import("./lerc-730e23a1.js").then((m) => m.default));
135689
+ addDecoder(50001, () => import("./webimage-3e2aece7.js").then((m) => m.default));
135609
135690
  function decodeRowAcc(row, stride) {
135610
135691
  let length2 = row.length - stride;
135611
135692
  let offset4 = 0;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a, L, V, d, c, e, f, b, h, u } from "./index-a79502da.js";
1
+ import { a, L, V, d, c, e, f, b, h, u } from "./index-1314685c.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-a79502da.js";
1
+ import { B as BaseDecoder } from "./index-1314685c.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-a79502da.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-1314685c.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-a79502da.js";
1
+ import { B as BaseDecoder } from "./index-1314685c.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-a79502da.js";
1
+ import { B as BaseDecoder } from "./index-1314685c.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-a79502da.js";
1
+ import { B as BaseDecoder } from "./index-1314685c.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-a79502da.js";
1
+ import { B as BaseDecoder } from "./index-1314685c.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/layer-controller",
3
- "version": "3.2.2",
3
+ "version": "3.3.1",
4
4
  "author": "Gehlenborg Lab",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -21,11 +21,11 @@
21
21
  "lodash-es": "^4.17.21",
22
22
  "math.gl": "^3.5.6",
23
23
  "react-aria": "^3.28.0",
24
- "@vitessce/gl": "3.2.2",
25
- "@vitessce/constants-internal": "3.2.2",
26
- "@vitessce/spatial-utils": "3.2.2",
27
- "@vitessce/utils": "3.2.2",
28
- "@vitessce/vit-s": "3.2.2"
24
+ "@vitessce/constants-internal": "3.3.1",
25
+ "@vitessce/spatial-utils": "3.3.1",
26
+ "@vitessce/vit-s": "3.3.1",
27
+ "@vitessce/gl": "3.3.1",
28
+ "@vitessce/utils": "3.3.1"
29
29
  },
30
30
  "devDependencies": {
31
31
  "react": "^18.0.0",