mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-13 19:33:46 +08:00
Camera Label Hiding (#1031)
* ThreeJS group traversal * Isolated hiding to camera labels * Logic for hide scene addeD
This commit is contained in:
1 parent
fff1fee686
commit
a578ac8d15
3 files changed
+20
No files matched your search
@@ -631,6 +631,7 @@ export default function CameraPanel(props) {
|
||||
labelDiv.style.borderRadius = '6px';
|
||||
labelDiv.style.visibility = 'visible';
|
||||
const camera_label = new CSS2DObject(labelDiv);
|
||||
camera_label.name = 'CAMERA_LABEL';
|
||||
camera_label.position.set(0, -0.1, -0.1);
|
||||
camera_helper.add(camera_label);
|
||||
camera_label.layers.set(0);
|
||||
|
||||
@@ -77,6 +77,14 @@ function MenuItems(props: ListItemProps) {
|
||||
const toggleVisible = (e) => {
|
||||
e.stopPropagation();
|
||||
setVisible(!visible);
|
||||
scene_node.object.traverse(
|
||||
(obj) => {
|
||||
if (obj.name === 'CAMERA_LABEL') {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
obj.visible = !visible;
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
React.useEffect(() => {
|
||||
|
||||
@@ -43,6 +43,17 @@ export default function StatusPanel(props: StatusPanelProps) {
|
||||
is_images_visible;
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
sceneTree.object.traverse(
|
||||
(obj) => {
|
||||
if (obj.name === 'CAMERA_LABEL') {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
obj.visible = is_scene_visible;
|
||||
}
|
||||
}
|
||||
);
|
||||
}, [is_scene_visible]);
|
||||
|
||||
const handlePlayChange = () => {
|
||||
dispatch({
|
||||
type: 'write',
|
||||
|
||||
Reference in new issue
Block a user