|
|
@ -22,11 +22,11 @@ import { PromptEntityResult, PromptStatus } from './PromptResult';
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
export class GetEntityServices implements EditorService
|
|
|
|
export class GetEntityServices implements EditorService
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_Editor: Editor;
|
|
|
|
_Editor: Editor;
|
|
|
|
private m_Viewer: Viewer;
|
|
|
|
private m_Viewer: Viewer;
|
|
|
|
constructor(ed: Editor)
|
|
|
|
constructor(ed: Editor)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.m_Editor = ed;
|
|
|
|
this._Editor = ed;
|
|
|
|
this.m_Viewer = ed.m_App.m_Viewer;
|
|
|
|
this.m_Viewer = ed.m_App.m_Viewer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
IsReady: boolean = false;
|
|
|
|
IsReady: boolean = false;
|
|
|
@ -41,22 +41,22 @@ export class GetEntityServices implements EditorService
|
|
|
|
|
|
|
|
|
|
|
|
prompt = prompt || {};
|
|
|
|
prompt = prompt || {};
|
|
|
|
this.prompt = prompt;
|
|
|
|
this.prompt = prompt;
|
|
|
|
this.m_Editor.m_InputState |= InputState.Entsel;
|
|
|
|
this._Editor.m_InputState |= InputState.Entsel;
|
|
|
|
|
|
|
|
|
|
|
|
if (!prompt.IsSelect)
|
|
|
|
if (!prompt.IsSelect)
|
|
|
|
this.m_Editor.m_SelectCtrl.Cancel();
|
|
|
|
this._Editor.m_SelectCtrl.Cancel();
|
|
|
|
|
|
|
|
|
|
|
|
//光标变换
|
|
|
|
//光标变换
|
|
|
|
this.m_Viewer.m_PreViewer.Cursor.Mode = CursorMode.GetEntity;
|
|
|
|
this.m_Viewer.m_PreViewer.Cursor.Mode = CursorMode.GetEntity;
|
|
|
|
|
|
|
|
|
|
|
|
let mouseCtrl = this.m_Editor.m_MouseCtrl;
|
|
|
|
let mouseCtrl = this._Editor.m_MouseCtrl;
|
|
|
|
//鼠标移动
|
|
|
|
//鼠标移动
|
|
|
|
if (prompt.Callback)
|
|
|
|
if (prompt.Callback)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
prompt.Callback(this.HandleMouseMove());
|
|
|
|
prompt.Callback(this.PickEntity());
|
|
|
|
this.removeCalls.push(
|
|
|
|
this.removeCalls.push(
|
|
|
|
end(mouseCtrl, mouseCtrl.onMouseMove,
|
|
|
|
end(mouseCtrl, mouseCtrl.onMouseMove,
|
|
|
|
() => { prompt.Callback(this.HandleMouseMove()) }
|
|
|
|
() => { prompt.Callback(this.PickEntity()) }
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -106,7 +106,7 @@ export class GetEntityServices implements EditorService
|
|
|
|
}
|
|
|
|
}
|
|
|
|
initHandleInput(prompt: GetEntityPrompt)
|
|
|
|
initHandleInput(prompt: GetEntityPrompt)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.removeCalls.push(end(this.m_Editor, this.m_Editor.InputEvent, (input: string) =>
|
|
|
|
this.removeCalls.push(end(this._Editor, this._Editor.InputEvent, (input: string) =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (prompt.KeyWordList)
|
|
|
|
if (prompt.KeyWordList)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -130,7 +130,7 @@ export class GetEntityServices implements EditorService
|
|
|
|
initHandleKeyDown()
|
|
|
|
initHandleKeyDown()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.removeCalls.push(
|
|
|
|
this.removeCalls.push(
|
|
|
|
end(this.m_Editor.m_KeyCtrl, this.m_Editor.m_KeyCtrl.OnKeyDown, (e: KeyboardEvent) =>
|
|
|
|
end(this._Editor.m_KeyCtrl, this._Editor.m_KeyCtrl.OnKeyDown, (e: KeyboardEvent) =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
switch (e.keyCode as KeyBoard)
|
|
|
|
switch (e.keyCode as KeyBoard)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -153,7 +153,11 @@ export class GetEntityServices implements EditorService
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case MouseKey.Left:
|
|
|
|
case MouseKey.Left:
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.Retun(this.HandleMouseMove());
|
|
|
|
let res = this.PickEntity();
|
|
|
|
|
|
|
|
if (!this.prompt.NotNone || res.Status === PromptStatus.OK)
|
|
|
|
|
|
|
|
this.Retun(this.PickEntity());
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
this._Editor.Prompt("禁止空选择!");
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case MouseKey.Right:
|
|
|
|
case MouseKey.Right:
|
|
|
@ -179,28 +183,31 @@ export class GetEntityServices implements EditorService
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
dyn.SetPostion(mouseCtrl.m_CurMousePointVCS);
|
|
|
|
dyn.SetPostion(mouseCtrl.m_CurMousePointVCS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private HandleMouseMove(): PromptEntityResult
|
|
|
|
|
|
|
|
|
|
|
|
private PickEntity(): PromptEntityResult
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let pickObj = PointPick(this.m_Editor.m_MouseCtrl.m_CurMousePointVCS, this.m_Viewer, this.prompt.Filter)[0];
|
|
|
|
let pickObj = PointPick(this._Editor.m_MouseCtrl.m_CurMousePointVCS, this.m_Viewer, this.prompt.Filter)[0];
|
|
|
|
let ret = new PromptEntityResult();
|
|
|
|
let ret = new PromptEntityResult();
|
|
|
|
if (pickObj && IsEntity(pickObj))
|
|
|
|
if (pickObj && IsEntity(pickObj))
|
|
|
|
ret.Entity = GetEntity(pickObj);
|
|
|
|
ret.Entity = GetEntity(pickObj);
|
|
|
|
ret.Object = pickObj;
|
|
|
|
ret.Object = pickObj;
|
|
|
|
ret.Point = this.m_Editor.m_MouseCtrl.m_CurMousePointWCS.clone();
|
|
|
|
ret.Point = this._Editor.m_MouseCtrl.m_CurMousePointWCS.clone();
|
|
|
|
ret.Status = ret.Entity ? PromptStatus.OK : PromptStatus.None;
|
|
|
|
ret.Status = ret.Entity ? PromptStatus.OK : PromptStatus.None;
|
|
|
|
return ret;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//还原状态
|
|
|
|
//还原状态
|
|
|
|
private RestState()
|
|
|
|
private RestState()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.IsReady = false;
|
|
|
|
this.IsReady = false;
|
|
|
|
this.prompt = undefined;
|
|
|
|
this.prompt = undefined;
|
|
|
|
|
|
|
|
|
|
|
|
this.m_Editor.m_InputState &= ~InputState.Entsel;
|
|
|
|
this._Editor.m_InputState &= ~InputState.Entsel;
|
|
|
|
this.m_Viewer.m_PreViewer.Cursor.Mode = CursorMode.None;
|
|
|
|
this.m_Viewer.m_PreViewer.Cursor.Mode = CursorMode.None;
|
|
|
|
this.removeCalls.forEach(f => f());
|
|
|
|
this.removeCalls.forEach(f => f());
|
|
|
|
this.removeCalls.length = 0;
|
|
|
|
this.removeCalls.length = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Retun(result: PromptEntityResult)
|
|
|
|
private Retun(result: PromptEntityResult)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!this.m_promisResolve)
|
|
|
|
if (!this.m_promisResolve)
|
|
|
|