!1648 修复:工具栏菜单、视图菜单、对象捕捉菜单无法切换

pull/1644/MERGE
黄诗津 3 years ago committed by ChenX
parent 217d157cf5
commit 93b73c57d8

@ -3,10 +3,9 @@ import { observable } from "mobx";
import { observer } from "mobx-react";
import * as React from "react";
import { app } from "../ApplicationServices/Application";
import { KeyBoard } from "../Common/KeyEnum";
import { SnapModal } from "../UI/Components/Modal/SnapModal";
import { SNAPMODE } from "./ShowSnapMenu";
import { DownPanelStore } from "../UI/Store/DownPanelStore";
import { SNAPMODE } from "./ShowSnapMenu";
/**
* .
@ -14,27 +13,27 @@ import { DownPanelStore } from "../UI/Store/DownPanelStore";
@observer
export class SnapMenuFixed extends React.Component<{}>
{
@observable private isMenuShow: boolean = false;
/**
* ,,.
*/
@observable private isModalShow: boolean = false;
public state = {
isOpenObjectSnap: false,
};
render()
{
return (
<Popover
isOpen={this.isMenuShow}
isOpen={this.state.isOpenObjectSnap ? true : undefined}
modifiers={{ arrow: { enabled: false } }}
content={this.RenderMenu()}
onClosed={this.close}
>
<Button
style={{ fontSize: "11px", textAlign: "center", minHeight: "15px", height: "15px", lineHeight: "1px" }}
text="对象捕捉"
onContextMenu={this.ShowMenu}
onClick={this.ShowMenu}
/>
{this.RenderMenu()}
</Popover >
);
}
@ -46,18 +45,6 @@ export class SnapMenuFixed extends React.Component<{}>
className="snapMenu-fixed"
style={{ minWidth: "120px" }}
tabIndex={-1}
onKeyDown={(e) =>
{
if (e.keyCode === KeyBoard.Escape)
{
this.HideMenu();
e.stopPropagation();
}
}}
onBlur={() =>
{
this.HideMenu();
}}
>
{
downStore.snapData.map(
@ -66,6 +53,7 @@ export class SnapMenuFixed extends React.Component<{}>
key={data.mode}
text={data.name}
icon={data.enable ? "tick" : "blank"}
shouldDismissPopover={false}
onClick={() =>
{
let snapServices = app.Editor.GetPointServices.snapServices;
@ -79,9 +67,9 @@ export class SnapMenuFixed extends React.Component<{}>
<MenuDivider />
<MenuItem
text={"对象捕捉设置..."}
shouldDismissPopover={false}
onClick={() =>
{
this.isModalShow = true;
app.Editor.ModalManage.RenderModal(SnapModal, { store: downStore });
}}
/>
@ -89,20 +77,6 @@ export class SnapMenuFixed extends React.Component<{}>
);
};
ShowMenu = (e: any) =>
{
this.isMenuShow = true;
this.isModalShow = false;
app.Editor.MaskManage.ShowMask();
e.preventDefault();
};
HideMenu = () =>
{
this.isMenuShow = false;
if (!this.isModalShow)
app.Editor.MaskManage.Clear();
};
private close = () =>
{
let store = DownPanelStore.GetInstance() as DownPanelStore;

@ -6,7 +6,6 @@ import { OrthographicCamera, Vector3 } from "three";
import { begin, end } from "xaop";
import { app } from "../../../ApplicationServices/Application";
import { CommandNames } from "../../../Common/CommandNames";
import { KeyBoard } from "../../../Common/KeyEnum";
import { Singleton } from "../../../Common/Singleton";
import { commandMachine } from "../../../Editor/CommandMachine";
import { equalv3 } from "../../../Geometry/GeUtils";
@ -122,6 +121,10 @@ export class CameraControlBtnStore extends Singleton
@observer
export class CameraControlBtn extends React.Component<{ store: CameraControlBtnStore; }, {}>
{
public state = {
isOpenToolbar: false,
isOpenViewMenu: false,
};
render()
{
const { m_isMenuShow, m_ViewMenuTitle } = this.props.store;
@ -139,43 +142,31 @@ export class CameraControlBtn extends React.Component<{ store: CameraControlBtnS
return (
<div>
<Popover
isOpen={m_isMenuShow === MenuType.ControlsMenu}
isOpen={this.state.isOpenToolbar === true ? true : undefined}
modifiers={{ arrow: { enabled: false } }}
content={this.RenderControlsMenu()}
>
<Button
style={btnStyle}
minimal={true}
text="[-]"
onContextMenu={() => this.ShowMenu(MenuType.ControlsMenu)}
onClick={() =>
{
if (m_isMenuShow === MenuType.ControlsMenu)
this.HideMenu();
else
this.ShowMenu(MenuType.ControlsMenu);
}}
/>
{
this.RenderControlsMenu()
}
</Popover >
<Popover
isOpen={m_isMenuShow === MenuType.ViewMenu}
isOpen={this.state.isOpenViewMenu === true ? true : undefined}
modifiers={{ arrow: { enabled: false } }}
content={this.RenderViewMenu()}
>
<Button
style={btnStyle}
minimal={true}
text={`[${m_ViewMenuTitle}]`}
onContextMenu={() => this.ShowMenu(MenuType.ViewMenu)}
onClick={() =>
{
if (m_isMenuShow === MenuType.ViewMenu)
this.HideMenu();
else
this.ShowMenu(MenuType.ViewMenu);
}}
/>
{
this.RenderViewMenu()
}
</Popover >
{
VisualStyleData.map(
@ -231,25 +222,13 @@ export class CameraControlBtn extends React.Component<{ store: CameraControlBtnS
className="controlsMenu-fixed"
style={{ minWidth: "120px" }}
tabIndex={-1}
onKeyDown={(e) =>
{
if (e.keyCode === KeyBoard.Escape)
{
this.HideMenu();
e.stopPropagation();
}
}}
onBlur={this.HideMenu}
>
{
<>
<MenuItem
text="顶部工具栏"
icon={downStore.isTopToolBarShow ? "tick" : "blank"}
onClick={() =>
{
downStore.toggleTopToolBarShow();
this.HideMenu();
}}
/>
<MenuItem
@ -258,7 +237,6 @@ export class CameraControlBtn extends React.Component<{ store: CameraControlBtnS
onClick={() =>
{
downStore.toggleLeftToolBarShow();
this.HideMenu();
}}
/>
<MenuItem
@ -267,11 +245,8 @@ export class CameraControlBtn extends React.Component<{ store: CameraControlBtnS
onClick={() =>
{
downStore.toggleBottomToolBarShow();
this.HideMenu();
}}
/>
</>
}
</Menu>
);
};
@ -284,18 +259,6 @@ export class CameraControlBtn extends React.Component<{ store: CameraControlBtnS
className="viewMenu-fixed"
style={{ minWidth: "120px" }}
tabIndex={-1}
onKeyDown={(e) =>
{
if (e.keyCode === KeyBoard.Escape)
{
this.HideMenu();
e.stopPropagation();
}
}}
onBlur={() =>
{
this.HideMenu();
}}
>
{
viewData.map(
@ -306,7 +269,6 @@ export class CameraControlBtn extends React.Component<{ store: CameraControlBtnS
icon={data.name === m_ViewMenuTitle ? "tick" : "blank"}
onClick={() =>
{
this.HideMenu();
m_ViewMenuTitle = data.name;
commandMachine.ExecCommand(data.command);
}}
@ -319,7 +281,6 @@ export class CameraControlBtn extends React.Component<{ store: CameraControlBtnS
icon={m_CameraType === "正交" ? "tick" : "blank"}
onClick={() =>
{
this.HideMenu();
if (m_CameraType !== "正交")
app.Viewer.CameraCtrl.SwitchCamera();
}}
@ -329,7 +290,6 @@ export class CameraControlBtn extends React.Component<{ store: CameraControlBtnS
icon={m_CameraType === "透视" ? "tick" : "blank"}
onClick={() =>
{
this.HideMenu();
if (m_CameraType !== "透视")
app.Viewer.CameraCtrl.SwitchCamera();
}}
@ -338,15 +298,4 @@ export class CameraControlBtn extends React.Component<{ store: CameraControlBtnS
);
};
ShowMenu = (menuType: MenuType) =>
{
this.props.store.m_isMenuShow = menuType;
app.Editor.MaskManage.ShowMask();
};
HideMenu = () =>
{
this.props.store.m_isMenuShow = -1;
app.Editor.MaskManage.Clear();
};
}

@ -18,7 +18,6 @@ export class ReplaceOrRename extends React.Component<Operation>{
isOpen={this.props.isOpen}
canOutsideClickClose={false}
onClose={this.props.cancel}
icon="key-tab"
>
<div>
<div >

Loading…
Cancel
Save