From 56dbe129e7f401981cb393bc67f75ea2c15f20dc Mon Sep 17 00:00:00 2001 From: ChenX Date: Wed, 12 Jul 2023 14:40:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=E6=89=93=E5=8D=B0=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E9=93=BA=E6=BB=A1,=E5=9C=A8=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E7=BA=B5=E5=90=91=E5=92=8C=E6=A8=AA=E5=90=91=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Add-on/Print.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Add-on/Print.ts b/src/Add-on/Print.ts index 594fd48bf..83c7b2b07 100644 --- a/src/Add-on/Print.ts +++ b/src/Add-on/Print.ts @@ -246,8 +246,8 @@ async function PrintImage2(ens: Entity[]) for (let url of imgUrls) { let img = new Image(); - img.style.height = "100%"; - // img.style.marginBottom = "2%"; + img.style.maxHeight = "calc(100vh - 100px)"; + img.style.maxWidth = "calc(100vw - 40px)"; img.src = url; div.append(img); } @@ -316,10 +316,14 @@ export function GetPrintWindow() display: flex; align-items: center; justify-content: center; + max-width:100vw; + max-height:100vh; } } - .centerOnPrintedPage { - height: 100%; + @media screen { + .centerOnPrintedPage { + max-width:100vw; + } } `; win.document.head.append(style); @@ -377,12 +381,14 @@ export async function GetImgElement(ens: Entity[], isReset = true) let box = GetBox(app.Viewer.Scene, true); if (box.isEmpty()) box.set(new Vector3(), new Vector3(1000 * (this.Width / this.Height), 1000, 1000)); - app.Viewer.CameraControl.ZoomExtentsBox3(box); - app.Viewer.CameraControl.Zoom(1.01); let size = box.getSize(new Vector3); size.multiplyScalar(1450 / size.x); app.Viewer.OnSize(size.x * 2, size.y * 2); + + app.Viewer.CameraControl.ZoomExtentsBox3(box); + app.Viewer.CameraControl.Zoom(1.01); + app.Viewer.Render(); let url = app.Viewer.Renderer.domElement.toDataURL("image/jpeg", 1.0);