@vitessce/image-utils 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-6ca251e9.js";
2
+ import { B as BaseDecoder } from "./index-0d0c0adf.js";
3
3
  import "react";
4
4
  class DeflateDecoder extends BaseDecoder {
5
5
  decodeBlock(buffer) {
@@ -38459,7 +38459,7 @@ const jsonLoader = {
38459
38459
  testText: isJSON,
38460
38460
  parseTextSync: JSON.parse
38461
38461
  };
38462
- const version = "8.8.20";
38462
+ const version = "8.8.27";
38463
38463
  const existingVersion = globalThis.deck && globalThis.deck.VERSION;
38464
38464
  if (existingVersion && existingVersion !== version) {
38465
38465
  throw new Error("deck.gl - multiple versions detected: ".concat(existingVersion, " vs ").concat(version));
@@ -39658,9 +39658,8 @@ function cssToDeviceRatio(gl) {
39658
39658
  luma
39659
39659
  } = gl;
39660
39660
  if (gl.canvas && luma) {
39661
- const {
39662
- clientWidth
39663
- } = luma.canvasSizeInfo;
39661
+ const cachedSize = luma.canvasSizeInfo;
39662
+ const clientWidth = "clientWidth" in cachedSize ? cachedSize.clientWidth : gl.canvas.clientWidth;
39664
39663
  return clientWidth ? gl.drawingBufferWidth / clientWidth : 1;
39665
39664
  }
39666
39665
  return 1;
@@ -39916,7 +39915,7 @@ function setDevicePixelRatio(gl, devicePixelRatio, options) {
39916
39915
  });
39917
39916
  }
39918
39917
  }
39919
- const VERSION$7 = "8.5.16";
39918
+ const VERSION$7 = "8.5.21";
39920
39919
  const STARTUP_MESSAGE = "set luma.log.level=1 (or higher) to trace rendering";
