diff --git a/__test__/Geometry/__snapshots__/EdgeGeometry.test.ts.snap b/__test__/Geometry/__snapshots__/EdgeGeometry.test.ts.snap index a0528f396..7e89ef0d7 100644 --- a/__test__/Geometry/__snapshots__/EdgeGeometry.test.ts.snap +++ b/__test__/Geometry/__snapshots__/EdgeGeometry.test.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`EdgeGeometry生成 1`] = `164`; +exports[`EdgeGeometry生成 1`] = `168`; exports[`EdgeGeometry生成 2`] = `410`; diff --git a/src/Add-on/ShowProcessingGroupModal.ts b/src/Add-on/ShowProcessingGroupModal.ts index 515d16bec..8dab0d056 100644 --- a/src/Add-on/ShowProcessingGroupModal.ts +++ b/src/Add-on/ShowProcessingGroupModal.ts @@ -6,6 +6,7 @@ import { userConfigStore } from "../UI/Store/UserConfigStore"; export class Command_ShowProcessingGroupModal2 implements Command { + NoHistory = true;//呼出时,我们没有任何的操作记录 async exec() { let store = ProcessingGroupModalStore.GetInstance() as ProcessingGroupModalStore; diff --git a/src/Common/Log.ts b/src/Common/Log.ts index 0e5d163d6..91fd7980f 100644 --- a/src/Common/Log.ts +++ b/src/Common/Log.ts @@ -12,3 +12,7 @@ export function Log(message?: any, ...optionalParams: any[]): void export const LogEnable = { Display: false }; + +export const ReportErrorWrap = { + ReportError: undefined +}; diff --git a/src/DatabaseServices/HistoricManage.ts b/src/DatabaseServices/HistoricManage.ts index cbf95fbc5..058554bf0 100644 --- a/src/DatabaseServices/HistoricManage.ts +++ b/src/DatabaseServices/HistoricManage.ts @@ -1,4 +1,4 @@ -import { LogEnable } from '../Common/Log'; +import { LogEnable, ReportErrorWrap } from '../Common/Log'; import { Intent, Toaster } from '../Common/Toaster'; import { CommandState } from '../Editor/CommandState'; import { Factory } from './CADFactory'; @@ -75,6 +75,17 @@ export class HistoricManage extends CADObject console.warn("未标记命令!"); } + if (!CommandState.CommandIng && ReportErrorWrap.ReportError) + { + ReportErrorWrap.ReportError(new Error().stack, "命令未执行中,但是却产生了错误了记录!"); + Toaster({ + message: "程序内部错误!命令未执行中,但是却产生了错误了记录! (请与我们联系,将错误报告给我们)", + timeout: 5000, + intent: Intent.DANGER, + key: "no_command_his" + }); + } + if (this._SignalCommandHistory && CommandState.CommandIng) return this._SignalCommandHistory.UndoData; else diff --git a/src/DatabaseServices/ProcessingGroup/ProcessingGroupRecord.ts b/src/DatabaseServices/ProcessingGroup/ProcessingGroupRecord.ts index d6336f3e9..157a3f972 100644 --- a/src/DatabaseServices/ProcessingGroup/ProcessingGroupRecord.ts +++ b/src/DatabaseServices/ProcessingGroup/ProcessingGroupRecord.ts @@ -62,9 +62,5 @@ export class ProcessingGroupRecord extends SymbolTableRecord for (let id of this.Objects) file.WriteObjectId(id); } - //局部撤销 - ApplyPartialUndo(undoData: CADObject) - { - } //#endregion } diff --git a/src/UI/Components/Modal/ProcessingGroupModal.tsx b/src/UI/Components/Modal/ProcessingGroupModal.tsx index 8bc0ea7ef..d5ffe898c 100644 --- a/src/UI/Components/Modal/ProcessingGroupModal.tsx +++ b/src/UI/Components/Modal/ProcessingGroupModal.tsx @@ -588,68 +588,72 @@ export class ProcessingGroupModal extends React.Component<{ store: ProcessingGro //确认删除 private DelAlertConfirm = () => { - //为了保持节点展开 删除完毕后将父节点选中 - let needSelectedCategory: string[] = []; - - //只选中左边的项时 删除左边选中的 - if (this.props.store.selectedRightNodeSet.size === 0 && this.props.store.selectedGroupSet.size === 0 && this.props.store.selectedObjectSet.size === 0 && this.props.store.selectedLeftNodeSet.size > 0) + CommandWrap(() => { - for (let gname of this.props.store.selectedLeftNodeSet) + //为了保持节点展开 删除完毕后将父节点选中 + let needSelectedCategory: string[] = []; + + //只选中左边的项时 删除左边选中的 + if (this.props.store.selectedRightNodeSet.size === 0 && this.props.store.selectedGroupSet.size === 0 && this.props.store.selectedObjectSet.size === 0 && this.props.store.selectedLeftNodeSet.size > 0) { - this.pgCategoryMap.delete(gname); + for (let gname of this.props.store.selectedLeftNodeSet) + { + this.pgCategoryMap.delete(gname); + } + this.props.store.processGroupCategory = this.props.store.processGroupCategory.filter((g) => !this.props.store.selectedLeftNodeSet.has(g)); + this.setState({ nodes: this.parseNodes() }); + this.props.store.selectedLeftNodeSet.clear(); } - this.props.store.processGroupCategory = this.props.store.processGroupCategory.filter((g) => !this.props.store.selectedLeftNodeSet.has(g)); - this.setState({ nodes: this.parseNodes() }); - this.props.store.selectedLeftNodeSet.clear(); - } - //删除加工组 - for (let g of this.props.store.selectedGroupSet) - { - this.DelGroup(g); - needSelectedCategory.push(g.Name); - } - this.props.store.selectedGroupSet.clear(); - //删除组类别 - for (let c of this.props.store.selectedRightNodeSet) - { - for (let g of app.Database.ProcessingGroupTable.Objects) + //删除加工组 + for (let g of this.props.store.selectedGroupSet) { - if (g.IsErase) - continue; - if (g.Name === c) - this.DelGroup(g); + this.DelGroup(g); + needSelectedCategory.push(g.Name); } - } - //检查组类别下的模块加工组 - for (let ndpg of this.props.store.tempPgs) - { - let title = ndpg.nodeName.match(/(?<=>)(.*)/g)[0].trim(); - if (this.props.store.selectedRightNodeSet.has(title)) + this.props.store.selectedGroupSet.clear(); + //删除组类别 + for (let c of this.props.store.selectedRightNodeSet) { - AppToaster.show({ - message: `加工组${ndpg.nodeName}跟随模块生成,无法删除!`, - intent: Intent.WARNING, - timeout: 1000, - }); + for (let g of app.Database.ProcessingGroupTable.Objects) + { + if (g.IsErase) + continue; + if (g.Name === c) + this.DelGroup(g); + } + } + //检查组类别下的模块加工组 + for (let ndpg of this.props.store.tempPgs) + { + let title = ndpg.nodeName.match(/(?<=>)(.*)/g)[0].trim(); + if (this.props.store.selectedRightNodeSet.has(title)) + { + AppToaster.show({ + message: `加工组${ndpg.nodeName}跟随模块生成,无法删除!`, + intent: Intent.WARNING, + timeout: 1000, + }); + } } - } - for (let nd of this.props.store.selectedTempPgs) - { - let title = nd.nodeName.match(/(?<=>)(.*)/g)[0].trim(); - if (!this.props.store.selectedRightNodeSet.has(title)) - AppToaster.show({ - message: `加工组${nd.nodeName}跟随模块生成,无法删除!`, - intent: Intent.WARNING, - timeout: 1000, - }); - } - this.props.store.selectedTempPgs = []; - this.props.store.selectedRightNodeSet.clear(); - for (let c of needSelectedCategory) - this.props.store.selectedRightNodeSet.add(c); - this.setState({ nodes: this.parseNodes(), canAlertOpen1: false }); + for (let nd of this.props.store.selectedTempPgs) + { + let title = nd.nodeName.match(/(?<=>)(.*)/g)[0].trim(); + if (!this.props.store.selectedRightNodeSet.has(title)) + AppToaster.show({ + message: `加工组${nd.nodeName}跟随模块生成,无法删除!`, + intent: Intent.WARNING, + timeout: 1000, + }); + } + this.props.store.selectedTempPgs = []; + this.props.store.selectedRightNodeSet.clear(); + for (let c of needSelectedCategory) + this.props.store.selectedRightNodeSet.add(c); + this.setState({ nodes: this.parseNodes(), canAlertOpen1: false }); + + }, "删除加工组"); }; //使选中的实体亮显 private ShowGroups = () => diff --git a/src/index.tsx b/src/index.tsx index 96463bcc8..2e3745499 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,8 +1,8 @@ import { Intent } from '@blueprintjs/core'; import hotkeys from 'hotkeys-js'; import { Cache, Layers, Object3D } from 'three'; -import { ErrorMonitoring } from './Common/ErrorMonitoring'; -import { LogEnable } from './Common/Log'; +import { ErrorMonitoring, ReportError } from './Common/ErrorMonitoring'; +import { LogEnable, ReportErrorWrap } from './Common/Log'; import { copyTextToClipboard } from './Common/Utils'; import { ExtrudeConfig } from './DatabaseServices/Entity/ExtrudeConfig'; import { AppToaster } from './UI/Components/Toaster'; @@ -187,6 +187,8 @@ window.onload = function () LogEnable.Display = true; + ReportErrorWrap.ReportError = ReportError; + let searchParams = new URLSearchParams(location.search); if (searchParams.has("disablerefcut"))