yangdx
commited on
Commit
·
1fbc1f7
1
Parent(s):
f6bf58b
Added camera rotation controls to graph panel.
Browse files
lightrag/api/webui/assets/{index-DFtyEbmf.js → index-DlSL6ZG8.js}
RENAMED
Binary files a/lightrag/api/webui/assets/index-DFtyEbmf.js and b/lightrag/api/webui/assets/index-DlSL6ZG8.js differ
|
|
lightrag/api/webui/index.html
CHANGED
Binary files a/lightrag/api/webui/index.html and b/lightrag/api/webui/index.html differ
|
|
lightrag_webui/src/components/graph/ZoomControl.tsx
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import { useCamera, useSigma } from '@react-sigma/core'
|
2 |
import { useCallback } from 'react'
|
3 |
import Button from '@/components/ui/Button'
|
4 |
-
import { ZoomInIcon, ZoomOutIcon, FullscreenIcon } from 'lucide-react'
|
5 |
import { controlButtonVariant } from '@/lib/constants'
|
6 |
import { useTranslation } from 'react-i18next';
|
7 |
|
@@ -44,8 +44,50 @@ const ZoomControl = () => {
|
|
44 |
}
|
45 |
}, [sigma, reset])
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
return (
|
48 |
<>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
<Button
|
50 |
variant={controlButtonVariant}
|
51 |
onClick={handleResetZoom}
|
|
|
1 |
import { useCamera, useSigma } from '@react-sigma/core'
|
2 |
import { useCallback } from 'react'
|
3 |
import Button from '@/components/ui/Button'
|
4 |
+
import { ZoomInIcon, ZoomOutIcon, FullscreenIcon, RotateCwIcon, RotateCcwIcon } from 'lucide-react'
|
5 |
import { controlButtonVariant } from '@/lib/constants'
|
6 |
import { useTranslation } from 'react-i18next';
|
7 |
|
|
|
44 |
}
|
45 |
}, [sigma, reset])
|
46 |
|
47 |
+
const handleRotate = useCallback(() => {
|
48 |
+
if (!sigma) return
|
49 |
+
|
50 |
+
const camera = sigma.getCamera()
|
51 |
+
const currentAngle = camera.angle
|
52 |
+
const newAngle = currentAngle + Math.PI / 8
|
53 |
+
|
54 |
+
camera.animate(
|
55 |
+
{ angle: newAngle },
|
56 |
+
{ duration: 200 }
|
57 |
+
)
|
58 |
+
}, [sigma])
|
59 |
+
|
60 |
+
const handleRotateCounterClockwise = useCallback(() => {
|
61 |
+
if (!sigma) return
|
62 |
+
|
63 |
+
const camera = sigma.getCamera()
|
64 |
+
const currentAngle = camera.angle
|
65 |
+
const newAngle = currentAngle - Math.PI / 8
|
66 |
+
|
67 |
+
camera.animate(
|
68 |
+
{ angle: newAngle },
|
69 |
+
{ duration: 200 }
|
70 |
+
)
|
71 |
+
}, [sigma])
|
72 |
+
|
73 |
return (
|
74 |
<>
|
75 |
+
<Button
|
76 |
+
variant={controlButtonVariant}
|
77 |
+
onClick={handleRotateCounterClockwise}
|
78 |
+
tooltip={t('graphPanel.sideBar.zoomControl.rotateCameraCounterClockwise')}
|
79 |
+
size="icon"
|
80 |
+
>
|
81 |
+
<RotateCcwIcon />
|
82 |
+
</Button>
|
83 |
+
<Button
|
84 |
+
variant={controlButtonVariant}
|
85 |
+
onClick={handleRotate}
|
86 |
+
tooltip={t('graphPanel.sideBar.zoomControl.rotateCamera')}
|
87 |
+
size="icon"
|
88 |
+
>
|
89 |
+
<RotateCwIcon />
|
90 |
+
</Button>
|
91 |
<Button
|
92 |
variant={controlButtonVariant}
|
93 |
onClick={handleResetZoom}
|
lightrag_webui/src/locales/en.json
CHANGED
@@ -112,7 +112,9 @@
|
|
112 |
"zoomControl": {
|
113 |
"zoomIn": "Zoom In",
|
114 |
"zoomOut": "Zoom Out",
|
115 |
-
"resetZoom": "Reset Zoom"
|
|
|
|
|
116 |
},
|
117 |
|
118 |
"layoutsControl": {
|
|
|
112 |
"zoomControl": {
|
113 |
"zoomIn": "Zoom In",
|
114 |
"zoomOut": "Zoom Out",
|
115 |
+
"resetZoom": "Reset Zoom",
|
116 |
+
"rotateCamera": "Clockwise Rotate",
|
117 |
+
"rotateCameraCounterClockwise": "Counter-Clockwise Rotate"
|
118 |
},
|
119 |
|
120 |
"layoutsControl": {
|
lightrag_webui/src/locales/zh.json
CHANGED
@@ -111,7 +111,9 @@
|
|
111 |
"zoomControl": {
|
112 |
"zoomIn": "放大",
|
113 |
"zoomOut": "缩小",
|
114 |
-
"resetZoom": "重置缩放"
|
|
|
|
|
115 |
},
|
116 |
"layoutsControl": {
|
117 |
"startAnimation": "继续布局动画",
|
|
|
111 |
"zoomControl": {
|
112 |
"zoomIn": "放大",
|
113 |
"zoomOut": "缩小",
|
114 |
+
"resetZoom": "重置缩放",
|
115 |
+
"rotateCamera": "顺时针旋转图形",
|
116 |
+
"rotateCameraCounterClockwise": "逆时针旋转图形"
|
117 |
},
|
118 |
"layoutsControl": {
|
119 |
"startAnimation": "继续布局动画",
|