mirror of https://gitee.com/cf-fz/WebCAD.git
parent
db1026bdbf
commit
25baa00f2f
@ -0,0 +1,33 @@
|
||||
import { Intent } from "@blueprintjs/core";
|
||||
import { app } from "../../ApplicationServices/Application";
|
||||
import { EBoardKeyList } from "../../Common/BoardKeyList";
|
||||
import { Board } from "../../DatabaseServices/Entity/Board";
|
||||
import { Command } from "../../Editor/CommandMachine";
|
||||
import { PromptStatus } from "../../Editor/PromptResult";
|
||||
import { AppToaster } from "../../UI/Components/Toaster";
|
||||
import { ComposingType } from "../../UI/Store/BoardInterface";
|
||||
|
||||
export class Command_ChangeBoardColorByPBFace implements Command
|
||||
{
|
||||
async exec()
|
||||
{
|
||||
AppToaster.show({
|
||||
message: "根据板件的排版面改颜色,红色=正面,反面=黄色,可翻转=绿色",
|
||||
timeout: 5000,
|
||||
intent: Intent.SUCCESS,
|
||||
}, "ChangeBoardColorByPBFace");
|
||||
|
||||
let ssRes = await app.Editor.GetSelection({ Filter: { filterTypes: [Board] }, UseSelect: true });
|
||||
if (ssRes.Status !== PromptStatus.OK) return;
|
||||
let ents = ssRes.SelectSet.SelectEntityList as Board[];
|
||||
for (let br of ents)
|
||||
{
|
||||
if (br.BoardProcessOption[EBoardKeyList.ComposingFace] === ComposingType.Positive)
|
||||
br.ColorIndex = 1;
|
||||
else if (br.BoardProcessOption[EBoardKeyList.ComposingFace] === ComposingType.Reverse)
|
||||
br.ColorIndex = 2;
|
||||
else
|
||||
br.ColorIndex = 3;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue