@vitessce/spatial-utils 3.3.0 → 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-0b31baff.js";
2
+ import { B as BaseDecoder } from "./index-27c044ac.js";
3
3
  import "react";
4
4
  class DeflateDecoder extends BaseDecoder {
5
5
  decodeBlock(buffer) {
@@ -38583,7 +38583,7 @@ const jsonLoader = {
38583
38583
  testText: isJSON,
38584
38584
  parseTextSync: JSON.parse
38585
38585
  };
38586
- const version = "8.8.20";
38586
+ const version = "8.8.27";
38587
38587
  const existingVersion = globalThis.deck && globalThis.deck.VERSION;
38588
38588
  if (existingVersion && existingVersion !== version) {
38589
38589
  throw new Error("deck.gl - multiple versions detected: ".concat(existingVersion, " vs ").concat(version));
@@ -39782,9 +39782,8 @@ function cssToDeviceRatio(gl) {
39782
39782
  luma
39783
39783
  } = gl;
39784
39784
  if (gl.canvas && luma) {
39785
- const {
39786
- clientWidth
39787
- } = luma.canvasSizeInfo;
39785
+ const cachedSize = luma.canvasSizeInfo;
39786
+ const clientWidth = "clientWidth" in cachedSize ? cachedSize.clientWidth : gl.canvas.clientWidth;
39788
39787
  return clientWidth ? gl.drawingBufferWidth / clientWidth : 1;
39789
39788
  }
39790
39789
  return 1;
@@ -40040,7 +40039,7 @@ function setDevicePixelRatio(gl, devicePixelRatio, options) {
40040
40039
  });
40041
40040
  }
40042
40041
  }
40043
- const VERSION$7 = "8.5.16";
40042
+ const VERSION$7 = "8.5.21";
40044
40043
  const STARTUP_MESSAGE = "set luma.log.level=1 (or higher) to trace rendering";
