@vitessce/all 4.0.0-test.0 → 4.0.0-test.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,52 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { useState, useEffect } from "react";
3
- import { x as xrStore } from "./xrStore-BymedRtx.js";
4
- function XREnterButton() {
5
- const [supported, setSupported] = useState(false);
6
- const [entered, setEntered] = useState(false);
7
- useEffect(() => {
8
- let cancelled = false;
9
- if (navigator.xr) {
10
- navigator.xr.isSessionSupported("immersive-ar").then((result) => {
11
- if (!cancelled)
12
- setSupported(result);
13
- }).catch(() => {
14
- });
15
- }
16
- return () => {
17
- cancelled = true;
18
- };
19
- }, []);
20
- useEffect(() => {
21
- const unsubscribe = xrStore.subscribe((state) => {
22
- setEntered(state.session != null);
23
- });
24
- return unsubscribe;
25
- }, []);
26
- if (!supported)
27
- return null;
28
- const handleClick = () => {
29
- if (entered) {
30
- const { session } = xrStore.getState();
31
- if (session)
32
- session.end();
33
- } else {
34
- xrStore.enterAR();
35
- }
36
- };
37
- return jsx("button", { type: "button", onClick: handleClick, style: {
38
- border: "1px solid white",
39
- padding: "12px 24px",
40
- borderRadius: "4px",
41
- background: "rgba(0, 0, 0, 0.1)",
42
- color: "white",
43
- font: "normal 0.8125rem sans-serif",
44
- outline: "none",
45
- cursor: "pointer",
46
- zIndex: 1,
47
- position: "absolute"
48
- }, children: entered ? "Exit AR" : "Enter AR" });
49
- }
50
- export {
51
- XREnterButton as default
52
- };
@@ -1,62 +0,0 @@
1
- import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
- import { useRef } from "react";
3
- import { useXRInputSourceState, useXR } from "@react-three/xr";
4
- import { useThree, useFrame } from "@react-three/fiber";
5
- function getHandJoint(hand, jointName) {
6
- return hand.get(jointName);
7
- }
8
- function HandBbox() {
9
- const rightHand = useXRInputSourceState("hand", "right");
10
- const leftHand = useXRInputSourceState("hand", "left");
11
- const rightTipRef = useRef(null);
12
- const leftTipRef = useRef(null);
13
- const { gl } = useThree();
14
- useFrame((_state, _delta, frame) => {
15
- if (!frame || !gl.xr.isPresenting)
16
- return;
17
- const refSpace = gl.xr.getReferenceSpace();
18
- if (!refSpace)
19
- return;
20
- if (rightHand?.inputSource?.hand && rightTipRef.current) {
21
- const jointSpace = getHandJoint(rightHand.inputSource.hand, "index-finger-tip");
22
- if (jointSpace) {
23
- const pose = frame.getJointPose?.(jointSpace, refSpace);
24
- if (pose) {
25
- rightTipRef.current.position.set(pose.transform.position.x, pose.transform.position.y, pose.transform.position.z);
26
- }
27
- }
28
- }
29
- if (leftHand?.inputSource?.hand && leftTipRef.current) {
30
- const jointSpace = getHandJoint(leftHand.inputSource.hand, "index-finger-tip");
31
- if (jointSpace) {
32
- const pose = frame.getJointPose?.(jointSpace, refSpace);
33
- if (pose) {
34
- leftTipRef.current.position.set(pose.transform.position.x, pose.transform.position.y, pose.transform.position.z);
35
- }
36
- }
37
- }
38
- });
39
- return jsxs(Fragment, { children: [jsxs("mesh", { name: "leftTipBbox", ref: leftTipRef, children: [jsx("boxGeometry", { args: [0.02, 0.02, 0.02] }), jsx("meshStandardMaterial", { color: "blue", transparent: true, opacity: 0 })] }), jsxs("mesh", { name: "rightTipBbox", ref: rightTipRef, children: [jsx("boxGeometry", { args: [0.02, 0.02, 0.02] }), jsx("meshStandardMaterial", { color: "orange", transparent: true, opacity: 0 })] })] });
40
- }
41
- function HandDecorate() {
42
- const session = useXR((state) => state.session);
43
- const { scene } = useThree();
44
- useFrame(() => {
45
- if (!session)
46
- return;
47
- scene.traverse((child) => {
48
- if (child.isMesh && child.material && child.userData?.xpiHand) {
49
- const mesh = child;
50
- mesh.material.transparent = true;
51
- mesh.material.opacity = 0.5;
52
- }
53
- });
54
- });
55
- return null;
56
- }
57
- function XRSceneComponents() {
58
- return jsxs(Fragment, { children: [jsx(HandBbox, {}), jsx(HandDecorate, {})] });
59
- }
60
- export {
61
- XRSceneComponents as default
62
- };
@@ -1,9 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { XR } from "@react-three/xr";
3
- import { x as xrStore } from "./xrStore-BymedRtx.js";
4
- function XRWrapper({ children }) {
5
- return jsx(XR, { store: xrStore, children });
6
- }
7
- export {
8
- XRWrapper as default
9
- };