39921
39920
  class StatsManager {
39922
39921
  constructor() {
@@ -40037,7 +40036,6 @@ let Resource$1 = class Resource {
40037
40036
  this._handle = this._createHandle();
40038
40037
  }
40039
40038
  this.byteLength = 0;
40040
- this._initStats();
40041
40039
  this._addStats();
40042
40040
  }
40043
40041
  toString() {
@@ -40173,9 +40171,6 @@ let Resource$1 = class Resource {
40173
40171
  this.gl.luma = this.gl.luma || {};
40174
40172
  return this.gl.luma;
40175
40173
  }
40176
- _initStats() {
40177
- this.gl.stats = this.gl.stats || new StatsManager();
40178
- }
40179
40174
  _addStats() {
40180
40175
  const name2 = this[Symbol.toStringTag];
40181
40176
  const stats = lumaStats.get("Resource Counts");
@@ -40190,27 +40185,29 @@ let Resource$1 = class Resource {
40190
40185
  }
40191
40186
  _trackAllocatedMemory(bytes) {
40192
40187
  let name2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this[Symbol.toStringTag];
40193
- this._doTrackAllocatedMemory(bytes, name2);
40194
- this._doTrackAllocatedMemory(bytes, name2, this.gl.stats.get("Memory Usage"));
40188
+ this._trackAllocatedMemoryForContext(bytes, name2);
40189
+ this._trackAllocatedMemoryForContext(bytes, name2, this.gl.canvas && this.gl.canvas.id);
40190
+ this.byteLength = bytes;
40195
40191
  }
40196
- _doTrackAllocatedMemory(bytes) {
40192
+ _trackAllocatedMemoryForContext(bytes) {
40197
40193
  let name2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this[Symbol.toStringTag];
40198
- let stats = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : lumaStats.get("Memory Usage");
40194
+ let id = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
40195
+ const stats = lumaStats.get("Memory Usage".concat(id));
40199
40196
  stats.get("GPU Memory").addCount(bytes);
40200
40197
  stats.get("".concat(name2, " Memory")).addCount(bytes);
40201
- this.byteLength = bytes;
40202
40198
  }
40203
40199
  _trackDeallocatedMemory() {
40204
40200
  let name2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this[Symbol.toStringTag];
40205
- this._doTrackDeallocatedMemory(name2);
40206
- this._doTrackDeallocatedMemory(name2, this.gl.stats.get("Memory Usage"));
40201
+ this._trackDeallocatedMemoryForContext(name2);
40202
+ this._trackDeallocatedMemoryForContext(name2, this.gl.canvas && this.gl.canvas.id);
40203
+ this.byteLength = 0;
40207
40204
  }
40208
- _doTrackDeallocatedMemory() {
40205
+ _trackDeallocatedMemoryForContext() {
40209
40206
  let name2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this[Symbol.toStringTag];
40210
- let stats = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : lumaStats.get("Memory Usage");
40207
+ let id = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
40208
+ const stats = lumaStats.get("Memory Usage".concat(id));
40211
40209
  stats.get("GPU Memory").subtractCount(this.byteLength);
40212
40210
  stats.get("".concat(name2, " Memory")).subtractCount(this.byteLength);
40213
- this.byteLength = 0;
40214
40211
  }
40215
40212
  };
40216
40213
  const ERR_TYPE_DEDUCTION = "Failed to deduce GL constant from typed array";
@@ -49825,6 +49822,7 @@ const picking = {
49825
49822
  inject: {
49826
49823
  "vs:DECKGL_FILTER_GL_POSITION": "\n // for picking depth values\n picking_setPickingAttribute(position.z / position.w);\n ",
49827
49824
  "vs:DECKGL_FILTER_COLOR": "\n picking_setPickingColor(geometry.pickingColor);\n ",
49825
+ "fs:#decl": "\nuniform bool picking_uAttribute;\n ",
49828
49826
  "fs:DECKGL_FILTER_COLOR": {
49829
49827
  order: 99,
49830
49828
  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 "
@@ -50635,6 +50633,9 @@ class Viewport {
50635
50633
  this.projectFlat = this.projectFlat.bind(this);
50636
50634
  this.unprojectFlat = this.unprojectFlat.bind(this);
50637
50635
  }
50636
+ get subViewports() {
50637
+ return null;
50638
+ }
50638
50639
  get metersPerPixel() {
50639
50640
  return this.distanceScales.metersPerUnit[2] / this.scale;
50640
50641
  }
@@ -59526,7 +59527,7 @@ class Attribute extends DataColumn {
59526
59527
  const {
59527
59528
  startIndices
59528
59529
  } = this;
59529
- const vertexIndex = startIndices ? startIndices[row] : row;
59530
+ const vertexIndex = startIndices ? row < startIndices.length ? startIndices[row] : this.numInstances : row;
59530
59531
  return vertexIndex * this.size;
59531
59532
  }
59532
59533
  getShaderAttributes() {
@@ -62170,7 +62171,7 @@ class Layer extends Component {
62170
62171
  if (Array.isArray(highlightColor)) {
62171
62172
  parameters.pickingHighlightColor = highlightColor;
62172
62173
  }
62173
- if (Number.isInteger(highlightedObjectIndex)) {
62174
+ if (forceUpdate || highlightedObjectIndex !== oldProps.highlightedObjectIndex) {
62174
62175
  parameters.pickingSelectedColor = Number.isFinite(highlightedObjectIndex) && highlightedObjectIndex >= 0 ? this.encodePickingColor(highlightedObjectIndex) : null;
62175
62176
  }
62176
62177
  this.setModuleParameters(parameters);
@@ -63533,7 +63534,7 @@ function interpolateQuad(quad, ut, vt) {
63533
63534
  }
63534
63535
  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";
63535
63536
  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";
63536
- 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");
63537
+ 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");
63537
63538
  const defaultProps$I = {
63538
63539
  image: {
63539
63540
  type: "image",
@@ -71673,18 +71674,22 @@ function getBoundingBox(viewport, zRange, extent2) {
71673
71674
  }
71674
71675
  function getCullBounds({
71675
71676
  viewport,
71676
- z: z2,
71677
+ z: z2 = 0,
71677
71678
  cullRect
71678
71679
  }) {
71679
- const x2 = cullRect.x - viewport.x;
71680
- const y2 = cullRect.y - viewport.y;
71681
- const {
71682
- width,
71683
- height
71684
- } = cullRect;
71680
+ const subViewports = viewport.subViewports || [viewport];
71681
+ return subViewports.map((v) => getCullBoundsInViewport(v, z2, cullRect));
71682
+ }
71683
+ function getCullBoundsInViewport(viewport, z2, cullRect) {
71685
71684
  if (!Array.isArray(z2)) {
71685
+ const x2 = cullRect.x - viewport.x;
71686
+ const y2 = cullRect.y - viewport.y;
71687
+ const {
71688
+ width,
71689
+ height
71690
+ } = cullRect;
71686
71691
  const unprojectOption = {
71687
- targetZ: z2 || 0
71692
+ targetZ: z2
71688
71693
  };
71689
71694
  const topLeft = viewport.unproject([x2, y2], unprojectOption);
71690
71695
  const topRight = viewport.unproject([x2 + width, y2], unprojectOption);
@@ -71692,16 +71697,8 @@ function getCullBounds({
71692
71697
  const bottomRight = viewport.unproject([x2 + width, y2 + height], unprojectOption);
71693
71698
  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])];
71694
71699
  }
71695
- const bounds0 = getCullBounds({
71696
- viewport,
71697
- z: z2[0],
71698
- cullRect
71699
- });
71700
- const bounds1 = getCullBounds({
71701
- viewport,
71702
- z: z2[1],
71703
- cullRect
71704
- });
71700
+ const bounds0 = getCullBoundsInViewport(viewport, z2[0], cullRect);
71701
+ const bounds1 = getCullBoundsInViewport(viewport, z2[1], cullRect);
71705
71702
  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])];
71706
71703
  }
71707
71704
  function getIndexingCoords(bbox2, scale2, modelMatrixInverse) {
@@ -71931,7 +71928,7 @@ class Tileset2D {
71931
71928
  return false;
71932
71929
  }
71933
71930
  if (cullRect && this._viewport) {
71934
- const [minX, minY, maxX, maxY] = getCullBounds({
71931
+ const boundsArr = this._getCullBounds({
71935
71932
  viewport: this._viewport,
71936
71933
  z: this._zRange,
71937
71934
  cullRect
@@ -71939,12 +71936,20 @@ class Tileset2D {
71939
71936
  const {
71940
71937
  bbox: bbox2
71941
71938
  } = tile;
71942
- if ("west" in bbox2) {
71943
- return bbox2.west < maxX && bbox2.east > minX && bbox2.south < maxY && bbox2.north > minY;
71939
+ for (const [minX, minY, maxX, maxY] of boundsArr) {
71940
+ let overlaps;
71941
+ if ("west" in bbox2) {
71942
+ overlaps = bbox2.west < maxX && bbox2.east > minX && bbox2.south < maxY && bbox2.north > minY;
71943
+ } else {
71944
+ const y02 = Math.min(bbox2.top, bbox2.bottom);
71945
+ const y12 = Math.max(bbox2.top, bbox2.bottom);
71946
+ overlaps = bbox2.left < maxX && bbox2.right > minX && y02 < maxY && y12 > minY;
71947
+ }
71948
+ if (overlaps) {
71949
+ return true;
71950
+ }
71944
71951
  }
71945
- const y02 = Math.min(bbox2.top, bbox2.bottom);
71946
- const y12 = Math.max(bbox2.top, bbox2.bottom);
71947
- return bbox2.left < maxX && bbox2.right > minX && y02 < maxY && y12 > minY;
71952
+ return false;
71948
71953
  }
71949
71954
  return true;
71950
71955
  }
@@ -72393,14 +72398,19 @@ class TileLayer extends CompositeLayer {
72393
72398
  info,
72394
72399
  sourceLayer
72395
72400
  }) {
72401
+ const sourceTile = sourceLayer.props.tile;
72396
72402
  if (info.picked) {
72397
- info.tile = sourceLayer.props.tile;
72403
+ info.tile = sourceTile;
72398
72404
  }
72405
+ info.sourceTile = sourceTile;
72399
72406
  return info;
72400
72407
  }
72401
72408
  _updateAutoHighlight(info) {
72402
- if (info.sourceLayer) {
72403
- info.sourceLayer.updateAutoHighlight(info);
72409
+ const sourceTile = info.sourceTile;
72410
+ if (sourceTile && sourceTile.layers) {
72411
+ for (const layer of sourceTile.layers) {
72412
+ layer.updateAutoHighlight(info);
72413
+ }
72404
72414
  }
72405
72415
  }
72406
72416
  renderLayers() {
@@ -84718,6 +84728,9 @@ class ScenegraphNode {
84718
84728
  toString() {
84719
84729
  return "{type: ScenegraphNode, id: ".concat(this.id, ")}");
84720
84730
  }
84731
+ getBounds() {
84732
+ return null;
84733
+ }
84721
84734
  setPosition(position) {
84722
84735
  assert$7(position.length === 3, "setPosition requires vector argument");
84723
84736
  this.position = position;
@@ -84868,6 +84881,34 @@ class GroupNode extends ScenegraphNode {
84868
84881
  this.removeAll();
84869
84882
  super.delete();
84870
84883
  }
84884
+ getBounds() {
84885
+ const result = [[Infinity, Infinity, Infinity], [-Infinity, -Infinity, -Infinity]];
84886
+ this.traverse((node2, _ref) => {
84887
+ let {
84888
+ worldMatrix
84889
+ } = _ref;
84890
+ const bounds2 = node2.getBounds();
84891
+ if (!bounds2) {
84892
+ return;
84893
+ }
84894
+ const [min2, max2] = bounds2;
84895
+ const center2 = new Vector3(min2).add(max2).divide([2, 2, 2]);
84896
+ worldMatrix.transformAsPoint(center2, center2);
84897
+ const halfSize = new Vector3(max2).subtract(min2).divide([2, 2, 2]);
84898
+ worldMatrix.transformAsVector(halfSize, halfSize);
84899
+ for (let v = 0; v < 8; v++) {
84900
+ const position = new Vector3(v & 1 ? -1 : 1, v & 2 ? -1 : 1, v & 4 ? -1 : 1).multiply(halfSize).add(center2);
84901
+ for (let i2 = 0; i2 < 3; i2++) {
84902
+ result[0][i2] = Math.min(result[0][i2], position[i2]);
84903
+ result[1][i2] = Math.max(result[1][i2], position[i2]);
84904
+ }
84905
+ }
84906
+ });
84907
+ if (!Number.isFinite(result[0][0])) {
84908
+ return null;
84909
+ }
84910
+ return result;
84911
+ }
84871
84912
  traverse(visitor) {
84872
84913
  let {
84873
84914
  worldMatrix = new Matrix4()
@@ -85117,6 +85158,7 @@ class ModelNode extends ScenegraphNode {
85117
85158
  } else {
85118
85159
  this.model = new Model(gl, props2);
85119
85160
  }
85161
+ this.bounds = null;
85120
85162
  this.managedResources = props2.managedResources || [];
85121
85163
  }
85122
85164
  setProps(props2) {
@@ -85124,6 +85166,9 @@ class ModelNode extends ScenegraphNode {
85124
85166
  this._setModelNodeProps(props2);
85125
85167
  return this;
85126
85168
  }
85169
+ getBounds() {
85170
+ return this.bounds;
85171
+ }
85127
85172
  delete() {
85128
85173
  if (this.model) {
85129
85174
  this.model.delete();
@@ -85308,17 +85353,21 @@ function createGLTFModel(gl, options) {
85308
85353
  const managedResources = [];
85309
85354
  managedResources.push(...materialParser.generatedTextures);
85310
85355
  managedResources.push(...Object.values(attributes).map((attribute) => attribute.buffer));
85311
- const model = new ModelNode(gl, Object.assign({
85356
+ const model = new ModelNode(gl, {
85312
85357
  id,
85313
85358
  drawMode,
85314
85359
  vertexCount,
85315
85360
  modules: [pbr],
85316
- defines: materialParser.defines,
85317
85361
  parameters: materialParser.parameters,
85318
85362
  vs: addVersionToShader(gl, vs$7),
85319
85363
  fs: addVersionToShader(gl, fs$7),
85320
- managedResources
85321
- }, modelOptions));
85364
+ managedResources,
85365
+ ...modelOptions,
85366
+ defines: {
85367
+ ...materialParser.defines,
85368
+ ...modelOptions.defines
85369
+ }
85370
+ });
85322
85371
  model.setProps({
85323
85372
  attributes
85324
85373
  });
@@ -85413,13 +85462,15 @@ class GLTFInstantiator {
85413
85462
  log$2.warn("getVertexCount() not found")();
85414
85463
  }
85415
85464
  createPrimitive(gltfPrimitive, i2, gltfMesh) {
85416
- return createGLTFModel(this.gl, Object.assign({
85465
+ const model = createGLTFModel(this.gl, Object.assign({
85417
85466
  id: gltfPrimitive.name || "".concat(gltfMesh.name || gltfMesh.id, "-primitive-").concat(i2),
85418
85467
  drawMode: gltfPrimitive.mode || 4,
85419
85468
  vertexCount: gltfPrimitive.indices ? gltfPrimitive.indices.count : this.getVertexCount(gltfPrimitive.attributes),
85420
85469
  attributes: this.createAttributes(gltfPrimitive.attributes, gltfPrimitive.indices),
85421
85470
  material: gltfPrimitive.material
85422
85471
  }, this.options));
85472
+ model.bounds = [gltfPrimitive.attributes.POSITION.min, gltfPrimitive.attributes.POSITION.max];
85473
+ return model;
85423
85474
  }
85424
85475
  createAttributes(attributes, indices) {
85425
85476
  const loadedAttributes = {};
@@ -93347,15 +93398,11 @@ class Tile3DLayer extends CompositeLayer {
93347
93398
  info,
93348
93399
  sourceLayer
93349
93400
  }) {
93350
- const {
93351
- layerMap
93352
- } = this.state;
93353
- const layerId = sourceLayer && sourceLayer.id;
93354
- if (layerId) {
93355
- const substr = layerId.substring(this.id.length + 1);
93356
- const tileId = substr.substring(substr.indexOf("-") + 1);
93357
- info.object = layerMap[tileId] && layerMap[tileId].tile;
93401
+ const sourceTile = sourceLayer && sourceLayer.props.tile;
93402
+ if (info.picked) {
93403
+ info.object = sourceTile;
93358
93404
  }
93405
+ info.sourceTile = sourceTile;
93359
93406
  return info;
93360
93407
  }
93361
93408
  filterSubLayer({
@@ -93371,8 +93418,10 @@ class Tile3DLayer extends CompositeLayer {
93371
93418
  return tile.selected && tile.viewportIds.includes(viewportId);
93372
93419
  }
93373
93420
  _updateAutoHighlight(info) {
93374
- if (info.sourceLayer) {
93375
- info.sourceLayer.updateAutoHighlight(info);
93421
+ const sourceTile = info.sourceTile;
93422
+ const layerCache = this.state.layerMap[sourceTile === null || sourceTile === void 0 ? void 0 : sourceTile.id];
93423
+ if (layerCache && layerCache.layer) {
93424
+ layerCache.layer.updateAutoHighlight(info);
93376
93425
  }
93377
93426
  }
93378
93427
  async _loadTileset(tilesetUrl) {
@@ -133394,16 +133443,16 @@ function addDecoder(cases, importFn) {
133394
133443
  }
133395
133444
  cases.forEach((c) => registry$1.set(c, importFn));
133396
133445
  }
133397
- addDecoder([void 0, 1], () => import("./raw-4ec93bc1.js").then((m) => m.default));
133398
- addDecoder(5, () => import("./lzw-9452bd5a.js").then((m) => m.default));
133446
+ addDecoder([void 0, 1], () => import("./raw-0bd252aa.js").then((m) => m.default));
133447
+ addDecoder(5, () => import("./lzw-ff35f80d.js").then((m) => m.default));
133399
133448
  addDecoder(6, () => {
133400
133449
  throw new Error("old style JPEG compression is not supported.");
133401
133450
  });
133402
- addDecoder(7, () => import("./jpeg-7595bd75.js").then((m) => m.default));
133403
- addDecoder([8, 32946], () => import("./deflate-d9ef109e.js").then((m) => m.default));
133404
- addDecoder(32773, () => import("./packbits-568f6711.js").then((m) => m.default));
133405
- addDecoder(34887, () => import("./lerc-c2b996a9.js").then((m) => m.default));
133406
- addDecoder(50001, () => import("./webimage-d9e0dea0.js").then((m) => m.default));
133451
+ addDecoder(7, () => import("./jpeg-740477bd.js").then((m) => m.default));
133452
+ addDecoder([8, 32946], () => import("./deflate-e92fb9a9.js").then((m) => m.default));
133453
+ addDecoder(32773, () => import("./packbits-2148c0a8.js").then((m) => m.default));
133454
+ addDecoder(34887, () => import("./lerc-bed4a26d.js").then((m) => m.default));
133455
+ addDecoder(50001, () => import("./webimage-78bc948c.js").then((m) => m.default));
133407
133456
  function decodeRowAcc(row, stride) {
133408
133457
  let length2 = row.length - stride;
133409
133458
  let offset = 0;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { I } from "./index-6ca251e9.js";
1
+ import { I } from "./index-0d0c0adf.js";
2
2
  import "react";
3
3
  export {
4
4
  I as ImageWrapper
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-6ca251e9.js";
1
+ import { B as BaseDecoder } from "./index-0d0c0adf.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-6ca251e9.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-0d0c0adf.js";
3
3
  import "react";
4
4
  const LercParameters = {
5
5
  Version: 0,
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-6ca251e9.js";
1
+ import { B as BaseDecoder } from "./index-0d0c0adf.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-6ca251e9.js";
1
+ import { B as BaseDecoder } from "./index-0d0c0adf.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-6ca251e9.js";
1
+ import { B as BaseDecoder } from "./index-0d0c0adf.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-6ca251e9.js";
1
+ import { B as BaseDecoder } from "./index-0d0c0adf.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/image-utils",
3
- "version": "3.3.0",
3
+ "version": "3.3.2",
4
4
  "author": "Gehlenborg Lab",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -17,8 +17,8 @@
17
17
  ],
18
18
  "dependencies": {
19
19
  "@hms-dbmi/viv": "~0.13.8",
20
- "@vitessce/spatial-utils": "3.3.0",
21
- "@vitessce/utils": "3.3.0"
20
+ "@vitessce/spatial-utils": "3.3.2",
21
+ "@vitessce/utils": "3.3.2"
22
22
  },
23
23
  "devDependencies": {
24
24
  "vite": "^4.3.0",