This repository has been archived by the owner on Aug 21, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added the gizmo tools * show only when scene is selected * IR-2450 link to jira
- Loading branch information
1 parent
c00fefb
commit c9df1cc
Showing
3 changed files
with
103 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
packages/ui/src/components/editor/panels/Viewport/tools/GizmoTool.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* | ||
CPAL-1.0 License | ||
The contents of this file are subject to the Common Public Attribution License | ||
Version 1.0. (the "License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
https://github.com/EtherealEngine/etherealengine/blob/dev/LICENSE. | ||
The License is based on the Mozilla Public License Version 1.1, but Sections 14 | ||
and 15 have been added to cover use of software over a computer network and | ||
provide for limited attribution for the Original Developer. In addition, | ||
Exhibit A has been modified to be consistent with Exhibit B. | ||
Software distributed under the License is distributed on an "AS IS" basis, | ||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the | ||
specific language governing rights and limitations under the License. | ||
The Original Code is Ethereal Engine. | ||
The Original Developer is the Initial Developer. The Initial Developer of the | ||
Original Code is the Ethereal Engine team. | ||
All portions of the code written by the Ethereal Engine team are Copyright © 2021-2023 | ||
Ethereal Engine. All Rights Reserved. | ||
*/ | ||
|
||
import { EditorControlFunctions } from '@etherealengine/editor/src/functions/EditorControlFunctions' | ||
import { setTransformMode } from '@etherealengine/editor/src/functions/transformFunctions' | ||
import { EditorHelperState } from '@etherealengine/editor/src/services/EditorHelperState' | ||
import { TransformMode } from '@etherealengine/engine/src/scene/constants/transformConstants' | ||
import { useMutableState } from '@etherealengine/hyperflux' | ||
import React from 'react' | ||
import { TbPointer, TbRefresh, TbVector, TbWindowMaximize } from 'react-icons/tb' | ||
import { twMerge } from 'tailwind-merge' | ||
import Button from '../../../../../primitives/tailwind/Button' | ||
|
||
function Placer() { | ||
return ( | ||
<> | ||
<div className="mt-2 h-1 w-6 bg-[#2B2C30]" /> | ||
<div className="mt-1 h-1 w-6 bg-[#2B2C30]" /> | ||
</> | ||
) | ||
} | ||
|
||
export default function GizmoTool() { | ||
const editorHelperState = useMutableState(EditorHelperState) | ||
const transformMode = editorHelperState.transformMode.value | ||
|
||
return ( | ||
<div className="absolute left-4 top-14 z-10 flex flex-col items-center rounded-lg bg-black p-2"> | ||
<Placer /> | ||
<div className="mt-2 flex flex-col rounded bg-theme-surface-main"> | ||
<Button | ||
variant="transparent" | ||
className={twMerge('border-b border-b-theme-primary p-2 text-[#A3A3A3]')} | ||
iconContainerClassName="m-0" | ||
startIcon={<TbPointer />} | ||
title="Pointer" | ||
onClick={() => EditorControlFunctions.replaceSelection([])} | ||
/> | ||
<Button | ||
variant="transparent" | ||
className={twMerge( | ||
'border-b border-b-theme-primary p-2 text-[#A3A3A3]', | ||
transformMode === TransformMode.translate && 'bg-theme-highlight text-white' | ||
)} | ||
iconContainerClassName="m-0" | ||
startIcon={<TbVector />} | ||
title="Translate" | ||
onClick={() => setTransformMode(TransformMode.translate)} | ||
/> | ||
<Button | ||
variant="transparent" | ||
className={twMerge( | ||
'border-b border-b-theme-primary p-2 text-[#A3A3A3]', | ||
transformMode === TransformMode.rotate && 'bg-theme-highlight text-white' | ||
)} | ||
iconContainerClassName="m-0" | ||
startIcon={<TbRefresh />} | ||
title="Rotate" | ||
onClick={() => setTransformMode(TransformMode.rotate)} | ||
/> | ||
<Button | ||
variant="transparent" | ||
className={twMerge( | ||
'p-2 text-[#A3A3A3]', | ||
transformMode === TransformMode.scale && 'bg-theme-highlight text-white' | ||
)} | ||
iconContainerClassName="m-0" | ||
startIcon={<TbWindowMaximize />} | ||
title="Scale" | ||
onClick={() => setTransformMode(TransformMode.scale)} | ||
/> | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters