!2194 功能:在渲染器连接时,在底部工具栏添加<显隐同步>开关

pull/2218/MERGE
黄诗津 1 year ago committed by ChenX
parent 54f3666ebe
commit aac767d484

@ -52,6 +52,7 @@ import { GetCompoentObjectIdString } from '../UI/Components/ComponentObjectId';
import { ModalFooter, ModalHeader } from '../UI/Components/Modal/ModalContainer';
import { ModalPosition } from '../UI/Components/Modal/ModalInterface';
import { AppToaster } from '../UI/Components/Toaster';
import { DownPanelStore } from '../UI/Store/DownPanelStore';
import { TopPanelStore } from '../UI/Store/TopPanelStore';
import { Hole } from './../DatabaseServices/3DSolid/Hole';
import { CompositeEntity } from './../DatabaseServices/Entity/CompositeEntity';
@ -239,8 +240,12 @@ export function Entitys2Data(ents: Iterable<Entity>): Data
else
continue;
let visiable = e.VisibleInRender;
if (DownPanelStore.GetInstance().showHideSync)
visiable = visiable && e.Visible;
for (; index < d.Entitys.length; index++)
d.Entitys[index].Visiable = e.VisibleInRender;
d.Entitys[index].Visiable = visiable;
}
let materials = new Set<number>();

@ -1,6 +1,7 @@
import { end } from "xaop";
import { AppendUserInfo, ConverRoomRoof2Data, ConverRoomUnderFloor2Data, Data, Entitys2Data } from "../Add-on/ExportData";
import { app, ApplicationService } from "../ApplicationServices/Application";
import { CommandNames } from "../Common/CommandNames";
import { Hole } from "../DatabaseServices/3DSolid/Hole";
import { CADObject } from "../DatabaseServices/CADObject";
import { CommandHistoryRecord } from "../DatabaseServices/CommandHistoryRecord";
@ -26,6 +27,13 @@ function IsSyncEntity(ent: CADObject): boolean
return ent instanceof Entity && !(ent instanceof Hole);
}
const NO_SYNC_COMMANDS: Set<string> = new Set([
CommandNames.BatchModify,
CommandNames.EditDrilEdgeData,
CommandNames.EditSealEdgeData,
CommandNames.Hole,
]);
export class SyncDataReactor
{
constructor(private app: ApplicationService)
@ -35,6 +43,7 @@ export class SyncDataReactor
return (cmdName: string, historyRec: CommandHistoryRecord) =>
{
if (!userConfig.synchronousEnable || !app.WebSocket.IsLink) return;
if (NO_SYNC_COMMANDS.has(cmdName)) return;
let createEntitys = new Set<Entity>();
let changeEntitys = new Set<Entity>();

@ -1,6 +1,8 @@
import { Alignment, Button, Classes, HTMLSelect, Intent, Navbar, Position, ProgressBar, Switch, Tooltip } from '@blueprintjs/core';
import { observable } from 'mobx';
import { inject, observer } from 'mobx-react';
import * as React from 'react';
import { end } from 'xaop';
import { SendFile } from '../../Add-on/SendCADFileOnKF';
import { app } from '../../ApplicationServices/Application';
import { CommandNames } from '../../Common/CommandNames';
@ -28,6 +30,7 @@ import { userConfigStore } from '../Store/UserConfigStore';
import { BoardModalType } from "./Board/BoardModalType";
import { ChatButton, IsOpenChat } from './ChatButton';
import { AppConfirm } from './Common/Confirm';
import { SwitchServerStore } from './Modal/SwitchServerStore';
import { SettingPanel } from './SettingPanel/SettingPanel';
import SoucePanel from './SourceManage/SoucePanel';
import { AppToaster } from './Toaster';
@ -244,6 +247,7 @@ export class TopPanel extends React.Component<{ store?: TopPanelStore; }, {}>
@observer
export class DownPanel extends React.Component<{ store: DownPanelStore; }, {}>
{
@observable showHideSyncEnable = false; //显隐同步显示
rStore: RightPanelStore = RightPanelStore.GetInstance();
private downStore = DownPanelStore.GetInstance() as DownPanelStore;
private handleChange = async (e: React.FormEvent<HTMLInputElement>) =>
@ -380,8 +384,11 @@ export class DownPanel extends React.Component<{ store: DownPanelStore; }, {}>
else if (ent instanceof PointLight)
return LightDataModeType.P;
}
componentDidMount()
componentDidMount(): void
{
let gws = SwitchServerStore.GetInstance()._gangplankWs;
end(gws, gws.OnLinkEvent, () => { this.showHideSyncEnable = gws.IsLink ? true : false; });
}
render()
{
@ -553,6 +560,21 @@ export class DownPanel extends React.Component<{ store: DownPanelStore; }, {}>
>
<LightsMenu GetLightType={this.GetLightType} />
</Switch>
{
userConfig.synchronousEnable && this.showHideSyncEnable &&
<Tooltip
content="CAD实体隐藏显示时,渲染器也会跟着隐藏显示"
position={Position.TOP}
><Switch
checked={this.downStore.showHideSync}
label="显隐同步"
style={switchStyle}
alignIndicator={Alignment.RIGHT}
data-key="showHideSync"
onChange={this.handleChange}
/>
</Tooltip>
}
</div>
</div>
);

@ -155,13 +155,14 @@ export class DownPanelStore
@observable useAxis: boolean = true;
@observable isSmallScreen: boolean;
@observable isLeftToolBarShow: boolean = true;//
@observable isLeftToolBarShow: boolean = true;
@observable isTopToolBarShow: boolean = true;
@observable isBottomToolBarShow: boolean = true;
//新增另一组配置用来控制在不同屏幕大小设备下的显示隐藏 (小屏模式下用以下配置)
@observable isLeftToolBarShowMin: boolean = false;
@observable isTopToolBarShowMin: boolean = false;//
@observable isTopToolBarShowMin: boolean = false;
@observable isBottomToolBarShowMin: boolean = false;
@observable showHideSync: boolean = false; //显隐同步
private timeId;
private constructor()
{
@ -231,6 +232,7 @@ export class DownPanelStore
snapData: this.snapData.map(d => d.enable),
fontName: this.fontName,
lightsData: this.lightsData.map(l => l.enable),
showHideSync: this.showHideSync,
};
}
async Upload()
@ -311,6 +313,7 @@ export class DownPanelStore
}
this.SetSnapMode();
this.showType = (this.isSmallScreen ? !this.isLeftToolBarShowMin : !this.isLeftToolBarShow) ? this.showType ^ ToolBarType.lefttoolbar : this.showType | ToolBarType.lefttoolbar;
this.showHideSync = config.showHideSync ?? false;
}
toggleLeftToolBarShow()

Loading…
Cancel
Save