|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
import { Vector3 } from 'three';
|
|
|
|
|
|
|
|
|
|
import { end } from 'xaop';
|
|
|
|
|
import { app } from '../../ApplicationServices/Application';
|
|
|
|
|
import { midPoint, polar, midPtCir } from '../../Geometry/GeUtils';
|
|
|
|
|
import { midPoint, midPtCir, polar } from '../../Geometry/GeUtils';
|
|
|
|
|
import { AngleDynamicInput } from './AngleDynamicInput';
|
|
|
|
|
import { DynamicInputManage } from './DynamicInputManage';
|
|
|
|
|
import { PromptBlock } from './PromptBlock';
|
|
|
|
@ -15,16 +15,42 @@ import { RealDynamicInput } from './RealDynamicInput';
|
|
|
|
|
*/
|
|
|
|
|
export class GetPointPromptBlock extends PromptBlock
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
private pointValueDynInput: RealDynamicInput[] = [];
|
|
|
|
|
private relativeSpan: HTMLSpanElement;
|
|
|
|
|
|
|
|
|
|
//注册的注入函数
|
|
|
|
|
private regFunctions: Function[] = [];
|
|
|
|
|
constructor(dynamicInputManage: DynamicInputManage)
|
|
|
|
|
{
|
|
|
|
|
super(dynamicInputManage);
|
|
|
|
|
//相对输入模式下显示的`@`
|
|
|
|
|
this.relativeSpan = document.createElement("span");
|
|
|
|
|
this.relativeSpan.innerText = "@";
|
|
|
|
|
this.relativeSpan.style.cssText = `
|
|
|
|
|
display:none;
|
|
|
|
|
background:#999;
|
|
|
|
|
color:#000;
|
|
|
|
|
border:3px solid transparent;`
|
|
|
|
|
|
|
|
|
|
this.promptContainer.appendChild(this.relativeSpan);
|
|
|
|
|
|
|
|
|
|
this.pointValueDynInput.push(
|
|
|
|
|
new RealDynamicInput(this.promptContainer),
|
|
|
|
|
new RealDynamicInput(this.promptContainer),
|
|
|
|
|
new RealDynamicInput(this.promptContainer)
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
//注入用户想切换成相对输入的事件.
|
|
|
|
|
this.pointValueDynInput.forEach(dyn =>
|
|
|
|
|
{
|
|
|
|
|
this.regFunctions.push(
|
|
|
|
|
end(dyn, dyn.OnToggleRelativeEvent, () =>
|
|
|
|
|
{
|
|
|
|
|
this.Relative = !this.Relative;
|
|
|
|
|
})
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.pointValueDynInput.forEach(o =>
|
|
|
|
|
{
|
|
|
|
|
this.AddDynamicInput(o);
|
|
|
|
@ -33,6 +59,16 @@ export class GetPointPromptBlock extends PromptBlock
|
|
|
|
|
dynamicInputManage.FocusIndex = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//设置相对坐标模式
|
|
|
|
|
set Relative(b)
|
|
|
|
|
{
|
|
|
|
|
this.relativeSpan.style.display = b ? "inline-block" : "none";
|
|
|
|
|
}
|
|
|
|
|
get Relative()
|
|
|
|
|
{
|
|
|
|
|
return this.relativeSpan.style.display === "inline-block";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set Value(v: Vector3)
|
|
|
|
|
{
|
|
|
|
|
if (this.dynamicInputManage.IsInputing) return;
|
|
|
|
@ -46,6 +82,14 @@ export class GetPointPromptBlock extends PromptBlock
|
|
|
|
|
if (!arr.some(n => isNaN(n)))
|
|
|
|
|
return new Vector3().fromArray(arr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Destroy()
|
|
|
|
|
{
|
|
|
|
|
super.Destroy();
|
|
|
|
|
|
|
|
|
|
this.regFunctions.forEach(f => f());
|
|
|
|
|
this.regFunctions.length = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|