From 7079fc1af52d574243da2e679a5680fec69b3b99 Mon Sep 17 00:00:00 2001 From: yupeng_dyp Date: Thu, 13 Nov 2025 14:33:36 +0000 Subject: [PATCH] =?UTF-8?q?update=20src/CAD/IFox.CAD.Shared/ExtensionMetho?= =?UTF-8?q?d/EditorEx.cs.=20=E4=BF=AE=E5=A4=8D=E5=9B=A0=E8=A7=82=E5=AF=9F?= =?UTF-8?q?=E5=9D=90=E6=A0=87=E7=B3=BB=E7=9A=84=E5=8E=9F=E5=9B=A0=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E8=A7=86=E5=9B=BE=E7=BC=A9=E6=94=BE=E5=90=8E=E4=B8=AD?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E4=B8=8D=E5=AF=B9=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yupeng_dyp --- src/CAD/IFox.CAD.Shared/ExtensionMethod/EditorEx.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/CAD/IFox.CAD.Shared/ExtensionMethod/EditorEx.cs b/src/CAD/IFox.CAD.Shared/ExtensionMethod/EditorEx.cs index d9a92b0..482fd82 100644 --- a/src/CAD/IFox.CAD.Shared/ExtensionMethod/EditorEx.cs +++ b/src/CAD/IFox.CAD.Shared/ExtensionMethod/EditorEx.cs @@ -868,8 +868,15 @@ public static void ZoomWindow(this Editor ed, Point3d lpt, Point3d rpt, double o Extents3d extents = new(); extents.AddPoint(lpt); extents.AddPoint(rpt); - rpt = extents.MaxPoint + new Vector3d(offsetDist, offsetDist, 0); - lpt = extents.MinPoint - new Vector3d(offsetDist, offsetDist, 0); + + // 获取世界坐标系到观察坐标系的矩阵变换 + using ViewTableRecord view = ed.GetCurrentView(); + Matrix3d worldToEyeMat = Matrix3d.WorldToPlane(view.ViewDirection) * + Matrix3d.Displacement(view.Target.GetAsVector().Negate()) * + Matrix3d.Rotation(view.ViewTwist, view.ViewDirection, view.Target); + + rpt = (extents.MaxPoint + new Vector3d(offsetDist, offsetDist, 0)).TransformBy(worldToEyeMat); + lpt = (extents.MinPoint - new Vector3d(offsetDist, offsetDist, 0)).TransformBy(worldToEyeMat); Vector3d ver = rpt - lpt; ed.Zoom(lpt + ver / 2, ver.X, ver.Y); } -- Gitee