diff --git a/src/Common/CommandNames.ts b/src/Common/CommandNames.ts index 1fe3dc1b3..b29e634fa 100644 --- a/src/Common/CommandNames.ts +++ b/src/Common/CommandNames.ts @@ -279,8 +279,9 @@ export enum CommandNames Replace = "重新放置模型", Down = "DOWN", - AxesDisable = 'AXESDISABLE', //取消Gizmo - AxesTranslate = 'AXESTRANSLATE', //移动坐标 - AxesRotate = 'AXESROTATE', //旋转坐标 - AxesScale = 'AXESSCALE', //缩放坐标 + AxesDisable = "AXESDISABLE", //取消Gizmo + AxesTranslate = "AXESTRANSLATE", //移动坐标 + AxesRotate = "AXESROTATE", //旋转坐标 + AxesScale = "AXESSCALE", //缩放坐标 + GizmoCSSwith = "GIZMOCSSWITH", } diff --git a/src/Common/HotKeyList.ts b/src/Common/HotKeyList.ts index 040000966..562cc162b 100644 --- a/src/Common/HotKeyList.ts +++ b/src/Common/HotKeyList.ts @@ -36,10 +36,23 @@ export enum HotkeyList AD = "Alt+D", AS = "Alt+S", AF = "Alt+F", - AQ = "Alt+Q", //取消坐标 - AW = "Alt+W", //移动坐标 - AE = "Alt+E", //旋转坐标 - AR = "Alt+R", //缩放坐标 + /** + * ✨取消坐标 + */ + AQ = "Alt+Q", + /** + * ✨移动坐标 + */ + AW = "Alt+W", + /** + * ✨旋转坐标 + */ + AE = "Alt+E", + /** + * ✨缩放坐标 + */ + AR = "Alt+R", + ADot = "Alt+`", D = "Delete", END = "End", F1 = "F1", diff --git a/src/Editor/CommandRegister.ts b/src/Editor/CommandRegister.ts index 87fb25471..c06e68213 100644 --- a/src/Editor/CommandRegister.ts +++ b/src/Editor/CommandRegister.ts @@ -250,7 +250,7 @@ import { BuyMaterial } from './../Add-on/BuyMaterial'; import { Interfere } from './../Add-on/interfere'; import { ShowKinfeManageModal } from './../Add-on/showModal/ShowKnifeManageModal'; import { commandMachine } from './CommandMachine'; -import { Command_SetGizmoMode } from "./TranstrolControl/Command_SetGizmoMode"; +import { Command_GizmoCSSwith, Command_SetGizmoMode } from "./TranstrolControl/Command_SetGizmoMode"; import { TransMode } from "./TranstrolControl/TransformServices"; import { userConfig } from "./UserConfig"; export function registerCommand() @@ -711,12 +711,12 @@ export function registerCommand() commandMachine.RegisterCommand(CommandNames.ParseBoardName, new Command_ParseBoardName()); commandMachine.RegisterCommand(CommandNames.Down, new Command_Cmd_Down()); - //切换坐标系命令 + //Gizmo commandMachine.RegisterCommand(CommandNames.AxesDisable, new Command_SetGizmoMode(TransMode.OCS)); commandMachine.RegisterCommand(CommandNames.AxesTranslate, new Command_SetGizmoMode(TransMode.Move)); commandMachine.RegisterCommand(CommandNames.AxesRotate, new Command_SetGizmoMode(TransMode.Rotate)); commandMachine.RegisterCommand(CommandNames.AxesScale, new Command_SetGizmoMode(TransMode.Scale)); - + commandMachine.RegisterCommand(CommandNames.GizmoCSSwith, new Command_GizmoCSSwith()); } export async function LimitCommand() diff --git a/src/Editor/TranstrolControl/Command_SetGizmoMode.ts b/src/Editor/TranstrolControl/Command_SetGizmoMode.ts index 750a81348..8e3d3fe6f 100644 --- a/src/Editor/TranstrolControl/Command_SetGizmoMode.ts +++ b/src/Editor/TranstrolControl/Command_SetGizmoMode.ts @@ -1,6 +1,6 @@ import { app } from "../../ApplicationServices/Application"; +import AxisModeStore from "../../UI/Components/AxisMode/AxisModeStore"; import { Command } from "../CommandMachine"; -import { userConfig } from "../UserConfig"; import { TransMode } from './TransformServices'; @@ -9,7 +9,17 @@ export class Command_SetGizmoMode implements Command constructor(private mode: TransMode) { } async exec() { - userConfig.curMode = this.mode; + AxisModeStore.GetSingleInstance().curMode = this.mode; app.Editor.TransCtrl.Mode = this.mode; } } + +export class Command_GizmoCSSwith implements Command +{ + constructor() { } + async exec() + { + app.Editor.TransCtrl.SpaceCSType = (app.Editor.TransCtrl.SpaceCSType + 1) % 2; + AxisModeStore.GetSingleInstance()._SpaceCSType = app.Editor.TransCtrl.SpaceCSType; + } +} diff --git a/src/Editor/UserConfig.ts b/src/Editor/UserConfig.ts index cf86bb851..4e6c3af24 100644 --- a/src/Editor/UserConfig.ts +++ b/src/Editor/UserConfig.ts @@ -126,7 +126,6 @@ export class UserConfig implements IConfigStore @observable openLightConfig: boolean = false; //画灯光前是否打开配置 @observable oneKeyOpenLight: boolean = false; //一键开关灯光(通电/不通电) @observable isShowLightShadow = false; //一键开关灯光阴影(除了太阳光) - @observable curMode = 3; //模型坐标轴类型 constructor() { diff --git a/src/UI/Components/AxisMode/AxisMode.less b/src/UI/Components/AxisMode/AxisMode.less index 793df34b1..32fe646ed 100644 --- a/src/UI/Components/AxisMode/AxisMode.less +++ b/src/UI/Components/AxisMode/AxisMode.less @@ -11,6 +11,7 @@ box-shadow : 0 0 2px white inset; border-radius: 20px; margin-right: 10px; + background-color: rgba(1, 1, 1); button { border-radius: 50%; diff --git a/src/UI/Components/AxisMode/AxisMode.tsx b/src/UI/Components/AxisMode/AxisMode.tsx index 6bf7211bb..b44d3a34e 100644 --- a/src/UI/Components/AxisMode/AxisMode.tsx +++ b/src/UI/Components/AxisMode/AxisMode.tsx @@ -1,27 +1,25 @@ import { Button, Icon, Popover } from '@blueprintjs/core'; -import { observable } from 'mobx'; import { observer } from 'mobx-react'; import React, { Component } from 'react'; import { app } from '../../../ApplicationServices/Application'; import { SpaceCSType, TransMode } from '../../../Editor/TranstrolControl/TransformServices'; -import { userConfig } from '../../../Editor/UserConfig'; import './AxisMode.less'; - +import AxisModeStore from './AxisModeStore'; export const spanColor = "#1890ff"; @observer export default class AxisMode extends Component { - @observable _SpaceCSType: SpaceCSType = SpaceCSType.Local; + axisStore: AxisModeStore = AxisModeStore.GetSingleInstance(); _ChangeAxisMode = (e: React.MouseEvent, mode: TransMode) => { - userConfig.curMode = mode; + this.axisStore.curMode = mode; app.Editor.TransCtrl.Mode = mode; }; _ChangeSpaceCSType(spaceCSType: SpaceCSType) { app.Editor.TransCtrl.SpaceCSType = spaceCSType; - this._SpaceCSType = spaceCSType; + this.axisStore._SpaceCSType = spaceCSType; } render() @@ -31,67 +29,75 @@ export default class AxisMode extends Component
-

选择对象Objecet(Q)

+

选择对象模式({this.axisStore._AxisDisable})

- } minimal interactionKind='hover' placement='bottom'> + } minimal interactionKind='hover' placement='bottom' + onOpening={this.axisStore.SyncHotkey} + > -

选择并移动对象(W)

- 长按(Ctrl + Alt)获取更多信息 +

选择并移动对象({this.axisStore._AxisTranslate_Hotkey})

+ {/* 长按(Ctrl + Alt)获取更多信息 */} - } minimal interactionKind='hover' placement='bottom'> + } minimal interactionKind='hover' placement='bottom' + onOpening={this.axisStore.SyncHotkey} + >
-

选择并旋转对象(E)

- 长按(Ctrl + Alt)获取更多信息 +

选择并旋转对象({this.axisStore._AxisRotate_Hotkey})

+ {/* 长按(Ctrl + Alt)获取更多信息 */} - } minimal interactionKind='hover' placement='bottom'> + } minimal interactionKind='hover' placement='bottom' + onOpening={this.axisStore.SyncHotkey} + >
-

旋转并缩放对象(R)

- 长按(Ctrl + Alt)获取更多信息 +

旋转并缩放对象({this.axisStore._AxisScale_Hotkey})

+ {/* 长按(Ctrl + Alt)获取更多信息 */} - } minimal interactionKind='hover' placement='bottom'> + } minimal interactionKind='hover' placement='bottom' + onOpening={this.axisStore.SyncHotkey} + >
@@ -99,12 +105,15 @@ export default class AxisMode extends Component
-

在世界场景和本地(对象)之间循环变形小工具坐标系(Ctrl + `)

- 长按(Ctrl + Alt)获取更多信息 +

在世界场景和本地(对象)之间循环变形小工具坐标系({this.axisStore._GizmoCSSwith_Hotkey})

+ {/* 长按(Ctrl + Alt)获取更多信息 */} +

{`当前:${this.axisStore._SpaceCSType === SpaceCSType.World ? "世界" : "本地"}坐标系`}

- } minimal interactionKind='hover' placement='bottom'> + } minimal interactionKind='hover' placement='bottom' + onOpening={this.axisStore.SyncHotkey} + > { - this._SpaceCSType === SpaceCSType.World ? + this.axisStore._SpaceCSType === SpaceCSType.World ?