diff --git a/package.json b/package.json index fc1f0429d..31ef61b0e 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,8 @@ "cy-comp": "cypress run --component", "test:coverage": "npx nyc report --reporter=html --reporter=text-summary", "format": "prettier --write --config prettier.config.js ./src", - "prettier": "npx prettier --config prettier.config.js --check ./src", + "prettier": "npx prettier --config prettier.config.js -w ./src", + "prettier:check": "npx prettier --config prettier.config.js --check ./src", "postinstall": "husky install", "typecheck": "tsc --noEmit", "lint": "eslint src --max-warnings 24" diff --git a/public/svg-icons/CameraCenterIcon.svg b/public/svg-icons/CameraCenterIcon.svg new file mode 100644 index 000000000..ea04c22cb --- /dev/null +++ b/public/svg-icons/CameraCenterIcon.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/components/Icons/CameraCenterIcon.tsx b/src/components/Icons/CameraCenterIcon.tsx new file mode 100644 index 000000000..26d89b6ea --- /dev/null +++ b/src/components/Icons/CameraCenterIcon.tsx @@ -0,0 +1,16 @@ +/* eslint-disable */ +import React from 'react' + +const CameraCenterIcon: React.FC> = (props) => ( + + + + + + + + + +) + +export default CameraCenterIcon diff --git a/src/components/Universe/Controls/CameraAnimations/useAutoNavigate.ts b/src/components/Universe/Controls/CameraAnimations/useAutoNavigate.ts index 3b9ce0bf2..f1292d1b3 100644 --- a/src/components/Universe/Controls/CameraAnimations/useAutoNavigate.ts +++ b/src/components/Universe/Controls/CameraAnimations/useAutoNavigate.ts @@ -46,7 +46,7 @@ export const useAutoNavigate = (cameraControlsRef: RefObject f.ref_id === selectedNode?.ref_id) - let pos = new Vector3(0, 0, 0) + let pos = new Vector3(2000, 2000, 3000) if (selected && graphData) { // find all node children ... is there a better way? @@ -163,14 +163,12 @@ export const useAutoNavigate = (cameraControlsRef: RefObject { if (cameraControlsRef.current) { // do movement animation - if (selectedNode) { - if (!distanceReached) { - moveCameraToNode(destination, state.camera) - } + if (!distanceReached) { + moveCameraToNode(destination, state.camera) + } - if (!lookAtReached) { - turnCameraToNode(lookat, state.camera) - } + if (!lookAtReached) { + turnCameraToNode(lookat, state.camera) } } }) diff --git a/src/components/Universe/Overlay/index.tsx b/src/components/Universe/Overlay/index.tsx index d6c8358c2..342b687da 100644 --- a/src/components/Universe/Overlay/index.tsx +++ b/src/components/Universe/Overlay/index.tsx @@ -1,31 +1,24 @@ -import { useEffect } from 'react' +import { Button } from '@mui/material' import styled from 'styled-components' -import { Button } from '~/components/Button' -import { useControlStore } from '~/stores/useControlStore' +import CameraCenterIcon from '~/components/Icons/CameraCenterIcon' import { useDataStore } from '~/stores/useDataStore' import { Tooltip } from '../Graph/Cubes/Cube/components/Tooltip' export const Overlay = () => { - const [selectedNode, hoveredNode, cameraFocusTrigger, setCameraFocusTrigger] = useDataStore((s) => [ - s.selectedNode, + const [hoveredNode, cameraFocusTrigger, setCameraFocusTrigger] = useDataStore((s) => [ s.hoveredNode, s.cameraFocusTrigger, s.setCameraFocusTrigger, ]) - const userMovedCamera = useControlStore((s) => s.userMovedCamera) - - useEffect(() => { - document.body.style.cursor = hoveredNode ? 'pointer' : 'auto' - }, [hoveredNode]) - return ( - {!!selectedNode && userMovedCamera && ( - - )} + setCameraFocusTrigger(!cameraFocusTrigger)} + size="medium" + startIcon={} + /> {hoveredNode && (
@@ -36,6 +29,25 @@ export const Overlay = () => { ) } +const CameraCenterButton = styled(Button)` + && { + position: absolute; + right: 20px; + bottom: 102px; + padding: 0; + width: 32px; + min-width: auto; + justify-content: center; + align-items: center; + pointer-events: all; + + .MuiButton-startIcon { + margin-left: 0; + filter: brightness(.65); + } + } +` + const OverlayWrap = styled('div')(({ theme }) => ({ position: 'absolute', zIndex: 1,