清理初始化关键字的代码

pull/27/head
ChenX 7 years ago
parent cea0df4d0e
commit eb1e32d946

@ -28,7 +28,7 @@ export interface KeyWord
msg: string;
key: string;
}
interface GetAnyPrompt
export interface GetAnyPrompt
{
Msg?: string
KeyWordList?: KeyWord[]

@ -3,13 +3,14 @@ import { end } from 'xaop';
import { GetEntityPrompt, InputState } from '../Common/InputState';
import { KeyBoard, MouseKey } from '../Common/KeyEnum';
import { Entity } from '../DatabaseServices/Entity';
import { Viewer } from '../GraphicsSystem/Viewer';
import { DynamicInputManage } from '../UI/DynamicPrompt/DynamicInputManage';
import { PromptBlock } from '../UI/DynamicPrompt/PromptBlock';
import { Editor, EditorService } from './Editor';
import { InitKeyWord } from './InitKeyword';
import { MouseControls } from './MouseControls';
import { PointPick } from './PointPick';
import { PromptEntityResult, PromptStatus } from './PromptResult';
import { Viewer } from '../GraphicsSystem/Viewer';
/**
*
@ -59,6 +60,9 @@ export class GetEntityServices implements EditorService
)
)
}
this.removeCalls.push(InitKeyWord(prompt));
this.removeCalls.push(
end(this.m_Editor.m_KeyCtrl, this.m_Editor.m_KeyCtrl.OnKeyDown, (e: KeyboardEvent) =>
{

@ -1,5 +1,5 @@
import { Vector3 } from 'three';
import * as THREE from 'three';
import { Vector3 } from 'three';
import * as xaop from 'xaop';
import { app } from '../ApplicationServices/Application';
@ -9,9 +9,10 @@ import { midPoint } from '../Geometry/GeUtils';
import { DynamicInputManage } from '../UI/DynamicPrompt/DynamicInputManage';
import { GetDistancePromptBlock } from '../UI/DynamicPrompt/GetDistancePromptBlock';
import { GetPoint2PromptBlock, GetPointPromptBlock } from '../UI/DynamicPrompt/GetPointPromptBlock';
import { EditorService } from './Editor';
import { InitKeyWord } from './InitKeyword';
import { PromptDistendResult, PromptPointResult, PromptStatus } from './PromptResult';
import { SnapServices } from './SnapServices';
import { EditorService } from './Editor';
/**
* ,Editor.
@ -48,7 +49,7 @@ export class GetPointServices implements EditorService
//动态输入框.
this.initDynInput(prompt);
//设置关键字
this.initKeyword(prompt);
this.removeCalls.push(InitKeyWord(prompt));
//处理用户输入
this.initHandleInput(prompt);
//如果有基点,绘制橡皮筋
@ -217,19 +218,6 @@ export class GetPointServices implements EditorService
}
}
private initKeyword(prompt: GetPointPrompt)
{
if (prompt.KeyWordList)
{
app.m_Editor.m_CommandStore.keyWordList.length = 0;
app.m_Editor.m_CommandStore.keyWordList.push(...prompt.KeyWordList);
this.removeCalls.push(() =>
{
app.m_Editor.m_CommandStore.keyWordList.length = 0;
});
}
}
//初始化动态输入框,包括处理事件
protected initDynInput(prompt: GetPointPrompt)
{

@ -0,0 +1,17 @@
import { app } from '../ApplicationServices/Application';
import { GetAnyPrompt } from '../Common/InputState';
function ClearKeyWord()
{
app.m_Editor.m_CommandStore.keyWordList.length = 0;
}
export function InitKeyWord(prompt: GetAnyPrompt)
{
if (prompt.KeyWordList)
{
app.m_Editor.m_CommandStore.keyWordList.length = 0;
app.m_Editor.m_CommandStore.keyWordList.push(...prompt.KeyWordList);
}
return ClearKeyWord;
}
Loading…
Cancel
Save