|
|
|
@ -6,6 +6,7 @@ import { KeyBoard } from '../../Common/KeyEnum';
|
|
|
|
|
import { ModalState, BoardOption, BehindBoardOption, BehindHeightPositon, BrRelativePos, LayerBoardOption, LayerNailOption, VerticalBoardOption, TBBoardOption, SingleBoardOption, ClosingStripOption, StripType } from './BoardInterface';
|
|
|
|
|
import { BoardType } from '../../DatabaseServices/Board';
|
|
|
|
|
import { configOption } from '../Components/Board/BoardModal';
|
|
|
|
|
import { DrawBoardServer } from '../../Add-on/DrawBoard/DrawBoardServer';
|
|
|
|
|
|
|
|
|
|
export class BoardStore
|
|
|
|
|
{
|
|
|
|
@ -13,40 +14,47 @@ export class BoardStore
|
|
|
|
|
name: string;
|
|
|
|
|
m_BoardOption: BoardOption;
|
|
|
|
|
title: string;
|
|
|
|
|
cmdType: string;
|
|
|
|
|
//事件
|
|
|
|
|
private events: Function[] = [];
|
|
|
|
|
constructor()
|
|
|
|
|
{
|
|
|
|
|
this.registerEvent();
|
|
|
|
|
}
|
|
|
|
|
//是否连续绘制
|
|
|
|
|
registerEvent()
|
|
|
|
|
{
|
|
|
|
|
this.events.push(
|
|
|
|
|
xaop.end(app.m_Editor.m_ModalManage, app.m_Editor.m_ModalManage.OnKeyDown, (e: KeyboardEvent) =>
|
|
|
|
|
xaop.end(app.m_Editor.m_ModalManage, app.m_Editor.m_ModalManage.OnKeyDown, (e: KeyboardEvent) =>
|
|
|
|
|
{
|
|
|
|
|
if (e.keyCode === KeyBoard.Enter || e.keyCode === KeyBoard.Space)
|
|
|
|
|
{
|
|
|
|
|
if (e.keyCode === KeyBoard.Enter || e.keyCode === KeyBoard.Space)
|
|
|
|
|
{
|
|
|
|
|
this.OnOk(ModalState.Ok, this.title !== "收口条");
|
|
|
|
|
}
|
|
|
|
|
else if (e.keyCode === KeyBoard.Escape)
|
|
|
|
|
{
|
|
|
|
|
this.OnOk(ModalState.Cancel);
|
|
|
|
|
}
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
})
|
|
|
|
|
)
|
|
|
|
|
console.log("回车");
|
|
|
|
|
this.OnOk(ModalState.Ok, this.title !== "收口条");
|
|
|
|
|
}
|
|
|
|
|
else if (e.keyCode === KeyBoard.Escape)
|
|
|
|
|
{
|
|
|
|
|
this.OnOk(ModalState.Cancel);
|
|
|
|
|
}
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
GetBoardOption()
|
|
|
|
|
{
|
|
|
|
|
this.registerEvent();
|
|
|
|
|
return new Promise<number>((res) =>
|
|
|
|
|
{
|
|
|
|
|
this.m_PromisRes = res;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
OnOk(state: number, isClose: boolean = true)
|
|
|
|
|
async OnOk(state: number, isClose: boolean = true)
|
|
|
|
|
{
|
|
|
|
|
this.events.forEach(f => f())
|
|
|
|
|
this.events.length = 0;
|
|
|
|
|
isClose && app.m_Editor.m_ModalManage.Clear();
|
|
|
|
|
if (this.m_PromisRes) this.m_PromisRes(state);
|
|
|
|
|
|
|
|
|
|
if (state === ModalState.Ok)
|
|
|
|
|
{
|
|
|
|
|
await DrawBoardServer.ExecDrawBoardCmd(this.cmdType)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
SaveConfig()
|
|
|
|
|
{
|
|
|
|
@ -92,6 +100,7 @@ export class SideBoardStore extends BoardStore
|
|
|
|
|
spaceSize: "836"
|
|
|
|
|
};
|
|
|
|
|
title = "左右侧板";
|
|
|
|
|
cmdType = "zyc";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class TopBottomBoardStore extends BoardStore
|
|
|
|
@ -119,6 +128,8 @@ export class TopBottomBoardStore extends BoardStore
|
|
|
|
|
footThickness: "18"
|
|
|
|
|
};
|
|
|
|
|
title = "顶底板";
|
|
|
|
|
cmdType = "dd";
|
|
|
|
|
|
|
|
|
|
SaveConfig()
|
|
|
|
|
{
|
|
|
|
|
let newConfig: configOption = {};
|
|
|
|
@ -148,6 +159,8 @@ export class TopBottomBoardStore extends BoardStore
|
|
|
|
|
export class BehindBoardStore extends BoardStore
|
|
|
|
|
{
|
|
|
|
|
title = "背板";
|
|
|
|
|
cmdType = "bb";
|
|
|
|
|
|
|
|
|
|
@observable name = "背板";
|
|
|
|
|
@observable m_BoardOption: BehindBoardOption = {
|
|
|
|
|
leftExt: "0",
|
|
|
|
@ -171,6 +184,7 @@ export class BehindBoardStore extends BoardStore
|
|
|
|
|
export class LayerBoardStore extends BoardStore
|
|
|
|
|
{
|
|
|
|
|
title = "层板";
|
|
|
|
|
cmdType = "cb";
|
|
|
|
|
@observable name = "层板"
|
|
|
|
|
@observable m_BoardOption: LayerBoardOption = {
|
|
|
|
|
frontShrink: "0",
|
|
|
|
@ -223,6 +237,8 @@ export class LayerBoardStore extends BoardStore
|
|
|
|
|
export class VerticalBoardStore extends BoardStore
|
|
|
|
|
{
|
|
|
|
|
title = "立板";
|
|
|
|
|
cmdType = "lb";
|
|
|
|
|
|
|
|
|
|
@observable name = "立板";
|
|
|
|
|
@observable m_BoardOption: VerticalBoardOption = {
|
|
|
|
|
frontShrink: "0",
|
|
|
|
|