@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.
@@ -3,7 +3,7 @@ import { useRef, useEffect, useState } from "react";
3
3
  import { useThree, useFrame } from "@react-three/fiber";
4
4
  import { Bvh } from "@react-three/drei";
5
5
  import { Matrix4, Vector3, Box3, FrontSide } from "three";
6
- import { g as getXRModule, i as isValidGeometrySize, M as MeasureLine, s as stringifyLineData } from "./index-B_ToVxzC.js";
6
+ import { g as getXRModule, i as isValidGeometrySize, M as MeasureLine, s as stringifyLineData } from "./index-4JZT6bFU.js";
7
7
  function getHandJoint(hand, jointName) {
8
8
  return hand.get(jointName);
9
9
  }
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import React__default from "react";
3
- import { g as getDefaultExportFromCjs, d as requireAssign, f as require_export, h as require_core, j as require_fails, k as require_toObject, m as require_objectKeys, n as require_cof, o as require_wks, p as require_iterators, q as requireWeb_dom_iterable, s as requireEs6_string_iterator, t as require_anObject, v as require_hide, w as require_ctx, x as require_toLength, y as require_global, z as require_objectDp, A as require_descriptors, D as require_isObject, E as require_objectCreate, F as require_iterDefine, G as require_iterStep, H as require_meta, I as require_isArray, J as require_iobject, K as require_setToStringTag, M as require_aFunction, N as requireIterator, O as require_propertyDesc, c as commonjsGlobal, P as requireEs6_symbol, Q as requireDefineProperty, R as require_toIobject, S as require_objectGopd, T as require_html, U as require_domCreate, V as require_library, W as requireSymbol, X as require_objectPie, Y as require_has, Z as require_redefine, _ as require_objectAssign, $ as GREY_HEX, a0 as diffCameraState, a1 as applyQuat } from "./index-zwNOYbwy.js";
3
+ import { g as getDefaultExportFromCjs, d as requireAssign, f as require_export, h as require_core, j as require_fails, k as require_toObject, m as require_objectKeys, n as require_cof, o as require_wks, p as require_iterators, q as requireWeb_dom_iterable, s as requireEs6_string_iterator, t as require_anObject, v as require_hide, w as require_ctx, x as require_toLength, y as require_global, z as require_objectDp, A as require_descriptors, D as require_isObject, E as require_objectCreate, F as require_iterDefine, G as require_iterStep, H as require_meta, I as require_isArray, J as require_iobject, K as require_setToStringTag, M as require_aFunction, N as requireIterator, O as require_propertyDesc, c as commonjsGlobal, P as requireEs6_symbol, Q as requireDefineProperty, R as require_toIobject, S as require_objectGopd, T as require_html, U as require_domCreate, V as require_library, W as requireSymbol, X as require_objectPie, Y as require_has, Z as require_redefine, _ as require_objectAssign, $ as GREY_HEX, a0 as diffCameraState, a1 as applyQuat } from "./index-D7sxxfGG.js";
4
4
  var assignExports = requireAssign();
5
5
  const _Object$assign = /* @__PURE__ */ getDefaultExportFromCjs(assignExports);
6
6
  var es6_object_keys = {};
@@ -65501,6 +65501,29 @@ class Neuroglancer extends React__default.Component {
65501
65501
  });
65502
65502
  }
65503
65503
  };
65504
+ // Viewer-level toggles. Applied directly (not via restoreState) because updates
65505
+ // after mount only re-apply camera and layers.
65506
+ applyViewerToggles = () => {
65507
+ const { viewer } = this;
65508
+ if (!viewer)
65509
+ return;
65510
+ const { axisLinesVisible, boundsVisible, orthographic, scaleBarVisible } = this.props;
65511
+ this.withoutEmitting(() => {
65512
+ if (typeof axisLinesVisible === "boolean" && viewer.showAxisLines.value !== axisLinesVisible) {
65513
+ viewer.showAxisLines.value = axisLinesVisible;
65514
+ }
65515
+ if (typeof boundsVisible === "boolean" && viewer.showDefaultAnnotations.value !== boundsVisible) {
65516
+ viewer.showDefaultAnnotations.value = boundsVisible;
65517
+ }
65518
+ const layoutSpec = viewer.layout?.container?.component?.layerGroupViewer?.layout?.specification;
65519
+ if (typeof orthographic === "boolean" && layoutSpec?.orthographicProjection && layoutSpec.orthographicProjection.value !== orthographic) {
65520
+ layoutSpec.orthographicProjection.value = orthographic;
65521
+ }
65522
+ if (typeof scaleBarVisible === "boolean" && viewer.showScaleBar.value !== scaleBarVisible) {
65523
+ viewer.showScaleBar.value = scaleBarVisible;
65524
+ }
65525
+ });
65526
+ };
65504
65527
  // Only consider actual changes in camera settings, i.e., position/rotation/zoom
