@vitessce/all 4.1.2 → 4.1.3

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.
@@ -7,7 +7,7 @@ var __privateAdd = (obj, member, value2) => member.has(obj) ? __typeError("Canno
7
7
  var __privateSet = (obj, member, value2, setter2) => (__accessCheck(obj, member, "write to private field"), setter2 ? setter2.call(obj, value2) : member.set(obj, value2), value2);
8
8
  var _inner;
9
9
  import * as React from "react";
10
- import React__default, { useContext, forwardRef as forwardRef$1, useRef, useMemo as useMemo$1, createContext as createContext$1, createElement, PureComponent, useEffect, useState, Children, version as version$6, isValidElement, useLayoutEffect as useLayoutEffect$1, useImperativeHandle, Component as Component$1, useCallback, cloneElement, useDeferredValue, Suspense, useReducer } from "react";
10
+ import React__default, { useContext, forwardRef as forwardRef$1, useRef, useMemo as useMemo$1, createContext as createContext$1, createElement, PureComponent, useEffect, useState, Children, version as version$6, isValidElement, useLayoutEffect as useLayoutEffect$1, useImperativeHandle, Component as Component$1, useCallback, cloneElement, useDeferredValue, Suspense, useReducer, useId as useId$2 } from "react";
11
11
  import { useLoaders, useCoordinationScopes, useCoordination, useDescription, useImageData, useReady, TitleInfo, useVitessceContainer, useSetWarning, useObsSetsData, useUrls, usePlotOptionsStyles, OptionsContainer, CellColorEncodingOption, OptionSelect, useComponentHover, useComponentViewInfo, useViewMapping, useSetComponentHover, useSetComponentViewInfo, useAnnotationFrameCoordination, useAnnotationEditingForView, useInitialCoordination, useDeckCanvasSize, useAnnotationStoryData, useMultiObsLabels, useObsEmbeddingData, useFeatureSelection, useObsFeatureMatrixIndices, useFeatureLabelsData, useExpandedFeatureLabelsMap, useSampleSetsData, useSampleEdgesData, useGetObsInfo, useUint8FeatureSelection, useExpressionValueGetter, useAuxiliaryCoordination, useHasLoader, useObsLocationsData, useObsLabelsData, useObsSegmentationsData, useNeighborhoodsData, useMergeCoordination, useCoordinationScopesBy, useMultiCoordinationScopesSecondaryNonNull, useMultiCoordinationScopesNonNull, useComplexCoordination, useComplexCoordinationSecondary, useGridItemSize, useMultiObsPoints, usePointMultiObsLabels, usePointMultiObsFeatureMatrixIndices, useMultiObsSpots, useSpotMultiObsSets, useSpotMultiFeatureLabels, useSpotMultiFeatureSelection, useSpotMultiObsFeatureMatrixIndices, useSegmentationMultiObsLocations, useMultiObsSegmentations, useSegmentationMultiObsSets, useSegmentationMultiFeatureSelection, useSegmentationMultiObsFeatureMatrixIndices, useMultiImages, useObsFeatureMatrixData, useUint8ObsFeatureMatrix, useGetObsMembership, PopperMenu, useComponentLayout, useClosestVitessceContainerSize, useWindowDimensions, useRemoveImageChannelInMetaCoordinationScopes, useAddImageChannelInMetaCoordinationScopes, useViewConfigStoreApi, useViewConfig, useSetViewConfig, createLoaders, useAnnotationEditingStoreShallow, useViewConfigStore, getViewCoordinationValuesForFrame, useAnnotationEditingStoreApi, useAnnotationEditingStore, getAnnotationFrameUpdate, useWarning, useGenomicProfilesData, shallowDiff, shallowDiffByChannelWithKeys, shallowDiffByLayer, shallowDiffByChannelCoordinationWithKeys, shallowDiffByChannel, shallowDiffByLayerCoordinationWithKeys, useMemoCustomComparison, useSegmentationMultiObsColors, useMatchingLoader, useColumnNameMapping, useFeatureStatsData, useObsSetStatsData, useAsyncFunction, useFeatureSetStatsData, useMultiCoordinationScopes, useComparisonMetadata, logConfig, VitSContainer } from "@vitessce/vit-s";
12
12
  import { jsx as jsx$1, jsxs, Fragment } from "react/jsx-runtime";
13
13
  import * as ReactDOM from "react-dom";
@@ -6714,6 +6714,23 @@ function sum$5(values3, valueof) {
6714
6714
  }
6715
6715
  return sum2;
6716
6716
  }
