@vitessce/scatterplot-gating 3.1.3 → 3.2.0

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.
@@ -10898,8 +10898,10 @@ const ViewType$1 = {
10898
10898
  STATUS: "status",
10899
10899
  SCATTERPLOT: "scatterplot",
10900
10900
  SPATIAL: "spatial",
10901
+ SPATIAL_BETA: "spatialBeta",
10901
10902
  HEATMAP: "heatmap",
10902
10903
  LAYER_CONTROLLER: "layerController",
10904
+ LAYER_CONTROLLER_BETA: "layerControllerBeta",
10903
10905
  GENOMIC_PROFILES: "genomicProfiles",
10904
10906
  GATING: "gating",
10905
10907
  FEATURE_LIST: "featureList",
@@ -10911,20 +10913,24 @@ const ViewType$1 = {
10911
10913
  const DataType$2 = {
10912
10914
  OBS_LABELS: "obsLabels",
10913
10915
  OBS_EMBEDDING: "obsEmbedding",
10914
- OBS_LOCATIONS: "obsLocations",
10915
10916
  OBS_FEATURE_MATRIX: "obsFeatureMatrix",
10916
10917
  OBS_SETS: "obsSets",
10917
10918
  FEATURE_LABELS: "featureLabels",
10918
10919
  IMAGE: "image",
10919
10920
  OBS_SEGMENTATIONS: "obsSegmentations",
10920
10921
  NEIGHBORHOODS: "neighborhoods",
10921
- GENOMIC_PROFILES: "genomic-profiles"
10922
+ GENOMIC_PROFILES: "genomic-profiles",
10923
+ OBS_SPOTS: "obsSpots",
10924
+ OBS_POINTS: "obsPoints",
10925
+ OBS_LOCATIONS: "obsLocations"
10922
10926
  };
10923
10927
  const FileType$1 = {
10924
10928
  // Joint file types
10925
10929
  ANNDATA_ZARR: "anndata.zarr",
10926
10930
  // Atomic file types
10927
10931
  OBS_EMBEDDING_CSV: "obsEmbedding.csv",
10932
+ OBS_SPOTS_CSV: "obsSpots.csv",
10933
+ OBS_POINTS_CSV: "obsPoints.csv",
10928
10934
  OBS_LOCATIONS_CSV: "obsLocations.csv",
10929
10935
  OBS_LABELS_CSV: "obsLabels.csv",
10930
10936
  FEATURE_LABELS_CSV: "featureLabels.csv",
@@ -10937,6 +10943,8 @@ const FileType$1 = {
10937
10943
  OBS_FEATURE_MATRIX_ANNDATA_ZARR: "obsFeatureMatrix.anndata.zarr",
10938
10944
  OBS_SETS_ANNDATA_ZARR: "obsSets.anndata.zarr",
10939
10945
  OBS_EMBEDDING_ANNDATA_ZARR: "obsEmbedding.anndata.zarr",
10946
+ OBS_SPOTS_ANNDATA_ZARR: "obsSpots.anndata.zarr",
10947
+ OBS_POINTS_ANNDATA_ZARR: "obsPoints.anndata.zarr",
10940
10948
  OBS_LOCATIONS_ANNDATA_ZARR: "obsLocations.anndata.zarr",
10941
10949
  OBS_SEGMENTATIONS_ANNDATA_ZARR: "obsSegmentations.anndata.zarr",
10942
10950
  OBS_LABELS_ANNDATA_ZARR: "obsLabels.anndata.zarr",
@@ -10945,6 +10953,8 @@ const FileType$1 = {
10945
10953
  OBS_FEATURE_MATRIX_MUDATA_ZARR: "obsFeatureMatrix.mudata.zarr",
10946
10954
  OBS_SETS_MUDATA_ZARR: "obsSets.mudata.zarr",
10947
10955
  OBS_EMBEDDING_MUDATA_ZARR: "obsEmbedding.mudata.zarr",
10956
+ OBS_SPOTS_MUDATA_ZARR: "obsSpots.mudata.zarr",
10957
+ OBS_POINTS_MUDATA_ZARR: "obsPoints.mudata.zarr",
10948
10958
  OBS_LOCATIONS_MUDATA_ZARR: "obsLocations.mudata.zarr",
10949
10959
  OBS_SEGMENTATIONS_MUDATA_ZARR: "obsSegmentations.mudata.zarr",
10950
10960
  OBS_LABELS_MUDATA_ZARR: "obsLabels.mudata.zarr",
@@ -10988,10 +10998,8 @@ const FileType$1 = {
10988
10998
  ANNDATA_EXPRESSION_MATRIX_ZARR: "anndata-expression-matrix.zarr"
10989
10999
  };
10990
11000
  const CoordinationType$1 = {
10991
- // Meta coordination scopes
10992
11001
  META_COORDINATION_SCOPES: "metaCoordinationScopes",
10993
11002
  META_COORDINATION_SCOPES_BY: "metaCoordinationScopesBy",
10994
- // Other coordination scopes
10995
11003
  DATASET: "dataset",
10996
11004
  // Entity types
10997
11005
  OBS_TYPE: "obsType",
@@ -11017,6 +11025,7 @@ const CoordinationType$1 = {
11017
11025
  SPATIAL_TARGET_X: "spatialTargetX",
11018
11026
  SPATIAL_TARGET_Y: "spatialTargetY",
11019
11027
  SPATIAL_TARGET_Z: "spatialTargetZ",
11028
+ SPATIAL_TARGET_T: "spatialTargetT",
11020
11029
  SPATIAL_ROTATION_X: "spatialRotationX",
11021
11030
  SPATIAL_ROTATION_Y: "spatialRotationY",
11022
11031
  SPATIAL_ROTATION_Z: "spatialRotationZ",
@@ -11054,7 +11063,46 @@ const CoordinationType$1 = {
11054
11063
  GATING_FEATURE_SELECTION_X: "gatingFeatureSelectionX",
11055
11064
  GATING_FEATURE_SELECTION_Y: "gatingFeatureSelectionY",
11056
11065
  FEATURE_VALUE_TRANSFORM_COEFFICIENT: "featureValueTransformCoefficient",
11057
- TOOLTIPS_VISIBLE: "tooltipsVisible"
11066
+ TOOLTIPS_VISIBLE: "tooltipsVisible",
11067
+ FILE_UID: "fileUid",
11068
+ IMAGE_LAYER: "imageLayer",
11069
+ IMAGE_CHANNEL: "imageChannel",
11070
+ SEGMENTATION_LAYER: "segmentationLayer",
11071
+ SEGMENTATION_CHANNEL: "segmentationChannel",
11072
+ SPATIAL_TARGET_C: "spatialTargetC",
11073
+ SPATIAL_LAYER_VISIBLE: "spatialLayerVisible",
11074
+ SPATIAL_LAYER_OPACITY: "spatialLayerOpacity",
11075
+ SPATIAL_LAYER_COLORMAP: "spatialLayerColormap",
11076
+ SPATIAL_LAYER_TRANSPARENT_COLOR: "spatialLayerTransparentColor",
11077
+ SPATIAL_LAYER_MODEL_MATRIX: "spatialLayerModelMatrix",
11078
+ SPATIAL_SEGMENTATION_FILLED: "spatialSegmentationFilled",
11079
+ SPATIAL_SEGMENTATION_STROKE_WIDTH: "spatialSegmentationStrokeWidth",
11080
+ SPATIAL_CHANNEL_COLOR: "spatialChannelColor",
11081
+ SPATIAL_CHANNEL_VISIBLE: "spatialChannelVisible",
11082
+ SPATIAL_CHANNEL_OPACITY: "spatialChannelOpacity",
11083
+ SPATIAL_CHANNEL_WINDOW: "spatialChannelWindow",
11084
+ PHOTOMETRIC_INTERPRETATION: "photometricInterpretation",
11085
+ // For 3D volume rendering
11086
+ SPATIAL_RENDERING_MODE: "spatialRenderingMode",
11087
+ VOLUMETRIC_RENDERING_ALGORITHM: "volumetricRenderingAlgorithm",
11088
+ SPATIAL_TARGET_RESOLUTION: "spatialTargetResolution",
11089
+ // For clipping plane sliders
11090
+ SPATIAL_SLICE_X: "spatialSliceX",
11091
+ SPATIAL_SLICE_Y: "spatialSliceY",
11092
+ SPATIAL_SLICE_Z: "spatialSliceZ",
11093
+ // For spatial spot and point layers
11094
+ SPOT_LAYER: "spotLayer",
11095
+ POINT_LAYER: "pointLayer",
11096
+ SPATIAL_SPOT_RADIUS: "spatialSpotRadius",
11097
+ SPATIAL_SPOT_FILLED: "spatialSpotFilled",
11098
+ SPATIAL_SPOT_STROKE_WIDTH: "spatialSpotStrokeWidth",
11099
+ SPATIAL_LAYER_COLOR: "spatialLayerColor",
11100
+ PIXEL_HIGHLIGHT: "pixelHighlight",
11101
+ TOOLTIP_CROSSHAIRS_VISIBLE: "tooltipCrosshairsVisible",
11102
+ LEGEND_VISIBLE: "legendVisible",
11103
+ SPATIAL_CHANNEL_LABELS_VISIBLE: "spatialChannelLabelsVisible",
11104
+ SPATIAL_CHANNEL_LABELS_ORIENTATION: "spatialChannelLabelsOrientation",
11105
+ SPATIAL_CHANNEL_LABEL_SIZE: "spatialChannelLabelSize"
11058
11106
  };
11059
11107
  const COMPONENT_COORDINATION_TYPES = {
11060
11108
  [ViewType$1.SCATTERPLOT]: [
@@ -11158,6 +11206,77 @@ const COMPONENT_COORDINATION_TYPES = {
11158
11206
  CoordinationType$1.MOLECULE_HIGHLIGHT,
11159
11207
  CoordinationType$1.TOOLTIPS_VISIBLE
11160
11208
  ],
11209
+ [ViewType$1.SPATIAL_BETA]: [
11210
+ CoordinationType$1.META_COORDINATION_SCOPES,
11211
+ CoordinationType$1.META_COORDINATION_SCOPES_BY,
11212
+ CoordinationType$1.DATASET,
11213
+ CoordinationType$1.OBS_TYPE,
11214
+ CoordinationType$1.OBS_LABELS_TYPE,
11215
+ CoordinationType$1.FEATURE_TYPE,
11216
+ CoordinationType$1.FEATURE_VALUE_TYPE,
11217
+ CoordinationType$1.SPATIAL_ZOOM,
11218
+ CoordinationType$1.SPATIAL_ROTATION,
11219
+ CoordinationType$1.SPATIAL_POINT_LAYER,
11220
+ CoordinationType$1.SPATIAL_NEIGHBORHOOD_LAYER,
11221
+ CoordinationType$1.SPATIAL_TARGET_X,
11222
+ CoordinationType$1.SPATIAL_TARGET_Y,
11223
+ CoordinationType$1.SPATIAL_TARGET_Z,
11224
+ CoordinationType$1.SPATIAL_TARGET_T,
11225
+ CoordinationType$1.SPATIAL_ROTATION_X,
11226
+ CoordinationType$1.SPATIAL_ROTATION_Y,
11227
+ CoordinationType$1.SPATIAL_ROTATION_Z,
11228
+ CoordinationType$1.SPATIAL_ROTATION_ORBIT,
11229
+ CoordinationType$1.SPATIAL_ORBIT_AXIS,
11230
+ CoordinationType$1.SPATIAL_AXIS_FIXED,
11231
+ CoordinationType$1.OBS_FILTER,
11232
+ CoordinationType$1.OBS_HIGHLIGHT,
11233
+ CoordinationType$1.OBS_SET_SELECTION,
11234
+ CoordinationType$1.OBS_SET_HIGHLIGHT,
11235
+ CoordinationType$1.OBS_SET_COLOR,
11236
+ CoordinationType$1.FEATURE_HIGHLIGHT,
11237
+ CoordinationType$1.FEATURE_SELECTION,
11238
+ CoordinationType$1.FEATURE_VALUE_COLORMAP,
11239
+ CoordinationType$1.FEATURE_VALUE_COLORMAP_RANGE,
11240
+ CoordinationType$1.OBS_COLOR_ENCODING,
11241
+ CoordinationType$1.ADDITIONAL_OBS_SETS,
11242
+ CoordinationType$1.MOLECULE_HIGHLIGHT,
11243
+ CoordinationType$1.TOOLTIPS_VISIBLE,
11244
+ CoordinationType$1.FILE_UID,
11245
+ CoordinationType$1.SPATIAL_TARGET_C,
11246
+ CoordinationType$1.SPATIAL_LAYER_VISIBLE,
11247
+ CoordinationType$1.SPATIAL_LAYER_OPACITY,
11248
+ CoordinationType$1.SPATIAL_LAYER_COLORMAP,
11249
+ CoordinationType$1.SPATIAL_LAYER_TRANSPARENT_COLOR,
11250
+ CoordinationType$1.SPATIAL_LAYER_MODEL_MATRIX,
11251
+ CoordinationType$1.SPATIAL_CHANNEL_COLOR,
11252
+ CoordinationType$1.SPATIAL_SEGMENTATION_FILLED,
11253
+ CoordinationType$1.SPATIAL_SEGMENTATION_STROKE_WIDTH,
11254
+ CoordinationType$1.IMAGE_LAYER,
11255
+ CoordinationType$1.SEGMENTATION_LAYER,
11256
+ CoordinationType$1.IMAGE_CHANNEL,
11257
+ CoordinationType$1.SEGMENTATION_CHANNEL,
11258
+ CoordinationType$1.SPATIAL_CHANNEL_VISIBLE,
11259
+ CoordinationType$1.SPATIAL_CHANNEL_OPACITY,
11260
+ CoordinationType$1.SPATIAL_CHANNEL_WINDOW,
11261
+ CoordinationType$1.SPATIAL_RENDERING_MODE,
11262
+ CoordinationType$1.VOLUMETRIC_RENDERING_ALGORITHM,
11263
+ CoordinationType$1.SPATIAL_TARGET_RESOLUTION,
11264
+ CoordinationType$1.SPATIAL_SLICE_X,
11265
+ CoordinationType$1.SPATIAL_SLICE_Y,
11266
+ CoordinationType$1.SPATIAL_SLICE_Z,
11267
+ CoordinationType$1.SPOT_LAYER,
11268
+ CoordinationType$1.POINT_LAYER,
11269
+ CoordinationType$1.SPATIAL_SPOT_RADIUS,
11270
+ CoordinationType$1.SPATIAL_SPOT_FILLED,
11271
+ CoordinationType$1.SPATIAL_SPOT_STROKE_WIDTH,
11272
+ CoordinationType$1.SPATIAL_LAYER_COLOR,
11273
+ CoordinationType$1.PIXEL_HIGHLIGHT,
11274
+ CoordinationType$1.TOOLTIP_CROSSHAIRS_VISIBLE,
11275
+ CoordinationType$1.LEGEND_VISIBLE,
11276
+ CoordinationType$1.SPATIAL_CHANNEL_LABELS_VISIBLE,
11277
+ CoordinationType$1.SPATIAL_CHANNEL_LABELS_ORIENTATION,
11278
+ CoordinationType$1.SPATIAL_CHANNEL_LABEL_SIZE
11279
+ ],
11161
11280
  [ViewType$1.HEATMAP]: [
11162
11281
  CoordinationType$1.DATASET,
11163
11282
  CoordinationType$1.OBS_TYPE,
@@ -11263,6 +11382,61 @@ const COMPONENT_COORDINATION_TYPES = {
11263
11382
  CoordinationType$1.SPATIAL_ROTATION_ORBIT,
11264
11383
  CoordinationType$1.SPATIAL_ORBIT_AXIS
11265
11384
  ],
11385
+ [ViewType$1.LAYER_CONTROLLER_BETA]: [
11386
+ CoordinationType$1.META_COORDINATION_SCOPES,
11387
+ CoordinationType$1.META_COORDINATION_SCOPES_BY,
11388
+ CoordinationType$1.DATASET,
11389
+ CoordinationType$1.OBS_TYPE,
11390
+ CoordinationType$1.FEATURE_TYPE,
11391
+ CoordinationType$1.FEATURE_VALUE_TYPE,
11392
+ CoordinationType$1.SPATIAL_POINT_LAYER,
11393
+ CoordinationType$1.SPATIAL_NEIGHBORHOOD_LAYER,
11394
+ CoordinationType$1.SPATIAL_ZOOM,
11395
+ CoordinationType$1.SPATIAL_TARGET_X,
11396
+ CoordinationType$1.SPATIAL_TARGET_Y,
11397
+ CoordinationType$1.SPATIAL_TARGET_Z,
11398
+ CoordinationType$1.SPATIAL_TARGET_T,
11399
+ CoordinationType$1.SPATIAL_ROTATION_X,
11400
+ CoordinationType$1.SPATIAL_ROTATION_Y,
11401
+ CoordinationType$1.SPATIAL_ROTATION_Z,
11402
+ CoordinationType$1.SPATIAL_ROTATION_ORBIT,
11403
+ CoordinationType$1.SPATIAL_ORBIT_AXIS,
11404
+ CoordinationType$1.FILE_UID,
11405
+ CoordinationType$1.SPATIAL_TARGET_C,
11406
+ CoordinationType$1.SPATIAL_LAYER_VISIBLE,
11407
+ CoordinationType$1.SPATIAL_LAYER_OPACITY,
11408
+ CoordinationType$1.SPATIAL_LAYER_COLORMAP,
11409
+ CoordinationType$1.SPATIAL_LAYER_TRANSPARENT_COLOR,
11410
+ CoordinationType$1.SPATIAL_LAYER_MODEL_MATRIX,
11411
+ CoordinationType$1.SPATIAL_CHANNEL_COLOR,
11412
+ CoordinationType$1.SPATIAL_SEGMENTATION_FILLED,
11413
+ CoordinationType$1.SPATIAL_SEGMENTATION_STROKE_WIDTH,
11414
+ CoordinationType$1.IMAGE_CHANNEL,
11415
+ CoordinationType$1.SEGMENTATION_CHANNEL,
11416
+ CoordinationType$1.SPATIAL_CHANNEL_VISIBLE,
11417
+ CoordinationType$1.SPATIAL_CHANNEL_OPACITY,
11418
+ CoordinationType$1.SPATIAL_CHANNEL_WINDOW,
11419
+ CoordinationType$1.PHOTOMETRIC_INTERPRETATION,
11420
+ CoordinationType$1.SPATIAL_RENDERING_MODE,
11421
+ CoordinationType$1.VOLUMETRIC_RENDERING_ALGORITHM,
11422
+ CoordinationType$1.SPATIAL_TARGET_RESOLUTION,
11423
+ CoordinationType$1.SPATIAL_SLICE_X,
11424
+ CoordinationType$1.SPATIAL_SLICE_Y,
11425
+ CoordinationType$1.SPATIAL_SLICE_Z,
11426
+ CoordinationType$1.SPOT_LAYER,
11427
+ CoordinationType$1.POINT_LAYER,
11428
+ CoordinationType$1.SPATIAL_SPOT_RADIUS,
11429
+ CoordinationType$1.SPATIAL_SPOT_FILLED,
11430
+ CoordinationType$1.SPATIAL_SPOT_STROKE_WIDTH,
11431
+ CoordinationType$1.SPATIAL_LAYER_COLOR,
11432
+ CoordinationType$1.OBS_COLOR_ENCODING,
11433
+ CoordinationType$1.TOOLTIPS_VISIBLE,
11434
+ CoordinationType$1.TOOLTIP_CROSSHAIRS_VISIBLE,
11435
+ CoordinationType$1.LEGEND_VISIBLE,
11436
+ CoordinationType$1.SPATIAL_CHANNEL_LABELS_VISIBLE,
11437
+ CoordinationType$1.SPATIAL_CHANNEL_LABELS_ORIENTATION,
11438
+ CoordinationType$1.SPATIAL_CHANNEL_LABEL_SIZE
11439
+ ],
11266
11440
  [ViewType$1.GENOMIC_PROFILES]: [
11267
11441
  CoordinationType$1.DATASET,
11268
11442
  CoordinationType$1.OBS_TYPE,
@@ -11554,6 +11728,8 @@ const annDataObsSets = z.array(z.object({
11554
11728
  ]),
11555
11729
  scorePath: z.string().optional().describe("The location in the AnnData store for the set confidence scores, like 'obs/celltype_prediction_score.'")
11556
11730
  }));
11731
+ const annDataObsSpots = annDataObsm;
11732
+ const annDataObsPoints = annDataObsm;
11557
11733
  const annDataObsLocations = annDataObsm;
11558
11734
  const annDataObsEmbedding = annDataObsm;
11559
11735
  const annDataObsSegmentations = annDataObs;
@@ -11580,10 +11756,21 @@ z.object({
11580
11756
  z.object({
11581
11757
  obsIndex: z.string(),
11582
11758
  obsEmbedding: z.array(z.string()).length(2)
11759
+ // TODO: support 3D?
11760
+ });
11761
+ z.object({
11762
+ obsIndex: z.string(),
11763
+ obsSpots: z.array(z.string()).length(2)
11764
+ // TODO: support 3D?
11765
+ });
11766
+ z.object({
11767
+ obsIndex: z.string(),
11768
+ obsPoints: z.array(z.string()).length(3)
11583
11769
  });
11584
11770
  z.object({
11585
11771
  obsIndex: z.string(),
11586
11772
  obsLocations: z.array(z.string()).length(2)
11773
+ // TODO: support 3D?
11587
11774
  });
11588
11775
  z.object({
11589
11776
  obsIndex: z.string(),
@@ -11615,6 +11802,8 @@ z.object({
11615
11802
  ]),
11616
11803
  obsFeatureMatrix: annDataObsFeatureMatrix,
11617
11804
  obsSets: annDataObsSets,
11805
+ obsSpots: annDataObsSpots,
11806
+ obsPoints: annDataObsPoints,
11618
11807
  obsLocations: annDataObsLocations,
11619
11808
  obsSegmentations: annDataObsSegmentations,
11620
11809
  obsEmbedding: z.union([
@@ -20370,17 +20559,17 @@ let COLOR;
20370
20559
  COLOR2[COLOR2["BRIGHT_CYAN"] = 96] = "BRIGHT_CYAN";
20371
20560
  COLOR2[COLOR2["BRIGHT_WHITE"] = 97] = "BRIGHT_WHITE";
20372
20561
  })(COLOR || (COLOR = {}));
20373
- function getColor(color) {
20562
+ function getColor$1(color) {
20374
20563
  return typeof color === "string" ? COLOR[color.toUpperCase()] || COLOR.WHITE : color;
20375
20564
  }
20376
20565
  function addColor(string, color, background) {
20377
20566
  if (!isBrowser$3 && typeof string === "string") {
20378
20567
  if (color) {
20379
- color = getColor(color);
20568
+ color = getColor$1(color);
20380
20569
  string = "\x1B[".concat(color, "m").concat(string, "\x1B[39m");
20381
20570
  }
20382
20571
  if (background) {
20383
- color = getColor(background);
20572
+ color = getColor$1(background);
20384
20573
  string = "\x1B[".concat(background + 10, "m").concat(string, "\x1B[49m");
20385
20574
  }
20386
20575
  }
@@ -30404,7 +30593,7 @@ function negate(out, a2) {
30404
30593
  out[2] = -a2[2];
30405
30594
  return out;
30406
30595
  }
30407
- function normalize$3(out, a2) {
30596
+ function normalize$4(out, a2) {
30408
30597
  var x2 = a2[0];
30409
30598
  var y2 = a2[1];
30410
30599
  var z2 = a2[2];
@@ -31713,7 +31902,7 @@ function squaredLength$1(a2) {
31713
31902
  var w2 = a2[3];
31714
31903
  return x2 * x2 + y2 * y2 + z2 * z2 + w2 * w2;
31715
31904
  }
31716
- function normalize$2(out, a2) {
31905
+ function normalize$3(out, a2) {
31717
31906
  var x2 = a2[0];
31718
31907
  var y2 = a2[1];
31719
31908
  var z2 = a2[2];
@@ -32350,7 +32539,7 @@ var dot$1 = dot$2;
32350
32539
  var lerp$1 = lerp$2;
32351
32540
  var length$2 = length$3;
32352
32541
  var squaredLength = squaredLength$1;
32353
- var normalize$1 = normalize$2;
32542
+ var normalize$2 = normalize$3;
32354
32543
  var rotationTo = function() {
32355
32544
  var tmpvec3 = create$3();
32356
32545
  var xUnitVec3 = fromValues(1, 0, 0);
@@ -32361,7 +32550,7 @@ var rotationTo = function() {
32361
32550
  cross(tmpvec3, xUnitVec3, a2);
32362
32551
  if (len(tmpvec3) < 1e-6)
32363
32552
  cross(tmpvec3, yUnitVec3, a2);
32364
- normalize$3(tmpvec3, tmpvec3);
32553
+ normalize$4(tmpvec3, tmpvec3);
32365
32554
  setAxisAngle(out, tmpvec3, Math.PI);
32366
32555
  return out;
32367
32556
  } else if (dot2 > 0.999999) {
@@ -32376,7 +32565,7 @@ var rotationTo = function() {
32376
32565
  out[1] = tmpvec3[1];
32377
32566
  out[2] = tmpvec3[2];
32378
32567
  out[3] = 1 + dot2;
32379
- return normalize$1(out, out);
32568
+ return normalize$2(out, out);
32380
32569
  }
32381
32570
  };
32382
32571
  }();
@@ -32402,7 +32591,7 @@ var rotationTo = function() {
32402
32591
  matr[2] = -view[0];
32403
32592
  matr[5] = -view[1];
32404
32593
  matr[8] = -view[2];
32405
- return normalize$1(out, fromMat3(out, matr));
32594
+ return normalize$2(out, fromMat3(out, matr));
32406
32595
  };
32407
32596
  })();
32408
32597
  const IDENTITY_QUATERNION = [0, 0, 0, 1];
@@ -54091,7 +54280,7 @@ function copyFlatRing(target, targetStartIndex, positions, size, srcStartIndex =
54091
54280
  modifyPolygonWindingDirection(target, windingDirection, windingOptions);
54092
54281
  return targetIndex;
54093
54282
  }
54094
- function normalize(polygon2, positionSize) {
54283
+ function normalize$1(polygon2, positionSize) {
54095
54284
  validate(polygon2);
54096
54285
  const positions = [];
54097
54286
  const holeIndices = [];
@@ -54197,7 +54386,7 @@ class PolygonTesselator extends Tesselator {
54197
54386
  }
54198
54387
  normalizeGeometry(polygon2) {
54199
54388
  if (this.normalize) {
54200
- const normalizedPolygon = normalize(polygon2, this.positionSize);
54389
+ const normalizedPolygon = normalize$1(polygon2, this.positionSize);
54201
54390
  if (this.opts.resolution) {
54202
54391
  return cutPolygonByGrid(getPositions(normalizedPolygon), getHoleIndices(normalizedPolygon), {
54203
54392
  size: this.positionSize,
@@ -54819,7 +55008,7 @@ class PolygonLayer extends CompositeLayer {
54819
55008
  objectInfo.index++;
54820
55009
  let polygon2 = getPolygon(object2, objectInfo);
54821
55010
  if (_normalize) {
54822
- polygon2 = normalize(polygon2, positionSize);
55011
+ polygon2 = normalize$1(polygon2, positionSize);
54823
55012
  }
54824
55013
  const {
54825
55014
  holeIndices
@@ -119678,28 +119867,38 @@ const PASS_THROUGH_PROPS = [
119678
119867
  ];
119679
119868
  class SelectionLayer extends CompositeLayer {
119680
119869
  _selectPolygonObjects(coordinates2) {
119681
- const { onSelect, getCellCoords, cellsQuadTree, flipY } = this.props;
119870
+ const { flipY, obsLayers } = this.props;
119682
119871
  const flippedCoordinates = flipY ? coordinates2.map((poly) => poly.map((p) => [p[0], -p[1]])) : coordinates2;
119683
119872
  const selectedPolygon = polygon(flippedCoordinates);
119684
- const pickingInfos = [];
119685
- cellsQuadTree.visit((node, x02, y02, x12, y12) => {
119686
- const nodePoints = [[[x02, y02], [x12, y02], [x12, y12], [x02, y12], [x02, y02]]];
119687
- const nodePolygon = polygon(nodePoints);
119688
- const nodePolygonContainsSelectedPolygon = booleanContains(nodePolygon, selectedPolygon);
119689
- const nodePolygonWithinSelectedPolygon = booleanWithin(nodePolygon, selectedPolygon);
119690
- const nodePolygonOverlapsSelectedPolgyon = booleanOverlap(nodePolygon, selectedPolygon);
119691
- if (!nodePolygonContainsSelectedPolygon && !nodePolygonWithinSelectedPolygon && !nodePolygonOverlapsSelectedPolgyon) {
119692
- return true;
119693
- }
119694
- if (node.data && booleanPointInPolygon$1(point([].slice.call(getCellCoords(node.data))), selectedPolygon)) {
119695
- pickingInfos.push(node.data);
119696
- }
119697
- return false;
119873
+ obsLayers.forEach((obsLayer) => {
119874
+ const { getObsCoords, obsQuadTree, obsIndex, onSelect: layerOnSelect } = obsLayer;
119875
+ const pickingInfos = [];
119876
+ obsQuadTree == null ? void 0 : obsQuadTree.visit((node, x02, y02, x12, y12) => {
119877
+ const nodePoints = [[[x02, y02], [x12, y02], [x12, y12], [x02, y12], [x02, y02]]];
119878
+ const nodePolygon = polygon(nodePoints);
119879
+ const nodePolygonContainsSelectedPolygon = booleanContains(nodePolygon, selectedPolygon);
119880
+ const nodePolygonWithinSelectedPolygon = booleanWithin(nodePolygon, selectedPolygon);
119881
+ const nodePolygonOverlapsSelectedPolgyon = booleanOverlap(nodePolygon, selectedPolygon);
119882
+ if (!nodePolygonContainsSelectedPolygon && !nodePolygonWithinSelectedPolygon && !nodePolygonOverlapsSelectedPolgyon) {
119883
+ return true;
119884
+ }
119885
+ if (node.data && booleanPointInPolygon$1(point([].slice.call(getObsCoords(node.data))), selectedPolygon)) {
119886
+ pickingInfos.push(node.data);
119887
+ }
119888
+ return false;
119889
+ });
119890
+ const pickingIds = pickingInfos.map((obsI) => obsIndex[obsI]);
119891
+ layerOnSelect(pickingIds);
119892
+ });
119893
+ }
119894
+ _selectEmpty() {
119895
+ const { obsLayers } = this.props;
119896
+ obsLayers.forEach((obsLayer) => {
119897
+ const { onSelect: layerOnSelect } = obsLayer;
119898
+ layerOnSelect([]);
119698
119899
  });
119699
- onSelect({ pickingInfos });
119700
119900
  }
119701
119901
  renderLayers() {
119702
- const { onSelect } = this.props;
119703
119902
  const mode = MODE_MAP[this.props.selectionType] || distEs6.ViewMode;
119704
119903
  const inheritedProps = {};
119705
119904
  PASS_THROUGH_PROPS.forEach((p) => {
@@ -119721,7 +119920,7 @@ class SelectionLayer extends CompositeLayer {
119721
119920
  const { coordinates: coordinates2 } = updatedData.features[0].geometry;
119722
119921
  this._selectPolygonObjects(coordinates2);
119723
119922
  } else if (editType === EDIT_TYPE_CLEAR) {
119724
- onSelect({ pickingInfos: [] });
119923
+ this._selectEmpty();
119725
119924
  }
119726
119925
  },
119727
119926
  _subLayerProps: {
@@ -119753,25 +119952,23 @@ SelectionLayer.defaultProps = defaultProps$f;
119753
119952
  function getBaseLayerId(layerId) {
119754
119953
  return `base-${layerId}`;
119755
119954
  }
119756
- function getSelectionLayers(tool, zoom, layerId, getCellCoords, obsIndex, updateCellsSelection, cellsQuadTree, flipY = false) {
119955
+ const onSelectNoop = ({ pickingInfos }) => {
119956
+ };
119957
+ function getSelectionLayer(tool, zoom, layerId, obsLayers, flipY = false) {
119757
119958
  if (!tool) {
119758
119959
  return [];
119759
119960
  }
119760
119961
  const cellBaseLayerId = getBaseLayerId(layerId);
119761
119962
  const editHandlePointRadius = 5 / (zoom + 16);
119762
- return [new SelectionLayer({
119963
+ return new SelectionLayer({
119763
119964
  id: "selection",
119764
119965
  flipY,
119765
- cellsQuadTree,
119766
- getCellCoords,
119966
+ obsLayers,
119767
119967
  coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
119768
119968
  selectionType: tool,
119769
- onSelect: ({ pickingInfos }) => {
119770
- const cellIds = pickingInfos.map((i2) => obsIndex[i2]);
119771
- if (updateCellsSelection) {
119772
- updateCellsSelection(cellIds);
119773
- }
119774
- },
119969
+ // This onSelect is no longer used since
119970
+ // the obsLayers each have their own onSelect.
119971
+ onSelect: onSelectNoop,
119775
119972
  layerIds: [cellBaseLayerId],
119776
119973
  getTentativeFillColor: () => [255, 255, 255, 95],
119777
119974
  getTentativeLineColor: () => [143, 143, 143, 255],
@@ -119783,7 +119980,7 @@ function getSelectionLayers(tool, zoom, layerId, getCellCoords, obsIndex, update
119783
119980
  editHandlePointRadiusScale: 1,
119784
119981
  editHandlePointRadiusMinPixels: editHandlePointRadius,
119785
119982
  editHandlePointRadiusMaxPixels: 2 * editHandlePointRadius
119786
- })];
119983
+ });
119787
119984
  }
119788
119985
  const TILE_SIZE = 4096;
119789
119986
  const DATA_TEXTURE_SIZE = 4096;
@@ -120897,16 +121094,16 @@ function addDecoder(cases, importFn) {
120897
121094
  }
120898
121095
  cases.forEach((c2) => registry$1.set(c2, importFn));
120899
121096
  }
120900
- addDecoder([void 0, 1], () => import("./raw-32c12810.js").then((m2) => m2.default));
120901
- addDecoder(5, () => import("./lzw-96dab2b2.js").then((m2) => m2.default));
121097
+ addDecoder([void 0, 1], () => import("./raw-602cd908.js").then((m2) => m2.default));
121098
+ addDecoder(5, () => import("./lzw-969b495e.js").then((m2) => m2.default));
120902
121099
  addDecoder(6, () => {
120903
121100
  throw new Error("old style JPEG compression is not supported.");
120904
121101
  });
120905
- addDecoder(7, () => import("./jpeg-57e5b50f.js").then((m2) => m2.default));
120906
- addDecoder([8, 32946], () => import("./deflate-13a7810b.js").then((m2) => m2.default));
120907
- addDecoder(32773, () => import("./packbits-943e1bc7.js").then((m2) => m2.default));
120908
- addDecoder(34887, () => import("./lerc-2b818719.js").then((m2) => m2.default));
120909
- addDecoder(50001, () => import("./webimage-4f5c5831.js").then((m2) => m2.default));
121102
+ addDecoder(7, () => import("./jpeg-a3397dc3.js").then((m2) => m2.default));
121103
+ addDecoder([8, 32946], () => import("./deflate-ee41da61.js").then((m2) => m2.default));
121104
+ addDecoder(32773, () => import("./packbits-e04429a8.js").then((m2) => m2.default));
121105
+ addDecoder(34887, () => import("./lerc-8b857b48.js").then((m2) => m2.default));
121106
+ addDecoder(50001, () => import("./webimage-9e7f3198.js").then((m2) => m2.default));
120910
121107
  function decodeRowAcc(row, stride) {
120911
121108
  let length2 = row.length - stride;
120912
121109
  let offset5 = 0;
@@ -127699,7 +127896,7 @@ const SIGNAL_ABORTED = "__vivSignalAborted";
127699
127896
  addDecoder(5, () => LZWDecoder);
127700
127897
  const MAX_COLOR_INTENSITY = 255;
127701
127898
  const DEFAULT_COLOR_OFF = [0, 0, 0];
127702
- const MAX_CHANNELS = 6;
127899
+ const MAX_CHANNELS$1 = 6;
127703
127900
  const DEFAULT_FONT_FAMILY = "-apple-system, 'Helvetica Neue', Arial, sans-serif";
127704
127901
  const DTYPE_VALUES = {
127705
127902
  Uint8: {
@@ -129215,7 +129412,7 @@ const AdditiveColormapExtension = class extends LayerExtension {
129215
129412
  };
129216
129413
  AdditiveColormapExtension.extensionName = "AdditiveColormapExtension";
129217
129414
  AdditiveColormapExtension.defaultProps = defaultProps$4$1;
129218
- const fs$1$1 = `uniform vec3 transparentColor;
129415
+ const fs$1$2 = `uniform vec3 transparentColor;
129219
129416
  uniform bool useTransparentColor;
129220
129417
  uniform float opacity;
129221
129418
 
@@ -129242,12 +129439,12 @@ rgba = apply_opacity(rgb);
129242
129439
  `;
129243
129440
  const colorPalette = {
129244
129441
  name: "color-palette-module",
129245
- fs: fs$1$1,
129442
+ fs: fs$1$2,
129246
129443
  inject: {
129247
129444
  "fs:DECKGL_MUTATE_COLOR": DECKGL_MUTATE_COLOR
129248
129445
  }
129249
129446
  };
129250
- function padWithDefault$2(arr, defaultValue2, padWidth) {
129447
+ function padWithDefault$3(arr, defaultValue2, padWidth) {
129251
129448
  for (let i2 = 0; i2 < padWidth; i2 += 1) {
129252
129449
  arr.push(defaultValue2);
129253
129450
  }
@@ -129273,8 +129470,8 @@ function padColors({ colors, channelsVisible }) {
129273
129470
  const newColors = colors.map(
129274
129471
  (color, i2) => channelsVisible[i2] ? color.map((c2) => c2 / MAX_COLOR_INTENSITY) : DEFAULT_COLOR_OFF
129275
129472
  );
129276
- const padSize = MAX_CHANNELS - newColors.length;
129277
- const paddedColors = padWithDefault$2(
129473
+ const padSize = MAX_CHANNELS$1 - newColors.length;
129474
+ const paddedColors = padWithDefault$3(
129278
129475
  newColors,
129279
129476
  DEFAULT_COLOR_OFF,
129280
129477
  padSize
@@ -129393,7 +129590,7 @@ const lens = {
129393
129590
  `
129394
129591
  }
129395
129592
  };
129396
- const defaultProps$2$1 = {
129593
+ const defaultProps$2$2 = {
129397
129594
  lensEnabled: { type: "boolean", value: false, compare: true },
129398
129595
  lensSelection: { type: "number", value: 0, compare: true },
129399
129596
  lensRadius: { type: "number", value: 100, compare: true },
@@ -129415,7 +129612,7 @@ const LensExtension = class extends LayerExtension {
129415
129612
  }
129416
129613
  const onMouseMove = () => {
129417
129614
  const { viewportId } = layer.props;
129418
- const { lensRadius = defaultProps$2$1.lensRadius.value } = this.props;
129615
+ const { lensRadius = defaultProps$2$2.lensRadius.value } = this.props;
129419
129616
  if (!viewportId) {
129420
129617
  layer.setState({ unprojectLensBounds: [0, 0, 0, 0] });
129421
129618
  return;
@@ -129462,10 +129659,10 @@ const LensExtension = class extends LayerExtension {
129462
129659
  const { unprojectLensBounds = [0, 0, 0, 0] } = this.state;
129463
129660
  const {
129464
129661
  bounds: bounds2,
129465
- lensEnabled = defaultProps$2$1.lensEnabled.value,
129466
- lensSelection = defaultProps$2$1.lensSelection.value,
129467
- lensBorderColor = defaultProps$2$1.lensBorderColor.value,
129468
- lensBorderRadius = defaultProps$2$1.lensBorderRadius.value,
129662
+ lensEnabled = defaultProps$2$2.lensEnabled.value,
129663
+ lensSelection = defaultProps$2$2.lensSelection.value,
129664
+ lensBorderColor = defaultProps$2$2.lensBorderColor.value,
129665
+ lensBorderRadius = defaultProps$2$2.lensBorderRadius.value,
129469
129666
  colors,
129470
129667
  channelsVisible
129471
129668
  } = this.props;
@@ -129506,7 +129703,7 @@ const LensExtension = class extends LayerExtension {
129506
129703
  }
129507
129704
  };
129508
129705
  LensExtension.extensionName = "LensExtension";
129509
- LensExtension.defaultProps = defaultProps$2$1;
129706
+ LensExtension.defaultProps = defaultProps$2$2;
129510
129707
  function colormapModuleFactory3D(name2, apply_cmap) {
129511
129708
  const fs2 = `${apply_cmap}
129512
129709
 
@@ -129746,7 +129943,7 @@ const channels = {
129746
129943
  function range(len2) {
129747
129944
  return [...Array(len2).keys()];
129748
129945
  }
129749
- function padWithDefault$1(arr, defaultValue2, padWidth) {
129946
+ function padWithDefault$2(arr, defaultValue2, padWidth) {
129750
129947
  for (let i2 = 0; i2 < padWidth; i2 += 1) {
129751
129948
  arr.push(defaultValue2);
129752
129949
  }
@@ -129770,13 +129967,13 @@ function padContrastLimits({
129770
129967
  const newContrastLimits = contrastLimits.map(
129771
129968
  (slider, i2) => channelsVisible[i2] ? slider : [maxSliderValue, maxSliderValue]
129772
129969
  );
129773
- const padSize = MAX_CHANNELS - newContrastLimits.length;
129970
+ const padSize = MAX_CHANNELS$1 - newContrastLimits.length;
129774
129971
  if (padSize < 0) {
129775
129972
  throw Error(
129776
129973
  `${newContrastLimits.lengths} channels passed in, but only 6 are allowed.`
129777
129974
  );
129778
129975
  }
129779
- const paddedContrastLimits = padWithDefault$1(
129976
+ const paddedContrastLimits = padWithDefault$2(
129780
129977
  newContrastLimits,
129781
129978
  [maxSliderValue, maxSliderValue],
129782
129979
  padSize
@@ -129806,7 +130003,7 @@ function makeBoundingBox(viewState) {
129806
130003
  viewport.unproject([0, viewport.height])
129807
130004
  ];
129808
130005
  }
129809
- const fs$1 = `#define SHADER_NAME xr-layer-fragment-shader
130006
+ const fs$1$1 = `#define SHADER_NAME xr-layer-fragment-shader
129810
130007
 
129811
130008
  precision highp float;
129812
130009
  precision highp int;
@@ -129847,7 +130044,7 @@ void main() {
129847
130044
  DECKGL_FILTER_COLOR(gl_FragColor, geometry);
129848
130045
  }
129849
130046
  `;
129850
- const vs$1 = `#define SHADER_NAME xr-layer-vertex-shader
130047
+ const vs$1$1 = `#define SHADER_NAME xr-layer-vertex-shader
129851
130048
 
129852
130049
  attribute vec2 texCoords;
129853
130050
  attribute vec3 positions;
@@ -129866,7 +130063,7 @@ void main(void) {
129866
130063
  DECKGL_FILTER_COLOR(color, geometry);
129867
130064
  }
129868
130065
  `;
129869
- const coreShaderModule = { fs: fs$1, vs: vs$1 };
130066
+ const coreShaderModule = { fs: fs$1$1, vs: vs$1$1 };
129870
130067
  function validateWebGL2Filter(gl, interpolation) {
129871
130068
  const canShowFloat = hasFeature(gl, FEATURES$1.TEXTURE_FLOAT);
129872
130069
  const canShowLinear = hasFeature(gl, FEATURES$1.TEXTURE_FILTER_LINEAR_FLOAT);
@@ -130600,7 +130797,7 @@ function getPosition$1(boundingBox, position, length2) {
130600
130797
  }
130601
130798
  }
130602
130799
  }
130603
- const defaultProps$2 = {
130800
+ const defaultProps$2$1 = {
130604
130801
  pickable: { type: "boolean", value: true, compare: true },
130605
130802
  viewState: {
130606
130803
  type: "object",
@@ -130693,7 +130890,7 @@ const ScaleBarLayer = class extends CompositeLayer {
130693
130890
  }
130694
130891
  };
130695
130892
  ScaleBarLayer.layerName = "ScaleBarLayer";
130696
- ScaleBarLayer.defaultProps = defaultProps$2;
130893
+ ScaleBarLayer.defaultProps = defaultProps$2$1;
130697
130894
  const vs$2 = `#version 300 es
130698
130895
  #define SHADER_NAME xr-layer-vertex-shader
130699
130896
 
@@ -131099,7 +131296,7 @@ const XR3DLayer = class extends Layer {
131099
131296
  });
131100
131297
  const invertedScaleMatrix = scaleMatrix.clone().invert();
131101
131298
  const invertedResolutionMatrix = resolutionMatrix.clone().invert();
131102
- const paddedClippingPlanes = padWithDefault$1(
131299
+ const paddedClippingPlanes = padWithDefault$2(
131103
131300
  clippingPlanes.map(
131104
131301
  (p) => p.clone().transform(invertedScaleMatrix).transform(invertedResolutionMatrix)
131105
131302
  ),
@@ -131411,7 +131608,7 @@ const VolumeLayer = class extends CompositeLayer {
131411
131608
  };
131412
131609
  VolumeLayer.layerName = "VolumeLayer";
131413
131610
  VolumeLayer.defaultProps = defaultProps$9;
131414
- const vs = `
131611
+ const vs$1 = `
131415
131612
  #define SHADER_NAME bitmask-layer-vertex-shader
131416
131613
 
131417
131614
  attribute vec2 texCoords;
@@ -131432,7 +131629,7 @@ void main(void) {
131432
131629
  DECKGL_FILTER_COLOR(color, geometry);
131433
131630
  }
131434
131631
  `;
131435
- const fs = `
131632
+ const fs$1 = `
131436
131633
  #define SHADER_NAME bitmask-layer-fragment-shader
131437
131634
  precision highp float;
131438
131635
 
@@ -131500,14 +131697,14 @@ void main() {
131500
131697
  DECKGL_FILTER_COLOR(gl_FragColor, geometry);
131501
131698
  }
131502
131699
  `;
131503
- function padWithDefault(arr, defaultValue2, padWidth) {
131700
+ function padWithDefault$1(arr, defaultValue2, padWidth) {
131504
131701
  const newArr = [...arr];
131505
131702
  for (let i2 = 0; i2 < padWidth; i2 += 1) {
131506
131703
  newArr.push(defaultValue2);
131507
131704
  }
131508
131705
  return newArr;
131509
131706
  }
131510
- const defaultProps$1 = {
131707
+ const defaultProps$2 = {
131511
131708
  hoveredCell: { type: "number", value: null, compare: true },
131512
131709
  // We do not want to deep-compare cellColorData,
131513
131710
  // as it is potentially a TypedArray with millions of elements.
@@ -131519,13 +131716,13 @@ const defaultProps$1 = {
131519
131716
  // Same as with cellColorData, we do not want to deep-compare expressionData.
131520
131717
  expressionData: { type: "object", value: null, compare: 0 }
131521
131718
  };
131522
- class BitmaskLayer extends XRLayer {
131719
+ let BitmaskLayer$1 = class BitmaskLayer extends XRLayer {
131523
131720
  // eslint-disable-next-line class-methods-use-this
131524
131721
  getShaders() {
131525
131722
  const { colormap } = this.props;
131526
131723
  return {
131527
- fs,
131528
- vs,
131724
+ fs: fs$1,
131725
+ vs: vs$1,
131529
131726
  modules: [project32, picking],
131530
131727
  defines: {
131531
131728
  [COLORMAP_SHADER_PLACEHOLDER]: GLSL_COLORMAPS.includes(colormap) ? colormap : GLSL_COLORMAP_DEFAULT
@@ -131585,7 +131782,7 @@ class BitmaskLayer extends XRLayer {
131585
131782
  expressionTex,
131586
131783
  colorTexHeight: colorTex.height,
131587
131784
  colorTexWidth: colorTex.width,
131588
- channelsVisible: padWithDefault(
131785
+ channelsVisible: padWithDefault$1(
131589
131786
  channelsVisible,
131590
131787
  false,
131591
131788
  // There are six texture entries on the shaders
@@ -131622,9 +131819,564 @@ class BitmaskLayer extends XRLayer {
131622
131819
  type: GL$1.FLOAT
131623
131820
  });
131624
131821
  }
131822
+ };
131823
+ BitmaskLayer$1.layerName = "BitmaskLayer";
131824
+ BitmaskLayer$1.defaultProps = defaultProps$2;
131825
+ const vs = `
131826
+ #define SHADER_NAME bitmask-layer-vertex-shader
131827
+
131828
+ attribute vec2 texCoords;
131829
+ attribute vec3 positions;
131830
+ attribute vec3 positions64Low;
131831
+ attribute vec3 instancePickingColors;
131832
+
131833
+ varying vec2 vTexCoord;
131834
+
131835
+ void main(void) {
131836
+ geometry.worldPosition = positions;
131837
+ geometry.uv = texCoords;
131838
+ geometry.pickingColor = instancePickingColors;
131839
+ gl_Position = project_position_to_clipspace(positions, positions64Low, vec3(0.0), geometry.position);
131840
+ DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
131841
+ vTexCoord = texCoords;
131842
+ vec4 color = vec4(0.0);
131843
+ DECKGL_FILTER_COLOR(color, geometry);
131844
+ }
131845
+ `;
131846
+ const fs = `
131847
+ #define SHADER_NAME bitmask-layer-fragment-shader
131848
+ precision highp float;
131849
+
131850
+ ${colormaps}
131851
+
131852
+ // Note: can have a maximum of 16 textures in most browsers
131853
+ // Reference: https://webglreport.com/
131854
+
131855
+ // Data (mask) texture
131856
+ uniform sampler2D channel0;
131857
+ uniform sampler2D channel1;
131858
+ uniform sampler2D channel2;
131859
+ uniform sampler2D channel3;
131860
+ uniform sampler2D channel4;
131861
+ uniform sampler2D channel5;
131862
+ uniform sampler2D channel6;
131863
+
131864
+ // Color texture
131865
+ uniform float hovered;
131866
+
131867
+ // Channel-specific properties
131868
+ uniform bool channelsVisible[7];
131869
+ uniform float channelOpacities[7];
131870
+ uniform bool channelIsStaticColorMode[7]; // TODO: should this be a single float?
131871
+ uniform bool channelIsSetColorMode[7]; // TODO: should this be a single float?
131872
+
131873
+ // TODO: can array of tuples/vec2 be used?
131874
+ uniform float channelColormapRangeStarts[7];
131875
+ uniform float channelColormapRangeEnds[7];
131876
+
131877
+ uniform float multiFeatureTexSize;
131878
+
131879
+ // Use one expressionTex for all channels, using an offset mechanism.
131880
+ uniform sampler2D valueTex;
131881
+ uniform float valueTexOffsets[7];
131882
+ uniform float valueTexHeight;
131883
+
131884
+ // Textures for set colors, using the same offset mechanism.
131885
+ uniform sampler2D colorTex;
131886
+ uniform float colorTexOffsets[7];
131887
+ uniform float colorTexHeight;
131888
+
131889
+
131890
+ // Static colors
131891
+ // TODO: For some reason I cannot use uniform vec3 colors[7]; and i cannot figure out why.
131892
+ uniform vec3 color0;
131893
+ uniform vec3 color1;
131894
+ uniform vec3 color2;
131895
+ uniform vec3 color3;
131896
+ uniform vec3 color4;
131897
+ uniform vec3 color5;
131898
+ uniform vec3 color6;
131899
+
131900
+ // Info for edge-only mode
131901
+ uniform float scaleFactor;
131902
+ uniform bool channelsFilled[7];
131903
+ uniform float channelStrokeWidths[7];
131904
+
131905
+ // opacity
131906
+ uniform float opacity;
131907
+
131908
+ varying vec2 vTexCoord;
131909
+
131910
+ vec3 sampleAndGetData(sampler2D dataTex, vec2 coord, bool isFilled, float strokeWidth, bool isOn) {
131911
+ float sampledData = texture(dataTex, coord).r;
131912
+ float clampedSampledData = max(0., min(sampledData, 1.));
131913
+
131914
+ bool isEdge = true;
131915
+
131916
+ if(!isFilled) {
131917
+ vec2 uTextureSize = vec2(2048.0, 2048.0);
131918
+ vec2 onePixel = vec2(1.0, 1.0) / uTextureSize;
131919
+
131920
+ // Vary the edgeSize based on user-defined stroke width.
131921
+ float edgeSize = 150.0 * strokeWidth * scaleFactor;
131922
+
131923
+ float pixN = texture(dataTex, coord + vec2(0.0, onePixel.y * edgeSize)).r;
131924
+ float pixS = texture(dataTex, coord - vec2(0.0, onePixel.y * edgeSize)).r;
131925
+ float pixW = texture(dataTex, coord + vec2(onePixel.x * edgeSize, 0.0)).r;
131926
+ float pixE = texture(dataTex, coord - vec2(onePixel.x * edgeSize, 0.0)).r;
131927
+
131928
+ float pixNW = texture(dataTex, coord + vec2(onePixel.y * edgeSize, onePixel.y * edgeSize)).r;
131929
+ float pixNE = texture(dataTex, coord + vec2(-1.0 * onePixel.x * edgeSize, onePixel.y * edgeSize)).r;
131930
+ float pixSW = texture(dataTex, coord - vec2(onePixel.x * edgeSize, onePixel.y * edgeSize)).r;
131931
+ float pixSE = texture(dataTex, coord - vec2(-1.0 * onePixel.x * edgeSize, onePixel.y * edgeSize)).r;
131932
+
131933
+ isEdge = (pixN != sampledData || pixS != sampledData || pixW != sampledData || pixE != sampledData || pixNW != sampledData || pixNE != sampledData || pixSW != sampledData || pixSE != sampledData);
131934
+ }
131935
+ // Return a tuple of (sampledData, isEdge)
131936
+ return vec3(clampedSampledData * float(isOn), sampledData, float(isEdge));
131625
131937
  }
131626
- BitmaskLayer.layerName = "BitmaskLayer";
131627
- BitmaskLayer.defaultProps = defaultProps$1;
131938
+
131939
+ vec4 dataToColor(vec3 sampledDataAndIsEdge, bool isStaticColorMode, vec3 channelColor, float channelOpacity, float valueOffset, float rangeStart, float rangeEnd, bool isSetColorMode, float setColorOffset) {
131940
+ float clampedSampledDataAndIsOn = sampledDataAndIsEdge.x;
131941
+ float sampledData = sampledDataAndIsEdge.y;
131942
+ float isEdge = sampledDataAndIsEdge.z;
131943
+
131944
+
131945
+ vec4 hoveredColor = float(sampledData == hovered && sampledData > 0. && hovered > 0.) * vec4(0., 0., 1., 1.);
131946
+
131947
+ // Colors are laid out corresponding to ids in row-major order in the texture. So if width of the texture is 10, and you want ID 25,
131948
+ // you need coordinate (1, 4) (i.e 2 rows down, and 5 columns over indexed from 0 for a total of 25 units covered in row major order).
131949
+ float offsetSampledData = sampledData + valueOffset - 1.0;
131950
+ vec2 colorTexCoord = vec2(mod(offsetSampledData, multiFeatureTexSize) / multiFeatureTexSize, floor(offsetSampledData / multiFeatureTexSize) / (valueTexHeight - 1.));
131951
+
131952
+ // Get expression value
131953
+ float expressionValue = texture(valueTex, colorTexCoord).r / 255.;
131954
+ float scaledExpressionValue = (expressionValue - rangeStart) / max(0.005, (rangeEnd - rangeStart));
131955
+
131956
+
131957
+ // Get set color index value
131958
+ vec2 setIndicesTexCoord = vec2(mod(offsetSampledData, multiFeatureTexSize) / multiFeatureTexSize, floor(offsetSampledData / multiFeatureTexSize) / (valueTexHeight - 1.));
131959
+ float setColorIndex = texture(valueTex, setIndicesTexCoord).r;
131960
+
131961
+ // Initialize to the default "null" color.
131962
+ vec3 setColor = vec3(200. / 255., 200. / 255., 200. / 255.);
131963
+ if(setColorIndex != 0.) {
131964
+ // Subtract one from setColorIndex because we have already checked for the "null" value.
131965
+ setColorIndex = setColorIndex - 1.;
131966
+
131967
+ float setColorOffsetR = (setColorIndex + setColorOffset) * 3.0 + 0.0;
131968
+ vec2 setColorTexCoordR = vec2(mod(setColorOffsetR, multiFeatureTexSize) / multiFeatureTexSize, floor(setColorOffsetR / multiFeatureTexSize) / (colorTexHeight - 1.));
131969
+ float setColorR = texture(colorTex, setColorTexCoordR).r / 255.;
131970
+
131971
+ float setColorOffsetG = (setColorIndex + setColorOffset) * 3.0 + 1.0;
131972
+ vec2 setColorTexCoordG = vec2(mod(setColorOffsetG, multiFeatureTexSize) / multiFeatureTexSize, floor(setColorOffsetG / multiFeatureTexSize) / (colorTexHeight - 1.));
131973
+ float setColorG = texture(colorTex, setColorTexCoordG).r / 255.;
131974
+
131975
+ float setColorOffsetB = (setColorIndex + setColorOffset) * 3.0 + 2.0;
131976
+ vec2 setColorTexCoordB = vec2(mod(setColorOffsetB, multiFeatureTexSize) / multiFeatureTexSize, floor(setColorOffsetB / multiFeatureTexSize) / (colorTexHeight - 1.));
131977
+ float setColorB = texture(colorTex, setColorTexCoordB).r / 255.;
131978
+
131979
+ setColor = vec3(setColorR, setColorG, setColorB);
131980
+ }
131981
+
131982
+
131983
+ vec4 sampledColor = (1. - (float(isStaticColorMode) + float(isSetColorMode))) * vec4(COLORMAP_FUNC(clamp(scaledExpressionValue, 0.0, 1.0)).rgb, channelOpacity) + float(isStaticColorMode) * vec4(channelColor.rgb, channelOpacity) + float(isSetColorMode) * vec4(setColor, channelOpacity);
131984
+ // Only return a color if the data is non-zero.
131985
+
131986
+ return clampedSampledDataAndIsOn * isEdge * sampledColor;
131987
+ }
131988
+
131989
+ void main() {
131990
+
131991
+ // Get the color and alpha value for each channel.
131992
+ vec3 dat0 = sampleAndGetData(channel0, vTexCoord, channelsFilled[0], channelStrokeWidths[0], channelsVisible[0]);
131993
+ vec3 dat1 = sampleAndGetData(channel1, vTexCoord, channelsFilled[1], channelStrokeWidths[1], channelsVisible[1]);
131994
+ vec3 dat2 = sampleAndGetData(channel2, vTexCoord, channelsFilled[2], channelStrokeWidths[2], channelsVisible[2]);
131995
+ vec3 dat3 = sampleAndGetData(channel3, vTexCoord, channelsFilled[3], channelStrokeWidths[3], channelsVisible[3]);
131996
+ vec3 dat4 = sampleAndGetData(channel4, vTexCoord, channelsFilled[4], channelStrokeWidths[4], channelsVisible[4]);
131997
+ vec3 dat5 = sampleAndGetData(channel5, vTexCoord, channelsFilled[5], channelStrokeWidths[5], channelsVisible[5]);
131998
+ vec3 dat6 = sampleAndGetData(channel6, vTexCoord, channelsFilled[6], channelStrokeWidths[6], channelsVisible[6]);
131999
+
132000
+ vec4 val0 = dataToColor(dat0, channelIsStaticColorMode[0], color0, channelOpacities[0], valueTexOffsets[0], channelColormapRangeStarts[0], channelColormapRangeEnds[0], channelIsSetColorMode[0], colorTexOffsets[0]);
132001
+ vec4 val1 = dataToColor(dat1, channelIsStaticColorMode[1], color1, channelOpacities[1], valueTexOffsets[1], channelColormapRangeStarts[1], channelColormapRangeEnds[1], channelIsSetColorMode[1], colorTexOffsets[1]);
132002
+ vec4 val2 = dataToColor(dat2, channelIsStaticColorMode[2], color2, channelOpacities[2], valueTexOffsets[2], channelColormapRangeStarts[2], channelColormapRangeEnds[2], channelIsSetColorMode[2], colorTexOffsets[2]);
132003
+ vec4 val3 = dataToColor(dat3, channelIsStaticColorMode[3], color3, channelOpacities[3], valueTexOffsets[3], channelColormapRangeStarts[3], channelColormapRangeEnds[3], channelIsSetColorMode[3], colorTexOffsets[3]);
132004
+ vec4 val4 = dataToColor(dat4, channelIsStaticColorMode[4], color4, channelOpacities[4], valueTexOffsets[4], channelColormapRangeStarts[4], channelColormapRangeEnds[4], channelIsSetColorMode[4], colorTexOffsets[4]);
132005
+ vec4 val5 = dataToColor(dat5, channelIsStaticColorMode[5], color5, channelOpacities[5], valueTexOffsets[5], channelColormapRangeStarts[5], channelColormapRangeEnds[5], channelIsSetColorMode[5], colorTexOffsets[5]);
132006
+ vec4 val6 = dataToColor(dat6, channelIsStaticColorMode[6], color6, channelOpacities[6], valueTexOffsets[6], channelColormapRangeStarts[6], channelColormapRangeEnds[6], channelIsSetColorMode[6], colorTexOffsets[6]);
132007
+
132008
+ // If all of the channels are "empty", then discard this pixel so that it is not considered during picking.
132009
+ float emptyDat = 0.;
132010
+ if(dat0.x == emptyDat && dat1.x == emptyDat && dat2.x == emptyDat && dat3.x == emptyDat && dat4.x == emptyDat && dat5.x == emptyDat && dat6.x == emptyDat) {
132011
+ discard;
132012
+ }
132013
+
132014
+ // If the next channel color and the currently stored color (gl_FragColor) are identical,
132015
+ // or the next channel color is transparent black,
132016
+ // just use the currently stored color. Repeat this for all channels.
132017
+
132018
+ // Mix colors where necessary, using the alpha value of the next channel as the weight.
132019
+ // Use the maximum alpha value as the resulting alpha value.
132020
+ gl_FragColor = val0;
132021
+ gl_FragColor = (val1 == gl_FragColor || val1 == vec4(0.)) ? gl_FragColor : vec4(mix(gl_FragColor, val1, val1.a).rgb, max(gl_FragColor.a, val1.a));
132022
+ gl_FragColor = (val2 == gl_FragColor || val2 == vec4(0.)) ? gl_FragColor : vec4(mix(gl_FragColor, val2, val2.a).rgb, max(gl_FragColor.a, val2.a));
132023
+ gl_FragColor = (val3 == gl_FragColor || val3 == vec4(0.)) ? gl_FragColor : vec4(mix(gl_FragColor, val3, val3.a).rgb, max(gl_FragColor.a, val3.a));
132024
+ gl_FragColor = (val4 == gl_FragColor || val4 == vec4(0.)) ? gl_FragColor : vec4(mix(gl_FragColor, val4, val4.a).rgb, max(gl_FragColor.a, val4.a));
132025
+ gl_FragColor = (val5 == gl_FragColor || val5 == vec4(0.)) ? gl_FragColor : vec4(mix(gl_FragColor, val5, val5.a).rgb, max(gl_FragColor.a, val5.a));
132026
+ gl_FragColor = (val6 == gl_FragColor || val6 == vec4(0.)) ? gl_FragColor : vec4(mix(gl_FragColor, val6, val6.a).rgb, max(gl_FragColor.a, val6.a));
132027
+
132028
+
132029
+
132030
+ // TODO: multiply the resulting channel-level opacity value by the layer-level opacity value.
132031
+
132032
+ geometry.uv = vTexCoord;
132033
+ DECKGL_FILTER_COLOR(gl_FragColor, geometry);
132034
+ }
132035
+ `;
132036
+ function normalize(arr) {
132037
+ const [min, max] = extent$1(arr);
132038
+ const ratio = 255 / (max - min);
132039
+ const data = new Uint8Array(arr.map((i2) => Math.floor((i2 - min) * ratio)));
132040
+ return data;
132041
+ }
132042
+ function multiSetsToTextureData(multiFeatureValues, setColorValues, channelIsSetColorMode, texSize) {
132043
+ let totalValuesLength = 0;
132044
+ let totalColorsLength = 0;
132045
+ channelIsSetColorMode.forEach((isSetColorMode, channelIndex) => {
132046
+ var _a2, _b, _c, _d, _e;
132047
+ if (isSetColorMode) {
132048
+ totalValuesLength += ((_b = (_a2 = setColorValues[channelIndex]) == null ? void 0 : _a2.obsIndex) == null ? void 0 : _b.length) || 0;
132049
+ totalColorsLength += (((_d = (_c = setColorValues[channelIndex]) == null ? void 0 : _c.setColors) == null ? void 0 : _d.length) || 0) * 3;
132050
+ } else {
132051
+ totalValuesLength += ((_e = multiFeatureValues[channelIndex]) == null ? void 0 : _e.length) || 0;
132052
+ }
132053
+ });
132054
+ const valueTexHeight = Math.max(2, Math.ceil(totalValuesLength / texSize));
132055
+ const colorTexHeight = Math.max(2, Math.ceil(totalColorsLength / texSize));
132056
+ if (valueTexHeight > texSize) {
132057
+ console.error("Error: length of concatenated quantitative feature values larger than maximum texture size");
132058
+ }
132059
+ if (colorTexHeight > texSize) {
132060
+ console.error("Error: length of concatenated quantitative feature values larger than maximum texture size");
132061
+ }
132062
+ const totalData = new Uint8Array(texSize * valueTexHeight);
132063
+ const totalColors = new Uint8Array(texSize * colorTexHeight);
132064
+ const indicesOffsets = [];
132065
+ const colorsOffsets = [];
132066
+ let indexOffset = 0;
132067
+ let colorOffset = 0;
132068
+ channelIsSetColorMode.forEach((isSetColorMode, channelIndex) => {
132069
+ if (isSetColorMode) {
132070
+ const { setColorIndices, setColors, obsIndex } = setColorValues[channelIndex] || {};
132071
+ if (setColorIndices && setColors && obsIndex) {
132072
+ for (let i2 = 0; i2 < obsIndex.length; i2++) {
132073
+ const colorIndex = setColorIndices.get(String(i2 + 1));
132074
+ totalData[indexOffset + i2] = colorIndex === void 0 ? 0 : colorIndex + 1;
132075
+ }
132076
+ for (let i2 = 0; i2 < setColors.length; i2++) {
132077
+ const { color: [r2, g2, b] } = setColors[i2];
132078
+ totalColors[(colorOffset + i2) * 3 + 0] = r2;
132079
+ totalColors[(colorOffset + i2) * 3 + 1] = g2;
132080
+ totalColors[(colorOffset + i2) * 3 + 2] = b;
132081
+ }
132082
+ }
132083
+ indicesOffsets.push(indexOffset);
132084
+ colorsOffsets.push(colorOffset);
132085
+ indexOffset += (obsIndex == null ? void 0 : obsIndex.length) || 0;
132086
+ colorOffset += (setColors == null ? void 0 : setColors.length) || 0;
132087
+ } else {
132088
+ const featureArr = multiFeatureValues[channelIndex];
132089
+ totalData.set(normalize(featureArr), indexOffset);
132090
+ indicesOffsets.push(indexOffset);
132091
+ indexOffset += featureArr.length;
132092
+ colorsOffsets.push(colorOffset);
132093
+ }
132094
+ });
132095
+ return [
132096
+ totalData,
132097
+ valueTexHeight,
132098
+ indicesOffsets,
132099
+ totalColors,
132100
+ colorTexHeight,
132101
+ colorsOffsets
132102
+ ];
132103
+ }
132104
+ const MAX_CHANNELS = 7;
132105
+ const MULTI_FEATURE_TEX_SIZE = 2048;
132106
+ function padWithDefault(arr, defaultValue2, padWidth) {
132107
+ const newArr = [...arr];
132108
+ for (let i2 = 0; i2 < padWidth; i2 += 1) {
132109
+ newArr.push(defaultValue2);
132110
+ }
132111
+ return newArr;
132112
+ }
132113
+ function getColor(arr) {
132114
+ return arr ? arr.map((v) => v / 255) : [0, 0, 0];
132115
+ }
132116
+ const defaultProps$1 = {
132117
+ channelStrokeWidths: { type: "array", value: null, compare: true },
132118
+ channelsFilled: { type: "array", value: null, compare: true },
132119
+ channelOpacities: { type: "array", value: null, compare: true },
132120
+ channelColors: { type: "array", value: null, compare: true },
132121
+ hoveredCell: { type: "number", value: null, compare: true },
132122
+ colormap: { type: "string", value: GLSL_COLORMAP_DEFAULT, compare: true },
132123
+ expressionData: { type: "object", value: null, compare: true },
132124
+ multiFeatureValues: { type: "array", value: null, compare: true },
132125
+ setColorValues: { type: "array", value: null, compare: true },
132126
+ channelFeatureValueColormaps: { type: "array", value: null, compare: true },
132127
+ channelFeatureValueColormapRanges: { type: "array", value: null, compare: true },
132128
+ channelIsStaticColorMode: { type: "array", value: null, compare: true },
132129
+ channelIsSetColorMode: { type: "array", value: null, compare: true }
132130
+ };
132131
+ class BitmaskLayer2 extends XRLayer {
132132
+ // eslint-disable-next-line class-methods-use-this
132133
+ getShaders() {
132134
+ const { colormap } = this.props;
132135
+ return {
132136
+ fs,
132137
+ vs,
132138
+ modules: [project32, picking],
132139
+ defines: {
132140
+ [COLORMAP_SHADER_PLACEHOLDER]: GLSL_COLORMAPS.includes(colormap) ? colormap : GLSL_COLORMAP_DEFAULT
132141
+ }
132142
+ };
132143
+ }
132144
+ /**
132145
+ * Override the parent loadChannelTextures to enable
132146
+ * up to eight channels (rather than six).
132147
+ * Reference: https://github.com/hms-dbmi/viv/blob/v0.13.3/packages/layers/src/xr-layer/xr-layer.js#L316
132148
+ */
132149
+ loadChannelTextures(channelData) {
132150
+ const textures = {
132151
+ channel0: null,
132152
+ channel1: null,
132153
+ channel2: null,
132154
+ channel3: null,
132155
+ channel4: null,
132156
+ channel5: null,
132157
+ channel6: null
132158
+ };
132159
+ if (this.state.textures) {
132160
+ Object.values(this.state.textures).forEach((tex) => tex && tex.delete());
132161
+ }
132162
+ if (channelData && Object.keys(channelData).length > 0 && channelData.data) {
132163
+ channelData.data.forEach((d, i2) => {
132164
+ textures[`channel${i2}`] = this.dataToTexture(d, channelData.width, channelData.height);
132165
+ }, this);
132166
+ this.setState({ textures });
132167
+ }
132168
+ }
132169
+ updateState({ props: props2, oldProps, changeFlags }) {
132170
+ super.updateState({ props: props2, oldProps, changeFlags });
132171
+ if (props2.multiFeatureValues !== oldProps.multiFeatureValues || props2.setColorValues !== oldProps.setColorValues || props2.channelIsSetColorMode !== oldProps.channelIsSetColorMode) {
132172
+ const { multiFeatureValues, setColorValues, channelIsSetColorMode } = this.props;
132173
+ const [valueTex, colorTex, valueTexOffsets, colorTexOffsets, valueTexHeight, colorTexHeight] = this.multiSetsToTexture(multiFeatureValues, setColorValues, channelIsSetColorMode);
132174
+ this.setState({
132175
+ valueTex,
132176
+ colorTex,
132177
+ valueTexOffsets,
132178
+ colorTexOffsets,
132179
+ valueTexHeight,
132180
+ colorTexHeight
132181
+ });
132182
+ }
132183
+ if (props2.colormap !== oldProps.colormap) {
132184
+ const { gl } = this.context;
132185
+ if (this.state.model) {
132186
+ this.state.model.delete();
132187
+ }
132188
+ this.setState({ model: this._getModel(gl) });
132189
+ this.getAttributeManager().invalidateAll();
132190
+ }
132191
+ }
132192
+ draw(opts2) {
132193
+ const { uniforms } = opts2;
132194
+ const {
132195
+ channelStrokeWidths,
132196
+ channelsFilled,
132197
+ channelOpacities,
132198
+ channelColors,
132199
+ channelsVisible,
132200
+ // TODO: use `channelFeatureValueColormaps` in shader,
132201
+ // figure out how to call multiple GLSL colormap functions
132202
+ channelFeatureValueColormaps,
132203
+ channelFeatureValueColormapRanges,
132204
+ channelIsStaticColorMode,
132205
+ channelIsSetColorMode,
132206
+ hoveredCell,
132207
+ colorScaleLo,
132208
+ colorScaleHi,
132209
+ isExpressionMode,
132210
+ zoom,
132211
+ minZoom,
132212
+ maxZoom,
132213
+ zoomOffset
132214
+ // TODO: figure out if this needs to be used or not
132215
+ } = this.props;
132216
+ const {
132217
+ textures,
132218
+ model,
132219
+ // Expression and set index (and colors) textures with offsets
132220
+ valueTex,
132221
+ colorTex,
132222
+ valueTexOffsets,
132223
+ colorTexOffsets,
132224
+ valueTexHeight,
132225
+ colorTexHeight
132226
+ } = this.state;
132227
+ if (textures && model) {
132228
+ const scaleFactor = 1 / 2 ** (maxZoom - zoom);
132229
+ const colors = fromEntries(range$5(MAX_CHANNELS).map((i2) => [`color${i2}`, getColor(channelColors[i2])]));
132230
+ model.setUniforms(Object.assign({}, uniforms, {
132231
+ ...colors,
132232
+ // Bitmask image channel data textures
132233
+ ...textures,
132234
+ multiFeatureTexSize: MULTI_FEATURE_TEX_SIZE,
132235
+ // Expression textures with offsets
132236
+ valueTex,
132237
+ valueTexOffsets: padWithDefault(valueTexOffsets, 0, MAX_CHANNELS - valueTexOffsets.length),
132238
+ valueTexHeight,
132239
+ // Set indices and colors textures with offsets
132240
+ colorTex,
132241
+ colorTexOffsets: padWithDefault(colorTexOffsets, 0, MAX_CHANNELS - colorTexOffsets.length),
132242
+ colorTexHeight,
132243
+ // Visualization properties
132244
+ channelsFilled: padWithDefault(
132245
+ channelsFilled,
132246
+ true,
132247
+ // There are six texture entries on the shaders
132248
+ MAX_CHANNELS - channelsFilled.length
132249
+ ),
132250
+ channelOpacities: padWithDefault(
132251
+ channelOpacities,
132252
+ 0,
132253
+ // There are six texture entries on the shaders
132254
+ MAX_CHANNELS - channelOpacities.length
132255
+ ),
132256
+ channelStrokeWidths: padWithDefault(
132257
+ channelStrokeWidths,
132258
+ 1,
132259
+ // There are six texture entries on the shaders
132260
+ MAX_CHANNELS - channelStrokeWidths.length
132261
+ ),
132262
+ channelColormapRangeStarts: padWithDefault(
132263
+ channelFeatureValueColormapRanges.map((r2) => (r2 == null ? void 0 : r2[0]) || 0),
132264
+ 0,
132265
+ // There are six texture entries on the shaders
132266
+ MAX_CHANNELS - channelFeatureValueColormapRanges.length
132267
+ ),
132268
+ channelColormapRangeEnds: padWithDefault(
132269
+ channelFeatureValueColormapRanges.map((r2) => (r2 == null ? void 0 : r2[1]) || 1),
132270
+ 1,
132271
+ // There are six texture entries on the shaders
132272
+ MAX_CHANNELS - channelFeatureValueColormapRanges.length
132273
+ ),
132274
+ channelIsStaticColorMode: padWithDefault(
132275
+ channelIsStaticColorMode,
132276
+ true,
132277
+ // There are six texture entries on the shaders
132278
+ MAX_CHANNELS - channelIsStaticColorMode.length
132279
+ ),
132280
+ channelIsSetColorMode: padWithDefault(
132281
+ channelIsSetColorMode,
132282
+ false,
132283
+ // There are six texture entries on the shaders
132284
+ MAX_CHANNELS - channelIsSetColorMode.length
132285
+ ),
132286
+ hovered: hoveredCell || 0,
132287
+ channelsVisible: padWithDefault(
132288
+ channelsVisible,
132289
+ false,
132290
+ // There are six texture entries on the shaders
132291
+ MAX_CHANNELS - channelsVisible.length
132292
+ ),
132293
+ // uColorScaleRange: [colorScaleLo, colorScaleHi],
132294
+ // uIsExpressionMode: isExpressionMode,
132295
+ // uIsOutlined: false,
132296
+ scaleFactor
132297
+ })).draw();
132298
+ }
132299
+ }
132300
+ /**
132301
+ * This function creates textures from the data
132302
+ */
132303
+ dataToTexture(data, width, height) {
132304
+ const isWebGL2On = isWebGL2$1(this.context.gl);
132305
+ return new Texture2D(this.context.gl, {
132306
+ width,
132307
+ height,
132308
+ // Only use Float32 so we don't have to write two shaders
132309
+ data: new Float32Array(data),
132310
+ // we don't want or need mimaps
132311
+ mipmaps: false,
132312
+ parameters: {
132313
+ // NEAREST for integer data
132314
+ [GL$1.TEXTURE_MIN_FILTER]: GL$1.NEAREST,
132315
+ [GL$1.TEXTURE_MAG_FILTER]: GL$1.NEAREST,
132316
+ // CLAMP_TO_EDGE to remove tile artifacts
132317
+ [GL$1.TEXTURE_WRAP_S]: GL$1.CLAMP_TO_EDGE,
132318
+ [GL$1.TEXTURE_WRAP_T]: GL$1.CLAMP_TO_EDGE
132319
+ },
132320
+ format: isWebGL2On ? GL$1.R32F : GL$1.LUMINANCE,
132321
+ dataFormat: isWebGL2On ? GL$1.RED : GL$1.LUMINANCE,
132322
+ type: GL$1.FLOAT
132323
+ });
132324
+ }
132325
+ multiSetsToTexture(multiFeatureValues, setColorValues, channelIsSetColorMode) {
132326
+ const isWebGL2On = isWebGL2$1(this.context.gl);
132327
+ const [totalData, valueTexHeight, indicesOffsets, totalColors, colorTexHeight, colorsOffsets] = multiSetsToTextureData(multiFeatureValues, setColorValues, channelIsSetColorMode, MULTI_FEATURE_TEX_SIZE);
132328
+ return [
132329
+ // Color indices texture
132330
+ new Texture2D(this.context.gl, {
132331
+ width: MULTI_FEATURE_TEX_SIZE,
132332
+ height: valueTexHeight,
132333
+ // Only use Float32 so we don't have to write two shaders
132334
+ data: new Float32Array(totalData),
132335
+ // we don't want or need mimaps
132336
+ mipmaps: false,
132337
+ parameters: {
132338
+ // NEAREST for integer data
132339
+ [GL$1.TEXTURE_MIN_FILTER]: GL$1.NEAREST,
132340
+ [GL$1.TEXTURE_MAG_FILTER]: GL$1.NEAREST,
132341
+ // CLAMP_TO_EDGE to remove tile artifacts
132342
+ [GL$1.TEXTURE_WRAP_S]: GL$1.CLAMP_TO_EDGE,
132343
+ [GL$1.TEXTURE_WRAP_T]: GL$1.CLAMP_TO_EDGE
132344
+ },
132345
+ format: isWebGL2On ? GL$1.R32F : GL$1.LUMINANCE,
132346
+ dataFormat: isWebGL2On ? GL$1.RED : GL$1.LUMINANCE,
132347
+ type: GL$1.FLOAT
132348
+ }),
132349
+ // Colors texture
132350
+ new Texture2D(this.context.gl, {
132351
+ width: MULTI_FEATURE_TEX_SIZE,
132352
+ height: colorTexHeight,
132353
+ // Only use Float32 so we don't have to write two shaders
132354
+ data: new Float32Array(totalColors),
132355
+ // we don't want or need mimaps
132356
+ mipmaps: false,
132357
+ parameters: {
132358
+ // NEAREST for integer data
132359
+ [GL$1.TEXTURE_MIN_FILTER]: GL$1.NEAREST,
132360
+ [GL$1.TEXTURE_MAG_FILTER]: GL$1.NEAREST,
132361
+ // CLAMP_TO_EDGE to remove tile artifacts
132362
+ [GL$1.TEXTURE_WRAP_S]: GL$1.CLAMP_TO_EDGE,
132363
+ [GL$1.TEXTURE_WRAP_T]: GL$1.CLAMP_TO_EDGE
132364
+ },
132365
+ format: isWebGL2On ? GL$1.R32F : GL$1.LUMINANCE,
132366
+ dataFormat: isWebGL2On ? GL$1.RED : GL$1.LUMINANCE,
132367
+ type: GL$1.FLOAT
132368
+ }),
132369
+ // Offsets
132370
+ indicesOffsets,
132371
+ colorsOffsets,
132372
+ // Texture heights
132373
+ valueTexHeight,
132374
+ colorTexHeight
132375
+ ];
132376
+ }
132377
+ }
132378
+ BitmaskLayer2.layerName = "BitmaskLayer";
132379
+ BitmaskLayer2.defaultProps = defaultProps$1;
131628
132380
  function r(e2) {
131629
132381
  var t2, f2, n2 = "";
131630
132382
  if ("string" == typeof e2 || "number" == typeof e2)
@@ -147301,8 +148053,8 @@ class AbstractSpatialOrScatterplot extends PureComponent {
147301
148053
  * @param {object} params.viewState The next deck.gl viewState.
147302
148054
  */
147303
148055
  onViewStateChange({ viewState: nextViewState }) {
147304
- const { setViewState, viewState, layers, spatialAxisFixed } = this.props;
147305
- const use3d = layers == null ? void 0 : layers.some((l2) => l2.use3d);
148056
+ const { setViewState, viewState, spatialAxisFixed } = this.props;
148057
+ const use3d = this.use3d();
147306
148058
  setViewState({
147307
148059
  ...nextViewState,
147308
148060
  // If the axis is fixed, just use the current target in state i.e don't change target.
@@ -147350,6 +148102,8 @@ class AbstractSpatialOrScatterplot extends PureComponent {
147350
148102
  getLayers() {
147351
148103
  return [];
147352
148104
  }
148105
+ // TODO: remove this method and use the layer-level onHover instead.
148106
+ // (e.g., see delegateHover in spatial-beta/SpatialSubscriber.js).
147353
148107
  // eslint-disable-next-line consistent-return
147354
148108
  onHover(info) {
147355
148109
  const { coordinate, sourceLayer: layer, tile } = info;
@@ -147470,7 +148224,7 @@ class AbstractSpatialOrScatterplot extends PureComponent {
147470
148224
  */
147471
148225
  render() {
147472
148226
  var _a2, _b, _c, _d;
147473
- const { deckRef, viewState, uuid, hideTools } = this.props;
148227
+ const { deckRef, viewState, uuid, hideTools, orbitAxis } = this.props;
147474
148228
  const { gl, tool } = this.state;
147475
148229
  const layers = this.getLayers();
147476
148230
  const use3d = this.use3d();
@@ -147481,7 +148235,7 @@ class AbstractSpatialOrScatterplot extends PureComponent {
147481
148235
  pan: showPanTool && !hideTools,
147482
148236
  selectLasso: showCellSelectionTools && !hideTools
147483
148237
  }, recenterOnClick: this.recenter }), jsxRuntimeExports.jsx(DeckGL$1, { id: `deckgl-overlay-${uuid}`, ref: deckRef, views: [
147484
- use3d ? new OrbitView({ id: "orbit", controller: true, orbitAxis: "Y" }) : new OrthographicView({
148238
+ use3d ? new OrbitView({ id: "orbit", controller: true, orbitAxis }) : new OrthographicView({
147485
148239
  id: "ortho"
147486
148240
  })
147487
148241
  ], layers: gl && viewState.target.slice(0, 2).every((i2) => typeof i2 === "number") ? layers : [], glOptions: DEFAULT_GL_OPTIONS, onWebGLInitialized: this.onWebGLInitialized, onViewStateChange: this.onViewStateChange, viewState, useDevicePixels, controller: tool ? { dragPan: false } : true, getCursor: tool ? getCursorWithTool : getCursor, onHover: this.onHover, children: this.onInitializeViewInfo })] });
@@ -147783,20 +148537,29 @@ class Scatterplot extends AbstractSpatialOrScatterplot {
147783
148537
  }
147784
148538
  return result;
147785
148539
  }
147786
- createSelectionLayers() {
148540
+ createSelectionLayer() {
147787
148541
  const { obsEmbeddingIndex: obsIndex, obsEmbedding, viewState, setCellSelection } = this.props;
147788
148542
  const { tool } = this.state;
147789
148543
  const { cellsQuadTree } = this;
147790
148544
  const flipYTooltip = true;
147791
148545
  const getCellCoords = makeDefaultGetObsCoords(obsEmbedding);
147792
- return getSelectionLayers(tool, viewState.zoom, CELLS_LAYER_ID, getCellCoords, obsIndex, setCellSelection, cellsQuadTree, flipYTooltip);
148546
+ return getSelectionLayer(tool, viewState.zoom, CELLS_LAYER_ID, [
148547
+ {
148548
+ getObsCoords: getCellCoords,
148549
+ obsIndex,
148550
+ obsQuadTree: cellsQuadTree,
148551
+ onSelect: (obsIds) => {
148552
+ setCellSelection(obsIds);
148553
+ }
148554
+ }
148555
+ ], flipYTooltip);
147793
148556
  }
147794
148557
  getLayers() {
147795
148558
  const { cellsLayer, cellSetsLayers } = this;
147796
148559
  return [
147797
148560
  cellsLayer,
147798
148561
  ...cellSetsLayers,
147799
- ...this.createSelectionLayers()
148562
+ this.createSelectionLayer()
147800
148563
  ];
147801
148564
  }
147802
148565
  onUpdateCellsData() {