@@ -7,8 +7,9 @@ import { Component, MouseEvent, ReactNode } from "react";
77import { Grid } from "react-loader-spinner" ;
88
99import { FaCheck } from "react-icons/fa6" ;
10- import { GiWireframeGlobe } from "react-icons/gi" ;
1110import { IoIosOptions , IoIosStats } from "react-icons/io" ;
11+ import { LuMove3D , LuRotate3D , LuScale3D } from "react-icons/lu" ;
12+ import { GiArrowCursor , GiWireframeGlobe } from "react-icons/gi" ;
1213
1314import {
1415 AbstractEngine ,
@@ -32,10 +33,11 @@ import {
3233 SceneLoaderFlags ,
3334} from "babylonjs" ;
3435
35- import { Toggle } from "../../ui/shadcn/ui/toggle" ;
3636import { Button } from "../../ui/shadcn/ui/button" ;
3737import { Progress } from "../../ui/shadcn/ui/progress" ;
38+ import { Toggle } from "../../ui/shadcn/ui/toggle" ;
3839import { Select , SelectContent , SelectItem , SelectTrigger , SelectValue } from "../../ui/shadcn/ui/select" ;
40+ import { ToolbarRadioGroup , ToolbarRadioGroupItem } from "../../ui/shadcn/ui/toolbar-radio-group" ;
3941
4042import { Editor } from "../main" ;
4143
@@ -56,10 +58,6 @@ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel,
5658
5759import { EditorCamera } from "../nodes/camera" ;
5860
59- import { PositionIcon } from "../../ui/icons/position" ;
60- import { RotationIcon } from "../../ui/icons/rotation" ;
61- import { ScalingIcon } from "../../ui/icons/scaling" ;
62-
6361import { SpinnerUIComponent } from "../../ui/spinner" ;
6462import { Separator } from "../../ui/shadcn/ui/separator" ;
6563import { Tooltip , TooltipContent , TooltipProvider , TooltipTrigger } from "../../ui/shadcn/ui/tooltip" ;
@@ -761,33 +759,72 @@ export class EditorPreview extends Component<IEditorPreviewProps, IEditorPreview
761759 </ SelectContent >
762760 </ Select >
763761
764- < Separator orientation = "vertical" className = "mx-2 h-[24px]" />
762+ < Separator orientation = "vertical" className = "mx-1 h-[24px]" />
763+
764+ < ToolbarRadioGroup
765+ value = { this . state . activeGizmo === "none" ? "select" : this . state . activeGizmo }
766+ onValueChange = { ( value ) => {
767+ if ( value === "select" ) {
768+ this . setActiveGizmo ( "none" ) ;
769+ } else {
770+ this . setActiveGizmo ( value as "position" | "rotation" | "scaling" ) ;
771+ }
772+ } }
773+ >
774+ < Tooltip >
775+ < TooltipTrigger asChild >
776+ < ToolbarRadioGroupItem value = "select" className = { this . state . activeGizmo === "none" ? "bg-primary/20" : "" } >
777+ < GiArrowCursor className = "h-4 w-4" />
778+ </ ToolbarRadioGroupItem >
779+ </ TooltipTrigger >
780+ < TooltipContent > Select mode</ TooltipContent >
781+ </ Tooltip >
782+ < Tooltip >
783+ < TooltipTrigger asChild >
784+ < ToolbarRadioGroupItem value = "position" className = { this . state . activeGizmo === "position" ? "bg-primary/20" : "" } >
785+ < LuMove3D height = { 16 } />
786+ </ ToolbarRadioGroupItem >
787+ </ TooltipTrigger >
788+ < TooltipContent > Toggle position gizmo</ TooltipContent >
789+ </ Tooltip >
790+ < Tooltip >
791+ < TooltipTrigger asChild >
792+ < ToolbarRadioGroupItem value = "rotation" className = { this . state . activeGizmo === "rotation" ? "bg-primary/20" : "" } >
793+ < LuRotate3D height = { 16 } />
794+ </ ToolbarRadioGroupItem >
795+ </ TooltipTrigger >
796+ < TooltipContent > Toggle rotation gizmo</ TooltipContent >
797+ </ Tooltip >
798+ < Tooltip >
799+ < TooltipTrigger asChild >
800+ < ToolbarRadioGroupItem value = "scaling" className = { this . state . activeGizmo === "scaling" ? "bg-primary/20" : "" } >
801+ < LuScale3D height = { 16 } />
802+ </ ToolbarRadioGroupItem >
803+ </ TooltipTrigger >
804+ < TooltipContent > Toggle scaling gizmo</ TooltipContent >
805+ </ Tooltip >
806+ </ ToolbarRadioGroup >
807+
808+ < Separator orientation = "vertical" className = "mx-1 h-[24px]" />
765809
766810 < Tooltip >
767811 < TooltipTrigger asChild >
768- < Toggle pressed = { this . state . activeGizmo === "position" } onPressedChange = { ( ) => this . setActiveGizmo ( "position" ) } >
769- < PositionIcon height = { 16 } />
770- </ Toggle >
771- </ TooltipTrigger >
772- < TooltipContent > Toggle position gizmo</ TooltipContent >
773- </ Tooltip >
774- < Tooltip >
775- < TooltipTrigger asChild >
776- < Toggle pressed = { this . state . activeGizmo === "rotation" } onPressedChange = { ( ) => this . setActiveGizmo ( "rotation" ) } >
777- < RotationIcon height = { 16 } />
778- </ Toggle >
779- </ TooltipTrigger >
780- < TooltipContent > Toggle rotation gizmo</ TooltipContent >
781- </ Tooltip >
782- < Tooltip >
783- < TooltipTrigger asChild >
784- < Toggle pressed = { this . state . activeGizmo === "scaling" } onPressedChange = { ( ) => this . setActiveGizmo ( "scaling" ) } >
785- < ScalingIcon height = { 16 } />
812+ < Toggle
813+ className = { this . scene ?. forceWireframe ? "!px-2 !py-2 bg-primary/20" : "!px-2 !py-2" }
814+ pressed = { this . scene ?. forceWireframe }
815+ onPressedChange = { ( ) => {
816+ this . scene . forceWireframe = ! this . scene . forceWireframe ;
817+ this . forceUpdate ( ) ;
818+ } }
819+ >
820+ < GiWireframeGlobe className = "w-6 h-6 scale-125" strokeWidth = { 1 } color = "white" />
786821 </ Toggle >
787822 </ TooltipTrigger >
788- < TooltipContent > Toggle scaling gizmo </ TooltipContent >
823+ < TooltipContent > Toggle wireframe </ TooltipContent >
789824 </ Tooltip >
790825
826+ < Separator orientation = "vertical" className = "mx-1 h-[24px]" />
827+
791828 < Select
792829 value = { this . gizmo ?. getCoordinateMode ( ) . toString ( ) }
793830 onValueChange = { ( v ) => {
@@ -804,25 +841,7 @@ export class EditorPreview extends Component<IEditorPreviewProps, IEditorPreview
804841 </ SelectContent >
805842 </ Select >
806843
807- < Separator orientation = "vertical" className = "mx-2 h-[24px]" />
808-
809- < Tooltip >
810- < TooltipTrigger asChild >
811- < Toggle
812- className = "!px-2 !py-2"
813- pressed = { this . scene ?. forceWireframe }
814- onPressedChange = { ( ) => {
815- this . scene . forceWireframe = ! this . scene . forceWireframe ;
816- this . forceUpdate ( ) ;
817- } }
818- >
819- < GiWireframeGlobe className = "w-6 h-6 scale-125" strokeWidth = { 1 } color = "white" />
820- </ Toggle >
821- </ TooltipTrigger >
822- < TooltipContent > Toggle wireframe</ TooltipContent >
823- </ Tooltip >
824-
825- < Separator orientation = "vertical" className = "mx-2 h-[24px]" />
844+ < Separator orientation = "vertical" className = "mx-1 h-[24px]" />
826845
827846 < DropdownMenu >
828847 < DropdownMenuTrigger asChild >
0 commit comments