@vitessce/layer-controller 3.3.0 → 3.3.2

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-b51c005e.js";
2
+ import { B as BaseDecoder } from "./index-d3bd5576.js";
3
3
  import "react";
4
4
  import "@vitessce/vit-s";
5
5
  import "react-dom";
@@ -40693,7 +40693,7 @@ const jsonLoader = {
40693
40693
  testText: isJSON,
40694
40694
  parseTextSync: JSON.parse
40695
40695
  };
40696
- const version = "8.8.20";
40696
+ const version = "8.8.27";
40697
40697
  const existingVersion = globalThis.deck && globalThis.deck.VERSION;
40698
40698
  if (existingVersion && existingVersion !== version) {
40699
40699
  throw new Error("deck.gl - multiple versions detected: ".concat(existingVersion, " vs ").concat(version));
@@ -41892,9 +41892,8 @@ function cssToDeviceRatio(gl) {
41892
41892
  luma
41893
41893
  } = gl;
41894
41894
  if (gl.canvas && luma) {
41895
- const {
41896
- clientWidth
41897
- } = luma.canvasSizeInfo;
41895
+ const cachedSize = luma.canvasSizeInfo;
41896
+ const clientWidth = "clientWidth" in cachedSize ? cachedSize.clientWidth : gl.canvas.clientWidth;
41898
41897
  return clientWidth ? gl.drawingBufferWidth / clientWidth : 1;
41899
41898
  }
41900
41899
  return 1;
@@ -42150,7 +42149,7 @@ function setDevicePixelRatio(gl, devicePixelRatio, options) {
42150
42149
  });
42151
42150
  }
42152
42151
  }
42153
- const VERSION$7 = "8.5.16";
42152
+ const VERSION$7 = "8.5.21";
42154
42153
  const STARTUP_MESSAGE = "set luma.log.level=1 (or higher) to trace rendering";
42155
42154
  class StatsManager {
42156
42155
  constructor() {
@@ -42271,7 +42270,6 @@ let Resource$1 = class Resource {
42271
42270
  this._handle = this._createHandle();
42272
42271
  }
42273
42272
  this.byteLength = 0;
42274
- this._initStats();
42275
42273
  this._addStats();
42276
42274
  }
42277
42275
  toString() {
@@ -42407,9 +42405,6 @@ let Resource$1 = class Resource {
42407
42405
  this.gl.luma = this.gl.luma || {};
42408
42406
  return this.gl.luma;
42409
42407
  }
42410
- _initStats() {
42411
- this.gl.stats = this.gl.stats || new StatsManager();
42412
- }
42413
42408
  _addStats() {
42414
42409
  const name2 = this[Symbol.toStringTag];
42415
42410
  const stats = lumaStats.get("Resource Counts");
@@ -42424,27 +42419,29 @@ let Resource$1 = class Resource {
42424
42419
  }
42425
42420
  _trackAllocatedMemory(bytes) {
42426
42421
  let name2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this[Symbol.toStringTag];
42427
- this._doTrackAllocatedMemory(bytes, name2);
42428
- 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;
42429
42425
  }
42430
- _doTrackAllocatedMemory(bytes) {
42426
+ _trackAllocatedMemoryForContext(bytes) {
42431
42427
  let name2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this[Symbol.toStringTag];
42432
- 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));
42433
42430
  stats.get("GPU Memory").addCount(bytes);
42434
42431
  stats.get("".concat(name2, " Memory")).addCount(bytes);
42435
- this.byteLength = bytes;
42436
42432
  }
42437
42433
  _trackDeallocatedMemory() {
42438
42434
  let name2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this[Symbol.toStringTag];
42439
- this._doTrackDeallocatedMemory(name2);
42440
- 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;
42441
42438
  }
42442
- _doTrackDeallocatedMemory() {
42439
+ _trackDeallocatedMemoryForContext() {
42443
42440
  let name2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this[Symbol.toStringTag];
42444
- 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));
42445
42443
  stats.get("GPU Memory").subtractCount(this.byteLength);
42446
42444
  stats.get("".concat(name2, " Memory")).subtractCount(this.byteLength);
42447
- this.byteLength = 0;
42448
42445
  }
42449
42446
  };
42450
42447
  const ERR_TYPE_DEDUCTION = "Failed to deduce GL constant from typed array";
@@ -52059,6 +52056,7 @@ const picking = {
52059
52056
  inject: {
52060
52057
  "vs:DECKGL_FILTER_GL_POSITION": "\n // for picking depth values\n picking_setPickingAttribute(position.z / position.w);\n ",
52061
52058
  "vs:DECKGL_FILTER_COLOR": "\n picking_setPickingColor(geometry.pickingColor);\n ",
52059
+ "fs:#decl": "\nuniform bool picking_uAttribute;\n ",
52062
52060
  "fs:DECKGL_FILTER_COLOR": {
52063
52061
  order: 99,
52064
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 "
@@ -52869,6 +52867,9 @@ class Viewport {
52869
52867
  this.projectFlat = this.projectFlat.bind(this);
52870
52868
  this.unprojectFlat = this.unprojectFlat.bind(this);
52871
52869
  }
52870
+ get subViewports() {
52871
+ return null;
52872
+ }
52872
52873
  get metersPerPixel() {
52873
52874
  return this.distanceScales.metersPerUnit[2] / this.scale;
52874
52875
  }
@@ -61760,7 +61761,7 @@ class Attribute extends DataColumn {
61760
61761
  const {
61761
61762
  startIndices
61762
61763
  } = this;
61763
- const vertexIndex = startIndices ? startIndices[row] : row;
61764
+ const vertexIndex = startIndices ? row < startIndices.length ? startIndices[row] : this.numInstances : row;
61764
61765
  return vertexIndex * this.size;
61765
61766
  }
61766
61767
  getShaderAttributes() {
@@ -64404,7 +64405,7 @@ class Layer extends Component {
64404
64405
  if (Array.isArray(highlightColor)) {
64405
64406
  parameters.pickingHighlightColor = highlightColor;
64406
64407
  }
64407
- if (Number.isInteger(highlightedObjectIndex)) {
64408
+ if (forceUpdate || highlightedObjectIndex !== oldProps.highlightedObjectIndex) {
64408
64409
  parameters.pickingSelectedColor = Number.isFinite(highlightedObjectIndex) && highlightedObjectIndex >= 0 ? this.encodePickingColor(highlightedObjectIndex) : null;
64409
64410
  }
64410
64411
  this.setModuleParameters(parameters);
@@ -65767,7 +65768,7 @@ function interpolateQuad(quad, ut, vt) {
65767
65768
  }
65768
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";
65769
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";
65770
- 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");
65771
65772
  const defaultProps$I = {
65772
65773
  image: {
65773
65774
  type: "image",
@@ -73907,18 +73908,22 @@ function getBoundingBox(viewport, zRange, extent2) {
73907
73908
  }
73908
73909
  function getCullBounds({
73909
73910
  viewport,
73910
- z: z2,
73911
+ z: z2 = 0,
73911
73912
  cullRect
73912
73913
  }) {
73913
- const x2 = cullRect.x - viewport.x;
73914
- const y2 = cullRect.y - viewport.y;
73915
- const {
73916
- width,
73917
- height
73918
- } = cullRect;
73914
+ const subViewports = viewport.subViewports || [viewport];
73915
+ return subViewports.map((v) => getCullBoundsInViewport(v, z2, cullRect));
73916
+ }
73917
+ function getCullBoundsInViewport(viewport, z2, cullRect) {
73919
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;
73920
73925
  const unprojectOption = {
73921
- targetZ: z2 || 0
73926
+ targetZ: z2
73922
73927
  };
73923
73928
  const topLeft = viewport.unproject([x2, y2], unprojectOption);
73924
73929
  const topRight = viewport.unproject([x2 + width, y2], unprojectOption);
@@ -73926,16 +73931,8 @@ function getCullBounds({
73926
73931
  const bottomRight = viewport.unproject([x2 + width, y2 + height], unprojectOption);
73927
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])];
73928
73933
  }
73929
- const bounds0 = getCullBounds({
73930
- viewport,
73931
- z: z2[0],
73932
- cullRect
73933
- });
73934
- const bounds1 = getCullBounds({
73935
- viewport,
73936
- z: z2[1],
73937
- cullRect
73938
- });
73934
+ const bounds0 = getCullBoundsInViewport(viewport, z2[0], cullRect);
73935
+ const bounds1 = getCullBoundsInViewport(viewport, z2[1], cullRect);
73939
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])];
73940
73937
  }
73941
73938
  function getIndexingCoords(bbox2, scale2, modelMatrixInverse) {
@@ -74165,7 +74162,7 @@ class Tileset2D {
74165
74162
  return false;
74166
74163
  }
74167
74164
  if (cullRect && this._viewport) {
74168
- const [minX, minY, maxX, maxY] = getCullBounds({
74165
+ const boundsArr = this._getCullBounds({
74169
74166
  viewport: this._viewport,
74170
74167
  z: this._zRange,
74171
74168
  cullRect
@@ -74173,12 +74170,20 @@ class Tileset2D {
74173
74170
  const {
74174
74171
  bbox: bbox2
74175
74172
  } = tile;
74176
- if ("west" in bbox2) {
74177
- 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
+ }
74178
74185
  }
74179
- const y02 = Math.min(bbox2.top, bbox2.bottom);
74180
- const y12 = Math.max(bbox2.top, bbox2.bottom);
74181
- return bbox2.left < maxX && bbox2.right > minX && y02 < maxY && y12 > minY;
74186
+ return false;
74182
74187
  }
74183
74188
  return true;
74184
74189
  }
@@ -74627,14 +74632,19 @@ class TileLayer extends CompositeLayer {
74627
74632
  info,
74628
74633
  sourceLayer
74629
74634
  }) {
74635
+ const sourceTile = sourceLayer.props.tile;
74630
74636
  if (info.picked) {
74631
- info.tile = sourceLayer.props.tile;
74637
+ info.tile = sourceTile;
74632
74638
  }
74639
+ info.sourceTile = sourceTile;
74633
74640
  return info;
74634
74641
  }
74635
74642
  _updateAutoHighlight(info) {
74636
- if (info.sourceLayer) {
74637
- 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
+ }
74638
74648
  }
74639
74649
  }
74640
74650
  renderLayers() {
@@ -86952,6 +86962,9 @@ class ScenegraphNode {
86952
86962
  toString() {
86953
86963
  return "{type: ScenegraphNode, id: ".concat(this.id, ")}");
86954
86964
  }
86965
+ getBounds() {
86966
+ return null;
86967
+ }
86955
86968
  setPosition(position) {
86956
86969
  assert$7(position.length === 3, "setPosition requires vector argument");
86957
86970
  this.position = position;
@@ -87102,6 +87115,34 @@ class GroupNode extends ScenegraphNode {
87102
87115
  this.removeAll();
87103
87116
  super.delete();
87104
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
+ }
87105
87146
  traverse(visitor) {
87106
87147
  let {
87107
87148
  worldMatrix = new Matrix4()
@@ -87351,6 +87392,7 @@ class ModelNode extends ScenegraphNode {
87351
87392
  } else {
87352
87393
  this.model = new Model(gl, props2);
87353
87394
  }
87395
+ this.bounds = null;
87354
87396
  this.managedResources = props2.managedResources || [];
87355
87397
  }
87356
87398
  setProps(props2) {
@@ -87358,6 +87400,9 @@ class ModelNode extends ScenegraphNode {
87358
87400
  this._setModelNodeProps(props2);
87359
87401
  return this;
87360
87402
  }
87403
+ getBounds() {
87404
+ return this.bounds;
87405
+ }
87361
87406
  delete() {
87362
87407
  if (this.model) {
87363
87408
  this.model.delete();
@@ -87542,17 +87587,21 @@ function createGLTFModel(gl, options) {
87542
87587
  const managedResources = [];
87543
87588
  managedResources.push(...materialParser.generatedTextures);
87544
87589
  managedResources.push(...Object.values(attributes).map((attribute) => attribute.buffer));
87545
- const model = new ModelNode(gl, Object.assign({
87590
+ const model = new ModelNode(gl, {
87546
87591
  id,
87547
87592
  drawMode,
87548
87593
  vertexCount,
87549
87594
  modules: [pbr],
87550
- defines: materialParser.defines,
87551
87595
  parameters: materialParser.parameters,
87552
87596
  vs: addVersionToShader(gl, vs$7),
87553
87597
  fs: addVersionToShader(gl, fs$7),
87554
- managedResources
87555
- }, modelOptions));
87598
+ managedResources,
87599
+ ...modelOptions,
87600
+ defines: {
87601
+ ...materialParser.defines,
87602
+ ...modelOptions.defines
87603
+ }
87604
+ });
87556
87605
  model.setProps({
87557
87606
  attributes
87558
87607
  });
@@ -87647,13 +87696,15 @@ class GLTFInstantiator {
87647
87696
  log$2.warn("getVertexCount() not found")();
87648
87697
  }
87649
87698
  createPrimitive(gltfPrimitive, i2, gltfMesh) {
87650
- return createGLTFModel(this.gl, Object.assign({
87699
+ const model = createGLTFModel(this.gl, Object.assign({
87651
87700
  id: gltfPrimitive.name || "".concat(gltfMesh.name || gltfMesh.id, "-primitive-").concat(i2),
87652
87701
  drawMode: gltfPrimitive.mode || 4,
87653
87702
  vertexCount: gltfPrimitive.indices ? gltfPrimitive.indices.count : this.getVertexCount(gltfPrimitive.attributes),
87654
87703
  attributes: this.createAttributes(gltfPrimitive.attributes, gltfPrimitive.indices),
87655
87704
  material: gltfPrimitive.material
87656
87705
  }, this.options));
87706
+ model.bounds = [gltfPrimitive.attributes.POSITION.min, gltfPrimitive.attributes.POSITION.max];
87707
+ return model;
87657
87708
  }
87658
87709
  createAttributes(attributes, indices) {
87659
87710
  const loadedAttributes = {};
@@ -95581,15 +95632,11 @@ class Tile3DLayer extends CompositeLayer {
95581
95632
  info,
95582
95633
  sourceLayer
95583
95634
  }) {
95584
- const {
95585
- layerMap
95586
- } = this.state;
95587
- const layerId = sourceLayer && sourceLayer.id;
95588
- if (layerId) {
95589
- const substr = layerId.substring(this.id.length + 1);
95590
- const tileId = substr.substring(substr.indexOf("-") + 1);
95591
- info.object = layerMap[tileId] && layerMap[tileId].tile;
95635
+ const sourceTile = sourceLayer && sourceLayer.props.tile;
95636
+ if (info.picked) {
95637
+ info.object = sourceTile;
95592
95638
  }
95639
+ info.sourceTile = sourceTile;
95593
95640
  return info;
95594
95641
  }
95595
95642
  filterSubLayer({
@@ -95605,8 +95652,10 @@ class Tile3DLayer extends CompositeLayer {
95605
95652
  return tile.selected && tile.viewportIds.includes(viewportId);
95606
95653
  }
95607
95654
  _updateAutoHighlight(info) {
95608
- if (info.sourceLayer) {
95609
- 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);
95610
95659
  }
95611
95660
  }
95612
95661
  async _loadTileset(tilesetUrl) {
@@ -135628,16 +135677,16 @@ function addDecoder(cases, importFn) {
135628
135677
  }
135629
135678
  cases.forEach((c) => registry$1.set(c, importFn));
135630
135679
  }
135631
- addDecoder([void 0, 1], () => import("./raw-dbd5f758.js").then((m) => m.default));
135632
- addDecoder(5, () => import("./lzw-1b172fa4.js").then((m) => m.default));
135680
+ addDecoder([void 0, 1], () => import("./raw-5fe65388.js").then((m) => m.default));
135681
+ addDecoder(5, () => import("./lzw-77e04669.js").then((m) => m.default));
135633
135682
  addDecoder(6, () => {
135634
135683
  throw new Error("old style JPEG compression is not supported.");
135635
135684
  });
135636
- addDecoder(7, () => import("./jpeg-32ca4e37.js").then((m) => m.default));
135637
- addDecoder([8, 32946], () => import("./deflate-804156cd.js").then((m) => m.default));
135638
- addDecoder(32773, () => import("./packbits-84f5534a.js").then((m) => m.default));
135639
- addDecoder(34887, () => import("./lerc-be957c97.js").then((m) => m.default));
135640
- addDecoder(50001, () => import("./webimage-d64061e3.js").then((m) => m.default));
135685
+ addDecoder(7, () => import("./jpeg-f45548fb.js").then((m) => m.default));
135686
+ addDecoder([8, 32946], () => import("./deflate-eb6142f1.js").then((m) => m.default));
135687
+ addDecoder(32773, () => import("./packbits-9cb1da9c.js").then((m) => m.default));
135688
+ addDecoder(34887, () => import("./lerc-efa246ce.js").then((m) => m.default));
135689
+ addDecoder(50001, () => import("./webimage-fb5c89b6.js").then((m) => m.default));
135641
135690
  function decodeRowAcc(row, stride) {
135642
135691
  let length2 = row.length - stride;
135643
135692
  let offset4 = 0;
@@ -149163,6 +149212,8 @@ const LayerControllerMemoized = React__default.memo(
149163
149212
  forwardRef((props2, ref) => {
149164
149213
  const {
149165
149214
  title,
149215
+ closeButtonVisible,
149216
+ downloadButtonVisible,
149166
149217
  removeGridComponent,
149167
149218
  theme,
149168
149219
  isReady,
@@ -149215,6 +149266,8 @@ const LayerControllerMemoized = React__default.memo(
149215
149266
  {
149216
149267
  title,
149217
149268
  isScroll: true,
149269
+ closeButtonVisible,
149270
+ downloadButtonVisible,
149218
149271
  removeGridComponent,
149219
149272
  theme,
149220
149273
  isReady,
@@ -149388,6 +149441,8 @@ const LayerControllerMemoized = React__default.memo(
149388
149441
  function LayerControllerSubscriber(props2) {
149389
149442
  const {
149390
149443
  coordinationScopes,
149444
+ closeButtonVisible,
149445
+ downloadButtonVisible,
149391
149446
  removeGridComponent,
149392
149447
  theme,
149393
149448
  title = "Spatial Layers",
@@ -149522,6 +149577,8 @@ function LayerControllerSubscriber(props2) {
149522
149577
  {
149523
149578
  ref: layerControllerRef,
149524
149579
  title,
149580
+ closeButtonVisible,
149581
+ downloadButtonVisible,
149525
149582
  removeGridComponent,
149526
149583
  theme,
149527
149584
  isReady,
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a, L, V, d, c, e, f, b, h, u } from "./index-b51c005e.js";
1
+ import { a, L, V, d, c, e, f, b, h, u } from "./index-d3bd5576.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-b51c005e.js";
1
+ import { B as BaseDecoder } from "./index-d3bd5576.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-b51c005e.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-d3bd5576.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-b51c005e.js";
1
+ import { B as BaseDecoder } from "./index-d3bd5576.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-b51c005e.js";
1
+ import { B as BaseDecoder } from "./index-d3bd5576.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-b51c005e.js";
1
+ import { B as BaseDecoder } from "./index-d3bd5576.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-b51c005e.js";
1
+ import { B as BaseDecoder } from "./index-d3bd5576.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1 +1 @@
1
- {"version":3,"file":"LayerControllerSubscriber.d.ts","sourceRoot":"","sources":["../src/LayerControllerSubscriber.js"],"names":[],"mappings":"AAiSA;;;;;;;;;;;;;;;GAeG;AACH;IAbyB,KAAK,EAAnB,MAAM;IACQ,kBAAkB,EAAhC,MAAM;IAEU,mBAAmB;IAErB,KAAK,EAAnB,MAAM;IACQ,SAAS,EAAvB,MAAM;IACS,eAAe,EAA9B,OAAO;IACQ,4BAA4B,EAA3C,OAAO;IAEQ,8BAA8B,EAA7C,OAAO;gBAsMjB"}
1
+ {"version":3,"file":"LayerControllerSubscriber.d.ts","sourceRoot":"","sources":["../src/LayerControllerSubscriber.js"],"names":[],"mappings":"AAqSA;;;;;;;;;;;;;;;GAeG;AACH;IAbyB,KAAK,EAAnB,MAAM;IACQ,kBAAkB,EAAhC,MAAM;IAEU,mBAAmB;IAErB,KAAK,EAAnB,MAAM;IACQ,SAAS,EAAvB,MAAM;IACS,eAAe,EAA9B,OAAO;IACQ,4BAA4B,EAA3C,OAAO;IAEQ,8BAA8B,EAA7C,OAAO;gBA0MjB"}
@@ -17,10 +17,10 @@ import ImageAddButton from './ImageAddButton.js';
17
17
  // the actual Spatial component. Re-rendering this component is very
18
18
  // expensive so we have to be careful with props in this file in general.
19
19
  const LayerControllerMemoized = React.memo(forwardRef((props, ref) => {
20
- const { title, removeGridComponent, theme, isReady, dataset, obsType, moleculesLayer, setMoleculesLayer, cellsLayer, // May be one polygon layer object or an array of bitmask layers.
20
+ const { title, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, isReady, dataset, obsType, moleculesLayer, setMoleculesLayer, cellsLayer, // May be one polygon layer object or an array of bitmask layers.
21
21
  setCellsLayer, rasterLayers, imageLayerLoaders, imageLayerMeta, imageLayerCallbacks, setImageLayerCallbacks, areLoadingImageChannels, setAreLoadingImageChannels, handleRasterLayerChange, handleRasterLayerRemove, obsSegmentationsType, segmentationLayerLoaders, segmentationLayerMeta, segmentationLayerCallbacks, setSegmentationLayerCallbacks, areLoadingSegmentationChannels, setAreLoadingSegmentationChannels, handleSegmentationLayerChange, handleSegmentationLayerRemove, disable3d, globalDisable3d, disableChannelsIfRgbDetected, layerIs3DIndex, setZoom, setTargetX, setTargetY, setTargetZ, setRotationX, setRotationOrbit, componentHeight, componentWidth, spatialLayout, handleImageAdd, enableLayerButtonsWithOneLayer, } = props;
22
22
  const shouldShowImageLayerButton = Boolean(enableLayerButtonsWithOneLayer || imageLayerLoaders?.length > 1);
23
- return (_jsx(TitleInfo, { title: title, isScroll: true, removeGridComponent: removeGridComponent, theme: theme, isReady: isReady, children: _jsxs("div", { className: "layer-controller-container", ref: ref, children: [moleculesLayer && (_jsx(VectorLayerController, { label: "Molecules", layerType: "molecules", layer: moleculesLayer, handleLayerChange: setMoleculesLayer }, `${dataset}-molecules`)), cellsLayer && obsSegmentationsType === 'polygon' && (_jsx(VectorLayerController, { label: `${capitalize(obsType)} Segmentations`, layerType: "cells", layer: cellsLayer, handleLayerChange: setCellsLayer }, `${dataset}-cells`)), cellsLayer && obsSegmentationsType === 'bitmask'
23
+ return (_jsx(TitleInfo, { title: title, isScroll: true, closeButtonVisible: closeButtonVisible, downloadButtonVisible: downloadButtonVisible, removeGridComponent: removeGridComponent, theme: theme, isReady: isReady, children: _jsxs("div", { className: "layer-controller-container", ref: ref, children: [moleculesLayer && (_jsx(VectorLayerController, { label: "Molecules", layerType: "molecules", layer: moleculesLayer, handleLayerChange: setMoleculesLayer }, `${dataset}-molecules`)), cellsLayer && obsSegmentationsType === 'polygon' && (_jsx(VectorLayerController, { label: `${capitalize(obsType)} Segmentations`, layerType: "cells", layer: cellsLayer, handleLayerChange: setCellsLayer }, `${dataset}-cells`)), cellsLayer && obsSegmentationsType === 'bitmask'
24
24
  && cellsLayer.map((layer, i) => {
25
25
  const { index } = layer;
26
26
  const loader = segmentationLayerLoaders?.[index];
@@ -125,7 +125,7 @@ const LayerControllerMemoized = React.memo(forwardRef((props, ref) => {
125
125
  * show the the layer add/remove buttons.
126
126
  */
127
127
  export function LayerControllerSubscriber(props) {
128
- const { coordinationScopes, removeGridComponent, theme, title = 'Spatial Layers', disable3d, globalDisable3d, disableChannelsIfRgbDetected, enableLayerButtonsWithOneLayer, } = props;
128
+ const { coordinationScopes, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, title = 'Spatial Layers', disable3d, globalDisable3d, disableChannelsIfRgbDetected, enableLayerButtonsWithOneLayer, } = props;
129
129
  const loaders = useLoaders();
130
130
  // Get "props" from the coordination space.
131
131
  const [{ dataset, obsType, spatialImageLayer: rasterLayers, spatialSegmentationLayer: cellsLayer, spatialPointLayer: moleculesLayer, }, { setSpatialImageLayer: setRasterLayers, setSpatialSegmentationLayer: setCellsLayer, setSpatialPointLayer: setMoleculesLayer, setSpatialTargetX: setTargetX, setSpatialTargetY: setTargetY, setSpatialTargetZ: setTargetZ, setSpatialRotationX: setRotationX, setSpatialRotationOrbit: setRotationOrbit, setSpatialZoom: setZoom, },] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType.LAYER_CONTROLLER], coordinationScopes);
@@ -188,7 +188,7 @@ export function LayerControllerSubscriber(props) {
188
188
  setCellsLayer(newLayers);
189
189
  }, [cellsLayer, setCellsLayer]);
190
190
  const layerIs3DIndex = rasterLayers?.findIndex && rasterLayers.findIndex(layer => layer.use3d);
191
- return (_jsx(LayerControllerMemoized, { ref: layerControllerRef, title: title, removeGridComponent: removeGridComponent, theme: theme, isReady: isReady, moleculesLayer: moleculesLayer, dataset: dataset, obsType: obsType, setMoleculesLayer: setMoleculesLayer, cellsLayer: cellsLayer, setCellsLayer: setCellsLayer, rasterLayers: rasterLayers, imageLayerLoaders: imageLayerLoaders, imageLayerMeta: imageLayerMeta, imageLayerCallbacks: imageLayerCallbacks, setImageLayerCallbacks: setImageLayerCallbacks, areLoadingImageChannels: areLoadingImageChannels, setAreLoadingImageChannels: setAreLoadingImageChannels, handleRasterLayerChange: handleRasterLayerChange, handleRasterLayerRemove: handleRasterLayerRemove, obsSegmentationsType: obsSegmentationsType, segmentationLayerLoaders: segmentationLayerLoaders, segmentationLayerMeta: segmentationLayerMeta, segmentationLayerCallbacks: segmentationLayerCallbacks, setSegmentationLayerCallbacks: setSegmentationLayerCallbacks, areLoadingSegmentationChannels: areLoadingSegmentationChannels, setAreLoadingSegmentationChannels: setAreLoadingSegmentationChannels, handleSegmentationLayerChange: handleSegmentationLayerChange, handleSegmentationLayerRemove: handleSegmentationLayerRemove, disable3d: disable3d, globalDisable3d: globalDisable3d, layerIs3DIndex: layerIs3DIndex, disableChannelsIfRgbDetected: disableChannelsIfRgbDetected, enableLayerButtonsWithOneLayer: enableLayerButtonsWithOneLayer, setZoom: setZoom, setTargetX: setTargetX, setTargetY: setTargetY, setTargetZ: setTargetZ, setRotationX: setRotationX, setRotationOrbit: setRotationOrbit,
191
+ return (_jsx(LayerControllerMemoized, { ref: layerControllerRef, title: title, closeButtonVisible: closeButtonVisible, downloadButtonVisible: downloadButtonVisible, removeGridComponent: removeGridComponent, theme: theme, isReady: isReady, moleculesLayer: moleculesLayer, dataset: dataset, obsType: obsType, setMoleculesLayer: setMoleculesLayer, cellsLayer: cellsLayer, setCellsLayer: setCellsLayer, rasterLayers: rasterLayers, imageLayerLoaders: imageLayerLoaders, imageLayerMeta: imageLayerMeta, imageLayerCallbacks: imageLayerCallbacks, setImageLayerCallbacks: setImageLayerCallbacks, areLoadingImageChannels: areLoadingImageChannels, setAreLoadingImageChannels: setAreLoadingImageChannels, handleRasterLayerChange: handleRasterLayerChange, handleRasterLayerRemove: handleRasterLayerRemove, obsSegmentationsType: obsSegmentationsType, segmentationLayerLoaders: segmentationLayerLoaders, segmentationLayerMeta: segmentationLayerMeta, segmentationLayerCallbacks: segmentationLayerCallbacks, setSegmentationLayerCallbacks: setSegmentationLayerCallbacks, areLoadingSegmentationChannels: areLoadingSegmentationChannels, setAreLoadingSegmentationChannels: setAreLoadingSegmentationChannels, handleSegmentationLayerChange: handleSegmentationLayerChange, handleSegmentationLayerRemove: handleSegmentationLayerRemove, disable3d: disable3d, globalDisable3d: globalDisable3d, layerIs3DIndex: layerIs3DIndex, disableChannelsIfRgbDetected: disableChannelsIfRgbDetected, enableLayerButtonsWithOneLayer: enableLayerButtonsWithOneLayer, setZoom: setZoom, setTargetX: setTargetX, setTargetY: setTargetY, setTargetZ: setTargetZ, setRotationX: setRotationX, setRotationOrbit: setRotationOrbit,
192
192
  // Fall back to window for height and width.
193
193
  componentHeight: componentHeight || windowHeight, componentWidth: componentWidth || windowWidth, spatialLayout: spatialLayout, handleImageAdd: handleImageAdd }));
194
194
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/layer-controller",
3
- "version": "3.3.0",
3
+ "version": "3.3.2",
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/constants-internal": "3.3.0",
25
- "@vitessce/gl": "3.3.0",
26
- "@vitessce/spatial-utils": "3.3.0",
27
- "@vitessce/utils": "3.3.0",
28
- "@vitessce/vit-s": "3.3.0"
24
+ "@vitessce/constants-internal": "3.3.2",
25
+ "@vitessce/spatial-utils": "3.3.2",
26
+ "@vitessce/gl": "3.3.2",
27
+ "@vitessce/utils": "3.3.2",
28
+ "@vitessce/vit-s": "3.3.2"
29
29
  },
30
30
  "devDependencies": {
31
31
  "react": "^18.0.0",
@@ -33,6 +33,8 @@ const LayerControllerMemoized = React.memo(
33
33
  forwardRef((props, ref) => {
34
34
  const {
35
35
  title,
36
+ closeButtonVisible,
37
+ downloadButtonVisible,
36
38
  removeGridComponent,
37
39
  theme,
38
40
  isReady,
@@ -86,6 +88,8 @@ const LayerControllerMemoized = React.memo(
86
88
  <TitleInfo
87
89
  title={title}
88
90
  isScroll
91
+ closeButtonVisible={closeButtonVisible}
92
+ downloadButtonVisible={downloadButtonVisible}
89
93
  removeGridComponent={removeGridComponent}
90
94
  theme={theme}
91
95
  isReady={isReady}
@@ -306,6 +310,8 @@ const LayerControllerMemoized = React.memo(
306
310
  export function LayerControllerSubscriber(props) {
307
311
  const {
308
312
  coordinationScopes,
313
+ closeButtonVisible,
314
+ downloadButtonVisible,
309
315
  removeGridComponent,
310
316
  theme,
311
317
  title = 'Spatial Layers',
@@ -450,6 +456,8 @@ export function LayerControllerSubscriber(props) {
450
456
  <LayerControllerMemoized
451
457
  ref={layerControllerRef}
452
458
  title={title}
459
+ closeButtonVisible={closeButtonVisible}
460
+ downloadButtonVisible={downloadButtonVisible}
453
461
  removeGridComponent={removeGridComponent}
454
462
  theme={theme}
455
463
  isReady={isReady}