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

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

@ -279,8 +279,9 @@ export enum CommandNames
Replace = "重新放置模型", Replace = "重新放置模型",
Down = "DOWN", Down = "DOWN",
AxesDisable = 'AXESDISABLE', //取消Gizmo AxesDisable = "AXESDISABLE", //取消Gizmo
AxesTranslate = 'AXESTRANSLATE', //移动坐标 AxesTranslate = "AXESTRANSLATE", //移动坐标
AxesRotate = 'AXESROTATE', //旋转坐标 AxesRotate = "AXESROTATE", //旋转坐标
AxesScale = 'AXESSCALE', //缩放坐标 AxesScale = "AXESSCALE", //缩放坐标
GizmoCSSwith = "GIZMOCSSWITH",
} }

@ -36,10 +36,23 @@ export enum HotkeyList
AD = "Alt+D", AD = "Alt+D",
AS = "Alt+S", AS = "Alt+S",
AF = "Alt+F", 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", D = "Delete",
END = "End", END = "End",
F1 = "F1", F1 = "F1",

@ -250,7 +250,7 @@ import { BuyMaterial } from './../Add-on/BuyMaterial';
import { Interfere } from './../Add-on/interfere'; import { Interfere } from './../Add-on/interfere';
import { ShowKinfeManageModal } from './../Add-on/showModal/ShowKnifeManageModal'; import { ShowKinfeManageModal } from './../Add-on/showModal/ShowKnifeManageModal';
import { commandMachine } from './CommandMachine'; 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 { TransMode } from "./TranstrolControl/TransformServices";
import { userConfig } from "./UserConfig"; import { userConfig } from "./UserConfig";
export function registerCommand() export function registerCommand()
@ -711,12 +711,12 @@ export function registerCommand()
commandMachine.RegisterCommand(CommandNames.ParseBoardName, new Command_ParseBoardName()); commandMachine.RegisterCommand(CommandNames.ParseBoardName, new Command_ParseBoardName());
commandMachine.RegisterCommand(CommandNames.Down, new Command_Cmd_Down()); commandMachine.RegisterCommand(CommandNames.Down, new Command_Cmd_Down());
//切换坐标系命令 //Gizmo
commandMachine.RegisterCommand(CommandNames.AxesDisable, new Command_SetGizmoMode(TransMode.OCS)); commandMachine.RegisterCommand(CommandNames.AxesDisable, new Command_SetGizmoMode(TransMode.OCS));
commandMachine.RegisterCommand(CommandNames.AxesTranslate, new Command_SetGizmoMode(TransMode.Move)); commandMachine.RegisterCommand(CommandNames.AxesTranslate, new Command_SetGizmoMode(TransMode.Move));
commandMachine.RegisterCommand(CommandNames.AxesRotate, new Command_SetGizmoMode(TransMode.Rotate)); commandMachine.RegisterCommand(CommandNames.AxesRotate, new Command_SetGizmoMode(TransMode.Rotate));
commandMachine.RegisterCommand(CommandNames.AxesScale, new Command_SetGizmoMode(TransMode.Scale)); commandMachine.RegisterCommand(CommandNames.AxesScale, new Command_SetGizmoMode(TransMode.Scale));
commandMachine.RegisterCommand(CommandNames.GizmoCSSwith, new Command_GizmoCSSwith());
} }
export async function LimitCommand() export async function LimitCommand()

