mirror of https://gitee.com/cf-fz/WebCAD.git
!1685 功能:底部工具栏增加隐藏显示灯光助手开关
parent
6ba67dd2f1
commit
d25a0b9f99
@ -0,0 +1,81 @@
|
|||||||
|
|
||||||
|
import { Button, Menu, MenuItem, Popover } from "@blueprintjs/core";
|
||||||
|
import { observer } from "mobx-react";
|
||||||
|
import * as React from "react";
|
||||||
|
import { DownPanelStore, LightDataModeType } from "../UI/Store/DownPanelStore";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 底部状态栏的灯光助手按钮.
|
||||||
|
*/
|
||||||
|
@observer
|
||||||
|
export class LightsMenu extends React.Component<{}>
|
||||||
|
{
|
||||||
|
public state = {
|
||||||
|
isOpenMenu: false,
|
||||||
|
};
|
||||||
|
render()
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
<Popover
|
||||||
|
isOpen={this.state.isOpenMenu ? true : undefined}
|
||||||
|
modifiers={{ arrow: { enabled: false } }}
|
||||||
|
onClosed={this.close}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
style={{ fontSize: "11px", textAlign: "center", minHeight: "15px", height: "15px", lineHeight: "1px" }}
|
||||||
|
text="灯光助手"
|
||||||
|
/>
|
||||||
|
{this.RenderMenu()}
|
||||||
|
</Popover >
|
||||||
|
);
|
||||||
|
}
|
||||||
|
RenderMenu = () =>
|
||||||
|
{
|
||||||
|
const downStore = DownPanelStore.GetInstance() as DownPanelStore;
|
||||||
|
return (
|
||||||
|
<Menu
|
||||||
|
className="snapMenu-fixed"
|
||||||
|
style={{ minWidth: "120px" }}
|
||||||
|
tabIndex={-1}
|
||||||
|
>
|
||||||
|
{
|
||||||
|
downStore.lightsData.map(
|
||||||
|
(data) =>
|
||||||
|
<MenuItem
|
||||||
|
key={data.mode}
|
||||||
|
text={data.name}
|
||||||
|
icon={data.enable ? "tick" : "blank"}
|
||||||
|
shouldDismissPopover={false}
|
||||||
|
onClick={() =>
|
||||||
|
{
|
||||||
|
data.enable = !data.enable;
|
||||||
|
if (data.mode !== LightDataModeType.A && !data.enable) //有灯光取消打勾时, "全部"取消打勾
|
||||||
|
{
|
||||||
|
if (downStore.lightsData[0].enable)
|
||||||
|
downStore.lightsData[0].enable = false;
|
||||||
|
}
|
||||||
|
if (data.mode === LightDataModeType.A && data.enable) //选"全部"打勾时,所灯光ui打勾
|
||||||
|
{
|
||||||
|
for (let data of downStore.lightsData)
|
||||||
|
if (!data.enable && data.mode !== LightDataModeType.A)
|
||||||
|
data.enable = true;
|
||||||
|
}
|
||||||
|
else if (data.mode === LightDataModeType.A && !data.enable) // 选"全部"不打勾时,所灯光ui取消打勾
|
||||||
|
{
|
||||||
|
for (let data of downStore.lightsData)
|
||||||
|
if (data.enable && data.mode !== LightDataModeType.A)
|
||||||
|
data.enable = false;
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</Menu>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
private close = () =>
|
||||||
|
{
|
||||||
|
let store = DownPanelStore.GetInstance() as DownPanelStore;
|
||||||
|
store.Upload();
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in new issue