功能:在绘制直线和多段线时,支持Ctrl+Z

pull/1654/MERGE
ChenX 3 years ago
parent 67a386b9d2
commit b2a4fda50e

@ -1,3 +1,4 @@
import hotkeys from 'hotkeys-js';
import { Vector3 } from 'three';
import { app } from '../ApplicationServices/Application';
import { Arc } from '../DatabaseServices/Entity/Arc';
@ -34,6 +35,14 @@ export class DrawLine implements Command
}
}
const TempUndo = () =>
{
if (app.Editor.GetPointServices.IsReady)
app.Editor.GetPointServices.ReturnKeyword("U");//放弃
};
hotkeys("Control+Z", hotkeys.getScope(), TempUndo);
let drawLines: Line[] = [];
while (true)
{
@ -106,6 +115,8 @@ export class DrawLine implements Command
else
break;
}
hotkeys.unbind("Control+Z", hotkeys.getScope(), TempUndo);
}
}

@ -1,11 +1,12 @@
import hotkeys from 'hotkeys-js';
import { Vector2, Vector3 } from 'three';
import { app } from '../ApplicationServices/Application';
import { getCirAngleByChordAndTangent } from '../Common/CurveUtils';
import { GetPointPrompt } from "../Editor/PromptOptions";
import { Polyline } from '../DatabaseServices/Entity/Polyline';
import { PromptStatus } from '../Editor/PromptResult';
import { JigUtils } from '../Editor/JigUtils';
import { equalv3, AsVector2, AsVector3, ZeroVec } from '../Geometry/GeUtils';
import { GetPointPrompt } from "../Editor/PromptOptions";
import { PromptStatus } from '../Editor/PromptResult';
import { AsVector2, AsVector3, equalv3, ZeroVec } from '../Geometry/GeUtils';
enum PolylineModel
{
@ -34,6 +35,15 @@ export class DrawPolyline
let keywords2 = keywords.concat([{ msg: "闭合", key: "C" }]);
let nextOps: GetPointPrompt = { Msg: "请点击下一个点或", Callback, AllowNone: true };
const TempUndo = () =>
{
if (app.Editor.GetPointServices.IsReady)
app.Editor.GetPointServices.ReturnKeyword("U");//放弃
};
hotkeys("Control+Z", hotkeys.getScope(), TempUndo);
while (true)
{
let ops: GetPointPrompt;
@ -101,7 +111,9 @@ export class DrawPolyline
else
break;
}
JigUtils.End();
hotkeys.unbind("Control+Z", hotkeys.getScope(), TempUndo);
if (pl.NumberOfVertices < 2)
{
app.LayoutTool.RemoveDatabaseSpace(pl);

@ -464,7 +464,7 @@ export class GetPointServices implements EditorService
return this.ReturnResult(retValue);
}
protected ReturnKeyword(keyword: string)
ReturnKeyword(keyword: string)
{
let retValue = new PromptPointResult();
retValue.Status = PromptStatus.Keyword;

Loading…
Cancel
Save