6717
+ const RESERVED_FEATURE_AGGREGATION_STRATEGIES = [
6718
+ "first",
6719
+ "last",
6720
+ "sum",
6721
+ "mean",
6722
+ "difference"
6723
+ ];
6724
+ function resolveFeatureAggregationStrategy(strategy, featureSelection) {
6725
+ if (typeof strategy === "string" && !RESERVED_FEATURE_AGGREGATION_STRATEGIES.includes(strategy)) {
6726
+ const featureIndex = featureSelection?.indexOf(strategy) ?? -1;
6727
+ return featureIndex >= 0 ? featureIndex : "first";
6728
+ }
6729
+ if (typeof strategy === "number" && Array.isArray(featureSelection) && (strategy < 0 || strategy >= featureSelection.length)) {
6730
+ return "first";
6731
+ }
6732
+ return strategy ?? null;
6733
+ }
6717
6734
  function aggregateFeatureArrays(arrays, strategy) {
6718
6735
  if (!arrays || arrays.length === 0)
6719
6736
  return null;
@@ -9599,6 +9616,8 @@ const CoordinationType$1 = {
9599
9616
  SPATIAL_SEGMENTATION_FILLED: "spatialSegmentationFilled",
9600
9617
  SPATIAL_SEGMENTATION_STROKE_WIDTH: "spatialSegmentationStrokeWidth",
9601
9618
  SPATIAL_POINT_STROKE_WIDTH: "spatialPointStrokeWidth",
9619
+ SPATIAL_POINT_RADIUS: "spatialPointRadius",
9620
+ SPATIAL_POINT_PROJECTION_SPACING: "spatialPointProjectionSpacing",
9602
9621
  SPATIAL_CHANNEL_COLOR: "spatialChannelColor",
9603
9622
  SPATIAL_CHANNEL_VISIBLE: "spatialChannelVisible",
9604
9623
  SPATIAL_CHANNEL_OPACITY: "spatialChannelOpacity",
@@ -9615,6 +9634,12 @@ const CoordinationType$1 = {
9615
9634
  // Per-image-channel (for spatial-accelerated)
9616
9635
  SPATIAL_LOD_FACTOR: "spatialLodFactor",
9617
9636
  // LOD factor for 3D volume rendering
9637
+ SPATIAL_AXIS_LINES_VISIBLE: "spatialAxisLinesVisible",
9638
+ // axisLines' visibility in Neuroglancer View
9639
+ SPATIAL_BOUNDS_VISIBLE: "spatialBoundsVisible",
9640
+ // annotationBounds' visibility in Neuroglancer View
9641
+ SPATIAL_SCALE_BAR_VISIBLE: "spatialScaleBarVisible",
9642
+ SPATIAL_BACKGROUND_THEME: "spatialBackgroundTheme",
9618
9643
  // For clipping plane sliders
9619
9644
  SPATIAL_SLICE_X: "spatialSliceX",
9620
9645
  SPATIAL_SLICE_Y: "spatialSliceY",
@@ -9624,6 +9649,7 @@ const CoordinationType$1 = {
9624
9649
  POINT_LAYER: "pointLayer",
9625
9650
  SPATIAL_SPOT_RADIUS: "spatialSpotRadius",
9626
9651
  // In micrometers?
9652
+ SPATIAL_SPOT_SHAPE: "spatialSpotShape",
9627
9653
  SPATIAL_SPOT_FILLED: "spatialSpotFilled",
9628
9654
  SPATIAL_SPOT_STROKE_WIDTH: "spatialSpotStrokeWidth",
9629
9655
  SPATIAL_LAYER_COLOR: "spatialLayerColor",
@@ -9975,7 +10001,8 @@ const ALT_ZARR_STORE_TYPES = {
9975
10001
  CoordinationType$1.SPATIAL_ORBIT_AXIS,
9976
10002
  CoordinationType$1.FEATURE_AGGREGATION_STRATEGY,
9977
10003
  // Annotation shapes are specific to a view's coordinate system.
9978
- CoordinationType$1.ANNOTATION_SHAPES
10004
+ CoordinationType$1.ANNOTATION_SHAPES,
10005
+ CoordinationType$1.SPATIAL_BACKGROUND_THEME
9979
10006
  ];
9980
10007
  const COMPONENT_COORDINATION_TYPES = {
9981
10008
  [ViewType$1.NEUROGLANCER]: [
@@ -10026,7 +10053,13 @@ const COMPONENT_COORDINATION_TYPES = {
10026
10053
  CoordinationType$1.SPATIAL_CHANNEL_OPACITY,
10027
10054
  CoordinationType$1.SPATIAL_CHANNEL_VISIBLE,
10028
10055
  CoordinationType$1.LEGEND_VISIBLE,
10029
- CoordinationType$1.SPATIAL_POINT_STROKE_WIDTH
10056
+ CoordinationType$1.SPATIAL_POINT_STROKE_WIDTH,
10057
+ CoordinationType$1.SPATIAL_POINT_RADIUS,
10058
+ CoordinationType$1.SPATIAL_AXIS_LINES_VISIBLE,
10059
+ CoordinationType$1.SPATIAL_BOUNDS_VISIBLE,
10060
+ CoordinationType$1.SPATIAL_POINT_PROJECTION_SPACING,
10061
+ CoordinationType$1.SPATIAL_SCALE_BAR_VISIBLE,
10062
+ CoordinationType$1.SPATIAL_BACKGROUND_THEME
10030
10063
  ],
10031
10064
  [ViewType$1.SCATTERPLOT]: [
10032
10065
  CoordinationType$1.DATASET,
@@ -10275,6 +10308,7 @@ const COMPONENT_COORDINATION_TYPES = {
10275
10308
  CoordinationType$1.SPOT_LAYER,
10276
10309
  CoordinationType$1.POINT_LAYER,
10277
10310
  CoordinationType$1.SPATIAL_SPOT_RADIUS,
10311
+ CoordinationType$1.SPATIAL_SPOT_SHAPE,
10278
10312
  CoordinationType$1.SPATIAL_SPOT_FILLED,
10279
10313
  CoordinationType$1.SPATIAL_SPOT_STROKE_WIDTH,
10280
10314
  CoordinationType$1.SPATIAL_LAYER_COLOR,
@@ -10292,7 +10326,10 @@ const COMPONENT_COORDINATION_TYPES = {
10292
10326
  CoordinationType$1.ANNOTATION_OVERLAY_VISIBLE,
10293
10327
  CoordinationType$1.ANNOTATION_TRANSITION_DURATION,
10294
10328
  CoordinationType$1.ANNOTATION_EDITABLE,
10295
- CoordinationType$1.ANNOTATION_SEMANTIC_ZOOM
10329
+ CoordinationType$1.ANNOTATION_SEMANTIC_ZOOM,
10330
+ CoordinationType$1.SPATIAL_POINT_RADIUS,
10331
+ CoordinationType$1.SPATIAL_POINT_STROKE_WIDTH,
10332
+ CoordinationType$1.SPATIAL_BACKGROUND_THEME
10296
10333
  ],
10297
10334
  [ViewType$1.ANNOTATION_CONTROLLER]: [
10298
10335
  CoordinationType$1.DATASET,
@@ -10457,6 +10494,7 @@ const COMPONENT_COORDINATION_TYPES = {
10457
10494
  CoordinationType$1.SPATIAL_SEGMENTATION_FILLED,
10458
10495
  CoordinationType$1.SPATIAL_SEGMENTATION_STROKE_WIDTH,
10459
10496
  CoordinationType$1.SPATIAL_POINT_STROKE_WIDTH,
10497
+ CoordinationType$1.SPATIAL_POINT_RADIUS,
10460
10498
  CoordinationType$1.IMAGE_CHANNEL,
10461
10499
  CoordinationType$1.IMAGE_LAYER,
10462
10500
  CoordinationType$1.SEGMENTATION_CHANNEL,
@@ -10475,6 +10513,7 @@ const COMPONENT_COORDINATION_TYPES = {
10475
10513
  CoordinationType$1.SPOT_LAYER,
10476
10514
  CoordinationType$1.POINT_LAYER,
10477
10515
  CoordinationType$1.SPATIAL_SPOT_RADIUS,
10516
+ CoordinationType$1.SPATIAL_SPOT_SHAPE,
10478
10517
  CoordinationType$1.SPATIAL_SPOT_FILLED,
10479
10518
  CoordinationType$1.SPATIAL_SPOT_STROKE_WIDTH,
10480
10519
  CoordinationType$1.SPATIAL_LAYER_COLOR,
@@ -94124,27 +94163,9 @@ function stratifyArrays(sampleEdges, sampleSets, sampleSetSelection, obsIndex, m
94124
94163
  if (arrKey !== "featureValue") {
94125
94164
  return (i2) => arr[i2];
94126
94165
  }
94127
- if (featureAggregationStrategy === "first") {
94166
+ {
94128
94167
  return (i2) => arr[0][i2];
94129
94168
  }
94130
- if (featureAggregationStrategy === "last") {
94131
- return (i2) => arr[arr.length - 1][i2];
94132
- }
94133
- if (typeof featureAggregationStrategy === "number") {
94134
- const j = featureAggregationStrategy;
94135
- return (i2) => arr[j][i2];
94136
- }
94137
- if (featureAggregationStrategy === "sum" || featureAggregationStrategy === "mean") {
94138
- const divisor = featureAggregationStrategy === "mean" ? arr.length : 1;
94139
- return (i2) => {
94140
- let sum2 = 0;
94141
- for (let h2 = 0; h2 < arr.length; h2 += 1) {
94142
- sum2 += arr[h2][i2];
94143
- }
94144
- return sum2 / divisor;
94145
- };
94146
- }
94147
- return () => void 0;
94148
94169
  });
94149
94170
  const groupArrays = new Array(numGroups);
94150
94171
  for (let g2 = 0; g2 < numGroups; g2 += 1) {
@@ -189747,7 +189768,7 @@ function requireBignumber() {
189747
189768
  (function(globalObject) {
189748
189769
  var BigNumber2, isNumeric2 = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, mathceil2 = Math.ceil, mathfloor2 = Math.floor, bignumberError2 = "[BigNumber Error] ", tooManyDigits2 = bignumberError2 + "Number primitive has more than 15 significant digits: ", BASE2 = 1e14, LOG_BASE2 = 14, MAX_SAFE_INTEGER2 = 9007199254740991, POWS_TEN2 = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], SQRT_BASE2 = 1e7, MAX2 = 1e9;
189749
189770
  function clone2(configObject) {
189750
- var div2, convertBase2, parseNumeric, P2 = BigNumber3.prototype = { constructor: BigNumber3, toString: null, valueOf: null }, ONE = new BigNumber3(1), DECIMAL_PLACES = 20, ROUNDING_MODE = 4, TO_EXP_NEG = -7, TO_EXP_POS = 21, MIN_EXP = -1e7, MAX_EXP = 1e7, CRYPTO = false, MODULO_MODE = 1, POW_PRECISION = 0, FORMAT = {
189771
+ var div2, convertBase2, parseNumeric, P2 = BigNumber3.prototype = { constructor: BigNumber3, toString: null, valueOf: null }, ONE = new BigNumber3(1), DECIMAL_PLACES = 20, ROUNDING_MODE = 4, TO_EXP_NEG = -7, TO_EXP_POS = 21, MIN_EXP2 = -1e7, MAX_EXP2 = 1e7, CRYPTO = false, MODULO_MODE = 1, POW_PRECISION = 0, FORMAT = {
189751
189772
  prefix: "",
189752
189773
  groupSize: 3,
189753
189774
  secondaryGroupSize: 0,
@@ -189764,9 +189785,9 @@ function requireBignumber() {
189764
189785
  if (b2 == null) {
189765
189786
  if (v && v._isBigNumber === true) {
189766
189787
  x2.s = v.s;
189767
- if (!v.c || v.e > MAX_EXP) {
189788
+ if (!v.c || v.e > MAX_EXP2) {
189768
189789
  x2.c = x2.e = null;
189769
- } else if (v.e < MIN_EXP) {
189790
+ } else if (v.e < MIN_EXP2) {
189770
189791
  x2.c = [x2.e = 0];
189771
189792
  } else {
189772
189793
  x2.e = v.e;
@@ -189778,7 +189799,7 @@ function requireBignumber() {
189778
189799
  x2.s = 1 / v < 0 ? (v = -v, -1) : 1;
189779
189800
  if (v === ~~v) {
189780
189801
  for (e3 = 0, i2 = v; i2 >= 10; i2 /= 10, e3++) ;
189781
- if (e3 > MAX_EXP) {
189802
+ if (e3 > MAX_EXP2) {
189782
189803
  x2.c = x2.e = null;
189783
189804
  } else {
189784
189805
  x2.e = e3;
@@ -189847,9 +189868,9 @@ function requireBignumber() {
189847
189868
  if (isNum && BigNumber3.DEBUG && len2 > 15 && (v > MAX_SAFE_INTEGER2 || v !== mathfloor2(v))) {
189848
189869
  throw Error(tooManyDigits2 + x2.s * v);
189849
189870
  }
189850
- if ((e3 = e3 - i2 - 1) > MAX_EXP) {
189871
+ if ((e3 = e3 - i2 - 1) > MAX_EXP2) {
189851
189872
  x2.c = x2.e = null;
189852
- } else if (e3 < MIN_EXP) {
189873
+ } else if (e3 < MIN_EXP2) {
189853
189874
  x2.c = [x2.e = 0];
189854
189875
  } else {
189855
189876
  x2.e = e3;
@@ -189914,12 +189935,12 @@ function requireBignumber() {
189914
189935
  if (v && v.pop) {
189915
189936
  intCheck2(v[0], -MAX2, -1, p);
189916
189937
  intCheck2(v[1], 1, MAX2, p);
189917
- MIN_EXP = v[0];
189918
- MAX_EXP = v[1];
189938
+ MIN_EXP2 = v[0];
189939
+ MAX_EXP2 = v[1];
189919
189940
  } else {
189920
189941
  intCheck2(v, -MAX2, MAX2, p);
189921
189942
  if (v) {
189922
- MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);
189943
+ MIN_EXP2 = -(MAX_EXP2 = v < 0 ? -v : v);
189923
189944
  } else {
189924
189945
  throw Error(bignumberError2 + p + " cannot be zero: " + v);
189925
189946
  }
@@ -189974,7 +189995,7 @@ function requireBignumber() {
189974
189995
  DECIMAL_PLACES,
189975
189996
  ROUNDING_MODE,
189976
189997
  EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],
189977
- RANGE: [MIN_EXP, MAX_EXP],
189998
+ RANGE: [MIN_EXP2, MAX_EXP2],
189978
189999
  CRYPTO,
189979
190000
  MODULO_MODE,
189980
190001
  POW_PRECISION,
@@ -190351,9 +190372,9 @@ function requireBignumber() {
190351
190372
  var i2 = 1, j = c2.length;
190352
190373
  for (; !c2[--j]; c2.pop()) ;
190353
190374
  for (j = c2[0]; j >= 10; j /= 10, i2++) ;
190354
- if ((e3 = i2 + e3 * LOG_BASE2 - 1) > MAX_EXP) {
190375
+ if ((e3 = i2 + e3 * LOG_BASE2 - 1) > MAX_EXP2) {
190355
190376
  n3.c = n3.e = null;
190356
- } else if (e3 < MIN_EXP) {
190377
+ } else if (e3 < MIN_EXP2) {
190357
190378
  n3.c = [n3.e = 0];
190358
190379
  } else {
190359
190380
  n3.e = e3;
@@ -190465,9 +190486,9 @@ function requireBignumber() {
190465
190486
  }
190466
190487
  for (i2 = xc.length; xc[--i2] === 0; xc.pop()) ;
190467
190488
  }
190468
- if (x2.e > MAX_EXP) {
190489
+ if (x2.e > MAX_EXP2) {
190469
190490
  x2.c = x2.e = null;
190470
- } else if (x2.e < MIN_EXP) {
190491
+ } else if (x2.e < MIN_EXP2) {
190471
190492
  x2.c = [x2.e = 0];
190472
190493
  }
190473
190494
  }
@@ -190952,8 +190973,8 @@ function requireBignumber() {
190952
190973
  e3 = d.e = s2.length - x2.e - 1;
190953
190974
  d.c[0] = POWS_TEN2[(exp2 = e3 % LOG_BASE2) < 0 ? LOG_BASE2 + exp2 : exp2];
190954
190975
  md2 = !md2 || n3.comparedTo(d) > 0 ? e3 > 0 ? d : n12 : n3;
190955
- exp2 = MAX_EXP;
190956
- MAX_EXP = 1 / 0;
190976
+ exp2 = MAX_EXP2;
190977
+ MAX_EXP2 = 1 / 0;
190957
190978
  n3 = new BigNumber3(s2);
190958
190979
  n0.c[0] = 0;
190959
190980
  for (; ; ) {
@@ -190975,7 +190996,7 @@ function requireBignumber() {
190975
190996
  r3 = div2(n12, d1, e3, ROUNDING_MODE).minus(x2).abs().comparedTo(
190976
190997
  div2(n0, d0, e3, ROUNDING_MODE).minus(x2).abs()
190977
190998
  ) < 1 ? [n12, d1] : [n0, d0];
190978
- MAX_EXP = exp2;
190999
+ MAX_EXP2 = exp2;
190979
191000
  return r3;
190980
191001
  };
190981
191002
  P2.toNumber = function() {
@@ -210925,22 +210946,22 @@ async function getDecoder(fileDirectory) {
210925
210946
  const Decoder = await importFn();
210926
210947
  return new Decoder(fileDirectory);
210927
210948
  }
210928
- addDecoder([void 0, 1], () => import("./raw-CEMGBBAD.js").then((m2) => m2.default));
210929
- addDecoder(5, () => import("./lzw-DBPKnFIn.js").then((m2) => m2.default));
210949
+ addDecoder([void 0, 1], () => import("./raw-Bi4zouCM.js").then((m2) => m2.default));
210950
+ addDecoder(5, () => import("./lzw-BhiKtyvb.js").then((m2) => m2.default));
210930
210951
  addDecoder(6, () => {
210931
210952
  throw new Error("old style JPEG compression is not supported.");
210932
210953
  });
210933
- addDecoder(7, () => import("./jpeg-DmU-OL1-.js").then((m2) => m2.default));
210934
- addDecoder([8, 32946], () => import("./deflate-fHER2jFf.js").then((m2) => m2.default));
210935
- addDecoder(32773, () => import("./packbits-hvcFV7pJ.js").then((m2) => m2.default));
210954
+ addDecoder(7, () => import("./jpeg--u-M0g9b.js").then((m2) => m2.default));
210955
+ addDecoder([8, 32946], () => import("./deflate-Dw6ATHuZ.js").then((m2) => m2.default));
210956
+ addDecoder(32773, () => import("./packbits-BJuD6cdw.js").then((m2) => m2.default));
210936
210957
  addDecoder(
210937
210958
  34887,
210938
- () => import("./lerc-BVAXzWm2.js").then(async (m2) => {
210959
+ () => import("./lerc-7EC7_2zX.js").then(async (m2) => {
210939
210960
  await m2.zstd.init();
210940
210961
  return m2;
210941
210962
  }).then((m2) => m2.default)
210942
210963
  );
210943
- addDecoder(50001, () => import("./webimage-Bgcea_jr.js").then((m2) => m2.default));
210964
+ addDecoder(50001, () => import("./webimage-BEdUDFND.js").then((m2) => m2.default));
210944
210965
  function copyNewSize(array2, width2, height2, samplesPerPixel = 1) {
210945
210966
  return new (Object.getPrototypeOf(array2)).constructor(width2 * height2 * samplesPerPixel);
210946
210967
  }
@@ -221367,14 +221388,14 @@ vec4 colormap(float intensity) {
221367
221388
  }
221368
221389
  };
221369
221390
  }
221370
- const defaultProps$4$1 = {
221391
+ const defaultProps$4$2 = {
221371
221392
  colormap: { type: "string", value: "viridis", compare: true },
221372
221393
  opacity: { type: "number", value: 1, compare: true },
221373
221394
  useTransparentColor: { type: "boolean", value: false, compare: true }
221374
221395
  };
221375
221396
  const AdditiveColormapExtension = class extends LayerExtension {
221376
221397
  getShaders() {
221377
- const name2 = this?.props?.colormap || defaultProps$4$1.colormap.value;
221398
+ const name2 = this?.props?.colormap || defaultProps$4$2.colormap.value;
221378
221399
  const apply_cmap = cmaps[name2];
221379
221400
  if (!apply_cmap) {
221380
221401
  throw Error(`No colormap named ${name2} found in registry`);
@@ -221393,8 +221414,8 @@ const AdditiveColormapExtension = class extends LayerExtension {
221393
221414
  }
221394
221415
  draw() {
221395
221416
  const {
221396
- useTransparentColor = defaultProps$4$1.useTransparentColor.value,
221397
- opacity: opacity2 = defaultProps$4$1.opacity.value
221417
+ useTransparentColor = defaultProps$4$2.useTransparentColor.value,
221418
+ opacity: opacity2 = defaultProps$4$2.opacity.value
221398
221419
  } = this.props;
221399
221420
  const uniforms = {
221400
221421
  opacity: opacity2,
@@ -221404,7 +221425,7 @@ const AdditiveColormapExtension = class extends LayerExtension {
221404
221425
  }
221405
221426
  };
221406
221427
  AdditiveColormapExtension.extensionName = "AdditiveColormapExtension";
221407
- AdditiveColormapExtension.defaultProps = defaultProps$4$1;
221428
+ AdditiveColormapExtension.defaultProps = defaultProps$4$2;
221408
221429
  const fs$1$2 = `uniform vec3 transparentColor;
221409
221430
  uniform bool useTransparentColor;
221410
221431
  uniform float opacity;
@@ -222704,7 +222725,7 @@ const ImageLayer = class extends CompositeLayer {
222704
222725
  };
222705
222726
  ImageLayer.layerName = "ImageLayer";
222706
222727
  ImageLayer.defaultProps = defaultProps$5;
222707
- const defaultProps$4 = {
222728
+ const defaultProps$4$1 = {
222708
222729
  pickable: { type: "boolean", value: true, compare: true },
222709
222730
  onHover: { type: "function", value: null, compare: false },
222710
222731
  contrastLimits: { type: "array", value: [], compare: true },
@@ -222816,7 +222837,7 @@ const MultiscaleImageLayer = class extends CompositeLayer {
222816
222837
  }
222817
222838
  };
222818
222839
  MultiscaleImageLayer.layerName = "MultiscaleImageLayer";
222819
- MultiscaleImageLayer.defaultProps = defaultProps$4;
222840
+ MultiscaleImageLayer.defaultProps = defaultProps$4$1;
222820
222841
  const defaultProps$3$1 = {
222821
222842
  pickable: { type: "boolean", value: true, compare: true },
222822
222843
  loader: {
@@ -223954,7 +223975,7 @@ function padWithDefault$1(arr, defaultValue2, padWidth) {
223954
223975
  }
223955
223976
  return newArr;
223956
223977
  }
223957
- const defaultProps$3 = {
223978
+ const defaultProps$4 = {
223958
223979
  hoveredCell: { type: "number", value: null, compare: true },
223959
223980
  // We do not want to deep-compare cellColorData,
223960
223981
  // as it is potentially a TypedArray with millions of elements.
@@ -224071,7 +224092,7 @@ let BitmaskLayer$1 = class BitmaskLayer extends XRLayer {
224071
224092
  }
224072
224093
  };
224073
224094
  BitmaskLayer$1.layerName = "BitmaskLayer";
224074
- BitmaskLayer$1.defaultProps = defaultProps$3;
224095
+ BitmaskLayer$1.defaultProps = defaultProps$4;
224075
224096
  const vs = `
224076
224097
  #define SHADER_NAME bitmask-layer-vertex-shader
224077
224098
 
@@ -224413,7 +224434,7 @@ function isEqualShallow(prevArr, nextArr) {
224413
224434
  }
224414
224435
  return prevArr === nextArr;
224415
224436
  }
224416
- const defaultProps$2 = {
224437
+ const defaultProps$3 = {
224417
224438
  channelStrokeWidths: { type: "array", value: null, compare: true },
224418
224439
  channelsFilled: { type: "array", value: null, compare: true },
224419
224440
  channelOpacities: { type: "array", value: null, compare: true },
@@ -224677,10 +224698,10 @@ class BitmaskLayer2 extends XRLayer {
224677
224698
  }
224678
224699
  }
224679
224700
  BitmaskLayer2.layerName = "BitmaskLayer";
224680
- BitmaskLayer2.defaultProps = defaultProps$2;
224701
+ BitmaskLayer2.defaultProps = defaultProps$3;
224681
224702
  var isNumeric$2 = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, mathceil = Math.ceil, mathfloor$1 = Math.floor, bignumberError = "[BigNumber Error] ", tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: ", BASE$1 = 1e14, LOG_BASE$1 = 14, MAX_SAFE_INTEGER$3 = 9007199254740991, POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], SQRT_BASE = 1e7, MAX$1 = 1e9;
224682
224703
  function clone$3(configObject) {
224683
- var div2, convertBase2, parseNumeric, P2 = BigNumber2.prototype = { constructor: BigNumber2, toString: null, valueOf: null }, ONE = new BigNumber2(1), DECIMAL_PLACES = 20, ROUNDING_MODE = 4, TO_EXP_NEG = -7, TO_EXP_POS = 21, MIN_EXP = -1e7, MAX_EXP = 1e7, CRYPTO = false, MODULO_MODE = 1, POW_PRECISION = 0, FORMAT = {
224704
+ var div2, convertBase2, parseNumeric, P2 = BigNumber2.prototype = { constructor: BigNumber2, toString: null, valueOf: null }, ONE = new BigNumber2(1), DECIMAL_PLACES = 20, ROUNDING_MODE = 4, TO_EXP_NEG = -7, TO_EXP_POS = 21, MIN_EXP2 = -1e7, MAX_EXP2 = 1e7, CRYPTO = false, MODULO_MODE = 1, POW_PRECISION = 0, FORMAT = {
224684
224705
  prefix: "",
224685
224706
  groupSize: 3,
224686
224707
  secondaryGroupSize: 0,
@@ -224697,9 +224718,9 @@ function clone$3(configObject) {
224697
224718
  if (b2 == null) {
224698
224719
  if (v && v._isBigNumber === true) {
224699
224720
  x2.s = v.s;
224700
- if (!v.c || v.e > MAX_EXP) {
224721
+ if (!v.c || v.e > MAX_EXP2) {
224701
224722
  x2.c = x2.e = null;
224702
- } else if (v.e < MIN_EXP) {
224723
+ } else if (v.e < MIN_EXP2) {
224703
224724
  x2.c = [x2.e = 0];
224704
224725
  } else {
224705
224726
  x2.e = v.e;
@@ -224711,7 +224732,7 @@ function clone$3(configObject) {
224711
224732
  x2.s = 1 / v < 0 ? (v = -v, -1) : 1;
224712
224733
  if (v === ~~v) {
224713
224734
  for (e3 = 0, i2 = v; i2 >= 10; i2 /= 10, e3++) ;
224714
- if (e3 > MAX_EXP) {
224735
+ if (e3 > MAX_EXP2) {
224715
224736
  x2.c = x2.e = null;
224716
224737
  } else {
224717
224738
  x2.e = e3;
@@ -224780,9 +224801,9 @@ function clone$3(configObject) {
224780
224801
  if (isNum && BigNumber2.DEBUG && len2 > 15 && (v > MAX_SAFE_INTEGER$3 || v !== mathfloor$1(v))) {
224781
224802
  throw Error(tooManyDigits + x2.s * v);
224782
224803
  }
224783
- if ((e3 = e3 - i2 - 1) > MAX_EXP) {
224804
+ if ((e3 = e3 - i2 - 1) > MAX_EXP2) {
224784
224805
  x2.c = x2.e = null;
224785
- } else if (e3 < MIN_EXP) {
224806
+ } else if (e3 < MIN_EXP2) {
224786
224807
  x2.c = [x2.e = 0];
224787
224808
  } else {
224788
224809
  x2.e = e3;
@@ -224847,12 +224868,12 @@ function clone$3(configObject) {
224847
224868
  if (v && v.pop) {
224848
224869
  intCheck(v[0], -MAX$1, -1, p);
224849
224870
  intCheck(v[1], 1, MAX$1, p);
224850
- MIN_EXP = v[0];
224851
- MAX_EXP = v[1];
224871
+ MIN_EXP2 = v[0];
224872
+ MAX_EXP2 = v[1];
224852
224873
  } else {
224853
224874
  intCheck(v, -MAX$1, MAX$1, p);
224854
224875
  if (v) {
224855
- MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);
224876
+ MIN_EXP2 = -(MAX_EXP2 = v < 0 ? -v : v);
224856
224877
  } else {
224857
224878
  throw Error(bignumberError + p + " cannot be zero: " + v);
224858
224879
  }
@@ -224907,7 +224928,7 @@ function clone$3(configObject) {
224907
224928
  DECIMAL_PLACES,
224908
224929
  ROUNDING_MODE,
224909
224930
  EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],
224910
- RANGE: [MIN_EXP, MAX_EXP],
224931
+ RANGE: [MIN_EXP2, MAX_EXP2],
224911
224932
  CRYPTO,
224912
224933
  MODULO_MODE,
224913
224934
  POW_PRECISION,
@@ -225284,9 +225305,9 @@ function clone$3(configObject) {
225284
225305
  var i2 = 1, j = c2.length;
225285
225306
  for (; !c2[--j]; c2.pop()) ;
225286
225307
  for (j = c2[0]; j >= 10; j /= 10, i2++) ;
225287
- if ((e3 = i2 + e3 * LOG_BASE$1 - 1) > MAX_EXP) {
225308
+ if ((e3 = i2 + e3 * LOG_BASE$1 - 1) > MAX_EXP2) {
225288
225309
  n3.c = n3.e = null;
225289
- } else if (e3 < MIN_EXP) {
225310
+ } else if (e3 < MIN_EXP2) {
225290
225311
  n3.c = [n3.e = 0];
225291
225312
  } else {
225292
225313
  n3.e = e3;
@@ -225398,9 +225419,9 @@ function clone$3(configObject) {
225398
225419
  }
225399
225420
  for (i2 = xc.length; xc[--i2] === 0; xc.pop()) ;
225400
225421
  }
225401
- if (x2.e > MAX_EXP) {
225422
+ if (x2.e > MAX_EXP2) {
225402
225423
  x2.c = x2.e = null;
225403
- } else if (x2.e < MIN_EXP) {
225424
+ } else if (x2.e < MIN_EXP2) {
225404
225425
  x2.c = [x2.e = 0];
225405
225426
  }
225406
225427
  }
@@ -225885,8 +225906,8 @@ function clone$3(configObject) {
225885
225906
  e3 = d.e = s2.length - x2.e - 1;
225886
225907
  d.c[0] = POWS_TEN[(exp2 = e3 % LOG_BASE$1) < 0 ? LOG_BASE$1 + exp2 : exp2];
225887
225908
  md2 = !md2 || n3.comparedTo(d) > 0 ? e3 > 0 ? d : n12 : n3;
225888
- exp2 = MAX_EXP;
225889
- MAX_EXP = 1 / 0;
225909
+ exp2 = MAX_EXP2;
225910
+ MAX_EXP2 = 1 / 0;
225890
225911
  n3 = new BigNumber2(s2);
225891
225912
  n0.c[0] = 0;
225892
225913
  for (; ; ) {
@@ -225908,7 +225929,7 @@ function clone$3(configObject) {
225908
225929
  r3 = div2(n12, d1, e3, ROUNDING_MODE).minus(x2).abs().comparedTo(
225909
225930
  div2(n0, d0, e3, ROUNDING_MODE).minus(x2).abs()
225910
225931
  ) < 1 ? [n12, d1] : [n0, d0];
225911
- MAX_EXP = exp2;
225932
+ MAX_EXP2 = exp2;
225912
225933
  return r3;
225913
225934
  };
225914
225935
  P2.toNumber = function() {
@@ -227633,7 +227654,7 @@ function distance(from2, to, options = {}) {
227633
227654
  );
227634
227655
  }
227635
227656
  const DEFAULT_THRESHOLD = 1;
227636
- const defaultProps$1 = {
227657
+ const defaultProps$2 = {
227637
227658
  // for text
227638
227659
  obsSetPath: { type: "object" },
227639
227660
  sampleSetPath: { type: "object" },
@@ -227807,7 +227828,7 @@ class ContourLayerWithText extends ContourLayer {
227807
227828
  }
227808
227829
  }
227809
227830
  ContourLayerWithText.layerName = "ContourLayerWithText";
227810
- ContourLayerWithText.defaultProps = defaultProps$1;
227831
+ ContourLayerWithText.defaultProps = defaultProps$2;
227811
227832
  const deck = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
227812
227833
  __proto__: null,
227813
227834
  COORDINATE_SYSTEM,
@@ -228834,7 +228855,7 @@ function createAnnotationLayers(shapes = [], zoom2 = 0, selectedShapeUid = null,
228834
228855
  });
228835
228856
  return [...selectionLayers, ...layers, ...measureLayers];
228836
228857
  }
228837
- const defaultProps = {
228858
+ const defaultProps$1 = {
228838
228859
  // Array of annotation shape objects (see annotationShapeObj in @vitessce/schemas).
228839
228860
  data: { type: "object", value: [], compare: true },
228840
228861
  // UID of the shape to highlight with a selection halo.
@@ -228893,7 +228914,122 @@ class AnnotationLayer extends CompositeLayer {
228893
228914
  }
228894
228915
  }
228895
228916
  AnnotationLayer.layerName = "AnnotationLayer";
228896
- AnnotationLayer.defaultProps = defaultProps;
228917
+ AnnotationLayer.defaultProps = defaultProps$1;
228918
+ const DIST_TO_CENTER_ORIGINAL = "float distToCenter = length(unitPosition) * outerRadiusPixels;";
228919
+ const DIST_TO_CENTER_REPLACEMENT = `float distToCenter = (
228920
+ uIsSquare
228921
+ ? max(abs(unitPosition.x), abs(unitPosition.y))
228922
+ : length(unitPosition)
228923
+ ) * outerRadiusPixels;`;
228924
+ const defaultProps = {
228925
+ spotShape: { type: "string", value: "circle", compare: true }
228926
+ };
228927
+ class SpotLayer extends ScatterplotLayer {
228928
+ getShaders() {
228929
+ const shaders = super.getShaders();
228930
+ if (!shaders.fs.includes(DIST_TO_CENTER_ORIGINAL)) {
228931
+ log$b.warn("SpotLayer: unable to modify ScatterplotLayer fragment shader; spots will be rendered as circles.");
228932
+ return shaders;
228933
+ }
228934
+ return {
228935
+ ...shaders,
228936
+ fs: shaders.fs.replace("uniform bool antialiasing;", "uniform bool antialiasing;\nuniform bool uIsSquare;").replace(DIST_TO_CENTER_ORIGINAL, DIST_TO_CENTER_REPLACEMENT)
228937
+ };
228938
+ }
228939
+ draw(opts2) {
228940
+ const { spotShape } = this.props;
228941
+ super.draw({
228942
+ ...opts2,
228943
+ uniforms: {
228944
+ ...opts2.uniforms,
228945
+ uIsSquare: spotShape === "square"
228946
+ }
228947
+ });
228948
+ }
228949
+ }
228950
+ SpotLayer.layerName = "SpotLayer";
228951
+ SpotLayer.defaultProps = defaultProps;
228952
+ const useStyles$v = makeStyles()(() => ({
228953
+ toolButton: {
228954
+ display: "inline-flex",
228955
+ "&:active": {
228956
+ opacity: ".65",
228957
+ extend: "iconClicked"
228958
+ }
228959
+ },
228960
+ tool: {
228961
+ position: "absolute",
228962
+ display: "inline",
228963
+ zIndex: "1000",
228964
+ opacity: ".65",
228965
+ color: "black",
228966
+ "&:hover": {
228967
+ opacity: ".90"
228968
+ }
228969
+ },
228970
+ iconClicked: {
228971
+ // Styles for the clicked state
228972
+ boxShadow: "none",
228973
+ transform: "scale(0.98)"
228974
+ // make the button slightly smaller
228975
+ },
228976
+ toolIcon: {
228977
+ // btn btn-outline-secondary mr-2 icon
228978
+ padding: "0",
228979
+ height: "2em",
228980
+ width: "2em",
228981
+ backgroundColor: "white",
228982
+ display: "inline-block",
228983
+ fontWeight: "400",
228984
+ textAlign: "center",
228985
+ verticalAlign: "middle",
228986
+ cursor: "pointer",
228987
+ userSelect: "none",
228988
+ border: "1px solid #6c757d",
228989
+ fontSize: "16px",
228990
+ lineHeight: "1.5",
228991
+ borderRadius: "4px",
228992
+ transition: "color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out",
228993
+ color: "#6c757d",
228994
+ marginRight: "8px",
228995
+ "& > svg": {
228996
+ verticalAlign: "middle",
228997
+ display: "inline-block",
228998
+ color: "black"
228999
+ },
229000
+ "&:active": {
229001
+ extend: "iconClicked"
229002
+ }
229003
+ },
229004
+ toolActive: {
229005
+ // active
229006
+ color: "#fff",
229007
+ backgroundColor: "#6c757d",
229008
+ borderColor: "#6c757d",
229009
+ boxShadow: "0 0 0 3px rgba(108, 117, 125, 0.5)"
229010
+ }
229011
+ }));
229012
+ function IconTool(props) {
229013
+ const { alt, onClick, isActive: isActive2, children: children3 } = props;
229014
+ const { classes: classes2 } = useStyles$v();
229015
+ return jsx$1("button", { className: clsx(classes2.toolIcon, { [classes2.toolActive]: isActive2 }), onClick, type: "button", title: alt, children: children3 });
229016
+ }
229017
+ function IconButton(props) {
229018
+ const { alt, onClick, children: children3 } = props;
229019
+ const { classes: classes2 } = useStyles$v();
229020
+ return jsx$1("button", { className: clsx(classes2.toolIcon, classes2.toolButton), onClick, type: "button", title: alt, children: children3 });
229021
+ }
229022
+ function ToolMenu(props) {
229023
+ const pointerIconAltText = "Pointer tool";
229024
+ const lassoIconAltText = "Select lasso";
229025
+ const { setActiveTool, activeTool, visibleTools = { pan: true, selectLasso: true, recenter: true }, recenterOnClick = () => {
229026
+ } } = props;
229027
+ const { classes: classes2 } = useStyles$v();
229028
+ const onRecenterButtonCLick = () => {
229029
+ recenterOnClick();
229030
+ };
229031
+ return jsxs("div", { className: classes2.tool, children: [visibleTools.pan && jsx$1(IconTool, { alt: pointerIconAltText, onClick: () => setActiveTool(null), isActive: activeTool === null, children: jsx$1(SvgNearMe, {}) }), visibleTools.selectLasso ? jsx$1(IconTool, { alt: lassoIconAltText, onClick: () => setActiveTool(distEs6Exports$2.SELECTION_TYPE.POLYGON), isActive: activeTool === distEs6Exports$2.SELECTION_TYPE.POLYGON, children: jsx$1(SvgSelectionLasso, {}) }) : null, visibleTools.recenter ? jsx$1(IconButton, { alt: "click to recenter", onClick: () => onRecenterButtonCLick(), "aria-label": "Recenter scatterplot view", children: jsx$1(CenterFocusStrong, {}) }) : null] });
229032
+ }
228897
229033
  const MOUSE = { ROTATE: 0, DOLLY: 1, PAN: 2 };
228898
229034
  const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
228899
229035
  const WebGLCoordinateSystem = 2e3;
@@ -233243,87 +233379,6 @@ class RawView extends View$2 {
233243
233379
  return OrbitController2;
233244
233380
  }
233245
233381
  }
233246
- const useStyles$v = makeStyles()(() => ({
233247
- toolButton: {
233248
- display: "inline-flex",
233249
- "&:active": {
233250
- opacity: ".65",
233251
- extend: "iconClicked"
233252
- }
233253
- },
233254
- tool: {
233255
- position: "absolute",
233256
- display: "inline",
233257
- zIndex: "1000",
233258
- opacity: ".65",
233259
- color: "black",
233260
- "&:hover": {
233261
- opacity: ".90"
233262
- }
233263
- },
233264
- iconClicked: {
233265
- // Styles for the clicked state
233266
- boxShadow: "none",
233267
- transform: "scale(0.98)"
233268
- // make the button slightly smaller
233269
- },
233270
- toolIcon: {
233271
- // btn btn-outline-secondary mr-2 icon
233272
- padding: "0",
233273
- height: "2em",
233274
- width: "2em",
233275
- backgroundColor: "white",
233276
- display: "inline-block",
233277
- fontWeight: "400",
233278
- textAlign: "center",
233279
- verticalAlign: "middle",
233280
- cursor: "pointer",
233281
- userSelect: "none",
233282
- border: "1px solid #6c757d",
233283
- fontSize: "16px",
233284
- lineHeight: "1.5",
233285
- borderRadius: "4px",
233286
- transition: "color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out",
233287
- color: "#6c757d",
233288
- marginRight: "8px",
233289
- "& > svg": {
233290
- verticalAlign: "middle",
233291
- display: "inline-block",
233292
- color: "black"
233293
- },
233294
- "&:active": {
233295
- extend: "iconClicked"
233296
- }
233297
- },
233298
- toolActive: {
233299
- // active
233300
- color: "#fff",
233301
- backgroundColor: "#6c757d",
233302
- borderColor: "#6c757d",
233303
- boxShadow: "0 0 0 3px rgba(108, 117, 125, 0.5)"
233304
- }
233305
- }));
233306
- function IconTool(props) {
233307
- const { alt, onClick, isActive: isActive2, children: children3 } = props;
233308
- const { classes: classes2 } = useStyles$v();
233309
- return jsx$1("button", { className: clsx(classes2.toolIcon, { [classes2.toolActive]: isActive2 }), onClick, type: "button", title: alt, children: children3 });
233310
- }
233311
- function IconButton(props) {
233312
- const { alt, onClick, children: children3 } = props;
233313
- const { classes: classes2 } = useStyles$v();
233314
- return jsx$1("button", { className: clsx(classes2.toolIcon, classes2.toolButton), onClick, type: "button", title: alt, children: children3 });
233315
- }
233316
- function ToolMenu(props) {
233317
- const pointerIconAltText = "Pointer tool";
233318
- const lassoIconAltText = "Select lasso";
233319
- const { setActiveTool, activeTool, visibleTools = { pan: true, selectLasso: true, recenter: true }, recenterOnClick = () => {
233320
- } } = props;
233321
- const { classes: classes2 } = useStyles$v();
233322
- const onRecenterButtonCLick = () => {
233323
- recenterOnClick();
233324
- };
233325
- return jsxs("div", { className: classes2.tool, children: [visibleTools.pan && jsx$1(IconTool, { alt: pointerIconAltText, onClick: () => setActiveTool(null), isActive: activeTool === null, children: jsx$1(SvgNearMe, {}) }), visibleTools.selectLasso ? jsx$1(IconTool, { alt: lassoIconAltText, onClick: () => setActiveTool(distEs6Exports$2.SELECTION_TYPE.POLYGON), isActive: activeTool === distEs6Exports$2.SELECTION_TYPE.POLYGON, children: jsx$1(SvgSelectionLasso, {}) }) : null, visibleTools.recenter ? jsx$1(IconButton, { alt: "click to recenter", onClick: () => onRecenterButtonCLick(), "aria-label": "Recenter scatterplot view", children: jsx$1(CenterFocusStrong, {}) }) : null] });
233326
- }
233327
233382
  const getCursorWithTool = () => "crosshair";
233328
233383
  const getCursor = (interactionState) => interactionState.isDragging ? "grabbing" : "grab";
233329
233384
  function getOnHoverCallback(obsIndex, setObsHighlight, setComponentHover) {
@@ -238960,7 +239015,7 @@ function Legend(props) {
238960
239015
  spatialLayerColor,
238961
239016
  obsSetSelection,
238962
239017
  obsSetColor,
238963
- featureAggregationStrategy,
239018
+ featureAggregationStrategy: featureAggregationStrategyProp,
238964
239019
  extent: extent2,
238965
239020
  missing,
238966
239021
  width: width2 = 100,
@@ -238974,6 +239029,7 @@ function Legend(props) {
238974
239029
  contourPercentiles,
238975
239030
  contourThresholds
238976
239031
  } = props;
239032
+ const featureAggregationStrategy = resolveFeatureAggregationStrategy(featureAggregationStrategyProp, featureSelection);
238977
239033
  const svgRef = useRef(null);
238978
239034
  const { classes: classes2 } = useStyles$s();
238979
239035
  const [localRange, setLocalRange] = useState(featureValueColormapRange);
@@ -239518,7 +239574,7 @@ function EmbeddingScatterplotSubscriber(props) {
239518
239574
  const { embeddingZoom: initialZoom, embeddingTargetX: initialTargetX, embeddingTargetY: initialTargetY } = useInitialCoordination(COMPONENT_COORDINATION_TYPES[ViewType$1.SCATTERPLOT], coordinationScopes, coordinationValues);
239519
239575
  const observationsLabel = observationsLabelOverride || obsType;
239520
239576
  const sampleSetSelection = sampleSetSelectionFromProps || sampleSetSelectionFromCoordination;
239521
- const featureAggregationStrategyToUse = featureAggregationStrategy ?? DEFAULT_FEATURE_AGGREGATION_STRATEGY$3;
239577
+ const featureAggregationStrategyToUse = resolveFeatureAggregationStrategy(featureAggregationStrategy, geneSelection) ?? DEFAULT_FEATURE_AGGREGATION_STRATEGY$3;
239522
239578
  const [width2, height2, deckRef] = useDeckCanvasSize();
239523
239579
  const title2 = titleOverride || `Scatterplot (${mapping})`;
239524
239580
  const [, annotationStoryStatus, annotationStoryUrls, annotationStoryError] = useAnnotationStoryData(loaders, dataset, false, { setAnnotationStory }, { annotationStory }, {});
@@ -239780,7 +239836,10 @@ function EmbeddingScatterplotSubscriber(props) {
239780
239836
  obsEmbeddingY: alignedEmbeddingData.data[1],
239781
239837
  ...uint8ExpressionData?.[0] ? { featureValue: uint8ExpressionData } : {}
239782
239838
  },
239783
- featureAggregationStrategyToUse,
239839
+ // The featureAggregationStrategy has already been applied above
239840
+ // (uint8ExpressionData contains a single, aggregated array),
239841
+ // so we must not apply it again here.
239842
+ "first",
239784
239843
  // Raw codes let the strata come from typed arrays when the indices match.
239785
239844
  { obsSetsColumns }
239786
239845
  );
@@ -239797,7 +239856,6 @@ function EmbeddingScatterplotSubscriber(props) {
239797
239856
  deferredSampleSetSelection,
239798
239857
  deferredCellSetSelection,
239799
239858
  mergedCellSets,
239800
- featureAggregationStrategyToUse,
239801
239859
  obsSetsColumns
239802
239860
  ]);
239803
239861
  const annotationFrameCoordinationValues = getAnnotationFrameCoordinationValues(annotationStory, annotationFrameIndex, viewUid);
@@ -260255,7 +260313,7 @@ function SpatialSubscriber$1(props) {
260255
260313
  subobservationsLabel,
260256
260314
  locationsCount
260257
260315
  });
260258
- const featureAggregationStrategyToUse = featureAggregationStrategy ?? DEFAULT_FEATURE_AGGREGATION_STRATEGY$2;
260316
+ const featureAggregationStrategyToUse = resolveFeatureAggregationStrategy(featureAggregationStrategy, geneSelection) ?? DEFAULT_FEATURE_AGGREGATION_STRATEGY$2;
260259
260317
  const aggregatedExpressionData = useMemo$1(() => {
260260
260318
  if (featureAggregationStrategyToUse != null && expressionData && expressionData.length > 1) {
260261
260319
  const aggregated = aggregateFeatureArrays(expressionData, featureAggregationStrategyToUse);
@@ -260747,10 +260805,10 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
260747
260805
  const getExpressionValue = this.spotExpressionGetters[layerScope];
260748
260806
  const obsIndex = layerObsSpots?.obsIndex;
260749
260807
  const getSpotColor = makeDefaultGetCellColors(cellColors, obsIndex, theme);
260750
- const { spatialLayerVisible, spatialLayerOpacity, spatialSpotRadius, spatialSpotFilled, spatialSpotStrokeWidth, obsColorEncoding, featureValueColormap, featureValueColormapRange, spatialLayerColor } = layerCoordination;
260808
+ const { spatialLayerVisible, spatialLayerOpacity, spatialSpotRadius, spatialSpotShape, spatialSpotFilled, spatialSpotStrokeWidth, obsColorEncoding, featureValueColormap, featureValueColormapRange, spatialLayerColor } = layerCoordination;
260751
260809
  const isStaticColor = obsColorEncoding === "spatialLayerColor";
260752
260810
  const staticColor = Array.isArray(spatialLayerColor) && spatialLayerColor.length === 3 ? spatialLayerColor : getDefaultColor(theme);
260753
- return new ScatterplotLayer({
260811
+ return new SpotLayer({
260754
260812
  id: `${SPOT_LAYER_PREFIX}${layerScope}`,
260755
260813
  data: this.obsSpotsData[layerScope],
260756
260814
  coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
@@ -260762,6 +260820,7 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
260762
260820
  getLineWidth: !spatialSpotFilled ? spatialSpotStrokeWidth : 0,
260763
260821
  visible: spatialLayerVisible,
260764
260822
  getRadius: spatialSpotRadius,
260823
+ spotShape: spatialSpotShape,
260765
260824
  getPosition: (object2, { data: data2, index: index2, target: target2 }) => {
260766
260825
  target2[0] = data2.src.obsSpots.data[0][index2];
260767
260826
  target2[1] = data2.src.obsSpots.data[1][index2];
@@ -260788,7 +260847,12 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
260788
260847
  }
260789
260848
  createPointLayer(layerScope, layerCoordination, layerObsPoints) {
260790
260849
  const { theme, delegateHover, targetZ, pointMatrixIndices, setTiledPointsLoadingProgress } = this.props;
260791
- const { spatialLayerVisible, spatialLayerOpacity, obsColorEncoding, spatialLayerColor, featureSelection, featureFilterMode, featureColor, spatialLayerOpacityUnselected } = layerCoordination;
260850
+ const { spatialLayerVisible, spatialLayerOpacity, obsColorEncoding, spatialLayerColor, featureSelection, featureFilterMode, featureColor, spatialLayerOpacityUnselected, spatialPointRadius, spatialPointStrokeWidth } = layerCoordination;
260851
+ const pointRadius = spatialPointRadius ?? 2.5;
260852
+ const pointRadiusMaxPixels = pointRadius * 0.6;
260853
+ const pointLineWidth = spatialPointStrokeWidth ?? 0;
260854
+ const pointLineColor = [0, 0, 0];
260855
+ const arePointsStroked = pointLineWidth > 0;
260792
260856
  const pointFeatureIndex = pointMatrixIndices?.[layerScope]?.featureIndex;
260793
260857
  let featureIndices = [];
260794
260858
  if (Array.isArray(featureSelection) && featureSelection.length >= 1) {
@@ -260920,6 +260984,13 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
260920
260984
  };
260921
260985
  }
260922
260986
  }
260987
+ const getLineColor = (object2, { index: index2, data: data2, target: target2 }) => {
260988
+ getFillColor(object2, { index: index2, data: data2, target: target2 });
260989
+ target2[0] = pointLineColor[0];
260990
+ target2[1] = pointLineColor[1];
260991
+ target2[2] = pointLineColor[2];
260992
+ return target2;
260993
+ };
260923
260994
  const {
260924
260995
  obsPointsModelMatrix,
260925
260996
  obsPoints,
@@ -260942,6 +261013,15 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
260942
261013
  autoHighlight: true,
260943
261014
  onHover: (info2) => delegateHover(info2, "point", layerScope),
260944
261015
  opacity: 1,
261016
+ // deck.gl's TileLayer ignores changes to `renderSubLayers` itself (it's marked
261017
+ // `compare: false` internally, since it's usually just a fresh inline function
261018
+ // every render), so simply updating pointRadius/pointLineWidth inside this
261019
+ // closure won't make the tiles re-render on their own. This key is a dummy
261020
+ // value that changes whenever the point size or stroke width changes, just so
261021
+ // TileLayer re-renders the tiles.
261022
+ // It's separate from getTileData's updateTriggers on purpose, so we don't
261023
+ // re-fetch tile data -- we only want the existing data to be redrawn.
261024
+ pointStyleKey: `${pointRadius}_${pointRadiusMaxPixels}_${pointLineWidth}`,
260945
261025
  visible: spatialLayerVisible,
260946
261026
  // Since points are tiled but not multi-resolution,
260947
261027
  // it provides no benefit to request tiles at different zoom levels.
@@ -260985,8 +261065,11 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
260985
261065
  return new ScatterplotLayer(subLayerProps, {
260986
261066
  bounds: [left2, top2, right2, bottom2],
260987
261067
  data: tileData,
260988
- getRadius: 5,
260989
- radiusMaxPixels: 3,
261068
+ getRadius: pointRadius,
261069
+ radiusMaxPixels: pointRadiusMaxPixels,
261070
+ stroked: arePointsStroked,
261071
+ getLineWidth: pointLineWidth,
261072
+ getLineColor,
260990
261073
  // getPosition: d => d,
260991
261074
  // getFillColor: [255, 0, 0],
260992
261075
  getPosition: (object2, { data: data2, index: index2, target: target2 }) => {
@@ -261065,8 +261148,11 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
261065
261148
  opacity: spatialLayerOpacity,
261066
261149
  visible: spatialLayerVisible,
261067
261150
  modelMatrix: modelMatrix2,
261068
- getRadius: 5,
261069
- radiusMaxPixels: 3,
261151
+ getRadius: pointRadius,
261152
+ radiusMaxPixels: pointRadiusMaxPixels,
261153
+ stroked: arePointsStroked,
261154
+ getLineWidth: pointLineWidth,
261155
+ getLineColor,
261070
261156
  getPosition: (object2, { data: data2, index: index2, target: target2 }) => {
261071
261157
  target2[0] = data2.src.obsPoints.data[0][index2];
261072
261158
  target2[1] = data2.src.obsPoints.data[1][index2];
@@ -261814,7 +261900,11 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
261814
261900
  super.viewInfoDidUpdate(null, null, makeDefaultGetObsCoords);
261815
261901
  }
261816
261902
  recenter() {
261817
- const { originalViewState, setViewState } = this.props;
261903
+ const { originalViewState, setViewState, onRequestCameraReset } = this.props;
261904
+ if (onRequestCameraReset) {
261905
+ onRequestCameraReset();
261906
+ return;
261907
+ }
261818
261908
  if (Array.isArray(originalViewState?.target) && typeof originalViewState?.zoom === "number") {
261819
261909
  setViewState(originalViewState);
261820
261910
  }
@@ -262023,7 +262113,7 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
262023
262113
  }
262024
262114
  }
262025
262115
  const SpatialWrapper = forwardRef$1((props, deckRef) => jsx$1(Spatial2, { ...props, deckRef }));
262026
- function TooltipChild(props) {
262116
+ function TooltipChild$1(props) {
262027
262117
  const { x: x2, y: y2, parentUuid, sourceUuid, width: width2, height: height2, info: info2, tooltipsVisible, tooltipCrosshairsVisible, featureType, featureLabelsMap } = props;
262028
262118
  const visible = parentUuid === sourceUuid ? tooltipsVisible : tooltipCrosshairsVisible;
262029
262119
  return visible ? jsx$1(Tooltip2D, { x: x2, y: y2, parentUuid, sourceUuid, parentWidth: width2, parentHeight: height2, children: jsx$1(TooltipContent, { info: info2, featureType, featureLabelsMap }) }) : null;
@@ -262042,7 +262132,7 @@ function getXY(obsHighlight, viewInfo, obsIndex, obsLocations, useHoverInfoForTo
262042
262132
  const projectedObsCoord = viewInfo?.project(obsCoord);
262043
262133
  return [projectedObsCoord?.[0], projectedObsCoord?.[1]];
262044
262134
  }
262045
- function getObsInfo(obsSetsData, obsType, obsId, obsSetSelection, tooltipObsSetsMode) {
262135
+ function getObsInfo$1(obsSetsData, obsType, obsId, obsSetSelection, tooltipObsSetsMode) {
262046
262136
  let result = {
262047
262137
  [`${capitalize$3(obsType)} ID`]: obsId
262048
262138
  };
@@ -262093,13 +262183,13 @@ function SpatialTooltipSubscriber(props) {
262093
262183
  let yOffset = -30;
262094
262184
  return jsxs(Fragment, { children: [projectedHoverCoord && imageLayerScopes?.map((layerScope) => {
262095
262185
  const { pixelHighlight, tooltipsVisible, spatialLayerVisible } = imageLayerCoordination?.[0]?.[layerScope] || {};
262096
- return tooltipsVisible && pixelHighlight && spatialLayerVisible ? jsx$1(TooltipChild, { parentUuid, sourceUuid, width: width2, height: height2, info: {
262186
+ return tooltipsVisible && pixelHighlight && spatialLayerVisible ? jsx$1(TooltipChild$1, { parentUuid, sourceUuid, width: width2, height: height2, info: {
262097
262187
  "Pixel Value": JSON.stringify(pixelHighlight)
262098
262188
  }, x: projectedHoverCoord?.[0], y: projectedHoverCoord?.[1] + (yOffset += 30), featureType, featureLabelsMap }, layerScope) : null;
262099
262189
  }), segmentationLayerScopes?.flatMap((layerScope) => segmentationChannelScopesByLayer?.[layerScope]?.map((channelScope) => {
262100
262190
  const { obsType, obsHighlight, tooltipsVisible, tooltipCrosshairsVisible, spatialChannelVisible, obsSetSelection, tooltipObsSetsMode } = segmentationChannelCoordination?.[0]?.[layerScope]?.[channelScope] || {};
262101
262191
  const obsSetsData = obsSegmentationsSetsData?.[layerScope]?.[channelScope];
262102
- const obsInfo = getObsInfo(obsSetsData, obsType, obsHighlight, obsSetSelection, tooltipObsSetsMode);
262192
+ const obsInfo = getObsInfo$1(obsSetsData, obsType, obsHighlight, obsSetSelection, tooltipObsSetsMode);
262103
262193
  if (!obsHighlight || !spatialChannelVisible || !tooltipsVisible && !tooltipCrosshairsVisible)
262104
262194
  return null;
262105
262195
  const { obsIndex, obsLocations } = obsSegmentationsLocations?.[layerScope]?.[channelScope] || {};
@@ -262107,7 +262197,7 @@ function SpatialTooltipSubscriber(props) {
262107
262197
  if (!xy)
262108
262198
  return null;
262109
262199
  const [x2, y2] = xy;
262110
- return jsx$1(TooltipChild, { parentUuid, sourceUuid, tooltipsVisible, tooltipCrosshairsVisible, width: width2, height: height2, info: obsInfo, x: x2, y: y2 + (yOffset += 20 + 15 * Object.keys(obsInfo).length), featureType, featureLabelsMap }, `${layerScope}-${channelScope}`);
262200
+ return jsx$1(TooltipChild$1, { parentUuid, sourceUuid, tooltipsVisible, tooltipCrosshairsVisible, width: width2, height: height2, info: obsInfo, x: x2, y: y2 + (yOffset += 20 + 15 * Object.keys(obsInfo).length), featureType, featureLabelsMap }, `${layerScope}-${channelScope}`);
262111
262201
  })), spotLayerScopes?.map((layerScope) => {
262112
262202
  const { obsType, obsHighlight, tooltipsVisible, tooltipCrosshairsVisible, spatialLayerVisible } = spotLayerCoordination?.[0]?.[layerScope] || {};
262113
262203
  if (!obsHighlight || !spatialLayerVisible || !tooltipsVisible && !tooltipCrosshairsVisible)
@@ -262117,7 +262207,7 @@ function SpatialTooltipSubscriber(props) {
262117
262207
  if (!xy)
262118
262208
  return null;
262119
262209
  const [x2, y2] = xy;
262120
- return jsx$1(TooltipChild, { parentUuid, sourceUuid, tooltipsVisible, tooltipCrosshairsVisible, width: width2, height: height2, info: {
262210
+ return jsx$1(TooltipChild$1, { parentUuid, sourceUuid, tooltipsVisible, tooltipCrosshairsVisible, width: width2, height: height2, info: {
262121
262211
  [`${capitalize$3(obsType)} ID`]: obsHighlight
262122
262212
  }, x: x2, y: y2 + (yOffset += 30), featureType, featureLabelsMap }, layerScope);
262123
262213
  }), pointLayerScopes?.map((layerScope) => {
@@ -262129,7 +262219,7 @@ function SpatialTooltipSubscriber(props) {
262129
262219
  if (!xy)
262130
262220
  return null;
262131
262221
  const [x2, y2] = xy;
262132
- return jsx$1(TooltipChild, { parentUuid, sourceUuid, tooltipsVisible, tooltipCrosshairsVisible, width: width2, height: height2, info: {
262222
+ return jsx$1(TooltipChild$1, { parentUuid, sourceUuid, tooltipsVisible, tooltipCrosshairsVisible, width: width2, height: height2, info: {
262133
262223
  [`${capitalize$3(obsType)} ID`]: obsHighlight
262134
262224
  }, x: x2, y: y2 + (yOffset += 30), featureType, featureLabelsMap }, layerScope);
262135
262225
  })] });
@@ -262156,12 +262246,12 @@ class ErrorBoundary extends React__default.Component {
262156
262246
  }
262157
262247
  }
262158
262248
  const LazySpatialThree = React__default.lazy(async () => {
262159
- const { SpatialWrapper: SpatialWrapper2 } = await import("./index-B_ToVxzC.js").then((n3) => n3.a);
262249
+ const { SpatialWrapper: SpatialWrapper2 } = await import("./index-4JZT6bFU.js").then((n3) => n3.a);
262160
262250
  return { default: SpatialWrapper2 };
262161
262251
  });
262162
262252
  const SpatialThreeAdapter = React__default.forwardRef((props, ref2) => jsx$1("div", { ref: ref2, style: { width: "100%", height: "100%" }, children: jsx$1(ErrorBoundary, { fallback: jsx$1("div", { children: "3D spatial view is not available in this environment." }), children: jsx$1(Suspense, { fallback: jsx$1("div", { children: "Loading..." }), children: jsx$1(LazySpatialThree, { ...props }) }) }) }));
262163
262253
  const LazySpatialAccelerated = React__default.lazy(async () => {
262164
- const { SpatialWrapper: SpatialWrapper2 } = await import("./index-CO-QVcb0.js");
262254
+ const { SpatialWrapper: SpatialWrapper2 } = await import("./index-IrX1v-qA.js");
262165
262255
  return { default: SpatialWrapper2 };
262166
262256
  });
262167
262257
  const SpatialAcceleratedAdapter = React__default.forwardRef((props, ref2) => jsx$1("div", { ref: ref2, style: { width: "100%", height: "100%" }, children: jsx$1(ErrorBoundary, { fallback: jsx$1("div", { children: "3D spatial view is not available in this environment." }), children: jsx$1(Suspense, { fallback: jsx$1("div", { children: "Loading..." }), children: jsx$1(LazySpatialAccelerated, { ...props }) }) }) }));
@@ -262174,115 +262264,120 @@ const useStyles$p = makeStyles()(() => ({
262174
262264
  }
262175
262265
  }));
262176
262266
  function SpatialOptions(props) {
262177
- const { spatialAxisFixed, setSpatialAxisFixed, use3d } = props;
262267
+ const { spatialAxisFixed, setSpatialAxisFixed, use3d, spatialBackgroundTheme, setSpatialBackgroundTheme } = props;
262178
262268
  const toggleAxisId = $bdb11010cef70236$export$f680877a34711e37();
262269
+ const backgroundId = $bdb11010cef70236$export$f680877a34711e37();
262179
262270
  const { classes: classes2 } = useStyles$p();
262180
- return jsx$1(OptionsContainer, { children: jsxs(TableRow, { children: [jsx$1(TableCell, { className: classes2.spatialBetaCameraLabel, variant: "head", scope: "row", children: jsx$1("label", { htmlFor: `spatial-camera-axis-${toggleAxisId}`, children: "Fix Camera Axis" }) }), jsx$1(TableCell, { className: classes2.spatialBetaToggleBox, variant: "body", children: jsx$1(Checkbox$1, { onClick: () => setSpatialAxisFixed(!spatialAxisFixed), disabled: !use3d, checked: Boolean(spatialAxisFixed), slotProps: { input: {
262271
+ return jsxs(OptionsContainer, { children: [jsxs(TableRow, { children: [jsx$1(TableCell, { className: classes2.spatialBetaCameraLabel, variant: "head", scope: "row", children: jsx$1("label", { htmlFor: `spatial-camera-axis-${toggleAxisId}`, children: "Fix Camera Axis" }) }), jsx$1(TableCell, { className: classes2.spatialBetaToggleBox, variant: "body", children: jsx$1(Checkbox$1, { onClick: () => setSpatialAxisFixed(!spatialAxisFixed), disabled: !use3d, checked: Boolean(spatialAxisFixed), slotProps: { input: {
262181
262272
  "aria-label": "Fix or not fix spatial camera axis",
262182
262273
  id: `spatial-camera-axis-${toggleAxisId}`
262183
- } } }) })] }) });
262274
+ } } }) })] }), jsxs(TableRow, { children: [jsx$1(TableCell, { className: classes2.spatialBetaCameraLabel, variant: "head", scope: "row", children: jsx$1("label", { htmlFor: `spatial-background-${backgroundId}`, children: "Light Background" }) }), jsx$1(TableCell, { className: classes2.spatialBetaToggleBox, variant: "body", children: jsx$1(Checkbox$1, { onClick: () => setSpatialBackgroundTheme(spatialBackgroundTheme === "light" ? "dark" : "light"), checked: spatialBackgroundTheme === "light", slotProps: { input: {
262275
+ "aria-label": "Toggle light or dark background",
262276
+ id: `spatial-background-${backgroundId}`
262277
+ } } }) })] })] });
262184
262278
  }
262185
262279
  const DEFAULT_FEATURE_AGGREGATION_STRATEGY$1 = "first";
262186
- function useAggregatedNormalizedExpressionDataForLayers({ multiExpressionData: spotMultiExpressionData, layerScopes: spotLayerScopes, layerCoordination: spotLayerCoordination }) {
262187
- const [spotMultiExpressionNormDataAggregated, spotMultiExpressionExtentsAggregated] = useMemo$1(() => {
262188
- if (!spotMultiExpressionData || !spotLayerScopes?.length || !spotLayerCoordination?.[0]) {
262189
- return [null, null];
262280
+ function isValidExpressionArray(arr) {
262281
+ return filterValidExpressionArrays([arr]).length === 1;
262282
+ }
262283
+ function getSingleFeatureIndex(strategy, numFeatures) {
262284
+ if (strategy === "first") {
262285
+ return 0;
262286
+ }
262287
+ if (strategy === "last") {
262288
+ return numFeatures - 1;
262289
+ }
262290
+ if (typeof strategy === "number") {
262291
+ return strategy >= 0 && strategy < numFeatures ? strategy : 0;
262292
+ }
262293
+ return null;
262294
+ }
262295
+ function aggregateExpressionForScope(data2, normData, extents, strategy, featureSelection) {
262296
+ if (!Array.isArray(normData) || normData.length <= 1) {
262297
+ return null;
262298
+ }
262299
+ const strategyToUse = resolveFeatureAggregationStrategy(strategy, featureSelection) ?? DEFAULT_FEATURE_AGGREGATION_STRATEGY$1;
262300
+ const featureIndex = getSingleFeatureIndex(strategyToUse, normData.length);
262301
+ if (featureIndex !== null) {
262302
+ const selectedNormData = normData[featureIndex];
262303
+ if (!isValidExpressionArray(selectedNormData)) {
262304
+ return null;
262190
262305
  }
262191
- let hasNormData = false;
262192
- let hasExtents = false;
262193
- const normDataByLayer = {};
262194
- const extentsByLayer = {};
262306
+ return {
262307
+ normData: [selectedNormData],
262308
+ extents: [extents?.[featureIndex] ?? null]
262309
+ };
262310
+ }
262311
+ if (!Array.isArray(data2) || !data2.every(isValidExpressionArray)) {
262312
+ return null;
262313
+ }
262314
+ const aggregated = aggregateFeatureArrays(data2, strategyToUse);
262315
+ const normalized = normalizeAggregatedFeatureArray(aggregated);
262316
+ if (!normalized) {
262317
+ return null;
262318
+ }
262319
+ return {
262320
+ normData: [normalized.normData],
262321
+ extents: [normalized.extent]
262322
+ };
262323
+ }
262324
+ function useAggregatedNormalizedExpressionDataForLayers({ multiExpressionData: spotMultiExpressionData, multiExpressionNormData: spotMultiExpressionNormData, multiExpressionExtents: spotMultiExpressionExtents, layerScopes: spotLayerScopes, layerCoordination: spotLayerCoordination }) {
262325
+ return useMemo$1(() => {
262326
+ if (!spotMultiExpressionNormData || !spotLayerScopes?.length || !spotLayerCoordination?.[0]) {
262327
+ return [spotMultiExpressionNormData, spotMultiExpressionExtents];
262328
+ }
262329
+ const normDataByLayer = { ...spotMultiExpressionNormData };
262330
+ const extentsByLayer = { ...spotMultiExpressionExtents };
262195
262331
  spotLayerScopes.forEach((layerScope) => {
262196
- const expressionData = spotMultiExpressionData[layerScope];
262197
- const validExpressionArrays = filterValidExpressionArrays(expressionData);
262198
- if (validExpressionArrays.length <= 1) {
262199
- return;
262200
- }
262201
- const strategy = spotLayerCoordination?.[0]?.[layerScope]?.featureAggregationStrategy ?? DEFAULT_FEATURE_AGGREGATION_STRATEGY$1;
262202
- if (strategy == null) {
262203
- return;
262204
- }
262205
- const aggregated = aggregateFeatureArrays(validExpressionArrays, strategy);
262206
- if (!aggregated) {
262207
- return;
262208
- }
262209
- const normalized = normalizeAggregatedFeatureArray(aggregated);
262210
- if (!normalized) {
262211
- return;
262332
+ const { featureAggregationStrategy, featureSelection } = spotLayerCoordination[0][layerScope] || {};
262333
+ const result = aggregateExpressionForScope(spotMultiExpressionData?.[layerScope], spotMultiExpressionNormData[layerScope], spotMultiExpressionExtents?.[layerScope], featureAggregationStrategy, featureSelection);
262334
+ if (result) {
262335
+ normDataByLayer[layerScope] = result.normData;
262336
+ extentsByLayer[layerScope] = result.extents;
262212
262337
  }
262213
- normDataByLayer[layerScope] = [normalized.normData];
262214
- extentsByLayer[layerScope] = [normalized.extent];
262215
- hasNormData = true;
262216
- hasExtents = true;
262217
262338
  });
262218
- return [
262219
- hasNormData ? normDataByLayer : null,
262220
- hasExtents ? extentsByLayer : null
262221
- ];
262222
- }, [spotMultiExpressionData, spotLayerScopes, spotLayerCoordination]);
262223
- return [
262224
- spotMultiExpressionNormDataAggregated,
262225
- spotMultiExpressionExtentsAggregated
262226
- ];
262339
+ return [normDataByLayer, extentsByLayer];
262340
+ }, [
262341
+ spotMultiExpressionData,
262342
+ spotMultiExpressionNormData,
262343
+ spotMultiExpressionExtents,
262344
+ spotLayerScopes,
262345
+ spotLayerCoordination
262346
+ ]);
262227
262347
  }
262228
- function useAggregatedNormalizedExpressionDataForChannels({ multiExpressionData: segmentationMultiExpressionData, layerScopes: segmentationLayerScopes, channelScopesByLayer: segmentationChannelScopesByLayer, channelCoordination: segmentationChannelCoordination }) {
262229
- const [segmentationMultiExpressionNormDataAggregated, segmentationMultiExpressionExtentsAggregated] = useMemo$1(() => {
262230
- if (!segmentationMultiExpressionData || !segmentationLayerScopes?.length || !segmentationChannelScopesByLayer || !segmentationChannelCoordination?.[0]) {
262231
- return [null, null];
262348
+ function useAggregatedNormalizedExpressionDataForChannels({ multiExpressionData: segmentationMultiExpressionData, multiExpressionNormData: segmentationMultiExpressionNormData, multiExpressionExtents: segmentationMultiExpressionExtents, layerScopes: segmentationLayerScopes, channelScopesByLayer: segmentationChannelScopesByLayer, channelCoordination: segmentationChannelCoordination }) {
262349
+ return useMemo$1(() => {
262350
+ if (!segmentationMultiExpressionNormData || !segmentationLayerScopes?.length || !segmentationChannelScopesByLayer || !segmentationChannelCoordination?.[0]) {
262351
+ return [segmentationMultiExpressionNormData, segmentationMultiExpressionExtents];
262232
262352
  }
262233
- let hasNormData = false;
262234
- let hasExtents = false;
262235
- const normDataByLayer = {};
262236
- const extentsByLayer = {};
262353
+ const normDataByLayer = { ...segmentationMultiExpressionNormData };
262354
+ const extentsByLayer = { ...segmentationMultiExpressionExtents };
262237
262355
  segmentationLayerScopes.forEach((layerScope) => {
262238
- const channelScopes = segmentationChannelScopesByLayer?.[layerScope];
262239
- if (!channelScopes?.length) {
262240
- return;
262241
- }
262242
- channelScopes.forEach((channelScope) => {
262243
- const expressionData = segmentationMultiExpressionData[layerScope]?.[channelScope];
262244
- const validExpressionArrays = filterValidExpressionArrays(expressionData);
262245
- if (validExpressionArrays.length <= 1) {
262246
- return;
262247
- }
262248
- const strategy = segmentationChannelCoordination?.[0]?.[layerScope]?.[channelScope]?.featureAggregationStrategy ?? DEFAULT_FEATURE_AGGREGATION_STRATEGY$1;
262249
- if (strategy == null) {
262250
- return;
262251
- }
262252
- const aggregated = aggregateFeatureArrays(validExpressionArrays, strategy);
262253
- if (!aggregated) {
262254
- return;
262255
- }
262256
- const normalized = normalizeAggregatedFeatureArray(aggregated);
262257
- if (!normalized) {
262258
- return;
262259
- }
262260
- if (!normDataByLayer[layerScope]) {
262261
- normDataByLayer[layerScope] = {};
262262
- }
262263
- if (!extentsByLayer[layerScope]) {
262264
- extentsByLayer[layerScope] = {};
262356
+ const channelScopes = segmentationChannelScopesByLayer[layerScope];
262357
+ channelScopes?.forEach((channelScope) => {
262358
+ const { featureAggregationStrategy, featureSelection } = segmentationChannelCoordination[0][layerScope]?.[channelScope] || {};
262359
+ const result = aggregateExpressionForScope(segmentationMultiExpressionData?.[layerScope]?.[channelScope], segmentationMultiExpressionNormData[layerScope]?.[channelScope], segmentationMultiExpressionExtents?.[layerScope]?.[channelScope], featureAggregationStrategy, featureSelection);
262360
+ if (result) {
262361
+ normDataByLayer[layerScope] = {
262362
+ ...normDataByLayer[layerScope],
262363
+ [channelScope]: result.normData
262364
+ };
262365
+ extentsByLayer[layerScope] = {
262366
+ ...extentsByLayer[layerScope],
262367
+ [channelScope]: result.extents
262368
+ };
262265
262369
  }
262266
- normDataByLayer[layerScope][channelScope] = [normalized.normData];
262267
- extentsByLayer[layerScope][channelScope] = [normalized.extent];
262268
- hasNormData = true;
262269
- hasExtents = true;
262270
262370
  });
262271
262371
  });
262272
- return [
262273
- hasNormData ? normDataByLayer : null,
262274
- hasExtents ? extentsByLayer : null
262275
- ];
262372
+ return [normDataByLayer, extentsByLayer];
262276
262373
  }, [
262277
262374
  segmentationMultiExpressionData,
262375
+ segmentationMultiExpressionNormData,
262376
+ segmentationMultiExpressionExtents,
262278
262377
  segmentationLayerScopes,
262279
262378
  segmentationChannelScopesByLayer,
262280
262379
  segmentationChannelCoordination
262281
262380
  ]);
262282
- return [
262283
- segmentationMultiExpressionNormDataAggregated,
262284
- segmentationMultiExpressionExtentsAggregated
262285
- ];
262286
262381
  }
262287
262382
  const DEFAULT_VIEW_STATE = {
262288
262383
  zoom: 0,
@@ -262384,6 +262479,7 @@ function SpatialSubscriber(props) {
262384
262479
  spatialRotationOrbit: rotationOrbit,
262385
262480
  spatialOrbitAxis: orbitAxis,
262386
262481
  spatialAxisFixed,
262482
+ spatialBackgroundTheme,
262387
262483
  spatialCameraSnapshot,
262388
262484
  // TODO: get obsSets per-layer or per-channel
262389
262485
  additionalObsSets,
@@ -262408,6 +262504,7 @@ function SpatialSubscriber(props) {
262408
262504
  setSpatialRotationOrbit: setRotationOrbit,
262409
262505
  setSpatialOrbitAxis: setOrbitAxis,
262410
262506
  setSpatialAxisFixed,
262507
+ setSpatialBackgroundTheme,
262411
262508
  setSpatialCameraSnapshot,
262412
262509
  // TODO: get obsSets per-layer or per-channel
262413
262510
  setAdditionalObsSets,
@@ -262419,6 +262516,9 @@ function SpatialSubscriber(props) {
262419
262516
  const annotationEditingProps = useAnnotationEditingForView(uuid2, Boolean(areAnnotationsEditable && annotationEditable && typeof annotationFrameIndex === "number"));
262420
262517
  const { spatialZoom: initialZoom, spatialTargetX: initialTargetX, spatialTargetY: initialTargetY, spatialTargetZ: initialTargetZ } = useInitialCoordination(COMPONENT_COORDINATION_TYPES[ViewType$1.SPATIAL_BETA], coordinationScopes);
262421
262518
  const hasSpatialCameraSnapshot = Boolean(spatialCameraSnapshot) && spatialRenderingMode === "3D";
262519
+ const requestCameraReset = useCallback(() => {
262520
+ setSpatialCameraSnapshot(null);
262521
+ }, [setSpatialCameraSnapshot]);
262422
262522
  const [segmentationLayerScopes, segmentationChannelScopesByLayer] = useMultiCoordinationScopesSecondaryNonNull(CoordinationType$1.SEGMENTATION_CHANNEL, CoordinationType$1.SEGMENTATION_LAYER, coordinationScopes, coordinationScopesBy);
262423
262523
  const [imageLayerScopes, imageChannelScopesByLayer] = useMultiCoordinationScopesSecondaryNonNull(CoordinationType$1.IMAGE_CHANNEL, CoordinationType$1.IMAGE_LAYER, coordinationScopes, coordinationScopesBy);
262424
262524
  const spotLayerScopes = useMultiCoordinationScopesNonNull(CoordinationType$1.SPOT_LAYER, coordinationScopes);
@@ -262484,6 +262584,7 @@ function SpatialSubscriber(props) {
262484
262584
  CoordinationType$1.SPATIAL_LAYER_VISIBLE,
262485
262585
  CoordinationType$1.SPATIAL_LAYER_OPACITY,
262486
262586
  CoordinationType$1.SPATIAL_SPOT_RADIUS,
262587
+ CoordinationType$1.SPATIAL_SPOT_SHAPE,
262487
262588
  CoordinationType$1.SPATIAL_SPOT_FILLED,
262488
262589
  CoordinationType$1.SPATIAL_SPOT_STROKE_WIDTH,
262489
262590
  CoordinationType$1.OBS_COLOR_ENCODING,
@@ -262515,7 +262616,9 @@ function SpatialSubscriber(props) {
262515
262616
  CoordinationType$1.OBS_HIGHLIGHT,
262516
262617
  CoordinationType$1.TOOLTIPS_VISIBLE,
262517
262618
  CoordinationType$1.TOOLTIP_CROSSHAIRS_VISIBLE,
262518
- CoordinationType$1.LEGEND_VISIBLE
262619
+ CoordinationType$1.LEGEND_VISIBLE,
262620
+ CoordinationType$1.SPATIAL_POINT_RADIUS,
262621
+ CoordinationType$1.SPATIAL_POINT_STROKE_WIDTH
262519
262622
  ], coordinationScopes, coordinationScopesBy, CoordinationType$1.POINT_LAYER);
262520
262623
  const [volumeLoadingStatus, setVolumeLoadingStatus] = useState(null);
262521
262624
  const [{ volumeLoadingProgress, tiledPointsLoadingProgress }, { setVolumeLoadingProgress, setTiledPointsLoadingProgress }] = useAuxiliaryCoordination([
@@ -262550,12 +262653,16 @@ function SpatialSubscriber(props) {
262550
262653
  const [segmentationMultiExpressionData, segmentationMultiLoadedFeatureSelection, segmentationMultiExpressionExtents, segmentationMultiExpressionNormData, segmentationMultiFeatureSelectionStatus, segmentationMultiFeatureSelectionErrors] = useSegmentationMultiFeatureSelection(coordinationScopes, coordinationScopesBy, loaders, dataset);
262551
262654
  const [segmentationMultiIndicesData, segmentationMultiIndicesDataStatus, segmentationMultiIndicesDataErrors] = useSegmentationMultiObsFeatureMatrixIndices(coordinationScopes, coordinationScopesBy, loaders, dataset);
262552
262655
  const [spotMultiExpressionNormDataAggregated, spotMultiExpressionExtentsAggregated] = useAggregatedNormalizedExpressionDataForLayers({
262553
- multiExpressionData: spotMultiExpressionNormData,
262656
+ multiExpressionData: spotMultiExpressionData,
262657
+ multiExpressionNormData: spotMultiExpressionNormData,
262658
+ multiExpressionExtents: spotMultiExpressionExtents,
262554
262659
  layerScopes: spotLayerScopes,
262555
262660
  layerCoordination: spotLayerCoordination
262556
262661
  });
262557
262662
  const [segmentationMultiExpressionNormDataAggregated, segmentationMultiExpressionExtentsAggregated] = useAggregatedNormalizedExpressionDataForChannels({
262558
- multiExpressionData: segmentationMultiExpressionNormData,
262663
+ multiExpressionData: segmentationMultiExpressionData,
262664
+ multiExpressionNormData: segmentationMultiExpressionNormData,
262665
+ multiExpressionExtents: segmentationMultiExpressionExtents,
262559
262666
  layerScopes: segmentationLayerScopes,
262560
262667
  channelScopesByLayer: segmentationChannelScopesByLayer,
262561
262668
  channelCoordination: segmentationChannelCoordination
@@ -262888,7 +262995,7 @@ function SpatialSubscriber(props) {
262888
262995
  }
262889
262996
  }
262890
262997
  };
262891
- return jsxs(TitleInfo, { title: title2, info: subtitle, isSpatial: true, urls: urls2, theme, closeButtonVisible, downloadButtonVisible, removeGridComponent, isReady: isReady && !isSelectionPending, errors, helpText, options: jsx$1(SpatialOptions, { spatialAxisFixed, setSpatialAxisFixed, use3d: is3dMode }), children: [shouldUseThree ? acceleratedFor3d ? jsx$1(SpatialAcceleratedAdapter, { ref: threeRef, uuid: uuid2, width: width2, height: height2, theme, hideTools: !isSelectable, rotation: [rotationX, rotationY, rotationZ], setRotationX, setRotationY, setRotationZ, targetT, targetZ, viewState: isValidViewState ? {
262998
+ return jsxs(TitleInfo, { title: title2, info: subtitle, isSpatial: true, urls: urls2, theme, closeButtonVisible, downloadButtonVisible, removeGridComponent, isReady: isReady && !isSelectionPending, errors, helpText, spatialBackgroundTheme: spatialBackgroundTheme ?? "dark", options: jsx$1(SpatialOptions, { spatialAxisFixed, setSpatialAxisFixed, use3d: is3dMode, spatialBackgroundTheme: spatialBackgroundTheme ?? "dark", setSpatialBackgroundTheme }), children: [shouldUseThree ? acceleratedFor3d ? jsx$1(SpatialAcceleratedAdapter, { ref: threeRef, uuid: uuid2, width: width2, height: height2, theme, hideTools: !isSelectable, rotation: [rotationX, rotationY, rotationZ], setRotationX, setRotationY, setRotationZ, targetT, targetZ, viewState: isValidViewState ? {
262892
262999
  zoom: zoom2,
262893
263000
  target: [targetX2, targetY2, targetZ],
262894
263001
  rotationX,
@@ -262898,13 +263005,66 @@ function SpatialSubscriber(props) {
262898
263005
  target: [targetX2, targetY2, targetZ],
262899
263006
  rotationX,
262900
263007
  rotationOrbit
262901
- } : DEFAULT_VIEW_STATE, orbitAxis, spatialAxisFixed, setViewState: isValidViewState ? setViewState : SET_VIEW_STATE_NOOP, originalViewState, spatialRenderingMode, updateViewInfo: setComponentViewInfo, delegateHover, onEntitySelected, obsPoints: obsPointsData, pointLayerScopes, pointLayerCoordination, pointMultiObsLabels: pointMultiObsLabelsData, obsSpots: obsSpotsData, spotLayerScopes, spotLayerCoordination, obsSpotsSets: obsSpotsSetsData, spotMatrixIndices: spotMultiIndicesData, spotMultiExpressionData: spotMultiExpressionNormDataAggregated || spotMultiExpressionNormData, segmentationLayerScopes, segmentationLayerCoordination, segmentationChannelScopesByLayer, segmentationChannelCoordination, obsSegmentations: obsSegmentationsData, obsSegmentationsLocations: obsSegmentationsLocationsData, obsSegmentationsSets: obsSegmentationsSetsData, segmentationMatrixIndices: segmentationMultiIndicesData, segmentationMultiExpressionData: segmentationMultiExpressionNormDataAggregated || segmentationMultiExpressionNormData, bitmaskValueIsIndex, images: imageData, imageLayerScopes, imageLayerCoordination, imageChannelScopesByLayer, imageChannelCoordination }) : jsx$1(SpatialWrapper, { ref: deckRef, uuid: uuid2, onSelectionBusy: setIsSelectionPending, width: width2, height: height2, theme, hideTools: !isSelectable, targetT, targetZ, viewState: isValidViewState ? {
262902
- zoom: zoom2,
262903
- target: [targetX2, targetY2, targetZ],
262904
- rotationX,
262905
- rotationOrbit,
262906
- ...annotationTransitionProps
262907
- } : DEFAULT_VIEW_STATE, orbitAxis, spatialAxisFixed, setViewState: isValidViewState ? setViewState : SET_VIEW_STATE_NOOP, originalViewState, spatialRenderingMode, updateViewInfo: setComponentViewInfo, delegateHover, obsPoints: obsPointsData, pointLayerScopes, pointLayerCoordination, pointMultiObsLabels: pointMultiObsLabelsData, pointMatrixIndices: pointMultiIndicesData, obsSpots: obsSpotsData, spotLayerScopes, spotLayerCoordination, obsSpotsSets: obsSpotsSetsData, spotMatrixIndices: spotMultiIndicesData, spotMultiExpressionData: spotMultiExpressionNormDataAggregated || spotMultiExpressionNormData, segmentationLayerScopes, segmentationLayerCoordination, segmentationChannelScopesByLayer, segmentationChannelCoordination, obsSegmentations: obsSegmentationsData, obsSegmentationsLocations: obsSegmentationsLocationsData, obsSegmentationsSets: obsSegmentationsSetsData, segmentationMatrixIndices: segmentationMultiIndicesData, segmentationMultiExpressionData: segmentationMultiExpressionNormDataAggregated || segmentationMultiExpressionNormData, bitmaskValueIsIndex, images: imageData, imageLayerScopes, imageLayerCoordination, imageChannelScopesByLayer, imageChannelCoordination, setTiledPointsLoadingProgress, spatialCameraSnapshot: hasSpatialCameraSnapshot ? sceneCameraSnapshot : null, setSpatialCameraSnapshot: hasSpatialCameraSnapshot ? setSceneCameraSnapshot : null, annotationShapes, annotationOverlayVisible, annotationSemanticZoom, hideRecenter: hasSpatialCameraSnapshot, ...annotationEditingProps }), !disableTooltip && jsx$1(SpatialTooltipSubscriber, {
263008
+ } : DEFAULT_VIEW_STATE, orbitAxis, spatialAxisFixed, setViewState: isValidViewState ? setViewState : SET_VIEW_STATE_NOOP, originalViewState, spatialRenderingMode, updateViewInfo: setComponentViewInfo, delegateHover, onEntitySelected, obsPoints: obsPointsData, pointLayerScopes, pointLayerCoordination, pointMultiObsLabels: pointMultiObsLabelsData, obsSpots: obsSpotsData, spotLayerScopes, spotLayerCoordination, obsSpotsSets: obsSpotsSetsData, spotMatrixIndices: spotMultiIndicesData, spotMultiExpressionData: spotMultiExpressionNormDataAggregated || spotMultiExpressionNormData, segmentationLayerScopes, segmentationLayerCoordination, segmentationChannelScopesByLayer, segmentationChannelCoordination, obsSegmentations: obsSegmentationsData, obsSegmentationsLocations: obsSegmentationsLocationsData, obsSegmentationsSets: obsSegmentationsSetsData, segmentationMatrixIndices: segmentationMultiIndicesData, segmentationMultiExpressionData: segmentationMultiExpressionNormDataAggregated || segmentationMultiExpressionNormData, bitmaskValueIsIndex, images: imageData, imageLayerScopes, imageLayerCoordination, imageChannelScopesByLayer, imageChannelCoordination }) : jsx$1(SpatialWrapper, {
263009
+ ref: deckRef,
263010
+ uuid: uuid2,
263011
+ onSelectionBusy: setIsSelectionPending,
263012
+ width: width2,
263013
+ height: height2,
263014
+ theme,
263015
+ hideTools: !isSelectable,
263016
+ targetT,
263017
+ targetZ,
263018
+ viewState: isValidViewState ? {
263019
+ zoom: zoom2,
263020
+ target: [targetX2, targetY2, targetZ],
263021
+ rotationX,
263022
+ rotationOrbit,
263023
+ ...annotationTransitionProps
263024
+ } : DEFAULT_VIEW_STATE,
263025
+ orbitAxis,
263026
+ spatialAxisFixed,
263027
+ setViewState: isValidViewState ? setViewState : SET_VIEW_STATE_NOOP,
263028
+ originalViewState,
263029
+ spatialRenderingMode,
263030
+ updateViewInfo: setComponentViewInfo,
263031
+ delegateHover,
263032
+ obsPoints: obsPointsData,
263033
+ pointLayerScopes,
263034
+ pointLayerCoordination,
263035
+ pointMultiObsLabels: pointMultiObsLabelsData,
263036
+ pointMatrixIndices: pointMultiIndicesData,
263037
+ obsSpots: obsSpotsData,
263038
+ spotLayerScopes,
263039
+ spotLayerCoordination,
263040
+ obsSpotsSets: obsSpotsSetsData,
263041
+ spotMatrixIndices: spotMultiIndicesData,
263042
+ spotMultiExpressionData: spotMultiExpressionNormDataAggregated || spotMultiExpressionNormData,
263043
+ segmentationLayerScopes,
263044
+ segmentationLayerCoordination,
263045
+ segmentationChannelScopesByLayer,
263046
+ segmentationChannelCoordination,
263047
+ obsSegmentations: obsSegmentationsData,
263048
+ obsSegmentationsLocations: obsSegmentationsLocationsData,
263049
+ obsSegmentationsSets: obsSegmentationsSetsData,
263050
+ segmentationMatrixIndices: segmentationMultiIndicesData,
263051
+ segmentationMultiExpressionData: segmentationMultiExpressionNormDataAggregated || segmentationMultiExpressionNormData,
263052
+ bitmaskValueIsIndex,
263053
+ images: imageData,
263054
+ imageLayerScopes,
263055
+ imageLayerCoordination,
263056
+ imageChannelScopesByLayer,
263057
+ imageChannelCoordination,
263058
+ setTiledPointsLoadingProgress,
263059
+ spatialCameraSnapshot: hasSpatialCameraSnapshot ? sceneCameraSnapshot : null,
263060
+ setSpatialCameraSnapshot: hasSpatialCameraSnapshot ? setSceneCameraSnapshot : null,
263061
+ annotationShapes,
263062
+ annotationOverlayVisible,
263063
+ annotationSemanticZoom,
263064
+ // Synced to Neuroglancer: recenter asks NG to restore its home camera (snapshot follows).
263065
+ onRequestCameraReset: hasSpatialCameraSnapshot ? requestCameraReset : void 0,
263066
+ ...annotationEditingProps
263067
+ }), !disableTooltip && jsx$1(SpatialTooltipSubscriber, {
262908
263068
  parentUuid: uuid2,
262909
263069
  width: width2,
262910
263070
  height: height2,
@@ -262929,8 +263089,8 @@ function SpatialSubscriber(props) {
262929
263089
  }), jsx$1(
262930
263090
  MultiLegend,
262931
263091
  {
262932
- // Fix to dark theme due to black background of spatial plot.
262933
- theme: "dark",
263092
+ // Match the plot background, which is configurable.
263093
+ theme: spatialBackgroundTheme ?? "dark",
262934
263094
  maxHeight: height2,
262935
263095
  // Segmentations
262936
263096
  segmentationLayerScopes,
@@ -271888,6 +272048,44 @@ function ChannelColorPickerMenu(props) {
271888
272048
  [classes2.colorIconOutline]: theme !== "dark" && isEqual$3(color2, [255, 255, 255])
271889
272049
  }), style: { backgroundColor: currentColor } }) : isColormap && visible && featureValueColormap ? jsx$1("div", { className: classes2.colorIcon, children: jsx$1("svg", { width: "18", height: "18", children: jsx$1("image", { x: 0, y: 0, width: 18, height: 18, preserveAspectRatio: "none", href: getXlinkHref(featureValueColormap), clipPath: "inset(0% round 4px)" }) }) }) : jsx$1("div", { className: classes2.colorIcon }), buttonClassName: classes2.colorIconButton, withPaper: true, paperClassName: classes2.colorPickerPaper, "aria-label": "Open color picker menu", children: jsx$1(Twitter$1, { className: classes2.colorPicker, disableAlpha: true, width: 108, triangle: "hide", colors: defaultPalette, color: currentColor, onChangeComplete: handleColorChange }) });
271890
272050
  }
272051
+ const FEATURE_INDEX_OPTION_PREFIX = "feature-index-";
272052
+ function getFeatureOptionValue(featureName, featureIndex) {
272053
+ return RESERVED_FEATURE_AGGREGATION_STRATEGIES.includes(featureName) ? `${FEATURE_INDEX_OPTION_PREFIX}${featureIndex}` : featureName;
272054
+ }
272055
+ function getSelectedOptionValue(featureAggregationStrategy, featureSelection) {
272056
+ const resolvedStrategy = resolveFeatureAggregationStrategy(featureAggregationStrategy, featureSelection) ?? "first";
272057
+ if (resolvedStrategy === "mean" || resolvedStrategy === "sum") {
272058
+ return resolvedStrategy;
272059
+ }
272060
+ if (resolvedStrategy === "difference" && featureSelection.length === 2) {
272061
+ return resolvedStrategy;
272062
+ }
272063
+ let featureIndex = 0;
272064
+ if (resolvedStrategy === "last") {
272065
+ featureIndex = featureSelection.length - 1;
272066
+ } else if (typeof resolvedStrategy === "number") {
272067
+ featureIndex = resolvedStrategy;
272068
+ }
272069
+ return getFeatureOptionValue(featureSelection[featureIndex], featureIndex);
272070
+ }
272071
+ function SingleFeatureSelect(props) {
272072
+ const { featureSelection, featureAggregationStrategy, setFeatureAggregationStrategy } = props;
272073
+ const { classes: lcClasses } = useControllerSectionStyles();
272074
+ const { classes: selectClasses2 } = useSelectStyles();
272075
+ const selectedOptionValue = getSelectedOptionValue(featureAggregationStrategy, featureSelection);
272076
+ const handleChange = useCallback((e3) => {
272077
+ const { value: value2 } = e3.target;
272078
+ if (value2.startsWith(FEATURE_INDEX_OPTION_PREFIX)) {
272079
+ setFeatureAggregationStrategy(Number(value2.substring(FEATURE_INDEX_OPTION_PREFIX.length)));
272080
+ } else {
272081
+ setFeatureAggregationStrategy(value2);
272082
+ }
272083
+ }, [setFeatureAggregationStrategy]);
272084
+ return jsx$1(Grid$1, { className: lcClasses.layerControllerGrid, children: jsx$1(Paper, { elevation: 2, className: lcClasses.layerControllerSubRow, children: jsxs(NativeSelect, { onChange: handleChange, value: selectedOptionValue, inputProps: { "aria-label": "Select the feature used for colormap-based coloring" }, classes: { root: selectClasses2.selectRoot }, children: [jsx$1("optgroup", { label: "Single feature", children: featureSelection.map((featureName, featureIndex) => {
272085
+ const optionValue = getFeatureOptionValue(featureName, featureIndex);
272086
+ return jsx$1("option", { value: optionValue, children: featureName }, optionValue);
272087
+ }) }), jsxs("optgroup", { label: "Combine features", children: [jsx$1("option", { value: "mean", children: "Mean" }), jsx$1("option", { value: "sum", children: "Sum" }), featureSelection.length === 2 ? jsx$1("option", { value: "difference", children: `Difference (${featureSelection[0]} − ${featureSelection[1]})` }) : null] })] }) }) });
272088
+ }
271891
272089
  const useStyles$h = makeStyles()(() => ({
271892
272090
  layerTypeSpotIcon: {
271893
272091
  height: "100%",
@@ -271916,13 +272114,14 @@ function SpotLayerEllipsisMenu(props) {
271916
272114
  }
271917
272115
  function SpotLayerController(props) {
271918
272116
  const { theme, layerScope, layerCoordination, setLayerCoordination, palette = null } = props;
271919
- const { obsType, spatialLayerVisible: visible, spatialLayerLabel, spatialLayerOpacity: opacity2, spatialSpotRadius: radius2, spatialSpotFilled: filled, spatialSpotStrokeWidth: strokeWidth, spatialLayerColor: color2, obsColorEncoding, featureSelection, featureValueColormap, featureValueColormapRange, tooltipsVisible, tooltipCrosshairsVisible, legendVisible } = layerCoordination;
271920
- const { setSpatialLayerVisible: setVisible, setSpatialLayerOpacity: setOpacity2, setSpatialSpotRadius: setRadius, setSpatialSpotFilled: setFilled, setSpatialSpotStrokeWidth: setStrokeWidth, setSpatialLayerColor: setColor2, setObsColorEncoding, setFeatureSelection, setFeatureValueColormap, setFeatureValueColormapRange, setTooltipsVisible, setTooltipCrosshairsVisible, setLegendVisible } = setLayerCoordination;
272117
+ const { obsType, spatialLayerVisible: visible, spatialLayerLabel, spatialLayerOpacity: opacity2, spatialSpotRadius: radius2, spatialSpotFilled: filled, spatialSpotStrokeWidth: strokeWidth, spatialLayerColor: color2, obsColorEncoding, featureSelection, featureAggregationStrategy, featureValueColormap, featureValueColormapRange, tooltipsVisible, tooltipCrosshairsVisible, legendVisible } = layerCoordination;
272118
+ const { setSpatialLayerVisible: setVisible, setSpatialLayerOpacity: setOpacity2, setSpatialSpotRadius: setRadius, setSpatialSpotFilled: setFilled, setSpatialSpotStrokeWidth: setStrokeWidth, setSpatialLayerColor: setColor2, setObsColorEncoding, setFeatureSelection, setFeatureAggregationStrategy, setFeatureValueColormap, setFeatureValueColormapRange, setTooltipsVisible, setTooltipCrosshairsVisible, setLegendVisible } = setLayerCoordination;
271921
272119
  const label2 = spatialLayerLabel || capitalize$3(obsType);
271922
272120
  const visibleSetting = typeof visible === "boolean" ? visible : true;
271923
272121
  const Visibility$1 = useMemo$1(() => visibleSetting ? Visibility : VisibilityOff, [visibleSetting]);
271924
272122
  const isStaticColor = obsColorEncoding === "spatialLayerColor";
271925
272123
  const isColormap = obsColorEncoding === "geneSelection";
272124
+ const hasMultipleFeaturesSelected = Array.isArray(featureSelection) && featureSelection.length > 1;
271926
272125
  const { classes: classes2 } = useStyles$h();
271927
272126
  const { classes: lcClasses } = useControllerSectionStyles();
271928
272127
  const { classes: menuClasses } = useEllipsisMenuStyles();
@@ -271931,9 +272130,9 @@ function SpotLayerController(props) {
271931
272130
  setVisible(nextVisible);
271932
272131
  }, [visible, setVisible]);
271933
272132
  const handleOpacityChange = useCallback((e3, v) => setOpacity2(v), [setOpacity2]);
271934
- return jsx$1(Grid$1, { className: lcClasses.layerControllerGrid, children: jsx$1(Paper, { elevation: 4, className: lcClasses.layerControllerRoot, children: jsxs(Grid$1, { container: true, direction: "row", sx: {
272133
+ return jsxs(Fragment, { children: [jsx$1(Grid$1, { className: lcClasses.layerControllerGrid, children: jsx$1(Paper, { elevation: 4, className: lcClasses.layerControllerRoot, children: jsxs(Grid$1, { container: true, direction: "row", sx: {
271935
272134
  justifyContent: "space-between"
271936
- }, children: [jsx$1(Grid$1, { size: 1, children: jsx$1(Button, { onClick: handleVisibleChange, className: menuClasses.imageLayerVisibleButton, "aria-label": "Toggle spot layer visibility", children: jsx$1(Visibility$1, {}) }) }), jsx$1(Grid$1, { size: 1, children: jsx$1(ChannelColorPickerMenu, { theme, color: color2, setColor: setColor2, palette, isStaticColor, isColormap, featureValueColormap, visible }) }), jsx$1(Grid$1, { size: 6, children: jsx$1(Typography, { className: menuClasses.imageLayerName, children: label2 }) }), jsx$1(Grid$1, { size: 2, children: jsx$1(Slider, { value: opacity2, min: 0, max: 1, step: 1e-3, onChange: handleOpacityChange, className: menuClasses.imageLayerOpacitySlider, orientation: "horizontal", "aria-label": `Adjust opacity for layer ${label2}` }) }), jsx$1(Grid$1, { size: 1, children: jsx$1(SpotLayerEllipsisMenu, { filled, setFilled, strokeWidth, setStrokeWidth, featureSelection, obsColorEncoding, setObsColorEncoding, featureValueColormap, setFeatureValueColormap, featureValueColormapRange, setFeatureValueColormapRange, tooltipsVisible, setTooltipsVisible, tooltipCrosshairsVisible, setTooltipCrosshairsVisible, legendVisible, setLegendVisible }) }), jsx$1(Grid$1, { size: 1, children: jsx$1(SvgSpots, { className: classes2.layerTypeSpotIcon }) })] }) }) });
272135
+ }, children: [jsx$1(Grid$1, { size: 1, children: jsx$1(Button, { onClick: handleVisibleChange, className: menuClasses.imageLayerVisibleButton, "aria-label": "Toggle spot layer visibility", children: jsx$1(Visibility$1, {}) }) }), jsx$1(Grid$1, { size: 1, children: jsx$1(ChannelColorPickerMenu, { theme, color: color2, setColor: setColor2, palette, isStaticColor, isColormap, featureValueColormap, visible }) }), jsx$1(Grid$1, { size: 6, children: jsx$1(Typography, { className: menuClasses.imageLayerName, children: label2 }) }), jsx$1(Grid$1, { size: 2, children: jsx$1(Slider, { value: opacity2, min: 0, max: 1, step: 1e-3, onChange: handleOpacityChange, className: menuClasses.imageLayerOpacitySlider, orientation: "horizontal", "aria-label": `Adjust opacity for layer ${label2}` }) }), jsx$1(Grid$1, { size: 1, children: jsx$1(SpotLayerEllipsisMenu, { filled, setFilled, strokeWidth, setStrokeWidth, featureSelection, obsColorEncoding, setObsColorEncoding, featureValueColormap, setFeatureValueColormap, featureValueColormapRange, setFeatureValueColormapRange, tooltipsVisible, setTooltipsVisible, tooltipCrosshairsVisible, setTooltipCrosshairsVisible, legendVisible, setLegendVisible }) }), jsx$1(Grid$1, { size: 1, children: jsx$1(SvgSpots, { className: classes2.layerTypeSpotIcon }) })] }) }) }), isColormap && hasMultipleFeaturesSelected ? jsx$1(SingleFeatureSelect, { featureSelection, featureAggregationStrategy, setFeatureAggregationStrategy }) : null] });
271937
272136
  }
271938
272137
  const useStyles$g = makeStyles()(() => ({
271939
272138
  layerFeatureControllerGrid: {
@@ -272055,6 +272254,7 @@ function LayerPerFeatureController(props) {
272055
272254
  justifyContent: "space-between"
272056
272255
  }, children: jsx$1(LinearProgress, { variant: loadingDoneFraction === 0 ? "indeterminate" : "determinate", value: loadingDoneFraction * 100 }) }) : null] }) }, featureName);
272057
272256
  }
272257
+ const DEFAULT_POINT_RADIUS = 2.5;
272058
272258
  const useStyles$f = makeStyles()(() => ({
272059
272259
  pointLayerButton: {
272060
272260
  borderStyle: "dashed",
@@ -272084,7 +272284,7 @@ const useStyles$f = makeStyles()(() => ({
272084
272284
  }
272085
272285
  }));
272086
272286
  function PointLayerEllipsisMenu(props) {
272087
- const { featureSelection, featureFilterMode, setFeatureFilterMode, obsColorEncoding, setObsColorEncoding, featureValueColormap, setFeatureValueColormap, featureValueColormapRange, setFeatureValueColormapRange, tooltipsVisible, setTooltipsVisible, tooltipCrosshairsVisible, setTooltipCrosshairsVisible, legendVisible, setLegendVisible } = props;
272287
+ const { featureSelection, featureFilterMode, setFeatureFilterMode, obsColorEncoding, setObsColorEncoding, featureValueColormap, setFeatureValueColormap, featureValueColormapRange, setFeatureValueColormapRange, tooltipsVisible, setTooltipsVisible, tooltipCrosshairsVisible, setTooltipCrosshairsVisible, legendVisible, setLegendVisible, strokeWidth, setStrokeWidth, pointRadius, setpointRadius } = props;
272088
272288
  const [open2, setOpen] = useState(false);
272089
272289
  const { classes: selectClasses2 } = useSelectStyles();
272090
272290
  const { classes: menuClasses } = useEllipsisMenuStyles();
@@ -272095,7 +272295,9 @@ function PointLayerEllipsisMenu(props) {
272095
272295
  const legendVisibleId = $bdb11010cef70236$export$f680877a34711e37();
272096
272296
  const featureFilterModeId = $bdb11010cef70236$export$f680877a34711e37();
272097
272297
  const colormapSelectorId = $bdb11010cef70236$export$f680877a34711e37();
272098
- return jsxs(PopperMenu, { open: open2, setOpen, buttonIcon: jsx$1(MoreVertIcon, {}), buttonClassName: menuClasses.imageLayerMenuButton, containerClassName: menuClasses.imageLayerPopperContainer, withPaper: true, getAriaLabel: () => "Open point layer options menu", children: [jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: colormapSelectorId, children: "Colormap: " }), jsx$1(NativeSelect, { onChange: (e3) => setFeatureValueColormap(e3.target.value), value: featureValueColormap, inputProps: { id: colormapSelectorId, "aria-label": "Colormap selector" }, classes: { root: selectClasses2.selectRoot }, children: GLSL_COLORMAPS.map((cmap) => jsx$1("option", { value: cmap, children: cmap }, cmap)) })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: quantitativeColormapId, children: "Color Encoding: " }), jsxs(NativeSelect, { onChange: (e3) => setObsColorEncoding(e3.target.value), value: obsColorEncoding, inputProps: { id: quantitativeColormapId, "aria-label": "Color encoding selector" }, classes: { root: selectClasses2.selectRoot }, children: [jsx$1("option", { value: "spatialLayerColor", children: "Static Color" }), jsx$1("option", { value: "geneSelection", children: "Feature Color" }), jsx$1("option", { value: "randomByFeature", children: "Random Color per Feature" }), jsx$1("option", { value: "random", children: "Random Color per Point" })] })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: featureFilterModeId, children: "Filter to Feature Selection: " }), jsx$1(Checkbox$1, { color: "primary", className: menuClasses.menuItemCheckbox, checked: featureFilterMode === "featureSelection", onChange: (e3, v) => setFeatureFilterMode(v ? "featureSelection" : null), slotProps: { input: { id: featureFilterModeId, "aria-label": "Toggle feature filter mode" } } })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: colormapRangeId, children: "Colormap Range: " }), jsx$1(Slider, { disabled: obsColorEncoding !== "geneSelection", value: featureValueColormapRange, min: 0, max: 1, step: 0.01, onChange: (e3, v) => setFeatureValueColormapRange(v), className: menuClasses.menuItemSlider, orientation: "horizontal", id: colormapRangeId, getAriaLabel: (index2) => index2 === 0 ? "Low value colormap range slider" : "High value colormap range slider" })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: tooltipsVisibleId, children: "Tooltips Visible: " }), jsx$1(Checkbox$1, { color: "primary", className: menuClasses.menuItemCheckbox, checked: tooltipsVisible, onChange: (e3, v) => setTooltipsVisible(v), slotProps: { input: { id: tooltipsVisibleId, "aria-label": "Toggle tooltip visibility" } } })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: crosshairsVisibleId, children: "Tooltip Crosshairs Visible: " }), jsx$1(Checkbox$1, { color: "primary", className: menuClasses.menuItemCheckbox, checked: tooltipCrosshairsVisible, onChange: (e3, v) => setTooltipCrosshairsVisible(v), slotProps: { input: { id: crosshairsVisibleId, "aria-label": "Toggle tooltip crosshair visibility" } } })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: legendVisibleId, children: "Legend Visible: " }), jsx$1(Checkbox$1, { color: "primary", className: menuClasses.menuItemCheckbox, checked: legendVisible, onChange: (e3, v) => setLegendVisible(v), slotProps: { input: { id: legendVisibleId, "aria-label": "Toggle legend visibility" } } })] })] });
272298
+ const strokeWidthId = $bdb11010cef70236$export$f680877a34711e37();
272299
+ const pointRadiusId = $bdb11010cef70236$export$f680877a34711e37();
272300
+ return jsxs(PopperMenu, { open: open2, setOpen, buttonIcon: jsx$1(MoreVertIcon, {}), buttonClassName: menuClasses.imageLayerMenuButton, containerClassName: menuClasses.imageLayerPopperContainer, withPaper: true, getAriaLabel: () => "Open point layer options menu", children: [jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: colormapSelectorId, children: "Colormap: " }), jsx$1(NativeSelect, { onChange: (e3) => setFeatureValueColormap(e3.target.value), value: featureValueColormap, inputProps: { id: colormapSelectorId, "aria-label": "Colormap selector" }, classes: { root: selectClasses2.selectRoot }, children: GLSL_COLORMAPS.map((cmap) => jsx$1("option", { value: cmap, children: cmap }, cmap)) })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: quantitativeColormapId, children: "Color Encoding: " }), jsxs(NativeSelect, { onChange: (e3) => setObsColorEncoding(e3.target.value), value: obsColorEncoding, inputProps: { id: quantitativeColormapId, "aria-label": "Color encoding selector" }, classes: { root: selectClasses2.selectRoot }, children: [jsx$1("option", { value: "spatialLayerColor", children: "Static Color" }), jsx$1("option", { value: "geneSelection", children: "Feature Color" }), jsx$1("option", { value: "randomByFeature", children: "Random Color per Feature" }), jsx$1("option", { value: "random", children: "Random Color per Point" })] })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: featureFilterModeId, children: "Filter to Feature Selection: " }), jsx$1(Checkbox$1, { color: "primary", className: menuClasses.menuItemCheckbox, checked: featureFilterMode === "featureSelection", onChange: (e3, v) => setFeatureFilterMode(v ? "featureSelection" : null), slotProps: { input: { id: featureFilterModeId, "aria-label": "Toggle feature filter mode" } } })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: colormapRangeId, children: "Colormap Range: " }), jsx$1(Slider, { disabled: obsColorEncoding !== "geneSelection", value: featureValueColormapRange, min: 0, max: 1, step: 0.01, onChange: (e3, v) => setFeatureValueColormapRange(v), className: menuClasses.menuItemSlider, orientation: "horizontal", id: colormapRangeId, getAriaLabel: (index2) => index2 === 0 ? "Low value colormap range slider" : "High value colormap range slider" })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: tooltipsVisibleId, children: "Tooltips Visible: " }), jsx$1(Checkbox$1, { color: "primary", className: menuClasses.menuItemCheckbox, checked: tooltipsVisible, onChange: (e3, v) => setTooltipsVisible(v), slotProps: { input: { id: tooltipsVisibleId, "aria-label": "Toggle tooltip visibility" } } })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: crosshairsVisibleId, children: "Tooltip Crosshairs Visible: " }), jsx$1(Checkbox$1, { color: "primary", className: menuClasses.menuItemCheckbox, checked: tooltipCrosshairsVisible, onChange: (e3, v) => setTooltipCrosshairsVisible(v), slotProps: { input: { id: crosshairsVisibleId, "aria-label": "Toggle tooltip crosshair visibility" } } })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: legendVisibleId, children: "Legend Visible: " }), jsx$1(Checkbox$1, { color: "primary", className: menuClasses.menuItemCheckbox, checked: legendVisible, onChange: (e3, v) => setLegendVisible(v), slotProps: { input: { id: legendVisibleId, "aria-label": "Toggle legend visibility" } } })] }), setStrokeWidth ? jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: strokeWidthId, children: "Stroke Width: " }), jsx$1(Slider, { value: strokeWidth ?? 0, min: 0, max: 5, step: 0.1, valueLabelDisplay: "auto", onChange: (e3, v) => setStrokeWidth(v), className: menuClasses.menuItemSlider, orientation: "horizontal", id: strokeWidthId, "aria-label": "Point stroke width slider" })] }) : null, jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: pointRadiusId, children: "Point Size: " }), jsx$1(Slider, { value: pointRadius ?? DEFAULT_POINT_RADIUS, min: 0.1, max: 20, step: 0.1, valueLabelDisplay: "auto", onChange: (e3, v) => setpointRadius?.(v), className: menuClasses.menuItemSlider, orientation: "horizontal", id: pointRadiusId, "aria-label": "Point size slider" })] })] });
272099
272301
  }
272100
272302
  function PointLayerController(props) {
272101
272303
  const { theme, layerScope, layerCoordination, setLayerCoordination, palette = null, pointMatrixIndicesData, tiledPointsLoadingProgress, layerPerFeatureForPoints } = props;
@@ -272106,8 +272308,8 @@ function PointLayerController(props) {
272106
272308
  }
272107
272309
  return 1;
272108
272310
  }, [tiledPointsLoadingProgress]);
272109
- const { obsType, spatialLayerVisible: visible, spatialLayerOpacity: opacity2, spatialLayerOpacityUnselected, spatialLayerLabel, obsColorEncoding, featureColor, featureFilterMode, featureSelection, featureValueColormap, featureValueColormapRange, spatialLayerColor, tooltipsVisible, tooltipCrosshairsVisible, legendVisible } = layerCoordination;
272110
- const { setSpatialLayerVisible: setVisible, setSpatialLayerOpacity: setOpacity2, setSpatialLayerOpacityUnselected, setObsColorEncoding, setFeatureColor, setFeatureFilterMode, setFeatureSelection, setFeatureValueColormap, setFeatureValueColormapRange, setSpatialLayerColor, setTooltipsVisible, setTooltipCrosshairsVisible, setLegendVisible } = setLayerCoordination;
272311
+ const { obsType, spatialLayerVisible: visible, spatialLayerOpacity: opacity2, spatialLayerOpacityUnselected, spatialLayerLabel, obsColorEncoding, featureColor, featureFilterMode, featureSelection, featureValueColormap, featureValueColormapRange, spatialLayerColor, tooltipsVisible, tooltipCrosshairsVisible, legendVisible, spatialPointStrokeWidth, spatialPointRadius } = layerCoordination;
272312
+ const { setSpatialLayerVisible: setVisible, setSpatialLayerOpacity: setOpacity2, setSpatialLayerOpacityUnselected, setObsColorEncoding, setFeatureColor, setFeatureFilterMode, setFeatureSelection, setFeatureValueColormap, setFeatureValueColormapRange, setSpatialLayerColor, setTooltipsVisible, setTooltipCrosshairsVisible, setLegendVisible, setSpatialPointStrokeWidth, setSpatialPointRadius } = setLayerCoordination;
272111
272313
  const label2 = spatialLayerLabel ?? capitalize$3(obsType);
272112
272314
  const visibleSetting = typeof visible === "boolean" ? visible : true;
272113
272315
  const Visibility$1 = useMemo$1(() => visibleSetting ? Visibility : VisibilityOff, [visibleSetting]);
@@ -272156,7 +272358,7 @@ function PointLayerController(props) {
272156
272358
  }, [featureSelection, obsColorEncoding, featureIndex, featureColor]);
272157
272359
  return jsxs(Grid$1, { className: lcClasses.layerControllerGrid, children: [jsxs(Paper, { elevation: 4, className: lcClasses.layerControllerRoot, children: [jsxs(Grid$1, { container: true, direction: "row", sx: [{
272158
272360
  justifyContent: "space-between"
272159
- }, channelRowContainerSx], children: [jsx$1(Grid$1, { size: 1, sx: channelControlCellSx, children: jsx$1(Button, { onClick: handleVisibleChange, className: menuClasses.imageLayerVisibleButton, "aria-label": "Toggle layer visibility", children: jsx$1(Visibility$1, {}) }) }), jsx$1(Grid$1, { size: 1, sx: channelControlCellSx, children: jsx$1(Tooltip$3, { title: colorTooltip ?? "", disableHoverListener: !colorTooltip, placement: "top", children: jsx$1("span", { children: jsx$1(ChannelColorPickerMenu, { theme, color: color2, setColor: colorEditable ? setColor2 : null, palette, isStaticColor, isColormap, featureValueColormap, visible }) }) }) }), jsx$1(Grid$1, { size: 6, sx: channelSelectorCellSx, children: jsx$1(Typography, { className: menuClasses.imageLayerName, title: label2, children: label2 }) }), jsx$1(Grid$1, { size: 2, sx: channelSliderCellSx, children: jsx$1(Slider, { value: opacity2, min: 0, max: 1, step: 1e-3, onChange: handleOpacityChange, className: menuClasses.imageLayerOpacitySlider, orientation: "horizontal", "aria-label": `Adjust opacity for layer ${label2}` }) }), jsx$1(Grid$1, { size: 1, sx: channelControlCellSx, children: jsx$1(PointLayerEllipsisMenu, { featureSelection, obsColorEncoding, setObsColorEncoding, featureValueColormapRange, setFeatureValueColormapRange, tooltipsVisible, setTooltipsVisible, tooltipCrosshairsVisible, setTooltipCrosshairsVisible, legendVisible, setLegendVisible, featureFilterMode, setFeatureFilterMode, featureValueColormap, setFeatureValueColormap }) }), jsxs(Grid$1, { size: 1, container: true, direction: "row", sx: channelControlCellSx, children: [jsx$1(SvgPoints, { className: classes2.layerTypePointIcon }), null] })] }), loadingDoneFraction < 1 ? jsx$1(Grid$1, { size: 12, container: true, className: classes2.pointFeatureControllerGrid, sx: {
272361
+ }, channelRowContainerSx], children: [jsx$1(Grid$1, { size: 1, sx: channelControlCellSx, children: jsx$1(Button, { onClick: handleVisibleChange, className: menuClasses.imageLayerVisibleButton, "aria-label": "Toggle layer visibility", children: jsx$1(Visibility$1, {}) }) }), jsx$1(Grid$1, { size: 1, sx: channelControlCellSx, children: jsx$1(Tooltip$3, { title: colorTooltip ?? "", disableHoverListener: !colorTooltip, placement: "top", children: jsx$1("span", { children: jsx$1(ChannelColorPickerMenu, { theme, color: color2, setColor: colorEditable ? setColor2 : null, palette, isStaticColor, isColormap, featureValueColormap, visible }) }) }) }), jsx$1(Grid$1, { size: 6, sx: channelSelectorCellSx, children: jsx$1(Typography, { className: menuClasses.imageLayerName, title: label2, children: label2 }) }), jsx$1(Grid$1, { size: 2, sx: channelSliderCellSx, children: jsx$1(Slider, { value: opacity2, min: 0, max: 1, step: 1e-3, onChange: handleOpacityChange, className: menuClasses.imageLayerOpacitySlider, orientation: "horizontal", "aria-label": `Adjust opacity for layer ${label2}` }) }), jsx$1(Grid$1, { size: 1, sx: channelControlCellSx, children: jsx$1(PointLayerEllipsisMenu, { featureSelection, obsColorEncoding, setObsColorEncoding, featureValueColormapRange, setFeatureValueColormapRange, tooltipsVisible, setTooltipsVisible, tooltipCrosshairsVisible, setTooltipCrosshairsVisible, legendVisible, setLegendVisible, featureFilterMode, setFeatureFilterMode, featureValueColormap, setFeatureValueColormap, strokeWidth: spatialPointStrokeWidth, setStrokeWidth: setSpatialPointStrokeWidth, pointRadius: spatialPointRadius, setpointRadius: setSpatialPointRadius }) }), jsxs(Grid$1, { size: 1, container: true, direction: "row", sx: channelControlCellSx, children: [jsx$1(SvgPoints, { className: classes2.layerTypePointIcon }), null] })] }), loadingDoneFraction < 1 ? jsx$1(Grid$1, { size: 12, container: true, className: classes2.pointFeatureControllerGrid, sx: {
272160
272362
  flexDirection: "column",
272161
272363
  justifyContent: "space-between"
272162
272364
  }, children: jsx$1(LinearProgress, { variant: loadingDoneFraction === 0 ? "indeterminate" : "determinate", value: loadingDoneFraction * 100 }) }) : null, null] }), layerPerFeatureForPoints && hasSelectedFeatures ? jsxs(Fragment, { children: [featureSelection.map((featureName) => jsx$1(LayerPerFeatureController, { theme, featureName, featureColor, setFeatureColor, spatialLayerColor, featureIndex, featureValueColormap, featureSelection, setFeatureSelection, obsColorEncoding, loadingDoneFraction }, featureName)), jsx$1(Grid$1, { className: lcClasses.layerControllerGrid, children: jsx$1(Paper, { elevation: 2, className: lcClasses.layerControllerSubRow, children: jsxs(Grid$1, { container: true, direction: "row", sx: {
@@ -272196,11 +272398,12 @@ function SegmentationChannelEllipsisMenu(props) {
272196
272398
  return jsxs(PopperMenu, { open: open2, setOpen, buttonIcon: jsx$1(MoreVertIcon, {}), buttonClassName: menuClasses.imageLayerMenuButton, containerClassName: menuClasses.imageLayerPopperContainer, withPaper: true, "aria-label": "Open segmentation channel options menu", children: [jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: filledId, children: "Filled: " }), jsx$1(Checkbox$1, { color: "primary", className: menuClasses.menuItemCheckbox, checked: filled, onChange: (e3, v) => setFilled(v), slotProps: { input: { id: filledId, "aria-label": "Toggle between filled and stroked segmentations" } } })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: strokeWidthId, children: "Stroke Width:" }), jsx$1(Slider, { disabled: filled, value: strokeWidth, min: 0.01, max: 5, step: 0.01, onChange: (e3, v) => setStrokeWidth(v), className: menuClasses.menuItemSlider, orientation: "horizontal", id: strokeWidthId, "aria-label": "Stroke width slider" })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: colorEncodingId, children: "Color Encoding: " }), jsxs(NativeSelect, { onChange: (e3) => setObsColorEncoding(e3.target.value), value: obsColorEncoding, inputProps: { id: colorEncodingId, "aria-label": "Color encoding selector" }, classes: { root: selectClasses2.selectRoot }, children: [jsx$1("option", { value: "spatialChannelColor", children: "Static Color" }), jsx$1("option", { value: "geneSelection", children: "Feature Value" }), jsx$1("option", { value: "cellSetSelection", children: "Set Selection" }), jsx$1("option", { value: "obsColors", children: "Per-observation Colors" })] })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: quantitativeColormapId, children: "Colormap: " }), jsx$1(NativeSelect, { onChange: (e3) => setFeatureValueColormap(e3.target.value), value: featureValueColormap, inputProps: { id: quantitativeColormapId, "aria-label": "Colormap selector" }, classes: { root: selectClasses2.selectRoot }, children: GLSL_COLORMAPS.map((cmap) => jsx$1("option", { value: cmap, children: cmap }, cmap)) })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: colormapRangeId, children: "Colormap Range: " }), jsx$1(Slider, { disabled: obsColorEncoding !== "geneSelection", value: featureValueColormapRange, min: 0, max: 1, step: 0.01, onChange: (e3, v) => setFeatureValueColormapRange(v), className: menuClasses.menuItemSlider, orientation: "horizontal", id: colormapRangeId, getAriaLabel: (index2) => index2 === 0 ? "Low value colormap range slider" : "High value colormap range slider" })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: tooltipsVisibleId, children: "Tooltips Visible: " }), jsx$1(Checkbox$1, { color: "primary", className: menuClasses.menuItemCheckbox, checked: tooltipsVisible, onChange: (e3, v) => setTooltipsVisible(v), slotProps: { input: { id: tooltipsVisibleId, "aria-label": "Toggle tooltip visibility" } } })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: crosshairsVisibleId, children: "Tooltip Crosshairs Visible: " }), jsx$1(Checkbox$1, { color: "primary", className: menuClasses.menuItemCheckbox, checked: tooltipCrosshairsVisible, onChange: (e3, v) => setTooltipCrosshairsVisible(v), slotProps: { input: { id: crosshairsVisibleId, "aria-label": "Toggle tooltip crosshair visibility" } } })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: legendVisibleId, children: "Legend Visible: " }), jsx$1(Checkbox$1, { color: "primary", className: menuClasses.menuItemCheckbox, checked: legendVisible, onChange: (e3, v) => setLegendVisible(v), slotProps: { input: { id: legendVisibleId, "aria-label": "Toggle legend visibility" } } })] })] });
272197
272399
  }
272198
272400
  function SegmentationChannelController(props) {
272199
- const { label: label2, theme, obsType, featureType, featureValueType, opacity: opacity2, setOpacity: setOpacity2, visible, setVisible, color: color2, setColor: setColor2, palette = null, filled, setFilled, strokeWidth, setStrokeWidth, featureSelection, obsColorEncoding, featureValueColormap, featureValueColormapRange, setObsColorEncoding, setFeatureValueColormap, setFeatureValueColormapRange, tooltipsVisible, setTooltipsVisible, tooltipCrosshairsVisible, setTooltipCrosshairsVisible, legendVisible, setLegendVisible } = props;
272401
+ const { label: label2, theme, obsType, featureType, featureValueType, opacity: opacity2, setOpacity: setOpacity2, visible, setVisible, color: color2, setColor: setColor2, palette = null, filled, setFilled, strokeWidth, setStrokeWidth, featureSelection, featureAggregationStrategy, setFeatureAggregationStrategy, obsColorEncoding, featureValueColormap, featureValueColormapRange, setObsColorEncoding, setFeatureValueColormap, setFeatureValueColormapRange, tooltipsVisible, setTooltipsVisible, tooltipCrosshairsVisible, setTooltipCrosshairsVisible, legendVisible, setLegendVisible } = props;
272200
272402
  const visibleSetting = typeof visible === "boolean" ? visible : true;
272201
272403
  const Visibility$1 = useMemo$1(() => visibleSetting ? Visibility : VisibilityOff, [visibleSetting]);
272202
272404
  const isStaticColor = obsColorEncoding === "spatialChannelColor";
272203
272405
  const isColormap = obsColorEncoding === "geneSelection";
272406
+ const hasMultipleFeaturesSelected = Array.isArray(featureSelection) && featureSelection.length > 1;
272204
272407
  const { classes: classes2 } = useStyles$e();
272205
272408
  const { classes: lcClasses } = useControllerSectionStyles();
272206
272409
  const { classes: menuClasses } = useEllipsisMenuStyles();
@@ -272209,9 +272412,9 @@ function SegmentationChannelController(props) {
272209
272412
  setVisible(nextVisible);
272210
272413
  }, [visible, setVisible]);
272211
272414
  const handleOpacityChange = useCallback((e3, v) => setOpacity2(v), [setOpacity2]);
272212
- return jsx$1(Grid$1, { className: lcClasses.layerControllerGrid, children: jsx$1(Paper, { elevation: 4, className: lcClasses.layerControllerRoot, children: jsxs(Grid$1, { container: true, direction: "row", sx: [{
272415
+ return jsxs(Fragment, { children: [jsx$1(Grid$1, { className: lcClasses.layerControllerGrid, children: jsx$1(Paper, { elevation: 4, className: lcClasses.layerControllerRoot, children: jsxs(Grid$1, { container: true, direction: "row", sx: [{
272213
272416
  justifyContent: "space-between"
272214
- }, channelRowContainerSx], children: [jsx$1(Grid$1, { size: 1, sx: channelControlCellSx, children: jsx$1(Button, { onClick: handleVisibleChange, className: menuClasses.imageLayerVisibleButton, "aria-label": "Toggle channel visibility", children: jsx$1(Visibility$1, {}) }) }), jsx$1(Grid$1, { size: 1, sx: channelControlCellSx, children: jsx$1(ChannelColorPickerMenu, { theme, color: color2, setColor: setColor2, palette, isStaticColor, isColormap, featureValueColormap, visible }) }), jsx$1(Grid$1, { size: 6, sx: channelSelectorCellSx, children: jsx$1(Typography, { className: clsx(menuClasses.imageLayerName, classes2.channelName), title: capitalize$3(label2), children: capitalize$3(label2) }) }), jsx$1(Grid$1, { size: 2, sx: channelSliderCellSx, children: jsx$1(Slider, { value: opacity2, min: 0, max: 1, step: 1e-3, onChange: handleOpacityChange, className: menuClasses.imageLayerOpacitySlider, orientation: "horizontal", "aria-label": `Adjust opacity for layer ${label2}` }) }), jsx$1(Grid$1, { size: 1, sx: channelControlCellSx, children: jsx$1(SegmentationChannelEllipsisMenu, { obsType, featureType, featureValueType, strokeWidth, setStrokeWidth, filled, setFilled, featureSelection, obsColorEncoding, setObsColorEncoding, featureValueColormap, setFeatureValueColormap, featureValueColormapRange, setFeatureValueColormapRange, tooltipsVisible, setTooltipsVisible, tooltipCrosshairsVisible, setTooltipCrosshairsVisible, legendVisible, setLegendVisible }) }), jsx$1(Grid$1, { size: 1, sx: channelControlCellSx, children: jsx$1(SvgVector, { className: classes2.layerTypeSegmentationIcon }) })] }) }) });
272417
+ }, channelRowContainerSx], children: [jsx$1(Grid$1, { size: 1, sx: channelControlCellSx, children: jsx$1(Button, { onClick: handleVisibleChange, className: menuClasses.imageLayerVisibleButton, "aria-label": "Toggle channel visibility", children: jsx$1(Visibility$1, {}) }) }), jsx$1(Grid$1, { size: 1, sx: channelControlCellSx, children: jsx$1(ChannelColorPickerMenu, { theme, color: color2, setColor: setColor2, palette, isStaticColor, isColormap, featureValueColormap, visible }) }), jsx$1(Grid$1, { size: 6, sx: channelSelectorCellSx, children: jsx$1(Typography, { className: clsx(menuClasses.imageLayerName, classes2.channelName), title: capitalize$3(label2), children: capitalize$3(label2) }) }), jsx$1(Grid$1, { size: 2, sx: channelSliderCellSx, children: jsx$1(Slider, { value: opacity2, min: 0, max: 1, step: 1e-3, onChange: handleOpacityChange, className: menuClasses.imageLayerOpacitySlider, orientation: "horizontal", "aria-label": `Adjust opacity for layer ${label2}` }) }), jsx$1(Grid$1, { size: 1, sx: channelControlCellSx, children: jsx$1(SegmentationChannelEllipsisMenu, { obsType, featureType, featureValueType, strokeWidth, setStrokeWidth, filled, setFilled, featureSelection, obsColorEncoding, setObsColorEncoding, featureValueColormap, setFeatureValueColormap, featureValueColormapRange, setFeatureValueColormapRange, tooltipsVisible, setTooltipsVisible, tooltipCrosshairsVisible, setTooltipCrosshairsVisible, legendVisible, setLegendVisible }) }), jsx$1(Grid$1, { size: 1, sx: channelControlCellSx, children: jsx$1(SvgVector, { className: classes2.layerTypeSegmentationIcon }) })] }) }) }), isColormap && hasMultipleFeaturesSelected ? jsx$1(SingleFeatureSelect, { featureSelection, featureAggregationStrategy, setFeatureAggregationStrategy }) : null] });
272215
272418
  }
272216
272419
  function SegmentationLayerController(props) {
272217
272420
  const { theme, layerScope, layerCoordination, setLayerCoordination, channelScopes, channelCoordination, setChannelCoordination } = props;
@@ -272219,10 +272422,10 @@ function SegmentationLayerController(props) {
272219
272422
  const { setSpatialLayerVisible, setSpatialLayerOpacity } = setLayerCoordination;
272220
272423
  const reversedChannelScopes = useMemo$1(() => [...channelScopes || []].reverse(), [channelScopes]);
272221
272424
  return jsx$1(Fragment, { children: reversedChannelScopes.map((cScope) => {
272222
- const { obsType, featureType, featureValueType, spatialChannelVisible, spatialChannelOpacity, spatialChannelColor: color2, spatialSegmentationFilled: filled, spatialSegmentationStrokeWidth: strokeWidth, obsColorEncoding, featureSelection, featureValueColormap, featureValueColormapRange, tooltipsVisible, tooltipCrosshairsVisible, legendVisible } = channelCoordination[cScope];
272223
- const { setSpatialChannelVisible, setSpatialChannelOpacity, setSpatialChannelColor: setColor2, setSpatialSegmentationFilled: setFilled, setSpatialSegmentationStrokeWidth: setStrokeWidth, setObsColorEncoding, setFeatureValueColormap, setFeatureValueColormapRange, setTooltipsVisible, setTooltipCrosshairsVisible, setLegendVisible } = setChannelCoordination[cScope];
272425
+ const { obsType, featureType, featureValueType, spatialChannelVisible, spatialChannelOpacity, spatialChannelColor: color2, spatialSegmentationFilled: filled, spatialSegmentationStrokeWidth: strokeWidth, obsColorEncoding, featureSelection, featureAggregationStrategy, featureValueColormap, featureValueColormapRange, tooltipsVisible, tooltipCrosshairsVisible, legendVisible } = channelCoordination[cScope];
272426
+ const { setSpatialChannelVisible, setSpatialChannelOpacity, setSpatialChannelColor: setColor2, setSpatialSegmentationFilled: setFilled, setSpatialSegmentationStrokeWidth: setStrokeWidth, setObsColorEncoding, setFeatureAggregationStrategy, setFeatureValueColormap, setFeatureValueColormapRange, setTooltipsVisible, setTooltipCrosshairsVisible, setLegendVisible } = setChannelCoordination[cScope];
272224
272427
  const obsTypeName = spatialLayerLabel ?? obsType;
272225
- return jsx$1(SegmentationChannelController, { theme, layerScope, label: obsTypeName, obsType, featureType, featureValueType, opacity: spatialChannelOpacity, setOpacity: setSpatialChannelOpacity, visible: spatialChannelVisible, setVisible: setSpatialChannelVisible, color: color2, setColor: setColor2, filled, setFilled, strokeWidth, setStrokeWidth, obsColorEncoding, featureSelection, featureValueColormap, featureValueColormapRange, setObsColorEncoding, setFeatureValueColormap, setFeatureValueColormapRange, tooltipsVisible, setTooltipsVisible, tooltipCrosshairsVisible, setTooltipCrosshairsVisible, legendVisible, setLegendVisible }, `${layerScope}-${cScope}`);
272428
+ return jsx$1(SegmentationChannelController, { theme, layerScope, label: obsTypeName, obsType, featureType, featureValueType, opacity: spatialChannelOpacity, setOpacity: setSpatialChannelOpacity, visible: spatialChannelVisible, setVisible: setSpatialChannelVisible, color: color2, setColor: setColor2, filled, setFilled, strokeWidth, setStrokeWidth, obsColorEncoding, featureSelection, featureAggregationStrategy, setFeatureAggregationStrategy, featureValueColormap, featureValueColormapRange, setObsColorEncoding, setFeatureValueColormap, setFeatureValueColormapRange, tooltipsVisible, setTooltipsVisible, tooltipCrosshairsVisible, setTooltipCrosshairsVisible, legendVisible, setLegendVisible }, `${layerScope}-${cScope}`);
272226
272429
  }) });
272227
272430
  }
272228
272431
  var Subscribable = class {
@@ -273876,12 +274079,12 @@ function GlobalDimensionSlider(props) {
273876
274079
  }
273877
274080
  return jsx$1(Grid$1, { className: lcClasses.layerControllerGrid, children: jsx$1(Paper, { elevation: 4, className: lcClasses.layerControllerRoot, children: jsxs(Grid$1, { container: true, direction: "row", sx: [{
273878
274081
  justifyContent: "space-between"
273879
- }, channelRowContainerSx], children: [jsx$1(Grid$1, { size: 1, sx: channelControlCellSx, children: jsx$1(SvgDimensions, { className: classes2.dimensionsIcon }) }), jsx$1(Grid$1, { size: 1, sx: channelSelectorCellSx, children: jsx$1(Typography, { className: classes2.dimensionLabel, children: label2 }) }), jsx$1(Grid$1, { size: 8, sx: channelSliderCellSx, children: !is3dMode ? jsx$1(Slider, { value: targetValue, min: min2, max: max2, step: 1, onChange: (e3, v) => setTargetValue(v), className: classes2.dimensionSlider, valueLabelDisplay: "auto", orientation: "horizontal", disabled: spatialRenderingMode === "3D", "aria-label": `${label2}-slice slider` }) : null }), jsx$1(Grid$1, { size: 2, sx: channelControlCellSx, children: isForZ && enable3d ? jsx$1(FormGroup, { row: true, className: classes2.switchFormGroup, children: jsx$1(FormControlLabel$1, { control: jsx$1(Switch, { color: "primary", checked: spatialRenderingMode === "3D", onChange: handleRenderingModeChange, name: "is3dMode" }), label: "3D" }) }) : null })] }) }) });
274082
+ }, channelRowContainerSx], children: [jsx$1(Grid$1, { size: 1, sx: channelControlCellSx, children: jsx$1(SvgDimensions, { className: classes2.dimensionsIcon }) }), jsx$1(Grid$1, { size: 1, sx: channelSelectorCellSx, children: jsx$1(Typography, { className: classes2.dimensionLabel, children: label2 }) }), jsx$1(Grid$1, { size: 8, sx: channelSliderCellSx, children: !is3dMode && max2 > min2 ? jsx$1(Slider, { value: targetValue, min: min2, max: max2, step: 1, onChange: (e3, v) => setTargetValue(v), className: classes2.dimensionSlider, valueLabelDisplay: "auto", orientation: "horizontal", disabled: spatialRenderingMode === "3D", "aria-label": `${label2}-slice slider` }) : null }), jsx$1(Grid$1, { size: 2, sx: channelControlCellSx, children: isForZ && enable3d ? jsx$1(FormGroup, { row: true, className: classes2.switchFormGroup, children: jsx$1(FormControlLabel$1, { control: jsx$1(Switch, { color: "primary", checked: spatialRenderingMode === "3D", onChange: handleRenderingModeChange, name: "is3dMode" }), label: "3D" }) }) : null })] }) }) });
273880
274083
  }
273881
274084
  function LayerController(props) {
273882
- const { theme, coordinationScopesRaw, segmentationLayerScopes, segmentationLayerCoordination, segmentationChannelScopesByLayer, segmentationChannelCoordination, images, imageLayerScopes, imageLayerCoordination, targetT, targetZ, setTargetT, setTargetZ, spatialRenderingMode, setSpatialRenderingMode, imageChannelScopesByLayer, imageChannelCoordination, spotLayerScopes, spotLayerCoordination, pointLayerScopes, pointLayerCoordination, pointMultiIndicesData, volumeLoadingStatus, tiledPointsLoadingProgress, layerPerFeatureForPoints, globalDisable3d } = props;
274085
+ const { theme, coordinationScopesRaw, segmentationLayerScopes, segmentationLayerCoordination, segmentationChannelScopesByLayer, segmentationChannelCoordination, images, imageLayerScopes, imageLayerCoordination, targetT, targetZ, setTargetT, setTargetZ, spatialRenderingMode, setSpatialRenderingMode, imageChannelScopesByLayer, imageChannelCoordination, spotLayerScopes, spotLayerCoordination, pointLayerScopes, pointLayerCoordination, pointMultiIndicesData, volumeLoadingStatus, tiledPointsLoadingProgress, layerPerFeatureForPoints, globalDisable3d, forceEnable3d } = props;
273883
274086
  const anyLayerHasT = Object.values(images || {}).some((image2) => image2?.image?.instance.hasTStack());
273884
- const anyLayerHasZ = Object.values(images || {}).some((image2) => image2?.image?.instance.hasZStack());
274087
+ const anyLayerHasZ = forceEnable3d || Object.values(images || {}).some((image2) => image2?.image?.instance.hasZStack());
273885
274088
  const maxT = Object.values(images || {}).reduce((a2, h2) => Math.max(a2, h2?.image?.instance.getNumT()), 1) - 1;
273886
274089
  const maxZ = Object.values(images || {}).reduce((a2, h2) => Math.max(a2, h2?.image?.instance.getNumZ()), 1) - 1;
273887
274090
  const reversedImageLayerScopes = useMemo$1(() => [...imageLayerScopes || []].reverse(), [imageLayerScopes]);
@@ -273891,12 +274094,12 @@ function LayerController(props) {
273891
274094
  return jsxs("div", { children: [anyLayerHasZ ? jsx$1(GlobalDimensionSlider, { label: "Z", targetValue: targetZ, setTargetValue: setTargetZ, max: maxZ, spatialRenderingMode, setSpatialRenderingMode, enable3d: !globalDisable3d }) : null, anyLayerHasT ? jsx$1(GlobalDimensionSlider, { label: "T", targetValue: targetT, setTargetValue: setTargetT, max: maxT }) : null, pointLayerScopes && reversedPointLayerScopes.map((layerScope) => jsx$1(PointLayerController, { theme, layerScope, layerCoordination: pointLayerCoordination[0][layerScope], setLayerCoordination: pointLayerCoordination[1][layerScope], pointMatrixIndicesData: pointMultiIndicesData?.[layerScope], tiledPointsLoadingProgress, layerPerFeatureForPoints }, layerScope)), spotLayerScopes && reversedSpotLayerScopes.map((layerScope) => jsx$1(SpotLayerController, { theme, layerScope, layerCoordination: spotLayerCoordination[0][layerScope], setLayerCoordination: spotLayerCoordination[1][layerScope] }, layerScope)), segmentationLayerScopes && reversedSegmentationLayerScopes.map((layerScope) => jsx$1(SegmentationLayerController, { theme, layerScope, layerCoordination: segmentationLayerCoordination[0][layerScope], setLayerCoordination: segmentationLayerCoordination[1][layerScope], channelScopes: segmentationChannelScopesByLayer[layerScope], channelCoordination: segmentationChannelCoordination[0][layerScope], setChannelCoordination: segmentationChannelCoordination[1][layerScope] }, layerScope)), imageLayerScopes && reversedImageLayerScopes.map((layerScope) => jsx$1(ImageLayerController, { theme, coordinationScopesRaw, layerScope, layerCoordination: imageLayerCoordination[0][layerScope], setLayerCoordination: imageLayerCoordination[1][layerScope], channelScopes: imageChannelScopesByLayer[layerScope], channelCoordination: imageChannelCoordination[0][layerScope], setChannelCoordination: imageChannelCoordination[1][layerScope], image: images[layerScope]?.image?.instance, featureIndex: images[layerScope]?.featureIndex, targetT, targetZ, spatialRenderingMode, volumeLoadingProgress: volumeLoadingStatus?.loadingProgress, onStopVolumeLoading: volumeLoadingStatus?.onStopLoading, onRestartVolumeLoading: volumeLoadingStatus?.onRestartLoading, volumeStillRef: volumeLoadingStatus?.stillRef }, layerScope))] });
273892
274095
  }
273893
274096
  function LayerControllerSubscriber(props) {
273894
- const { coordinationScopes: coordinationScopesRaw, coordinationScopesBy: coordinationScopesByRaw, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, title: title2 = "Spatial Layers", uuid: uuid2, layerPerFeatureForPoints = false, globalDisable3d = false, cameraPresets, helpText = ViewHelpMapping.LAYER_CONTROLLER_BETA } = props;
274097
+ const { coordinationScopes: coordinationScopesRaw, coordinationScopesBy: coordinationScopesByRaw, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, title: title2 = "Spatial Layers", uuid: uuid2, layerPerFeatureForPoints = false, globalDisable3d = false, forceEnable3d = false, cameraPresets, helpText = ViewHelpMapping.LAYER_CONTROLLER_BETA, showViewerOptions = false } = props;
273895
274098
  const loaders = useLoaders();
273896
274099
  const mergeCoordination = useMergeCoordination();
273897
274100
  const coordinationScopes = useCoordinationScopes(coordinationScopesRaw);
273898
274101
  const coordinationScopesBy = useCoordinationScopesBy(coordinationScopes, coordinationScopesByRaw);
273899
- const [{ dataset, spatialTargetT: targetT, spatialTargetZ: targetZ, spatialRenderingMode }, { setSpatialTargetX: setTargetX, setSpatialTargetY: setTargetY, setSpatialTargetZ: setTargetZ, setSpatialTargetT: setTargetT, setSpatialRotationX: setRotationX, setSpatialRotationOrbit: setRotationOrbit, setSpatialZoom: setZoom, setSpatialRenderingMode }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$1.LAYER_CONTROLLER_BETA], coordinationScopes);
274102
+ const [{ dataset, spatialTargetT: targetT, spatialTargetZ: targetZ, spatialRenderingMode, spatialAxisLinesVisible, spatialBoundsVisible }, { setSpatialTargetX: setTargetX, setSpatialTargetY: setTargetY, setSpatialTargetZ: setTargetZ, setSpatialTargetT: setTargetT, setSpatialRotationX: setRotationX, setSpatialRotationOrbit: setRotationOrbit, setSpatialZoom: setZoom, setSpatialRenderingMode, setSpatialAxisLinesVisible, setSpatialBoundsVisible }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$1.LAYER_CONTROLLER_BETA], coordinationScopes);
273900
274103
  const applyPreset = useCallback((preset) => {
273901
274104
  if (!preset)
273902
274105
  return;
@@ -273956,6 +274159,7 @@ function LayerControllerSubscriber(props) {
273956
274159
  CoordinationType$1.SPATIAL_SEGMENTATION_STROKE_WIDTH,
273957
274160
  CoordinationType$1.OBS_COLOR_ENCODING,
273958
274161
  CoordinationType$1.FEATURE_SELECTION,
274162
+ CoordinationType$1.FEATURE_AGGREGATION_STRATEGY,
273959
274163
  CoordinationType$1.FEATURE_VALUE_COLORMAP,
273960
274164
  CoordinationType$1.FEATURE_VALUE_COLORMAP_RANGE,
273961
274165
  CoordinationType$1.TOOLTIPS_VISIBLE,
@@ -274001,6 +274205,7 @@ function LayerControllerSubscriber(props) {
274001
274205
  CoordinationType$1.SPATIAL_SPOT_STROKE_WIDTH,
274002
274206
  CoordinationType$1.OBS_COLOR_ENCODING,
274003
274207
  CoordinationType$1.FEATURE_SELECTION,
274208
+ CoordinationType$1.FEATURE_AGGREGATION_STRATEGY,
274004
274209
  CoordinationType$1.FEATURE_VALUE_COLORMAP,
274005
274210
  CoordinationType$1.FEATURE_VALUE_COLORMAP_RANGE,
274006
274211
  CoordinationType$1.SPATIAL_LAYER_COLOR,
@@ -274024,7 +274229,9 @@ function LayerControllerSubscriber(props) {
274024
274229
  CoordinationType$1.SPATIAL_LAYER_COLOR,
274025
274230
  CoordinationType$1.TOOLTIPS_VISIBLE,
274026
274231
  CoordinationType$1.TOOLTIP_CROSSHAIRS_VISIBLE,
274027
- CoordinationType$1.LEGEND_VISIBLE
274232
+ CoordinationType$1.LEGEND_VISIBLE,
274233
+ CoordinationType$1.SPATIAL_POINT_STROKE_WIDTH,
274234
+ CoordinationType$1.SPATIAL_POINT_RADIUS
274028
274235
  ], coordinationScopes, coordinationScopesBy, CoordinationType$1.POINT_LAYER);
274029
274236
  const [{ volumeLoadingProgress: volumeLoadingStatus, tiledPointsLoadingProgress }] = useAuxiliaryCoordination([
274030
274237
  "spatialAcceleratedVolumeLoadingProgress",
@@ -274053,7 +274260,7 @@ function LayerControllerSubscriber(props) {
274053
274260
  imageDataStatus,
274054
274261
  pointMultiIndicesDataStatus
274055
274262
  ]);
274056
- return jsx$1(TitleInfo, { title: title2, isScroll: true, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, isReady, errors, helpText, children: jsx$1(LayerController, { theme, coordinationScopesRaw, segmentationLayerScopes, segmentationLayerCoordination, segmentationChannelScopesByLayer, segmentationChannelCoordination, images: imageData, imageLayerScopes, imageLayerCoordination, targetT, targetZ, setTargetT, setTargetZ, spatialRenderingMode, setSpatialRenderingMode, imageChannelScopesByLayer, imageChannelCoordination, spotLayerScopes, spotLayerCoordination, pointLayerScopes, pointLayerCoordination, pointMultiIndicesData, layerPerFeatureForPoints, globalDisable3d, volumeLoadingStatus, tiledPointsLoadingProgress }) });
274263
+ return jsx$1(TitleInfo, { title: title2, isScroll: true, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, isReady, errors, helpText, children: jsx$1(LayerController, { theme, coordinationScopesRaw, segmentationLayerScopes, segmentationLayerCoordination, segmentationChannelScopesByLayer, segmentationChannelCoordination, images: imageData, imageLayerScopes, imageLayerCoordination, targetT, targetZ, setTargetT, setTargetZ, spatialRenderingMode, setSpatialRenderingMode, imageChannelScopesByLayer, imageChannelCoordination, spotLayerScopes, spotLayerCoordination, pointLayerScopes, pointLayerCoordination, pointMultiIndicesData, layerPerFeatureForPoints, globalDisable3d, forceEnable3d, volumeLoadingStatus, tiledPointsLoadingProgress }) });
274057
274264
  }
274058
274265
  const isIterable$2 = (obj) => Symbol.iterator in obj;
274059
274266
  const hasIterableEntries = (value2) => (
@@ -274533,6 +274740,7 @@ const CAPTURE_CATEGORIES = [
274533
274740
  coordinationTypes: [
274534
274741
  CT.SPOT_LAYER,
274535
274742
  CT.SPATIAL_SPOT_RADIUS,
274743
+ CT.SPATIAL_SPOT_SHAPE,
274536
274744
  CT.SPATIAL_SPOT_FILLED,
274537
274745
  CT.SPATIAL_SPOT_STROKE_WIDTH,
274538
274746
  ...SHARED_SPATIAL_LAYER_TYPES
@@ -277513,7 +277721,7 @@ function HiglassGlobalStyles(props) {
277513
277721
  }
277514
277722
  register({ dataFetcher: ZarrMultivecDataFetcher_default, config: ZarrMultivecDataFetcher_default.config }, { pluginType: "dataFetcher" });
277515
277723
  const LazyHiGlassComponent = React__default.lazy(async () => {
277516
- const { HiGlassComponent } = await import("./higlass-CAqsuvzB.js");
277724
+ const { HiGlassComponent } = await import("./higlass-B8HiKDgZ.js");
277517
277725
  return { default: HiGlassComponent };
277518
277726
  });
277519
277727
  const HG_SIZE = 800;
@@ -280468,10 +280676,16 @@ function NeuroglancerGlobalStyles(props) {
280468
280676
  const { classes: classes2 } = props;
280469
280677
  return jsxs(Fragment, { children: [jsx$1(GlobalStyles$3, { styles: globalNeuroglancerCss }), jsx$1(ScopedGlobalStyles, { styles: globalNeuroglancerStyles, parentClassName: classes2.neuroglancerWrapper })] });
280470
280678
  }
280471
- const LazyReactNeuroglancer = React__default.lazy(() => import("./ReactNeuroglancer-9V3VAS-Y.js"));
280679
+ const LazyReactNeuroglancer = React__default.lazy(() => import("./ReactNeuroglancer-D2Sm_o8g.js"));
280472
280680
  function createWorker() {
280473
280681
  const worker = new WorkerFactory$1();
280474
- worker.AsyncComputationWorker = WorkerFactory;
280682
+ const asyncWorkers = [];
280683
+ worker.AsyncComputationWorker = function TrackedAsyncComputationWorker() {
280684
+ const w2 = new WorkerFactory();
280685
+ asyncWorkers.push(w2);
280686
+ return w2;
280687
+ };
280688
+ worker.asyncWorkers = asyncWorkers;
280475
280689
  return worker;
280476
280690
  }
280477
280691
  function getPickedAnnotationLayerName(viewer, mouseState) {
@@ -280531,6 +280745,7 @@ class NeuroglancerComp extends PureComponent {
280531
280745
  const { onViewerReady } = this.props;
280532
280746
  this.prevHoverHandler = () => {
280533
280747
  const ms = viewer.mouseState;
280748
+ const hoverCoord = ms.active && ms.position?.length >= 3 ? [ms.position[0], ms.position[1], ms.position[2]] : null;
280534
280749
  const { getMeshIdToCellId, centroidAnnotationUrlsByLayerName, decodeCentroidById } = this.props;
280535
280750
  if (ms.pickedAnnotationId != null) {
280536
280751
  const layerName = getPickedAnnotationLayerName(viewer, ms);
@@ -280547,7 +280762,7 @@ class NeuroglancerComp extends PureComponent {
280547
280762
  return;
280548
280763
  }
280549
280764
  const cellId = getMeshIdToCellId?.(actualMeshId) ?? actualMeshId;
280550
- this.latestOnSelectHoveredCoords?.(cellId);
280765
+ this.latestOnSelectHoveredCoords?.(cellId, hoverCoord);
280551
280766
  }).catch(() => {
280552
280767
  });
280553
280768
  return;
@@ -280555,7 +280770,7 @@ class NeuroglancerComp extends PureComponent {
280555
280770
  if (ms.pickedValue !== void 0 && ms.pickedValue !== null) {
280556
280771
  const meshId = String(ms.pickedValue?.low);
280557
280772
  const cellId = getMeshIdToCellId?.(meshId) ?? meshId;
280558
- this.latestOnSelectHoveredCoords?.(cellId);
280773
+ this.latestOnSelectHoveredCoords?.(cellId, hoverCoord);
280559
280774
  return;
280560
280775
  }
280561
280776
  this.latestOnSelectHoveredCoords?.(null);
@@ -280588,13 +280803,19 @@ class NeuroglancerComp extends PureComponent {
280588
280803
  this.setState({ bundleRootReady: true });
280589
280804
  }
280590
280805
  componentWillUnmount() {
280806
+ this.bundleRoot?.asyncWorkers?.forEach((w2) => {
280807
+ try {
280808
+ w2.terminate();
280809
+ } catch {
280810
+ }
280811
+ });
280591
280812
  this.bundleRoot?.terminate();
280592
280813
  this.bundleRoot = null;
280593
280814
  }
280594
280815
  render() {
280595
- const { classes: classes2, viewerState, cellColorMapping, onLayerLoadingChange, onAnnotationSourceReady, onViewerReady, allowEmptySegments } = this.props;
280816
+ const { classes: classes2, viewerState, cellColorMapping, onLayerLoadingChange, onAnnotationSourceReady, onViewerReady, allowEmptySegments, axisLinesVisible, boundsVisible, orthographic: orthographic2, scaleBarVisible, cameraResetRequest, backgroundTheme } = this.props;
280596
280817
  const { bundleRootReady } = this.state;
280597
- return jsxs(Fragment, { children: [jsx$1(NeuroglancerGlobalStyles, { classes: classes2 }), jsx$1("div", { className: classes2.neuroglancerWrapper, children: jsx$1(Suspense, { fallback: jsx$1("div", { children: "Loading..." }), children: bundleRootReady && jsx$1(LazyReactNeuroglancer, { brainMapsClientId: "NOT_A_VALID_ID", viewerState, onViewerStateChanged: this.onViewerStateChanged, onLayerLoadingChange, bundleRoot: this.bundleRoot, cellColorMapping, ref: this.onRef, onAnnotationSourceReady, onViewerReady, allowEmptySegments }) }) })] });
280818
+ return jsxs(Fragment, { children: [jsx$1(NeuroglancerGlobalStyles, { classes: classes2 }), jsx$1("div", { className: classes2.neuroglancerWrapper, children: jsx$1(Suspense, { fallback: jsx$1("div", { children: "Loading..." }), children: bundleRootReady && jsx$1(LazyReactNeuroglancer, { brainMapsClientId: "NOT_A_VALID_ID", viewerState, onViewerStateChanged: this.onViewerStateChanged, onLayerLoadingChange, bundleRoot: this.bundleRoot, cellColorMapping, ref: this.onRef, onAnnotationSourceReady, onViewerReady, allowEmptySegments, axisLinesVisible, boundsVisible, orthographic: orthographic2, scaleBarVisible, cameraResetRequest, backgroundTheme }) }) })] });
280598
280819
  }
280599
280820
  }
280600
280821
  function customIsEqualForCellColors(prevDeps, nextDeps) {
@@ -280629,7 +280850,8 @@ function customIsEqualForCellColors(prevDeps, nextDeps) {
280629
280850
  "spatialChannelOpacity",
280630
280851
  "featureValueColormap",
280631
280852
  "featureValueColormapRange",
280632
- "featureSelection"
280853
+ "featureSelection",
280854
+ "spatialLayerOpacityUnselected"
280633
280855
  ]) || curriedShallowDiffByChannel("segmentationMultiIndicesData", layerScope, channelScope) || curriedShallowDiffByChannel("segmentationMultiExpressionNormData", layerScope, channelScope)) {
280634
280856
  forceUpdate = true;
280635
280857
  }
@@ -280673,7 +280895,8 @@ function customIsEqualForInitialViewerState(prevDeps, nextDeps) {
280673
280895
  "featureValueColormapRange",
280674
280896
  "obsSetColor",
280675
280897
  "obsSetSelection",
280676
- "additionalObsSets"
280898
+ "additionalObsSets",
280899
+ "spatialSegmentationStrokeWidth"
280677
280900
  ]);
280678
280901
  const opacityChanged = Math.abs(getOpacity2(prevDeps) - getOpacity2(nextDeps)) >= 0.05;
280679
280902
  if (keysChanged || opacityChanged) {
@@ -280702,7 +280925,9 @@ function customIsEqualForInitialViewerState(prevDeps, nextDeps) {
280702
280925
  "featureValueColormapRange",
280703
280926
  "obsSetColor",
280704
280927
  "obsSetSelection",
280705
- "additionalObsSets"
280928
+ "additionalObsSets",
280929
+ "spatialPointProjectionSpacing",
280930
+ "spatialPointRadius"
280706
280931
  ]);
280707
280932
  const opacityChanged = Math.abs((prevLayer?.spatialLayerOpacity ?? 1) - (nextLayer?.spatialLayerOpacity ?? 1)) >= 0.05;
280708
280933
  const unselectedChanged = Math.abs((prevLayer?.spatialLayerOpacityUnselected ?? 0.25) - (nextLayer?.spatialLayerOpacityUnselected ?? 0.25)) >= 0.05;
@@ -280713,6 +280938,213 @@ function customIsEqualForInitialViewerState(prevDeps, nextDeps) {
280713
280938
  }
280714
280939
  return !forceUpdate;
280715
280940
  }
280941
+ const ANNOTATION_HEADER_OFFSET = 8;
280942
+ function ngMetersPerUnit(dimensions) {
280943
+ if (!dimensions?.x)
280944
+ return null;
280945
+ const [scale2, unit2] = dimensions.x;
280946
+ const factor = UNIT_TO_METERS[unit2];
280947
+ return factor ? scale2 * factor : null;
280948
+ }
280949
+ const GREY_HEX = "#323232";
280950
+ const EPSILON_KEYS_MAPPING_NG = {
280951
+ projectionScale: 5,
280952
+ projectionOrientation: 0.02,
280953
+ position: 1
280954
+ };
280955
+ const SOFT_POS_FACTOR = 0.15;
280956
+ const Q_Y_UP = [1, 0, 0, 0];
280957
+ const multiplyQuat = (a2, b2) => {
280958
+ const [ax, ay, az, aw] = a2;
280959
+ const [bx, by, bz, bw] = b2;
280960
+ return [
280961
+ aw * bx + ax * bw + ay * bz - az * by,
280962
+ aw * by - ax * bz + ay * bw + az * bx,
280963
+ aw * bz + ax * by - ay * bx + az * bw,
280964
+ aw * bw - ax * bx - ay * by - az * bz
280965
+ ];
280966
+ };
280967
+ const deg2rad = (d) => d * Math.PI / 180;
280968
+ const isFiniteNumberArray = (value2, length2) => Array.isArray(value2) && value2.length === length2 && value2.every(Number.isFinite);
280969
+ function isValidNgPosition(position2) {
280970
+ return isFiniteNumberArray(position2, 3);
280971
+ }
280972
+ function isValidNgOrientation(orientation) {
280973
+ return isFiniteNumberArray(orientation, 4) && orientation.some((v) => v !== 0);
280974
+ }
280975
+ function isValidNgScale(scale2) {
280976
+ return Number.isFinite(scale2) && scale2 > 0;
280977
+ }
280978
+ const NG_CAMERA_VALIDATORS = {
280979
+ position: isValidNgPosition,
280980
+ projectionOrientation: isValidNgOrientation,
280981
+ projectionScale: isValidNgScale,
280982
+ crossSectionScale: isValidNgScale
280983
+ };
280984
+ function applyColormap(colormap, t4) {
280985
+ const tClamped = Math.max(0, Math.min(1, t4));
280986
+ const interpolators = {
280987
+ plasma: interpolatePlasma,
280988
+ viridis: interpolateViridis,
280989
+ jet: interpolateJet,
280990
+ greys: interpolateGreys
280991
+ };
280992
+ const fn2 = interpolators[colormap] ?? interpolateViridis;
280993
+ return fn2(tClamped);
280994
+ }
280995
+ function valueGreaterThanEpsilon(a2, b2, epsilon3) {
280996
+ if (Array.isArray(a2) && Array.isArray(b2) && a2.length === b2.length) {
280997
+ return a2.some((val, i2) => Math.abs(val - b2[i2]) > epsilon3);
280998
+ }
280999
+ if (typeof a2 === "number" && typeof b2 === "number") {
281000
+ return Math.abs(a2 - b2) > epsilon3;
281001
+ }
281002
+ return void 0;
281003
+ }
281004
+ const nearEq = (a2, b2, epsilon3) => Number.isFinite(a2) && Number.isFinite(b2) ? Math.abs(a2 - b2) <= epsilon3 : a2 === b2;
281005
+ function diffCameraState(prev2, next4) {
281006
+ const eps = EPSILON_KEYS_MAPPING_NG;
281007
+ const scale2 = valueGreaterThanEpsilon(prev2?.projectionScale, next4?.projectionScale, eps.projectionScale);
281008
+ const posHard = valueGreaterThanEpsilon(prev2?.position, next4?.position, eps.position);
281009
+ const rot2 = valueGreaterThanEpsilon(prev2?.projectionOrientation, next4?.projectionOrientation, eps.projectionOrientation);
281010
+ const posSoft = !posHard && scale2 && valueGreaterThanEpsilon(prev2?.position, next4?.position, SOFT_POS_FACTOR);
281011
+ const pos = posHard || posSoft;
281012
+ return { changed: scale2 || pos || rot2, scale: scale2, pos, rot: rot2 };
281013
+ }
281014
+ function eulerToQuaternion(pitch, yaw, roll = 0) {
281015
+ const c1 = Math.cos(pitch / 2);
281016
+ const c2 = Math.cos(yaw / 2);
281017
+ const c3 = Math.cos(roll / 2);
281018
+ const s1 = Math.sin(pitch / 2);
281019
+ const s2 = Math.sin(yaw / 2);
281020
+ const s3 = Math.sin(roll / 2);
281021
+ return [
281022
+ s1 * c2 * c3 + c1 * s2 * s3,
281023
+ c1 * s2 * c3 - s1 * c2 * s3,
281024
+ c1 * c2 * s3 - s1 * s2 * c3,
281025
+ c1 * c2 * c3 + s1 * s2 * s3
281026
+ ];
281027
+ }
281028
+ function applyQuat(q, v) {
281029
+ const [qx, qy, qz, qw] = q;
281030
+ const [vx, vy, vz] = v;
281031
+ const tx2 = 2 * (qy * vz - qz * vy);
281032
+ const ty = 2 * (qz * vx - qx * vz);
281033
+ const tz = 2 * (qx * vy - qy * vx);
281034
+ return [
281035
+ vx + qw * tx2 + qy * tz - qz * ty,
281036
+ vy + qw * ty + qz * tx2 - qx * tz,
281037
+ vz + qw * tz + qx * ty - qy * tx2
281038
+ ];
281039
+ }
281040
+ function getAnnotationPropertyIndices(info2, { segmentIdProp } = {}) {
281041
+ const propertyIds = (info2?.properties ?? []).map((p) => p.id);
281042
+ const resolvedSegmentIdProp = segmentIdProp ?? (propertyIds.includes("id") ? "id" : null);
281043
+ return {
281044
+ propertyIds,
281045
+ segmentIdProp: resolvedSegmentIdProp,
281046
+ segmentIdIndex: resolvedSegmentIdProp ? propertyIds.indexOf(resolvedSegmentIdProp) : -1
281047
+ };
281048
+ }
281049
+ function toNamedProperties(propertyIds, values3) {
281050
+ const named2 = {};
281051
+ propertyIds.forEach((name2, k) => {
281052
+ named2[name2] = values3[k];
281053
+ });
281054
+ return named2;
281055
+ }
281056
+ function parseAnnotationChunkSegmentsWithPositions(buffer2, serializer2, layout) {
281057
+ const dv = new DataView(buffer2);
281058
+ if (buffer2.byteLength <= 8)
281059
+ return [];
281060
+ const { propertyIds = [], segmentIdIndex } = layout ?? {};
281061
+ if (!(segmentIdIndex >= 0))
281062
+ return [];
281063
+ const count2 = dv.getUint32(0, true);
281064
+ if (count2 === 0 || dv.getUint32(4, true) !== 0)
281065
+ return [];
281066
+ const geometryStride = serializer2.propertyGroupBytes?.[0] ?? serializer2.serializedBytes;
281067
+ const values3 = new Array(propertyIds.length).fill(null);
281068
+ const results = [];
281069
+ for (let i2 = 0; i2 < count2; i2++) {
281070
+ serializer2.deserialize(dv, ANNOTATION_HEADER_OFFSET, i2, count2, true, values3);
281071
+ const segId = values3[segmentIdIndex];
281072
+ if (segId > 0) {
281073
+ const propBase = ANNOTATION_HEADER_OFFSET + i2 * geometryStride;
281074
+ const x2 = dv.getFloat32(propBase + 0, true);
281075
+ const y2 = dv.getFloat32(propBase + 4, true);
281076
+ const z2 = dv.getFloat32(propBase + 8, true);
281077
+ if (x2 !== 0 || y2 !== 0 || z2 !== 0) {
281078
+ results.push({
281079
+ id: String(segId),
281080
+ // value of segmentIdProp: used for the NG segments array
281081
+ x: x2,
281082
+ y: y2,
281083
+ z: z2,
281084
+ properties: toNamedProperties(propertyIds, values3)
281085
+ });
281086
+ }
281087
+ }
281088
+ }
281089
+ return results;
281090
+ }
281091
+ function parseAnnotationById(buffer2, serializer2, layout) {
281092
+ const { propertyIds = [], segmentIdIndex } = layout ?? {};
281093
+ if (!(segmentIdIndex >= 0) || !buffer2 || !serializer2 || buffer2.byteLength < serializer2.serializedBytes)
281094
+ return null;
281095
+ const values3 = new Array(propertyIds.length).fill(null);
281096
+ serializer2.deserialize(new DataView(buffer2), 0, 0, 1, true, values3);
281097
+ const segId = values3[segmentIdIndex];
281098
+ if (!(segId > 0))
281099
+ return null;
281100
+ return { id: String(segId), properties: toNamedProperties(propertyIds, values3) };
281101
+ }
281102
+ const remapCellColors = (ngCellColors, cellIdToMeshIdRef) => {
281103
+ const remapped = {};
281104
+ Object.entries(ngCellColors).forEach(([cellId, color2]) => {
281105
+ const meshId = cellIdToMeshIdRef.current[cellId] ?? cellId;
281106
+ remapped[meshId] = color2;
281107
+ });
281108
+ return remapped;
281109
+ };
281110
+ const autoColorCache = /* @__PURE__ */ new Map();
281111
+ function hashStringToIndex(str, mod2) {
281112
+ let hash2 = 0;
281113
+ for (let i2 = 0; i2 < str.length; i2 += 1) {
281114
+ hash2 = (hash2 * 31 + str.charCodeAt(i2)) % 2 ** 32;
281115
+ }
281116
+ return hash2 % mod2;
281117
+ }
281118
+ function autoColorForId(id2) {
281119
+ const key2 = String(id2);
281120
+ let color2 = autoColorCache.get(key2);
281121
+ if (!color2) {
281122
+ color2 = PALETTE[hashStringToIndex(key2, PALETTE.length)].map((c2) => c2.toString(16).padStart(2, "0")).join("");
281123
+ color2 = `#${color2}`;
281124
+ autoColorCache.set(key2, color2);
281125
+ }
281126
+ return color2;
281127
+ }
281128
+ function reuseIfShallowEqual(cacheRef, next4) {
281129
+ const prev2 = cacheRef.current;
281130
+ const prevKeys = Object.keys(prev2);
281131
+ const nextKeys = Object.keys(next4);
281132
+ if (prevKeys.length === nextKeys.length && nextKeys.every((k) => prev2[k] === next4[k])) {
281133
+ return prev2;
281134
+ }
281135
+ cacheRef.current = next4;
281136
+ return next4;
281137
+ }
281138
+ function projectToScreen(mat, [x2, y2, z2], width2, height2) {
281139
+ if (!mat)
281140
+ return null;
281141
+ const cx = mat[0] * x2 + mat[4] * y2 + mat[8] * z2 + mat[12];
281142
+ const cy = mat[1] * x2 + mat[5] * y2 + mat[9] * z2 + mat[13];
281143
+ const cw2 = mat[3] * x2 + mat[7] * y2 + mat[11] * z2 + mat[15];
281144
+ if (!(cw2 > 0))
281145
+ return null;
281146
+ return [(cx / cw2 + 1) * 0.5 * width2, (1 - cy / cw2) * 0.5 * height2];
281147
+ }
280716
281148
  function normalizeColor(rgbColor) {
280717
281149
  if (!Array.isArray(rgbColor)) {
280718
281150
  return [0, 0, 0];
@@ -280722,6 +281154,10 @@ function normalizeColor(rgbColor) {
280722
281154
  function borderWidthGlsl(borderWidth = 0) {
280723
281155
  return `setPointMarkerBorderWidth(${borderWidth.toFixed(1)});`;
280724
281156
  }
281157
+ const DEFAULT_POINT_MARKER_SIZE = 5;
281158
+ function pointMarkerSizeGlsl(size2 = DEFAULT_POINT_MARKER_SIZE) {
281159
+ return `setPointMarkerSize(${size2.toFixed(1)});`;
281160
+ }
280725
281161
  function toVec3(normalizedColor) {
280726
281162
  return `vec3(${normalizedColor.join(", ")})`;
280727
281163
  }
@@ -281101,7 +281537,7 @@ function getObsSetSelectionShader(phenotypeColors, opacity2, borderWidth = 0) {
281101
281537
  }
281102
281538
  `;
281103
281539
  }
281104
- function getPointsShader(layerCoordination) {
281540
+ function getPointsShaderInner(layerCoordination) {
281105
281541
  const { theme, featureIndex, spatialLayerOpacity, obsColorEncoding, spatialLayerColor, featureSelection, featureFilterMode, featureColor, pointMarkerBorderWidth = 0, featureIndexProp, pointIndexProp, quantitativeColorProp, featureValueColormap, featureValueColormapRange, obsSetColor, obsSetSelection, quantitativeColorMax, pointsAreSegmentationCentroids, spatialLayerOpacityUnselected } = layerCoordination;
281106
281542
  const defaultColor = getDefaultColor(theme);
281107
281543
  const opacity2 = spatialLayerOpacity ?? 1;
@@ -281201,202 +281637,11 @@ function getPointsShader(layerCoordination) {
281201
281637
  }
281202
281638
  return getSpatialLayerColorShader(staticColor, opacity2, pointMarkerBorderWidth);
281203
281639
  }
281204
- const ANNOTATION_HEADER_OFFSET = 8;
281205
- function ngMetersPerUnit(dimensions) {
281206
- if (!dimensions?.x)
281207
- return null;
281208
- const [scale2, unit2] = dimensions.x;
281209
- const factor = UNIT_TO_METERS[unit2];
281210
- return factor ? scale2 * factor : null;
281211
- }
281212
- const GREY_HEX = "#323232";
281213
- const EPSILON_KEYS_MAPPING_NG = {
281214
- projectionScale: 5,
281215
- projectionOrientation: 0.02,
281216
- position: 1
281217
- };
281218
- const SOFT_POS_FACTOR = 0.15;
281219
- const Q_Y_UP = [1, 0, 0, 0];
281220
- const multiplyQuat = (a2, b2) => {
281221
- const [ax, ay, az, aw] = a2;
281222
- const [bx, by, bz, bw] = b2;
281223
- return [
281224
- aw * bx + ax * bw + ay * bz - az * by,
281225
- aw * by - ax * bz + ay * bw + az * bx,
281226
- aw * bz + ax * by - ay * bx + az * bw,
281227
- aw * bw - ax * bx - ay * by - az * bz
281228
- ];
281229
- };
281230
- const deg2rad = (d) => d * Math.PI / 180;
281231
- const isFiniteNumberArray = (value2, length2) => Array.isArray(value2) && value2.length === length2 && value2.every(Number.isFinite);
281232
- function isValidNgPosition(position2) {
281233
- return isFiniteNumberArray(position2, 3);
281234
- }
281235
- function isValidNgOrientation(orientation) {
281236
- return isFiniteNumberArray(orientation, 4) && orientation.some((v) => v !== 0);
281237
- }
281238
- function isValidNgScale(scale2) {
281239
- return Number.isFinite(scale2) && scale2 > 0;
281240
- }
281241
- const NG_CAMERA_VALIDATORS = {
281242
- position: isValidNgPosition,
281243
- projectionOrientation: isValidNgOrientation,
281244
- projectionScale: isValidNgScale,
281245
- crossSectionScale: isValidNgScale
281246
- };
281247
- function applyColormap(colormap, t4) {
281248
- const tClamped = Math.max(0, Math.min(1, t4));
281249
- const interpolators = {
281250
- plasma: interpolatePlasma,
281251
- viridis: interpolateViridis,
281252
- jet: interpolateJet,
281253
- greys: interpolateGreys
281254
- };
281255
- const fn2 = interpolators[colormap] ?? interpolateViridis;
281256
- return fn2(tClamped);
281257
- }
281258
- function valueGreaterThanEpsilon(a2, b2, epsilon3) {
281259
- if (Array.isArray(a2) && Array.isArray(b2) && a2.length === b2.length) {
281260
- return a2.some((val, i2) => Math.abs(val - b2[i2]) > epsilon3);
281261
- }
281262
- if (typeof a2 === "number" && typeof b2 === "number") {
281263
- return Math.abs(a2 - b2) > epsilon3;
281264
- }
281265
- return void 0;
281266
- }
281267
- const nearEq = (a2, b2, epsilon3) => Number.isFinite(a2) && Number.isFinite(b2) ? Math.abs(a2 - b2) <= epsilon3 : a2 === b2;
281268
- function diffCameraState(prev2, next4) {
281269
- const eps = EPSILON_KEYS_MAPPING_NG;
281270
- const scale2 = valueGreaterThanEpsilon(prev2?.projectionScale, next4?.projectionScale, eps.projectionScale);
281271
- const posHard = valueGreaterThanEpsilon(prev2?.position, next4?.position, eps.position);
281272
- const rot2 = valueGreaterThanEpsilon(prev2?.projectionOrientation, next4?.projectionOrientation, eps.projectionOrientation);
281273
- const posSoft = !posHard && scale2 && valueGreaterThanEpsilon(prev2?.position, next4?.position, SOFT_POS_FACTOR);
281274
- const pos = posHard || posSoft;
281275
- return { changed: scale2 || pos || rot2, scale: scale2, pos, rot: rot2 };
281276
- }
281277
- function eulerToQuaternion(pitch, yaw, roll = 0) {
281278
- const c1 = Math.cos(pitch / 2);
281279
- const c2 = Math.cos(yaw / 2);
281280
- const c3 = Math.cos(roll / 2);
281281
- const s1 = Math.sin(pitch / 2);
281282
- const s2 = Math.sin(yaw / 2);
281283
- const s3 = Math.sin(roll / 2);
281284
- return [
281285
- s1 * c2 * c3 + c1 * s2 * s3,
281286
- c1 * s2 * c3 - s1 * c2 * s3,
281287
- c1 * c2 * s3 - s1 * s2 * c3,
281288
- c1 * c2 * c3 + s1 * s2 * s3
281289
- ];
281290
- }
281291
- function applyQuat(q, v) {
281292
- const [qx, qy, qz, qw] = q;
281293
- const [vx, vy, vz] = v;
281294
- const tx2 = 2 * (qy * vz - qz * vy);
281295
- const ty = 2 * (qz * vx - qx * vz);
281296
- const tz = 2 * (qx * vy - qy * vx);
281297
- return [
281298
- vx + qw * tx2 + qy * tz - qz * ty,
281299
- vy + qw * ty + qz * tx2 - qx * tz,
281300
- vz + qw * tz + qx * ty - qy * tx2
281301
- ];
281302
- }
281303
- function getAnnotationPropertyIndices(info2, { segmentIdProp } = {}) {
281304
- const propertyIds = (info2?.properties ?? []).map((p) => p.id);
281305
- const resolvedSegmentIdProp = segmentIdProp ?? (propertyIds.includes("id") ? "id" : null);
281306
- return {
281307
- propertyIds,
281308
- segmentIdProp: resolvedSegmentIdProp,
281309
- segmentIdIndex: resolvedSegmentIdProp ? propertyIds.indexOf(resolvedSegmentIdProp) : -1
281310
- };
281311
- }
281312
- function toNamedProperties(propertyIds, values3) {
281313
- const named2 = {};
281314
- propertyIds.forEach((name2, k) => {
281315
- named2[name2] = values3[k];
281316
- });
281317
- return named2;
281318
- }
281319
- function parseAnnotationChunkSegmentsWithPositions(buffer2, serializer2, layout) {
281320
- const dv = new DataView(buffer2);
281321
- if (buffer2.byteLength <= 8)
281322
- return [];
281323
- const { propertyIds = [], segmentIdIndex } = layout ?? {};
281324
- if (!(segmentIdIndex >= 0))
281325
- return [];
281326
- const count2 = dv.getUint32(0, true);
281327
- if (count2 === 0 || dv.getUint32(4, true) !== 0)
281328
- return [];
281329
- const geometryStride = serializer2.propertyGroupBytes?.[0] ?? serializer2.serializedBytes;
281330
- const values3 = new Array(propertyIds.length).fill(null);
281331
- const results = [];
281332
- for (let i2 = 0; i2 < count2; i2++) {
281333
- serializer2.deserialize(dv, ANNOTATION_HEADER_OFFSET, i2, count2, true, values3);
281334
- const segId = values3[segmentIdIndex];
281335
- if (segId > 0) {
281336
- const propBase = ANNOTATION_HEADER_OFFSET + i2 * geometryStride;
281337
- const x2 = dv.getFloat32(propBase + 0, true);
281338
- const y2 = dv.getFloat32(propBase + 4, true);
281339
- const z2 = dv.getFloat32(propBase + 8, true);
281340
- if (x2 !== 0 || y2 !== 0 || z2 !== 0) {
281341
- results.push({
281342
- id: String(segId),
281343
- // value of segmentIdProp: used for the NG segments array
281344
- x: x2,
281345
- y: y2,
281346
- z: z2,
281347
- properties: toNamedProperties(propertyIds, values3)
281348
- });
281349
- }
281350
- }
281351
- }
281352
- return results;
281353
- }
281354
- function parseAnnotationById(buffer2, serializer2, layout) {
281355
- const { propertyIds = [], segmentIdIndex } = layout ?? {};
281356
- if (!(segmentIdIndex >= 0) || !buffer2 || !serializer2 || buffer2.byteLength < serializer2.serializedBytes)
281357
- return null;
281358
- const values3 = new Array(propertyIds.length).fill(null);
281359
- serializer2.deserialize(new DataView(buffer2), 0, 0, 1, true, values3);
281360
- const segId = values3[segmentIdIndex];
281361
- if (!(segId > 0))
281362
- return null;
281363
- return { id: String(segId), properties: toNamedProperties(propertyIds, values3) };
281364
- }
281365
- const remapCellColors = (ngCellColors, cellIdToMeshIdRef) => {
281366
- const remapped = {};
281367
- Object.entries(ngCellColors).forEach(([cellId, color2]) => {
281368
- const meshId = cellIdToMeshIdRef.current[cellId] ?? cellId;
281369
- remapped[meshId] = color2;
281370
- });
281371
- return remapped;
281372
- };
281373
- const autoColorCache = /* @__PURE__ */ new Map();
281374
- function hashStringToIndex(str, mod2) {
281375
- let hash2 = 0;
281376
- for (let i2 = 0; i2 < str.length; i2 += 1) {
281377
- hash2 = (hash2 * 31 + str.charCodeAt(i2)) % 2 ** 32;
281378
- }
281379
- return hash2 % mod2;
281380
- }
281381
- function autoColorForId(id2) {
281382
- const key2 = String(id2);
281383
- let color2 = autoColorCache.get(key2);
281384
- if (!color2) {
281385
- color2 = PALETTE[hashStringToIndex(key2, PALETTE.length)].map((c2) => c2.toString(16).padStart(2, "0")).join("");
281386
- color2 = `#${color2}`;
281387
- autoColorCache.set(key2, color2);
281388
- }
281389
- return color2;
281390
- }
281391
- function reuseIfShallowEqual(cacheRef, next4) {
281392
- const prev2 = cacheRef.current;
281393
- const prevKeys = Object.keys(prev2);
281394
- const nextKeys = Object.keys(next4);
281395
- if (prevKeys.length === nextKeys.length && nextKeys.every((k) => prev2[k] === next4[k])) {
281396
- return prev2;
281397
- }
281398
- cacheRef.current = next4;
281399
- return next4;
281640
+ function getPointsShader(layerCoordination) {
281641
+ const { pointMarkerSize = DEFAULT_POINT_MARKER_SIZE } = layerCoordination;
281642
+ const shader = getPointsShaderInner(layerCoordination);
281643
+ return shader.replace(/setPointMarkerBorderWidth\([^)]*\);/g, (match2) => `${match2}
281644
+ ${pointMarkerSizeGlsl(pointMarkerSize)}`);
281400
281645
  }
281401
281646
  const DEFAULT_NG_DIMENSIONS = {
281402
281647
  x: [1, "nm"],
@@ -281412,6 +281657,8 @@ const DEFAULT_NG_PROPS = {
281412
281657
  dimensions: DEFAULT_NG_DIMENSIONS,
281413
281658
  layers: []
281414
281659
  };
281660
+ const MIN_ANNOTATION_SPACING = 0.0625;
281661
+ const MAX_ANNOTATION_SPACING = 65536;
281415
281662
  function sanitizeNgCameraState(cameraState, fallbacks = {}) {
281416
281663
  const defaults2 = {
281417
281664
  projectionOrientation: [0, 0, 0, 1],
@@ -281497,7 +281744,7 @@ function getSegmentationCentroidSources({ segmentationLayerScopes, segmentationC
281497
281744
  const CENTROID_POINT_STROKE_WIDTH = 0.2;
281498
281745
  function getCentroidShaderParams(layerCoordination, channelCoordination) {
281499
281746
  const { spatialLayerOpacity } = layerCoordination || {};
281500
- const { spatialChannelOpacity, spatialChannelColor, obsColorEncoding, featureValueColormap, featureValueColormapRange, obsSetColor, obsSetSelection, additionalObsSets } = channelCoordination || {};
281747
+ const { spatialChannelOpacity, spatialChannelColor, obsColorEncoding, featureValueColormap, featureValueColormapRange, obsSetColor, obsSetSelection, additionalObsSets, spatialSegmentationStrokeWidth } = channelCoordination || {};
281501
281748
  return {
281502
281749
  spatialLayerOpacity: (spatialLayerOpacity ?? 1) * (spatialChannelOpacity ?? 1),
281503
281750
  // Segmentation channels use 'spatialChannelColor' for a static color,
@@ -281511,7 +281758,7 @@ function getCentroidShaderParams(layerCoordination, channelCoordination) {
281511
281758
  additionalObsSets,
281512
281759
  // Only show the centroids of the selected obsSets.
281513
281760
  featureFilterMode: "featureSelection",
281514
- pointMarkerBorderWidth: CENTROID_POINT_STROKE_WIDTH,
281761
+ pointMarkerBorderWidth: spatialSegmentationStrokeWidth ?? CENTROID_POINT_STROKE_WIDTH,
281515
281762
  // The points represent the centroids of the segmentations.
281516
281763
  // We pass this down to the getPointsShader, to determine whether to interpret
281517
281764
  // `obsColorEncoding === 'geneSelection'` as a
@@ -281579,8 +281826,6 @@ function useNeuroglancerViewerState(theme, showAxisLines, segmentationLayerScope
281579
281826
  result = {
281580
281827
  ...result,
281581
281828
  showAxisLines,
281582
- showDefaultAnnotations: false,
281583
- // this removes the yellow box around pointsLayer
281584
281829
  layers: [
281585
281830
  ...result.layers,
281586
281831
  {
@@ -281637,7 +281882,7 @@ function useNeuroglancerViewerState(theme, showAxisLines, segmentationLayerScope
281637
281882
  const ngOptions = layerData?.neuroglancerOptions;
281638
281883
  const featureIndex = pointMultiIndicesData[layerScope]?.featureIndex;
281639
281884
  if (layerUrl && layerData) {
281640
- const { spatialLayerVisible, spatialLayerOpacity, spatialLayerOpacityUnselected, obsColorEncoding, spatialLayerColor, featureSelection, featureFilterMode, featureColor, spatialPointStrokeWidth, featureValueColormap, featureValueColormapRange } = layerCoordination || {};
281885
+ const { spatialLayerVisible, spatialLayerOpacity, spatialLayerOpacityUnselected, obsColorEncoding, spatialLayerColor, featureSelection, featureFilterMode, featureColor, spatialPointStrokeWidth, spatialPointProjectionSpacing, featureValueColormap, featureValueColormapRange, spatialPointRadius } = layerCoordination || {};
281641
281886
  const quantitativeColorMaxSelected = getQuantitativeColorMax(ngOptions, obsColorEncoding);
281642
281887
  const shader = getPointsShader({
281643
281888
  theme,
@@ -281659,7 +281904,10 @@ function useNeuroglancerViewerState(theme, showAxisLines, segmentationLayerScope
281659
281904
  obsSetColor: layerCoordination.obsSetColor,
281660
281905
  obsSetSelection: layerCoordination.obsSetSelection,
281661
281906
  additionalObsSets: layerCoordination.additionalObsSets,
281662
- quantitativeColorMax: quantitativeColorMaxSelected
281907
+ quantitativeColorMax: quantitativeColorMaxSelected,
281908
+ // spatialPointRadius is a radius (consistent with spatialSpotRadius), but NG's
281909
+ // own setPointMarkerSize expects a diameter, so double it here.
281910
+ pointMarkerSize: (spatialPointRadius ?? DEFAULT_POINT_MARKER_SIZE / 2) * 2
281663
281911
  });
281664
281912
  result = {
281665
281913
  ...result,
@@ -281674,7 +281922,8 @@ function useNeuroglancerViewerState(theme, showAxisLines, segmentationLayerScope
281674
281922
  visible: spatialLayerVisible,
281675
281923
  // Options from layerData.neuroglancerOptions
281676
281924
  // like projectionAnnotationSpacing:
281677
- projectionAnnotationSpacing: ngOptions?.projectionAnnotationSpacing ?? 1
281925
+ // Coordination value (LC) > file option > 1.0; clamped to NG's valid range.
281926
+ projectionAnnotationSpacing: Math.min(MAX_ANNOTATION_SPACING, Math.max(MIN_ANNOTATION_SPACING, spatialPointProjectionSpacing ?? ngOptions?.projectionAnnotationSpacing ?? 1))
281678
281927
  }
281679
281928
  ],
281680
281929
  // TODO: is this needed?
@@ -281707,11 +281956,111 @@ function useNeuroglancerViewerState(theme, showAxisLines, segmentationLayerScope
281707
281956
  }, customIsEqualForInitialViewerState);
281708
281957
  return viewerState;
281709
281958
  }
281959
+ function TooltipChild(props) {
281960
+ const { x: x2, y: y2, parentUuid, sourceUuid, width: width2, height: height2, info: info2, tooltipsVisible, tooltipCrosshairsVisible, featureType, featureLabelsMap } = props;
281961
+ const visible = parentUuid === sourceUuid ? tooltipsVisible : tooltipCrosshairsVisible;
281962
+ return visible ? jsx$1(Tooltip2D, { x: x2, y: y2, parentUuid, sourceUuid, parentWidth: width2, parentHeight: height2, children: jsx$1(TooltipContent, { info: info2, featureType, featureLabelsMap }) }) : null;
281963
+ }
281964
+ function getObsInfo(obsSetsData, obsType, obsId) {
281965
+ let result = { [`${capitalize$3(obsType)} ID`]: obsId };
281966
+ const obsMembership = obsSetsData?.obsSetsMembership?.get(obsId) || [];
281967
+ result = {
281968
+ ...result,
281969
+ ...Object.fromEntries(obsMembership.flatMap((path2) => path2.slice(1).map((pathEl, elLevel) => [
281970
+ `${path2[0]}${path2.length > 2 ? ` L${elLevel + 1}` : ""}`,
281971
+ pathEl
281972
+ ])))
281973
+ };
281974
+ return result;
281975
+ }
281976
+ function NeuroglancerTooltipSubscriber(props) {
281977
+ const { parentUuid, width: width2, height: height2, hoverCoord, getViewProjectionMat, getObsPosition, obsHighlight: viewObsHighlight, featureType, featureLabelsMap, segmentationLayerScopes, segmentationChannelScopesByLayer, segmentationChannelCoordination, obsSegmentationsSetsData } = props;
281978
+ const sourceUuid = useComponentHover();
281979
+ const isSource = sourceUuid === parentUuid;
281980
+ const mat = getViewProjectionMat?.();
281981
+ let yOffset = -30;
281982
+ return jsx$1(Fragment, { children: segmentationLayerScopes?.flatMap((layerScope) => segmentationChannelScopesByLayer?.[layerScope]?.map((channelScope) => {
281983
+ const { obsType, obsHighlight: channelObsHighlight, tooltipsVisible, tooltipCrosshairsVisible, spatialChannelVisible } = segmentationChannelCoordination?.[0]?.[layerScope]?.[channelScope] || {};
281984
+ const showTooltip = tooltipsVisible ?? true;
281985
+ const showCrosshair = tooltipCrosshairsVisible ?? true;
281986
+ const obsHighlight = channelObsHighlight ?? viewObsHighlight;
281987
+ if (!obsHighlight || spatialChannelVisible === false || !showTooltip && !showCrosshair)
281988
+ return null;
281989
+ const obsInfo = getObsInfo(obsSegmentationsSetsData?.[layerScope]?.[channelScope], obsType, String(obsHighlight));
281990
+ const coord = isSource ? hoverCoord : getObsPosition?.(obsHighlight);
281991
+ const xy = coord ? projectToScreen(mat, coord, width2, height2) : null;
281992
+ if (!xy)
281993
+ return null;
281994
+ return jsx$1(TooltipChild, {
281995
+ parentUuid,
281996
+ sourceUuid,
281997
+ tooltipsVisible: showTooltip,
281998
+ tooltipCrosshairsVisible: showCrosshair,
281999
+ width: width2,
282000
+ height: height2,
282001
+ info: obsInfo,
282002
+ x: xy[0],
282003
+ // Stack offset only applies to tooltips; crosshairs must sit on the point.
282004
+ y: isSource ? xy[1] + (yOffset += 20 + 15 * Object.keys(obsInfo).length) : xy[1],
282005
+ featureType,
282006
+ featureLabelsMap
282007
+ }, `${layerScope}-${channelScope}`);
282008
+ })) });
282009
+ }
282010
+ const MIN_EXP = -4;
282011
+ const MAX_EXP = 4;
282012
+ const toExp = (v) => Math.min(MAX_EXP, Math.max(MIN_EXP, Math.log2(v)));
282013
+ function CheckboxRow({ label: label2, checked, onChange, id: id2, disabled = false }) {
282014
+ const { classes: classes2 } = usePlotOptionsStyles();
282015
+ return jsxs(TableRow, { children: [jsx$1(TableCell, { className: classes2.labelCell, variant: "head", scope: "row", children: jsx$1("label", { htmlFor: id2, children: label2 }) }), jsx$1(TableCell, { className: classes2.inputCell, variant: "body", children: jsx$1(Checkbox$1, { className: classes2.checkbox, checked, disabled, onChange: (e3, v) => onChange(v), color: "default", slotProps: { input: { id: id2, "aria-label": label2 } } }) })] });
282016
+ }
282017
+ function SliderRow({ label: label2, id: id2, children: children3 }) {
282018
+ const { classes: classes2 } = usePlotOptionsStyles();
282019
+ return jsxs(TableRow, { children: [jsx$1(TableCell, { className: classes2.labelCell, variant: "head", scope: "row", children: jsx$1("label", { htmlFor: id2, children: label2 }) }), jsx$1(TableCell, { className: classes2.inputCell, variant: "body", children: children3 })] });
282020
+ }
282021
+ function PointLayerRows({ layer, baseId }) {
282022
+ const { classes: classes2 } = usePlotOptionsStyles();
282023
+ const { label: label2, spacing: spacing2, setSpacing } = layer;
282024
+ const [exp2, setExp] = useState(toExp(spacing2 ?? 1));
282025
+ useEffect(() => {
282026
+ setExp(toExp(spacing2 ?? 1));
282027
+ }, [spacing2]);
282028
+ const spacingId = `${baseId}-spacing`;
282029
+ return jsx$1(Fragment, { children: setSpacing ? jsx$1(SliderRow, { label: `${label2} spacing (3D)`, id: spacingId, children: jsx$1(Slider, { slotProps: {
282030
+ root: { className: classes2.slider },
282031
+ valueLabel: { className: classes2.sliderValueLabel }
282032
+ }, value: exp2, min: MIN_EXP, max: MAX_EXP, step: 0.5, scale: (x2) => 2 ** x2, valueLabelDisplay: "auto", valueLabelFormat: (v) => v <= 0.0625 ? "all" : v.toFixed(v < 1 ? 3 : 1), onChange: (e3, v) => setExp(v), onChangeCommitted: (e3, v) => setSpacing(2 ** v), id: spacingId, "aria-label": `${label2} projection spacing (lower shows more points)` }) }) : null });
282033
+ }
282034
+ function NeuroglancerOptions(props) {
282035
+ const { axisLinesVisible, setAxisLinesVisible, boundsVisible, setBoundsVisible, pointLayers = [], orthographic: orthographic2, scaleBarVisible, setScaleBarVisible, hideUnselected, setHideUnselected, backgroundTheme, setBackgroundTheme } = props;
282036
+ const id2 = useId$2();
282037
+ return jsxs(OptionsContainer, { children: [setBackgroundTheme ? jsx$1(CheckboxRow, { label: "Light background", id: `ng-light-background-${id2}`, checked: backgroundTheme === "light", onChange: (v) => setBackgroundTheme(v ? "light" : "dark") }) : null, setAxisLinesVisible ? jsx$1(CheckboxRow, { label: "Axis lines", id: `ng-axis-lines-${id2}`, checked: Boolean(axisLinesVisible), onChange: setAxisLinesVisible }) : null, setBoundsVisible ? jsx$1(CheckboxRow, { label: "Bounds", id: `ng-bounds-${id2}`, checked: Boolean(boundsVisible), onChange: setBoundsVisible }) : null, setScaleBarVisible ? jsx$1(
282038
+ CheckboxRow,
282039
+ {
282040
+ // Neuroglancer only draws the scale bar in orthographic projection.
282041
+ label: "Scale bar",
282042
+ id: `ng-scale-bar-${id2}`,
282043
+ checked: Boolean(scaleBarVisible) && Boolean(orthographic2),
282044
+ disabled: !orthographic2,
282045
+ onChange: setScaleBarVisible
282046
+ }
282047
+ ) : null, pointLayers.map((layer) => jsx$1(PointLayerRows, { layer, baseId: `ng-points-${id2}-${layer.scope}` }, layer.scope)), setHideUnselected ? jsx$1(
282048
+ CheckboxRow,
282049
+ {
282050
+ // Applies when cells are colored by set selection and at least one set is selected.
282051
+ label: "Hide unselected cells",
282052
+ id: `ng-hide-unselected-${id2}`,
282053
+ checked: Boolean(hideUnselected),
282054
+ onChange: setHideUnselected
282055
+ }
282056
+ ) : null] });
282057
+ }
281710
282058
  const ROTATION_EPS = 1e-3;
281711
282059
  const TARGET_EPS = 0.5;
281712
282060
  const MESH_LOAD_THRESHOLD = 100;
281713
282061
  const MESH_LOADING_OVERLAY_TIMEOUT = 1500;
281714
282062
  const GUIDE_URL = "https://vitessce.io/docs/ng-guide/";
282063
+ const DEFAULT_UNSELECTED_OPACITY = 0.25;
281715
282064
  const LAST_INTERACTION_SOURCE = {
281716
282065
  vitessce: "vitessce",
281717
282066
  neuroglancer: "neuroglancer"
@@ -281719,6 +282068,7 @@ const LAST_INTERACTION_SOURCE = {
281719
282068
  function NeuroglancerSubscriber(props) {
281720
282069
  const {
281721
282070
  uuid: uuid2,
282071
+ disableTooltip = false,
281722
282072
  coordinationScopes: coordinationScopesRaw,
281723
282073
  coordinationScopesBy: coordinationScopesByRaw,
281724
282074
  closeButtonVisible,
@@ -281758,6 +282108,7 @@ function NeuroglancerSubscriber(props) {
281758
282108
  const { classes: classes2 } = useStyles$4();
281759
282109
  const initialRotationPushedRef = useRef(false);
281760
282110
  const getViewProjectionMatRef = useRef(null);
282111
+ const centroidPosByMeshIdRef = useRef(/* @__PURE__ */ new Map());
281761
282112
  const meshIdToCellIdRef = useRef({});
281762
282113
  const cellIdToMeshIdRef = useRef({});
281763
282114
  const lastInteractionSource = useRef(null);
@@ -281794,8 +282145,12 @@ function NeuroglancerSubscriber(props) {
281794
282145
  additionalObsSets: additionalCellSets,
281795
282146
  obsHighlight: cellHighlight,
281796
282147
  spatialCameraSnapshot,
281797
- spatialRenderingMode
281798
- }, { setSpatialCameraSnapshot, setAdditionalObsSets: setAdditionalCellSets, setObsSetColor: setCellSetColor, setObsColorEncoding: setCellColorEncoding, setObsSetSelection: setCellSetSelection, setObsHighlight: setCellHighlight }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$1.NEUROGLANCER], coordinationScopes);
282148
+ spatialRenderingMode,
282149
+ spatialAxisLinesVisible,
282150
+ spatialBoundsVisible,
282151
+ spatialScaleBarVisible,
282152
+ spatialBackgroundTheme
282153
+ }, { setSpatialCameraSnapshot, setSpatialAxisLinesVisible, setSpatialBoundsVisible, setSpatialScaleBarVisible, setSpatialBackgroundTheme, setAdditionalObsSets: setAdditionalCellSets, setObsSetColor: setCellSetColor, setObsColorEncoding: setCellColorEncoding, setObsSetSelection: setCellSetSelection, setObsHighlight: setCellHighlight }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$1.NEUROGLANCER], coordinationScopes);
281799
282154
  const csvUrlRef = useRef(null);
281800
282155
  const csvUrl = useMemo$1(() => {
281801
282156
  if (csvUrlRef.current)
@@ -281810,6 +282165,8 @@ function NeuroglancerSubscriber(props) {
281810
282165
  return url;
281811
282166
  }, [loaders, dataset]);
281812
282167
  const [ngWidth, ngHeight, containerRef] = useGridItemSize();
282168
+ const setComponentHover = useSetComponentHover();
282169
+ const [hoverCoord, setHoverCoord] = useState(null);
281813
282170
  const [segmentationLayerScopes, segmentationChannelScopesByLayer] = useMultiCoordinationScopesSecondaryNonNull(CoordinationType$1.SEGMENTATION_CHANNEL, CoordinationType$1.SEGMENTATION_LAYER, coordinationScopes, coordinationScopesBy);
281814
282171
  const pointLayerScopes = useMultiCoordinationScopesNonNull(CoordinationType$1.POINT_LAYER, coordinationScopes);
281815
282172
  const segmentationLayerCoordination = useComplexCoordination([
@@ -281840,7 +282197,8 @@ function NeuroglancerSubscriber(props) {
281840
282197
  CoordinationType$1.TOOLTIP_CROSSHAIRS_VISIBLE,
281841
282198
  CoordinationType$1.LEGEND_VISIBLE,
281842
282199
  CoordinationType$1.FEATURE_TYPE,
281843
- CoordinationType$1.FEATURE_VALUE_TYPE
282200
+ CoordinationType$1.FEATURE_VALUE_TYPE,
282201
+ CoordinationType$1.SPATIAL_LAYER_OPACITY_UNSELECTED
281844
282202
  ], coordinationScopes, coordinationScopesBy, CoordinationType$1.SEGMENTATION_LAYER, CoordinationType$1.SEGMENTATION_CHANNEL);
281845
282203
  const pointLayerCoordination = useComplexCoordination([
281846
282204
  CoordinationType$1.OBS_TYPE,
@@ -281859,6 +282217,9 @@ function NeuroglancerSubscriber(props) {
281859
282217
  CoordinationType$1.TOOLTIP_CROSSHAIRS_VISIBLE,
281860
282218
  CoordinationType$1.LEGEND_VISIBLE,
281861
282219
  CoordinationType$1.SPATIAL_POINT_STROKE_WIDTH,
282220
+ CoordinationType$1.SPATIAL_POINT_RADIUS,
282221
+ CoordinationType$1.SPATIAL_LAYER_LABEL,
282222
+ CoordinationType$1.SPATIAL_POINT_PROJECTION_SPACING,
281862
282223
  CoordinationType$1.OBS_SET_COLOR,
281863
282224
  CoordinationType$1.OBS_SET_SELECTION,
281864
282225
  CoordinationType$1.ADDITIONAL_OBS_SETS
@@ -282137,17 +282498,23 @@ function NeuroglancerSubscriber(props) {
282137
282498
  theme
282138
282499
  });
282139
282500
  const ngCellColors = {};
282501
+ const selectedCellIds = [];
282140
282502
  idsToColor.forEach((id2) => {
282141
282503
  if (knownIdSet.has(String(id2))) {
282142
282504
  const color2 = cellColors.get(String(id2));
282143
282505
  if (color2) {
282144
282506
  ngCellColors[id2] = colorArrayToString(color2);
282507
+ selectedCellIds.push(id2);
282145
282508
  } else {
282146
282509
  ngCellColors[id2] = GREY_HEX;
282147
282510
  }
282148
282511
  }
282149
282512
  });
282150
282513
  finalizeChannelColors(ngCellColors, spatialChannelOpacity);
282514
+ const { spatialLayerOpacityUnselected } = segmentationChannelCoordination[0][layerScope][channelScope];
282515
+ if (spatialLayerOpacityUnselected === 0 && obsSetSelection?.length > 0) {
282516
+ result[layerScope].visibleMeshIds = new Set(selectedCellIds.map((id2) => String(cellIdToMeshIdRef.current?.[String(id2)] ?? id2)));
282517
+ }
282151
282518
  }
282152
282519
  });
282153
282520
  });
@@ -282332,6 +282699,9 @@ function NeuroglancerSubscriber(props) {
282332
282699
  readyScopes.forEach((scope, i2) => {
282333
282700
  const allEntries = entriesByScope[i2];
282334
282701
  const transform3 = transformByScope[scope];
282702
+ allEntries.forEach(({ id: id2, x: x2, y: y2, z: z2 }) => {
282703
+ centroidPosByMeshIdRef.current.set(String(id2), [x2 / transform3.x, y2 / transform3.y, (z2 || 0) / transform3.z]);
282704
+ });
282335
282705
  const obsIdToMeshId = {};
282336
282706
  allEntries.forEach(({ id: id2, obsId }) => {
282337
282707
  obsIdToMeshId[obsId] = id2;
@@ -282491,7 +282861,9 @@ function NeuroglancerSubscriber(props) {
282491
282861
  result[layerScope] = {
282492
282862
  colors: segmentationColorMapping?.[layerScope]?.[channelScope] ?? {},
282493
282863
  opacity: segmentationColorMapping?.[layerScope]?.opacity ?? 1,
282494
- defaultColor: segmentationColorMapping?.[layerScope]?.defaultColor ?? null
282864
+ defaultColor: segmentationColorMapping?.[layerScope]?.defaultColor ?? null,
282865
+ // Set only when "hide unselected" is active (unselected opacity 0 + a set selection).
282866
+ visibleMeshIds: segmentationColorMapping?.[layerScope]?.visibleMeshIds ?? null
282495
282867
  };
282496
282868
  });
282497
282869
  return result;
@@ -282655,6 +283027,10 @@ function NeuroglancerSubscriber(props) {
282655
283027
  } else if (Object.keys(layerColorMapping).length > 0) {
282656
283028
  segments2 = Object.keys(layerColorMapping);
282657
283029
  }
283030
+ const visibleMeshIds = cellColorMappingByLayer?.[layerScope]?.visibleMeshIds;
283031
+ if (visibleMeshIds) {
283032
+ segments2 = segments2.filter((id2) => visibleMeshIds.has(String(id2)));
283033
+ }
282658
283034
  let derivedSegmentColors = {};
282659
283035
  if (isCulled && segments2.length > 0) {
282660
283036
  segments2.forEach((meshId) => {
@@ -282706,12 +283082,23 @@ function NeuroglancerSubscriber(props) {
282706
283082
  is3dMode,
282707
283083
  centroidLayerRoles
282708
283084
  ]);
282709
- const onSegmentHighlight = useCallback((obsId) => {
283085
+ const onSegmentHighlight = useCallback((obsId, coord = null) => {
282710
283086
  const next4 = obsId != null ? String(obsId) : null;
282711
- if (next4 === cellHighlight)
282712
- return;
283087
+ if (next4 != null && coord) {
283088
+ setHoverCoord(coord);
283089
+ setComponentHover(uuid2);
283090
+ } else {
283091
+ setHoverCoord(null);
283092
+ }
282713
283093
  setCellHighlight(next4);
282714
- }, [setCellHighlight, cellHighlight]);
283094
+ }, [setCellHighlight, cellHighlight, setComponentHover, uuid2]);
283095
+ const getObsPosition = useCallback((obsId) => {
283096
+ if (obsId == null)
283097
+ return null;
283098
+ const stripped = String(obsId).replace(/^.*_/, "");
283099
+ const meshId = String(cellIdToMeshIdRef.current?.[stripped] ?? stripped);
283100
+ return centroidPosByMeshIdRef.current.get(meshId) ?? null;
283101
+ }, []);
282715
283102
  const handleLayerLoadingChange = useCallback((isLoaded) => {
282716
283103
  if (!isLayersLoaded && isLoaded) {
282717
283104
  setIsLayersLoaded(true);
@@ -282719,8 +283106,46 @@ function NeuroglancerSubscriber(props) {
282719
283106
  }, [isLayersLoaded]);
282720
283107
  const hasLayers = derivedViewerState?.layers?.length > 0;
282721
283108
  const legendPointLayerScopes = pointLayerScopes?.length > 0 ? pointLayerScopes : void 0;
282722
- return jsx$1(TitleInfo, { title: title2, info: subtitle, helpText, isSpatial: true, theme, closeButtonVisible, downloadButtonVisible, removeGridComponent, isReady: isReady && isLayersLoaded, errors, withPadding: false, guideUrl: GUIDE_URL, children: hasLayers && hasResolvedInitialCamera ? jsxs("div", { style: { position: "relative", width: "100%", height: "100%" }, ref: setContainerNode, children: [jsx$1("div", { style: { position: "absolute", top: 0, right: 0, zIndex: 50 }, children: jsx$1(MultiLegend, {
282723
- theme: "dark",
283109
+ const axisLinesVisibleEffective = spatialAxisLinesVisible ?? showAxisLines;
283110
+ const boundsVisibleEffective = spatialBoundsVisible ?? false;
283111
+ const orthographicEffective = spatialRenderingMode !== "3D";
283112
+ const scaleBarVisibleEffective = spatialScaleBarVisible ?? true;
283113
+ const pointLayersForOptions = useMemo$1(() => (pointLayerScopes || []).map((scope) => {
283114
+ const values3 = pointLayerCoordination[0]?.[scope] ?? {};
283115
+ const setters = pointLayerCoordination[1]?.[scope] ?? {};
283116
+ const ngLayer = derivedViewerState?.layers?.find((l2) => l2?.name === `obsPoints-${scope}`);
283117
+ return {
283118
+ scope,
283119
+ label: values3.spatialLayerLabel || `Points ${scope}`,
283120
+ strokeWidth: values3.spatialPointStrokeWidth,
283121
+ setStrokeWidth: setters.setSpatialPointStrokeWidth,
283122
+ spacing: ngLayer?.projectionAnnotationSpacing ?? values3.spatialPointProjectionSpacing,
283123
+ setSpacing: setters.setSpatialPointProjectionSpacing
283124
+ };
283125
+ }), [pointLayerScopes, pointLayerCoordination, derivedViewerState]);
283126
+ const hideUnselected = useMemo$1(() => (segmentationLayerScopes ?? []).some((layerScope) => (segmentationChannelScopesByLayer?.[layerScope] ?? []).some((channelScope) => segmentationChannelCoordination?.[0]?.[layerScope]?.[channelScope]?.spatialLayerOpacityUnselected === 0)), [segmentationLayerScopes, segmentationChannelScopesByLayer, segmentationChannelCoordination]);
283127
+ const setHideUnselected = useCallback((hide2) => {
283128
+ const value2 = hide2 ? 0 : DEFAULT_UNSELECTED_OPACITY;
283129
+ (segmentationLayerScopes ?? []).forEach((layerScope) => {
283130
+ (segmentationChannelScopesByLayer?.[layerScope] ?? []).forEach((channelScope) => {
283131
+ segmentationChannelCoordination?.[1]?.[layerScope]?.[channelScope]?.setSpatialLayerOpacityUnselected?.(value2);
283132
+ });
283133
+ });
283134
+ }, [segmentationLayerScopes, segmentationChannelScopesByLayer, segmentationChannelCoordination]);
283135
+ const onRecenter = useCallback(() => {
283136
+ setSpatialCameraSnapshot(null);
283137
+ }, [setSpatialCameraSnapshot]);
283138
+ const [cameraResetTick, setCameraResetTick] = useState(0);
283139
+ const prevSpatialCameraSnapshotForResetRef = useRef(spatialCameraSnapshot);
283140
+ useEffect(() => {
283141
+ if (prevSpatialCameraSnapshotForResetRef.current && !spatialCameraSnapshot) {
283142
+ setCameraResetTick((tick2) => tick2 + 1);
283143
+ }
283144
+ prevSpatialCameraSnapshotForResetRef.current = spatialCameraSnapshot;
283145
+ }, [spatialCameraSnapshot]);
283146
+ const backgroundTheme = spatialBackgroundTheme ?? "dark";
283147
+ return jsx$1(TitleInfo, { title: title2, info: subtitle, helpText, isSpatial: true, theme, closeButtonVisible, downloadButtonVisible, removeGridComponent, isReady: isReady && isLayersLoaded, errors, withPadding: false, guideUrl: GUIDE_URL, spatialBackgroundTheme: backgroundTheme, options: jsx$1(NeuroglancerOptions, { axisLinesVisible: axisLinesVisibleEffective, setAxisLinesVisible: setSpatialAxisLinesVisible, boundsVisible: boundsVisibleEffective, orthographic: orthographicEffective, setBoundsVisible: setSpatialBoundsVisible, pointLayers: pointLayersForOptions, scaleBarVisible: scaleBarVisibleEffective, setScaleBarVisible: setSpatialScaleBarVisible, hideUnselected, setHideUnselected: segmentationLayerScopes?.length ? setHideUnselected : void 0, backgroundTheme, setBackgroundTheme: setSpatialBackgroundTheme }), children: hasLayers && hasResolvedInitialCamera ? jsxs("div", { style: { position: "relative", width: "100%", height: "100%" }, ref: setContainerNode, children: [jsx$1("div", { style: { position: "absolute", top: 12, left: 12, zIndex: 1e3 }, children: jsx$1(ToolMenu, { visibleTools: { pan: false, selectLasso: false, recenter: true }, recenterOnClick: onRecenter }) }), jsx$1("div", { style: { position: "absolute", top: 0, right: 0, zIndex: 50 }, children: jsx$1(MultiLegend, {
283148
+ theme: backgroundTheme,
282724
283149
  maxHeight: ngHeight,
282725
283150
  // Segmentations
282726
283151
  segmentationLayerScopes,
@@ -282731,9 +283156,55 @@ function NeuroglancerSubscriber(props) {
282731
283156
  pointLayerScopes: legendPointLayerScopes,
282732
283157
  pointLayerCoordination,
282733
283158
  pointMultiIndicesData
282734
- }) }), isMeshLoading ? jsx$1(Chip, { label: "Loading meshes...", size: "small", color: "primary", className: classes2.meshLoadingIndicator }) : null, jsx$1(NeuroglancerComp, { classes: classes2, onSegmentClick, onSelectHoveredCoords: detailMode ? void 0 : onSegmentHighlight, viewerState: derivedViewerState, cellColorMapping: cellColorMappingByLayer, setViewerState: handleStateUpdate, onLayerLoadingChange: handleLayerLoadingChange, onAnnotationSourceReady, onViewerReady: (getFn) => {
282735
- getViewProjectionMatRef.current = getFn;
282736
- }, getMeshIdToCellId: (meshId) => meshIdToCellIdRef.current[meshId], centroidAnnotationUrlsByLayerName, decodeCentroidById, allowEmptySegments: detailMode })] }) : null });
283159
+ }) }), isMeshLoading ? jsx$1(Chip, { label: "Loading meshes...", size: "small", color: "primary", className: classes2.meshLoadingIndicator }) : null, jsx$1(NeuroglancerComp, {
283160
+ classes: classes2,
283161
+ onSegmentClick,
283162
+ onSelectHoveredCoords: detailMode ? void 0 : onSegmentHighlight,
283163
+ viewerState: derivedViewerState,
283164
+ cellColorMapping: cellColorMappingByLayer,
283165
+ setViewerState: handleStateUpdate,
283166
+ onLayerLoadingChange: handleLayerLoadingChange,
283167
+ onAnnotationSourceReady,
283168
+ onViewerReady: (getFn) => {
283169
+ getViewProjectionMatRef.current = getFn;
283170
+ },
283171
+ getMeshIdToCellId: (meshId) => meshIdToCellIdRef.current[meshId],
283172
+ centroidAnnotationUrlsByLayerName,
283173
+ decodeCentroidById,
283174
+ // Hiding unselected (esp. with on-demand culling) can legitimately leave zero meshes in view.
283175
+ allowEmptySegments: detailMode || hideUnselected,
283176
+ axisLinesVisible: axisLinesVisibleEffective,
283177
+ boundsVisible: boundsVisibleEffective,
283178
+ scaleBarVisible: scaleBarVisibleEffective,
283179
+ orthographic: orthographicEffective,
283180
+ cameraResetRequest: cameraResetTick,
283181
+ backgroundTheme: spatialBackgroundTheme ?? "dark"
283182
+ }), !disableTooltip && !detailMode ? (
283183
+ // Overlay pinned to the container's top-left so the tooltip anchor's (x, y)
283184
+ // offsets are relative to the canvas, not to the end of the NG wrapper.
283185
+ jsx$1("div", { style: {
283186
+ position: "absolute",
283187
+ top: 0,
283188
+ left: 0,
283189
+ width: "100%",
283190
+ height: "100%",
283191
+ pointerEvents: "none",
283192
+ zIndex: 60
283193
+ }, children: jsx$1(NeuroglancerTooltipSubscriber, {
283194
+ parentUuid: uuid2,
283195
+ hoverCoord,
283196
+ // useGridItemSize can report 0x0; viewportSizeRef holds the real container size.
283197
+ width: viewportSizeRef.current.width || ngWidth,
283198
+ height: viewportSizeRef.current.height || ngHeight,
283199
+ getViewProjectionMat: () => getViewProjectionMatRef.current?.(),
283200
+ obsHighlight: cellHighlight,
283201
+ getObsPosition,
283202
+ segmentationLayerScopes,
283203
+ segmentationChannelScopesByLayer,
283204
+ segmentationChannelCoordination,
283205
+ obsSegmentationsSetsData
283206
+ }) })
283207
+ ) : null] }) : null });
282737
283208
  }
282738
283209
  const FEATURE_AGGREGATION_STRATEGIES = ["first", "last", "sum", "mean"];
282739
283210
  function CellSetExpressionPlotOptions(props) {
@@ -284960,7 +285431,7 @@ function CellSetExpressionPlotSubscriber(props) {
284960
285431
  sampleSetsUrls,
284961
285432
  sampleEdgesUrls
284962
285433
  ]);
284963
- const featureAggregationStrategyToUse = featureAggregationStrategy ?? DEFAULT_FEATURE_AGGREGATION_STRATEGY;
285434
+ const featureAggregationStrategyToUse = resolveFeatureAggregationStrategy(featureAggregationStrategy, geneSelection) ?? DEFAULT_FEATURE_AGGREGATION_STRATEGY;
284964
285435
  const [histogramData, setArr, exprMax] = useExpressionByCellSet(sampleEdges, sampleSets, sampleSetSelection, expressionData, obsIndex, cellSets, additionalCellSets, geneSelection, cellSetSelection, cellSetColor, featureValueTransform, featureValueTransformCoefficient, theme, yMin, featureAggregationStrategyToUse, obsSetsColumns);
284965
285436
  const featureSuffix = useMemo$1(() => {
284966
285437
  const cleanedGeneSelection = geneSelection?.map((geneName) => featureLabelsMap?.get(geneName) || featureLabelsMap?.get(cleanFeatureId(geneName)) || geneName);
@@ -335582,10 +336053,11 @@ function ExpressionHistogramSubscriber(props) {
335582
336053
  matrixUrls
335583
336054
  ]);
335584
336055
  const numGenesSelected = geneSelection ? geneSelection.length : 0;
335585
- const aggregationStrategy = featureAggregationStrategy ?? "first";
336056
+ const aggregationStrategy = resolveFeatureAggregationStrategy(featureAggregationStrategy, geneSelection) ?? "first";
336057
+ const aggregationStrategyLabel = typeof aggregationStrategy === "number" ? geneSelection[aggregationStrategy] : aggregationStrategy;
335586
336058
  const titleSuffix = (
335587
336059
  // eslint-disable-next-line no-nested-ternary
335588
- numGenesSelected > 1 ? ` (${numGenesSelected} genes, ${aggregationStrategy})` : numGenesSelected === 1 ? ` (${geneSelection[0]})` : ""
336060
+ numGenesSelected > 1 ? ` (${numGenesSelected} genes, ${aggregationStrategyLabel})` : numGenesSelected === 1 ? ` (${geneSelection[0]})` : ""
335589
336061
  );
335590
336062
  const data2 = useMemo$1(() => {
335591
336063
  if (numGenesSelected > 0 && obsFeatureMatrix && expressionData) {
@@ -335625,7 +336097,7 @@ function ExpressionHistogramSubscriber(props) {
335625
336097
  const onSelect = useCallback((value2) => {
335626
336098
  const geneName = (
335627
336099
  // eslint-disable-next-line no-nested-ternary
335628
- numGenesSelected > 1 ? `${numGenesSelected} genes (${aggregationStrategy})` : numGenesSelected === 1 ? ` ${geneSelection[0]}` : "transcript count"
336100
+ numGenesSelected > 1 ? `${numGenesSelected} genes (${aggregationStrategyLabel})` : numGenesSelected === 1 ? ` ${geneSelection[0]}` : "transcript count"
335629
336101
  );
335630
336102
  const selectedCellIds = getObsInfoFromDataWithinRange(value2, data2);
335631
336103
  setObsSelection(selectedCellIds, additionalCellSets, cellSetColor, setCellSetSelection, setAdditionalCellSets, setCellSetColor, setCellColorEncoding, "Selection ", `: based on ${geneName} in range [${value2[0].toFixed(1)}, ${value2[1].toFixed(1)}] `);
@@ -335638,7 +336110,7 @@ function ExpressionHistogramSubscriber(props) {
335638
336110
  setCellSetColor,
335639
336111
  setCellSetSelection,
335640
336112
  numGenesSelected,
335641
- aggregationStrategy,
336113
+ aggregationStrategyLabel,
335642
336114
  geneSelection
335643
336115
  ]);
335644
336116
  return jsx$1(TitleInfo, { title: `Histogram ${titleSuffix}`, closeButtonVisible, downloadButtonVisible, removeGridComponent, urls: urls2, theme, isReady, helpText, errors, children: jsx$1("div", { ref: containerRef, className: classes2.vegaContainer, children: jsx$1(ExpressionHistogram, { geneSelection, obsType, featureType, featureValueType, onSelect, data: data2, theme, width: width2, height: height2 }) }) });
@@ -335926,9 +336398,8 @@ function DotPlotSubscriber(props) {
335926
336398
  const [resultArr, meanExpressionMax] = useExpressionSummaries(sampleEdges, sampleSets, sampleSetSelection, expressionData, obsIndex, cellSets, additionalCellSets, geneSelection, cellSetSelection, cellSetColor, featureValueTransform, featureValueTransformCoefficient, posThreshold, featureLabelsMap, obsSetsColumns);
335927
336399
  const selectedTransformName = transformOptions.find((o2) => o2.value === featureValueTransform)?.name;
335928
336400
  const onDotSelect = useCallback((featureName, isShiftDown = false) => {
335929
- const featureI = geneSelection.indexOf(featureName?.[0]);
335930
- if (featureI >= 0) {
335931
- setFeatureAggregationStrategy(featureI);
336401
+ if (geneSelection.includes(featureName?.[0])) {
336402
+ setFeatureAggregationStrategy(featureName[0]);
335932
336403
  }
335933
336404
  }, [setFeatureAggregationStrategy, geneSelection]);
335934
336405
  return jsx$1(TitleInfo, { title: title2, removeGridComponent, urls: urls2, theme, isReady, helpText, errors, options: jsx$1(CellSetExpressionPlotOptions, { featureValueTransform, setFeatureValueTransform, featureValueTransformCoefficient, setFeatureValueTransformCoefficient, transformOptions, featureValuePositivityThreshold: posThreshold, setFeatureValuePositivityThreshold: setPosThreshold, featureValueColormap, setFeatureValueColormap }), children: jsx$1("div", { ref: containerRef, className: classes2.vegaContainer, children: resultArr ? jsx$1(DotPlot, { isStratified, transpose: transpose2, domainMax: meanExpressionMax, data: resultArr, theme, width: width2, height: height2, obsType, sampleType, featureType, featureValueType, featureValueTransformName: selectedTransformName, featureValueColormap, obsSetSelection: cellSetSelection, obsSetColor: cellSetColor, onDotSelect }) : jsxs("span", { children: ["Select at least one ", featureType, "."] }) }) });
@@ -337693,7 +338164,9 @@ class ObsSpotsCsvLoader extends CsvLoader {
337693
338164
  // spatialLayerColor: [255, 255, 255],
337694
338165
  spatialLayerVisible: true,
337695
338166
  spatialLayerOpacity: 1,
337696
- spatialSpotRadius: 10
338167
+ spatialSpotRadius: 10,
338168
+ spatialSpotShape: null,
338169
+ featureAggregationStrategy: null
337697
338170
  // TODO: spatialSpotRadiusUnit: 'µm' or 'um'
337698
338171
  // after resolving https://github.com/vitessce/vitessce/issues/1760
337699
338172
  // featureValueColormapRange: [0, 1],
@@ -337940,7 +338413,8 @@ class ObsSegmentationsJsonLoader extends JsonLoader {
337940
338413
  obsColorEncoding: "spatialChannelColor",
337941
338414
  spatialSegmentationFilled: true,
337942
338415
  spatialSegmentationStrokeWidth: 1,
337943
- obsHighlight: null
338416
+ obsHighlight: null,
338417
+ featureAggregationStrategy: null
337944
338418
  }];
337945
338419
  const coordinationValues = {
337946
338420
  // spatialTargetZ: imageWrapper.getDefaultTargetZ(),
@@ -339741,8 +340215,9 @@ class ObsSpotsAnndataLoader extends AbstractTwoStepLoader {
339741
340215
  // spatialLayerColor: [255, 255, 255],
339742
340216
  spatialLayerVisible: true,
339743
340217
  spatialLayerOpacity: 1,
339744
- spatialSpotRadius: 10
340218
+ spatialSpotRadius: 10,
339745
340219
  // TODO: get this from adata.uns if possible.
340220
+ spatialSpotShape: null,
339746
340221
  // TODO: spatialSpotRadiusUnit: 'µm' or 'um'
339747
340222
  // after resolving https://github.com/vitessce/vitessce/issues/1760
339748
340223
  // featureValueColormapRange: [0, 1],
@@ -339750,6 +340225,7 @@ class ObsSpotsAnndataLoader extends AbstractTwoStepLoader {
339750
340225
  // obsSetColor: null,
339751
340226
  // obsSetSelection: null,
339752
340227
  // additionalObsSets: null,
340228
+ featureAggregationStrategy: null
339753
340229
  })
339754
340230
  };
339755
340231
  const [obsIndex, obsSpots] = await Promise.all([
@@ -339875,7 +340351,8 @@ class ObsSegmentationsAnndataLoader extends AbstractTwoStepLoader {
339875
340351
  obsColorEncoding: "spatialChannelColor",
339876
340352
  spatialSegmentationFilled: true,
339877
340353
  spatialSegmentationStrokeWidth: 1,
339878
- obsHighlight: null
340354
+ obsHighlight: null,
340355
+ featureAggregationStrategy: null
339879
340356
  }];
339880
340357
  const coordinationValues = {
339881
340358
  // Old
@@ -341175,6 +341652,7 @@ class OmeZarrAsObsSegmentationsLoader extends OmeZarrLoader {
341175
341652
  spatialSegmentationStrokeWidth: 1,
341176
341653
  obsHighlight: null,
341177
341654
  featureValueColormap: GLSL_COLORMAP_DEFAULT,
341655
+ featureAggregationStrategy: null,
341178
341656
  ...obsTypesFromChannelNames ? { obsType: channelObj.name } : {}
341179
341657
  }));
341180
341658
  const coordinationValues = {
@@ -341222,7 +341700,8 @@ class SpatialDataLabelsLoader extends SpatialDataImageLoader {
341222
341700
  obsColorEncoding: "spatialChannelColor",
341223
341701
  spatialSegmentationFilled: true,
341224
341702
  spatialSegmentationStrokeWidth: 1,
341225
- obsHighlight: null
341703
+ obsHighlight: null,
341704
+ featureAggregationStrategy: null
341226
341705
  }));
341227
341706
  const coordinationValues = {
341228
341707
  spatialTargetZ: imageWrapper.getDefaultTargetZ(),
@@ -341387,7 +341866,9 @@ class SpatialDataObsSpotsLoader extends AbstractTwoStepLoader {
341387
341866
  // spatialLayerColor: [255, 255, 255],
341388
341867
  spatialLayerVisible: true,
341389
341868
  spatialLayerOpacity: 1,
341390
- spatialSpotRadius
341869
+ spatialSpotRadius,
341870
+ spatialSpotShape: null,
341871
+ featureAggregationStrategy: null
341391
341872
  // TODO: spatialSpotRadiusUnit: 'µm' or 'um'
341392
341873
  // after resolving https://github.com/vitessce/vitessce/issues/1760
341393
341874
  // featureValueColormapRange: [0, 1],
@@ -341470,7 +341951,8 @@ class SpatialDataObsSegmentationsLoader extends AbstractTwoStepLoader {
341470
341951
  spatialSegmentationFilled: true,
341471
341952
  spatialSegmentationStrokeWidth: 1,
341472
341953
  obsHighlight: null,
341473
- featureValueColormap: GLSL_COLORMAP_DEFAULT
341954
+ featureValueColormap: GLSL_COLORMAP_DEFAULT,
341955
+ featureAggregationStrategy: null
341474
341956
  }];
341475
341957
  const coordinationValues = {
341476
341958
  segmentationLayer: CL([
@@ -358333,6 +358815,7 @@ class OmeTiffAsObsSegmentationsLoader extends OmeTiffLoader {
358333
358815
  spatialSegmentationFilled: true,
358334
358816
  spatialSegmentationStrokeWidth: 1,
358335
358817
  obsHighlight: null,
358818
+ featureAggregationStrategy: null,
358336
358819
  ...obsTypesFromChannelNames ? { obsType: channelObj.name } : {}
358337
358820
  }));
358338
358821
  const imagesWithLoaderCreators = [
@@ -361155,7 +361638,10 @@ const baseCoordinationTypes = [
361155
361638
  "difference"
361156
361639
  ]),
361157
361640
  // An index of a featureSelection array element.
361158
- z.number()
361641
+ z.number(),
361642
+ // The name of a featureSelection array element.
361643
+ // Any string other than the reserved values above is treated as a feature name.
361644
+ z.string()
361159
361645
  ]).nullable()),
361160
361646
  new PluginCoordinationType(
361161
361647
  CoordinationType$1.FEATURE_SET_SELECTION,
@@ -361239,7 +361725,17 @@ const baseCoordinationTypes = [
361239
361725
  new PluginCoordinationType(CoordinationType$1.SPATIAL_SEGMENTATION_STROKE_WIDTH, 1, z.number()),
361240
361726
  new PluginCoordinationType(CoordinationType$1.SPATIAL_POINT_STROKE_WIDTH, 0, z.number()),
361241
361727
  new PluginCoordinationType(CoordinationType$1.SPATIAL_LOD_FACTOR, 1, z.number()),
361728
+ // null = fall back to the neuroglancer view's showAxisLines prop / NG default.
361729
+ new PluginCoordinationType(CoordinationType$1.SPATIAL_AXIS_LINES_VISIBLE, null, z.boolean().nullable()),
361730
+ // Neuroglancer default annotations (data-source bounding boxes).
361731
+ new PluginCoordinationType(CoordinationType$1.SPATIAL_BOUNDS_VISIBLE, null, z.boolean().nullable()),
361242
361732
  // Reference: https://www.awaresystems.be/imaging/tiff/tifftags/photometricinterpretation.html
361733
+ // null = use the file's projectionAnnotationSpacing option. NG valid range [0.0625, 65536].
361734
+ new PluginCoordinationType(CoordinationType$1.SPATIAL_POINT_PROJECTION_SPACING, null, z.number().nullable()),
361735
+ new PluginCoordinationType(CoordinationType$1.SPATIAL_SCALE_BAR_VISIBLE, true, z.boolean().nullable()),
361736
+ // Default matches Neuroglancer's own default point marker diameter
361737
+ new PluginCoordinationType(CoordinationType$1.SPATIAL_POINT_RADIUS, 2.5, z.number()),
361738
+ new PluginCoordinationType(CoordinationType$1.SPATIAL_BACKGROUND_THEME, "dark", z.enum(["dark", "light"]).nullable()),
361243
361739
  new PluginCoordinationType(CoordinationType$1.PHOTOMETRIC_INTERPRETATION, null, z.enum(["BlackIsZero", "RGB"]).nullable()),
361244
361740
  new PluginCoordinationType(CoordinationType$1.SPATIAL_RENDERING_MODE, "2D", z.enum(["2D", "3D"]).nullable()),
361245
361741
  new PluginCoordinationType(CoordinationType$1.VOLUMETRIC_RENDERING_ALGORITHM, "additive", z.enum(["maximumIntensityProjection", "additive"])),
@@ -361251,6 +361747,7 @@ const baseCoordinationTypes = [
361251
361747
  new PluginCoordinationType(CoordinationType$1.SPOT_LAYER, null, z.string().nullable()),
361252
361748
  new PluginCoordinationType(CoordinationType$1.POINT_LAYER, null, z.string().nullable()),
361253
361749
  new PluginCoordinationType(CoordinationType$1.SPATIAL_SPOT_RADIUS, 25, z.number().nullable()),
361750
+ new PluginCoordinationType(CoordinationType$1.SPATIAL_SPOT_SHAPE, "circle", z.enum(["circle", "square"]).nullable()),
361254
361751
  new PluginCoordinationType(CoordinationType$1.SPATIAL_SPOT_FILLED, true, z.boolean()),
361255
361752
  new PluginCoordinationType(CoordinationType$1.SPATIAL_SPOT_STROKE_WIDTH, 1, z.number()),
361256
361753
  new PluginCoordinationType(CoordinationType$1.SPATIAL_LAYER_COLOR, null, z.array(z.number()).length(3).nullable()),