优化对象被改变时产生的历史记录

pull/550/head
ChenX 5 years ago
parent 0c76233f85
commit 8e17b02061

@ -167,7 +167,7 @@ export abstract class CADObject
let undoData = this.UndoRecord(); let undoData = this.UndoRecord();
if (undoData) if (undoData)
{ {
undoData.CreateObjectHistory(this); undoData.WriteObjectSnapshoot(this);
return true; return true;
} }
return false; return false;

@ -76,16 +76,23 @@ export class CommandHistoryRecord extends CADObject
hrs.push(history); hrs.push(history);
} }
CreateObjectHistory(obj: CADObject): ObjectAllDataHistoryRecord WriteObjectSnapshoot(obj: CADObject): void
{ {
if (!obj.Id) if (!obj.Id)
{ {
console.warn("错误!CreateObjectHistory"); console.warn("错误!CreateObjectHistory");
return; return;
} }
if (this._CreateObjects.has(obj))
return;
let hrs = this.GetObjectHistoryList(obj.Id);
if (this.GetObjectAllDataRecord(hrs))
return;
let hr = new ObjectAllDataHistoryRecord(obj.Id); let hr = new ObjectAllDataHistoryRecord(obj.Id);
this.WriteObjectHistoryPath(obj, hr); hrs.push(hr);
return hr;
} }
CreateEraseHistory(obj: CADObject, isErase: boolean) CreateEraseHistory(obj: CADObject, isErase: boolean)

Loading…
Cancel
Save