@ -1,6 +1,6 @@
import { app } from "../../ApplicationServices/Application"; import { app } from "../../ApplicationServices/Application";
import AxisModeStore from "../../UI/Components/AxisMode/AxisModeStore";
import { Command } from "../CommandMachine"; import { Command } from "../CommandMachine";
import { userConfig } from "../UserConfig";
import { TransMode } from './TransformServices'; import { TransMode } from './TransformServices';
@ -9,7 +9,17 @@ export class Command_SetGizmoMode implements Command
constructor(private mode: TransMode) { } constructor(private mode: TransMode) { }
async exec() async exec()
{ {
userConfig.curMode = this.mode; AxisModeStore.GetSingleInstance().curMode = this.mode;
app.Editor.TransCtrl.Mode = 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 openLightConfig: boolean = false; //画灯光前是否打开配置
@observable oneKeyOpenLight: boolean = false; //一键开关灯光(通电/不通电) @observable oneKeyOpenLight: boolean = false; //一键开关灯光(通电/不通电)
@observable isShowLightShadow = false; //一键开关灯光阴影(除了太阳光) @observable isShowLightShadow = false; //一键开关灯光阴影(除了太阳光)
@observable curMode = 3; //模型坐标轴类型
constructor() constructor()
{ {

@ -11,6 +11,7 @@
box-shadow : 0 0 2px white inset; box-shadow : 0 0 2px white inset;
border-radius: 20px; border-radius: 20px;
margin-right: 10px; margin-right: 10px;
background-color: rgba(1, 1, 1);
button button
{ {
border-radius: 50%; border-radius: 50%;

@ -1,27 +1,25 @@
import { Button, Icon, Popover } from '@blueprintjs/core'; import { Button, Icon, Popover } from '@blueprintjs/core';
import { observable } from 'mobx';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { app } from '../../../ApplicationServices/Application'; import { app } from '../../../ApplicationServices/Application';
import { SpaceCSType, TransMode } from '../../../Editor/TranstrolControl/TransformServices'; import { SpaceCSType, TransMode } from '../../../Editor/TranstrolControl/TransformServices';
import { userConfig } from '../../../Editor/UserConfig';
import './AxisMode.less'; import './AxisMode.less';
import AxisModeStore from './AxisModeStore';
export const spanColor = "#1890ff"; export const spanColor = "#1890ff";
@observer @observer
export default class AxisMode extends Component export default class AxisMode extends Component
{ {
@observable _SpaceCSType: SpaceCSType = SpaceCSType.Local; axisStore: AxisModeStore = AxisModeStore.GetSingleInstance();
_ChangeAxisMode = (e: React.MouseEvent, mode: TransMode) => _ChangeAxisMode = (e: React.MouseEvent, mode: TransMode) =>
{ {
userConfig.curMode = mode; this.axisStore.curMode = mode;
app.Editor.TransCtrl.Mode = mode; app.Editor.TransCtrl.Mode = mode;
}; };
_ChangeSpaceCSType(spaceCSType: SpaceCSType) _ChangeSpaceCSType(spaceCSType: SpaceCSType)
{ {
app.Editor.TransCtrl.SpaceCSType = spaceCSType; app.Editor.TransCtrl.SpaceCSType = spaceCSType;
this._SpaceCSType = spaceCSType; this.axisStore._SpaceCSType = spaceCSType;
} }
render() render()
@ -31,67 +29,75 @@ export default class AxisMode extends Component
<div className='SwitchAxisMode'> <div className='SwitchAxisMode'>
<Popover content={ <Popover content={
<div className='AxisModeToolTip'> <div className='AxisModeToolTip'>
<p>ObjecetQ</p> <p>{this.axisStore._AxisDisable}</p>
</div> </div>
} minimal interactionKind='hover' placement='bottom'> } minimal interactionKind='hover' placement='bottom'
onOpening={this.axisStore.SyncHotkey}
>
<Button <Button
minimal minimal
onClick={(e) => { this._ChangeAxisMode(e, TransMode.OCS); }} onClick={(e) => { this._ChangeAxisMode(e, TransMode.OCS); }}
> >
<Icon <Icon
icon='select' icon='select'
style={{ color: userConfig.curMode === TransMode.OCS ? spanColor : "#FFFFFF" }} style={{ color: this.axisStore.curMode === TransMode.OCS ? spanColor : "#FFFFFF" }}
/> />
</Button> </Button>
</Popover> </Popover>
<Popover content={ <Popover content={
<div className='AxisModeToolTip'> <div className='AxisModeToolTip'>
<p>W</p> <p>{this.axisStore._AxisTranslate_Hotkey}</p>
(Ctrl + Alt) {/* 长按(Ctrl + Alt)获取更多信息 */}
</div> </div>
} minimal interactionKind='hover' placement='bottom'> } minimal interactionKind='hover' placement='bottom'
onOpening={this.axisStore.SyncHotkey}
>
<Button <Button
minimal minimal
onClick={(e) => { this._ChangeAxisMode(e, TransMode.Move); }} onClick={(e) => { this._ChangeAxisMode(e, TransMode.Move); }}
> >
<Icon <Icon
icon='move' icon='move'
style={{ color: userConfig.curMode === TransMode.Move ? spanColor : "#FFFFFF" }} style={{ color: this.axisStore.curMode === TransMode.Move ? spanColor : "#FFFFFF" }}
/> />
</Button> </Button>
</Popover> </Popover>
<Popover content={ <Popover content={
<div className='AxisModeToolTip'> <div className='AxisModeToolTip'>
<p>E</p> <p>{this.axisStore._AxisRotate_Hotkey}</p>
(Ctrl + Alt) {/* 长按(Ctrl + Alt)获取更多信息 */}
</div> </div>
} minimal interactionKind='hover' placement='bottom'> } minimal interactionKind='hover' placement='bottom'
onOpening={this.axisStore.SyncHotkey}
>
<Button <Button
minimal minimal
onClick={(e) => { this._ChangeAxisMode(e, TransMode.Rotate); }} onClick={(e) => { this._ChangeAxisMode(e, TransMode.Rotate); }}
> >
<Icon <Icon
icon='refresh' icon='refresh'
style={{ color: userConfig.curMode === TransMode.Rotate ? spanColor : "#FFFFFF" }} style={{ color: this.axisStore.curMode === TransMode.Rotate ? spanColor : "#FFFFFF" }}
/> />
</Button> </Button>
</Popover> </Popover>
<Popover content={ <Popover content={
<div className='AxisModeToolTip'> <div className='AxisModeToolTip'>
<p>R</p> <p>{this.axisStore._AxisScale_Hotkey}</p>
(Ctrl + Alt) {/* 长按(Ctrl + Alt)获取更多信息 */}
</div> </div>
} minimal interactionKind='hover' placement='bottom'> } minimal interactionKind='hover' placement='bottom'
onOpening={this.axisStore.SyncHotkey}
>
<Button <Button
minimal minimal
onClick={(e) => { this._ChangeAxisMode(e, TransMode.Scale); }} onClick={(e) => { this._ChangeAxisMode(e, TransMode.Scale); }}
> >
<Icon <Icon
icon='share' icon='share'
style={{ color: userConfig.curMode === TransMode.Scale ? spanColor : "#FFFFFF" }} style={{ color: this.axisStore.curMode === TransMode.Scale ? spanColor : "#FFFFFF" }}
/> />
</Button> </Button>
</Popover> </Popover>
@ -99,12 +105,15 @@ export default class AxisMode extends Component
<div className='SwitchAxisMode'> <div className='SwitchAxisMode'>
<Popover content={ <Popover content={
<div className='AxisModeToolTip'> <div className='AxisModeToolTip'>
<p>Ctrl + `</p> <p>{this.axisStore._GizmoCSSwith_Hotkey}</p>
(Ctrl + Alt) {/* 长按(Ctrl + Alt)获取更多信息 */}
<p>{`当前:${this.axisStore._SpaceCSType === SpaceCSType.World ? "世界" : "本地"}坐标系`}</p>
</div> </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 <Button
minimal minimal
onClick={() => { this._ChangeSpaceCSType(SpaceCSType.Local); }} onClick={() => { this._ChangeSpaceCSType(SpaceCSType.Local); }}
@ -127,7 +136,7 @@ export default class AxisMode extends Component
} }
</Popover> </Popover>
</div> </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 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 _SingleInstance: AxisModeStore;
static GetSingleInstance(): AxisModeStore static GetSingleInstance(): AxisModeStore
{ {

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

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

Loading…
Cancel
Save