修复:删除加工组没有历史记录,且无法撤销

pull/1504/MERGE
ChenX 3 years ago
parent 103c262aa7
commit 44ee913c03

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`EdgeGeometry生成 1`] = `164`; exports[`EdgeGeometry生成 1`] = `168`;
exports[`EdgeGeometry生成 2`] = `410`; exports[`EdgeGeometry生成 2`] = `410`;

@ -6,6 +6,7 @@ import { userConfigStore } from "../UI/Store/UserConfigStore";
export class Command_ShowProcessingGroupModal2 implements Command export class Command_ShowProcessingGroupModal2 implements Command
{ {
NoHistory = true;//呼出时,我们没有任何的操作记录
async exec() async exec()
{ {
let store = ProcessingGroupModalStore.GetInstance() as ProcessingGroupModalStore; let store = ProcessingGroupModalStore.GetInstance() as ProcessingGroupModalStore;

@ -12,3 +12,7 @@ export function Log(message?: any, ...optionalParams: any[]): void
export const LogEnable = { export const LogEnable = {
Display: false Display: false
}; };
export const ReportErrorWrap = {
ReportError: undefined
};

@ -1,4 +1,4 @@
import { LogEnable } from '../Common/Log'; import { LogEnable, ReportErrorWrap } from '../Common/Log';
import { Intent, Toaster } from '../Common/Toaster'; import { Intent, Toaster } from '../Common/Toaster';
import { CommandState } from '../Editor/CommandState'; import { CommandState } from '../Editor/CommandState';
import { Factory } from './CADFactory'; import { Factory } from './CADFactory';
@ -75,6 +75,17 @@ export class HistoricManage extends CADObject
console.warn("未标记命令!"); 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) if (this._SignalCommandHistory && CommandState.CommandIng)
return this._SignalCommandHistory.UndoData; return this._SignalCommandHistory.UndoData;
else else

@ -62,9 +62,5 @@ export class ProcessingGroupRecord extends SymbolTableRecord
for (let id of this.Objects) for (let id of this.Objects)
file.WriteObjectId(id); file.WriteObjectId(id);
} }
//局部撤销
ApplyPartialUndo(undoData: CADObject)
{
}
//#endregion //#endregion
} }

@ -588,68 +588,72 @@ export class ProcessingGroupModal extends React.Component<{ store: ProcessingGro
//确认删除 //确认删除
private DelAlertConfirm = () => private DelAlertConfirm = () =>
{ {
//为了保持节点展开 删除完毕后将父节点选中 CommandWrap(() =>
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)
{ {
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) 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)
{ {
if (g.IsErase) this.DelGroup(g);
continue; needSelectedCategory.push(g.Name);
if (g.Name === c)
this.DelGroup(g);
} }
} this.props.store.selectedGroupSet.clear();
//检查组类别下的模块加工组 //删除组类别
for (let ndpg of this.props.store.tempPgs) for (let c of this.props.store.selectedRightNodeSet)
{
let title = ndpg.nodeName.match(/(?<=>)(.*)/g)[0].trim();
if (this.props.store.selectedRightNodeSet.has(title))
{ {
AppToaster.show({ for (let g of app.Database.ProcessingGroupTable.Objects)
message: `加工组${ndpg.nodeName}跟随模块生成,无法删除!`, {
intent: Intent.WARNING, if (g.IsErase)
timeout: 1000, 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) for (let nd of this.props.store.selectedTempPgs)
{ {
let title = nd.nodeName.match(/(?<=>)(.*)/g)[0].trim(); let title = nd.nodeName.match(/(?<=>)(.*)/g)[0].trim();
if (!this.props.store.selectedRightNodeSet.has(title)) if (!this.props.store.selectedRightNodeSet.has(title))
AppToaster.show({ AppToaster.show({
message: `加工组${nd.nodeName}跟随模块生成,无法删除!`, message: `加工组${nd.nodeName}跟随模块生成,无法删除!`,
intent: Intent.WARNING, intent: Intent.WARNING,
timeout: 1000, timeout: 1000,
}); });
} }
this.props.store.selectedTempPgs = []; this.props.store.selectedTempPgs = [];
this.props.store.selectedRightNodeSet.clear(); this.props.store.selectedRightNodeSet.clear();
for (let c of needSelectedCategory) for (let c of needSelectedCategory)
this.props.store.selectedRightNodeSet.add(c); this.props.store.selectedRightNodeSet.add(c);
this.setState({ nodes: this.parseNodes(), canAlertOpen1: false }); this.setState({ nodes: this.parseNodes(), canAlertOpen1: false });
}, "删除加工组");
}; };
//使选中的实体亮显 //使选中的实体亮显
private ShowGroups = () => private ShowGroups = () =>

@ -1,8 +1,8 @@
import { Intent } from '@blueprintjs/core'; import { Intent } from '@blueprintjs/core';
import hotkeys from 'hotkeys-js'; import hotkeys from 'hotkeys-js';
import { Cache, Layers, Object3D } from 'three'; import { Cache, Layers, Object3D } from 'three';
import { ErrorMonitoring } from './Common/ErrorMonitoring'; import { ErrorMonitoring, ReportError } from './Common/ErrorMonitoring';
import { LogEnable } from './Common/Log'; import { LogEnable, ReportErrorWrap } from './Common/Log';
import { copyTextToClipboard } from './Common/Utils'; import { copyTextToClipboard } from './Common/Utils';
import { ExtrudeConfig } from './DatabaseServices/Entity/ExtrudeConfig'; import { ExtrudeConfig } from './DatabaseServices/Entity/ExtrudeConfig';
import { AppToaster } from './UI/Components/Toaster'; import { AppToaster } from './UI/Components/Toaster';
@ -187,6 +187,8 @@ window.onload = function ()
LogEnable.Display = true; LogEnable.Display = true;
ReportErrorWrap.ReportError = ReportError;
let searchParams = new URLSearchParams(location.search); let searchParams = new URLSearchParams(location.search);
if (searchParams.has("disablerefcut")) if (searchParams.has("disablerefcut"))

Loading…
Cancel
Save