diff --git a/src/Add-on/HideSelected.ts b/src/Add-on/HideSelected.ts index 14da32215..7cabcbd4f 100644 --- a/src/Add-on/HideSelected.ts +++ b/src/Add-on/HideSelected.ts @@ -1,6 +1,8 @@ import { Command } from "../Editor/CommandMachine"; import { app } from "../ApplicationServices/Application"; import { Light } from "../DatabaseServices/Lights/Light"; +import { Board } from "../DatabaseServices/Entity/Board"; +import { BoardOpenDir } from "../UI/Store/BoardInterface"; export class Command_HideSelected implements Command { @@ -46,3 +48,25 @@ export class Command_HideUnselected implements Command app.Editor.Prompt("没有未选中的实体,隐藏失败!"); } } +export class Command_ShowAllDoor implements Command +{ + async exec() + { + app.Database.ModelSpace.Entitys.forEach(o => + { + if (o instanceof Board && o.OpenDir !== BoardOpenDir.None) + o.Visible = true; + }); + } +} +export class Command_HideAllDoor implements Command +{ + async exec() + { + app.Database.ModelSpace.Entitys.forEach(o => + { + if (o instanceof Board && o.OpenDir !== BoardOpenDir.None) + o.Visible = false; + }); + } +} diff --git a/src/Editor/CommandRegister.ts b/src/Editor/CommandRegister.ts index 94f310d19..16f1c5698 100644 --- a/src/Editor/CommandRegister.ts +++ b/src/Editor/CommandRegister.ts @@ -88,7 +88,7 @@ import { Command_ExportData } from "../Add-on/ExportData"; import { Command_Extend } from "../Add-on/Extends"; import { CommandFillet } from "../Add-on/Fillet"; import { Command_Group } from "../Add-on/Group"; -import { Command_HideSelected, Command_HideUnselected, Command_ShowAll } from "../Add-on/HideSelected"; +import { Command_HideSelected, Command_HideUnselected, Command_ShowAll, Command_ShowAllDoor, Command_HideAllDoor } from "../Add-on/HideSelected"; import { Command_Insert } from "../Add-on/Insert"; import { Command_INsTest } from "../Add-on/instest"; import { Command_Join } from "../Add-on/Join"; @@ -453,6 +453,8 @@ export function registerCommand() commandMachine.RegisterCommand("testw", new Command_TestTape()); commandMachine.RegisterCommand("showknifeMg", new ShowKinfeManageModal()); + commandMachine.RegisterCommand("showdoors", new Command_ShowAllDoor()); + commandMachine.RegisterCommand("hidedoors", new Command_HideAllDoor()); RegistCustomCommand(); } diff --git a/src/Editor/ContextMenu.ts b/src/Editor/ContextMenu.ts index 030131fa6..543ec22eb 100644 --- a/src/Editor/ContextMenu.ts +++ b/src/Editor/ContextMenu.ts @@ -17,8 +17,10 @@ const KeyWordCommandMap: Map = new Map(Object.entries({ "1": "HS", "2": "HUS", "3": "SHOW", - "4": "JD", - "5": "SD", + "4": "SHOWDOORS", + "5": "HIDEDOORS", + "6": "JD", + "7": "SD", "R": "REDO", "U": "U", @@ -151,8 +153,8 @@ export class ContextMenuServices implements EditorService { if (selects[0] instanceof Board) menuKeywords.push(...[ - { key: "4", msg: `加点` }, - { key: "5", msg: `删点` }, + { key: "6", msg: `加点` }, + { key: "7", msg: `删点` }, ]); if (selects[0].Template && selects[0].Template.Object) { @@ -184,7 +186,10 @@ export class ContextMenuServices implements EditorService children: [{ key: "1", msg: `隐藏选中` }, { key: "2", msg: `隐藏未选中` }, - { key: "3", msg: `显示所有` },] + { key: "3", msg: `显示所有` }, + { key: "4", msg: `显示门板` }, + { key: "5", msg: `隐藏门板` }, + ] }, { key: "U", msg: `放弃`, disable: lastCmd === "help" }, { key: "R", msg: `重做`, disable: lastCmd === "help" },