diff --git a/src/Add-on/Print.ts b/src/Add-on/Print.ts index a21af294a..9c7b536c9 100644 --- a/src/Add-on/Print.ts +++ b/src/Add-on/Print.ts @@ -857,7 +857,7 @@ async function PrintImage3(ens: Entity[]) export function GetPrintWindow() { - const win = window.open(); + const win = window.open('', '', 'status=1,menubar=yes,toolbar=yes'); if (!win) { app.Editor.Prompt("无法弹出新的窗口,请允许新窗口弹出!(地址栏右侧)"); @@ -977,7 +977,7 @@ export async function GetImgElement(ens: Entity[], isReset = true) f.Reset(); app.Viewer.CameraCtrl.ReadFile(f); app.Viewer.OnSize(); - app.Viewer.Render(); + app.Viewer.UpdateRender(); } let div = document.createElement("div"); diff --git a/src/Add-on/Viewport/OneKeyPrint.ts b/src/Add-on/Viewport/OneKeyPrint.ts index f023b4076..a030b3d9e 100644 --- a/src/Add-on/Viewport/OneKeyPrint.ts +++ b/src/Add-on/Viewport/OneKeyPrint.ts @@ -89,7 +89,8 @@ export class OneKeyPrint implements Command }); return; } - win.document.body.innerText = "正在生成图纸,请稍等..."; + win.document.title = "按Ctrl+P打印"; + win.document.body.innerText = "生成后请按Ctrl+P打印,正在生成图纸,请稍等..."; const frag = document.createDocumentFragment(); @@ -101,14 +102,27 @@ export class OneKeyPrint implements Command app.Viewer.CameraCtrl.WriteFile(f); let vpsbak = app.Viewer.ViewPorts; + let i = 1; + let count = framesGrounps.size; for (let [, { entitys }] of framesGrounps) { let div = await GetImgElement(entitys, false); frag.append(div); + + win.document.body.innerText = `生成后请按Ctrl+P打印,正在生成图纸(${i}/${count}),请稍等...`; + i++; } win.document.body.innerText = ""; win.document.body.append(frag); + // setTimeout(() => + // { + // // chrome90如果自动调用这个,那么卡死 + // // win.focus(); + // // win.print(); + // // win.close(); + // }, 100); + //还原视图 [app.Viewer.Scene, sceneBak] = [sceneBak, app.Viewer.Scene]; app.Viewer.Renderer.setClearColor(clearColorBak); diff --git a/src/ApplicationServices/Application.ts b/src/ApplicationServices/Application.ts index f8acceb5a..770b9a250 100644 --- a/src/ApplicationServices/Application.ts +++ b/src/ApplicationServices/Application.ts @@ -194,7 +194,7 @@ export class ApplicationService e.preventDefault(); commandMachine.ExecCommand("COMANP"); } - if (app.Editor.KeyCtrl.KeyIsDown(KeyCode.ControlLeft)) + if (app.Editor.KeyCtrl.KeyIsDown(KeyCode.ControlLeft) || app.Editor.KeyCtrl.KeyIsDown(KeyCode.ControlRight)) { if (e.code === KeyCode.KeyZ) { @@ -221,6 +221,12 @@ export class ApplicationService { commandMachine.ExecCommand(CommandNames.Save); } + else if (e.code === KeyCode.KeyP) + { + commandMachine.ExecCommand(CommandNames.OneKeyPrint); + e.preventDefault(); + e.stopPropagation(); + } else if (e.code === KeyCode.KeyE) { if (app.Editor.KeyCtrl.KeyIsDown(KeyCode.AltLeft)) diff --git a/src/Common/KeyEnum.ts b/src/Common/KeyEnum.ts index ef73bd2c0..a10ef916f 100644 --- a/src/Common/KeyEnum.ts +++ b/src/Common/KeyEnum.ts @@ -256,6 +256,7 @@ export enum KeyCode CapsLock = "CapsLock", Control = "Control", ControlLeft = "ControlLeft", + ControlRight = "ControlRight", /** * win左键 diff --git a/src/UI/Layout/ApplicationLayout.tsx b/src/UI/Layout/ApplicationLayout.tsx index dc53bc597..4a89c6e4c 100644 --- a/src/UI/Layout/ApplicationLayout.tsx +++ b/src/UI/Layout/ApplicationLayout.tsx @@ -16,7 +16,6 @@ import { ZINDEX } from '../../Common/ZIndex'; import { Entity } from '../../DatabaseServices/Entity/Entity'; import { FileServer } from '../../DatabaseServices/FileServer'; import { registerCommand } from '../../Editor/CommandRegister'; -import { SelectSetBase } from '../../Editor/SelectBase'; import { CameraControlBtn, CameraControlBtnStore } from '../Components/CameraControlButton/CameraControlBtn'; import { MainContent } from '../Components/MainContent/MainContent'; import { MaterialContainer, MaterialContainerProps } from '../Components/MaterialContainer';