Skip to content

Add View Cube to the screen #1134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jun 24, 2025

Conversation

ariesninjadev
Copy link

Added the View Cube element to the top right of the screen. The cube is clickable on its faces, edges, and corners, and will automatically reorient the camera to match the proposed perspective of the clicked element. An option is present in settings to enable or disable the cube entirely.

image image image image

Copy link
Member

@BrandonPacewic BrandonPacewic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really good. Is there any way I can request that the view cube can also be draggable?

Copy link
Collaborator

@Dhruv-0-Arora Dhruv-0-Arora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change the colors of the view cube to better resemble the fusion view cube?

Screenshot 2025-06-19 at 3 27 15 PM

Also, if possible, can you add the functionality to make the view cube dragable, meaning you can orbit by clicking and dragging on the view cube?

@ariesninjadev
Copy link
Author

Could you change the colors of the view cube to better resemble the fusion view cube?

Screenshot 2025-06-19 at 3 27 15 PM Also, if possible, can you add the functionality to make the view cube dragable, meaning you can orbit by clicking and dragging on the view cube?

This looks really good. Is there any way I can request that the view cube can also be draggable?

I'm so cooked but yeah I'll try

@ariesninjadev ariesninjadev requested a review from rutmanz June 20, 2025 23:10
Copy link
Member

@rutmanz rutmanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀🧊 lgtm

Copy link
Member

@PepperLola PepperLola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you make it scale based on the size of the screen? On my big monitor it's very small and hard to click, and it makes the click+drag movement really sensitive. Would it also be possible to make it not spin all the way back around when the angle wraps around?

Also, it looks like the highlight doesn't update unless you move your mouse even if you're hovering over another part of the cube.

Screen.Recording.2025-06-20.at.4.52.11.PM.mov

Copy link
Collaborator

@Dhruv-0-Arora Dhruv-0-Arora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, looks good. I have a few suggestions though

@azaleacolburn
Copy link
Contributor

Could the view cube axises extend all the way to the corner?

Before:
Screenshot 2025-06-23 at 10 54 40 AM
After:
Screenshot 2025-06-23 at 11 37 43 AM

Here's the diff you'll need to apply.