65505
65528
  didLayersChange = (prevVS, nextVS) => {
65506
65529
  const stripColors = (layers) => (layers || []).map((l) => {
@@ -65531,6 +65554,13 @@ class Neuroglancer extends React__default.Component {
65531
65554
  const b = parseInt(hex.slice(5, 7), 16);
65532
65555
  return b * 65536 + g * 256 + r;
65533
65556
  };
65557
+ // Neuroglancer paints its own 3D canvas; match it to the view's background.
65558
+ applyBackgroundTheme = () => {
65559
+ if (!this.viewer)
65560
+ return;
65561
+ const hex = this.props.backgroundTheme === "light" ? "#ffffff" : "#000000";
65562
+ this.viewer.perspectiveViewBackgroundColor.restoreState(hex);
65563
+ };
65534
65564
  /* To add colors to the segments, turning unselected to grey */
65535
65565
  applyColorsAndVisibility = (cellColorMappingByLayer) => {
65536
65566
  if (!this.viewer)
@@ -65654,6 +65684,12 @@ class Neuroglancer extends React__default.Component {
65654
65684
  this.withoutEmitting(() => {
65655
65685
  this.viewer.state.restoreState(viewerState);
65656
65686
  });
65687
+ const s = this.viewer.state.toJSON();
65688
+ this.homeCamera = {
65689
+ position: s.position,
65690
+ projectionScale: s.projectionScale,
65691
+ projectionOrientation: s.projectionOrientation
65692
+ };
65657
65693
  let depthRaf = null;
65658
65694
  const fitDepthToData = () => {
65659
65695
  if (depthRaf !== null)
@@ -65686,6 +65722,7 @@ class Neuroglancer extends React__default.Component {
65686
65722
  cancelAnimationFrame(depthRaf);
65687
65723
  });
65688
65724
  fitDepthToData();
65725
+ this.applyViewerToggles();
65689
65726
  }
65690
65727
  if (key) {
65691
65728
  viewersKeyed[key] = this.viewer;
@@ -65775,10 +65812,17 @@ class Neuroglancer extends React__default.Component {
65775
65812
  this.applyColorsAndVisibility(this.props.cellColorMapping);
65776
65813
  }
65777
65814
  }));
65815
+ this.applyBackgroundTheme();
65778
65816
  window.viewer = this.viewer;
65779
65817
  }
65780
65818
  componentDidUpdate(prevProps, prevState) {
65781
65819
  const { viewerState, cellColorMapping: cellColorMappingByLayer } = this.props;
65820
+ if (prevProps.backgroundTheme !== this.props.backgroundTheme) {
65821
+ this.applyBackgroundTheme();
65822
+ }
65823
+ if (prevProps.axisLinesVisible !== this.props.axisLinesVisible || prevProps.boundsVisible !== this.props.boundsVisible || prevProps.orthographic !== this.props.orthographic || prevProps.scaleBarVisible !== this.props.scaleBarVisible) {
65824
+ this.applyViewerToggles();
65825
+ }
65782
65826
  const selectedSegments = {};
65783
65827
  for (const layer of this.viewer.layerManager.managedLayers) {
65784
65828
  if (layer.layer instanceof SegmentationUserLayer) {
@@ -65878,6 +65922,9 @@ class Neuroglancer extends React__default.Component {
65878
65922
  });
65879
65923
  this.applyColorsAndVisibility(cellColorMappingByLayer);
65880
65924
  }
65925
+ if (prevProps.cameraResetRequest !== this.props.cameraResetRequest && this.homeCamera) {
65926
+ this.viewer.state.restoreState(this.homeCamera);
65927
+ }
65881
65928
  }
65882
65929
  componentWillUnmount() {
65883
65930
  this.disposers.forEach((off) => {
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useState, useEffect } from "react";
3
- import { g as getXrStore } from "./xrStore-Cg8RL1U5.js";
3
+ import { g as getXrStore } from "./xrStore-Dt0n9R6Z.js";
4
4
  function XREnterButton() {
5
5
  const [supported, setSupported] = useState(false);
6
6
  const [entered, setEntered] = useState(false);
@@ -1,7 +1,7 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { useRef } from "react";
3
3
  import { useThree, useFrame } from "@react-three/fiber";
4
- import { g as getXRModule } from "./index-B_ToVxzC.js";
4
+ import { g as getXRModule } from "./index-4JZT6bFU.js";
5
5
  function getHandJoint(hand, jointName) {
6
6
  return hand.get(jointName);
7
7
  }
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { g as getXRModule } from "./index-B_ToVxzC.js";
3
- import { g as getXrStore } from "./xrStore-Cg8RL1U5.js";
2
+ import { g as getXRModule } from "./index-4JZT6bFU.js";
3
+ import { g as getXrStore } from "./xrStore-Dt0n9R6Z.js";
4
4
  function XRWrapper({ children }) {
5
5
  const { XR } = getXRModule();
6
6
  return jsx(XR, { store: getXrStore(), children });
@@ -1,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-SxljTded.js";
2
- import { B as BaseDecoder } from "./index-zwNOYbwy.js";
2
+ import { B as BaseDecoder } from "./index-D7sxxfGG.js";
3
3
  class DeflateDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
5
5
  return inflate_1(new Uint8Array(buffer)).buffer;
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import React__default, { createContext, isValidElement, PureComponent, Component, useMemo, useState, useRef, useEffect, useCallback, memo, useContext, useReducer, useLayoutEffect } from "react";
3
- import { r as requireObjectAssign, g as getDefaultExportFromCjs$1, c as commonjsGlobal, e as earcut } from "./index-zwNOYbwy.js";
3
+ import { r as requireObjectAssign, g as getDefaultExportFromCjs$1, c as commonjsGlobal, e as earcut } from "./index-D7sxxfGG.js";
4
4
  import ReactDOM__default, { unstable_batchedUpdates, createPortal } from "react-dom";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  function finallyConstructor(callback) {
@@ -3,7 +3,7 @@ import React__default, { useRef, useState, useEffect, Suspense, forwardRef } fro
3
3
  import { Canvas } from "@react-three/fiber";
4
4
  import { Center, Text, Line, Bvh, OrbitControls } from "@react-three/drei";
5
5
  import { Matrix3, Matrix4, Vector3, Vector2, UniformsUtils, Data3DTexture, RedFormat, FloatType, LinearFilter, FrontSide, Scene, Group, MeshPhysicalMaterial, MeshBasicMaterial, MeshStandardMaterial, BackSide } from "three";
6
- import { C as CoordinationType, b as getImageSize } from "./index-zwNOYbwy.js";
6
+ import { C as CoordinationType, b as getImageSize } from "./index-D7sxxfGG.js";
7
7
  function MeasureLine({ currentLine, scale }) {
8
8
  const textRef = useRef(null);
9
9
  return jsxs("group", { children: [jsx(Center, { bottom: true, right: true, position: [currentLine.midPoint.x, currentLine.midPoint.y, currentLine.midPoint.z], rotation: [0, 0, 0], children: jsx(Text, { color: "gray", scale: 0.05, ref: textRef, children: `${(currentLine.startPoint.distanceTo(currentLine.endPoint) * scale).toFixed(2)} µm` }) }), jsx(Line, {
@@ -945,8 +945,8 @@ function GeometryAndMesh(props) {
945
945
  setObsHighlight(e.object.name);
946
946
  }, onPointerOut: () => setObsHighlight(null) }) })] }) : null, renderingSettings.uniforms && renderingSettings.shader && renderingSettings.meshScale && renderingSettings.geometrySize ? jsx("group", { children: jsxs("mesh", { scale: renderingSettings.meshScale, ref: materialRef, children: [jsx("boxGeometry", { args: renderingSettings.geometrySize }), jsx("shaderMaterial", { customProgramCacheKey: () => "1", side: FrontSide, uniforms: renderingSettings.uniforms, needsUpdate: true, transparent: true, vertexShader: renderingSettings.shader.vertexShader, fragmentShader: renderingSettings.shader.fragmentShader })] }) }) : null] }), jsx("group", { name: "lines", children: lines.map((object) => jsx(MeasureLine, { currentLine: object, scale: 1 }, stringifyLineData(object))) })] });
947
947
  }
948
- const LazyGeometryAndMeshXR = React__default.lazy(() => import("./GeometryAndMeshXR-Bjs1Ruhx.js").catch(() => ({ default: GeometryAndMesh })));
949
- const LazyXRSceneComponents = React__default.lazy(() => import("./XRSceneComponents-D8sYIzX0.js").catch(() => ({ default: () => null })));
948
+ const LazyGeometryAndMeshXR = React__default.lazy(() => import("./GeometryAndMeshXR-BO4cB8Py.js").catch(() => ({ default: GeometryAndMesh })));
949
+ const LazyXRSceneComponents = React__default.lazy(() => import("./XRSceneComponents-CXXeqxgE.js").catch(() => ({ default: () => null })));
950
950
  function SpatialThree(props) {
951
951
  const materialRef = useRef(null);
952
952
  const orbitRef = useRef(null);
@@ -1303,13 +1303,13 @@ function getXRModule() {
1303
1303
  }
1304
1304
  const LazyXRWrapper = React__default.lazy(
1305
1305
  // eslint-disable-next-line implicit-arrow-linebreak, function-paren-newline
1306
- () => import("./XRWrapper-op8Avjd6.js").catch(() => ({
1306
+ () => import("./XRWrapper-ChEnDQOC.js").catch(() => ({
1307
1307
  default: ({ children }) => children
1308
1308
  }))
1309
1309
  );
1310
1310
  const LazyXREnterButton = React__default.lazy(
1311
1311
  // eslint-disable-next-line implicit-arrow-linebreak, function-paren-newline
1312
- () => import("./XREnterButton-CSkdz0V0.js").catch(() => ({
1312
+ () => import("./XREnterButton-DePbBRY6.js").catch(() => ({
1313
1313
  default: () => null
1314
1314
  }))
1315
1315
  );