更新当前点的更新注入函数,现在只会计算一次当前点的捕捉

pull/2/head
ChenX 7 years ago
parent 4884fb92cd
commit e603d4d253

@ -1,13 +1,14 @@
import * as THREE from 'three';
import { Vector3 } from 'three';
import * as xaop from 'xaop';
import { app } from '../ApplicationServices/Application';
import { GetPointPrompt, InputState } from '../Common/InputState';
import { MouseKey, KeyBoard } from '../Common/KeyEnum';
import { polar, equaln, fixAngle, Intersect } from '../Geometry/GeUtils';
import { PromptPointResult, PromptStatus } from './PromptResult';
import { GetPointPromptBlock } from '../UI/DynamicPrompt/GetPointPromptBlock';
import { KeyBoard, MouseKey } from '../Common/KeyEnum';
import { equaln, fixAngle, Intersect, polar } from '../Geometry/GeUtils';
import { DynamicInputManage } from '../UI/DynamicPrompt/DynamicInputManage';
import { GetPointPromptBlock } from '../UI/DynamicPrompt/GetPointPromptBlock';
import { PromptPointResult, PromptStatus } from './PromptResult';
/**
* ,Editor.
@ -27,6 +28,7 @@ export class GetPointServices
this.initAppState();
//点捕捉
this.initPtSnap();
this.initUpdateCurPoint();
//消息显示.
this.initPrompt(prompt);
//动态输入框.
@ -49,6 +51,20 @@ export class GetPointServices
});
}
//更新当前点事件,统一使用该方法注入其他服务的更新(aop在此方法中注入)
UpdateCurPointEvent(pt: Vector3)
{
}
//初始化更新当前点的事件
private initUpdateCurPoint()
{
xaop.end(app.m_Editor.m_MouseCtrl,
app.m_Editor.m_MouseCtrl.onMouseMove,
() => this.UpdateCurPointEvent(this.GetNowPoint())
)
}
private initHandleKeyDown()
{
this.removeCalls.push(xaop.begin(app.m_Editor.m_KeyCtrl, app.m_Editor.m_KeyCtrl.OnKeyDown, (e: KeyboardEvent) =>
@ -73,9 +89,8 @@ export class GetPointServices
{
if (prompt.Callback)
{
this.removeCalls.push(xaop.end(app.m_Editor.m_MouseCtrl, app.m_Editor.m_MouseCtrl.onMouseMove, () =>
this.removeCalls.push(xaop.end(this, this.UpdateCurPointEvent, (p: Vector3) =>
{
let p = this.GetNowPoint();
prompt.Callback(p);
app.m_Editor.UpdateScreen();
}));
@ -99,9 +114,9 @@ export class GetPointServices
this.removeCalls.push(() =>
{
preView.Scene.remove(line);
}, xaop.end(app.m_Editor.m_MouseCtrl, app.m_Editor.m_MouseCtrl.onMouseMove, () =>
}, xaop.end(this, this.UpdateCurPointEvent, (p: Vector3) =>
{
let endP = this.GetNowPoint();
let endP = p.clone();
app.m_Viewer.WorldToScreen(endP);
preView.ScreenPointToViewerPoint(endP);
let startP = prompt.BasePoint.clone();
@ -193,10 +208,10 @@ export class GetPointServices
{
dynPrompt.Destroy();
});
this.removeCalls.push(xaop.end(app.m_Editor.m_MouseCtrl, app.m_Editor.m_MouseCtrl.onMouseMove, () =>
this.removeCalls.push(xaop.end(this, this.UpdateCurPointEvent, (p) =>
{
dynPrompt.SetPostion(app.m_Editor.m_MouseCtrl.m_CurMousePointVCS);
dynPrompt.Value = this.GetNowPoint();
dynPrompt.Value = p;
}));
//处理动态输入
let dynManage = DynamicInputManage.GetManage();
@ -502,7 +517,7 @@ export class GetPointServices
}
}
testSnap();
let removeCall = xaop.end(app.m_Editor.m_MouseCtrl, app.m_Editor.m_MouseCtrl.onMouseMove, testSnap);
let removeCall = xaop.end(this, this.UpdateCurPointEvent, testSnap);
this.removeCalls.push(() =>
{
removeCall();

Loading…
Cancel
Save