40045
40044
  class StatsManager {
40046
40045
  constructor() {
@@ -40161,7 +40160,6 @@ let Resource$1 = class Resource {
40161
40160
  this._handle = this._createHandle();
40162
40161
  }
40163
40162
  this.byteLength = 0;
40164
- this._initStats();
40165
40163
  this._addStats();
40166
40164
  }
40167
40165
  toString() {
@@ -40297,9 +40295,6 @@ let Resource$1 = class Resource {
40297
40295
  this.gl.luma = this.gl.luma || {};
40298
40296
  return this.gl.luma;
40299
40297
  }
40300
- _initStats() {
40301
- this.gl.stats = this.gl.stats || new StatsManager();
40302
- }
40303
40298
  _addStats() {
40304
40299
  const name2 = this[Symbol.toStringTag];
40305
40300
  const stats = lumaStats.get("Resource Counts");
@@ -40314,27 +40309,29 @@ let Resource$1 = class Resource {
40314
40309
  }
40315
40310
  _trackAllocatedMemory(bytes) {
40316
40311
  let name2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this[Symbol.toStringTag];
40317
- this._doTrackAllocatedMemory(bytes, name2);
40318
- this._doTrackAllocatedMemory(bytes, name2, this.gl.stats.get("Memory Usage"));
40312
+ this._trackAllocatedMemoryForContext(bytes, name2);
40313
+ this._trackAllocatedMemoryForContext(bytes, name2, this.gl.canvas && this.gl.canvas.id);
40314
+ this.byteLength = bytes;
40319
40315
  }
40320
- _doTrackAllocatedMemory(bytes) {
40316
+ _trackAllocatedMemoryForContext(bytes) {
40321
40317
  let name2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this[Symbol.toStringTag];
40322
- let stats = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : lumaStats.get("Memory Usage");
40318
+ let id = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
40319
+ const stats = lumaStats.get("Memory Usage".concat(id));
40323
40320
  stats.get("GPU Memory").addCount(bytes);
40324
40321
  stats.get("".concat(name2, " Memory")).addCount(bytes);
40325
- this.byteLength = bytes;
40326
40322
  }
40327
40323
  _trackDeallocatedMemory() {
40328
40324
  let name2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this[Symbol.toStringTag];
40329
- this._doTrackDeallocatedMemory(name2);
40330
- this._doTrackDeallocatedMemory(name2, this.gl.stats.get("Memory Usage"));
40325
+ this._trackDeallocatedMemoryForContext(name2);
40326
+ this._trackDeallocatedMemoryForContext(name2, this.gl.canvas && this.gl.canvas.id);
40327
+ this.byteLength = 0;
40331
40328
  }
40332
- _doTrackDeallocatedMemory() {
40329
+ _trackDeallocatedMemoryForContext() {
40333
40330
  let name2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this[Symbol.toStringTag];
40334
- let stats = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : lumaStats.get("Memory Usage");
40331
+ let id = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
40332
+ const stats = lumaStats.get("Memory Usage".concat(id));
40335
40333
  stats.get("GPU Memory").subtractCount(this.byteLength);
40336
40334
  stats.get("".concat(name2, " Memory")).subtractCount(this.byteLength);
40337
- this.byteLength = 0;
40338
40335
  }
40339
40336
  };
40340
40337
  const ERR_TYPE_DEDUCTION = "Failed to deduce GL constant from typed array";
@@ -49949,6 +49946,7 @@ const picking = {
49949
49946
  inject: {
49950
49947
  "vs:DECKGL_FILTER_GL_POSITION": "\n // for picking depth values\n picking_setPickingAttribute(position.z / position.w);\n ",
49951
49948
  "vs:DECKGL_FILTER_COLOR": "\n picking_setPickingColor(geometry.pickingColor);\n ",
49949
+ "fs:#decl": "\nuniform bool picking_uAttribute;\n ",
49952
49950
  "fs:DECKGL_FILTER_COLOR": {
49953
49951
  order: 99,
49954
49952
  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 "
@@ -50759,6 +50757,9 @@ class Viewport {
50759
50757
  this.projectFlat = this.projectFlat.bind(this);
50760
50758
  this.unprojectFlat = this.unprojectFlat.bind(this);
50761
50759
  }
50760
+ get subViewports() {
50761
+ return null;
50762
+ }
50762
50763
  get metersPerPixel() {
50763
50764
  return this.distanceScales.metersPerUnit[2] / this.scale;
50764
50765
  }
@@ -59650,7 +59651,7 @@ class Attribute extends DataColumn {
59650
59651
  const {
59651
59652
  startIndices
59652
59653
  } = this;
59653
- const vertexIndex = startIndices ? startIndices[row] : row;
59654
+ const vertexIndex = startIndices ? row < startIndices.length ? startIndices[row] : this.numInstances : row;
59654
59655
  return vertexIndex * this.size;
59655
59656
  }
59656
59657
  getShaderAttributes() {
@@ -62294,7 +62295,7 @@ class Layer extends Component {
62294
62295
  if (Array.isArray(highlightColor)) {
62295
62296
  parameters.pickingHighlightColor = highlightColor;
62296
62297
  }
62297
- if (Number.isInteger(highlightedObjectIndex)) {
62298
+ if (forceUpdate || highlightedObjectIndex !== oldProps.highlightedObjectIndex) {
62298
62299
  parameters.pickingSelectedColor = Number.isFinite(highlightedObjectIndex) && highlightedObjectIndex >= 0 ? this.encodePickingColor(highlightedObjectIndex) : null;
62299
62300
  }
62300
62301
  this.setModuleParameters(parameters);
@@ -63657,7 +63658,7 @@ function interpolateQuad(quad, ut, vt) {
63657
63658
  }
63658
63659
  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";
63659
63660
  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";
63660
- 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");
63661
+ 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");
63661
63662
  const defaultProps$I = {
63662
63663
  image: {
63663
63664
  type: "image",
@@ -71797,18 +71798,22 @@ function getBoundingBox(viewport, zRange, extent2) {
71797
71798
  }
71798
71799
  function getCullBounds({
71799
71800
  viewport,
71800
- z: z2,
71801
+ z: z2 = 0,
71801
71802
  cullRect
71802
71803
  }) {
71803
- const x2 = cullRect.x - viewport.x;
71804
- const y2 = cullRect.y - viewport.y;
71805
- const {
71806
- width,
71807
- height
71808
- } = cullRect;
71804
+ const subViewports = viewport.subViewports || [viewport];
71805
+ return subViewports.map((v) => getCullBoundsInViewport(v, z2, cullRect));
71806
+ }
71807
+ function getCullBoundsInViewport(viewport, z2, cullRect) {
71809
71808
  if (!Array.isArray(z2)) {
71809
+ const x2 = cullRect.x - viewport.x;
71810
+ const y2 = cullRect.y - viewport.y;
71811
+ const {
71812
+ width,
71813
+ height
71814
+ } = cullRect;
71810
71815
  const unprojectOption = {
71811
- targetZ: z2 || 0
71816
+ targetZ: z2
71812
71817
  };
71813
71818
  const topLeft = viewport.unproject([x2, y2], unprojectOption);
71814
71819
  const topRight = viewport.unproject([x2 + width, y2], unprojectOption);
@@ -71816,16 +71821,8 @@ function getCullBounds({
71816
71821
  const bottomRight = viewport.unproject([x2 + width, y2 + height], unprojectOption);
71817
71822
  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])];
71818
71823
  }
71819
- const bounds0 = getCullBounds({
71820
- viewport,
71821
- z: z2[0],
71822
- cullRect
71823
- });
71824
- const bounds1 = getCullBounds({
71825
- viewport,
71826
- z: z2[1],
71827
- cullRect
71828
- });
71824
+ const bounds0 = getCullBoundsInViewport(viewport, z2[0], cullRect);
71825
+ const bounds1 = getCullBoundsInViewport(viewport, z2[1], cullRect);
71829
71826
  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])];
71830
71827
  }
71831
71828
  function getIndexingCoords(bbox2, scale2, modelMatrixInverse) {
@@ -72055,7 +72052,7 @@ class Tileset2D {
72055
72052
  return false;
72056
72053
  }
72057
72054
  if (cullRect && this._viewport) {
72058
- const [minX, minY, maxX, maxY] = getCullBounds({
72055
+ const boundsArr = this._getCullBounds({
72059
72056
  viewport: this._viewport,
72060
72057
  z: this._zRange,
72061
72058
  cullRect
@@ -72063,12 +72060,20 @@ class Tileset2D {
72063
72060
  const {
72064
72061
  bbox: bbox2
72065
72062
  } = tile;
72066
- if ("west" in bbox2) {
72067
- return bbox2.west < maxX && bbox2.east > minX && bbox2.south < maxY && bbox2.north > minY;
72063
+ for (const [minX, minY, maxX, maxY] of boundsArr) {
72064
+ let overlaps;
72065
+ if ("west" in bbox2) {
72066
+ overlaps = bbox2.west < maxX && bbox2.east > minX && bbox2.south < maxY && bbox2.north > minY;
72067
+ } else {
72068
+ const y02 = Math.min(bbox2.top, bbox2.bottom);
72069
+ const y12 = Math.max(bbox2.top, bbox2.bottom);
72070
+ overlaps = bbox2.left < maxX && bbox2.right > minX && y02 < maxY && y12 > minY;
72071
+ }
72072
+ if (overlaps) {
72073
+ return true;
72074
+ }
72068
72075
  }
72069
- const y02 = Math.min(bbox2.top, bbox2.bottom);
72070
- const y12 = Math.max(bbox2.top, bbox2.bottom);
72071
- return bbox2.left < maxX && bbox2.right > minX && y02 < maxY && y12 > minY;
72076
+ return false;
72072
72077
  }
72073
72078
  return true;
72074
72079
  }
@@ -72517,14 +72522,19 @@ class TileLayer extends CompositeLayer {
72517
72522
  info,
72518
72523
  sourceLayer
72519
72524
  }) {
72525
+ const sourceTile = sourceLayer.props.tile;
72520
72526
  if (info.picked) {
72521
- info.tile = sourceLayer.props.tile;
72527
+ info.tile = sourceTile;
72522
72528
  }
72529
+ info.sourceTile = sourceTile;
72523
72530
  return info;
72524
72531
  }
72525
72532
  _updateAutoHighlight(info) {
72526
- if (info.sourceLayer) {
72527
- info.sourceLayer.updateAutoHighlight(info);
72533
+ const sourceTile = info.sourceTile;
72534
+ if (sourceTile && sourceTile.layers) {
72535
+ for (const layer of sourceTile.layers) {
72536
+ layer.updateAutoHighlight(info);
72537
+ }
72528
72538
  }
72529
72539
  }
72530
72540
  renderLayers() {
@@ -84842,6 +84852,9 @@ class ScenegraphNode {
84842
84852
  toString() {
84843
84853
  return "{type: ScenegraphNode, id: ".concat(this.id, ")}");
84844
84854
  }
84855
+ getBounds() {
84856
+ return null;
84857
+ }
84845
84858
  setPosition(position) {
84846
84859
  assert$7(position.length === 3, "setPosition requires vector argument");
84847
84860
  this.position = position;
@@ -84992,6 +85005,34 @@ class GroupNode extends ScenegraphNode {
84992
85005
  this.removeAll();
84993
85006
  super.delete();
84994
85007
  }
85008
+ getBounds() {
85009
+ const result = [[Infinity, Infinity, Infinity], [-Infinity, -Infinity, -Infinity]];
85010
+ this.traverse((node2, _ref) => {
85011
+ let {
85012
+ worldMatrix
85013
+ } = _ref;
85014
+ const bounds2 = node2.getBounds();
85015
+ if (!bounds2) {
85016
+ return;
85017
+ }
85018
+ const [min2, max2] = bounds2;
85019
+ const center2 = new Vector3(min2).add(max2).divide([2, 2, 2]);
85020
+ worldMatrix.transformAsPoint(center2, center2);
85021
+ const halfSize = new Vector3(max2).subtract(min2).divide([2, 2, 2]);
85022
+ worldMatrix.transformAsVector(halfSize, halfSize);
85023
+ for (let v = 0; v < 8; v++) {
85024
+ const position = new Vector3(v & 1 ? -1 : 1, v & 2 ? -1 : 1, v & 4 ? -1 : 1).multiply(halfSize).add(center2);
85025
+ for (let i2 = 0; i2 < 3; i2++) {
85026
+ result[0][i2] = Math.min(result[0][i2], position[i2]);
85027
+ result[1][i2] = Math.max(result[1][i2], position[i2]);
85028
+ }
85029
+ }
85030
+ });
85031
+ if (!Number.isFinite(result[0][0])) {
85032
+ return null;
85033
+ }
85034
+ return result;
85035
+ }
84995
85036
  traverse(visitor) {
84996
85037
  let {
84997
85038
  worldMatrix = new Matrix4()
@@ -85241,6 +85282,7 @@ class ModelNode extends ScenegraphNode {
85241
85282
  } else {
85242
85283
  this.model = new Model(gl, props2);
85243
85284
  }
85285
+ this.bounds = null;
85244
85286
  this.managedResources = props2.managedResources || [];
85245
85287
  }
85246
85288
  setProps(props2) {
@@ -85248,6 +85290,9 @@ class ModelNode extends ScenegraphNode {
85248
85290
  this._setModelNodeProps(props2);
85249
85291
  return this;
85250
85292
  }
85293
+ getBounds() {
85294
+ return this.bounds;
85295
+ }
85251
85296
  delete() {
85252
85297
  if (this.model) {
85253
85298
  this.model.delete();
@@ -85432,17 +85477,21 @@ function createGLTFModel(gl, options) {
85432
85477
  const managedResources = [];
85433
85478
  managedResources.push(...materialParser.generatedTextures);
85434
85479
  managedResources.push(...Object.values(attributes).map((attribute) => attribute.buffer));
85435
- const model = new ModelNode(gl, Object.assign({
85480
+ const model = new ModelNode(gl, {
85436
85481
  id,
85437
85482
  drawMode,
85438
85483
  vertexCount,
85439
85484
  modules: [pbr],
85440
- defines: materialParser.defines,
85441
85485
  parameters: materialParser.parameters,
85442
85486
  vs: addVersionToShader(gl, vs$7),
85443
85487
  fs: addVersionToShader(gl, fs$7),
85444
- managedResources
85445
- }, modelOptions));
85488
+ managedResources,
85489
+ ...modelOptions,
85490
+ defines: {
85491
+ ...materialParser.defines,
85492
+ ...modelOptions.defines
85493
+ }
85494
+ });
85446
85495
  model.setProps({
85447
85496
  attributes
85448
85497
  });
@@ -85537,13 +85586,15 @@ class GLTFInstantiator {
85537
85586
  log$2.warn("getVertexCount() not found")();
85538
85587
  }
85539
85588
  createPrimitive(gltfPrimitive, i2, gltfMesh) {
85540
- return createGLTFModel(this.gl, Object.assign({
85589
+ const model = createGLTFModel(this.gl, Object.assign({
85541
85590
  id: gltfPrimitive.name || "".concat(gltfMesh.name || gltfMesh.id, "-primitive-").concat(i2),
85542
85591
  drawMode: gltfPrimitive.mode || 4,
85543
85592
  vertexCount: gltfPrimitive.indices ? gltfPrimitive.indices.count : this.getVertexCount(gltfPrimitive.attributes),
85544
85593
  attributes: this.createAttributes(gltfPrimitive.attributes, gltfPrimitive.indices),
85545
85594
  material: gltfPrimitive.material
85546
85595
  }, this.options));
85596
+ model.bounds = [gltfPrimitive.attributes.POSITION.min, gltfPrimitive.attributes.POSITION.max];
85597
+ return model;
85547
85598
  }
85548
85599
  createAttributes(attributes, indices) {
85549
85600
  const loadedAttributes = {};
@@ -93471,15 +93522,11 @@ class Tile3DLayer extends CompositeLayer {
93471
93522
  info,
93472
93523
  sourceLayer
93473
93524
  }) {
93474
- const {
93475
- layerMap
93476
- } = this.state;
93477
- const layerId = sourceLayer && sourceLayer.id;
93478
- if (layerId) {
93479
- const substr = layerId.substring(this.id.length + 1);
93480
- const tileId = substr.substring(substr.indexOf("-") + 1);
93481
- info.object = layerMap[tileId] && layerMap[tileId].tile;
93525
+ const sourceTile = sourceLayer && sourceLayer.props.tile;
93526
+ if (info.picked) {
93527
+ info.object = sourceTile;
93482
93528
  }
93529
+ info.sourceTile = sourceTile;
93483
93530
  return info;
93484
93531
  }
93485
93532
  filterSubLayer({
@@ -93495,8 +93542,10 @@ class Tile3DLayer extends CompositeLayer {
93495
93542
  return tile.selected && tile.viewportIds.includes(viewportId);
93496
93543
  }
93497
93544
  _updateAutoHighlight(info) {
93498
- if (info.sourceLayer) {
93499
- info.sourceLayer.updateAutoHighlight(info);
93545
+ const sourceTile = info.sourceTile;
93546
+ const layerCache = this.state.layerMap[sourceTile === null || sourceTile === void 0 ? void 0 : sourceTile.id];
93547
+ if (layerCache && layerCache.layer) {
93548
+ layerCache.layer.updateAutoHighlight(info);
93500
93549
  }
93501
93550
  }
93502
93551
  async _loadTileset(tilesetUrl) {
@@ -133518,16 +133567,16 @@ function addDecoder(cases, importFn) {
133518
133567
  }
133519
133568
  cases.forEach((c) => registry$2.set(c, importFn));
133520
133569
  }
133521
- addDecoder([void 0, 1], () => import("./raw-a4927efa.js").then((m) => m.default));
133522
- addDecoder(5, () => import("./lzw-18d035b6.js").then((m) => m.default));
133570
+ addDecoder([void 0, 1], () => import("./raw-7e5381d5.js").then((m) => m.default));
133571
+ addDecoder(5, () => import("./lzw-a22317ac.js").then((m) => m.default));
133523
133572
  addDecoder(6, () => {
133524
133573
  throw new Error("old style JPEG compression is not supported.");
133525
133574
  });
133526
- addDecoder(7, () => import("./jpeg-7f3e0d5a.js").then((m) => m.default));
133527
- addDecoder([8, 32946], () => import("./deflate-e679700e.js").then((m) => m.default));
133528
- addDecoder(32773, () => import("./packbits-588b56d4.js").then((m) => m.default));
133529
- addDecoder(34887, () => import("./lerc-46e1d208.js").then((m) => m.default));
133530
- addDecoder(50001, () => import("./webimage-b3b8965b.js").then((m) => m.default));
133575
+ addDecoder(7, () => import("./jpeg-780f2a29.js").then((m) => m.default));
133576
+ addDecoder([8, 32946], () => import("./deflate-d62c010f.js").then((m) => m.default));
133577
+ addDecoder(32773, () => import("./packbits-757ef203.js").then((m) => m.default));
133578
+ addDecoder(34887, () => import("./lerc-11712e42.js").then((m) => m.default));
133579
+ addDecoder(50001, () => import("./webimage-ec283d98.js").then((m) => m.default));
133531
133580
  function decodeRowAcc(row, stride) {
133532
133581
  let length2 = row.length - stride;
133533
133582
  let offset = 0;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { D, e, a, b, c, d, F, G, Z, C, r, n, E, A, y, l, m, z, x, h, q, v, o, i, f, j, k, u, t, p, s, w } from "./index-0b31baff.js";
1
+ import { D, e, a, b, c, d, F, G, Z, C, r, n, E, A, y, l, m, z, x, h, q, v, o, i, f, j, k, u, t, p, s, w } from "./index-27c044ac.js";
2
2
  import "react";
3
3
  export {
4
4
  D as DEFAULT_CELLS_LAYER,
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-0b31baff.js";
1
+ import { B as BaseDecoder } from "./index-27c044ac.js";
2
2
  import "react";
3
3
  const dctZigZag = new Int32Array([
4
4
  0,
@@ -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-0b31baff.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-27c044ac.js";
3
3
  import "react";
4
4
  const LercParameters = {
5
5
  Version: 0,
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-0b31baff.js";
1
+ import { B as BaseDecoder } from "./index-27c044ac.js";
2
2
  import "react";
3
3
  const MIN_BITS = 9;
4
4
  const CLEAR_CODE = 256;
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-0b31baff.js";
1
+ import { B as BaseDecoder } from "./index-27c044ac.js";
2
2
  import "react";
3
3
  class PackbitsDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-0b31baff.js";
1
+ import { B as BaseDecoder } from "./index-27c044ac.js";
2
2
  import "react";
3
3
  class RawDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-0b31baff.js";
1
+ import { B as BaseDecoder } from "./index-27c044ac.js";
2
2
  import "react";
3
3
  class WebImageDecoder extends BaseDecoder {
4
4
  constructor() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/spatial-utils",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "author": "Gehlenborg Lab",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -20,9 +20,9 @@
20
20
  "zarrita": "0.4.0-next.4",
21
21
  "math.gl": "^3.5.6",
22
22
  "mathjs": "^9.2.0",
23
- "@vitessce/gl": "3.3.0",
24
- "@vitessce/zarr-utils": "3.3.0",
25
- "@vitessce/utils": "3.3.0"
23
+ "@vitessce/gl": "3.3.1",
24
+ "@vitessce/zarr-utils": "3.3.1",
25
+ "@vitessce/utils": "3.3.1"
26
26
  },
27
27
  "scripts": {
28
28
  "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.js",