diff --git a/fission/src/ui/components/ViewCube.tsx b/fission/src/ui/components/ViewCube.tsx
index 22e0f1460..840fa6d7c 100644
--- a/fission/src/ui/components/ViewCube.tsx
+++ b/fission/src/ui/components/ViewCube.tsx
@@ -443,7 +443,7 @@ const ViewCube: React.FC<ViewCubeProps> = ({
             ) => {
                 const group = new THREE.Group()
 
-                const lineLength = 0.6
+                const lineLength = 2.5
                 const lineRadius = 0.025
 
                 const lineGeometry = new THREE.CylinderGeometry(lineRadius, lineRadius, lineLength)
@@ -488,16 +488,12 @@ const ViewCube: React.FC<ViewCubeProps> = ({
             const xAxis = createAxisLine(
                 0xff0000,
                 new THREE.Vector3(-1, 0, 0),
-                new THREE.Vector3(-1.3, -0.98, -0.98),
+                new THREE.Vector3(-.25, -0.98, -0.98),
                 "X"
             )
-            axisGroup.add(xAxis)
-
-            const yAxis = createAxisLine(0x00ff00, new THREE.Vector3(0, 1, 0), new THREE.Vector3(0.98, 1.3, -0.98), "Y")
-            axisGroup.add(yAxis)
-
-            const zAxis = createAxisLine(0x0000ff, new THREE.Vector3(0, 0, 1), new THREE.Vector3(0.98, -0.98, 1.3), "Z")
-            axisGroup.add(zAxis)
+            const yAxis = createAxisLine(0x00ff00, new THREE.Vector3(0, 1, 0), new THREE.Vector3(0.98, .25, -0.98), "Y")
+            const zAxis = createAxisLine(0x0000ff, new THREE.Vector3(0, 0, 1), new THREE.Vector3(0.98, -0.98, .25), "Z")
+            axisGroup.add(xAxis, yAxis, zAxis)
 
             return axisGroup
         }
@@ -734,7 +730,7 @@ const ViewCube: React.FC<ViewCubeProps> = ({
                 currentTarget: containerRef.current.children[0],
                 clientX: currentMousePos.x,
                 clientY: currentMousePos.y,
-                preventDefault: () => {},
+                preventDefault: () => { },
             } as React.MouseEvent
 
             const element = getClickedElement(mockEvent)

@ariesninjadev
Copy link
Author

Could the view cube axises extend all the way to the corner?

Before: Screenshot 2025-06-23 at 10 54 40 AM After: Screenshot 2025-06-23 at 11 37 43 AM

Here's the diff you'll need to apply.

diff --git a/fission/src/ui/components/ViewCube.tsx b/fission/src/ui/components/ViewCube.tsx
index 22e0f1460..840fa6d7c 100644
--- a/fission/src/ui/components/ViewCube.tsx
+++ b/fission/src/ui/components/ViewCube.tsx
@@ -443,7 +443,7 @@ const ViewCube: React.FC<ViewCubeProps> = ({
             ) => {
                 const group = new THREE.Group()
 
-                const lineLength = 0.6
+                const lineLength = 2.5
                 const lineRadius = 0.025
 
                 const lineGeometry = new THREE.CylinderGeometry(lineRadius, lineRadius, lineLength)
@@ -488,16 +488,12 @@ const ViewCube: React.FC<ViewCubeProps> = ({
             const xAxis = createAxisLine(
                 0xff0000,
                 new THREE.Vector3(-1, 0, 0),
-                new THREE.Vector3(-1.3, -0.98, -0.98),
+                new THREE.Vector3(-.25, -0.98, -0.98),
                 "X"
             )
-            axisGroup.add(xAxis)
-
-            const yAxis = createAxisLine(0x00ff00, new THREE.Vector3(0, 1, 0), new THREE.Vector3(0.98, 1.3, -0.98), "Y")
-            axisGroup.add(yAxis)
-
-            const zAxis = createAxisLine(0x0000ff, new THREE.Vector3(0, 0, 1), new THREE.Vector3(0.98, -0.98, 1.3), "Z")
-            axisGroup.add(zAxis)
+            const yAxis = createAxisLine(0x00ff00, new THREE.Vector3(0, 1, 0), new THREE.Vector3(0.98, .25, -0.98), "Y")
+            const zAxis = createAxisLine(0x0000ff, new THREE.Vector3(0, 0, 1), new THREE.Vector3(0.98, -0.98, .25), "Z")
+            axisGroup.add(xAxis, yAxis, zAxis)
 
             return axisGroup
         }
@@ -734,7 +730,7 @@ const ViewCube: React.FC<ViewCubeProps> = ({
                 currentTarget: containerRef.current.children[0],
                 clientX: currentMousePos.x,
                 clientY: currentMousePos.y,
-                preventDefault: () => {},
+                preventDefault: () => { },
             } as React.MouseEvent
 
             const element = getClickedElement(mockEvent)

Hmm I disagree with this change; I don't think it actually looks better, and the way we currently have it matches the style that Fusion uses. LMK if you really want me to change this.

@azaleacolburn
Copy link
Contributor

azaleacolburn commented Jun 23, 2025

Hmm I disagree with this change; I don't think it actually looks better, and the way we currently have it matches the style that Fusion uses. LMK if you really want me to change this.

Screenshot 2025-06-23 at 12 02 25 PM

It's probably a setting or something in Fusion, because this is what it looks like in Fusion for me.

@ariesninjadev
Copy link
Author

Hmm I disagree with this change; I don't think it actually looks better, and the way we currently have it matches the style that Fusion uses. LMK if you really want me to change this.

Screenshot 2025-06-23 at 12 02 25 PM It's probably a setting or something in Fusion, because this is what it looks like in Fusion for me.

Got it, I will do it how it is shown in your screenshot.

Copy link
Contributor

@azaleacolburn azaleacolburn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Member

@BrandonPacewic BrandonPacewic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting a small issue where if I move my cursor away from the view cube quickly after clicking on a face some highlightable section will say highlighted even when my mouse is no longer pressed down.

Screen.Recording.2025-06-24.at.14.34.53.mov

Copy link
Member

@BrandonPacewic BrandonPacewic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 🧊

I also believe that @Dhruv-0-Arora's and @PepperLola's requested changes have been made.

Copy link
Member

@PepperLola PepperLola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

groovy

@ariesninjadev ariesninjadev dismissed Dhruv-0-Arora’s stale review June 24, 2025 23:12

not waiting for ts 🥀

@ariesninjadev ariesninjadev merged commit d57a7ed into Autodesk:dev Jun 24, 2025
15 checks passed
@ariesninjadev ariesninjadev deleted the aries/1796/view-cube branch June 24, 2025 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants