!1771 增强:切换轴线UI同步热键

pull/1773/head
我是一条懒汉 3 years ago committed by ChenX
parent 76d1a595c4
commit f9b9899dc1

@ -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",
}

@ -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",

@ -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()

@ -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;
}
}

@ -126,7 +126,6 @@ export class UserConfig implements IConfigStore
@observable openLightConfig: boolean = false; //画灯光前是否打开配置
@observable oneKeyOpenLight: boolean = false; //一键开关灯光(通电/不通电)
@observable isShowLightShadow = false; //一键开关灯光阴影(除了太阳光)
@observable curMode = 3; //模型坐标轴类型
constructor()
{

@ -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%;

@ -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
<div className='SwitchAxisMode'>
<Popover content={
<div className='AxisModeToolTip'>
<p>ObjecetQ</p>
<p>{this.axisStore._AxisDisable}</p>
</div>
} minimal interactionKind='hover' placement='bottom'>
} minimal interactionKind='hover' placement='bottom'
onOpening={this.axisStore.SyncHotkey}
>
<Button
minimal
onClick={(e) => { this._ChangeAxisMode(e, TransMode.OCS); }}
>
<Icon
icon='select'
style={{ color: userConfig.curMode === TransMode.OCS ? spanColor : "#FFFFFF" }}
style={{ color: this.axisStore.curMode === TransMode.OCS ? spanColor : "#FFFFFF" }}
/>
</Button>
</Popover>
<Popover content={
<div className='AxisModeToolTip'>
<p>W</p>
(Ctrl + Alt)
<p>{this.axisStore._AxisTranslate_Hotkey}</p>
{/* 长按(Ctrl + Alt)获取更多信息 */}
</div>
} minimal interactionKind='hover' placement='bottom'>
} minimal interactionKind='hover' placement='bottom'
onOpening={this.axisStore.SyncHotkey}
>
<Button
minimal
onClick={(e) => { this._ChangeAxisMode(e, TransMode.Move); }}
>
<Icon
icon='move'
style={{ color: userConfig.curMode === TransMode.Move ? spanColor : "#FFFFFF" }}
style={{ color: this.axisStore.curMode === TransMode.Move ? spanColor : "#FFFFFF" }}
/>
</Button>
</Popover>
<Popover content={
<div className='AxisModeToolTip'>
<p>E</p>
(Ctrl + Alt)
<p>{this.axisStore._AxisRotate_Hotkey}</p>
{/* 长按(Ctrl + Alt)获取更多信息 */}
</div>
} minimal interactionKind='hover' placement='bottom'>
} minimal interactionKind='hover' placement='bottom'
onOpening={this.axisStore.SyncHotkey}
>
<Button
minimal
onClick={(e) => { this._ChangeAxisMode(e, TransMode.Rotate); }}
>
<Icon
icon='refresh'
style={{ color: userConfig.curMode === TransMode.Rotate ? spanColor : "#FFFFFF" }}
style={{ color: this.axisStore.curMode === TransMode.Rotate ? spanColor : "#FFFFFF" }}
/>
</Button>
</Popover>
<Popover content={
<div className='AxisModeToolTip'>
<p>R</p>
(Ctrl + Alt)
<p>{this.axisStore._AxisScale_Hotkey}</p>
{/* 长按(Ctrl + Alt)获取更多信息 */}
</div>
} minimal interactionKind='hover' placement='bottom'>
} minimal interactionKind='hover' placement='bottom'
onOpening={this.axisStore.SyncHotkey}
>
<Button
minimal
onClick={(e) => { this._ChangeAxisMode(e, TransMode.Scale); }}
>
<Icon
icon='share'
style={{ color: userConfig.curMode === TransMode.Scale ? spanColor : "#FFFFFF" }}
style={{ color: this.axisStore.curMode === TransMode.Scale ? spanColor : "#FFFFFF" }}
/>
</Button>
</Popover>
@ -99,12 +105,15 @@ export default class AxisMode extends Component
<div className='SwitchAxisMode'>
<Popover content={
<div className='AxisModeToolTip'>
<p>Ctrl + `</p>
(Ctrl + Alt)
<p>{this.axisStore._GizmoCSSwith_Hotkey}</p>
{/* 长按(Ctrl + Alt)获取更多信息 */}
<p>{`当前:${this.axisStore._SpaceCSType === SpaceCSType.World ? "世界" : "本地"}坐标系`}</p>
</div>
} minimal interactionKind='hover' placement='bottom'>
} minimal interactionKind='hover' placement='bottom'
onOpening={this.axisStore.SyncHotkey}
>
{
this._SpaceCSType === SpaceCSType.World ?
this.axisStore._SpaceCSType === SpaceCSType.World ?
<Button
minimal
onClick={() => { this._ChangeSpaceCSType(SpaceCSType.Local); }}
@ -127,7 +136,7 @@ export default class AxisMode extends Component
}
</Popover>
</div>
</div>
</div >
);
}
}

@ -1,8 +1,32 @@
import { observable, runInAction } from "mobx";
import { CommandNames } from "../../../Common/CommandNames";
import { CommandServer } from "../../../DatabaseServices/CommandServer";
import { SpaceCSType } from "../../../Editor/TranstrolControl/TransformServices";
export default class AxisModeStore
{
@observable _AxisDisable: string;
@observable _AxisTranslate_Hotkey: string;
@observable _AxisRotate_Hotkey: string;
@observable _AxisScale_Hotkey: string;
@observable _GizmoCSSwith_Hotkey: string;
@observable curMode = 3; //模型坐标轴类型
@observable _SpaceCSType: SpaceCSType = SpaceCSType.Local;
SyncHotkey = () =>
{
runInAction(() =>
{
let cmd = CommandServer.GetInstance();
this._AxisDisable = cmd.CommandHotKeyMap.get(CommandNames.AxesDisable);
this._AxisTranslate_Hotkey = cmd.CommandHotKeyMap.get(CommandNames.AxesTranslate);
this._AxisRotate_Hotkey = cmd.CommandHotKeyMap.get(CommandNames.AxesRotate);
this._AxisScale_Hotkey = cmd.CommandHotKeyMap.get(CommandNames.AxesScale);
this._GizmoCSSwith_Hotkey = cmd.CommandHotKeyMap.get(CommandNames.GizmoCSSwith);
});
};
private constructor() { }
static _SingleInstance: AxisModeStore;
static GetSingleInstance(): AxisModeStore
{

@ -34,6 +34,7 @@ export class CommandPanel extends React.Component<{}, CommandPanelState>
tabArr: [
["二维", "i2d", 0],
["三维", "i3d", 0],
["放置", "giz", 0],
["画板", "hb", 0],
["板件编辑", "bjbj", 0],
["灯光", "dg", 0],

@ -183,48 +183,59 @@ export const CommandList: ICommand[] = [
chDes: "设置当前用户坐标系 (UCS) 的原点和方向",
},
{
icon: IconEnum.UCS,
typeId: "i3d",
icon: "GizSelect.svg",
typeId: "giz",
link: `#`,
defaultCustom: CommandNames.AxesDisable,
command: CommandNames.AxesDisable,
type: "三维",
chName: "选择对象模式",
chDes: "选择对象模式",
hotkeysCustomize: HotkeyList.AQ
},
{
icon: "GizMove.svg",
typeId: "giz",
link: `#`,
defaultCustom: CommandNames.AxesTranslate,
command: CommandNames.AxesTranslate,
type: "三维",
chName: "移动坐标系",
chDes: "将当前坐标系换为移动坐标系",
chName: "移动对象模式",
chDes: "移动对象模式",
hotkeysCustomize: HotkeyList.AW
},
{
icon: IconEnum.UCS,
typeId: "i3d",
icon: "GizRotate.svg",
typeId: "giz",
link: `#`,
defaultCustom: CommandNames.AxesRotate,
command: CommandNames.AxesRotate,
type: "三维",
chName: "旋转坐标系",
chDes: "将当前坐标系换为旋转坐标系",
chName: "旋转对象模式",
chDes: "旋转对象模式",
hotkeysCustomize: HotkeyList.AE
},
{
icon: IconEnum.UCS,
typeId: "i3d",
icon: "GizScale.svg",
typeId: "giz",
link: `#`,
defaultCustom: CommandNames.AxesScale,
command: CommandNames.AxesScale,
type: "三维",
chName: "缩放坐标系",
chDes: "将当前坐标系换为缩放坐标系",
chName: "缩放对象模式",
chDes: "缩放对象模式",
hotkeysCustomize: HotkeyList.AR
},
{
icon: IconEnum.UCS,
typeId: "i3d",
icon: "global.svg",
typeId: "giz",
link: `#`,
defaultCustom: CommandNames.AxesDisable,
command: CommandNames.AxesDisable,
defaultCustom: CommandNames.GizmoCSSwith,
command: CommandNames.GizmoCSSwith,
type: "三维",
chName: "取消Gizmo",
chDes: "选中模型时不显示控制坐标系",
hotkeysCustomize: HotkeyList.AQ
chName: "切换Gizmo坐标系(世界-本地)",
chDes: "切换Gizmo坐标系(世界-本地)",
hotkeysCustomize: HotkeyList.ADot
},
{
icon: IconEnum.ExtrudeEntity,

Loading…
Cancel
Save