From 04dae9e8fb3aa66e47264e4ae836174309041d55 Mon Sep 17 00:00:00 2001 From: ChenX Date: Tue, 2 Jul 2019 16:09:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9C=AA=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/DatabaseServices/HistoricManage.ts | 5 ++++- src/UI/Store/RightPanelStore/LightStore.ts | 11 +++++++++-- src/UI/Store/RightPanelStore/RightPanelStore.ts | 13 ++++++++++--- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/DatabaseServices/HistoricManage.ts b/src/DatabaseServices/HistoricManage.ts index fda80fa9f..ca7ed04a6 100644 --- a/src/DatabaseServices/HistoricManage.ts +++ b/src/DatabaseServices/HistoricManage.ts @@ -65,7 +65,10 @@ export class HistoricManage extends CADObject if (this.doing) return undefined; if (!this.IsNow) + { this.StartCmd(""); + console.warn("未标记命令!"); + } if (this.m_SignalCommandHistory && CommandState.CommandIng) return this.m_SignalCommandHistory.UndoData; @@ -93,7 +96,7 @@ export class HistoricManage extends CADObject this.curIndex = this.historyRecord.length - 1; if (this.m_SignalCommandHistory) - this.m_SignalCommandHistory.StartCmd(""); + this.m_SignalCommandHistory.StartCmd("sub"); } //结束当前的命令,返回是否写入历史记录 diff --git a/src/UI/Store/RightPanelStore/LightStore.ts b/src/UI/Store/RightPanelStore/LightStore.ts index 1c261bd56..2d7cf171e 100644 --- a/src/UI/Store/RightPanelStore/LightStore.ts +++ b/src/UI/Store/RightPanelStore/LightStore.ts @@ -1,5 +1,5 @@ import { autorun, observable } from "mobx"; -import { Light as TLight, Mesh, MeshPhysicalMaterial, Vector3 } from 'three'; +import { Light as TLight, Mesh, MeshPhysicalMaterial } from 'three'; import { end } from "xaop"; import { app } from "../../../ApplicationServices/Application"; import { HostApplicationServices } from "../../../ApplicationServices/HostApplicationServices"; @@ -9,6 +9,7 @@ import { AmbientLight } from "../../../DatabaseServices/Lights/AmbientLight"; import { DirectionalLight } from "../../../DatabaseServices/Lights/DirectionalLight"; import { HemisphereLight } from "../../../DatabaseServices/Lights/HemisphereLight"; import { Light } from "../../../DatabaseServices/Lights/Light"; +import { commandMachine } from "../../../Editor/CommandMachine"; export interface LightModalState { @@ -43,10 +44,13 @@ export class LightStore @observable isShowShadow = false; constructor() { + commandMachine.CommandStart("初始化灯光"); autorun(() => this.TriggerLight(this.m_AmbientLight, this.m_ShowAmbientLight)); autorun(() => this.TriggerLight(this.m_DirectionalLight, this.m_ShowDirLight)); autorun(() => this.TriggerLight(this.m_HemisphereLight, this.m_ShowHemiLight)); + commandMachine.CommandEnd(); + this.WatchLightEvent(); } private TriggerLight(lg: Light, isShow: boolean) @@ -77,6 +81,7 @@ export class LightStore } InitScene() { + commandMachine.CommandStart("初始化灯光"); this.m_ShowAmbientLight = true; this.m_AmbientLight = new AmbientLight(); this.m_ShowDirLight = false; @@ -109,6 +114,8 @@ export class LightStore { app.Database.ModelSpace.Append(this.m_AmbientLight); } + + commandMachine.CommandEnd(); } ShowShadowObject(isShow: boolean) { @@ -161,7 +168,7 @@ export class LightStore end(app.Database.ModelSpace, app.Database.ModelSpace.AppendEvent, function (ent: Entity) { lgStore.WatchLight(ent, false); - }) + }); } private WatchLight(lg: Entity, IsErase: boolean) { diff --git a/src/UI/Store/RightPanelStore/RightPanelStore.ts b/src/UI/Store/RightPanelStore/RightPanelStore.ts index dd92c74f4..6dbb1fa95 100644 --- a/src/UI/Store/RightPanelStore/RightPanelStore.ts +++ b/src/UI/Store/RightPanelStore/RightPanelStore.ts @@ -1,6 +1,5 @@ import { TabId } from "@blueprintjs/core"; import { observable, toJS } from "mobx"; -import { Singleton } from "../../../Common/Singleton"; import { Modify } from "../../../Common/TypeOperator"; import { IModeling } from "../../../DatabaseServices/Entity/Board"; import { IConfigOption } from "../../Components/Board/UserConfig"; @@ -19,7 +18,7 @@ type IUIModeiling = Modify; -export class RightPanelStore extends Singleton implements IConfigStore +export class RightPanelStore implements IConfigStore { @observable m_TabId: TabId = RightTabId.Model; @observable m_IsShow = false; @@ -30,9 +29,17 @@ export class RightPanelStore extends Singleton implements IConfigStore drillingStore = new DrillingStore(); constructor() { - super(); this.InitModelingItems(); } + + private static __instance__: RightPanelStore = undefined; + static GetInstance() + { + if (this.__instance__) return this.__instance__; + this.__instance__ = new RightPanelStore(); + return this.__instance__; + } + InitModelingItems() { this.modelingItems.length = 0;